@flatjs/evolve 1.5.12 → 1.5.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/cjs/index.js +2 -2
  2. package/package.json +5 -4
package/cjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /*! @flatjs/forge MIT @flatjs/evolve */
2
- "use strict";var e=require("@flatjs/common");var t=require("lodash");var n=require("@flatjs/mock");var r=require("babel-merge");var s=require("path");var o=require("@flatjs/forge-plugin-postcss-pixel");var i=require("cssnano");var a=require("webpack");var l=require("mini-css-extract-plugin");var c=require("os");var u=require("tty");var p=require("image-minimizer-webpack-plugin");var d=require("terser-webpack-plugin");var f=require("@pmmmwh/react-refresh-webpack-plugin");var h=require("case-sensitive-paths-webpack-plugin");var m=require("webpack-bundle-analyzer");var g=require("webpack-sources");var b=require("webpack/lib/util/extractUrlAndGlobal");var v=require("html-webpack-plugin");var y=require("webpack-dev-server");var w=require("express");var k=require("https");var j=require("fs");var C=require("better-opn");function O(e){let t;const n=process.env.NODE_ENV==="FLATJS_CORE";switch(e){case"@flatjs/evolve-preset-babel":t=require.resolve(n?"../../../evolve-preset-babel/src/index":e);break}return t}const x=(e,t=false)=>{if(!t){return require(e)}else{return n.loadModule(e)}};const P=(t={usePreset:"react"},n=[])=>{const{usePreset:s,...o}=t;const i=n.map((e=>[require.resolve("babel-plugin-import"),{transformToDefaultImport:false,libraryDirectory:"cjs",style:()=>false,...e},e.libraryName]));const{reactBabelPreset:a,infernoBabelPreset:l,vueBabelPreset:c}=x(O("@flatjs/evolve-preset-babel"));const u=s==="react"?a():s==="vue"?c():l();let p={};try{p=r(u,o);if(p.plugins){p.plugins.unshift(...i)}else{p.plugins=i}}catch(t){e.printError(t)}return Object.assign({babelrc:false},p)};const M=[`https://polyfill.io/v3/polyfill.min.js?features=Array.from%2CArray.isArray%2CArray.of%2CArray.prototype.entries%2CArray.prototype.every%2CArray.prototype.fill%2CArray.prototype.filter%2CArray.prototype.find%2CArray.prototype.findIndex%2CArray.prototype.flat%2CArray.prototype.forEach%2CArray.prototype.flatMap%2CArray.prototype.keys%2CArray.prototype.indexOf%2CArray.prototype.includes%2CArray.prototype.lastIndexOf%2CArray.prototype.map%2CArray.prototype.reduce%2CArray.prototype.reduceRight%2CArray.prototype.some%2CArray.prototype.sort%2CArray.prototype.values%2CArrayBuffer%2CBlob%2CDataView%2CDate.now%2CObject.assign%2CObject.create%2CObject.defineProperties%2CObject.defineProperty%2CObject.entries%2CObject.freeze%2CObject.fromEntries%2CObject.getOwnPropertySymbols%2CObject.getOwnPropertyNames%2CObject.getOwnPropertyDescriptors%2CObject.getOwnPropertyDescriptor%2CObject.getPrototypeOf%2CObject.is%2CObject.isExtensible%2CObject.isFrozen%2CObject.isSealed%2CObject.keys%2CObject.values%2CObject.setPrototypeOf%2CPromise%2CPromise.prototype.finally%2CReflect%2CReflect.apply%2CReflect.construct%2CReflect.defineProperty%2CReflect.deleteProperty%2CReflect.getPrototypeOf%2CReflect.getOwnPropertyDescriptor%2CReflect.get%2CReflect.ownKeys%2CReflect.isExtensible%2CReflect.has%2CReflect.preventExtensions%2CReflect.set%2CReflect.setPrototypeOf%2CSet%2CString.prototype.trimStart%2CString.prototype.trimEnd%2CString.prototype.trim%2CString.prototype.startsWith%2CString.prototype.repeat%2CString.prototype.replaceAll%2CString.prototype.padStart%2CString.prototype.padEnd%2CMap%2CObject.seal%2Cconsole.groupEnd%2Cconsole.group`];const S={reactDev:[`https://unpkg.com/react@18.2.0/umd/react.development.js`,`https://unpkg.com/react-dom@18.2.0/umd/react-dom.development.js`],reactProd:[`https://unpkg.com/react@18.2.0/umd/react.production.min.js`,`https://unpkg.com/react-dom@18.2.0/umd/react-dom.production.min.js`]};const A={reactDev:[`https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js`,`https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js`],reactProd:[`https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.production.min.js`,`https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.production.min.js`]};const E={reactDev:[`https://cdn.bootcdn.net/ajax/libs/react/18.2.0/umd/react.development.js`,`https://cdn.bootcdn.net/ajax/libs/react-dom/18.2.0/umd/react-dom.development.js`],reactProd:[`https://cdn.bootcdn.net/ajax/libs/react/18.2.0/umd/react.production.min.js`,`https://cdn.bootcdn.net/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js`]};const B={flatjsEvolve:{projectCwd:process.cwd(),projectVirtualPath:"flatjs/evolve",forBuild:{rejectWarnings:false},forServe:{pageMiddlewares:[],defaultServeGlobalData:()=>({})},target:["web","es5"],liveReload:false,minimizeTerserOptions:{},multiHtmlCdn:{},watchOptions:{poll:1e3,ignored:/node_modules/,aggregateTimeout:500},extraPlugins:()=>[],pluginLoaderOptions:{babelOptions:{usePreset:"react"},lessOptions:{},cssnanoOptions:{},pixelOptions:{enabled:true,rootValue:{px:100,rpx:1},outputUnit:"rem"},enableBundleHashName:true,modularImports:[]}}};const R=(e,n={},r)=>{var s,o,i;const a=r[1];const l={vue:"Vue",react:"React","react-dom":"ReactDOM"};const c=t.isFunction(n)?n(e):n;const u=t.isFunction((s=a.options)==null?void 0:s.externals)?(o=a.options)==null?void 0:o.externals(e):(i=a.options)==null?void 0:i.externals;return Object.assign({},l,c,u||{})};const $=`(function(d){var j;var b=1;var i=1;var h=750;var c=100;function e(s,o){var q=d.document;var l=q.documentElement;var k=navigator.userAgent;var m=k.toLowerCase().indexOf("android")>-1;i=d.devicePixelRatio||1;if(i>3){i=3}if(m){i=1}console.log("current devicePixelRatio:",i);l.setAttribute("data-dpr",i.toString());var p=q.querySelector('meta[name="viewport"]');if(!p){b=1/i;p=q.createElement("meta");p.setAttribute("name","viewport");q.head.appendChild(p);p.setAttribute(["content","width=device-width,user-scalable=no,initial-scale=",b,",maximum-scale=",b,",minimum-scale=",b].join(""))}function n(){var t=document.documentElement.clientWidth;j=t/o*(s/i)*i;q.documentElement.style.fontSize=String(j)+"px"}var r;d.addEventListener("resize",function(){clearTimeout(r);r=setTimeout(n,300)},false);d.addEventListener("onload",n,false);n()}e(c,h);window.fabricViewport={currRem:j,currDpr:i,currScale:b,dpiPX2px:function f(k){return parseFloat(k.toString())/j*100+"px"},px2DPIpx:function a(k){return parseFloat(k.toString())/100*j+"px"},px2rem:function g(k){return parseFloat(k.toString())/100+"rem"}}})(window);`;const q={title:"",favicon:"",inlineScripts:()=>[],headBeforeStyles:()=>[],headBeforeScripts:e=>[...M,...e==="development"?E.reactDev:E.reactProd],bodyAfterScripts:()=>[],viewport:$,excludeCdnEnvs:["me","dev","ntv"],minify:true,template:s.join(e.getPackageDirSync(__dirname,""),"templates/html-plugin/index-{0}.html")};const F=(e,n,r)=>{let s;if(r){s=typeof r==="function"?r(n):r}if(t.isUndefined(s)){const t=q[e];return typeof t==="function"?t(n):t}return s};const T=(e,t)=>Object.assign({sourceMap:e,javascriptEnabled:true},t);const I=(e,t={},n={})=>{const r=[i({preset:["default",{discardComments:{removeAll:!e},reduceInitial:false,normalizeWhitespace:!e,...n}]})];if(t.enabled!==false){r.push(o.forgePluginPostcssPixel(t))}return{plugins:r}};const _=(e,t={})=>{const n={hints:e?false:"warning"};return Object.assign(n,t)};const D=(e={})=>({parallel:true,
2
+ "use strict";var e=require("@flatjs/common");var t=require("lodash");var n=require("@flatjs/mock");var r=require("babel-merge");var s=require("path");var o=require("@flatjs/forge-plugin-postcss-pixel");var i=require("cssnano");var a=require("webpack");var l=require("mini-css-extract-plugin");var c=require("chalk");var p=require("image-minimizer-webpack-plugin");var u=require("terser-webpack-plugin");var d=require("@pmmmwh/react-refresh-webpack-plugin");var m=require("case-sensitive-paths-webpack-plugin");var f=require("webpack-bundle-analyzer");var h=require("webpack-sources");var v=require("webpack/lib/util/extractUrlAndGlobal");var g=require("html-webpack-plugin");var b=require("webpack-dev-server");var y=require("express");var w=require("https");var j=require("fs");var C=require("better-opn");function k(e){let t;const n=process.env.NODE_ENV==="FLATJS_CORE";switch(e){case"@flatjs/evolve-preset-babel":t=require.resolve(n?"../../../evolve-preset-babel/src/index":e);break}return t}const S=(e,t=false)=>{if(!t){return require(e)}else{return n.loadModule(e)}};const P=(t={usePreset:"react"},n=[])=>{const{usePreset:s,...o}=t;const i=n.map((e=>[require.resolve("babel-plugin-import"),{transformToDefaultImport:false,libraryDirectory:"cjs",style:()=>false,...e},e.libraryName]));const{reactBabelPreset:a,infernoBabelPreset:l,vueBabelPreset:c}=S(k("@flatjs/evolve-preset-babel"));const p=s==="react"?a():s==="vue"?c():l();let u={};try{u=r(p,o);if(u.plugins){u.plugins.unshift(...i)}else{u.plugins=i}}catch(t){e.printError(t)}return Object.assign({babelrc:false},u)};const O=[`https://polyfill.io/v3/polyfill.min.js?features=Array.from%2CArray.isArray%2CArray.of%2CArray.prototype.entries%2CArray.prototype.every%2CArray.prototype.fill%2CArray.prototype.filter%2CArray.prototype.find%2CArray.prototype.findIndex%2CArray.prototype.flat%2CArray.prototype.forEach%2CArray.prototype.flatMap%2CArray.prototype.keys%2CArray.prototype.indexOf%2CArray.prototype.includes%2CArray.prototype.lastIndexOf%2CArray.prototype.map%2CArray.prototype.reduce%2CArray.prototype.reduceRight%2CArray.prototype.some%2CArray.prototype.sort%2CArray.prototype.values%2CArrayBuffer%2CBlob%2CDataView%2CDate.now%2CObject.assign%2CObject.create%2CObject.defineProperties%2CObject.defineProperty%2CObject.entries%2CObject.freeze%2CObject.fromEntries%2CObject.getOwnPropertySymbols%2CObject.getOwnPropertyNames%2CObject.getOwnPropertyDescriptors%2CObject.getOwnPropertyDescriptor%2CObject.getPrototypeOf%2CObject.is%2CObject.isExtensible%2CObject.isFrozen%2CObject.isSealed%2CObject.keys%2CObject.values%2CObject.setPrototypeOf%2CPromise%2CPromise.prototype.finally%2CReflect%2CReflect.apply%2CReflect.construct%2CReflect.defineProperty%2CReflect.deleteProperty%2CReflect.getPrototypeOf%2CReflect.getOwnPropertyDescriptor%2CReflect.get%2CReflect.ownKeys%2CReflect.isExtensible%2CReflect.has%2CReflect.preventExtensions%2CReflect.set%2CReflect.setPrototypeOf%2CSet%2CString.prototype.trimStart%2CString.prototype.trimEnd%2CString.prototype.trim%2CString.prototype.startsWith%2CString.prototype.repeat%2CString.prototype.replaceAll%2CString.prototype.padStart%2CString.prototype.padEnd%2CMap%2CObject.seal%2Cconsole.groupEnd%2Cconsole.group`];const x={reactDev:[`https://unpkg.com/react@18.2.0/umd/react.development.js`,`https://unpkg.com/react-dom@18.2.0/umd/react-dom.development.js`],reactProd:[`https://unpkg.com/react@18.2.0/umd/react.production.min.js`,`https://unpkg.com/react-dom@18.2.0/umd/react-dom.production.min.js`]};const A={reactDev:[`https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js`,`https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js`],reactProd:[`https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.production.min.js`,`https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.production.min.js`]};const B={reactDev:[`https://cdn.bootcdn.net/ajax/libs/react/18.2.0/umd/react.development.js`,`https://cdn.bootcdn.net/ajax/libs/react-dom/18.2.0/umd/react-dom.development.js`],reactProd:[`https://cdn.bootcdn.net/ajax/libs/react/18.2.0/umd/react.production.min.js`,`https://cdn.bootcdn.net/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js`]};const E={flatjsEvolve:{projectCwd:process.cwd(),projectVirtualPath:"flatjs/evolve",forBuild:{rejectWarnings:false},forServe:{pageMiddlewares:[],defaultServeGlobalData:()=>({})},target:["web","es5"],liveReload:false,minimizeTerserOptions:{},multiHtmlCdn:{},watchOptions:{poll:1e3,ignored:/node_modules/,aggregateTimeout:500},extraPlugins:()=>[],pluginLoaderOptions:{babelOptions:{usePreset:"react"},lessOptions:{},cssnanoOptions:{},pixelOptions:{enabled:true,rootValue:{px:100,rpx:1},outputUnit:"rem"},enableBundleHashName:true,modularImports:[]}}};const $=(e,n={},r)=>{var s,o,i;const a=r[1];const l={vue:"Vue",react:"React","react-dom":"ReactDOM"};const c=t.isFunction(n)?n(e):n;const p=t.isFunction((s=a.options)==null?void 0:s.externals)?(o=a.options)==null?void 0:o.externals(e):(i=a.options)==null?void 0:i.externals;return Object.assign({},l,c,p||{})};const M=`(function(d){var j;var b=1;var i=1;var h=750;var c=100;function e(s,o){var q=d.document;var l=q.documentElement;var k=navigator.userAgent;var m=k.toLowerCase().indexOf("android")>-1;i=d.devicePixelRatio||1;if(i>3){i=3}if(m){i=1}console.log("current devicePixelRatio:",i);l.setAttribute("data-dpr",i.toString());var p=q.querySelector('meta[name="viewport"]');if(!p){b=1/i;p=q.createElement("meta");p.setAttribute("name","viewport");q.head.appendChild(p);p.setAttribute(["content","width=device-width,user-scalable=no,initial-scale=",b,",maximum-scale=",b,",minimum-scale=",b].join(""))}function n(){var t=document.documentElement.clientWidth;j=t/o*(s/i)*i;q.documentElement.style.fontSize=String(j)+"px"}var r;d.addEventListener("resize",function(){clearTimeout(r);r=setTimeout(n,300)},false);d.addEventListener("onload",n,false);n()}e(c,h);window.fabricViewport={currRem:j,currDpr:i,currScale:b,dpiPX2px:function f(k){return parseFloat(k.toString())/j*100+"px"},px2DPIpx:function a(k){return parseFloat(k.toString())/100*j+"px"},px2rem:function g(k){return parseFloat(k.toString())/100+"rem"}}})(window);`;const q={title:"",favicon:"",inlineScripts:()=>[],headBeforeStyles:()=>[],headBeforeScripts:e=>[...O,...e==="development"?B.reactDev:B.reactProd],bodyAfterScripts:()=>[],viewport:M,excludeCdnEnvs:["me","dev","ntv"],minify:true,template:s.join(e.getPackageDirSync(__dirname,""),"templates/html-plugin/index-{0}.html")};const F=(e,n,r)=>{let s;if(r){s=typeof r==="function"?r(n):r}if(t.isUndefined(s)){const t=q[e];return typeof t==="function"?t(n):t}return s};const D=(e,t)=>Object.assign({sourceMap:e,javascriptEnabled:true},t);const R=(e,t={},n={})=>{const r=[i({preset:["default",{discardComments:{removeAll:!e},reduceInitial:false,normalizeWhitespace:!e,...n}]})];if(t.enabled!==false){r.push(o.forgePluginPostcssPixel(t))}return{plugins:r}};const T=(e,t={})=>{const n={hints:e?false:"warning"};return Object.assign(n,t)};const N=(e={})=>({parallel:true,
3
3
  // Disable Extract all or some (use /^\**!|@preserve|@license|@cc_on/i RegExp) comments.
4
- extractComments:false,terserOptions:t.merge({ecma:undefined,parse:{},compress:{},mangle:true,module:false,output:null,toplevel:false,nameCache:null,ie8:false,keep_classnames:undefined,keep_fnames:false,safari10:false},e)});const N=(n=process.cwd(),r)=>{const s=e.loadFlatjsConfig(n,"flatjsEvolve","flatjs.evolve.js");return t.merge({},B.flatjsEvolve,s.flatjsEvolve,r,{projectCwd:n})};const L=e=>{try{C(e)}catch(e){console.warn(`Unable to open browser. If you are running in a headless environment\n`)}};function z(e="",t=""){return e.replace(/\/$/,"")+"/"+t.replace(/^\//,"")}function W(e){const t=new RegExp("[?&]env(=([^&#]*)|&|#|$)");const n=t.exec(window.location.href);const r=n&&n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"prod";const s=e[r]||e["prod"]||[];const o=s[Math.floor(Math.random()*s.length)];return o.replace(/\/$/,"")+"/"}function U(e={},t="prod"){const n=e[t]||e["prod"]||[];return n[Math.floor(Math.random()*n.length)]}function H(e){return`window.evolveFetchMicroWidgets = function () {\n var cdnConfig = ${JSON.stringify(e)};\n var cdnFinder = ${W.toString()};\n return (cdnFinder(cdnConfig) || '').replace(/\\/$/, '');\n }`}function G(e,n){const r=[];for(const[t,n]of Object.entries(e)){r.push({[t]:n.entry})}return r.map((e=>t.merge({},n,{name:Object.keys(e)[0],entry:e})))}const V=(e,n)=>{var r,s;const o=t.merge({},n.pluginLoaderOptions);if((r=e.options)!=null&&r.allowPx2rem){t.set(o,"pixelOptions.enabled",e.options.allowPx2rem)}if((s=e.options)!=null&&s.enableBundleHashName){t.set(o,"enableBundleHashName",e.options.enableBundleHashName)}const i={...n,pluginLoaderOptions:o};return i};const J=(e,t)=>{var n,r;const s=(n=e.pluginLoaderOptions)==null?void 0:(r=n.pixelOptions)==null?void 0:r.enabled;const o=(t==null?void 0:t.allowPx2rem)??s;return!!o};const Y=e=>{if(Object.keys(e).length>1){throw new Error(`Only single one entry map support now while "serve", "build" process!`)}let t=undefined;for(const[n,r]of Object.entries(e)){t=[n,r];break}if(!t){throw new Error(`No entry map found while "serve", "build" process!`)}return t};const K=()=>Date.now().toString();const X=(e,t,n=true)=>{const r=e==="js"?".js":".css";if(t){return`bundle${r}`}if(n){return`bundle[contenthash]${r}`}return`bundle${r}?${K()}`};const Q=/svg-icons\//;const Z=/\.(jpe?g|png|gif|svg)$/;const ee=/\.(ttf|eot|woff|woff2)(\?.+)?$/;const te=e=>Q.test(e)&&e.endsWith(".svg");const ne=({projectCwd:e,projectVirtualPath:t},n,[r,o])=>{let i=s.dirname(s.join(t,n.replace(/^src/,"")));const a=o.entry.map((t=>s.dirname(s.join(e,t))));const l=s.resolve(e,n);const c=a.find((e=>l.startsWith(e)));if(c){i=s.dirname(s.join(r,s.relative(c,l)))}return`${i}/[name]-[contenthash:8][ext]`};const re=(e,t)=>{const n={test(e){return ee.test(e)||Z.test(e)&&!te(e)},type:"asset",generator:{filename({filename:n}){return ne(e,n,t)}},parser:{dataUrlCondition:{maxSize:4*1024}}};return n};const se=()=>{const e={test(e){return te(e)},use:[{loader:require.resolve("./loader-icon"),options:{svgo:{plugins:[{name:"removeTitle"},{name:"removeDimensions"}]}}}]};return e};function oe(e,n){const r=t.isFunction(e)?e(n):e;if(r.usePreset==="react"&&n){if(r.plugins){r.plugins.push(require.resolve("react-refresh/babel"))}else{r.plugins=[require.resolve("react-refresh/babel")]}}return r}const ie=(e,n={})=>{const{babelOptions:r={},modularImports:s=[]}=n;const o=oe(r,e);const i=t.isFunction(s)?s(e):s;const a=P(o,i);const l={test:/\.(tsx|ts|js|jsx)$/,use:[{loader:require.resolve("babel-loader"),options:a}]};return l};const ae=(e,t={})=>{const n={test:/\.css$/i,use:[{loader:l.loader,options:{esModule:true}},{loader:"css-loader",options:{sourceMap:e}}]};const{pixelOptions:r,cssnanoOptions:s}=t;if(Array.isArray(n.use)){n.use.push({loader:"postcss-loader",options:{postcssOptions:I(e,r,s),sourceMap:e}})}return n};const le=(e,t={})=>{const n=ae(e,t);n.test=/\.less$/i;const r=t.lessOptions;if(Array.isArray(n.use)){n.use.push({loader:require.resolve("less-loader"),options:{sourceMap:e,lessOptions:T(e,r)}})}return n};const ce=(e,t,n,r={})=>{const s=[se(),re(t,n),ae(e,r),le(e,r),ie(e,r)];return s};var ue={};var pe={get exports(){return ue},set exports(e){ue=e}};var de;var fe;function he(){if(fe)return de;fe=1;de={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};return de}var me;var ge;function be(){if(ge)return me;ge=1;const e=he();const t={};for(const n of Object.keys(e)){t[e[n]]=n}const n={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};me=n;for(const e of Object.keys(n)){if(!("channels"in n[e])){throw new Error("missing channels property: "+e)}if(!("labels"in n[e])){throw new Error("missing channel labels property: "+e)}if(n[e].labels.length!==n[e].channels){throw new Error("channel and label counts mismatch: "+e)}const{channels:t,labels:r}=n[e];delete n[e].channels;delete n[e].labels;Object.defineProperty(n[e],"channels",{value:t});Object.defineProperty(n[e],"labels",{value:r})}n.rgb.hsl=function(e){const t=e[0]/255;const n=e[1]/255;const r=e[2]/255;const s=Math.min(t,n,r);const o=Math.max(t,n,r);const i=o-s;let a;let l;if(o===s){a=0}else if(t===o){a=(n-r)/i}else if(n===o){a=2+(r-t)/i}else if(r===o){a=4+(t-n)/i}a=Math.min(a*60,360);if(a<0){a+=360}const c=(s+o)/2;if(o===s){l=0}else if(c<=.5){l=i/(o+s)}else{l=i/(2-o-s)}return[a,l*100,c*100]};n.rgb.hsv=function(e){let t;let n;let r;let s;let o;const i=e[0]/255;const a=e[1]/255;const l=e[2]/255;const c=Math.max(i,a,l);const u=c-Math.min(i,a,l);const p=function(e){return(c-e)/6/u+1/2};if(u===0){s=0;o=0}else{o=u/c;t=p(i);n=p(a);r=p(l);if(i===c){s=r-n}else if(a===c){s=1/3+t-r}else if(l===c){s=2/3+n-t}if(s<0){s+=1}else if(s>1){s-=1}}return[s*360,o*100,c*100]};n.rgb.hwb=function(e){const t=e[0];const r=e[1];let s=e[2];const o=n.rgb.hsl(e)[0];const i=1/255*Math.min(t,Math.min(r,s));s=1-1/255*Math.max(t,Math.max(r,s));return[o,i*100,s*100]};n.rgb.cmyk=function(e){const t=e[0]/255;const n=e[1]/255;const r=e[2]/255;const s=Math.min(1-t,1-n,1-r);const o=(1-t-s)/(1-s)||0;const i=(1-n-s)/(1-s)||0;const a=(1-r-s)/(1-s)||0;return[o*100,i*100,a*100,s*100]};function r(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}n.rgb.keyword=function(n){const s=t[n];if(s){return s}let o=Infinity;let i;for(const t of Object.keys(e)){const s=e[t];const a=r(n,s);if(a<o){o=a;i=t}}return i};n.keyword.rgb=function(t){return e[t]};n.rgb.xyz=function(e){let t=e[0]/255;let n=e[1]/255;let r=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92;n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;const s=t*.4124+n*.3576+r*.1805;const o=t*.2126+n*.7152+r*.0722;const i=t*.0193+n*.1192+r*.9505;return[s*100,o*100,i*100]};n.rgb.lab=function(e){const t=n.rgb.xyz(e);let r=t[0];let s=t[1];let o=t[2];r/=95.047;s/=100;o/=108.883;r=r>.008856?r**(1/3):7.787*r+16/116;s=s>.008856?s**(1/3):7.787*s+16/116;o=o>.008856?o**(1/3):7.787*o+16/116;const i=116*s-16;const a=500*(r-s);const l=200*(s-o);return[i,a,l]};n.hsl.rgb=function(e){const t=e[0]/360;const n=e[1]/100;const r=e[2]/100;let s;let o;let i;if(n===0){i=r*255;return[i,i,i]}if(r<.5){s=r*(1+n)}else{s=r+n-r*n}const a=2*r-s;const l=[0,0,0];for(let e=0;e<3;e++){o=t+1/3*-(e-1);if(o<0){o++}if(o>1){o--}if(6*o<1){i=a+(s-a)*6*o}else if(2*o<1){i=s}else if(3*o<2){i=a+(s-a)*(2/3-o)*6}else{i=a}l[e]=i*255}return l};n.hsl.hsv=function(e){const t=e[0];let n=e[1]/100;let r=e[2]/100;let s=n;const o=Math.max(r,.01);r*=2;n*=r<=1?r:2-r;s*=o<=1?o:2-o;const i=(r+n)/2;const a=r===0?2*s/(o+s):2*n/(r+n);return[t,a*100,i*100]};n.hsv.rgb=function(e){const t=e[0]/60;const n=e[1]/100;let r=e[2]/100;const s=Math.floor(t)%6;const o=t-Math.floor(t);const i=255*r*(1-n);const a=255*r*(1-n*o);const l=255*r*(1-n*(1-o));r*=255;switch(s){case 0:return[r,l,i];case 1:return[a,r,i];case 2:return[i,r,l];case 3:return[i,a,r];case 4:return[l,i,r];case 5:return[r,i,a]}};n.hsv.hsl=function(e){const t=e[0];const n=e[1]/100;const r=e[2]/100;const s=Math.max(r,.01);let o;let i;i=(2-n)*r;const a=(2-n)*s;o=n*s;o/=a<=1?a:2-a;o=o||0;i/=2;return[t,o*100,i*100]};n.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100;let r=e[2]/100;const s=n+r;let o;if(s>1){n/=s;r/=s}const i=Math.floor(6*t);const a=1-r;o=6*t-i;if((i&1)!==0){o=1-o}const l=n+o*(a-n);let c;let u;let p;switch(i){default:case 6:case 0:c=a;u=l;p=n;break;case 1:c=l;u=a;p=n;break;case 2:c=n;u=a;p=l;break;case 3:c=n;u=l;p=a;break;case 4:c=l;u=n;p=a;break;case 5:c=a;u=n;p=l;break}return[c*255,u*255,p*255]};n.cmyk.rgb=function(e){const t=e[0]/100;const n=e[1]/100;const r=e[2]/100;const s=e[3]/100;const o=1-Math.min(1,t*(1-s)+s);const i=1-Math.min(1,n*(1-s)+s);const a=1-Math.min(1,r*(1-s)+s);return[o*255,i*255,a*255]};n.xyz.rgb=function(e){const t=e[0]/100;const n=e[1]/100;const r=e[2]/100;let s;let o;let i;s=t*3.2406+n*-1.5372+r*-.4986;o=t*-.9689+n*1.8758+r*.0415;i=t*.0557+n*-.204+r*1.057;s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92;o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92;i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92;s=Math.min(Math.max(0,s),1);o=Math.min(Math.max(0,o),1);i=Math.min(Math.max(0,i),1);return[s*255,o*255,i*255]};n.xyz.lab=function(e){let t=e[0];let n=e[1];let r=e[2];t/=95.047;n/=100;r/=108.883;t=t>.008856?t**(1/3):7.787*t+16/116;n=n>.008856?n**(1/3):7.787*n+16/116;r=r>.008856?r**(1/3):7.787*r+16/116;const s=116*n-16;const o=500*(t-n);const i=200*(n-r);return[s,o,i]};n.lab.xyz=function(e){const t=e[0];const n=e[1];const r=e[2];let s;let o;let i;o=(t+16)/116;s=n/500+o;i=o-r/200;const a=o**3;const l=s**3;const c=i**3;o=a>.008856?a:(o-16/116)/7.787;s=l>.008856?l:(s-16/116)/7.787;i=c>.008856?c:(i-16/116)/7.787;s*=95.047;o*=100;i*=108.883;return[s,o,i]};n.lab.lch=function(e){const t=e[0];const n=e[1];const r=e[2];let s;const o=Math.atan2(r,n);s=o*360/2/Math.PI;if(s<0){s+=360}const i=Math.sqrt(n*n+r*r);return[t,i,s]};n.lch.lab=function(e){const t=e[0];const n=e[1];const r=e[2];const s=r/360*2*Math.PI;const o=n*Math.cos(s);const i=n*Math.sin(s);return[t,o,i]};n.rgb.ansi16=function(e,t=null){const[r,s,o]=e;let i=t===null?n.rgb.hsv(e)[2]:t;i=Math.round(i/50);if(i===0){return 30}let a=30+(Math.round(o/255)<<2|Math.round(s/255)<<1|Math.round(r/255));if(i===2){a+=60}return a};n.hsv.ansi16=function(e){return n.rgb.ansi16(n.hsv.rgb(e),e[2])};n.rgb.ansi256=function(e){const t=e[0];const n=e[1];const r=e[2];if(t===n&&n===r){if(t<8){return 16}if(t>248){return 231}return Math.round((t-8)/247*24)+232}const s=16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5);return s};n.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7){if(e>50){t+=3.5}t=t/10.5*255;return[t,t,t]}const n=(~~(e>50)+1)*.5;const r=(t&1)*n*255;const s=(t>>1&1)*n*255;const o=(t>>2&1)*n*255;return[r,s,o]};n.ansi256.rgb=function(e){if(e>=232){const t=(e-232)*10+8;return[t,t,t]}e-=16;let t;const n=Math.floor(e/36)/5*255;const r=Math.floor((t=e%36)/6)/5*255;const s=t%6/5*255;return[n,r,s]};n.rgb.hex=function(e){const t=((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255);const n=t.toString(16).toUpperCase();return"000000".substring(n.length)+n};n.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t){return[0,0,0]}let n=t[0];if(t[0].length===3){n=n.split("").map((e=>e+e)).join("")}const r=parseInt(n,16);const s=r>>16&255;const o=r>>8&255;const i=r&255;return[s,o,i]};n.rgb.hcg=function(e){const t=e[0]/255;const n=e[1]/255;const r=e[2]/255;const s=Math.max(Math.max(t,n),r);const o=Math.min(Math.min(t,n),r);const i=s-o;let a;let l;if(i<1){a=o/(1-i)}else{a=0}if(i<=0){l=0}else if(s===t){l=(n-r)/i%6}else if(s===n){l=2+(r-t)/i}else{l=4+(t-n)/i}l/=6;l%=1;return[l*360,i*100,a*100]};n.hsl.hcg=function(e){const t=e[1]/100;const n=e[2]/100;const r=n<.5?2*t*n:2*t*(1-n);let s=0;if(r<1){s=(n-.5*r)/(1-r)}return[e[0],r*100,s*100]};n.hsv.hcg=function(e){const t=e[1]/100;const n=e[2]/100;const r=t*n;let s=0;if(r<1){s=(n-r)/(1-r)}return[e[0],r*100,s*100]};n.hcg.rgb=function(e){const t=e[0]/360;const n=e[1]/100;const r=e[2]/100;if(n===0){return[r*255,r*255,r*255]}const s=[0,0,0];const o=t%1*6;const i=o%1;const a=1-i;let l=0;switch(Math.floor(o)){case 0:s[0]=1;s[1]=i;s[2]=0;break;case 1:s[0]=a;s[1]=1;s[2]=0;break;case 2:s[0]=0;s[1]=1;s[2]=i;break;case 3:s[0]=0;s[1]=a;s[2]=1;break;case 4:s[0]=i;s[1]=0;s[2]=1;break;default:s[0]=1;s[1]=0;s[2]=a}l=(1-n)*r;return[(n*s[0]+l)*255,(n*s[1]+l)*255,(n*s[2]+l)*255]};n.hcg.hsv=function(e){const t=e[1]/100;const n=e[2]/100;const r=t+n*(1-t);let s=0;if(r>0){s=t/r}return[e[0],s*100,r*100]};n.hcg.hsl=function(e){const t=e[1]/100;const n=e[2]/100;const r=n*(1-t)+.5*t;let s=0;if(r>0&&r<.5){s=t/(2*r)}else if(r>=.5&&r<1){s=t/(2*(1-r))}return[e[0],s*100,r*100]};n.hcg.hwb=function(e){const t=e[1]/100;const n=e[2]/100;const r=t+n*(1-t);return[e[0],(r-t)*100,(1-r)*100]};n.hwb.hcg=function(e){const t=e[1]/100;const n=e[2]/100;const r=1-n;const s=r-t;let o=0;if(s<1){o=(r-s)/(1-s)}return[e[0],s*100,o*100]};n.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};n.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};n.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};n.gray.hsl=function(e){return[0,0,e[0]]};n.gray.hsv=n.gray.hsl;n.gray.hwb=function(e){return[0,100,e[0]]};n.gray.cmyk=function(e){return[0,0,0,e[0]]};n.gray.lab=function(e){return[e[0],0,0]};n.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255;const n=(t<<16)+(t<<8)+t;const r=n.toString(16).toUpperCase();return"000000".substring(r.length)+r};n.rgb.gray=function(e){const t=(e[0]+e[1]+e[2])/3;return[t/255*100]};return me}var ve;var ye;function we(){if(ye)return ve;ye=1;const e=be();function t(){const t={};const n=Object.keys(e);for(let e=n.length,r=0;r<e;r++){t[n[r]]={distance:-1,parent:null}}return t}function n(n){const r=t();const s=[n];r[n].distance=0;while(s.length){const t=s.pop();const n=Object.keys(e[t]);for(let e=n.length,o=0;o<e;o++){const e=n[o];const i=r[e];if(i.distance===-1){i.distance=r[t].distance+1;i.parent=t;s.unshift(e)}}}return r}function r(e,t){return function(n){return t(e(n))}}function s(t,n){const s=[n[t].parent,t];let o=e[n[t].parent][t];let i=n[t].parent;while(n[i].parent){s.unshift(n[i].parent);o=r(e[n[i].parent][i],o);i=n[i].parent}o.conversion=s;return o}ve=function(e){const t=n(e);const r={};const o=Object.keys(t);for(let e=o.length,n=0;n<e;n++){const e=o[n];const i=t[e];if(i.parent===null){continue}r[e]=s(e,t)}return r};return ve}var ke;var je;function Ce(){if(je)return ke;je=1;const e=be();const t=we();const n={};const r=Object.keys(e);function s(e){const t=function(...t){const n=t[0];if(n===undefined||n===null){return n}if(n.length>1){t=n}return e(t)};if("conversion"in e){t.conversion=e.conversion}return t}function o(e){const t=function(...t){const n=t[0];if(n===undefined||n===null){return n}if(n.length>1){t=n}const r=e(t);if(typeof r==="object"){for(let e=r.length,t=0;t<e;t++){r[t]=Math.round(r[t])}}return r};if("conversion"in e){t.conversion=e.conversion}return t}r.forEach((r=>{n[r]={};Object.defineProperty(n[r],"channels",{value:e[r].channels});Object.defineProperty(n[r],"labels",{value:e[r].labels});const i=t(r);const a=Object.keys(i);a.forEach((e=>{const t=i[e];n[r][e]=o(t);n[r][e].raw=s(t)}))}));ke=n;return ke}(function(e){const t=(e,t)=>(...n)=>{const r=e(...n);return`[${r+t}m`};const n=(e,t)=>(...n)=>{const r=e(...n);return`[${38+t};5;${r}m`};const r=(e,t)=>(...n)=>{const r=e(...n);return`[${38+t};2;${r[0]};${r[1]};${r[2]}m`};const s=e=>e;const o=(e,t,n)=>[e,t,n];const i=(e,t,n)=>{Object.defineProperty(e,t,{get:()=>{const r=n();Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true});return r},enumerable:true,configurable:true})};let a;const l=(e,t,n,r)=>{if(a===undefined){a=Ce()}const s=r?10:0;const o={};for(const[r,i]of Object.entries(a)){const a=r==="ansi16"?"ansi":r;if(r===t){o[a]=e(n,s)}else if(typeof i==="object"){o[a]=e(i[t],s)}}return o};function c(){const e=new Map;const a={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};a.color.gray=a.color.blackBright;a.bgColor.bgGray=a.bgColor.bgBlackBright;a.color.grey=a.color.blackBright;a.bgColor.bgGrey=a.bgColor.bgBlackBright;for(const[t,n]of Object.entries(a)){for(const[t,r]of Object.entries(n)){a[t]={open:`[${r[0]}m`,close:`[${r[1]}m`};n[t]=a[t];e.set(r[0],r[1])}Object.defineProperty(a,t,{value:n,enumerable:false})}Object.defineProperty(a,"codes",{value:e,enumerable:false});a.color.close="";a.bgColor.close="";i(a.color,"ansi",(()=>l(t,"ansi16",s,false)));i(a.color,"ansi256",(()=>l(n,"ansi256",s,false)));i(a.color,"ansi16m",(()=>l(r,"rgb",o,false)));i(a.bgColor,"ansi",(()=>l(t,"ansi16",s,true)));i(a.bgColor,"ansi256",(()=>l(n,"ansi256",s,true)));i(a.bgColor,"ansi16m",(()=>l(r,"rgb",o,true)));return a}Object.defineProperty(e,"exports",{enumerable:true,get:c})})(pe);var Oe=(e,t=process.argv)=>{const n=e.startsWith("-")?"":e.length===1?"-":"--";const r=t.indexOf(n+e);const s=t.indexOf("--");return r!==-1&&(s===-1||r<s)};const xe=c;const Pe=u;const Me=Oe;const{env:Se}=process;let Ae;if(Me("no-color")||Me("no-colors")||Me("color=false")||Me("color=never")){Ae=0}else if(Me("color")||Me("colors")||Me("color=true")||Me("color=always")){Ae=1}if("FORCE_COLOR"in Se){if(Se.FORCE_COLOR==="true"){Ae=1}else if(Se.FORCE_COLOR==="false"){Ae=0}else{Ae=Se.FORCE_COLOR.length===0?1:Math.min(parseInt(Se.FORCE_COLOR,10),3)}}function Ee(e){if(e===0){return false}return{level:e,hasBasic:true,has256:e>=2,has16m:e>=3}}function Be(e,t){if(Ae===0){return 0}if(Me("color=16m")||Me("color=full")||Me("color=truecolor")){return 3}if(Me("color=256")){return 2}if(e&&!t&&Ae===undefined){return 0}const n=Ae||0;if(Se.TERM==="dumb"){return n}if(process.platform==="win32"){const e=xe.release().split(".");if(Number(e[0])>=10&&Number(e[2])>=10586){return Number(e[2])>=14931?3:2}return 1}if("CI"in Se){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in Se))||Se.CI_NAME==="codeship"){return 1}return n}if("TEAMCITY_VERSION"in Se){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Se.TEAMCITY_VERSION)?1:0}if(Se.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in Se){const e=parseInt((Se.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Se.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(Se.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Se.TERM)){return 1}if("COLORTERM"in Se){return 1}return n}function Re(e){const t=Be(e,e&&e.isTTY);return Ee(t)}var $e={supportsColor:Re,stdout:Ee(Be(true,Pe.isatty(1))),stderr:Ee(Be(true,Pe.isatty(2)))};const qe=(e,t,n)=>{let r=e.indexOf(t);if(r===-1){return e}const s=t.length;let o=0;let i="";do{i+=e.substr(o,r-o)+t+n;o=r+s;r=e.indexOf(t,o)}while(r!==-1);i+=e.substr(o);return i};const Fe=(e,t,n,r)=>{let s=0;let o="";do{const i=e[r-1]==="\r";o+=e.substr(s,(i?r-1:r)-s)+t+(i?"\r\n":"\n")+n;s=r+1;r=e.indexOf("\n",s)}while(r!==-1);o+=e.substr(s);return o};var Te={stringReplaceAll:qe,stringEncaseCRLFWithFirstIndex:Fe};var Ie;var _e;function De(){if(_e)return Ie;_e=1;const e=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;const t=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;const n=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;const r=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;const s=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a",""]]);function o(e){const t=e[0]==="u";const n=e[1]==="{";if(t&&!n&&e.length===5||e[0]==="x"&&e.length===3){return String.fromCharCode(parseInt(e.slice(1),16))}if(t&&n){return String.fromCodePoint(parseInt(e.slice(2,-1),16))}return s.get(e)||e}function i(e,t){const s=[];const i=t.trim().split(/\s*,\s*/g);let a;for(const t of i){const i=Number(t);if(!Number.isNaN(i)){s.push(i)}else if(a=t.match(n)){s.push(a[2].replace(r,((e,t,n)=>t?o(t):n)))}else{throw new Error(`Invalid Chalk template style argument: ${t} (in style '${e}')`)}}return s}function a(e){t.lastIndex=0;const n=[];let r;while((r=t.exec(e))!==null){const e=r[1];if(r[2]){const t=i(e,r[2]);n.push([e].concat(t))}else{n.push([e])}}return n}function l(e,t){const n={};for(const e of t){for(const t of e.styles){n[t[0]]=e.inverse?null:t.slice(1)}}let r=e;for(const[e,t]of Object.entries(n)){if(!Array.isArray(t)){continue}if(!(e in r)){throw new Error(`Unknown Chalk style: ${e}`)}r=t.length>0?r[e](...t):r[e]}return r}Ie=(t,n)=>{const r=[];const s=[];let i=[];n.replace(e,((e,n,c,u,p,d)=>{if(n){i.push(o(n))}else if(u){const e=i.join("");i=[];s.push(r.length===0?e:l(t,r)(e));r.push({inverse:c,styles:a(u)})}else if(p){if(r.length===0){throw new Error("Found extraneous } in Chalk template literal")}s.push(l(t,r)(i.join("")));i=[];r.pop()}else{i.push(d)}}));s.push(i.join(""));if(r.length>0){const e=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(e)}return s.join("")};return Ie}const Ne=ue;const{stdout:Le,stderr:ze}=$e;const{stringReplaceAll:We,stringEncaseCRLFWithFirstIndex:Ue}=Te;const{isArray:He}=Array;const Ge=["ansi","ansi","ansi256","ansi16m"];const Ve=Object.create(null);const Je=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3)){throw new Error("The `level` option should be an integer from 0 to 3")}const n=Le?Le.level:0;e.level=t.level===undefined?n:t.level};class Ye{constructor(e){return Ke(e)}}const Ke=e=>{const t={};Je(t,e);t.template=(...e)=>st(t.template,...e);Object.setPrototypeOf(t,Xe.prototype);Object.setPrototypeOf(t.template,t);t.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")};t.template.Instance=Ye;return t.template};function Xe(e){return Ke(e)}for(const[e,t]of Object.entries(Ne)){Ve[e]={get(){const n=tt(this,et(t.open,t.close,this._styler),this._isEmpty);Object.defineProperty(this,e,{value:n});return n}}}Ve.visible={get(){const e=tt(this,this._styler,true);Object.defineProperty(this,"visible",{value:e});return e}};const Qe=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(const e of Qe){Ve[e]={get(){const{level:t}=this;return function(...n){const r=et(Ne.color[Ge[t]][e](...n),Ne.color.close,this._styler);return tt(this,r,this._isEmpty)}}}}for(const e of Qe){const t="bg"+e[0].toUpperCase()+e.slice(1);Ve[t]={get(){const{level:t}=this;return function(...n){const r=et(Ne.bgColor[Ge[t]][e](...n),Ne.bgColor.close,this._styler);return tt(this,r,this._isEmpty)}}}}const Ze=Object.defineProperties((()=>{}),{...Ve,level:{enumerable:true,get(){return this._generator.level},set(e){this._generator.level=e}}});const et=(e,t,n)=>{let r;let s;if(n===undefined){r=e;s=t}else{r=n.openAll+e;s=t+n.closeAll}return{open:e,close:t,openAll:r,closeAll:s,parent:n}};const tt=(e,t,n)=>{const r=(...e)=>{if(He(e[0])&&He(e[0].raw)){return nt(r,st(r,...e))}return nt(r,e.length===1?""+e[0]:e.join(" "))};Object.setPrototypeOf(r,Ze);r._generator=e;r._styler=t;r._isEmpty=n;return r};const nt=(e,t)=>{if(e.level<=0||!t){return e._isEmpty?"":t}let n=e._styler;if(n===undefined){return t}const{openAll:r,closeAll:s}=n;if(t.indexOf("")!==-1){while(n!==undefined){t=We(t,n.close,n.open);n=n.parent}}const o=t.indexOf("\n");if(o!==-1){t=Ue(t,s,r,o)}return r+t+s};let rt;const st=(e,...t)=>{const[n]=t;if(!He(n)||!He(n.raw)){return t.join(" ")}const r=t.slice(1);const s=[n.raw[0]];for(let e=1;e<n.length;e++){s.push(String(r[e-1]).replace(/[{}\\]/g,"\\$&"),String(n.raw[e]))}if(rt===undefined){rt=De()}return rt(e,s.join(""))};Object.defineProperties(Xe.prototype,Ve);const ot=Xe();ot.supportsColor=Le;ot.stderr=Xe({level:ze?ze.level:0});ot.stderr.supportsColor=ze;var it=ot;const at=new Map;const lt=()=>{const t=[["svgo",{}],["gifsicle",{}],["jpegtran",{}],["pngquant",{}]];const n=t.map((t=>{const n=t[0];try{require.resolve(`imagemin-${n}`);return t}catch(t){if(!at.get(n)){at.set(n,true);const t=it.magenta(`"npm install imagemin-${n} -D"`);e.Logger.warn(`Execute ${t} for assets optimization`,"@flatjs/evolve")}return null}})).filter(Boolean);if(n.length){return new p({minimizer:{implementation:p.imageminMinify,options:{plugins:n}}})}return null};const ct=e=>new d(D(e.minimizeTerserOptions));const ut=(e,t)=>{if(e){return[]}return[ct(t),lt()].filter(Boolean)};class pt{constructor(e={}){this.verbose=void 0;this.cleanStaleWebpackAssets=void 0;this.protectWebpackAssets=void 0;this.cleanAfterEveryBuildPatterns=void 0;this.cleanOnceBeforeBuildPatterns=void 0;this.currentAssets=void 0;this.initialClean=void 0;this.outputPath=void 0;this.verbose=e.verbose===true||false;this.cleanStaleWebpackAssets=e.cleanStaleWebpackAssets===true||e.cleanStaleWebpackAssets===false?e.cleanStaleWebpackAssets:true;this.protectWebpackAssets=e.protectWebpackAssets===true||e.protectWebpackAssets===false?e.protectWebpackAssets:true;this.cleanAfterEveryBuildPatterns=Array.isArray(e.cleanAfterEveryBuildPatterns)?e.cleanAfterEveryBuildPatterns:[];this.cleanOnceBeforeBuildPatterns=Array.isArray(e.cleanOnceBeforeBuildPatterns)?e.cleanOnceBeforeBuildPatterns:["**/*"];this.currentAssets=[];this.initialClean=false;this.outputPath="";this.apply=this.apply.bind(this);this.handleInitial=this.handleInitial.bind(this);this.handleDone=this.handleDone.bind(this);this.removeFiles=this.removeFiles.bind(this)}apply(e){if(!e.options.output||!e.options.output.path){console.warn("clean-webpack-plugin: options.output.path not defined. Plugin disabled...");return}this.outputPath=e.options.output.path;const t=e.hooks;if(this.cleanOnceBeforeBuildPatterns.length!==0){t.emit.tap("clean-webpack-plugin",(e=>{this.handleInitial(e)}))}t.done.tap("clean-webpack-plugin",(e=>{this.handleDone(e)}))}handleInitial(e){if(this.initialClean){return}const t=e.getStats();if(t.hasErrors()){return}this.initialClean=true;this.removeFiles(this.cleanOnceBeforeBuildPatterns)}handleDone(e){if(e.hasErrors()){if(this.verbose){console.warn("clean-webpack-plugin: pausing due to webpack errors")}return}const t=e.toJson({assets:true}).assets||[];const n=t.map((e=>e.name));const r=this.currentAssets.filter((e=>{const t=n.includes(e)===false;return t}));this.currentAssets=n.sort();const s=[];if(this.cleanStaleWebpackAssets===true&&r.length!==0){s.push(...r)}if(this.cleanAfterEveryBuildPatterns.length!==0){s.push(...this.cleanAfterEveryBuildPatterns)}if(s.length!==0){this.removeFiles(s)}}removeFiles(t){try{const n=e.delFilesSync(t,{cwd:this.outputPath,dot:true,ignore:this.protectWebpackAssets?this.currentAssets:[]});if(this.verbose){n.forEach((e=>{const t=s.relative(process.cwd(),e);const n="removed";console.warn(`clean-webpack-plugin: ${n} ${t}`)}))}}catch(e){const t=/Cannot delete files\/folders outside the current working directory\./.test(e.message);if(t){const e="clean-webpack-plugin: Cannot delete files/folders outside the current working directory. Can be overridden with the `dangerouslyAllowCleanPatternsOutsideProject` option.";throw new Error(e)}throw e}}}const dt=t=>new pt({verbose:true,cleanOnceBeforeBuildPatterns:[`${s.join(e.ensureSlash(t[0],true),"**/*")}`]});const ft=(e,t)=>new l({filename:`[name]/${X("css",e,t==null?void 0:t.enableBundleHashName)}`,chunkFilename:"[id].[contenthash].css"});const ht="ExternalTemplateRemotesPlugin";const mt=e=>e.constructor.name==="ExternalModule";class gt{apply(e){e.hooks.make.tap(ht,(e=>{const t=[];e.hooks.buildModule.tap(ht,(e=>{if(mt(e)&&e.externalType==="script"){t.push(e)}}));e.hooks.afterCodeGeneration.tap(ht,(()=>{t.map((t=>{const n=b(t.request)[0];const r=bt(n);const s=e.codeGenerationResults.get(t,undefined).sources;const o=s.get("javascript");if(o){const e=new g.RawSource(o.source().toString().replace(`"${n}"`,r));s.set("javascript",e)}}))}))}))}}function bt(e){const t=[];const n=[];let r=false;let s=false;for(const o of e){if(o==="["){if(r){s=true;break}r=true;if(n.length){t.push(`"${n.join("")}"`);n.length=0}}else if(o==="]"){if(!r){s=true;break}r=false;if(n.length){t.push(`${n.join("")}`);n.length=0}n.length=0}else{n.push(o)}}if(r||s){throw new Error(`Invalid template URL "${e}"`)}if(n.length){t.push(`"${n.join("")}"`)}return t.join(" + ")}const vt=`HtmlInjectScriptPlugin`;class yt{constructor(e){this.scripts=void 0;this.scripts=e||[]}processScripts(){return this.scripts.filter(Boolean).map((e=>({tagName:"script",innerHTML:e,voidTag:false,attributes:{},meta:{plugin:"html-inject-script-webpack-plugin"}})))}apply(e){e.hooks.compilation.tap(`${vt}_compilation`,(e=>{const t=v.getHooks(e);t.alterAssetTags.tap(`${vt}_alterAssetTags`,(e=>{e.assetTags.scripts.unshift(...this.processScripts());return e}))}))}}const wt=(e="")=>e.replace(/[\/-]/gi,"_").toLowerCase();const kt=e=>s.join(e,`micro-remote-module.js`);const jt=(t,[n,r],s)=>{var o;const i=(o=r.options)==null?void 0:o.moduleFederation;const l=[];if(i){const{remotes:r,...o}=i;const c=kt(n);const u=wt(n);const p=(r||[]).map((({name:t,endpoint:n})=>{const r=wt(t);const s=kt(t);const o=n?e.ensureSlash(n(t),false):`[window.evolveFetchMicroWidgets()]`;return{[r]:`${r}@${o}/${s}`}}));l.push(new a.container.ModuleFederationPlugin({name:u,filename:c,remotes:p,...o}),new gt);if(!t){l.unshift(new yt([H(s)]))}}return l};const Ct={minifyJS:true,removeComments:true,collapseWhitespace:true,collapseBooleanAttributes:false};const Ot=(e,t,[n,r],s)=>{const o=[];const{options:i}=r;const a=e?"development":"production";for(const e of s){o.push(new v({inject:"body",title:F("title",a,i==null?void 0:i.title),chunks:[n],minify:(i==null?void 0:i.minify)===false?false:["me","dev"].includes(e)?false:Ct,filename:`${n}/index${e==="prod"?"":`-${e}`}.html`,template:F("template",a,i==null?void 0:i.template).replace(`{0}`,e),templateParameters:{title:F("title",a,i==null?void 0:i.title),favicon:F("favicon",a,i==null?void 0:i.favicon),inlineScripts:F("inlineScripts",a,i==null?void 0:i.inlineScripts),headBeforeStyles:F("headBeforeStyles",a,i==null?void 0:i.headBeforeStyles),headBeforeScripts:F("headBeforeScripts",a,i==null?void 0:i.headBeforeScripts),bodyAfterScripts:F("bodyAfterScripts",a,i==null?void 0:i.bodyAfterScripts),viewport:J(t,i)?F("viewport",a,i==null?void 0:i.viewport):""},multiCdn:{env:e,disabled:((i==null?void 0:i.excludeCdnEnvs)||["me","dev","ntv"]).includes(e)}}))}return o};class xt{constructor(e){var t;this.config=e;this.pluginName="FlatEvolveMultiCdnPlugin";this.requireFn=a.RuntimeGlobals.publicPath;if(!((t=this.config)!=null&&t.prod)){throw new Error("We must setup `prod` for each CDN config node!")}}apply(e){e.hooks.thisCompilation.tap(this.pluginName,(e=>{e.mainTemplate.hooks.requireExtensions.tap(this.pluginName,((t,n)=>{var r;const s=[];s.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const o=(r=e.chunkGraph)==null?void 0:r.getTreeRuntimeRequirements(n);if(o&&o.has(a.RuntimeGlobals.requireScope)){s.push("(function () {");s.push(a.Template.indent(`var flatjsMultiCdn = {`));s.push(a.Template.indent(a.Template.indent([`cdnConfig: ${JSON.stringify(this.config||{})},`])));s.push(a.Template.indent(a.Template.indent([`cdnFinder: ${W.toString()}`])));s.push(a.Template.indent(`};`));s.push(a.Template.indent(`${this.requireFn} = flatjsMultiCdn.cdnFinder(flatjsMultiCdn.cdnConfig) || ${this.requireFn};`));s.push("})();")}return a.Template.asString(s)}))}));e.hooks.compilation.tap(this.pluginName,(e=>{v.getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,(e=>{const{assets:t}=e;const{userOptions:n}=e.plugin;const r=n.multiCdn;const o=t.publicPath;const i=t.js.map((e=>{if(r.disabled){return s.basename(e)}const t=U(this.config,r.env);return z(t,e.replace(o,""))}));const a=t.css.map((e=>{if(r.disabled){return s.basename(e)}const t=U(this.config,r.env);return z(t,e.replace(o,""))}));e.assets.js=i;e.assets.css=a;return e}))}))}}const Pt=(e,t,n)=>{var r;const s=[new h];if(n.analyzer){s.push(new m.BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...n.analyzer}))}s.push(ft(e,n.pluginLoaderOptions));s.push(...jt(e,t,n.multiHtmlCdn));if(!e){s.push(dt(t));const r=Object.keys(n.multiHtmlCdn);s.push(...Ot(e,n,t,r));s.push(new xt(n.multiHtmlCdn))}const o=oe(((r=n.pluginLoaderOptions)==null?void 0:r.babelOptions)||{},e);if(o.usePreset==="react"&&e){s.push(new f({overlay:false}))}return s};const Mt=(n,r,o,i)=>{process.env.NODE_ENV=n;r=r==="auto"?"auto":e.ensureSlash(r,true);const a=n==="development";const l=i.projectCwd;const c=i.pluginLoaderOptions;const u=i.watchOptions;const p=Y(o);const d=t.isFunction(i.extraLoaders)?i.extraLoaders(a):i.extraLoaders;const f=[...ce(a,i,p,c),...d||[]];const h=t.isFunction(i.extraPlugins)?i.extraPlugins(a):i.extraPlugins;const m=t.isFunction(i.resolveAlias)?i.resolveAlias(a):i.resolveAlias;const g=[...Pt(a,p,i),...h||[]];const b={mode:n,target:i.target,stats:{preset:"minimal"},infrastructureLogging:{level:"warn"},devtool:a?"eval-source-map":i.productionSourceMap||false,plugins:g,watchOptions:u,context:l,cache:{type:"memory"},resolve:{mainFields:["browser","module","main"],extensions:[".ts",".tsx",".js",".json",".vue"],alias:m||{}},module:{rules:f},externals:R(a,i.externals,p),performance:_(a,i.performance),output:{devtoolModuleFilenameTemplate:({namespace:e,resourcePath:t})=>`webpack:///${s.join(e,t)}`,environment:{},pathinfo:false,path:s.join(l,"public"),publicPath:r,filename:`[name]/${X("js",a,c==null?void 0:c.enableBundleHashName)}`,chunkFilename:`[id].[contenthash].js`},optimization:{nodeEnv:a?"development":"production",chunkIds:a?"named":"named",moduleIds:a?"named":"named",minimize:i.minimize===false?false:a?false:true,minimizer:ut(a,i),splitChunks:{name:false,chunks:"all",minSize:25e5,cacheGroups:{default:false,defaultVendors:false}}}};return b};const St=(e,t,n)=>{const r=Mt("production",t,e,n);const s=G(e,r);if(s.length>1){throw new Error("startSingleEntryBuild() only support `compiler` at a time")}const o=s[0];return new Promise(((e,t)=>{a(o,((r,s)=>{var i,a;if(r){return t(r)}const l=s==null?void 0:s.toJson();if(l!=null&&(i=l.errors)!=null&&i.length){return t(l.errors)}if(n.forBuild.rejectWarnings&&l!=null&&(a=l.warnings)!=null&&a.length){return t(l.warnings)}e({name:o.name,warningStats:l==null?void 0:l.warnings})}))}))};const At=async(t,n)=>{var r;await e.keepPackageDepsUpToDateForNonMonoRepo({cwd:process.cwd(),autoUpgrade:true,needVerifyPackages:n.needVerifyPackages||{}});const s=((r=n.multiHtmlCdn)==null?void 0:r.prod)||[];const o=[];const i=e.ensureSlash(s[Math.floor(Math.random()*s.length)],true);for(const[e,r]of Object.entries(t)){var a;const t=V(r,n);const s={[e]:r};const l=(a=r.options)==null?void 0:a.useRelativeAssetPath;o.push(St(s,l?"auto":i,t))}return Promise.all(o)};const Et=async(n,r,o)=>{const i=await e.getPackageDir(__dirname,process.cwd());const a=j.readFileSync(s.join(i,"./templates/main.html"),"utf-8");const l=[];for(const[t,s]of Object.entries(o.entryMap)){var c;const i=((c=s.options)==null?void 0:c.servePageMainLinkFn)||(e=>e);const a=Object.keys(n).includes(t);const u=o.projectVirtualPath.replace(/^\//,"");l.push({name:t.replace(u,"").replace(/^\//,""),link:i(e.urlJoin(r,["pages",t],{env:"me"}),{hostUri:r,entryName:t,virtualPath:u}),flagText:a?"serve":"static",isServed:a?1:0})}const u={title:"@flatjs/evolve",modules:l.sort(((e,t)=>t.isServed-e.isServed))};return t.template(a)(u)};const Bt=async(n,r,o,i,a,l)=>{const c=l.entryMap;const u=Object.keys(c).sort(((e,t)=>t.length-e.length));const p=await e.getPackageDir(__dirname,process.cwd());const d=u.find((t=>e.ensureSlash(o.path.replace(/^\//,""),true).startsWith(e.ensureSlash(t,true))));if(!d){const e=j.readFileSync(s.join(p,`./templates/module-404.html`),"utf-8");return t.template(e)({title:"404 Not Found",errorMeta:[{name:`@flatjs/evolve workspace`,value:p},{name:`served entry names`,value:JSON.stringify(u)},{name:`module path`,value:`${o.path}`}]})}const f=c[d];const h=f.options;const m=n[d];const g=(m==null?void 0:m.devServerHostUri)||i;const b=(h==null?void 0:h.serveModuleTemplate)||"./templates/module.html";const v=s.join(l.projectCwd,"./templates/module.html");const y=j.readFileSync(s.isAbsolute(b)?b:e.existsSync(v)?v:s.join(p,"./templates/module.html"),"utf-8");const w=l.forServe;const k=w.defaultServeGlobalData?w.defaultServeGlobalData(f,i):{};const C={title:F("title",r,h==null?void 0:h.title),favicon:F("favicon",r,h==null?void 0:h.favicon),viewport:J(l,h)?F("viewport",r,h==null?void 0:h.viewport):"",inlineScripts:F("inlineScripts",r,h==null?void 0:h.inlineScripts),headBeforeStyles:F("headBeforeStyles",r,h==null?void 0:h.headBeforeStyles),headBeforeScripts:F("headBeforeScripts",r,h==null?void 0:h.headBeforeScripts),bodyAfterScripts:F("bodyAfterScripts",r,h==null?void 0:h.bodyAfterScripts),moduleFederationScripts:H({me:[e.urlJoin(i,["public"])]}),global:{hostUrl:i,apiBase:e.urlJoin(i,[a]),routeBaseName:s.join(`/pages`,d),moduleName:d.replace(l.projectVirtualPath,"").replace(/^\//,""),...k,...(h==null?void 0:h.serveGlobalData)||{}},styles:[e.urlJoin(g,[s.join("public",d,"bundle.css")])],scripts:[e.urlJoin(g,[s.join("public",d,"bundle.js")])]};return t.template(y)(C)};const Rt=(e,t,n,r,s)=>{const o=async(o,i)=>{let a;if(o.path==="/"){a=await Et(r,t,s)}else{a=await Bt(r,e,o,t,n,s)}i.send(a)};return(s.forServe.pageMiddlewares||[]).concat(o)};const $t=t=>async(n,r)=>{const o=n.baseUrl;if(!o.startsWith("/public")){r.redirect("/pages")}else{const n=await e.fileWalk(s.join("public/","**/*.{js,css}"),{cwd:t});const i=s.extname(o);const a=n.find((e=>s.extname(e)===i&&e.indexOf(o.replace(/\.(js|css)$/,""))!==-1));if(a){r.sendFile(a)}else{r.sendFile(s.join(t,o))}}};const qt=(e,t="development",r,s,o,i,a)=>{const l=w();n.attachMockMiddlewares(l,a);l.set("hostUri",s);l.use("/pages",...Rt(t,s,a.apiContext||"api",o,i));l.use("*",$t(e));return new Promise((e=>{const t=i.https?k.createServer(i.https,l):l;t.listen(r,(()=>{e(true)}))}))};const Ft=(e,t,n)=>{const{projectCwd:r,https:o,liveReload:i}=n;const a=new y({server:{type:o?"https":"http",options:{...o}},open:false,compress:true,port:t,hot:!i,liveReload:i,allowedHosts:"all",static:{directory:`${s.join(r,"/public")}`},headers:{"Access-Control-Allow-Origin":"*"},client:{progress:true,overlay:{errors:true,warnings:false}}},e);return new Promise(((e,t)=>{a.startCallback((n=>{if(n){return t(n)}e(true)}))}))};const Tt=async(r,o,i,l)=>{await e.keepPackageDepsUpToDateForNonMonoRepo({cwd:process.cwd(),autoUpgrade:true,needVerifyPackages:i.needVerifyPackages||{}});if(i.https){l.https=i.https}const{mockPort:c,hostUri:u}=await n.prepareMockDomain(l);const p=e.urlJoin(u,["/pages"]);let d=c;const f=[];const h={};for(const[e]of Object.entries(o)){d=d+1;const{mockPort:r,hostUri:s}=await n.prepareMockDomain(t.merge({},l,{port:d}));h[e]={devServerPort:r,devServerHostUri:s}}for(const[t,n]of Object.entries(o)){var m,g;const o=((m=n.options)==null?void 0:(g=m.moduleFederation)==null?void 0:g.remotes)||[];o.forEach((t=>{t.endpoint=t=>{var n;return e.urlJoin(((n=h[t])==null?void 0:n.devServerHostUri)||u,["/public"])}}));const{devServerPort:l,devServerHostUri:c}=h[t];const d=e.urlJoin(c,["public"]);const b={[t]:n};const v=V(n,i);const y=Mt("development",d,b,v);const w=a.webpack(G(b,y)[0]);f.push(Ft(w,l,i));const k=it.bgBlack(`[${it.magenta("@flatjs")}:${it.bold(w.name||"")}]`);w.hooks.invalid.tap("fileChange",(e=>{console.log(k,`${"file change".padEnd(12," ")} ➩ ${it.cyan(s.relative(r,e||""))}`)}));w.hooks.done.tap("compileDone",(()=>{console.log(k,`${"serve page".padEnd(12," ")} ➩ ${it.cyan(p)}`)}))}await qt(r,"development",c,u,h,i,l);L(p);return Promise.all(f).then((()=>true)).catch((e=>{console.log("evolve serve err: ",e);return false}))};const It=async(t,r,s)=>{if(r.https){s.https=r.https}const{mockPort:o,hostUri:i}=await n.prepareMockDomain(s);const a=e.urlJoin(i,["/pages"]);return qt(t,"development",o,i,{},r,s).then((e=>{const t=it.bgBlack(`[${it.magenta("@flatjs")}:`);console.log(t,`${"serve page".padEnd(12," ")} ➩ ${it.cyan(a)}`);return e}))};const _t=(e={},n={})=>{const r={};for(const[s,o]of Object.entries(n)){const n={options:{}};if(e[s]){r[s]=t.merge({},n,o,e[s])}t.merge(o,n)}return r};const Dt=(e,t,n={})=>{const r=N(e,n);const s=_t(t,r.entryMap);return At(s,r)};const Nt=(e,t,r={},s={})=>{const o=N(e,r);const i=n.loadMockConfiguration(e,s);const a=_t(t,o.entryMap);return Tt(e,a,o,i)};const Lt=(e,t={},r={})=>{const s=N(e,t);const o=n.loadMockConfiguration(e,r);return It(e,s,o)};exports.cdnBoot=E;exports.cdnJsDelivr=A;exports.cdnUnpkg=S;exports.createPageMiddleware=Rt;exports.createPublicAssetsMiddleware=$t;exports.defaultFlatjsConfig=B;exports.evolveBuild=Dt;exports.evolveServe=Nt;exports.evolveStatic=Lt;exports.flatBabelOptions=P;exports.flatExternalOptions=R;exports.flatLessLoaderOptions=T;exports.flatPerformanceOptions=_;exports.flatPostcssLoaderOptions=I;exports.getHtmlPluginConfig=F;exports.loadEvolveConfiguration=N;exports.loadModule=x;exports.normalizeEntries=_t;exports.polyfill=M;exports.terserOptions=D;exports.viewportScripts=$;
4
+ extractComments:false,terserOptions:t.merge({ecma:undefined,parse:{},compress:{},mangle:true,module:false,output:null,toplevel:false,nameCache:null,ie8:false,keep_classnames:undefined,keep_fnames:false,safari10:false},e)});const W=(n=process.cwd(),r)=>{const s=e.loadFlatjsConfig(n,"flatjsEvolve","flatjs.evolve.js");return t.merge({},E.flatjsEvolve,s.flatjsEvolve,r,{projectCwd:n})};const z=e=>{try{C(e)}catch(e){console.warn(`Unable to open browser. If you are running in a headless environment\n`)}};function L(e="",t=""){return e.replace(/\/$/,"")+"/"+t.replace(/^\//,"")}function U(e){const t=new RegExp("[?&]env(=([^&#]*)|&|#|$)");const n=t.exec(window.location.href);const r=n&&n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"prod";const s=e[r]||e["prod"]||[];const o=s[Math.floor(Math.random()*s.length)];return o.replace(/\/$/,"")+"/"}function H(e={},t="prod"){const n=e[t]||e["prod"]||[];return n[Math.floor(Math.random()*n.length)]}function I(e){return`window.evolveFetchMicroWidgets = function () {\n var cdnConfig = ${JSON.stringify(e)};\n var cdnFinder = ${U.toString()};\n return (cdnFinder(cdnConfig) || '').replace(/\\/$/, '');\n }`}function J(e,n){const r=[];for(const[t,n]of Object.entries(e)){r.push({[t]:n.entry})}return r.map((e=>t.merge({},n,{name:Object.keys(e)[0],entry:e})))}const V=(e,n)=>{var r,s;const o=t.merge({},n.pluginLoaderOptions);if((r=e.options)!=null&&r.allowPx2rem){t.set(o,"pixelOptions.enabled",e.options.allowPx2rem)}if((s=e.options)!=null&&s.enableBundleHashName){t.set(o,"enableBundleHashName",e.options.enableBundleHashName)}const i={...n,pluginLoaderOptions:o};return i};const _=(e,t)=>{var n,r;const s=(n=e.pluginLoaderOptions)==null?void 0:(r=n.pixelOptions)==null?void 0:r.enabled;const o=(t==null?void 0:t.allowPx2rem)??s;return!!o};const G=e=>{if(Object.keys(e).length>1){throw new Error(`Only single one entry map support now while "serve", "build" process!`)}let t=undefined;for(const[n,r]of Object.entries(e)){t=[n,r];break}if(!t){throw new Error(`No entry map found while "serve", "build" process!`)}return t};const K=()=>Date.now().toString();const X=(e,t,n=true)=>{const r=e==="js"?".js":".css";if(t){return`bundle${r}`}if(n){return`bundle[contenthash]${r}`}return`bundle${r}?${K()}`};const Q=/svg-icons\//;const Y=/\.(jpe?g|png|gif|svg)$/;const Z=/\.(ttf|eot|woff|woff2)(\?.+)?$/;const ee=e=>Q.test(e)&&e.endsWith(".svg");const te=({projectCwd:e,projectVirtualPath:t},n,[r,o])=>{let i=s.dirname(s.join(t,n.replace(/^src/,"")));const a=o.entry.map((t=>s.dirname(s.join(e,t))));const l=s.resolve(e,n);const c=a.find((e=>l.startsWith(e)));if(c){i=s.dirname(s.join(r,s.relative(c,l)))}return`${i}/[name]-[contenthash:8][ext]`};const ne=(e,t)=>{const n={test(e){return Z.test(e)||Y.test(e)&&!ee(e)},type:"asset",generator:{filename({filename:n}){return te(e,n,t)}},parser:{dataUrlCondition:{maxSize:4*1024}}};return n};const re=()=>{const e={test(e){return ee(e)},use:[{loader:require.resolve("./loader-icon"),options:{svgo:{plugins:[{name:"removeTitle"},{name:"removeDimensions"}]}}}]};return e};function se(e,n){const r=t.isFunction(e)?e(n):e;if(r.usePreset==="react"&&n){if(r.plugins){r.plugins.push(require.resolve("react-refresh/babel"))}else{r.plugins=[require.resolve("react-refresh/babel")]}}return r}const oe=(e,n={})=>{const{babelOptions:r={},modularImports:s=[]}=n;const o=se(r,e);const i=t.isFunction(s)?s(e):s;const a=P(o,i);const l={test:/\.(tsx|ts|js|jsx)$/,use:[{loader:require.resolve("babel-loader"),options:a}]};return l};const ie=(e,t={})=>{const n={test:/\.css$/i,use:[{loader:l.loader,options:{esModule:true}},{loader:"css-loader",options:{sourceMap:e}}]};const{pixelOptions:r,cssnanoOptions:s}=t;if(Array.isArray(n.use)){n.use.push({loader:"postcss-loader",options:{postcssOptions:R(e,r,s),sourceMap:e}})}return n};const ae=(e,t={})=>{const n=ie(e,t);n.test=/\.less$/i;const r=t.lessOptions;if(Array.isArray(n.use)){n.use.push({loader:require.resolve("less-loader"),options:{sourceMap:e,lessOptions:D(e,r)}})}return n};const le=(e,t,n,r={})=>{const s=[re(),ne(t,n),ie(e,r),ae(e,r),oe(e,r)];return s};const ce=new Map;const pe=()=>{const t=[["svgo",{}],["gifsicle",{}],["jpegtran",{}],["pngquant",{}]];const n=t.map((t=>{const n=t[0];try{require.resolve(`imagemin-${n}`);return t}catch(t){if(!ce.get(n)){ce.set(n,true);const t=c.magenta(`"npm install imagemin-${n} -D"`);e.Logger.warn(`Execute ${t} for assets optimization`,"@flatjs/evolve")}return null}})).filter(Boolean);if(n.length){return new p({minimizer:{implementation:p.imageminMinify,options:{plugins:n}}})}return null};const ue=e=>new u(N(e.minimizeTerserOptions));const de=(e,t)=>{if(e){return[]}return[ue(t),pe()].filter(Boolean)};class me{constructor(e={}){this.verbose=void 0;this.cleanStaleWebpackAssets=void 0;this.protectWebpackAssets=void 0;this.cleanAfterEveryBuildPatterns=void 0;this.cleanOnceBeforeBuildPatterns=void 0;this.currentAssets=void 0;this.initialClean=void 0;this.outputPath=void 0;this.verbose=e.verbose===true||false;this.cleanStaleWebpackAssets=e.cleanStaleWebpackAssets===true||e.cleanStaleWebpackAssets===false?e.cleanStaleWebpackAssets:true;this.protectWebpackAssets=e.protectWebpackAssets===true||e.protectWebpackAssets===false?e.protectWebpackAssets:true;this.cleanAfterEveryBuildPatterns=Array.isArray(e.cleanAfterEveryBuildPatterns)?e.cleanAfterEveryBuildPatterns:[];this.cleanOnceBeforeBuildPatterns=Array.isArray(e.cleanOnceBeforeBuildPatterns)?e.cleanOnceBeforeBuildPatterns:["**/*"];this.currentAssets=[];this.initialClean=false;this.outputPath="";this.apply=this.apply.bind(this);this.handleInitial=this.handleInitial.bind(this);this.handleDone=this.handleDone.bind(this);this.removeFiles=this.removeFiles.bind(this)}apply(e){if(!e.options.output||!e.options.output.path){console.warn("clean-webpack-plugin: options.output.path not defined. Plugin disabled...");return}this.outputPath=e.options.output.path;const t=e.hooks;if(this.cleanOnceBeforeBuildPatterns.length!==0){t.emit.tap("clean-webpack-plugin",(e=>{this.handleInitial(e)}))}t.done.tap("clean-webpack-plugin",(e=>{this.handleDone(e)}))}handleInitial(e){if(this.initialClean){return}const t=e.getStats();if(t.hasErrors()){return}this.initialClean=true;this.removeFiles(this.cleanOnceBeforeBuildPatterns)}handleDone(e){if(e.hasErrors()){if(this.verbose){console.warn("clean-webpack-plugin: pausing due to webpack errors")}return}const t=e.toJson({assets:true}).assets||[];const n=t.map((e=>e.name));const r=this.currentAssets.filter((e=>{const t=n.includes(e)===false;return t}));this.currentAssets=n.sort();const s=[];if(this.cleanStaleWebpackAssets===true&&r.length!==0){s.push(...r)}if(this.cleanAfterEveryBuildPatterns.length!==0){s.push(...this.cleanAfterEveryBuildPatterns)}if(s.length!==0){this.removeFiles(s)}}removeFiles(t){try{const n=e.delFilesSync(t,{cwd:this.outputPath,dot:true,ignore:this.protectWebpackAssets?this.currentAssets:[]});if(this.verbose){n.forEach((e=>{const t=s.relative(process.cwd(),e);const n="removed";console.warn(`clean-webpack-plugin: ${n} ${t}`)}))}}catch(e){const t=/Cannot delete files\/folders outside the current working directory\./.test(e.message);if(t){const e="clean-webpack-plugin: Cannot delete files/folders outside the current working directory. Can be overridden with the `dangerouslyAllowCleanPatternsOutsideProject` option.";throw new Error(e)}throw e}}}const fe=t=>new me({verbose:true,cleanOnceBeforeBuildPatterns:[`${s.join(e.ensureSlash(t[0],true),"**/*")}`]});const he=(e,t)=>new l({filename:`[name]/${X("css",e,t==null?void 0:t.enableBundleHashName)}`,chunkFilename:"[id].[contenthash].css"});const ve="ExternalTemplateRemotesPlugin";const ge=e=>e.constructor.name==="ExternalModule";class be{apply(e){e.hooks.make.tap(ve,(e=>{const t=[];e.hooks.buildModule.tap(ve,(e=>{if(ge(e)&&e.externalType==="script"){t.push(e)}}));e.hooks.afterCodeGeneration.tap(ve,(()=>{t.map((t=>{const n=v(t.request)[0];const r=ye(n);const s=e.codeGenerationResults.get(t,undefined).sources;const o=s.get("javascript");if(o){const e=new h.RawSource(o.source().toString().replace(`"${n}"`,r));s.set("javascript",e)}}))}))}))}}function ye(e){const t=[];const n=[];let r=false;let s=false;for(const o of e){if(o==="["){if(r){s=true;break}r=true;if(n.length){t.push(`"${n.join("")}"`);n.length=0}}else if(o==="]"){if(!r){s=true;break}r=false;if(n.length){t.push(`${n.join("")}`);n.length=0}n.length=0}else{n.push(o)}}if(r||s){throw new Error(`Invalid template URL "${e}"`)}if(n.length){t.push(`"${n.join("")}"`)}return t.join(" + ")}const we=`HtmlInjectScriptPlugin`;class je{constructor(e){this.scripts=void 0;this.scripts=e||[]}processScripts(){return this.scripts.filter(Boolean).map((e=>({tagName:"script",innerHTML:e,voidTag:false,attributes:{},meta:{plugin:"html-inject-script-webpack-plugin"}})))}apply(e){e.hooks.compilation.tap(`${we}_compilation`,(e=>{const t=g.getHooks(e);t.alterAssetTags.tap(`${we}_alterAssetTags`,(e=>{e.assetTags.scripts.unshift(...this.processScripts());return e}))}))}}const Ce=(e="")=>e.replace(/[\/-]/gi,"_").toLowerCase();const ke=e=>s.join(e,`micro-remote-module.js`);const Se=(t,[n,r],s)=>{var o;const i=(o=r.options)==null?void 0:o.moduleFederation;const l=[];if(i){const{remotes:r,...o}=i;const c=ke(n);const p=Ce(n);const u=(r||[]).map((({name:t,endpoint:n})=>{const r=Ce(t);const s=ke(t);const o=n?e.ensureSlash(n(t),false):`[window.evolveFetchMicroWidgets()]`;return{[r]:`${r}@${o}/${s}`}}));l.push(new a.container.ModuleFederationPlugin({name:p,filename:c,remotes:u,...o}),new be);if(!t){l.unshift(new je([I(s)]))}}return l};const Pe={minifyJS:true,removeComments:true,collapseWhitespace:true,collapseBooleanAttributes:false};const Oe=(e,t,[n,r],s)=>{const o=[];const{options:i}=r;const a=e?"development":"production";for(const e of s){o.push(new g({inject:"body",title:F("title",a,i==null?void 0:i.title),chunks:[n],minify:(i==null?void 0:i.minify)===false?false:["me","dev"].includes(e)?false:Pe,filename:`${n}/index${e==="prod"?"":`-${e}`}.html`,template:F("template",a,i==null?void 0:i.template).replace(`{0}`,e),templateParameters:{title:F("title",a,i==null?void 0:i.title),favicon:F("favicon",a,i==null?void 0:i.favicon),inlineScripts:F("inlineScripts",a,i==null?void 0:i.inlineScripts),headBeforeStyles:F("headBeforeStyles",a,i==null?void 0:i.headBeforeStyles),headBeforeScripts:F("headBeforeScripts",a,i==null?void 0:i.headBeforeScripts),bodyAfterScripts:F("bodyAfterScripts",a,i==null?void 0:i.bodyAfterScripts),viewport:_(t,i)?F("viewport",a,i==null?void 0:i.viewport):""},multiCdn:{env:e,disabled:((i==null?void 0:i.excludeCdnEnvs)||["me","dev","ntv"]).includes(e)}}))}return o};class xe{constructor(e){var t;this.config=e;this.pluginName="FlatEvolveMultiCdnPlugin";this.requireFn=a.RuntimeGlobals.publicPath;if(!((t=this.config)!=null&&t.prod)){throw new Error("We must setup `prod` for each CDN config node!")}}apply(e){e.hooks.thisCompilation.tap(this.pluginName,(e=>{e.mainTemplate.hooks.requireExtensions.tap(this.pluginName,((t,n)=>{var r;const s=[];s.push("// Dynamic assets path override(`@flatjs/evolve`) plugin-multi-html-cdn`)");const o=(r=e.chunkGraph)==null?void 0:r.getTreeRuntimeRequirements(n);if(o&&o.has(a.RuntimeGlobals.requireScope)){s.push("(function () {");s.push(a.Template.indent(`var flatjsMultiCdn = {`));s.push(a.Template.indent(a.Template.indent([`cdnConfig: ${JSON.stringify(this.config||{})},`])));s.push(a.Template.indent(a.Template.indent([`cdnFinder: ${U.toString()}`])));s.push(a.Template.indent(`};`));s.push(a.Template.indent(`${this.requireFn} = flatjsMultiCdn.cdnFinder(flatjsMultiCdn.cdnConfig) || ${this.requireFn};`));s.push("})();")}return a.Template.asString(s)}))}));e.hooks.compilation.tap(this.pluginName,(e=>{g.getHooks(e).beforeAssetTagGeneration.tap(this.pluginName,(e=>{const{assets:t}=e;const{userOptions:n}=e.plugin;const r=n.multiCdn;const o=t.publicPath;const i=t.js.map((e=>{if(r.disabled){return s.basename(e)}const t=H(this.config,r.env);return L(t,e.replace(o,""))}));const a=t.css.map((e=>{if(r.disabled){return s.basename(e)}const t=H(this.config,r.env);return L(t,e.replace(o,""))}));e.assets.js=i;e.assets.css=a;return e}))}))}}const Ae=(e,t,n)=>{var r;const s=[new m];if(n.analyzer){s.push(new f.BundleAnalyzerPlugin({analyzerPort:"auto",analyzerMode:"server",...n.analyzer}))}s.push(he(e,n.pluginLoaderOptions));s.push(...Se(e,t,n.multiHtmlCdn));if(!e){s.push(fe(t));const r=Object.keys(n.multiHtmlCdn);s.push(...Oe(e,n,t,r));s.push(new xe(n.multiHtmlCdn))}const o=se(((r=n.pluginLoaderOptions)==null?void 0:r.babelOptions)||{},e);if(o.usePreset==="react"&&e){s.push(new d({overlay:false}))}return s};const Be=(n,r,o,i)=>{process.env.NODE_ENV=n;r=r==="auto"?"auto":e.ensureSlash(r,true);const a=n==="development";const l=i.projectCwd;const c=i.pluginLoaderOptions;const p=i.watchOptions;const u=G(o);const d=t.isFunction(i.extraLoaders)?i.extraLoaders(a):i.extraLoaders;const m=[...le(a,i,u,c),...d||[]];const f=t.isFunction(i.extraPlugins)?i.extraPlugins(a):i.extraPlugins;const h=t.isFunction(i.resolveAlias)?i.resolveAlias(a):i.resolveAlias;const v=[...Ae(a,u,i),...f||[]];const g={mode:n,target:i.target,stats:{preset:"minimal"},infrastructureLogging:{level:"warn"},devtool:a?"eval-source-map":i.productionSourceMap||false,plugins:v,watchOptions:p,context:l,cache:{type:"memory"},resolve:{mainFields:["browser","module","main"],extensions:[".ts",".tsx",".js",".json",".vue"],alias:h||{}},module:{rules:m},externals:$(a,i.externals,u),performance:T(a,i.performance),output:{devtoolModuleFilenameTemplate:({namespace:e,resourcePath:t})=>`webpack:///${s.join(e,t)}`,environment:{},pathinfo:false,path:s.join(l,"public"),publicPath:r,filename:`[name]/${X("js",a,c==null?void 0:c.enableBundleHashName)}`,chunkFilename:`[id].[contenthash].js`},optimization:{nodeEnv:a?"development":"production",chunkIds:a?"named":"named",moduleIds:a?"named":"named",minimize:i.minimize===false?false:a?false:true,minimizer:de(a,i),splitChunks:{name:false,chunks:"all",minSize:25e5,cacheGroups:{default:false,defaultVendors:false}}}};return g};const Ee=(e,t,n)=>{const r=Be("production",t,e,n);const s=J(e,r);if(s.length>1){throw new Error("startSingleEntryBuild() only support `compiler` at a time")}const o=s[0];return new Promise(((e,t)=>{a(o,((r,s)=>{var i,a;if(r){return t(r)}const l=s==null?void 0:s.toJson();if(l!=null&&(i=l.errors)!=null&&i.length){return t(l.errors)}if(n.forBuild.rejectWarnings&&l!=null&&(a=l.warnings)!=null&&a.length){return t(l.warnings)}e({name:o.name,warningStats:l==null?void 0:l.warnings})}))}))};const $e=async(t,n)=>{var r;await e.keepPackageDepsUpToDateForNonMonoRepo({cwd:process.cwd(),autoUpgrade:true,needVerifyPackages:n.needVerifyPackages||{}});const s=((r=n.multiHtmlCdn)==null?void 0:r.prod)||[];const o=[];const i=e.ensureSlash(s[Math.floor(Math.random()*s.length)],true);for(const[e,r]of Object.entries(t)){var a;const t=V(r,n);const s={[e]:r};const l=(a=r.options)==null?void 0:a.useRelativeAssetPath;o.push(Ee(s,l?"auto":i,t))}return Promise.all(o)};const Me=async(n,r,o)=>{const i=await e.getPackageDir(__dirname,process.cwd());const a=j.readFileSync(s.join(i,"./templates/main.html"),"utf-8");const l=[];for(const[t,s]of Object.entries(o.entryMap)){var c;const i=((c=s.options)==null?void 0:c.servePageMainLinkFn)||(e=>e);const a=Object.keys(n).includes(t);const p=o.projectVirtualPath.replace(/^\//,"");l.push({name:t.replace(p,"").replace(/^\//,""),link:i(e.urlJoin(r,["pages",t],{env:"me"}),{hostUri:r,entryName:t,virtualPath:p}),flagText:a?"serve":"static",isServed:a?1:0})}const p={title:"@flatjs/evolve",modules:l.sort(((e,t)=>t.isServed-e.isServed))};return t.template(a)(p)};const qe=async(n,r,o,i,a,l)=>{const c=l.entryMap;const p=Object.keys(c).sort(((e,t)=>t.length-e.length));const u=await e.getPackageDir(__dirname,process.cwd());const d=p.find((t=>e.ensureSlash(o.path.replace(/^\//,""),true).startsWith(e.ensureSlash(t,true))));if(!d){const e=j.readFileSync(s.join(u,`./templates/module-404.html`),"utf-8");return t.template(e)({title:"404 Not Found",errorMeta:[{name:`@flatjs/evolve workspace`,value:u},{name:`served entry names`,value:JSON.stringify(p)},{name:`module path`,value:`${o.path}`}]})}const m=c[d];const f=m.options;const h=n[d];const v=(h==null?void 0:h.devServerHostUri)||i;const g=(f==null?void 0:f.serveModuleTemplate)||"./templates/module.html";const b=s.join(l.projectCwd,"./templates/module.html");const y=j.readFileSync(s.isAbsolute(g)?g:e.existsSync(b)?b:s.join(u,"./templates/module.html"),"utf-8");const w=l.forServe;const C=w.defaultServeGlobalData?w.defaultServeGlobalData(m,i):{};const k={title:F("title",r,f==null?void 0:f.title),favicon:F("favicon",r,f==null?void 0:f.favicon),viewport:_(l,f)?F("viewport",r,f==null?void 0:f.viewport):"",inlineScripts:F("inlineScripts",r,f==null?void 0:f.inlineScripts),headBeforeStyles:F("headBeforeStyles",r,f==null?void 0:f.headBeforeStyles),headBeforeScripts:F("headBeforeScripts",r,f==null?void 0:f.headBeforeScripts),bodyAfterScripts:F("bodyAfterScripts",r,f==null?void 0:f.bodyAfterScripts),moduleFederationScripts:I({me:[e.urlJoin(i,["public"])]}),global:{hostUrl:i,apiBase:e.urlJoin(i,[a]),routeBaseName:s.join(`/pages`,d),moduleName:d.replace(l.projectVirtualPath,"").replace(/^\//,""),...C,...(f==null?void 0:f.serveGlobalData)||{}},styles:[e.urlJoin(v,[s.join("public",d,"bundle.css")])],scripts:[e.urlJoin(v,[s.join("public",d,"bundle.js")])]};return t.template(y)(k)};const Fe=(e,t,n,r,s)=>{const o=async(o,i)=>{let a;if(o.path==="/"){a=await Me(r,t,s)}else{a=await qe(r,e,o,t,n,s)}i.send(a)};return(s.forServe.pageMiddlewares||[]).concat(o)};const De=t=>async(n,r)=>{const o=n.baseUrl;if(!o.startsWith("/public")){r.redirect("/pages")}else{const n=await e.fileWalk(s.join("public/","**/*.{js,css}"),{cwd:t});const i=s.extname(o);const a=n.find((e=>s.extname(e)===i&&e.indexOf(o.replace(/\.(js|css)$/,""))!==-1));if(a){r.sendFile(a)}else{r.sendFile(s.join(t,o))}}};const Re=(e,t="development",r,s,o,i,a)=>{const l=y();n.attachMockMiddlewares(l,a);l.set("hostUri",s);l.use("/pages",...Fe(t,s,a.apiContext||"api",o,i));l.use("*",De(e));return new Promise((e=>{const t=i.https?w.createServer(i.https,l):l;t.listen(r,(()=>{e(true)}))}))};const Te=(e,t,n)=>{const{projectCwd:r,https:o,liveReload:i}=n;const a=new b({server:{type:o?"https":"http",options:{...o}},open:false,compress:true,port:t,hot:!i,liveReload:i,allowedHosts:"all",static:{directory:`${s.join(r,"/public")}`},headers:{"Access-Control-Allow-Origin":"*"},client:{progress:true,overlay:{errors:true,warnings:false}}},e);return new Promise(((e,t)=>{a.startCallback((n=>{if(n){return t(n)}e(true)}))}))};const Ne=async(r,o,i,l)=>{await e.keepPackageDepsUpToDateForNonMonoRepo({cwd:process.cwd(),autoUpgrade:true,needVerifyPackages:i.needVerifyPackages||{}});if(i.https){l.https=i.https}const{mockPort:p,hostUri:u}=await n.prepareMockDomain(l);const d=e.urlJoin(u,["/pages"]);let m=p;const f=[];const h={};for(const[e]of Object.entries(o)){m=m+1;const{mockPort:r,hostUri:s}=await n.prepareMockDomain(t.merge({},l,{port:m}));h[e]={devServerPort:r,devServerHostUri:s}}for(const[t,n]of Object.entries(o)){var v,g;const o=((v=n.options)==null?void 0:(g=v.moduleFederation)==null?void 0:g.remotes)||[];o.forEach((t=>{t.endpoint=t=>{var n;return e.urlJoin(((n=h[t])==null?void 0:n.devServerHostUri)||u,["/public"])}}));const{devServerPort:l,devServerHostUri:p}=h[t];const m=e.urlJoin(p,["public"]);const b={[t]:n};const y=V(n,i);const w=Be("development",m,b,y);const j=a.webpack(J(b,w)[0]);f.push(Te(j,l,i));const C=c.bgBlack(`[${c.magenta("@flatjs")}:${c.bold(j.name||"")}]`);j.hooks.invalid.tap("fileChange",(e=>{console.log(C,`${"file change".padEnd(12," ")} ➩ ${c.cyan(s.relative(r,e||""))}`)}));j.hooks.done.tap("compileDone",(()=>{console.log(C,`${"serve page".padEnd(12," ")} ➩ ${c.cyan(d)}`)}))}await Re(r,"development",p,u,h,i,l);z(d);return Promise.all(f).then((()=>true)).catch((e=>{console.log("evolve serve err: ",e);return false}))};const We=async(t,r,s)=>{if(r.https){s.https=r.https}const{mockPort:o,hostUri:i}=await n.prepareMockDomain(s);const a=e.urlJoin(i,["/pages"]);return Re(t,"development",o,i,{},r,s).then((e=>{const t=c.bgBlack(`[${c.magenta("@flatjs")}:`);console.log(t,`${"serve page".padEnd(12," ")} ➩ ${c.cyan(a)}`);return e}))};const ze=(e={},n={})=>{const r={};for(const[s,o]of Object.entries(n)){const n={options:{}};if(e[s]){r[s]=t.merge({},n,o,e[s])}t.merge(o,n)}return r};const Le=(e,t,n={})=>{const r=W(e,n);const s=ze(t,r.entryMap);return $e(s,r)};const Ue=(e,t,r={},s={})=>{const o=W(e,r);const i=n.loadMockConfiguration(e,s);const a=ze(t,o.entryMap);return Ne(e,a,o,i)};const He=(e,t={},r={})=>{const s=W(e,t);const o=n.loadMockConfiguration(e,r);return We(e,s,o)};exports.cdnBoot=B;exports.cdnJsDelivr=A;exports.cdnUnpkg=x;exports.createPageMiddleware=Fe;exports.createPublicAssetsMiddleware=De;exports.defaultFlatjsConfig=E;exports.evolveBuild=Le;exports.evolveServe=Ue;exports.evolveStatic=He;exports.flatBabelOptions=P;exports.flatExternalOptions=$;exports.flatLessLoaderOptions=D;exports.flatPerformanceOptions=T;exports.flatPostcssLoaderOptions=R;exports.getHtmlPluginConfig=F;exports.loadEvolveConfiguration=W;exports.loadModule=S;exports.normalizeEntries=ze;exports.polyfill=O;exports.terserOptions=N;exports.viewportScripts=M;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatjs/evolve",
3
- "version": "1.5.12",
3
+ "version": "1.5.13",
4
4
  "description": "the webpack based tools `evolve` of @flatjs",
5
5
  "keywords": [
6
6
  "shared",
@@ -23,16 +23,17 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@babel/core": "^7.20.12",
26
- "@flatjs/common": "^1.5.12",
26
+ "@flatjs/common": "^1.5.13",
27
27
  "@flatjs/evolve-preset-babel": "^1.5.12",
28
28
  "@flatjs/forge-plugin-postcss-pixel": "^1.5.0",
29
- "@flatjs/mock": "^1.5.12",
29
+ "@flatjs/mock": "^1.5.13",
30
30
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
31
31
  "babel-loader": "^9.1.2",
32
32
  "babel-merge": "^3.0.0",
33
33
  "babel-plugin-import": "^1.13.6",
34
34
  "better-opn": "^3.0.2",
35
35
  "case-sensitive-paths-webpack-plugin": "^2.4.0",
36
+ "chalk": "^4.1.2",
36
37
  "css-loader": "^6.7.3",
37
38
  "cssnano": "^5.1.14",
38
39
  "cssnano-preset-default": "^5.2.13",
@@ -71,5 +72,5 @@
71
72
  "publishConfig": {
72
73
  "access": "public"
73
74
  },
74
- "gitHead": "419e104ed6425b87feaeda1f213f4c1988f8a400"
75
+ "gitHead": "45dd1103afa8ab2ca9016e7ae7aa4e0caf4be094"
75
76
  }