@empjs/cli 3.1.0-beta.2 → 3.1.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var hs=Object.create;var U=Object.defineProperty;var fs=Object.getOwnPropertyDescriptor;var us=Object.getOwnPropertyNames;var gs=Object.getPrototypeOf,ds=Object.prototype.hasOwnProperty;var h=(i,e)=>()=>(i&&(e=i(i=0)),e);var $=(i,e)=>{for(var t in e)U(i,t,{get:e[t],enumerable:!0})},Ve=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of us(e))!ds.call(i,r)&&r!==t&&U(i,r,{get:()=>e[r],enumerable:!(s=fs(e,r))||s.enumerable});return i};var l=(i,e,t)=>(t=i!=null?hs(gs(i)):{},Ve(e||!i||!i.__esModule?U(t,"default",{value:i,enumerable:!0}):t,i)),ys=i=>Ve(U({},"__esModule",{value:!0}),i);var a=h(()=>{"use strict"});var b,bs,S,vs,Cs,ws,oe,H,xs,Ss,j,ne,Es,ae,L,f,D=h(()=>{"use strict";a();b=l(require("chalk"),1),bs=b.default.hex("#1abc9c"),S=b.default.hex("#16a085"),vs=b.default.hex("#2ecc71"),Cs=b.default.hex("#27ae60"),ws=b.default.hex("#e74c3c"),oe=b.default.hex("#c0392b"),H=b.default.hex("#f1c40f"),xs=b.default.hex("#f39c12"),Ss=b.default.hex("#3498db"),j=b.default.hex("#2980b9"),ne=b.default.hex("#ecf0f1"),Es=b.default.hex("#fd79a8"),ae=b.default.hex("#e84393"),L=b.default.hex("#7f8c8d"),f={lightGreen:bs,green:S,lightCyan:vs,cyan:Cs,lightRed:ws,red:oe,yellow:H,orange:xs,lightBlue:Ss,blue:j,white:ne,lightMagenta:Es,magenta:ae,gray:L}});var pe,p,E=h(()=>{"use strict";a();D();pe=class{brandName="";fullName="";logLevel="debug";isLogTime=!1;setup({brandName:e,logLevel:t,fullName:s}){this.brandName=` [${e}] `,this.fullName=` ${s} `,this.fullName=f.green.bold(this.fullName),t&&(this.logLevel=t)}time=(...e)=>this.isLogTime&&console.time(...e);timeEnd=(...e)=>this.isLogTime&&console.timeEnd(...e);debug=(...e)=>["debug"].includes(this.logLevel)&&console.log(...e);info=(...e)=>["debug","info"].includes(this.logLevel)&&console.log(...e);warn=(...e)=>["debug","info","warn"].includes(this.logLevel)&&console.warn(...e);error=(...e)=>["debug","info","warn","error"].includes(this.logLevel)&&console.error(...e);blue=e=>{console.log(`${f.lightBlue(this.brandName)}${f.blue(` ${e} `)}
1
+ "use strict";var hs=Object.create;var H=Object.defineProperty;var fs=Object.getOwnPropertyDescriptor;var us=Object.getOwnPropertyNames;var gs=Object.getPrototypeOf,ds=Object.prototype.hasOwnProperty;var h=(i,e)=>()=>(i&&(e=i(i=0)),e);var $=(i,e)=>{for(var t in e)H(i,t,{get:e[t],enumerable:!0})},qe=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of us(e))!ds.call(i,r)&&r!==t&&H(i,r,{get:()=>e[r],enumerable:!(s=fs(e,r))||s.enumerable});return i};var l=(i,e,t)=>(t=i!=null?hs(gs(i)):{},qe(e||!i||!i.__esModule?H(t,"default",{value:i,enumerable:!0}):t,i)),ys=i=>qe(H({},"__esModule",{value:!0}),i);var a=h(()=>{"use strict"});var b,bs,S,vs,Cs,ws,oe,U,xs,Ss,j,ne,Es,ae,L,f,D=h(()=>{"use strict";a();b=l(require("chalk"),1),bs=b.default.hex("#1abc9c"),S=b.default.hex("#16a085"),vs=b.default.hex("#2ecc71"),Cs=b.default.hex("#27ae60"),ws=b.default.hex("#e74c3c"),oe=b.default.hex("#c0392b"),U=b.default.hex("#f1c40f"),xs=b.default.hex("#f39c12"),Ss=b.default.hex("#3498db"),j=b.default.hex("#2980b9"),ne=b.default.hex("#ecf0f1"),Es=b.default.hex("#fd79a8"),ae=b.default.hex("#e84393"),L=b.default.hex("#7f8c8d"),f={lightGreen:bs,green:S,lightCyan:vs,cyan:Cs,lightRed:ws,red:oe,yellow:U,orange:xs,lightBlue:Ss,blue:j,white:ne,lightMagenta:Es,magenta:ae,gray:L}});var pe,p,E=h(()=>{"use strict";a();D();pe=class{brandName="";fullName="";logLevel="debug";isLogTime=!1;setup({brandName:e,logLevel:t,fullName:s}){this.brandName=` [${e}] `,this.fullName=` ${s} `,this.fullName=f.green.bold(this.fullName),t&&(this.logLevel=t)}time=(...e)=>this.isLogTime&&console.time(...e);timeEnd=(...e)=>this.isLogTime&&console.timeEnd(...e);debug=(...e)=>["debug"].includes(this.logLevel)&&console.log(...e);info=(...e)=>["debug","info"].includes(this.logLevel)&&console.log(...e);warn=(...e)=>["debug","info","warn"].includes(this.logLevel)&&console.warn(...e);error=(...e)=>["debug","info","warn","error"].includes(this.logLevel)&&console.error(...e);blue=e=>{console.log(`${f.lightBlue(this.brandName)}${f.blue(` ${e} `)}
2
2
  `)};cyan=e=>{console.log(`${f.lightCyan(this.brandName)}${f.cyan(` ${e} `)}
3
3
  `)};magenta=e=>{console.log(`${f.lightMagenta(this.brandName)}${f.magenta(` ${e} `)}
4
4
  `)};green=e=>{console.log(`${f.lightGreen(this.brandName)}${f.green(` ${e} `)}
@@ -6,13 +6,13 @@
6
6
  `)};red=e=>{console.log(`${f.lightRed(this.brandName)}${f.red(` ${e} `)}
7
7
  `)};sysError=e=>{console.log(`${f.lightRed(" System Error Tips ")}${f.red(` ${e} `)}
8
8
  `)};link=e=>f.blue(e);title=e=>{console.log(`${this.fullName}${f.yellow.underline(`${e}`)}
9
- `)}},p=new pe});var fe={};$(fe,{clearConsole:()=>ce,deepAssign:()=>g,ensureArray:()=>Os,getLanIp:()=>N,getPkgVersion:()=>le,importJsVm:()=>he,jsonFilter:()=>Ps,timeFormat:()=>B,vCompare:()=>me});function ce(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function g(i,...e){for(let t of e)for(let s in t){let r=t[s],n=i[s];if(Object(r)==r&&Object(n)===n){i[s]=g(n,r);continue}i[s]=t[s]}return i}var We,qe,Xe,Ke,N,le,Os,Ps,me,B,he,C=h(()=>{"use strict";a();We=require("address"),qe=l(require("chalk"),1),Xe=require("default-gateway"),Ke=l(require("fs-extra"),1),N=()=>{let{int:i}=(0,Xe.gateway4sync)();return(0,We.ip)(i||"")||"127.0.0.1"},le=i=>{try{let{version:e}=Ke.default.readJSONSync(i);return e}catch{return}};Os=i=>Array.isArray(i)?i:[i],Ps=(i={},e=[])=>Object.keys(i).filter(t=>!e.includes(t)).reduce((t,s)=>(t[s]=i[s],t),{}),me=(i="",e="")=>{let t=i.replace("^","").split("."),s=e.replace("^","").split("."),r=Math.max(t.length,s.length),n=0;for(let c=0;c<r;c++){let d=t.length>c?t[c]:0,v=isNaN(Number(d))?d.charCodeAt():Number(d),A=s.length>c?s[c]:0,u=isNaN(Number(A))?A.charCodeAt():Number(A);if(v<u){n=-1;break}else if(v>u){n=1;break}}return n},B=i=>{i=i/1e3;let e=s=>qe.default.bold(s);if(i<1)return`${i*1e3} ms`;if(i<10){let s=i>=.01?2:3;return`${e(i.toFixed(s))} s`}if(i<60)return`${e(i.toFixed(1))} s`;let t=i/60;return`${e(t.toFixed(2))} m`},he=i=>`data:text/javascript,${i}`});var ue={};$(ue,{chalk:()=>Qe.default,color:()=>f,glob:()=>M.glob,logger:()=>p,utils:()=>fe});var Qe,M,z=h(()=>{"use strict";a();Qe=l(require("chalk"),1),M=require("glob");D();C();E()});var Ze,Ye,et,ks,tt,st,Ms,it=h(()=>{"use strict";a();Ze=l(require("fs"),1),Ye=l(require("path"),1),et=l(require("jiti"),1);y();E();ks=["emp-config.ts","emp-config.js","emp.config.ts","emp.config.js","emp-config.mjs","emp-config.cjs","emp-config.mts","emp-config.cts","emp.config.mjs","emp.config.cjs","emp.config.mts","emp.config.cts"],tt=(0,et.default)(__filename,{esmResolve:!0,requireCache:!1,interopDefault:!0}),st=async()=>Ms(),Ms=()=>{p.time("[store]GetEmpConfigPath");let i;for(let e of ks){let t=Ye.default.resolve(o.root,e);if(Ze.default.existsSync(t)){i=t;break}}return p.timeEnd("[store]GetEmpConfigPath"),i}});async function J(i,e="localhost"){if(i!==$s&&(i<rt||i>ge))throw new Error(`Port number must lie between ${rt} and ${ge}`);let t=i,s=js(),r;e&&!s.has(e)?r=new Set([e]):r=s;let n=new Set(["EADDRINUSE","EACCES"]);for(;t<=ge;)try{return await Ds(t,r)}catch(c){if(!n.has(c.code))throw c;t+=1}throw new Error("No available ports found")}var ot,nt,rt,ge,$s,js,Ls,Ds,de=h(()=>{"use strict";a();ot=l(require("net"),1),nt=l(require("os"),1),rt=1024,ge=65535,$s=443,js=()=>{let i=nt.default.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(i))if(t)for(let s of t)e.add(s.address);return e},Ls=(i,e)=>new Promise((t,s)=>{let r=ot.default.createServer();r.unref(),r.on("error",s),r.listen(i,e,()=>{let{port:n}=r.address();r.close(()=>{t(n)})})}),Ds=async(i,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let s of e)try{await Ls(i,s)}catch(r){if(!t.has(r.code))throw r}return i}});var ye,at,be,T,ve=h(()=>{"use strict";a();ye=l(require("url"),1),at=l(require("chalk"),1);D();C();be=class{imf={protocol:"",port:8e3,pathname:"/"};host="0.0.0.0";urls={lanUrlForConfig:"",lanUrlForTerminal:L("unavailable"),localUrlForTerminal:"",localUrlForBrowser:""};setup(e){e.host&&(this.host=e.host),e.protocol&&(this.imf.protocol=e.protocol),e.pathname&&(this.imf.pathname=e.pathname),e.port&&(this.imf.port=e.port),this.setupUrls()}setupUrls(){let{host:e}=this,t=e==="0.0.0.0"||e==="::",s;if(t){s="localhost";try{this.urls.lanUrlForConfig=this.getLanIp(),this.urls.lanUrlForConfig&&(/^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(this.urls.lanUrlForConfig)?this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig):this.urls.lanUrlForConfig="")}catch{}}else s=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(s),this.urls.localUrlForBrowser=this.formatUrl(s)}getLanIp=N;formatUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return ye.default.format({protocol:t,hostname:e,port:s,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return ye.default.format({protocol:t,hostname:e,port:at.default.bold(s),pathname:r})}},T=new be});var lt,ct,mt,pt,Ts,Rs,ht,ft=h(()=>{"use strict";a();lt=require("child_process"),ct=require("util");y();E();mt=(0,ct.promisify)(lt.exec),pt=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],Ts=async()=>{let i=process.env.BROWSER;if(!i||!pt.includes(i)){let{stdout:e}=await mt("ps cax");i=pt.find(t=>e.includes(t))}return i},Rs=async i=>{if(process.platform==="darwin")try{let t=await Ts();if(t){let s=`osascript openChrome.applescript "${encodeURI(i)}" "${t}"`;return await mt(s,{cwd:o.resource.dir}),!0}}catch(t){p.debug(t)}try{let{default:t}=await import("open");return await t(i),!0}catch(t){return p.error("Failed to open start URL."),p.error(t),!1}},ht=Rs});var Ce,_,we=h(()=>{"use strict";a();de();ve();C();y();Ce=class{isADB=!1;isHttps=!1;get isHttpBase(){let e=o.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}async setup(){if(this.isADB=!!o.empOptions.autoDevBase&&o.mode==="development"&&!this.isHttpBase,!this.isADB)return;let{server:e,https:t}=o.empOptions.server||{};this.isHttps=e==="https"||typeof e=="object"&&e.type==="https"||t===!0;let s=T.getLanIp(),r=this.isHttps?"https":"http",n=o.empOptions.server?.port||8e3;n=await J(n,s),o.empOptions.base=`${r}://${s}:${n}/`,o.empOptions.server=g({port:n,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${s}:${n}/ws`}},o.empOptions.server)}},_=new Ce});var xe,O,I=h(()=>{"use strict";a();xe=l(require("fs/promises"),1);D();de();ve();E();ft();C();y();we();O=class{sf={protocol:"http",host:"0.0.0.0",port:8e3,publicPath:"",publicHasHttp:!1,isOpenBrower:!1,url:"",urls:{localUrlForBrowser:"",localUrlForTerminal:"",lanUrlForTerminal:"",lanUrlForConfig:""}};static httpsType="default";async adaptServer(){this.sf.publicPath=o.rsConfig.output?.publicPath==="auto"?"/":o.rsConfig.output?.publicPath||"/",this.sf.isOpenBrower=!!o.empConfig.server.open,this.sf.protocol=this.isHttps?"https":"http",this.sf.host=o.empConfig.server.host?o.empConfig.server.host:this.sf.host,this.sf.port=o.empConfig.server.port,await this.serverPort(),T.setup(this.sf),this.sf.publicPath&&(this.sf.publicPath.indexOf("http://")>-1||this.sf.publicPath.indexOf("https://")>-1)?(this.sf.url=this.sf.publicPath,this.sf.publicHasHttp=!0,this.sf.urls.localUrlForTerminal=T.prettyPrintUrl("localhost")):(this.sf.urls=T.urls,this.sf.url=this.sf.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this.sf;this.sf.publicHasHttp?(p.info(`${S("\u279C")} Local: ${p.link(e.localUrlForTerminal)}`),p.info(`${S("\u279C")} Network: ${p.link(this.sf.publicPath)}`)):(p.info(`${S("\u279C")} Local: ${p.link(e.localUrlForTerminal)}`),p.info(`${S("\u279C")} Network: ${p.link(e.lanUrlForTerminal)}
10
- `)),this.sf.isOpenBrower&&ht(this.sf.url)}async setup(e,t){p.time(`[${e}]Setup`),await o.setup(e,t),o.debug.clearLog&&ce(),p.title(`${e}`),await this.adaptServer(),p.time(`[${e}]Run`),await this.run(),p.timeEnd(`[${e}]Run`),this.afterRun(),p.timeEnd(`[${e}]Setup`)}async run(){}afterRun(){process.on("SIGINT",function(){process.exit()})}get isHttps(){let{server:e,https:t,http2:s}=o.empConfig.server||{};return e==="https"||typeof e=="object"&&e.type==="https"||t===!0||s===!0}getcert(){return Promise.all([xe.default.readFile(o.resource.key),xe.default.readFile(o.resource.cert)])}async serverPort(){if(_.isADB)return;let{port:e,host:t}=this.sf,s=await J(e,t);s!==e&&(this.sf.port=s,o.rsConfig.devServer?.port&&(o.rsConfig.devServer.port=s))}}});var V,ut=h(()=>{"use strict";a();y();V=class{externals={};externalAssets={js:[],css:[]};exp=/^([0-9a-zA-Z_\s]+)@(.*)/;config;importMap={imports:{}};isEmpshare=!1;async setup(){this.config=o.empConfig.empShare,o.empConfig.empShare.name&&(this.isEmpshare=!0,o.empConfig.output.uniqueName=o.empConfig.empShare.name),o.empConfig.empShare.fastMode&&o.empConfig.empShareFastMode.setup(),this.config.shareLib&&this.setShareLib(),this.prepareEsm()}get useImportMap(){return this.config.useImportMap&&o.empConfig.isESM}get pluginConfig(){let e={...this.config};return delete e.shareLib,delete e.useImportMap,delete e.fastMode,{manifest:!1,dts:!1,...e}}prepareEsm(){if(o.empConfig.isESM){this.config.library={type:"module"};let e=this.config.remotes||{};for(let[t,s]of Object.entries(e))if(typeof s=="string"){let r=s.match(this.exp)||[];r.length>0&&(e[t]=r[2])}this.config.remotes=e}}async setShareLib(){let e=this.config,t=[];if(typeof e.shareLib=="object")for(let[s,r]of Object.entries(e.shareLib)){let n={};if(n.module=s,typeof r=="string"){let c=r.match(this.exp)||[];c.length>0?(n.global=c[1],n.entry=c[2],n.type="js",t.push(n),n={}):(n.global="",n.entry=r,n.type="js",t.push(n),n={})}else Array.isArray(r)?r.map(c=>{if(!c)return;if(c.split("?")[0].endsWith(".css"))n.entry=c,n.type="css";else{let v=c.match(this.exp)||[];v.length>0?(n.global=v[1],n.entry=v[2],n.type="js"):(n.global="",n.entry=c,n.type="js")}t.push(n),n={}}):typeof r=="object"&&r.entry&&(n.entry=r.entry,n.global=r.global,n.type=r.type,t.push(n),n={})}await Promise.all([this.setExternalAssets(t)])}async setExternalAssets(e=[]){if(e.length>0){let t=[];t=t.concat(e),t.map(s=>{s.type=s.type||"js",s.type==="js"&&s.module?(s.global?this.externals[s.module]=s.global:o.empConfig.isESM&&(this.useImportMap?(this.externals[s.module]=s.module,this.importMap.imports[s.module]=s.entry):this.externals[s.module]=s.entry),s.entry&&!o.empConfig.isESM&&this.externalAssets.js.push(s.entry)):s.type==="css"&&s.entry&&this.externalAssets.css.push(s.entry)})}}}});var W,gt=h(()=>{"use strict";a();y();W=class{fastMode={runtimeHost:"",runtimeLib:"",externals:{},globalVal:"EmpShareLib",framework:"react"};externalMF={"@module-federation/runtime":"MFRuntime","@module-federation/sdk":"MFSDK"};externalReact={react:"React","react-dom":"ReactDOM","react-router-dom":"ReactRouterDOM"};externals={};getRuntimeLib(e){return`${e}/runtime${o.mode==="development"?".development":""}.umd.js`}setup(){this.fastMode=o.deepAssign(this.fastMode,o.empConfig.empShare.fastMode),this.injectLib(),this.setExternals()}injectLib(){let{runtimeHost:e,runtimeLib:t}=this.fastMode;if(e||t){let s=t||this.getRuntimeLib(e);o.empConfig.empShareLib.externalAssets.js.push(s)}}setExternals(){for(let[e,t]of Object.entries(this.externalMF))this.externals[e]=`${this.fastMode.globalVal}.${t}`;if(this.fastMode.framework==="react")for(let[e,t]of Object.entries(this.externalReact))this.externals[e]=`${this.fastMode.globalVal}.${t}`;Object.entries(this.fastMode.externals).length>0&&(this.externals=o.deepAssign(this.externals,this.fastMode.externals)),o.empConfig.empShareLib.externals=o.deepAssign(o.empConfig.empShareLib.externals,this.externals)}}});var G,Se=h(()=>{"use strict";a();G={rule:{mjs:"mjs",typescript:"typescript",javascript:"javascript",sourceMap:"sourceMapLoader",inline:"inline",svg:"svg",image:"image",font:"fonts",svga:"svga",sass:"sass",less:"less",css:"css"},use:{swc:"swc",sourceMap:"sourceMapLoader",sass:"sassLoader",less:"lessLoader"},plugin:{bundleAnalyzer:"bundleAnalyzerPlugin",define:"definePlugin",copy:"copyRspackPlugin",progress:"progressPlugin",empShare:"empShare",html:{prefix:"html-plugin-",empSharePrefix:"html-plugin-empShare-",importMapPrefix:"html-plugin-import-map-",hooks:{empShareLib:"HtmlEmpShareLibPluginName",importMap:"HtmlImportMapPlugin"}}},minimizer:{minJs:"minJs",minCss:"minCss"}}});var Ee,dt,q,yt,X,As,K,Oe=h(()=>{"use strict";a();Ee=l(require("html-webpack-plugin"),1);C();y();Se();dt=G.plugin.html.hooks.importMap,q=class{importMap;chunk;constructor(e,t){this.importMap=e,this.chunk=t}apply(e){e.hooks.compilation.tap(dt,t=>{Ee.default.getHooks(t).alterAssetTagGroups.tapAsync(dt,(s,r)=>{if(!s.plugin.userOptions.chunks?.includes(this.chunk))return r(null,s);s.headTags.push({tagName:"script",attributes:{type:"importmap"},innerHTML:`${JSON.stringify(this.importMap,null,2)}`,voidTag:!1,meta:{plugin:void 0}}),r(null,s)})})}},yt=G.plugin.html.hooks.empShareLib,X=class{chunk;files;constructor(e,t){this.files=g({js:[],css:[]},e),this.chunk=t}apply(e){e.hooks.compilation.tap(yt,t=>{let s=this.files;Ee.default.getHooks(t).alterAssetTagGroups.tapAsync(yt,(r,n)=>{if(!r.plugin.userOptions.chunks?.includes(this.chunk))return n(null,r);s.js.map(c=>{r.headTags.push({tagName:"script",attributes:{src:c},voidTag:!1,meta:{plugin:void 0}})}),s.css.map(c=>{r.headTags.push({tagName:"link",attributes:{rel:"stylesheet",href:c},voidTag:!1,meta:{plugin:void 0}})}),n(null,r)})})}},As=()=>{let i=[`import 'core-js/${o.empConfig.build.coreJsFeatures}'`].join(`
11
- `);return he(i)},K=class{constructor(){}apply(e){let{webpack:t}=e;new t.EntryPlugin(e.context,As(),{name:void 0}).apply(e)}}});var Q,bt=h(()=>{"use strict";a();y();we();Oe();Q=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){await _.setup(),this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){o.empConfig.build.polyfill==="entry"&&o.chain.plugin("empPolyfill").use(K),this.op.beforePlugin&&await this.op.beforePlugin()}async afterPlugin(){this.op.afterPlugin&&await this.op.afterPlugin()}async beforeModule(){this.op.beforeModule&&await this.op.beforeModule()}async afterModule(){this.op.afterModule&&await this.op.afterModule()}async beforeEmpPlugin(){this.op.beforeEmpPlugin&&await this.op.beforeEmpPlugin()}async afterEmpPlugin(){this.op.afterEmpPlugin&&await this.op.afterEmpPlugin()}async beforeBuild(){this.op.beforeBuild&&await this.op.beforeBuild()}async afterBulid(){this.op.afterBulid&&await this.op.afterBulid()}async beforeDevServe(){this.op.beforeDevServe&&await this.op.beforeDevServe()}async afterDevServe(){this.op.afterDevServe&&await this.op.afterDevServe()}async beforeServe(){this.op.beforeServe&&await this.op.beforeServe()}async afterServe(){this.op.afterServe&&await this.op.afterServe()}}});var vt,Pe,Ct,wt=h(()=>{"use strict";a();vt=l(require("fs"),1);z();it();C();I();ut();gt();bt();Pe=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},g(e,t)}empShareFastMode=new W;empShareLib=new V;isESM=!1;async autoDevSet(){this.store.mode==="development"&&this.store.empOptions.autoDevBase}checkIsESM(e){return["es3","es5"].indexOf(e)===-1}lifeCycle;async setup(e){this.store=e,await this.syncEmpOptions(),this.lifeCycle=new Q(this.store.empOptions.lifeCycle),await this.lifeCycle.afterGetEmpOptions(),this.isESM=this.checkIsESM(this.build.target),this.store.empOptions.target?(this.target=this.store.empOptions.target,Array.isArray(this.target)&&!this.target.includes(this.build.target)&&this.target.push(this.build.target)):this.target=["web",this.build.target];let{appSrc:t,base:s,appEntry:r}=this.store.empOptions;t&&(this.appSrc=t),s&&(this.base=s),r&&(this.appEntry=r),this.store.empConfig.empShare&&await this.empShareLib.setup()}async chain(){this.store.empOptions.chain&&await this.store.empOptions.chain(this.store.chain)}async plugins(){let e=[];this.store.empOptions.plugins&&Array.isArray(this.store.empOptions.plugins)&&this.store.empOptions.plugins.length>0&&(this.store.empOptions.plugins.map(t=>{e.push(t.rsConfig(this.store))}),await Promise.all(e))}get debug(){return this.assign({loggerLevel:"info",clearLog:!0,progress:!0,showRsconfig:!1,showPerformance:!1,rspackCache:!0,infrastructureLogging:{appendOnly:!0,level:"warn"},newTreeshaking:this.store.empConfig.isESM},this.store.empOptions.debug)}get build(){let e=this.store.empOptions.build?.staticDir?`${this.store.empOptions.build?.staticDir}/`:"";return this.assign({outDir:"dist",staticDir:e,assetsDir:"assets",publicDir:"public",chunkIds:this.store.isDev?"named":"deterministic",moduleIds:this.store.isDev?"named":"deterministic",sourcemap:this.store.isDev,minify:!this.store.isDev,minOptions:{},target:"es5",polyfill:!1,polyfillInclude:[],coreJsFeatures:"stable",externalHelpers:!1,browserslist:this.store.browserslistOptions.default,swcConfig:{},devtool:"source-map"},{...this.store.empOptions.build,staticDir:e})}get html(){let e=this.store.empOptions.html?.template?{}:{charset:{charset:"utf-8"},"http-equiv":{"http-equiv":"X-UA-Compatible",content:"IE=edge"},viewport:{name:"viewport",content:"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"},keywords:{keywords:""},description:{description:""}};return this.assign({lang:"zh-CN",title:"EMP",inject:"body",minify:!this.store.isDev,scriptLoading:this.isESM?"module":"defer",meta:e,files:{css:[],js:[]},tags:{headTags:[],bodyTags:[]}},this.store.empOptions.html)}get entries(){return this.store.empOptions.entries?this.store.empOptions.entries:{}}get server(){let e={host:"0.0.0.0",port:8e3,open:process.platform==="darwin",hot:!0,watchFiles:["src/**/*.html"],static:[{directory:this.store.publicDir,watch:this.store.isDev}],allowedHosts:["all"],historyApiFallback:!0,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":"X-Requested-With, content-type, Authorization"}};return this.store.empOptions.server?.http2&&(O.httpsType="h2",delete this.store.empOptions.server.http2),this.assign(e,this.store.empOptions.server)}get empShare(){return this.assign({name:"",filename:"emp.js",shared:{}},this.store.empOptions.empShare)}get css(){return this.assign({sass:{mode:"modern"}},this.store.empOptions.css)}get output(){let e=(this.store.isDev,".[contenthash:8]"),t=this.store.isDev?"":".[contenthash:8]",{assetsDir:s,staticDir:r}=this.store.empConfig.build,n={publicPath:this.store.empConfig.base?this.store.empConfig.base:"auto",crossOriginLoading:"anonymous",filename:`${r}js/[name]${e}.js`,cssFilename:`${r}css/[name]${t}.css`,cssChunkFilename:`${r}css/[name]${t}.css`,assetModuleFilename:`${r}${s}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!0};return this.assign(n,this.store.empOptions.output)}get define(){let e={mode:this.store.mode,env:this.store.cliOptions.env};return this.store.empOptions.define&&(e={...e,...this.store.empOptions.define}),this.setDefine(e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",s={};return Object.keys(e).map(r=>{(t==="all"||t==="esm")&&(s[`import.meta.env.${r}`]=JSON.stringify(e[r])),(t==="all"||t==="cjs")&&(s[`process.env.${r}`]=JSON.stringify(e[r])),s[`${r}`]=JSON.stringify(e[r])}),s}get externals(){return this.assign(this.empShareLib.externals,this.store.empOptions.externals)}get resolve(){return g({alias:{src:this.store.resolve("src"),"@":this.store.resolve("src")},extensions:["...",".js",".jsx",".mjs",".ts",".tsx",".css",".less",".scss",".sass",".json",".wasm",".vue",".svg",".svga"]},this.store.empOptions.resolve)}async syncEmpOptions(){p.time("[store][empConfig]SyncEmpOptions");let e=await st();if(!e||!vt.default.existsSync(e))return;let t=await tt(e);typeof t=="function"?this.store.empOptions=await t(this.store):this.store.empOptions=t||{},p.timeEnd("[store][empConfig]SyncEmpOptions")}get moduleTransformRule(){let{moduleTransform:e}=this.store.empOptions,t=this.assign({defaultExclude:!1},e),s={and:[],not:[]};return t.defaultExclude===!0&&s.and.push(/(node_modules|bower_components)/),t?.exclude&&(s.and=s.and.concat(t.exclude)),e?.include&&(s.not=t.include),s}get cacheDir(){return this.store.empOptions.cacheDir?this.store.empOptions.cacheDir:"node_modules/.emp-cache"}get ignoreWarnings(){return this.store.empOptions.ignoreWarnings?this.store.empOptions.ignoreWarnings:[/Conflicting order/]}get autoPages(){let e;return this.store.empOptions.autoPages&&(e=typeof this.store.empOptions.autoPages=="boolean"?{}:this.store.empOptions.autoPages,e=this.assign({path:"pages"},e)),e}},Ct=new Pe});var xt,ke,St,Et=h(()=>{"use strict";a();xt=l(require("fs-extra"),1),ke=class{store;async setup(e){this.store=e;let t=[this.common(),this.stats(),this.devServer(),this.optimization(),this.checkTsconfig()];await Promise.all(t)}async common(){this.store.merge({node:{global:!0},experiments:{outputModule:this.store.empConfig.isESM,topLevelAwait:!0,css:!0},target:this.store.empConfig.target,infrastructureLogging:this.store.empConfig.debug.infrastructureLogging,context:this.store.root,mode:this.store.mode,cache:this.store.empConfig.debug.rspackCache,devtool:this.store.empConfig.build.sourcemap?this.store.empConfig.build.devtool:!1,output:this.store.empConfig.output,resolve:this.store.empConfig.resolve,externals:this.store.empConfig.externals,ignoreWarnings:this.store.empConfig.ignoreWarnings,watchOptions:{ignored:["**/node_modules/**","**/@mf-types/**"]}})}async checkTsconfig(){let e=this.store.resolve("tsconfig.json");if(await xt.default.exists(e)){let s={tsConfig:e};this.store.merge({resolve:s})}}async stats(){this.store.merge({stats:{colors:!0,all:!1,assets:!1,chunks:!1,timings:!0,version:!0}})}async devServer(){this.store.merge({devServer:this.store.empConfig.server})}async optimization(){let e={moduleIds:this.store.empConfig.build.moduleIds,chunkIds:this.store.empConfig.build.chunkIds,minimize:this.store.empConfig.build.minify,splitChunks:{chunks:"async",cacheGroups:{}}};this.store.empConfig.build.polyfill&&(e.splitChunks.cacheGroups={}),this.store.chain.merge({optimization:e})}},St=new ke});var Me,Ot,Pt=h(()=>{"use strict";a();Me=class{store;async setup(e){this.store=e;let t=[this.sass(),this.less(),this.css()];await Promise.all(t)}async sass(){let{rule:e,use:t}=this.store.chainName,s={},{sass:r}=this.store.empConfig.css||{sass:{}};r.mode==="modern"&&(s.implementation=r.implementation?r.implementation:require.resolve("sass-embedded"),s.api=r.api?r.api:"legacy",s.sourceMap=this.store.empConfig.build.sourcemap,r.sassOptions&&(s.sassOptions=r.sassOptions)),this.store.chain.merge({module:{rule:{[e.sass]:{test:/\.(sass|scss)$/,use:{[t.sass]:{loader:require.resolve("sass-loader"),options:s}},type:"css/auto"}}}})}async less(){let{rule:e,use:t}=this.store.chainName,s={loader:require.resolve("less-loader"),options:{lessOptions:{javascriptEnabled:!0}}};this.store.chain.merge({module:{rule:{[e.less]:{test:/\.less$/,use:{[t.less]:s},type:"css/auto"}}}})}async css(){let{rule:e}=this.store.chainName;this.store.chain.merge({module:{rule:{[e.css]:{test:/\.css$/,use:{},type:"css/auto"}}}})}},Ot=new Me});var w,kt,$e,Mt,$t=h(()=>{"use strict";a();w=l(require("path"),1),kt=l(require("html-webpack-plugin"),1);z();C();Oe();$e=class{store;entriesConfig={};async setup(e){this.store=e,await this.init(),this.toConfig()}setHtmlConfig(e,t){return e.template=this.setTemplate(e.template),e.favicon=this.setFavicion(e.favicon),e.chunks=t,e.filename=`${t[0]}.html`,this.store.empConfig.base&&(e.publicPath=this.store.empConfig.base),e.tags=e.tags||{},e}setChunk(e){return e.replace(w.default.extname(e),"").replace(`${this.store.empConfig.appSrc}${w.default.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(w.default.join("template","index.html"))}setFavicion(e){return e?this.store.resolve(e):this.store.empResolve(w.default.join("template","favicon.ico"))}setEntryItem(e,t,s){s=s||this.store.resolve(w.default.join(this.store.empConfig.appSrc,e));let r=this.setChunk(e),n=[s];this.entriesConfig[r]={entry:{[r]:n},html:this.setHtmlConfig(t,[r])},this.store.entries[r]=n}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`${this.store.chainName.plugin.html.prefix}${t}`).use(kt.default,[e]),this.store.empConfig.empShareLib&&(e.files=g(e.files,this.store.empConfig.empShareLib.externalAssets)),this.store.chain.plugin(`${this.store.chainName.plugin.html.empSharePrefix}${t}`).use(X,[e.files,t]),this.store.empConfig.empShareLib.useImportMap&&this.store.chain.plugin(`${this.store.chainName.plugin.html.importMapPrefix}${t}`).use(q,[this.store.empConfig.empShareLib.importMap,t])}setRspackEntry(e){this.store.merge({entry:e})}async init(){this.store.empConfig.autoPages?await this.setAutoPage():(await this.setDefaultEntry(),this.setEntryByConfig())}async setAutoPage(){p.time("setAutoPage");let e=this.store.empConfig.autoPages?.path||"pages",t=w.default.join(this.store.appSrc,e),s=w.default.join(t,"**","*.{ts,tsx,jsx,js}"),r=await(0,M.glob)([s],{windowsPathsNoEscape:!0});r=r.map(n=>n.replace(`${t}${w.default.sep}`,"")),r.map(n=>{let c=this.store.empConfig.entries[n]||{};this.setEntryItem(n,{...this.store.empConfig.html,...c},w.default.join(t,n))}),p.timeEnd("setAutoPage")}async setDefaultEntry(){p.time("[store][empConfig]SetDefaultEntry");let e=w.default.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}"),t=await(0,M.glob)([e],{windowsPathsNoEscape:!0});if(t[0]){let s=w.default.join(this.store.empConfig.appSrc,Object.keys(this.store.empConfig.entries).length>0&&this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index");this.setEntryItem(s,this.store.empConfig.html,t[0])}p.timeEnd("[store][empConfig]SetDefaultEntry")}setEntryByConfig(){if(Object.keys(this.store.empConfig.entries).length>0)for(let[e,t]of Object.entries(this.store.empConfig.entries))this.setEntryItem(e,{...this.store.empConfig.html,...t})}toConfig(){for(let[e,t]of Object.entries(this.entriesConfig))this.setRspackHtmlPlugin(t.html,e),this.setRspackEntry(t.entry)}},Mt=new $e});var je,Le,jt,Lt=h(()=>{"use strict";a();je=l(require("path"),1);C();Le=class{store;swcJsOptions={};swcTsOptions={};coreJs={version:"3",alias:"",path:""};async setup(e){this.store=e,this.swcInitOptions(),await this.run()}async run(){let e=[this.jsDataUrl(),this.files(),this.scripts(),this.rspackGenerator(),this.rspackParser()];await this.store.empConfig.lifeCycle.beforeModule(),await Promise.all(e),await this.store.empConfig.lifeCycle.afterModule()}rspackGenerator(){let e=this.store.isDev?"[path][name]-[local]-[hash:5]":"[local]-[hash:5]";this.store.chain.merge({module:{generator:{css:{localIdentName:e},"css/auto":{localIdentName:e},"css/module":{localIdentName:e}}}})}rspackParser(){this.store.chain.merge({module:{parser:{css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return this.store.empConfig.build.polyfill}swcParser(e){switch(e){case"js":return{syntax:"ecmascript",jsx:!0,decorators:!0,decoratorsBeforeExport:!1};case"ts":return{syntax:"typescript",decorators:!0,tsx:!0,dynamicImport:!0}}}swcJsc(e){let{target:t,externalHelpers:s}=this.store.empConfig.build;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:s,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:g(this.swcJsc(e),{...this.store.empConfig.build.swcConfig}),isModule:"unknown"};return this.isPolyfill&&(delete t.jsc.target,t.env={coreJs:this.swcCoreVersion,targets:this.store.empConfig.build.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill),this.store.empConfig.build.polyfill==="usage"&&(t.env.shippedProposals=!0,t.env.include=this.store.empConfig.build.polyfillInclude)),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build;e&&this.store.chain.resolve.alias.set("@swc/helpers",je.default.dirname(require.resolve("@swc/helpers/package.json"))),this.coreJs.path=require.resolve("core-js/package.json");let t=le(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=je.default.dirname(this.coreJs.path),this.store.empConfig.build.polyfill&&(this.store.chain.resolve.alias.set("core-js",this.coreJs.alias),this.store.chain.module.rule("javascript").exclude.add(/core-js/),this.store.chain.module.rule("typescript").exclude.add(/core-js/)),this.swcTsOptions=this.swcOptions("ts"),this.swcJsOptions=this.swcOptions("js")}jsDataUrl(){this.store.chain.module.rule("jsDataUrl").merge({mimetype:{or:["text/javascript","application/javascript"]}}).resolve.set("fullySpecified",!1).end().use("swcJsParser").loader("builtin:swc-loader").options(this.swcJsOptions)}async scripts(){let e=[],{rule:t,use:s}=this.store.chainName;this.store.chain.merge({module:{parser:{javascript:{exportsPresence:"error",importExportsPresence:"error"}},rule:{[t.mjs]:{test:/\.m?js/,resolve:{fullySpecified:!1}},[t.typescript]:{test:/\.(ts|tsx)$/,exclude:e,use:{[s.swc]:{loader:"builtin:swc-loader",options:this.swcTsOptions}}},[t.javascript]:{test:/\.((m|c)?js|jsx)$/,exclude:e,use:{[s.swc]:{loader:"builtin:swc-loader",options:this.swcJsOptions}}},[t.sourceMap]:{test:/\.[tj]sx?$/,enforce:"pre",use:{[s.sourceMap]:{loader:require.resolve("source-map-loader")}}}}}})}async files(){let{rule:e}=this.store.chainName;this.store.chain.merge({module:{rule:{[e.svg]:{test:/\.svg$/,type:"asset/resource"}}}}),this.store.chain.merge({module:{rule:{[e.inline]:{resourceQuery:/inline/,type:"asset/inline"}}}}),this.store.chain.merge({module:{rule:{[e.image]:{test:/\.(png|jpe?g|gif|webp|ico)$/i,type:"asset/resource"},[e.font]:{test:/\.(|otf|ttf|eot|woff|woff2)$/i,type:"asset/resource"},[e.svga]:{test:/\.(svga)$/i,type:"asset/resource"}}}})}},jt=new Le});var De,Dt,R,Te,Tt,Rt=h(()=>{"use strict";a();De=l(require("fs"),1),Dt=require("@module-federation/enhanced/rspack"),R=l(require("@rspack/core"),1),Te=class{store;async setup(e){this.store=e;let t=[this.define(),this.anylayze(),this.progress(),this.copy(),this.empShare(),this.minify()];await this.store.empConfig.lifeCycle.beforePlugin(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterPlugin()}async anylayze(){if(!this.store.cliOptions.analyze)return;let{default:{BundleAnalyzerPlugin:e}}=await import("webpack-bundle-analyzer");this.store.chain.plugin(this.store.chainName.plugin.bundleAnalyzer).use(e,[{analyzerPort:this.store.empConfig.server.port,defaultSizes:"gzip",analyzerHost:this.store.getLanIp()||"127.0.0.1"}])}async define(){this.store.chain.plugin(this.store.chainName.plugin.define).use(R.default.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");De.default.existsSync(e)&&De.default.readdirSync(e).length>0&&this.store.chain.plugin(this.store.chainName.plugin.copy).use(R.default.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve(this.store.empConfig.build.outDir)}]}])}async progress(){this.store.empConfig.debug.progress&&this.store.chain.plugin(this.store.chainName.plugin.progress).use(R.default.ProgressPlugin,[{prefix:"EMP"}])}async empShare(){let{isEmpshare:e}=this.store.empConfig.empShareLib;if(!e)return;let t=Dt.ModuleFederationPlugin;this.store.chain.plugin(this.store.chainName.plugin.empShare).use(t,[this.store.empConfig.empShareLib.pluginConfig])}minify(){this.store.chain.optimization.minimize(this.store.mode==="production"),this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minJs).use(R.default.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]),this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(R.default.SwcCssMinimizerRspackPlugin,[{}])}},Tt=new Te});var Re,At,Ft=h(()=>{"use strict";a();Et();Pt();$t();Lt();Rt();Re=class{store;async setup(e){this.store=e;let t=[St.setup(this.store),jt.setup(this.store),Tt.setup(this.store),Mt.setup(this.store),Ot.setup(this.store)];await Promise.all(t),await this.store.empConfig.lifeCycle.beforeEmpPlugin(),await this.store.empConfig.plugins(),await this.store.empConfig.lifeCycle.afterEmpPlugin(),await this.store.empConfig.chain()}},At=new Re});var Nt,x,zt,It,Ae,o,y=h(()=>{"use strict";a();Nt=l(require("fs/promises"),1),x=l(require("path"),1),zt=l(require("util"),1);E();C();wt();Ft();It=l(require("webpack-chain"),1);Se();Ae=class{empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=x.default.resolve(__dirname,__filename).replace(`${x.default.sep}dist${x.default.sep}index.js`,"");empSource=x.default.resolve(this.empRoot,"dist");resolve=e=>x.default.isAbsolute(e)?e:x.default.resolve(this.root,e);empResolve=e=>x.default.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};chainName=G;cacheDir="";mode="development";cliMode="dev";isDev=!0;cliOptions;chain;rsConfig;empOptions={};empConfig;vCompare=me;deepAssign=g;getLanIp=N;entries={};debug;async setup(e,t){p.time("[store]Setup"),await this.initVars(e,t),this.empConfig=Ct,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new It.default,await At.setup(this),this.setLogger(),this.toConfig(),this.logConfig(),p.timeEnd("[store]Setup")}async initVars(e,t){this.cliOptions=t||{},this.cliMode="prod",this.mode=e==="dev"?"development":"production",this.isDev=this.mode==="development",process.env.NODE_ENV=e==="dev"?"development":"production";let s=require(this.empResolve("package.json")),r=require(this.resolve("package.json"));this.empPkg={...this.empPkg,...s},this.pkg={...this.pkg,...r},this.resource.dir=x.default.join(this.empRoot,"resource"),this.resource.cert=x.default.join(this.resource.dir,"emp.cert"),this.resource.key=x.default.join(this.resource.dir,"emp.key")}initPaths(){this.appSrc=this.resolve(this.empConfig.appSrc),this.outDir=this.resolve(this.empConfig.build.outDir),this.publicDir=this.resolve(this.empConfig.build.publicDir),this.cacheDir=this.resolve(this.empConfig.cacheDir)}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),p.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}`,brandName:"EMP",logLevel:e})}merge(e){this.chain.merge(e)}toConfig(){this.rsConfig=this.chain.toConfig()}logConfig(){if(this.debug.showRsconfig)if(typeof this.debug.showRsconfig=="string"){let e=x.default.join(this.root,this.debug.showRsconfig);Nt.default.writeFile(e,JSON.stringify(this.rsConfig,null,2))}else{this.debug.clearLog=!1;let e={colors:!0,depth:null},t=typeof this.debug.showRsconfig=="object"?g(e,this.debug.showRsconfig):e;console.log(p.link("[Compile Config]")),console.log(zt.default.inspect(this.rsConfig,t))}}get browserslistOptions(){return{default:["chrome >= 87","edge >= 88","firefox >= 78","safari >= 14"],h5:["iOS >= 9","Android >= 4.4","last 2 versions","> 0.2%","not dead"],node:["node >= 16"]}}},o=new Ae});function Hs(i,e){let t=[i,e],s=["File","Size","Gzipped"].reduce((r,n,c)=>{let d=t[c],v=n;return d&&(v=n.length<d?n+" ".repeat(d-n.length):n),`${r+v} `}," ");console.log(j.bold(s))}async function Ht(i){let e=i.toJson({all:!1,assets:!0,timings:!0}),s=e.assets.filter(u=>Is(u.name)).map(Us);s.sort((u,F)=>u.size-F.size);let r=Math.max(...s.map(u=>u.sizeLabel.length)),n=Math.max(...s.map(u=>(u.folder+P.default.sep+u.name).length));Hs(n,r);let c=0,d=0;s.forEach(u=>{let{sizeLabel:F}=u,{name:ls,folder:cs,gzipSizeLabel:ms}=u,Be=(cs+P.default.sep+ls).length,Je=F.length;if(c+=u.size,d+=u.gzippedSize,Je<r){let re=" ".repeat(r-Je);F+=re}let _e=L(u.folder+P.default.sep)+Bs(u.name);if(Be<n){let re=" ".repeat(n-Be);_e+=re}p.info(` ${_e} ${L(F)} ${ms}`)});let v=`${j.bold("Total size:")} ${Z(c)}`,A=`${j.bold("Gzipped size:")} ${Z(d)}`;p.info(`
9
+ `)}},p=new pe});var fe={};$(fe,{clearConsole:()=>ce,deepAssign:()=>g,ensureArray:()=>Os,getLanIp:()=>N,getPkgVersion:()=>le,importJsVm:()=>he,jsonFilter:()=>Ps,timeFormat:()=>B,vCompare:()=>me});function ce(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function g(i,...e){for(let t of e)for(let s in t){let r=t[s],n=i[s];if(Object(r)==r&&Object(n)===n){i[s]=g(n,r);continue}i[s]=t[s]}return i}var Ve,We,Xe,Ke,N,le,Os,Ps,me,B,he,C=h(()=>{"use strict";a();Ve=require("address"),We=l(require("chalk"),1),Xe=require("default-gateway"),Ke=l(require("fs-extra"),1),N=()=>{let{int:i}=(0,Xe.gateway4sync)();return(0,Ve.ip)(i||"")||"127.0.0.1"},le=i=>{try{let{version:e}=Ke.default.readJSONSync(i);return e}catch{return}};Os=i=>Array.isArray(i)?i:[i],Ps=(i={},e=[])=>Object.keys(i).filter(t=>!e.includes(t)).reduce((t,s)=>(t[s]=i[s],t),{}),me=(i="",e="")=>{let t=i.replace("^","").split("."),s=e.replace("^","").split("."),r=Math.max(t.length,s.length),n=0;for(let c=0;c<r;c++){let d=t.length>c?t[c]:0,v=isNaN(Number(d))?d.charCodeAt():Number(d),A=s.length>c?s[c]:0,u=isNaN(Number(A))?A.charCodeAt():Number(A);if(v<u){n=-1;break}else if(v>u){n=1;break}}return n},B=i=>{i=i/1e3;let e=s=>We.default.bold(s);if(i<1)return`${i*1e3} ms`;if(i<10){let s=i>=.01?2:3;return`${e(i.toFixed(s))} s`}if(i<60)return`${e(i.toFixed(1))} s`;let t=i/60;return`${e(t.toFixed(2))} m`},he=i=>`data:text/javascript,${i}`});var ue={};$(ue,{chalk:()=>Qe.default,color:()=>f,glob:()=>M.glob,logger:()=>p,utils:()=>fe});var Qe,M,z=h(()=>{"use strict";a();Qe=l(require("chalk"),1),M=require("glob");D();C();E()});var Ze,Ye,et,ks,tt,st,Ms,it=h(()=>{"use strict";a();Ze=l(require("fs"),1),Ye=l(require("path"),1),et=l(require("jiti"),1);y();E();ks=["emp-config.ts","emp-config.js","emp.config.ts","emp.config.js","emp-config.mjs","emp-config.cjs","emp-config.mts","emp-config.cts","emp.config.mjs","emp.config.cjs","emp.config.mts","emp.config.cts"],tt=(0,et.default)(__filename,{esmResolve:!0,requireCache:!1,interopDefault:!0}),st=async()=>Ms(),Ms=()=>{p.time("[store]GetEmpConfigPath");let i;for(let e of ks){let t=Ye.default.resolve(o.root,e);if(Ze.default.existsSync(t)){i=t;break}}return p.timeEnd("[store]GetEmpConfigPath"),i}});async function J(i,e="localhost"){if(i!==$s&&(i<rt||i>ge))throw new Error(`Port number must lie between ${rt} and ${ge}`);let t=i,s=js(),r;e&&!s.has(e)?r=new Set([e]):r=s;let n=new Set(["EADDRINUSE","EACCES"]);for(;t<=ge;)try{return await Ds(t,r)}catch(c){if(!n.has(c.code))throw c;t+=1}throw new Error("No available ports found")}var ot,nt,rt,ge,$s,js,Ls,Ds,de=h(()=>{"use strict";a();ot=l(require("net"),1),nt=l(require("os"),1),rt=1024,ge=65535,$s=443,js=()=>{let i=nt.default.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(i))if(t)for(let s of t)e.add(s.address);return e},Ls=(i,e)=>new Promise((t,s)=>{let r=ot.default.createServer();r.unref(),r.on("error",s),r.listen(i,e,()=>{let{port:n}=r.address();r.close(()=>{t(n)})})}),Ds=async(i,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let s of e)try{await Ls(i,s)}catch(r){if(!t.has(r.code))throw r}return i}});var ye,at,be,T,ve=h(()=>{"use strict";a();ye=l(require("url"),1),at=l(require("chalk"),1);D();C();be=class{imf={protocol:"",port:8e3,pathname:"/"};host="0.0.0.0";urls={lanUrlForConfig:"",lanUrlForTerminal:L("unavailable"),localUrlForTerminal:"",localUrlForBrowser:""};setup(e){e.host&&(this.host=e.host),e.protocol&&(this.imf.protocol=e.protocol),e.pathname&&(this.imf.pathname=e.pathname),e.port&&(this.imf.port=e.port),this.setupUrls()}setupUrls(){let{host:e}=this,t=e==="0.0.0.0"||e==="::",s;if(t){s="localhost";try{this.urls.lanUrlForConfig=this.getLanIp(),this.urls.lanUrlForConfig&&(/^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(this.urls.lanUrlForConfig)?this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig):this.urls.lanUrlForConfig="")}catch{}}else s=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(s),this.urls.localUrlForBrowser=this.formatUrl(s)}getLanIp=N;formatUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return ye.default.format({protocol:t,hostname:e,port:s,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return ye.default.format({protocol:t,hostname:e,port:at.default.bold(s),pathname:r})}},T=new be});var lt,ct,mt,pt,Ts,Rs,ht,ft=h(()=>{"use strict";a();lt=require("child_process"),ct=require("util");y();E();mt=(0,ct.promisify)(lt.exec),pt=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],Ts=async()=>{let i=process.env.BROWSER;if(!i||!pt.includes(i)){let{stdout:e}=await mt("ps cax");i=pt.find(t=>e.includes(t))}return i},Rs=async i=>{if(process.platform==="darwin")try{let t=await Ts();if(t){let s=`osascript openChrome.applescript "${encodeURI(i)}" "${t}"`;return await mt(s,{cwd:o.resource.dir}),!0}}catch(t){p.debug(t)}try{let{default:t}=await import("open");return await t(i),!0}catch(t){return p.error("Failed to open start URL."),p.error(t),!1}},ht=Rs});var Ce,_,we=h(()=>{"use strict";a();de();ve();C();y();Ce=class{isADB=!1;isHttps=!1;get isHttpBase(){let e=o.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}async setup(){if(this.isADB=!!o.empOptions.autoDevBase&&o.mode==="development"&&!this.isHttpBase,!this.isADB)return;let{server:e,https:t}=o.empOptions.server||{};this.isHttps=e==="https"||typeof e=="object"&&e.type==="https"||t===!0;let s=T.getLanIp(),r=this.isHttps?"https":"http",n=o.empOptions.server?.port||8e3;n=await J(n,s),o.empOptions.base=`${r}://${s}:${n}/`,o.empOptions.server=g({port:n,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${s}:${n}/ws`}},o.empOptions.server)}},_=new Ce});var xe,O,I=h(()=>{"use strict";a();xe=l(require("fs/promises"),1);D();de();ve();E();ft();C();y();we();O=class{sf={protocol:"http",host:"0.0.0.0",port:8e3,publicPath:"",publicHasHttp:!1,isOpenBrower:!1,url:"",urls:{localUrlForBrowser:"",localUrlForTerminal:"",lanUrlForTerminal:"",lanUrlForConfig:""}};static httpsType="default";async adaptServer(){this.sf.publicPath=o.rsConfig.output?.publicPath==="auto"?"/":o.rsConfig.output?.publicPath||"/",this.sf.isOpenBrower=!!o.empConfig.server.open,this.sf.protocol=this.isHttps?"https":"http",this.sf.host=o.empConfig.server.host?o.empConfig.server.host:this.sf.host,this.sf.port=o.empConfig.server.port,await this.serverPort(),T.setup(this.sf),this.sf.publicPath&&(this.sf.publicPath.indexOf("http://")>-1||this.sf.publicPath.indexOf("https://")>-1)?(this.sf.url=this.sf.publicPath,this.sf.publicHasHttp=!0,this.sf.urls.localUrlForTerminal=T.prettyPrintUrl("localhost")):(this.sf.urls=T.urls,this.sf.url=this.sf.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this.sf;this.sf.publicHasHttp?(p.info(`${S("\u279C")} Local: ${p.link(e.localUrlForTerminal)}`),p.info(`${S("\u279C")} Network: ${p.link(this.sf.publicPath)}`)):(p.info(`${S("\u279C")} Local: ${p.link(e.localUrlForTerminal)}`),p.info(`${S("\u279C")} Network: ${p.link(e.lanUrlForTerminal)}
10
+ `)),this.sf.isOpenBrower&&ht(this.sf.url)}async setup(e,t){p.time(`[${e}]Setup`),await o.setup(e,t),o.debug.clearLog&&ce(),p.title(`${e}`),await this.adaptServer(),p.time(`[${e}]Run`),await this.run(),p.timeEnd(`[${e}]Run`),this.afterRun(),p.timeEnd(`[${e}]Setup`)}async run(){}afterRun(){process.on("SIGINT",function(){process.exit()})}get isHttps(){let{server:e,https:t,http2:s}=o.empConfig.server||{};return e==="https"||typeof e=="object"&&e.type==="https"||t===!0||s===!0}getcert(){return Promise.all([xe.default.readFile(o.resource.key),xe.default.readFile(o.resource.cert)])}async serverPort(){if(_.isADB)return;let{port:e,host:t}=this.sf,s=await J(e,t);s!==e&&(this.sf.port=s,o.rsConfig.devServer?.port&&(o.rsConfig.devServer.port=s))}}});var q,ut=h(()=>{"use strict";a();y();q=class{externals={};externalAssets={js:[],css:[]};exp=/^([0-9a-zA-Z_\s]+)@(.*)/;config;importMap={imports:{}};isEmpshare=!1;async setup(){(o.empConfig.empShare.name||o.empConfig.empShare.fastMode?.runtimeHost)&&(this.isEmpshare=!0),this.config=o.empConfig.empShare,this.config.name=this.config.name?this.config.name:o.uniqueName,(o.empConfig.empShare.fastMode?.runtimeHost||o.empConfig.empShare.fastMode?.runtimeLib)&&o.empConfig.empShareFastMode.setup(),this.config.shareLib&&this.setShareLib(),this.prepareEsm()}get useImportMap(){return this.config.useImportMap&&o.empConfig.isESM}get pluginConfig(){let e={...this.config};return delete e.shareLib,delete e.useImportMap,delete e.fastMode,{manifest:!1,dts:!1,dev:{disableDynamicRemoteTypeHints:!0},...e}}prepareEsm(){if(o.empConfig.isESM){this.config.library={type:"module"};let e=this.config.remotes||{};for(let[t,s]of Object.entries(e))if(typeof s=="string"){let r=s.match(this.exp)||[];r.length>0&&(e[t]=r[2])}this.config.remotes=e}}async setShareLib(){let e=this.config,t=[];if(typeof e.shareLib=="object")for(let[s,r]of Object.entries(e.shareLib)){let n={};if(n.module=s,typeof r=="string"){let c=r.match(this.exp)||[];c.length>0?(n.global=c[1],n.entry=c[2],n.type="js",t.push(n),n={}):(n.global="",n.entry=r,n.type="js",t.push(n),n={})}else Array.isArray(r)?r.map(c=>{if(!c)return;if(c.split("?")[0].endsWith(".css"))n.entry=c,n.type="css";else{let v=c.match(this.exp)||[];v.length>0?(n.global=v[1],n.entry=v[2],n.type="js"):(n.global="",n.entry=c,n.type="js")}t.push(n),n={}}):typeof r=="object"&&r.entry&&(n.entry=r.entry,n.global=r.global,n.type=r.type,t.push(n),n={})}await Promise.all([this.setExternalAssets(t)])}async setExternalAssets(e=[]){if(e.length>0){let t=[];t=t.concat(e),t.map(s=>{s.type=s.type||"js",s.type==="js"&&s.module?(s.global?this.externals[s.module]=s.global:o.empConfig.isESM&&(this.useImportMap?(this.externals[s.module]=s.module,this.importMap.imports[s.module]=s.entry):this.externals[s.module]=s.entry),s.entry&&!o.empConfig.isESM&&this.externalAssets.js.push(s.entry)):s.type==="css"&&s.entry&&this.externalAssets.css.push(s.entry)})}}}});var V,gt=h(()=>{"use strict";a();y();V=class{fastMode={runtimeHost:"",runtimeLib:"",externals:{},globalVal:"EMP_ADAPTER",framework:"react"};externalMF={"@module-federation/runtime":"MFRuntime","@module-federation/sdk":"MFSDK"};externalReact={react:"React","react-dom":"ReactDOM","react-router-dom":"ReactRouterDOM"};externals={};getRuntimeLib(e){return`${e}/runtime${o.mode==="development"?".development":""}.umd.js`}setup(){this.fastMode=o.deepAssign(this.fastMode,o.empConfig.empShare.fastMode),this.injectLib(),this.setExternals()}injectLib(){let{runtimeHost:e,runtimeLib:t}=this.fastMode;if(e||t){let s=t||this.getRuntimeLib(e);o.empConfig.empShareLib.externalAssets.js.push(s)}}setExternals(){for(let[e,t]of Object.entries(this.externalMF))this.externals[e]=`${this.fastMode.globalVal}.${t}`;if(this.fastMode.framework==="react")for(let[e,t]of Object.entries(this.externalReact))this.externals[e]=`${this.fastMode.globalVal}.${t}`;Object.entries(this.fastMode.externals).length>0&&(this.externals=o.deepAssign(this.externals,this.fastMode.externals)),o.empConfig.empShareLib.externals=o.deepAssign(o.empConfig.empShareLib.externals,this.externals)}}});var G,Se=h(()=>{"use strict";a();G={rule:{mjs:"mjs",typescript:"typescript",javascript:"javascript",sourceMap:"sourceMapLoader",inline:"inline",svg:"svg",image:"image",font:"fonts",svga:"svga",sass:"sass",less:"less",css:"css"},use:{swc:"swc",sourceMap:"sourceMapLoader",sass:"sassLoader",less:"lessLoader"},plugin:{bundleAnalyzer:"bundleAnalyzerPlugin",define:"definePlugin",copy:"copyRspackPlugin",progress:"progressPlugin",empShare:"empShare",html:{prefix:"html-plugin-",empSharePrefix:"html-plugin-empShare-",importMapPrefix:"html-plugin-import-map-",hooks:{empShareLib:"HtmlEmpShareLibPluginName",importMap:"HtmlImportMapPlugin"}},rsdoctor:"rsdoctor"},minimizer:{minJs:"minJs",minCss:"minCss"}}});var Ee,dt,W,yt,X,As,K,Oe=h(()=>{"use strict";a();Ee=l(require("html-webpack-plugin"),1);C();y();Se();dt=G.plugin.html.hooks.importMap,W=class{importMap;chunk;constructor(e,t){this.importMap=e,this.chunk=t}apply(e){e.hooks.compilation.tap(dt,t=>{Ee.default.getHooks(t).alterAssetTagGroups.tapAsync(dt,(s,r)=>{if(!s.plugin.userOptions.chunks?.includes(this.chunk))return r(null,s);s.headTags.push({tagName:"script",attributes:{type:"importmap"},innerHTML:`${JSON.stringify(this.importMap,null,2)}`,voidTag:!1,meta:{plugin:void 0}}),r(null,s)})})}},yt=G.plugin.html.hooks.empShareLib,X=class{chunk;files;constructor(e,t){this.files=g({js:[],css:[]},e),this.chunk=t}apply(e){e.hooks.compilation.tap(yt,t=>{let s=this.files;Ee.default.getHooks(t).alterAssetTagGroups.tapAsync(yt,(r,n)=>{if(!r.plugin.userOptions.chunks?.includes(this.chunk))return n(null,r);s.js.map(c=>{r.headTags.push({tagName:"script",attributes:{src:c},voidTag:!1,meta:{plugin:void 0}})}),s.css.map(c=>{r.headTags.push({tagName:"link",attributes:{rel:"stylesheet",href:c},voidTag:!1,meta:{plugin:void 0}})}),n(null,r)})})}},As=()=>{let i=[`import 'core-js/${o.empConfig.build.coreJsFeatures}'`].join(`
11
+ `);return he(i)},K=class{constructor(){}apply(e){let{webpack:t}=e;new t.EntryPlugin(e.context,As(),{name:void 0}).apply(e)}}});var Q,bt=h(()=>{"use strict";a();y();we();Oe();Q=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){await _.setup(),this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){o.empConfig.build.polyfill==="entry"&&o.chain.plugin("empPolyfill").use(K),this.op.beforePlugin&&await this.op.beforePlugin()}async afterPlugin(){this.op.afterPlugin&&await this.op.afterPlugin()}async beforeModule(){this.op.beforeModule&&await this.op.beforeModule()}async afterModule(){this.op.afterModule&&await this.op.afterModule()}async beforeEmpPlugin(){this.op.beforeEmpPlugin&&await this.op.beforeEmpPlugin()}async afterEmpPlugin(){this.op.afterEmpPlugin&&await this.op.afterEmpPlugin()}async beforeBuild(){this.op.beforeBuild&&await this.op.beforeBuild()}async afterBulid(){this.op.afterBulid&&await this.op.afterBulid()}async beforeDevServe(){this.op.beforeDevServe&&await this.op.beforeDevServe()}async afterDevServe(){this.op.afterDevServe&&await this.op.afterDevServe()}async beforeServe(){this.op.beforeServe&&await this.op.beforeServe()}async afterServe(){this.op.afterServe&&await this.op.afterServe()}}});var vt,Pe,Ct,wt=h(()=>{"use strict";a();vt=l(require("fs"),1);z();it();C();I();ut();gt();bt();Pe=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},g(e,t)}empShareFastMode=new V;empShareLib=new q;isESM=!1;async autoDevSet(){this.store.mode==="development"&&this.store.empOptions.autoDevBase}checkIsESM(e){return["es3","es5"].indexOf(e)===-1}lifeCycle;async setup(e){this.store=e,await this.syncEmpOptions(),this.lifeCycle=new Q(this.store.empOptions.lifeCycle),await this.lifeCycle.afterGetEmpOptions(),this.isESM=this.checkIsESM(this.build.target),this.store.empOptions.target?(this.target=this.store.empOptions.target,Array.isArray(this.target)&&!this.target.includes(this.build.target)&&this.target.push(this.build.target)):this.target=["web",this.build.target];let{appSrc:t,base:s,appEntry:r}=this.store.empOptions;t&&(this.appSrc=t),s&&(this.base=s),r&&(this.appEntry=r),this.store.empConfig.empShare&&await this.empShareLib.setup()}async chain(){this.store.empOptions.chain&&await this.store.empOptions.chain(this.store.chain)}async plugins(){let e=[];this.store.empOptions.plugins&&Array.isArray(this.store.empOptions.plugins)&&this.store.empOptions.plugins.length>0&&(this.store.empOptions.plugins.map(t=>{e.push(t.rsConfig(this.store))}),await Promise.all(e))}get debug(){let e=!1;return this.store.cliOptions.doctor&&(e={supports:{generateTileGraph:!0}}),this.assign({loggerLevel:"info",clearLog:!0,progress:!0,showRsconfig:!1,showPerformance:!1,rspackCache:!0,rsdoctor:e,infrastructureLogging:{appendOnly:!0,level:"warn"},newTreeshaking:this.store.empConfig.isESM},this.store.empOptions.debug)}get build(){let e=this.store.empOptions.build?.staticDir?`${this.store.empOptions.build?.staticDir}/`:"";return this.assign({outDir:"dist",staticDir:e,assetsDir:"assets",publicDir:"public",chunkIds:this.store.isDev?"named":"deterministic",moduleIds:this.store.isDev?"named":"deterministic",sourcemap:this.store.isDev,minify:!this.store.isDev,minOptions:{},cssminOptions:{},target:"es5",polyfill:!1,polyfillInclude:[],coreJsFeatures:"stable",externalHelpers:!1,browserslist:this.store.browserslistOptions.default,swcConfig:{},devtool:"source-map"},{...this.store.empOptions.build,staticDir:e})}get html(){let e=this.store.empOptions.html?.template?{}:{charset:{charset:"utf-8"},"http-equiv":{"http-equiv":"X-UA-Compatible",content:"IE=edge"},viewport:{name:"viewport",content:"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"},keywords:{keywords:""},description:{description:""}};return this.assign({lang:"zh-CN",title:"EMP",inject:"body",minify:!this.store.isDev,scriptLoading:this.isESM?"module":"defer",meta:e,files:{css:[],js:[]},tags:{headTags:[],bodyTags:[]}},this.store.empOptions.html)}get entries(){return this.store.empOptions.entries?this.store.empOptions.entries:{}}get server(){let e={host:"0.0.0.0",port:8e3,open:process.platform==="darwin",hot:!0,watchFiles:["src/**/*.html"],static:[{directory:this.store.publicDir,watch:this.store.isDev}],allowedHosts:["all"],historyApiFallback:!0,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":"X-Requested-With, content-type, Authorization"}};return this.store.empOptions.server?.http2&&(O.httpsType="h2",delete this.store.empOptions.server.http2),this.assign(e,this.store.empOptions.server)}get empShare(){return this.assign({name:"",filename:"emp.js",shared:{}},this.store.empOptions.empShare)}get css(){return this.assign({sass:{mode:"modern"}},this.store.empOptions.css)}get output(){let e=(this.store.isDev,".[contenthash:8]"),t=this.store.isDev?"":".[contenthash:8]",{assetsDir:s,staticDir:r}=this.store.empConfig.build,n={publicPath:this.store.empConfig.base?this.store.empConfig.base:"auto",crossOriginLoading:"anonymous",filename:`${r}js/[name]${e}.js`,cssFilename:`${r}css/[name]${t}.css`,cssChunkFilename:`${r}css/[name]${t}.css`,assetModuleFilename:`${r}${s}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!0,uniqueName:this.store.uniqueName};return this.assign(n,this.store.empOptions.output)}get define(){let e={mode:this.store.mode,env:this.store.cliOptions.env};return this.store.empOptions.define&&(e={...e,...this.store.empOptions.define}),this.setDefine(e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",s={};return Object.keys(e).map(r=>{t==="all"?(s[`import.meta.env.${r}`]=JSON.stringify(e[r]),s[`process.env.${r}`]=JSON.stringify(e[r])):t==="esm"?s[`import.meta.env.${r}`]=JSON.stringify(e[r]):t==="cjs"?s[`process.env.${r}`]=JSON.stringify(e[r]):t==="none"&&(s[`${r}`]=JSON.stringify(e[r]))}),s}get externals(){return this.assign(this.empShareLib.externals,this.store.empOptions.externals)}get resolve(){return g({alias:{src:this.store.resolve("src"),"@":this.store.resolve("src")},extensions:["...",".js",".jsx",".mjs",".ts",".tsx",".css",".less",".scss",".sass",".json",".wasm",".vue",".svg",".svga"]},this.store.empOptions.resolve)}async syncEmpOptions(){p.time("[store][empConfig]SyncEmpOptions");let e=await st();if(!e||!vt.default.existsSync(e))return;let t=await tt(e);typeof t=="function"?this.store.empOptions=await t(this.store):this.store.empOptions=t||{},p.timeEnd("[store][empConfig]SyncEmpOptions")}get moduleTransformRule(){let{moduleTransform:e}=this.store.empOptions,t=this.assign({defaultExclude:!1},e),s={and:[],not:[]};return t.defaultExclude===!0&&s.and.push(/(node_modules|bower_components)/),t?.exclude&&(s.and=s.and.concat(t.exclude)),e?.include&&(s.not=t.include),s}get cacheDir(){return this.store.empOptions.cacheDir?this.store.empOptions.cacheDir:"node_modules/.emp-cache"}get ignoreWarnings(){return this.store.empOptions.ignoreWarnings?this.store.empOptions.ignoreWarnings:[/Conflicting order/]}get autoPages(){let e;return this.store.empOptions.autoPages&&(e=typeof this.store.empOptions.autoPages=="boolean"?{}:this.store.empOptions.autoPages,e=this.assign({path:"pages"},e)),e}},Ct=new Pe});var xt,ke,St,Et=h(()=>{"use strict";a();xt=l(require("fs-extra"),1),ke=class{store;async setup(e){this.store=e;let t=[this.common(),this.stats(),this.devServer(),this.optimization(),this.checkTsconfig()];await Promise.all(t)}async common(){this.store.merge({node:{global:!0},experiments:{outputModule:this.store.empConfig.isESM,topLevelAwait:!0,css:!0},target:this.store.empConfig.target,infrastructureLogging:this.store.empConfig.debug.infrastructureLogging,context:this.store.root,mode:this.store.mode,cache:this.store.empConfig.debug.rspackCache,devtool:this.store.empConfig.build.sourcemap?this.store.empConfig.build.devtool:!1,output:this.store.empConfig.output,resolve:this.store.empConfig.resolve,externals:this.store.empConfig.externals,ignoreWarnings:this.store.empConfig.ignoreWarnings,watchOptions:{ignored:["**/node_modules/**","**/@mf-types/**"]}})}async checkTsconfig(){let e=this.store.resolve("tsconfig.json");if(await xt.default.exists(e)){let s={tsConfig:e};this.store.merge({resolve:s})}}async stats(){this.store.merge({stats:{colors:!0,all:!1,assets:!1,chunks:!1,timings:!0,version:!0}})}async devServer(){this.store.merge({devServer:this.store.empConfig.server})}async optimization(){let e={moduleIds:this.store.empConfig.build.moduleIds,chunkIds:this.store.empConfig.build.chunkIds,minimize:this.store.empConfig.build.minify,splitChunks:{chunks:"async",cacheGroups:{}}};this.store.empConfig.build.polyfill&&(e.splitChunks.cacheGroups={}),this.store.chain.merge({optimization:e})}},St=new ke});var Me,Ot,Pt=h(()=>{"use strict";a();Me=class{store;async setup(e){this.store=e;let t=[this.sass(),this.less(),this.css()];await Promise.all(t)}async sass(){let{rule:e,use:t}=this.store.chainName,s={},{sass:r}=this.store.empConfig.css||{sass:{}};r.mode==="modern"&&(s.implementation=r.implementation?r.implementation:require.resolve("sass-embedded"),s.api=r.api?r.api:"legacy",s.sourceMap=this.store.empConfig.build.sourcemap,r.sassOptions&&(s.sassOptions=r.sassOptions)),this.store.chain.merge({module:{rule:{[e.sass]:{test:/\.(sass|scss)$/,use:{[t.sass]:{loader:require.resolve("sass-loader"),options:s}},type:"css/auto"}}}})}async less(){let{rule:e,use:t}=this.store.chainName,s={loader:require.resolve("less-loader"),options:{lessOptions:{javascriptEnabled:!0}}};this.store.chain.merge({module:{rule:{[e.less]:{test:/\.less$/,use:{[t.less]:s},type:"css/auto"}}}})}async css(){let{rule:e}=this.store.chainName;this.store.chain.merge({module:{rule:{[e.css]:{test:/\.css$/,use:{},type:"css/auto"}}}})}},Ot=new Me});var w,kt,$e,Mt,$t=h(()=>{"use strict";a();w=l(require("path"),1),kt=l(require("html-webpack-plugin"),1);z();C();Oe();$e=class{store;entriesConfig={};async setup(e){this.store=e,await this.init(),this.toConfig()}setHtmlConfig(e,t){return e.template=this.setTemplate(e.template),e.favicon=this.setFavicion(e.favicon),e.chunks=t,e.filename=`${t[0]}.html`,this.store.empConfig.base&&(e.publicPath=this.store.empConfig.base),e.tags=e.tags||{},e}setChunk(e){return e.replace(w.default.extname(e),"").replace(`${this.store.empConfig.appSrc}${w.default.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(w.default.join("template","index.html"))}setFavicion(e){return e?this.store.resolve(e):this.store.empResolve(w.default.join("template","favicon.ico"))}setEntryItem(e,t,s){s=s||this.store.resolve(w.default.join(this.store.empConfig.appSrc,e));let r=this.setChunk(e),n=[s];this.entriesConfig[r]={entry:{[r]:n},html:this.setHtmlConfig(t,[r])},this.store.entries[r]=n}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`${this.store.chainName.plugin.html.prefix}${t}`).use(kt.default,[e]),this.store.empConfig.empShareLib&&(e.files=g(e.files,this.store.empConfig.empShareLib.externalAssets)),this.store.chain.plugin(`${this.store.chainName.plugin.html.empSharePrefix}${t}`).use(X,[e.files,t]),this.store.empConfig.empShareLib.useImportMap&&this.store.chain.plugin(`${this.store.chainName.plugin.html.importMapPrefix}${t}`).use(W,[this.store.empConfig.empShareLib.importMap,t])}setRspackEntry(e){this.store.merge({entry:e})}async init(){this.store.empConfig.autoPages?await this.setAutoPage():(await this.setDefaultEntry(),this.setEntryByConfig())}async setAutoPage(){p.time("setAutoPage");let e=this.store.empConfig.autoPages?.path||"pages",t=w.default.join(this.store.appSrc,e),s=w.default.join(t,"**","*.{ts,tsx,jsx,js}"),r=await(0,M.glob)([s],{windowsPathsNoEscape:!0});r=r.map(n=>n.replace(`${t}${w.default.sep}`,"")),r.map(n=>{let c=this.store.empConfig.entries[n]||{};this.setEntryItem(n,{...this.store.empConfig.html,...c},w.default.join(t,n))}),p.timeEnd("setAutoPage")}async setDefaultEntry(){p.time("[store][empConfig]SetDefaultEntry");let e=w.default.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}"),t=await(0,M.glob)([e],{windowsPathsNoEscape:!0});if(t[0]){let s=w.default.join(this.store.empConfig.appSrc,Object.keys(this.store.empConfig.entries).length>0&&this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index");this.setEntryItem(s,this.store.empConfig.html,t[0])}p.timeEnd("[store][empConfig]SetDefaultEntry")}setEntryByConfig(){if(Object.keys(this.store.empConfig.entries).length>0)for(let[e,t]of Object.entries(this.store.empConfig.entries))this.setEntryItem(e,{...this.store.empConfig.html,...t})}toConfig(){for(let[e,t]of Object.entries(this.entriesConfig))this.setRspackHtmlPlugin(t.html,e),this.setRspackEntry(t.entry)}},Mt=new $e});var je,Le,jt,Lt=h(()=>{"use strict";a();je=l(require("path"),1);C();Le=class{store;swcJsOptions={};swcTsOptions={};coreJs={version:"3",alias:"",path:""};async setup(e){this.store=e,this.swcInitOptions(),await this.run()}async run(){let e=[this.jsDataUrl(),this.files(),this.scripts(),this.rspackGenerator(),this.rspackParser()];await this.store.empConfig.lifeCycle.beforeModule(),await Promise.all(e),await this.store.empConfig.lifeCycle.afterModule()}rspackGenerator(){let e=this.store.isDev?"[path][name]-[local]-[hash:5]":"[local]-[hash:5]";this.store.chain.merge({module:{generator:{css:{localIdentName:e},"css/auto":{localIdentName:e},"css/module":{localIdentName:e}}}})}rspackParser(){this.store.chain.merge({module:{parser:{css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return this.store.empConfig.build.polyfill}swcParser(e){switch(e){case"js":return{syntax:"ecmascript",jsx:!0,decorators:!0,decoratorsBeforeExport:!1};case"ts":return{syntax:"typescript",decorators:!0,tsx:!0,dynamicImport:!0}}}swcJsc(e){let{target:t,externalHelpers:s}=this.store.empConfig.build;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:s,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:g(this.swcJsc(e),{...this.store.empConfig.build.swcConfig}),isModule:"unknown"};return this.isPolyfill&&(delete t.jsc.target,t.env={coreJs:this.swcCoreVersion,targets:this.store.empConfig.build.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill),this.store.empConfig.build.polyfill==="usage"&&(t.env.shippedProposals=!0,t.env.include=this.store.empConfig.build.polyfillInclude)),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build;e&&this.store.chain.resolve.alias.set("@swc/helpers",je.default.dirname(require.resolve("@swc/helpers/package.json"))),this.coreJs.path=require.resolve("core-js/package.json");let t=le(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=je.default.dirname(this.coreJs.path),this.store.empConfig.build.polyfill&&(this.store.chain.resolve.alias.set("core-js",this.coreJs.alias),this.store.chain.module.rule("javascript").exclude.add(/core-js/),this.store.chain.module.rule("typescript").exclude.add(/core-js/)),this.swcTsOptions=this.swcOptions("ts"),this.swcJsOptions=this.swcOptions("js")}jsDataUrl(){this.store.chain.module.rule("jsDataUrl").merge({mimetype:{or:["text/javascript","application/javascript"]}}).resolve.set("fullySpecified",!1).end().use("swcJsParser").loader("builtin:swc-loader").options(this.swcJsOptions)}async scripts(){let e=[],{rule:t,use:s}=this.store.chainName;this.store.chain.merge({module:{parser:{javascript:{exportsPresence:"error",importExportsPresence:"error"}},rule:{[t.mjs]:{test:/\.m?js/,resolve:{fullySpecified:!1}},[t.typescript]:{test:/\.(ts|tsx)$/,exclude:e,use:{[s.swc]:{loader:"builtin:swc-loader",options:this.swcTsOptions}}},[t.javascript]:{test:/\.((m|c)?js|jsx)$/,exclude:e,use:{[s.swc]:{loader:"builtin:swc-loader",options:this.swcJsOptions}}},[t.sourceMap]:{test:/\.[tj]sx?$/,enforce:"pre",use:{[s.sourceMap]:{loader:require.resolve("source-map-loader")}}}}}})}async files(){let{rule:e}=this.store.chainName;this.store.chain.merge({module:{rule:{[e.svg]:{test:/\.svg$/,type:"asset/resource"}}}}),this.store.chain.merge({module:{rule:{[e.inline]:{resourceQuery:/inline/,type:"asset/inline"}}}}),this.store.chain.merge({module:{rule:{[e.image]:{test:/\.(png|jpe?g|gif|webp|ico)$/i,type:"asset/resource"},[e.font]:{test:/\.(|otf|ttf|eot|woff|woff2)$/i,type:"asset/resource"},[e.svga]:{test:/\.(svga)$/i,type:"asset/resource"}}}})}},jt=new Le});var De,Dt,R,Te,Tt,Rt=h(()=>{"use strict";a();De=l(require("fs"),1),Dt=require("@module-federation/enhanced/rspack"),R=l(require("@rspack/core"),1),Te=class{store;async setup(e){this.store=e;let t=[this.define(),this.anylayze(),this.progress(),this.copy(),this.empShare(),this.minify(),this.redoctor()];await this.store.empConfig.lifeCycle.beforePlugin(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterPlugin()}async anylayze(){if(!this.store.cliOptions.analyze)return;let{default:{BundleAnalyzerPlugin:e}}=await import("webpack-bundle-analyzer");this.store.chain.plugin(this.store.chainName.plugin.bundleAnalyzer).use(e,[{analyzerPort:this.store.empConfig.server.port,defaultSizes:"gzip",analyzerHost:this.store.getLanIp()||"127.0.0.1"}])}async define(){this.store.chain.plugin(this.store.chainName.plugin.define).use(R.default.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");De.default.existsSync(e)&&De.default.readdirSync(e).length>0&&this.store.chain.plugin(this.store.chainName.plugin.copy).use(R.default.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve(this.store.empConfig.build.outDir)}]}])}async progress(){this.store.empConfig.debug.progress&&this.store.chain.plugin(this.store.chainName.plugin.progress).use(R.default.ProgressPlugin,[{prefix:"EMP"}])}async empShare(){let{isEmpshare:e}=this.store.empConfig.empShareLib;if(!e)return;let t=Dt.ModuleFederationPlugin;this.store.chain.plugin(this.store.chainName.plugin.empShare).use(t,[this.store.empConfig.empShareLib.pluginConfig])}minify(){this.store.chain.optimization.minimize(this.store.mode==="production"),this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minJs).use(R.default.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]),this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(R.default.LightningCssMinimizerRspackPlugin,[this.store.empConfig.build.cssminOptions])}redoctor(){if(!this.store.empConfig.debug.rsdoctor)return;let{RsdoctorRspackPlugin:e}=require("@rsdoctor/rspack-plugin"),t={};typeof this.store.empConfig.debug.rsdoctor=="object"&&(t=this.store.empConfig.debug.rsdoctor),this.store.chain.plugin(this.store.chainName.plugin.rsdoctor).use(e,[t])}},Tt=new Te});var Re,At,Ft=h(()=>{"use strict";a();Et();Pt();$t();Lt();Rt();Re=class{store;async setup(e){this.store=e;let t=[St.setup(this.store),jt.setup(this.store),Tt.setup(this.store),Mt.setup(this.store),Ot.setup(this.store)];await Promise.all(t),await this.store.empConfig.lifeCycle.beforeEmpPlugin(),await this.store.empConfig.plugins(),await this.store.empConfig.lifeCycle.afterEmpPlugin(),await this.store.empConfig.chain()}},At=new Re});var Nt,x,zt,It,Ae,o,y=h(()=>{"use strict";a();Nt=l(require("fs/promises"),1),x=l(require("path"),1),zt=l(require("util"),1);E();C();wt();Ft();It=l(require("webpack-chain"),1);Se();Ae=class{empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=x.default.resolve(__dirname,__filename).replace(`${x.default.sep}dist${x.default.sep}index.js`,"");empSource=x.default.resolve(this.empRoot,"dist");resolve=e=>x.default.isAbsolute(e)?e:x.default.resolve(this.root,e);empResolve=e=>x.default.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};chainName=G;cacheDir="";mode="development";cliMode="dev";isDev=!0;cliOptions;chain;rsConfig;empOptions={};empConfig;vCompare=me;deepAssign=g;getLanIp=N;entries={};debug;async setup(e,t){p.time("[store]Setup"),await this.initVars(e,t),this.empConfig=Ct,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new It.default,await At.setup(this),this.setLogger(),this.toConfig(),this.logConfig(),p.timeEnd("[store]Setup")}async initVars(e,t){this.cliOptions=t||{},this.cliMode="prod",this.mode=e==="dev"?"development":"production",this.isDev=this.mode==="development",process.env.NODE_ENV=e==="dev"?"development":"production";let s=require(this.empResolve("package.json")),r=require(this.resolve("package.json"));this.empPkg={...this.empPkg,...s},this.pkg={...this.pkg,...r},this.resource.dir=x.default.join(this.empRoot,"resource"),this.resource.cert=x.default.join(this.resource.dir,"emp.cert"),this.resource.key=x.default.join(this.resource.dir,"emp.key")}initPaths(){this.appSrc=this.resolve(this.empConfig.appSrc),this.outDir=this.resolve(this.empConfig.build.outDir),this.publicDir=this.resolve(this.empConfig.build.publicDir),this.cacheDir=this.resolve(this.empConfig.cacheDir)}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),p.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}`,brandName:"EMP",logLevel:e})}merge(e){this.chain.merge(e)}toConfig(){this.rsConfig=this.chain.toConfig()}logConfig(){if(this.debug.showRsconfig)if(typeof this.debug.showRsconfig=="string"){let e=x.default.join(this.root,this.debug.showRsconfig);Nt.default.writeFile(e,JSON.stringify(this.rsConfig,null,2))}else{this.debug.clearLog=!1;let e={colors:!0,depth:null},t=typeof this.debug.showRsconfig=="object"?g(e,this.debug.showRsconfig):e;console.log(p.link("[Compile Config]")),console.log(zt.default.inspect(this.rsConfig,t))}}get browserslistOptions(){return{default:["chrome >= 87","edge >= 88","firefox >= 78","safari >= 14"],h5:["iOS >= 9","Android >= 4.4","last 2 versions","> 0.2%","not dead"],node:["node >= 16"]}}get uniqueName(){return this.pkg.name.replaceAll("/","_").replaceAll("@","_").replaceAll("-","_")}},o=new Ae});function Us(i,e){let t=[i,e],s=["File","Size","Gzipped"].reduce((r,n,c)=>{let d=t[c],v=n;return d&&(v=n.length<d?n+" ".repeat(d-n.length):n),`${r+v} `}," ");console.log(j.bold(s))}async function Ut(i){let e=i.toJson({all:!1,assets:!0,timings:!0}),s=e.assets.filter(u=>Is(u.name)).map(Hs);s.sort((u,F)=>u.size-F.size);let r=Math.max(...s.map(u=>u.sizeLabel.length)),n=Math.max(...s.map(u=>(u.folder+P.default.sep+u.name).length));Us(n,r);let c=0,d=0;s.forEach(u=>{let{sizeLabel:F}=u,{name:ls,folder:cs,gzipSizeLabel:ms}=u,Be=(cs+P.default.sep+ls).length,Je=F.length;if(c+=u.size,d+=u.gzippedSize,Je<r){let re=" ".repeat(r-Je);F+=re}let _e=L(u.folder+P.default.sep)+Bs(u.name);if(Be<n){let re=" ".repeat(n-Be);_e+=re}p.info(` ${_e} ${L(F)} ${ms}`)});let v=`${j.bold("Total size:")} ${Z(c)}`,A=`${j.bold("Gzipped size:")} ${Z(d)}`;p.info(`
12
12
  ${v}
13
13
  ${A}
14
14
  `),p.info(`${S("\u2713")} Ready in ${B(Number(e.time))}
15
- `)}function Y(i=0){p.info(`${S("\u2713")} Ready in ${B(Number(i))}`)}var Gt,P,Ut,Fs,Ns,zs,Is,Gs,Us,Z,Bs,ee=h(()=>{"use strict";a();Gt=l(require("fs"),1),P=l(require("path"),1),Ut=require("gzip-size");D();y();E();C();Fs=/\.html$/,Ns=/\.(?:js|mjs|cjs|jsx)$/,zs=/\.css$/,Is=i=>!/\.map$/.test(i)&&!/\.LICENSE\.txt$/.test(i),Gs=i=>i>300*1e3?oe:i>100*1e3?H:ne,Us=i=>{let e=i.name.split("?")[0],t=Z(i.size),s=P.default.basename(e),r=P.default.join(P.default.basename(o.empConfig.build.outDir),P.default.dirname(e)),n=Gt.default.readFileSync(P.default.join(o.empConfig.build.outDir,e)),c=n.length,d=(0,Ut.gzipSizeSync)(n),v=Gs(d)(Z(d));return{size:c,folder:r,name:s,gzippedSize:d,sizeLabel:t,gzipSizeLabel:v}};Z=i=>{let e=i/1e3;return`${e.toFixed(e<1?2:1)} kB`},Bs=i=>Ns.test(i)?H(i):zs.test(i)?S(i):Fs.test(i)?j(i):ae(i)});var _t={};$(_t,{default:()=>Js});var Bt,Jt,Fe,Js,Vt=h(()=>{"use strict";a();Bt=require("@rspack/core"),Jt=require("@rspack/dev-server");ee();E();C();I();y();Fe=class extends O{get rspackDevConfig(){return g(o.rsConfig,{stats:{all:!1,colors:!0,assets:!1,chunks:!1,entrypoints:!1,timings:!1,version:!1,errors:!0,warnings:!0},devServer:{open:!1,setupExitSignals:!0}})}async devServerConfig(){let e=Object.assign({},o.rsConfig.devServer);if(this.isHttps&&(e.https===!0&&delete e.https,!e.server)){let[t,s]=await this.getcert();e.server={type:"https",options:{key:t,cert:s}}}return e}async run(){let e=(0,Bt.rspack)(this.rspackDevConfig);if(!o.rsConfig.devServer){p.error("devServer is not defined in config");return}let t=await this.devServerConfig(),s=new Jt.RspackDevServer(t,e);this.startOpen(),o.empConfig.lifeCycle.beforeDevServe&&await o.empConfig.lifeCycle.beforeDevServe(),await s.start();let r=n=>{let c=n?.toJson({all:!1,colors:!1,assets:!1,chunks:!1,timings:!0});Y(c.time)};o.debug.showPerformance&&e.hooks.afterDone.tap("done",r),s.middleware?.waitUntilValid(n=>{o.debug.showPerformance||r(n),o.empConfig.lifeCycle.afterDevServe&&o.empConfig.lifeCycle.afterDevServe()})}},Js=new Fe});var Wt,qt,Xt,Kt,te,Qt=h(()=>{"use strict";a();Wt=l(require("https"),1),qt=l(require("compression"),1),Xt=l(require("cors"),1),Kt=l(require("express"),1);I();te=class extends O{app;async init(){let e=(0,Kt.default)();e.use((0,qt.default)()),e.use((0,Xt.default)()),this.app=e}async server(){if(this.isHttps){let[e,t]=await this.getcert();Wt.default.createServer(typeof this.isHttps!="boolean"?this.isHttps:{key:e,cert:t},this.app).listen(this.sf.port,async()=>{this.startOpen(),await this.onReady()})}else this.app.listen(this.sf.port,async()=>{this.startOpen(),await this.onReady()})}async onReady(){}async middleware(){}async start(){await this.init(),await this.middleware(),await this.server()}}});var Ne={};$(Ne,{ServeScript:()=>se,default:()=>_s});var Zt,Yt,es,ts,se,_s,ze=h(()=>{"use strict";a();Zt=l(require("fs"),1),Yt=l(require("fs/promises"),1),es=l(require("path"),1),ts=l(require("express"),1);ee();E();y();Qt();se=class extends te{timing=0;async run(){if(this.timing=Date.now(),!Zt.default.existsSync(o.outDir))return p.sysError(`emp serve must be executed after emp build,${o.outDir} not exist!`);o.empConfig.lifeCycle.beforeServe&&await o.empConfig.lifeCycle.beforeServe(),this.start()}async middleware(){let e=o.resolve(o.rsConfig.output?.path);this.app.use(ts.default.static(e));let t=await Yt.default.readFile(es.default.join(e,"index.html"),"utf8");this.app.get("*",(s,r)=>r.send(t))}async onReady(){Y(Date.now()-this.timing),o.empConfig.lifeCycle.afterServe&&await o.empConfig.lifeCycle.afterServe()}},_s=new se});var is={};$(is,{default:()=>Vs});var ss,Ie,Vs,rs=h(()=>{"use strict";a();ss=require("@rspack/core");ee();E();I();y();Ie=class extends O{isWatchMode=!1;rspackConfig;isuseServe=!1;isStartServe=!1;watchMode(){this.isWatchMode&&this.rspackConfig.optimization&&(this.rspackConfig.optimization.moduleIds="named",this.rspackConfig.optimization.chunkIds="named",this.rspackConfig.watch=!0)}async startServe(){if(!this.isuseServe||this.isStartServe)return;this.isStartServe=!0;let{default:e}=await Promise.resolve().then(()=>(ze(),Ne));await e.setup("serve",o.cliOptions)}async run(){await o.empConfig.lifeCycle.beforeBuild(),this.isWatchMode=!!o.cliOptions.watch,this.isuseServe=!!o.cliOptions.serve,this.rspackConfig=o.rsConfig,this.isWatchMode&&this.watchMode(),(0,ss.rspack)(this.rspackConfig,async(e,t)=>{if(e!==null){p.error(e.stack||e),e.message&&p.error(e.message);return}if(!t){p.red("Stats is Undefined.");return}t.hasErrors()&&(p.error(t.toString({all:!1,colors:!0,errors:!0})),p.red("Failed to compile."),process.exit(1)),t.hasWarnings()&&(p.yellow("Compiled with warnings."),p.warn(t.toString({all:!1,chunks:!1,assets:!1,colors:!0,errors:!0,warnings:!0}))),await Ht(t),this.startServe(),await o.empConfig.lifeCycle.afterBulid()})}},Vs=new Ie});var Qs={};$(Qs,{HtmlWebpackPlugin:()=>ps.default,defineConfig:()=>Ks,dts:()=>ns,empHelper:()=>ue,rspack:()=>as.rspack,runScript:()=>Ge,store:()=>o});module.exports=ys(Qs);a();var as=require("@rspack/core"),ps=l(require("html-webpack-plugin"),1);a();var os=l(require("process"),1),k=require("commander");y();function Ge(){k.program.version(o.empPkg.version,"-v, --version").usage("<command> [options]"),k.program.command("dev").description("Dev \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-h, --hot","\u662F\u5426\u4F7F\u7528\u70ED\u66F4\u65B0 \u9ED8\u8BA4\u542F\u52A8").option("-o, --open","\u662F\u5426\u6253\u5F00\u8C03\u8BD5\u9875\u9762 \u9ED8\u8BA4\u4E0D\u6253\u5F00").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-ev, --env-vars <key=value>","\u5B9A\u4E49\u4E00\u4E2A\u73AF\u5883\u53D8\u91CF -ev key=value \u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u91CD\u590D\u8C03\u7528 -ev key=value -ev key=value",(i,e)=>{let[t,s]=i.split("=");return e[t]=s,e},{}).action(async i=>{let{default:e}=await Promise.resolve().then(()=>(Vt(),_t));await e.setup("dev",i)}),k.program.command("build").description("Build \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-a, --analyze","\u751F\u6210\u5206\u6790\u62A5\u544A \u9ED8\u8BA4\u4E3A false").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-w, --watch","watch \u6A21\u5F0F").option("-sv, --serve","watch \u6A21\u5F0F\u4E0B\u542F\u52A8serve").option("-ev, --env-vars <key=value>","\u5B9A\u4E49\u4E00\u4E2A\u73AF\u5883\u53D8\u91CF -ev key=value \u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u91CD\u590D\u8C03\u7528 -ev key=value -ev key=value",(i,e)=>{let[t,s]=i.split("=");return e[t]=s,e},{}).action(async i=>{let{default:e}=await Promise.resolve().then(()=>(rs(),is));await e.setup("build",i)}),k.program.command("serve").description("Server \u6A21\u5F0F").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").action(async i=>{let{default:e}=await Promise.resolve().then(()=>(ze(),Ne));await e.setup("serve",i)}),k.program.command("dts").description("\u62C9\u53D6 remote \u9879\u76EE\u7684 d.ts").option("-p, --typingsPath <typingsPath>","\u4E0B\u8F7D\u76EE\u5F55").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").action(i=>{}),k.program.command("init").description("\u521D\u59CB\u5316 emp \u9879\u76EE").option("-d, --data [data]","JSON\u6570\u636E http\u5730\u5740 \u6216\u8005 \u6587\u4EF6\u8DEF\u5F84\u76F8\u5BF9\u3001\u7EDD\u5BF9\u8DEF\u5F84").action(i=>{}),k.program.parse(os.default.argv)}a();var Ue=l(require("fs/promises"),1),ie=l(require("path"),1);z();y();var Ws=/(?:(?:import|export)\s?(?:type)?\s?(?:(?:\{[^;\n]+\})|(?:[^;\n]+))\s?from\s?['"][^;\n]+['"])|(?:import\(['"][^;\n]+?['"]\))/g,qs=/(?:import|export)\s?(?:type)?\s?\{?.+\}?\s?from\s?['"](.+)['"]/,Xs=/import\(['"]([^;\n]+?)['"]\)/,He=class{list=[];outDir=o.resolve("dist");aliasName="@empjs/cli";async setup(e,t){e&&(this.outDir=e),t&&(this.aliasName=t);let s=await this.readDts();await this.writeCode(s)}async readDts(){this.list=await(0,M.glob)([`${o.empConfig.build.outDir}/**/*.d.ts`],{windowsPathsNoEscape:!0});let e=[];this.list.map(s=>{s=o.resolve(s),e.push(this.readFile(s))});let t=await Promise.all(e);return t=t.map(s=>this.replaceAliasPath(s)),t}async readFile(e){let t=await Ue.default.readFile(e,{encoding:"utf-8"});return{src:e,code:t}}replaceAliasPath({src:e,code:t}){t=t.replace(Ws,r=>{let n=r.match(qs);if(n||(n=r.match(Xs)),n&&n[1]){let c=n[1];if(!c.startsWith("."))return r;let d=ie.default.resolve(ie.default.dirname(e),c).replace(this.outDir,this.aliasName);return r.replace(n[1],d)}return r});let s=e.replace(this.outDir,this.aliasName).replace(".d.ts","");return s.endsWith("/index")&&(s=s.replace("/index","")),t=this.warpDeclareModule(s,t),{code:t,src:e,mod:s}}warpDeclareModule(e,t){return`declare module '${e}' {\r
15
+ `)}function Y(i=0){p.info(`${S("\u2713")} Ready in ${B(Number(i))}`)}var Gt,P,Ht,Fs,Ns,zs,Is,Gs,Hs,Z,Bs,ee=h(()=>{"use strict";a();Gt=l(require("fs"),1),P=l(require("path"),1),Ht=require("gzip-size");D();y();E();C();Fs=/\.html$/,Ns=/\.(?:js|mjs|cjs|jsx)$/,zs=/\.css$/,Is=i=>!/\.map$/.test(i)&&!/\.LICENSE\.txt$/.test(i),Gs=i=>i>300*1e3?oe:i>100*1e3?U:ne,Hs=i=>{let e=i.name.split("?")[0],t=Z(i.size),s=P.default.basename(e),r=P.default.join(P.default.basename(o.empConfig.build.outDir),P.default.dirname(e)),n=Gt.default.readFileSync(P.default.join(o.empConfig.build.outDir,e)),c=n.length,d=(0,Ht.gzipSizeSync)(n),v=Gs(d)(Z(d));return{size:c,folder:r,name:s,gzippedSize:d,sizeLabel:t,gzipSizeLabel:v}};Z=i=>{let e=i/1e3;return`${e.toFixed(e<1?2:1)} kB`},Bs=i=>Ns.test(i)?U(i):zs.test(i)?S(i):Fs.test(i)?j(i):ae(i)});var _t={};$(_t,{default:()=>Js});var Bt,Jt,Fe,Js,qt=h(()=>{"use strict";a();Bt=require("@rspack/core"),Jt=require("@rspack/dev-server");ee();E();C();I();y();Fe=class extends O{get rspackDevConfig(){return g(o.rsConfig,{stats:{all:!1,colors:!0,assets:!1,chunks:!1,entrypoints:!1,timings:!1,version:!1,errors:!0,warnings:!0},devServer:{open:!1,setupExitSignals:!0}})}async devServerConfig(){let e=Object.assign({},o.rsConfig.devServer);if(this.isHttps&&(e.https===!0&&delete e.https,!e.server)){let[t,s]=await this.getcert();e.server={type:"https",options:{key:t,cert:s}}}return e}async run(){let e=(0,Bt.rspack)(this.rspackDevConfig);if(!o.rsConfig.devServer){p.error("devServer is not defined in config");return}let t=await this.devServerConfig(),s=new Jt.RspackDevServer(t,e);this.startOpen(),o.empConfig.lifeCycle.beforeDevServe&&await o.empConfig.lifeCycle.beforeDevServe(),await s.start();let r=n=>{let c=n?.toJson({all:!1,colors:!1,assets:!1,chunks:!1,timings:!0});Y(c.time)};o.debug.showPerformance&&e.hooks.afterDone.tap("done",r),s.middleware?.waitUntilValid(n=>{o.debug.showPerformance||r(n),o.empConfig.lifeCycle.afterDevServe&&o.empConfig.lifeCycle.afterDevServe()})}},Js=new Fe});var Vt,Wt,Xt,Kt,te,Qt=h(()=>{"use strict";a();Vt=l(require("https"),1),Wt=l(require("compression"),1),Xt=l(require("cors"),1),Kt=l(require("express"),1);I();te=class extends O{app;async init(){let e=(0,Kt.default)();e.use((0,Wt.default)()),e.use((0,Xt.default)()),this.app=e}async server(){if(this.isHttps){let[e,t]=await this.getcert();Vt.default.createServer(typeof this.isHttps!="boolean"?this.isHttps:{key:e,cert:t},this.app).listen(this.sf.port,async()=>{this.startOpen(),await this.onReady()})}else this.app.listen(this.sf.port,async()=>{this.startOpen(),await this.onReady()})}async onReady(){}async middleware(){}async start(){await this.init(),await this.middleware(),await this.server()}}});var Ne={};$(Ne,{ServeScript:()=>se,default:()=>_s});var Zt,Yt,es,ts,se,_s,ze=h(()=>{"use strict";a();Zt=l(require("fs"),1),Yt=l(require("fs/promises"),1),es=l(require("path"),1),ts=l(require("express"),1);ee();E();y();Qt();se=class extends te{timing=0;async run(){if(this.timing=Date.now(),!Zt.default.existsSync(o.outDir))return p.sysError(`emp serve must be executed after emp build,${o.outDir} not exist!`);o.empConfig.lifeCycle.beforeServe&&await o.empConfig.lifeCycle.beforeServe(),this.start()}async middleware(){let e=o.resolve(o.rsConfig.output?.path);this.app.use(ts.default.static(e));let t=await Yt.default.readFile(es.default.join(e,"index.html"),"utf8");this.app.get("*",(s,r)=>r.send(t))}async onReady(){Y(Date.now()-this.timing),o.empConfig.lifeCycle.afterServe&&await o.empConfig.lifeCycle.afterServe()}},_s=new se});var is={};$(is,{default:()=>qs});var ss,Ie,qs,rs=h(()=>{"use strict";a();ss=require("@rspack/core");ee();E();I();y();Ie=class extends O{isWatchMode=!1;rspackConfig;isuseServe=!1;isStartServe=!1;watchMode(){this.isWatchMode&&this.rspackConfig.optimization&&(this.rspackConfig.optimization.moduleIds="named",this.rspackConfig.optimization.chunkIds="named",this.rspackConfig.watch=!0)}async startServe(){if(!this.isuseServe||this.isStartServe)return;this.isStartServe=!0;let{default:e}=await Promise.resolve().then(()=>(ze(),Ne));await e.setup("serve",o.cliOptions)}async run(){await o.empConfig.lifeCycle.beforeBuild(),this.isWatchMode=!!o.cliOptions.watch,this.isuseServe=!!o.cliOptions.serve,this.rspackConfig=o.rsConfig,this.isWatchMode&&this.watchMode(),(0,ss.rspack)(this.rspackConfig,async(e,t)=>{if(e!==null){p.error(e.stack||e),e.message&&p.error(e.message);return}if(!t){p.red("Stats is Undefined.");return}t.hasErrors()&&(p.error(t.toString({all:!1,colors:!0,errors:!0})),p.red("Failed to compile."),process.exit(1)),t.hasWarnings()&&(p.yellow("Compiled with warnings."),p.warn(t.toString({all:!1,chunks:!1,assets:!1,colors:!0,errors:!0,warnings:!0}))),await Ut(t),this.startServe(),await o.empConfig.lifeCycle.afterBulid()})}},qs=new Ie});var Qs={};$(Qs,{HtmlWebpackPlugin:()=>ps.default,defineConfig:()=>Ks,dts:()=>ns,empHelper:()=>ue,rspack:()=>as.rspack,runScript:()=>Ge,store:()=>o});module.exports=ys(Qs);a();var as=require("@rspack/core"),ps=l(require("html-webpack-plugin"),1);a();var os=l(require("process"),1),k=require("commander");y();function Ge(){k.program.version(o.empPkg.version,"-v, --version").usage("<command> [options]"),k.program.command("dev").description("Dev \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-rd, --doctor","\u5F00\u542Frsdoctor,\u53EF\u901A\u8FC7debug.rsdoctor\u64CD\u4F5C").option("-h, --hot","\u662F\u5426\u4F7F\u7528\u70ED\u66F4\u65B0 \u9ED8\u8BA4\u542F\u52A8").option("-o, --open","\u662F\u5426\u6253\u5F00\u8C03\u8BD5\u9875\u9762 \u9ED8\u8BA4\u4E0D\u6253\u5F00").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-ev, --env-vars <key=value>","\u5B9A\u4E49\u4E00\u4E2A\u73AF\u5883\u53D8\u91CF -ev key=value \u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u91CD\u590D\u8C03\u7528 -ev key=value -ev key=value",(i,e)=>{let[t,s]=i.split("=");return e[t]=s,e},{}).action(async i=>{let{default:e}=await Promise.resolve().then(()=>(qt(),_t));await e.setup("dev",i)}),k.program.command("build").description("Build \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-rd, --doctor","\u5F00\u542Frsdoctor,\u53EF\u901A\u8FC7debug.rsdoctor\u64CD\u4F5C").option("-a, --analyze","\u751F\u6210\u5206\u6790\u62A5\u544A \u9ED8\u8BA4\u4E3A false").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-w, --watch","watch \u6A21\u5F0F").option("-sv, --serve","watch \u6A21\u5F0F\u4E0B\u542F\u52A8serve").option("-ev, --env-vars <key=value>","\u5B9A\u4E49\u4E00\u4E2A\u73AF\u5883\u53D8\u91CF -ev key=value \u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u91CD\u590D\u8C03\u7528 -ev key=value -ev key=value",(i,e)=>{let[t,s]=i.split("=");return e[t]=s,e},{}).action(async i=>{let{default:e}=await Promise.resolve().then(()=>(rs(),is));await e.setup("build",i)}),k.program.command("serve").description("Server \u6A21\u5F0F").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").action(async i=>{let{default:e}=await Promise.resolve().then(()=>(ze(),Ne));await e.setup("serve",i)}),k.program.command("dts").description("\u62C9\u53D6 remote \u9879\u76EE\u7684 d.ts").option("-p, --typingsPath <typingsPath>","\u4E0B\u8F7D\u76EE\u5F55").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").action(i=>{}),k.program.command("init").description("\u521D\u59CB\u5316 emp \u9879\u76EE").option("-d, --data [data]","JSON\u6570\u636E http\u5730\u5740 \u6216\u8005 \u6587\u4EF6\u8DEF\u5F84\u76F8\u5BF9\u3001\u7EDD\u5BF9\u8DEF\u5F84").action(i=>{}),k.program.parse(os.default.argv)}a();var He=l(require("fs/promises"),1),ie=l(require("path"),1);z();y();var Vs=/(?:(?:import|export)\s?(?:type)?\s?(?:(?:\{[^;\n]+\})|(?:[^;\n]+))\s?from\s?['"][^;\n]+['"])|(?:import\(['"][^;\n]+?['"]\))/g,Ws=/(?:import|export)\s?(?:type)?\s?\{?.+\}?\s?from\s?['"](.+)['"]/,Xs=/import\(['"]([^;\n]+?)['"]\)/,Ue=class{list=[];outDir=o.resolve("dist");aliasName="@empjs/cli";async setup(e,t){e&&(this.outDir=e),t&&(this.aliasName=t);let s=await this.readDts();await this.writeCode(s)}async readDts(){this.list=await(0,M.glob)([`${o.empConfig.build.outDir}/**/*.d.ts`],{windowsPathsNoEscape:!0});let e=[];this.list.map(s=>{s=o.resolve(s),e.push(this.readFile(s))});let t=await Promise.all(e);return t=t.map(s=>this.replaceAliasPath(s)),t}async readFile(e){let t=await He.default.readFile(e,{encoding:"utf-8"});return{src:e,code:t}}replaceAliasPath({src:e,code:t}){t=t.replace(Vs,r=>{let n=r.match(Ws);if(n||(n=r.match(Xs)),n&&n[1]){let c=n[1];if(!c.startsWith("."))return r;let d=ie.default.resolve(ie.default.dirname(e),c).replace(this.outDir,this.aliasName);return r.replace(n[1],d)}return r});let s=e.replace(this.outDir,this.aliasName).replace(".d.ts","");return s.endsWith("/index")&&(s=s.replace("/index","")),t=this.warpDeclareModule(s,t),{code:t,src:e,mod:s}}warpDeclareModule(e,t){return`declare module '${e}' {\r
16
16
  ${t}}\r
17
- `}async writeCode(e){let t="";e.map(s=>{t+=s.code}),await Ue.default.writeFile(ie.default.join(this.outDir.replace("dist","types"),"type.d.ts"),t)}},ns=new He;y();z();function Ks(i){return i}0&&(module.exports={HtmlWebpackPlugin,defineConfig,dts,empHelper,rspack,runScript,store});
17
+ `}async writeCode(e){let t="";e.map(s=>{t+=s.code}),await He.default.writeFile(ie.default.join(this.outDir.replace("dist","types"),"type.d.ts"),t)}},ns=new Ue;y();z();function Ks(i){return i}0&&(module.exports={HtmlWebpackPlugin,defineConfig,dts,empHelper,rspack,runScript,store});
18
18
  if (module.exports.default) module.exports = module.exports.default;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { InspectOptions } from 'node:util';
2
+ import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
2
3
  import * as _rspack_core from '@rspack/core';
3
- import { Configuration, Output, RspackOptions, Externals, Resolve, DevServer, SwcJsMinimizerRspackPluginOptions, HtmlRspackPluginOptions, RuleSetRule } from '@rspack/core';
4
+ import { Configuration, Output, RspackOptions, Externals, Resolve, DevServer, SwcJsMinimizerRspackPluginOptions, LightningCssMinimizerRspackPluginOptions, HtmlRspackPluginOptions, RuleSetRule } from '@rspack/core';
4
5
  export { rspack } from '@rspack/core';
5
6
  import { Options } from 'sass-embedded';
6
7
  import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
@@ -290,14 +291,13 @@ declare class GlobalStore {
290
291
  html: {
291
292
  prefix: string;
292
293
  empSharePrefix: string;
293
- importMapPrefix: string; /**
294
- * 项目pkg信息
295
- */
294
+ importMapPrefix: string;
296
295
  hooks: {
297
296
  empShareLib: string;
298
297
  importMap: string;
299
298
  };
300
299
  };
300
+ rsdoctor: string;
301
301
  };
302
302
  minimizer: {
303
303
  minJs: string;
@@ -355,6 +355,7 @@ declare class GlobalStore {
355
355
  h5: string[];
356
356
  node: string[];
357
357
  };
358
+ get uniqueName(): string;
358
359
  }
359
360
  declare const _default$3: GlobalStore;
360
361
 
@@ -365,6 +366,7 @@ type EMP3PluginType = {
365
366
  type EMP3PluginFnType = (o: any) => EMP3PluginType;
366
367
 
367
368
  type LoggerType = 'debug' | 'info' | 'warn' | 'error';
369
+ type RsdoctorRspackPluginOptions = ConstructorParameters<typeof RsdoctorRspackPlugin>[0];
368
370
  type DebugType = {
369
371
  loggerLevel?: LoggerType;
370
372
  clearLog?: boolean;
@@ -372,6 +374,7 @@ type DebugType = {
372
374
  showRsconfig?: boolean | string | InspectOptions;
373
375
  showPerformance?: boolean;
374
376
  rspackCache?: boolean;
377
+ rsdoctor?: boolean | RsdoctorRspackPluginOptions;
375
378
  newTreeshaking?: boolean;
376
379
  /**
377
380
  * 是否显示执行日志
@@ -452,6 +455,7 @@ type BuildType = {
452
455
  * @default {}
453
456
  */
454
457
  minOptions?: SwcJsMinimizerRspackPluginOptions;
458
+ cssminOptions?: LightningCssMinimizerRspackPluginOptions;
455
459
  /**
456
460
  * 生成代码 参考 https://swc.rs/docs/configuring-swc#jsctarget
457
461
  */
@@ -566,7 +570,7 @@ type EMPShareFastModeType = {
566
570
  /**
567
571
  * 默认支持React
568
572
  */
569
- framework?: 'react';
573
+ framework?: 'react' | '';
570
574
  };
571
575
  type EMPShareType = ModuleFederationPluginOptions & {
572
576
  /**
@@ -640,6 +644,7 @@ type EmpOptions = {
640
644
  empShare?: EMPShareType;
641
645
  /**
642
646
  * css 相关设置
647
+ * @argument sass default {mode: 'modern'}
643
648
  */
644
649
  css?: {
645
650
  sass?: CssSassOptionsType;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { InspectOptions } from 'node:util';
2
+ import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
2
3
  import * as _rspack_core from '@rspack/core';
3
- import { Configuration, Output, RspackOptions, Externals, Resolve, DevServer, SwcJsMinimizerRspackPluginOptions, HtmlRspackPluginOptions, RuleSetRule } from '@rspack/core';
4
+ import { Configuration, Output, RspackOptions, Externals, Resolve, DevServer, SwcJsMinimizerRspackPluginOptions, LightningCssMinimizerRspackPluginOptions, HtmlRspackPluginOptions, RuleSetRule } from '@rspack/core';
4
5
  export { rspack } from '@rspack/core';
5
6
  import { Options } from 'sass-embedded';
6
7
  import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
@@ -290,14 +291,13 @@ declare class GlobalStore {
290
291
  html: {
291
292
  prefix: string;
292
293
  empSharePrefix: string;
293
- importMapPrefix: string; /**
294
- * 项目pkg信息
295
- */
294
+ importMapPrefix: string;
296
295
  hooks: {
297
296
  empShareLib: string;
298
297
  importMap: string;
299
298
  };
300
299
  };
300
+ rsdoctor: string;
301
301
  };
302
302
  minimizer: {
303
303
  minJs: string;
@@ -355,6 +355,7 @@ declare class GlobalStore {
355
355
  h5: string[];
356
356
  node: string[];
357
357
  };
358
+ get uniqueName(): string;
358
359
  }
359
360
  declare const _default$3: GlobalStore;
360
361
 
@@ -365,6 +366,7 @@ type EMP3PluginType = {
365
366
  type EMP3PluginFnType = (o: any) => EMP3PluginType;
366
367
 
367
368
  type LoggerType = 'debug' | 'info' | 'warn' | 'error';
369
+ type RsdoctorRspackPluginOptions = ConstructorParameters<typeof RsdoctorRspackPlugin>[0];
368
370
  type DebugType = {
369
371
  loggerLevel?: LoggerType;
370
372
  clearLog?: boolean;
@@ -372,6 +374,7 @@ type DebugType = {
372
374
  showRsconfig?: boolean | string | InspectOptions;
373
375
  showPerformance?: boolean;
374
376
  rspackCache?: boolean;
377
+ rsdoctor?: boolean | RsdoctorRspackPluginOptions;
375
378
  newTreeshaking?: boolean;
376
379
  /**
377
380
  * 是否显示执行日志
@@ -452,6 +455,7 @@ type BuildType = {
452
455
  * @default {}
453
456
  */
454
457
  minOptions?: SwcJsMinimizerRspackPluginOptions;
458
+ cssminOptions?: LightningCssMinimizerRspackPluginOptions;
455
459
  /**
456
460
  * 生成代码 参考 https://swc.rs/docs/configuring-swc#jsctarget
457
461
  */
@@ -566,7 +570,7 @@ type EMPShareFastModeType = {
566
570
  /**
567
571
  * 默认支持React
568
572
  */
569
- framework?: 'react';
573
+ framework?: 'react' | '';
570
574
  };
571
575
  type EMPShareType = ModuleFederationPluginOptions & {
572
576
  /**
@@ -640,6 +644,7 @@ type EmpOptions = {
640
644
  empShare?: EMPShareType;
641
645
  /**
642
646
  * css 相关设置
647
+ * @argument sass default {mode: 'modern'}
643
648
  */
644
649
  css?: {
645
650
  sass?: CssSassOptionsType;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
2
- var Mt=Object.defineProperty;var w=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var h=(i,e)=>()=>(i&&(e=i(i=0)),e);var R=(i,e)=>{for(var t in e)Mt(i,t,{get:e[t],enumerable:!0})};import{fileURLToPath as jt}from"url";import Lt from"path";var ze,Dt,m,c,a=h(()=>{"use strict";ze=()=>jt(import.meta.url),Dt=()=>Lt.dirname(ze()),m=Dt(),c=ze()});import b from"chalk";var Tt,E,Ft,At,Rt,re,B,Nt,zt,M,oe,Gt,ne,j,f,L=h(()=>{"use strict";a();Tt=b.hex("#1abc9c"),E=b.hex("#16a085"),Ft=b.hex("#2ecc71"),At=b.hex("#27ae60"),Rt=b.hex("#e74c3c"),re=b.hex("#c0392b"),B=b.hex("#f1c40f"),Nt=b.hex("#f39c12"),zt=b.hex("#3498db"),M=b.hex("#2980b9"),oe=b.hex("#ecf0f1"),Gt=b.hex("#fd79a8"),ne=b.hex("#e84393"),j=b.hex("#7f8c8d"),f={lightGreen:Tt,green:E,lightCyan:Ft,cyan:At,lightRed:Rt,red:re,yellow:B,orange:Nt,lightBlue:zt,blue:M,white:oe,lightMagenta:Gt,magenta:ne,gray:j}});var ae,p,O=h(()=>{"use strict";a();L();ae=class{brandName="";fullName="";logLevel="debug";isLogTime=!1;setup({brandName:e,logLevel:t,fullName:s}){this.brandName=` [${e}] `,this.fullName=` ${s} `,this.fullName=f.green.bold(this.fullName),t&&(this.logLevel=t)}time=(...e)=>this.isLogTime&&console.time(...e);timeEnd=(...e)=>this.isLogTime&&console.timeEnd(...e);debug=(...e)=>["debug"].includes(this.logLevel)&&console.log(...e);info=(...e)=>["debug","info"].includes(this.logLevel)&&console.log(...e);warn=(...e)=>["debug","info","warn"].includes(this.logLevel)&&console.warn(...e);error=(...e)=>["debug","info","warn","error"].includes(this.logLevel)&&console.error(...e);blue=e=>{console.log(`${f.lightBlue(this.brandName)}${f.blue(` ${e} `)}
2
+ var Mt=Object.defineProperty;var C=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var h=(i,e)=>()=>(i&&(e=i(i=0)),e);var F=(i,e)=>{for(var t in e)Mt(i,t,{get:e[t],enumerable:!0})};import{fileURLToPath as jt}from"url";import Lt from"path";var ze,Dt,m,c,a=h(()=>{"use strict";ze=()=>jt(import.meta.url),Dt=()=>Lt.dirname(ze()),m=Dt(),c=ze()});import b from"chalk";var Tt,E,Rt,At,Ft,re,B,Nt,zt,M,oe,Gt,ne,j,f,L=h(()=>{"use strict";a();Tt=b.hex("#1abc9c"),E=b.hex("#16a085"),Rt=b.hex("#2ecc71"),At=b.hex("#27ae60"),Ft=b.hex("#e74c3c"),re=b.hex("#c0392b"),B=b.hex("#f1c40f"),Nt=b.hex("#f39c12"),zt=b.hex("#3498db"),M=b.hex("#2980b9"),oe=b.hex("#ecf0f1"),Gt=b.hex("#fd79a8"),ne=b.hex("#e84393"),j=b.hex("#7f8c8d"),f={lightGreen:Tt,green:E,lightCyan:Rt,cyan:At,lightRed:Ft,red:re,yellow:B,orange:Nt,lightBlue:zt,blue:M,white:oe,lightMagenta:Gt,magenta:ne,gray:j}});var ae,p,O=h(()=>{"use strict";a();L();ae=class{brandName="";fullName="";logLevel="debug";isLogTime=!1;setup({brandName:e,logLevel:t,fullName:s}){this.brandName=` [${e}] `,this.fullName=` ${s} `,this.fullName=f.green.bold(this.fullName),t&&(this.logLevel=t)}time=(...e)=>this.isLogTime&&console.time(...e);timeEnd=(...e)=>this.isLogTime&&console.timeEnd(...e);debug=(...e)=>["debug"].includes(this.logLevel)&&console.log(...e);info=(...e)=>["debug","info"].includes(this.logLevel)&&console.log(...e);warn=(...e)=>["debug","info","warn"].includes(this.logLevel)&&console.warn(...e);error=(...e)=>["debug","info","warn","error"].includes(this.logLevel)&&console.error(...e);blue=e=>{console.log(`${f.lightBlue(this.brandName)}${f.blue(` ${e} `)}
3
3
  `)};cyan=e=>{console.log(`${f.lightCyan(this.brandName)}${f.cyan(` ${e} `)}
4
4
  `)};magenta=e=>{console.log(`${f.lightMagenta(this.brandName)}${f.magenta(` ${e} `)}
5
5
  `)};green=e=>{console.log(`${f.lightGreen(this.brandName)}${f.green(` ${e} `)}
@@ -7,12 +7,12 @@ var Mt=Object.defineProperty;var w=(i=>typeof require<"u"?require:typeof Proxy<"
7
7
  `)};red=e=>{console.log(`${f.lightRed(this.brandName)}${f.red(` ${e} `)}
8
8
  `)};sysError=e=>{console.log(`${f.lightRed(" System Error Tips ")}${f.red(` ${e} `)}
9
9
  `)};link=e=>f.blue(e);title=e=>{console.log(`${this.fullName}${f.yellow.underline(`${e}`)}
10
- `)}},p=new ae});var he={};R(he,{clearConsole:()=>le,deepAssign:()=>g,ensureArray:()=>Jt,getLanIp:()=>N,getPkgVersion:()=>pe,importJsVm:()=>me,jsonFilter:()=>_t,timeFormat:()=>U,vCompare:()=>ce});import{ip as It}from"address";import Ht from"chalk";import{gateway4sync as Bt}from"default-gateway";import Ut from"fs-extra";function le(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function g(i,...e){for(let t of e)for(let s in t){let r=t[s],n=i[s];if(Object(r)==r&&Object(n)===n){i[s]=g(n,r);continue}i[s]=t[s]}return i}var N,pe,Jt,_t,ce,U,me,C=h(()=>{"use strict";a();N=()=>{let{int:i}=Bt();return It(i||"")||"127.0.0.1"},pe=i=>{try{let{version:e}=Ut.readJSONSync(i);return e}catch{return}};Jt=i=>Array.isArray(i)?i:[i],_t=(i={},e=[])=>Object.keys(i).filter(t=>!e.includes(t)).reduce((t,s)=>(t[s]=i[s],t),{}),ce=(i="",e="")=>{let t=i.replace("^","").split("."),s=e.replace("^","").split("."),r=Math.max(t.length,s.length),n=0;for(let l=0;l<r;l++){let d=t.length>l?t[l]:0,v=isNaN(Number(d))?d.charCodeAt():Number(d),F=s.length>l?s[l]:0,u=isNaN(Number(F))?F.charCodeAt():Number(F);if(v<u){n=-1;break}else if(v>u){n=1;break}}return n},U=i=>{i=i/1e3;let e=s=>Ht.bold(s);if(i<1)return`${i*1e3} ms`;if(i<10){let s=i>=.01?2:3;return`${e(i.toFixed(s))} s`}if(i<60)return`${e(i.toFixed(1))} s`;let t=i/60;return`${e(t.toFixed(2))} m`},me=i=>`data:text/javascript,${i}`});var Ge={};R(Ge,{chalk:()=>Vt,color:()=>f,glob:()=>D,logger:()=>p,utils:()=>he});import Vt from"chalk";import{glob as D}from"glob";var z=h(()=>{"use strict";a();L();C();O()});import Wt from"fs";import qt from"path";import Xt from"jiti";var Kt,Ie,He,Qt,Be=h(()=>{"use strict";a();y();O();Kt=["emp-config.ts","emp-config.js","emp.config.ts","emp.config.js","emp-config.mjs","emp-config.cjs","emp-config.mts","emp-config.cts","emp.config.mjs","emp.config.cjs","emp.config.mts","emp.config.cts"],Ie=Xt(c,{esmResolve:!0,requireCache:!1,interopDefault:!0}),He=async()=>Qt(),Qt=()=>{p.time("[store]GetEmpConfigPath");let i;for(let e of Kt){let t=qt.resolve(o.root,e);if(Wt.existsSync(t)){i=t;break}}return p.timeEnd("[store]GetEmpConfigPath"),i}});import Zt from"net";import Yt from"os";async function J(i,e="localhost"){if(i!==es&&(i<Ue||i>fe))throw new Error(`Port number must lie between ${Ue} and ${fe}`);let t=i,s=ts(),r;e&&!s.has(e)?r=new Set([e]):r=s;let n=new Set(["EADDRINUSE","EACCES"]);for(;t<=fe;)try{return await is(t,r)}catch(l){if(!n.has(l.code))throw l;t+=1}throw new Error("No available ports found")}var Ue,fe,es,ts,ss,is,ue=h(()=>{"use strict";a();Ue=1024,fe=65535,es=443,ts=()=>{let i=Yt.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(i))if(t)for(let s of t)e.add(s.address);return e},ss=(i,e)=>new Promise((t,s)=>{let r=Zt.createServer();r.unref(),r.on("error",s),r.listen(i,e,()=>{let{port:n}=r.address();r.close(()=>{t(n)})})}),is=async(i,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let s of e)try{await ss(i,s)}catch(r){if(!t.has(r.code))throw r}return i}});import Je from"url";import rs from"chalk";var ge,T,de=h(()=>{"use strict";a();L();C();ge=class{imf={protocol:"",port:8e3,pathname:"/"};host="0.0.0.0";urls={lanUrlForConfig:"",lanUrlForTerminal:j("unavailable"),localUrlForTerminal:"",localUrlForBrowser:""};setup(e){e.host&&(this.host=e.host),e.protocol&&(this.imf.protocol=e.protocol),e.pathname&&(this.imf.pathname=e.pathname),e.port&&(this.imf.port=e.port),this.setupUrls()}setupUrls(){let{host:e}=this,t=e==="0.0.0.0"||e==="::",s;if(t){s="localhost";try{this.urls.lanUrlForConfig=this.getLanIp(),this.urls.lanUrlForConfig&&(/^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(this.urls.lanUrlForConfig)?this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig):this.urls.lanUrlForConfig="")}catch{}}else s=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(s),this.urls.localUrlForBrowser=this.formatUrl(s)}getLanIp=N;formatUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return Je.format({protocol:t,hostname:e,port:s,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return Je.format({protocol:t,hostname:e,port:rs.bold(s),pathname:r})}},T=new ge});import{exec as os}from"child_process";import{promisify as ns}from"util";var Ve,_e,as,ps,We,qe=h(()=>{"use strict";a();y();O();Ve=ns(os),_e=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],as=async()=>{let i=process.env.BROWSER;if(!i||!_e.includes(i)){let{stdout:e}=await Ve("ps cax");i=_e.find(t=>e.includes(t))}return i},ps=async i=>{if(process.platform==="darwin")try{let t=await as();if(t){let s=`osascript openChrome.applescript "${encodeURI(i)}" "${t}"`;return await Ve(s,{cwd:o.resource.dir}),!0}}catch(t){p.debug(t)}try{let{default:t}=await import("open");return await t(i),!0}catch(t){return p.error("Failed to open start URL."),p.error(t),!1}},We=ps});var ye,_,be=h(()=>{"use strict";a();ue();de();C();y();ye=class{isADB=!1;isHttps=!1;get isHttpBase(){let e=o.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}async setup(){if(this.isADB=!!o.empOptions.autoDevBase&&o.mode==="development"&&!this.isHttpBase,!this.isADB)return;let{server:e,https:t}=o.empOptions.server||{};this.isHttps=e==="https"||typeof e=="object"&&e.type==="https"||t===!0;let s=T.getLanIp(),r=this.isHttps?"https":"http",n=o.empOptions.server?.port||8e3;n=await J(n,s),o.empOptions.base=`${r}://${s}:${n}/`,o.empOptions.server=g({port:n,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${s}:${n}/ws`}},o.empOptions.server)}},_=new ye});import Xe from"fs/promises";var P,G=h(()=>{"use strict";a();L();ue();de();O();qe();C();y();be();P=class{sf={protocol:"http",host:"0.0.0.0",port:8e3,publicPath:"",publicHasHttp:!1,isOpenBrower:!1,url:"",urls:{localUrlForBrowser:"",localUrlForTerminal:"",lanUrlForTerminal:"",lanUrlForConfig:""}};static httpsType="default";async adaptServer(){this.sf.publicPath=o.rsConfig.output?.publicPath==="auto"?"/":o.rsConfig.output?.publicPath||"/",this.sf.isOpenBrower=!!o.empConfig.server.open,this.sf.protocol=this.isHttps?"https":"http",this.sf.host=o.empConfig.server.host?o.empConfig.server.host:this.sf.host,this.sf.port=o.empConfig.server.port,await this.serverPort(),T.setup(this.sf),this.sf.publicPath&&(this.sf.publicPath.indexOf("http://")>-1||this.sf.publicPath.indexOf("https://")>-1)?(this.sf.url=this.sf.publicPath,this.sf.publicHasHttp=!0,this.sf.urls.localUrlForTerminal=T.prettyPrintUrl("localhost")):(this.sf.urls=T.urls,this.sf.url=this.sf.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this.sf;this.sf.publicHasHttp?(p.info(`${E("\u279C")} Local: ${p.link(e.localUrlForTerminal)}`),p.info(`${E("\u279C")} Network: ${p.link(this.sf.publicPath)}`)):(p.info(`${E("\u279C")} Local: ${p.link(e.localUrlForTerminal)}`),p.info(`${E("\u279C")} Network: ${p.link(e.lanUrlForTerminal)}
11
- `)),this.sf.isOpenBrower&&We(this.sf.url)}async setup(e,t){p.time(`[${e}]Setup`),await o.setup(e,t),o.debug.clearLog&&le(),p.title(`${e}`),await this.adaptServer(),p.time(`[${e}]Run`),await this.run(),p.timeEnd(`[${e}]Run`),this.afterRun(),p.timeEnd(`[${e}]Setup`)}async run(){}afterRun(){process.on("SIGINT",function(){process.exit()})}get isHttps(){let{server:e,https:t,http2:s}=o.empConfig.server||{};return e==="https"||typeof e=="object"&&e.type==="https"||t===!0||s===!0}getcert(){return Promise.all([Xe.readFile(o.resource.key),Xe.readFile(o.resource.cert)])}async serverPort(){if(_.isADB)return;let{port:e,host:t}=this.sf,s=await J(e,t);s!==e&&(this.sf.port=s,o.rsConfig.devServer?.port&&(o.rsConfig.devServer.port=s))}}});var V,Ke=h(()=>{"use strict";a();y();V=class{externals={};externalAssets={js:[],css:[]};exp=/^([0-9a-zA-Z_\s]+)@(.*)/;config;importMap={imports:{}};isEmpshare=!1;async setup(){this.config=o.empConfig.empShare,o.empConfig.empShare.name&&(this.isEmpshare=!0,o.empConfig.output.uniqueName=o.empConfig.empShare.name),o.empConfig.empShare.fastMode&&o.empConfig.empShareFastMode.setup(),this.config.shareLib&&this.setShareLib(),this.prepareEsm()}get useImportMap(){return this.config.useImportMap&&o.empConfig.isESM}get pluginConfig(){let e={...this.config};return delete e.shareLib,delete e.useImportMap,delete e.fastMode,{manifest:!1,dts:!1,...e}}prepareEsm(){if(o.empConfig.isESM){this.config.library={type:"module"};let e=this.config.remotes||{};for(let[t,s]of Object.entries(e))if(typeof s=="string"){let r=s.match(this.exp)||[];r.length>0&&(e[t]=r[2])}this.config.remotes=e}}async setShareLib(){let e=this.config,t=[];if(typeof e.shareLib=="object")for(let[s,r]of Object.entries(e.shareLib)){let n={};if(n.module=s,typeof r=="string"){let l=r.match(this.exp)||[];l.length>0?(n.global=l[1],n.entry=l[2],n.type="js",t.push(n),n={}):(n.global="",n.entry=r,n.type="js",t.push(n),n={})}else Array.isArray(r)?r.map(l=>{if(!l)return;if(l.split("?")[0].endsWith(".css"))n.entry=l,n.type="css";else{let v=l.match(this.exp)||[];v.length>0?(n.global=v[1],n.entry=v[2],n.type="js"):(n.global="",n.entry=l,n.type="js")}t.push(n),n={}}):typeof r=="object"&&r.entry&&(n.entry=r.entry,n.global=r.global,n.type=r.type,t.push(n),n={})}await Promise.all([this.setExternalAssets(t)])}async setExternalAssets(e=[]){if(e.length>0){let t=[];t=t.concat(e),t.map(s=>{s.type=s.type||"js",s.type==="js"&&s.module?(s.global?this.externals[s.module]=s.global:o.empConfig.isESM&&(this.useImportMap?(this.externals[s.module]=s.module,this.importMap.imports[s.module]=s.entry):this.externals[s.module]=s.entry),s.entry&&!o.empConfig.isESM&&this.externalAssets.js.push(s.entry)):s.type==="css"&&s.entry&&this.externalAssets.css.push(s.entry)})}}}});var W,Qe=h(()=>{"use strict";a();y();W=class{fastMode={runtimeHost:"",runtimeLib:"",externals:{},globalVal:"EmpShareLib",framework:"react"};externalMF={"@module-federation/runtime":"MFRuntime","@module-federation/sdk":"MFSDK"};externalReact={react:"React","react-dom":"ReactDOM","react-router-dom":"ReactRouterDOM"};externals={};getRuntimeLib(e){return`${e}/runtime${o.mode==="development"?".development":""}.umd.js`}setup(){this.fastMode=o.deepAssign(this.fastMode,o.empConfig.empShare.fastMode),this.injectLib(),this.setExternals()}injectLib(){let{runtimeHost:e,runtimeLib:t}=this.fastMode;if(e||t){let s=t||this.getRuntimeLib(e);o.empConfig.empShareLib.externalAssets.js.push(s)}}setExternals(){for(let[e,t]of Object.entries(this.externalMF))this.externals[e]=`${this.fastMode.globalVal}.${t}`;if(this.fastMode.framework==="react")for(let[e,t]of Object.entries(this.externalReact))this.externals[e]=`${this.fastMode.globalVal}.${t}`;Object.entries(this.fastMode.externals).length>0&&(this.externals=o.deepAssign(this.externals,this.fastMode.externals)),o.empConfig.empShareLib.externals=o.deepAssign(o.empConfig.empShareLib.externals,this.externals)}}});var I,ve=h(()=>{"use strict";a();I={rule:{mjs:"mjs",typescript:"typescript",javascript:"javascript",sourceMap:"sourceMapLoader",inline:"inline",svg:"svg",image:"image",font:"fonts",svga:"svga",sass:"sass",less:"less",css:"css"},use:{swc:"swc",sourceMap:"sourceMapLoader",sass:"sassLoader",less:"lessLoader"},plugin:{bundleAnalyzer:"bundleAnalyzerPlugin",define:"definePlugin",copy:"copyRspackPlugin",progress:"progressPlugin",empShare:"empShare",html:{prefix:"html-plugin-",empSharePrefix:"html-plugin-empShare-",importMapPrefix:"html-plugin-import-map-",hooks:{empShareLib:"HtmlEmpShareLibPluginName",importMap:"HtmlImportMapPlugin"}}},minimizer:{minJs:"minJs",minCss:"minCss"}}});import et from"html-webpack-plugin";var Ze,q,Ye,X,ls,K,Ce=h(()=>{"use strict";a();C();y();ve();Ze=I.plugin.html.hooks.importMap,q=class{importMap;chunk;constructor(e,t){this.importMap=e,this.chunk=t}apply(e){e.hooks.compilation.tap(Ze,t=>{et.getHooks(t).alterAssetTagGroups.tapAsync(Ze,(s,r)=>{if(!s.plugin.userOptions.chunks?.includes(this.chunk))return r(null,s);s.headTags.push({tagName:"script",attributes:{type:"importmap"},innerHTML:`${JSON.stringify(this.importMap,null,2)}`,voidTag:!1,meta:{plugin:void 0}}),r(null,s)})})}},Ye=I.plugin.html.hooks.empShareLib,X=class{chunk;files;constructor(e,t){this.files=g({js:[],css:[]},e),this.chunk=t}apply(e){e.hooks.compilation.tap(Ye,t=>{let s=this.files;et.getHooks(t).alterAssetTagGroups.tapAsync(Ye,(r,n)=>{if(!r.plugin.userOptions.chunks?.includes(this.chunk))return n(null,r);s.js.map(l=>{r.headTags.push({tagName:"script",attributes:{src:l},voidTag:!1,meta:{plugin:void 0}})}),s.css.map(l=>{r.headTags.push({tagName:"link",attributes:{rel:"stylesheet",href:l},voidTag:!1,meta:{plugin:void 0}})}),n(null,r)})})}},ls=()=>{let i=[`import 'core-js/${o.empConfig.build.coreJsFeatures}'`].join(`
12
- `);return me(i)},K=class{constructor(){}apply(e){let{webpack:t}=e;new t.EntryPlugin(e.context,ls(),{name:void 0}).apply(e)}}});var Q,tt=h(()=>{"use strict";a();y();be();Ce();Q=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){await _.setup(),this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){o.empConfig.build.polyfill==="entry"&&o.chain.plugin("empPolyfill").use(K),this.op.beforePlugin&&await this.op.beforePlugin()}async afterPlugin(){this.op.afterPlugin&&await this.op.afterPlugin()}async beforeModule(){this.op.beforeModule&&await this.op.beforeModule()}async afterModule(){this.op.afterModule&&await this.op.afterModule()}async beforeEmpPlugin(){this.op.beforeEmpPlugin&&await this.op.beforeEmpPlugin()}async afterEmpPlugin(){this.op.afterEmpPlugin&&await this.op.afterEmpPlugin()}async beforeBuild(){this.op.beforeBuild&&await this.op.beforeBuild()}async afterBulid(){this.op.afterBulid&&await this.op.afterBulid()}async beforeDevServe(){this.op.beforeDevServe&&await this.op.beforeDevServe()}async afterDevServe(){this.op.afterDevServe&&await this.op.afterDevServe()}async beforeServe(){this.op.beforeServe&&await this.op.beforeServe()}async afterServe(){this.op.afterServe&&await this.op.afterServe()}}});import cs from"fs";var we,st,it=h(()=>{"use strict";a();z();Be();C();G();Ke();Qe();tt();we=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},g(e,t)}empShareFastMode=new W;empShareLib=new V;isESM=!1;async autoDevSet(){this.store.mode==="development"&&this.store.empOptions.autoDevBase}checkIsESM(e){return["es3","es5"].indexOf(e)===-1}lifeCycle;async setup(e){this.store=e,await this.syncEmpOptions(),this.lifeCycle=new Q(this.store.empOptions.lifeCycle),await this.lifeCycle.afterGetEmpOptions(),this.isESM=this.checkIsESM(this.build.target),this.store.empOptions.target?(this.target=this.store.empOptions.target,Array.isArray(this.target)&&!this.target.includes(this.build.target)&&this.target.push(this.build.target)):this.target=["web",this.build.target];let{appSrc:t,base:s,appEntry:r}=this.store.empOptions;t&&(this.appSrc=t),s&&(this.base=s),r&&(this.appEntry=r),this.store.empConfig.empShare&&await this.empShareLib.setup()}async chain(){this.store.empOptions.chain&&await this.store.empOptions.chain(this.store.chain)}async plugins(){let e=[];this.store.empOptions.plugins&&Array.isArray(this.store.empOptions.plugins)&&this.store.empOptions.plugins.length>0&&(this.store.empOptions.plugins.map(t=>{e.push(t.rsConfig(this.store))}),await Promise.all(e))}get debug(){return this.assign({loggerLevel:"info",clearLog:!0,progress:!0,showRsconfig:!1,showPerformance:!1,rspackCache:!0,infrastructureLogging:{appendOnly:!0,level:"warn"},newTreeshaking:this.store.empConfig.isESM},this.store.empOptions.debug)}get build(){let e=this.store.empOptions.build?.staticDir?`${this.store.empOptions.build?.staticDir}/`:"";return this.assign({outDir:"dist",staticDir:e,assetsDir:"assets",publicDir:"public",chunkIds:this.store.isDev?"named":"deterministic",moduleIds:this.store.isDev?"named":"deterministic",sourcemap:this.store.isDev,minify:!this.store.isDev,minOptions:{},target:"es5",polyfill:!1,polyfillInclude:[],coreJsFeatures:"stable",externalHelpers:!1,browserslist:this.store.browserslistOptions.default,swcConfig:{},devtool:"source-map"},{...this.store.empOptions.build,staticDir:e})}get html(){let e=this.store.empOptions.html?.template?{}:{charset:{charset:"utf-8"},"http-equiv":{"http-equiv":"X-UA-Compatible",content:"IE=edge"},viewport:{name:"viewport",content:"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"},keywords:{keywords:""},description:{description:""}};return this.assign({lang:"zh-CN",title:"EMP",inject:"body",minify:!this.store.isDev,scriptLoading:this.isESM?"module":"defer",meta:e,files:{css:[],js:[]},tags:{headTags:[],bodyTags:[]}},this.store.empOptions.html)}get entries(){return this.store.empOptions.entries?this.store.empOptions.entries:{}}get server(){let e={host:"0.0.0.0",port:8e3,open:process.platform==="darwin",hot:!0,watchFiles:["src/**/*.html"],static:[{directory:this.store.publicDir,watch:this.store.isDev}],allowedHosts:["all"],historyApiFallback:!0,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":"X-Requested-With, content-type, Authorization"}};return this.store.empOptions.server?.http2&&(P.httpsType="h2",delete this.store.empOptions.server.http2),this.assign(e,this.store.empOptions.server)}get empShare(){return this.assign({name:"",filename:"emp.js",shared:{}},this.store.empOptions.empShare)}get css(){return this.assign({sass:{mode:"modern"}},this.store.empOptions.css)}get output(){let e=(this.store.isDev,".[contenthash:8]"),t=this.store.isDev?"":".[contenthash:8]",{assetsDir:s,staticDir:r}=this.store.empConfig.build,n={publicPath:this.store.empConfig.base?this.store.empConfig.base:"auto",crossOriginLoading:"anonymous",filename:`${r}js/[name]${e}.js`,cssFilename:`${r}css/[name]${t}.css`,cssChunkFilename:`${r}css/[name]${t}.css`,assetModuleFilename:`${r}${s}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!0};return this.assign(n,this.store.empOptions.output)}get define(){let e={mode:this.store.mode,env:this.store.cliOptions.env};return this.store.empOptions.define&&(e={...e,...this.store.empOptions.define}),this.setDefine(e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",s={};return Object.keys(e).map(r=>{(t==="all"||t==="esm")&&(s[`import.meta.env.${r}`]=JSON.stringify(e[r])),(t==="all"||t==="cjs")&&(s[`process.env.${r}`]=JSON.stringify(e[r])),s[`${r}`]=JSON.stringify(e[r])}),s}get externals(){return this.assign(this.empShareLib.externals,this.store.empOptions.externals)}get resolve(){return g({alias:{src:this.store.resolve("src"),"@":this.store.resolve("src")},extensions:["...",".js",".jsx",".mjs",".ts",".tsx",".css",".less",".scss",".sass",".json",".wasm",".vue",".svg",".svga"]},this.store.empOptions.resolve)}async syncEmpOptions(){p.time("[store][empConfig]SyncEmpOptions");let e=await He();if(!e||!cs.existsSync(e))return;let t=await Ie(e);typeof t=="function"?this.store.empOptions=await t(this.store):this.store.empOptions=t||{},p.timeEnd("[store][empConfig]SyncEmpOptions")}get moduleTransformRule(){let{moduleTransform:e}=this.store.empOptions,t=this.assign({defaultExclude:!1},e),s={and:[],not:[]};return t.defaultExclude===!0&&s.and.push(/(node_modules|bower_components)/),t?.exclude&&(s.and=s.and.concat(t.exclude)),e?.include&&(s.not=t.include),s}get cacheDir(){return this.store.empOptions.cacheDir?this.store.empOptions.cacheDir:"node_modules/.emp-cache"}get ignoreWarnings(){return this.store.empOptions.ignoreWarnings?this.store.empOptions.ignoreWarnings:[/Conflicting order/]}get autoPages(){let e;return this.store.empOptions.autoPages&&(e=typeof this.store.empOptions.autoPages=="boolean"?{}:this.store.empOptions.autoPages,e=this.assign({path:"pages"},e)),e}},st=new we});import ms from"fs-extra";var xe,rt,ot=h(()=>{"use strict";a();xe=class{store;async setup(e){this.store=e;let t=[this.common(),this.stats(),this.devServer(),this.optimization(),this.checkTsconfig()];await Promise.all(t)}async common(){this.store.merge({node:{global:!0},experiments:{outputModule:this.store.empConfig.isESM,topLevelAwait:!0,css:!0},target:this.store.empConfig.target,infrastructureLogging:this.store.empConfig.debug.infrastructureLogging,context:this.store.root,mode:this.store.mode,cache:this.store.empConfig.debug.rspackCache,devtool:this.store.empConfig.build.sourcemap?this.store.empConfig.build.devtool:!1,output:this.store.empConfig.output,resolve:this.store.empConfig.resolve,externals:this.store.empConfig.externals,ignoreWarnings:this.store.empConfig.ignoreWarnings,watchOptions:{ignored:["**/node_modules/**","**/@mf-types/**"]}})}async checkTsconfig(){let e=this.store.resolve("tsconfig.json");if(await ms.exists(e)){let s={tsConfig:e};this.store.merge({resolve:s})}}async stats(){this.store.merge({stats:{colors:!0,all:!1,assets:!1,chunks:!1,timings:!0,version:!0}})}async devServer(){this.store.merge({devServer:this.store.empConfig.server})}async optimization(){let e={moduleIds:this.store.empConfig.build.moduleIds,chunkIds:this.store.empConfig.build.chunkIds,minimize:this.store.empConfig.build.minify,splitChunks:{chunks:"async",cacheGroups:{}}};this.store.empConfig.build.polyfill&&(e.splitChunks.cacheGroups={}),this.store.chain.merge({optimization:e})}},rt=new xe});var Se,nt,at=h(()=>{"use strict";a();Se=class{store;async setup(e){this.store=e;let t=[this.sass(),this.less(),this.css()];await Promise.all(t)}async sass(){let{rule:e,use:t}=this.store.chainName,s={},{sass:r}=this.store.empConfig.css||{sass:{}};r.mode==="modern"&&(s.implementation=r.implementation?r.implementation:w.resolve("sass-embedded"),s.api=r.api?r.api:"legacy",s.sourceMap=this.store.empConfig.build.sourcemap,r.sassOptions&&(s.sassOptions=r.sassOptions)),this.store.chain.merge({module:{rule:{[e.sass]:{test:/\.(sass|scss)$/,use:{[t.sass]:{loader:w.resolve("sass-loader"),options:s}},type:"css/auto"}}}})}async less(){let{rule:e,use:t}=this.store.chainName,s={loader:w.resolve("less-loader"),options:{lessOptions:{javascriptEnabled:!0}}};this.store.chain.merge({module:{rule:{[e.less]:{test:/\.less$/,use:{[t.less]:s},type:"css/auto"}}}})}async css(){let{rule:e}=this.store.chainName;this.store.chain.merge({module:{rule:{[e.css]:{test:/\.css$/,use:{},type:"css/auto"}}}})}},nt=new Se});import x from"path";import hs from"html-webpack-plugin";var Ee,pt,lt=h(()=>{"use strict";a();z();C();Ce();Ee=class{store;entriesConfig={};async setup(e){this.store=e,await this.init(),this.toConfig()}setHtmlConfig(e,t){return e.template=this.setTemplate(e.template),e.favicon=this.setFavicion(e.favicon),e.chunks=t,e.filename=`${t[0]}.html`,this.store.empConfig.base&&(e.publicPath=this.store.empConfig.base),e.tags=e.tags||{},e}setChunk(e){return e.replace(x.extname(e),"").replace(`${this.store.empConfig.appSrc}${x.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(x.join("template","index.html"))}setFavicion(e){return e?this.store.resolve(e):this.store.empResolve(x.join("template","favicon.ico"))}setEntryItem(e,t,s){s=s||this.store.resolve(x.join(this.store.empConfig.appSrc,e));let r=this.setChunk(e),n=[s];this.entriesConfig[r]={entry:{[r]:n},html:this.setHtmlConfig(t,[r])},this.store.entries[r]=n}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`${this.store.chainName.plugin.html.prefix}${t}`).use(hs,[e]),this.store.empConfig.empShareLib&&(e.files=g(e.files,this.store.empConfig.empShareLib.externalAssets)),this.store.chain.plugin(`${this.store.chainName.plugin.html.empSharePrefix}${t}`).use(X,[e.files,t]),this.store.empConfig.empShareLib.useImportMap&&this.store.chain.plugin(`${this.store.chainName.plugin.html.importMapPrefix}${t}`).use(q,[this.store.empConfig.empShareLib.importMap,t])}setRspackEntry(e){this.store.merge({entry:e})}async init(){this.store.empConfig.autoPages?await this.setAutoPage():(await this.setDefaultEntry(),this.setEntryByConfig())}async setAutoPage(){p.time("setAutoPage");let e=this.store.empConfig.autoPages?.path||"pages",t=x.join(this.store.appSrc,e),s=x.join(t,"**","*.{ts,tsx,jsx,js}"),r=await D([s],{windowsPathsNoEscape:!0});r=r.map(n=>n.replace(`${t}${x.sep}`,"")),r.map(n=>{let l=this.store.empConfig.entries[n]||{};this.setEntryItem(n,{...this.store.empConfig.html,...l},x.join(t,n))}),p.timeEnd("setAutoPage")}async setDefaultEntry(){p.time("[store][empConfig]SetDefaultEntry");let e=x.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}"),t=await D([e],{windowsPathsNoEscape:!0});if(t[0]){let s=x.join(this.store.empConfig.appSrc,Object.keys(this.store.empConfig.entries).length>0&&this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index");this.setEntryItem(s,this.store.empConfig.html,t[0])}p.timeEnd("[store][empConfig]SetDefaultEntry")}setEntryByConfig(){if(Object.keys(this.store.empConfig.entries).length>0)for(let[e,t]of Object.entries(this.store.empConfig.entries))this.setEntryItem(e,{...this.store.empConfig.html,...t})}toConfig(){for(let[e,t]of Object.entries(this.entriesConfig))this.setRspackHtmlPlugin(t.html,e),this.setRspackEntry(t.entry)}},pt=new Ee});import ct from"path";var Oe,mt,ht=h(()=>{"use strict";a();C();Oe=class{store;swcJsOptions={};swcTsOptions={};coreJs={version:"3",alias:"",path:""};async setup(e){this.store=e,this.swcInitOptions(),await this.run()}async run(){let e=[this.jsDataUrl(),this.files(),this.scripts(),this.rspackGenerator(),this.rspackParser()];await this.store.empConfig.lifeCycle.beforeModule(),await Promise.all(e),await this.store.empConfig.lifeCycle.afterModule()}rspackGenerator(){let e=this.store.isDev?"[path][name]-[local]-[hash:5]":"[local]-[hash:5]";this.store.chain.merge({module:{generator:{css:{localIdentName:e},"css/auto":{localIdentName:e},"css/module":{localIdentName:e}}}})}rspackParser(){this.store.chain.merge({module:{parser:{css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return this.store.empConfig.build.polyfill}swcParser(e){switch(e){case"js":return{syntax:"ecmascript",jsx:!0,decorators:!0,decoratorsBeforeExport:!1};case"ts":return{syntax:"typescript",decorators:!0,tsx:!0,dynamicImport:!0}}}swcJsc(e){let{target:t,externalHelpers:s}=this.store.empConfig.build;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:s,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:g(this.swcJsc(e),{...this.store.empConfig.build.swcConfig}),isModule:"unknown"};return this.isPolyfill&&(delete t.jsc.target,t.env={coreJs:this.swcCoreVersion,targets:this.store.empConfig.build.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill),this.store.empConfig.build.polyfill==="usage"&&(t.env.shippedProposals=!0,t.env.include=this.store.empConfig.build.polyfillInclude)),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build;e&&this.store.chain.resolve.alias.set("@swc/helpers",ct.dirname(w.resolve("@swc/helpers/package.json"))),this.coreJs.path=w.resolve("core-js/package.json");let t=pe(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=ct.dirname(this.coreJs.path),this.store.empConfig.build.polyfill&&(this.store.chain.resolve.alias.set("core-js",this.coreJs.alias),this.store.chain.module.rule("javascript").exclude.add(/core-js/),this.store.chain.module.rule("typescript").exclude.add(/core-js/)),this.swcTsOptions=this.swcOptions("ts"),this.swcJsOptions=this.swcOptions("js")}jsDataUrl(){this.store.chain.module.rule("jsDataUrl").merge({mimetype:{or:["text/javascript","application/javascript"]}}).resolve.set("fullySpecified",!1).end().use("swcJsParser").loader("builtin:swc-loader").options(this.swcJsOptions)}async scripts(){let e=[],{rule:t,use:s}=this.store.chainName;this.store.chain.merge({module:{parser:{javascript:{exportsPresence:"error",importExportsPresence:"error"}},rule:{[t.mjs]:{test:/\.m?js/,resolve:{fullySpecified:!1}},[t.typescript]:{test:/\.(ts|tsx)$/,exclude:e,use:{[s.swc]:{loader:"builtin:swc-loader",options:this.swcTsOptions}}},[t.javascript]:{test:/\.((m|c)?js|jsx)$/,exclude:e,use:{[s.swc]:{loader:"builtin:swc-loader",options:this.swcJsOptions}}},[t.sourceMap]:{test:/\.[tj]sx?$/,enforce:"pre",use:{[s.sourceMap]:{loader:w.resolve("source-map-loader")}}}}}})}async files(){let{rule:e}=this.store.chainName;this.store.chain.merge({module:{rule:{[e.svg]:{test:/\.svg$/,type:"asset/resource"}}}}),this.store.chain.merge({module:{rule:{[e.inline]:{resourceQuery:/inline/,type:"asset/inline"}}}}),this.store.chain.merge({module:{rule:{[e.image]:{test:/\.(png|jpe?g|gif|webp|ico)$/i,type:"asset/resource"},[e.font]:{test:/\.(|otf|ttf|eot|woff|woff2)$/i,type:"asset/resource"},[e.svga]:{test:/\.(svga)$/i,type:"asset/resource"}}}})}},mt=new Oe});import ft from"fs";import{ModuleFederationPlugin as fs}from"@module-federation/enhanced/rspack";import H from"@rspack/core";var Pe,ut,gt=h(()=>{"use strict";a();Pe=class{store;async setup(e){this.store=e;let t=[this.define(),this.anylayze(),this.progress(),this.copy(),this.empShare(),this.minify()];await this.store.empConfig.lifeCycle.beforePlugin(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterPlugin()}async anylayze(){if(!this.store.cliOptions.analyze)return;let{default:{BundleAnalyzerPlugin:e}}=await import("webpack-bundle-analyzer");this.store.chain.plugin(this.store.chainName.plugin.bundleAnalyzer).use(e,[{analyzerPort:this.store.empConfig.server.port,defaultSizes:"gzip",analyzerHost:this.store.getLanIp()||"127.0.0.1"}])}async define(){this.store.chain.plugin(this.store.chainName.plugin.define).use(H.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");ft.existsSync(e)&&ft.readdirSync(e).length>0&&this.store.chain.plugin(this.store.chainName.plugin.copy).use(H.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve(this.store.empConfig.build.outDir)}]}])}async progress(){this.store.empConfig.debug.progress&&this.store.chain.plugin(this.store.chainName.plugin.progress).use(H.ProgressPlugin,[{prefix:"EMP"}])}async empShare(){let{isEmpshare:e}=this.store.empConfig.empShareLib;if(!e)return;let t=fs;this.store.chain.plugin(this.store.chainName.plugin.empShare).use(t,[this.store.empConfig.empShareLib.pluginConfig])}minify(){this.store.chain.optimization.minimize(this.store.mode==="production"),this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minJs).use(H.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]),this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(H.SwcCssMinimizerRspackPlugin,[{}])}},ut=new Pe});var ke,dt,yt=h(()=>{"use strict";a();ot();at();lt();ht();gt();ke=class{store;async setup(e){this.store=e;let t=[rt.setup(this.store),mt.setup(this.store),ut.setup(this.store),pt.setup(this.store),nt.setup(this.store)];await Promise.all(t),await this.store.empConfig.lifeCycle.beforeEmpPlugin(),await this.store.empConfig.plugins(),await this.store.empConfig.lifeCycle.afterEmpPlugin(),await this.store.empConfig.chain()}},dt=new ke});import us from"fs/promises";import S from"path";import gs from"util";import ds from"webpack-chain";var $e,o,y=h(()=>{"use strict";a();O();C();it();yt();ve();$e=class{empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=S.resolve(m,c).replace(`${S.sep}dist${S.sep}index.js`,"");empSource=S.resolve(this.empRoot,"dist");resolve=e=>S.isAbsolute(e)?e:S.resolve(this.root,e);empResolve=e=>S.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};chainName=I;cacheDir="";mode="development";cliMode="dev";isDev=!0;cliOptions;chain;rsConfig;empOptions={};empConfig;vCompare=ce;deepAssign=g;getLanIp=N;entries={};debug;async setup(e,t){p.time("[store]Setup"),await this.initVars(e,t),this.empConfig=st,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new ds,await dt.setup(this),this.setLogger(),this.toConfig(),this.logConfig(),p.timeEnd("[store]Setup")}async initVars(e,t){this.cliOptions=t||{},this.cliMode="prod",this.mode=e==="dev"?"development":"production",this.isDev=this.mode==="development",process.env.NODE_ENV=e==="dev"?"development":"production";let s=w(this.empResolve("package.json")),r=w(this.resolve("package.json"));this.empPkg={...this.empPkg,...s},this.pkg={...this.pkg,...r},this.resource.dir=S.join(this.empRoot,"resource"),this.resource.cert=S.join(this.resource.dir,"emp.cert"),this.resource.key=S.join(this.resource.dir,"emp.key")}initPaths(){this.appSrc=this.resolve(this.empConfig.appSrc),this.outDir=this.resolve(this.empConfig.build.outDir),this.publicDir=this.resolve(this.empConfig.build.publicDir),this.cacheDir=this.resolve(this.empConfig.cacheDir)}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),p.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}`,brandName:"EMP",logLevel:e})}merge(e){this.chain.merge(e)}toConfig(){this.rsConfig=this.chain.toConfig()}logConfig(){if(this.debug.showRsconfig)if(typeof this.debug.showRsconfig=="string"){let e=S.join(this.root,this.debug.showRsconfig);us.writeFile(e,JSON.stringify(this.rsConfig,null,2))}else{this.debug.clearLog=!1;let e={colors:!0,depth:null},t=typeof this.debug.showRsconfig=="object"?g(e,this.debug.showRsconfig):e;console.log(p.link("[Compile Config]")),console.log(gs.inspect(this.rsConfig,t))}}get browserslistOptions(){return{default:["chrome >= 87","edge >= 88","firefox >= 78","safari >= 14"],h5:["iOS >= 9","Android >= 4.4","last 2 versions","> 0.2%","not dead"],node:["node >= 16"]}}},o=new $e});import ys from"fs";import k from"path";import{gzipSizeSync as bs}from"gzip-size";function Os(i,e){let t=[i,e],s=["File","Size","Gzipped"].reduce((r,n,l)=>{let d=t[l],v=n;return d&&(v=n.length<d?n+" ".repeat(d-n.length):n),`${r+v} `}," ");console.log(M.bold(s))}async function bt(i){let e=i.toJson({all:!1,assets:!0,timings:!0}),s=e.assets.filter(u=>xs(u.name)).map(Es);s.sort((u,A)=>u.size-A.size);let r=Math.max(...s.map(u=>u.sizeLabel.length)),n=Math.max(...s.map(u=>(u.folder+k.sep+u.name).length));Os(n,r);let l=0,d=0;s.forEach(u=>{let{sizeLabel:A}=u,{name:Pt,folder:kt,gzipSizeLabel:$t}=u,Ae=(kt+k.sep+Pt).length,Re=A.length;if(l+=u.size,d+=u.gzippedSize,Re<r){let ie=" ".repeat(r-Re);A+=ie}let Ne=j(u.folder+k.sep)+Ps(u.name);if(Ae<n){let ie=" ".repeat(n-Ae);Ne+=ie}p.info(` ${Ne} ${j(A)} ${$t}`)});let v=`${M.bold("Total size:")} ${Z(l)}`,F=`${M.bold("Gzipped size:")} ${Z(d)}`;p.info(`
10
+ `)}},p=new ae});var he={};F(he,{clearConsole:()=>le,deepAssign:()=>g,ensureArray:()=>Jt,getLanIp:()=>N,getPkgVersion:()=>pe,importJsVm:()=>me,jsonFilter:()=>_t,timeFormat:()=>U,vCompare:()=>ce});import{ip as It}from"address";import Ht from"chalk";import{gateway4sync as Bt}from"default-gateway";import Ut from"fs-extra";function le(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function g(i,...e){for(let t of e)for(let s in t){let r=t[s],n=i[s];if(Object(r)==r&&Object(n)===n){i[s]=g(n,r);continue}i[s]=t[s]}return i}var N,pe,Jt,_t,ce,U,me,w=h(()=>{"use strict";a();N=()=>{let{int:i}=Bt();return It(i||"")||"127.0.0.1"},pe=i=>{try{let{version:e}=Ut.readJSONSync(i);return e}catch{return}};Jt=i=>Array.isArray(i)?i:[i],_t=(i={},e=[])=>Object.keys(i).filter(t=>!e.includes(t)).reduce((t,s)=>(t[s]=i[s],t),{}),ce=(i="",e="")=>{let t=i.replace("^","").split("."),s=e.replace("^","").split("."),r=Math.max(t.length,s.length),n=0;for(let l=0;l<r;l++){let d=t.length>l?t[l]:0,v=isNaN(Number(d))?d.charCodeAt():Number(d),R=s.length>l?s[l]:0,u=isNaN(Number(R))?R.charCodeAt():Number(R);if(v<u){n=-1;break}else if(v>u){n=1;break}}return n},U=i=>{i=i/1e3;let e=s=>Ht.bold(s);if(i<1)return`${i*1e3} ms`;if(i<10){let s=i>=.01?2:3;return`${e(i.toFixed(s))} s`}if(i<60)return`${e(i.toFixed(1))} s`;let t=i/60;return`${e(t.toFixed(2))} m`},me=i=>`data:text/javascript,${i}`});var Ge={};F(Ge,{chalk:()=>qt,color:()=>f,glob:()=>D,logger:()=>p,utils:()=>he});import qt from"chalk";import{glob as D}from"glob";var z=h(()=>{"use strict";a();L();w();O()});import Vt from"fs";import Wt from"path";import Xt from"jiti";var Kt,Ie,He,Qt,Be=h(()=>{"use strict";a();y();O();Kt=["emp-config.ts","emp-config.js","emp.config.ts","emp.config.js","emp-config.mjs","emp-config.cjs","emp-config.mts","emp-config.cts","emp.config.mjs","emp.config.cjs","emp.config.mts","emp.config.cts"],Ie=Xt(c,{esmResolve:!0,requireCache:!1,interopDefault:!0}),He=async()=>Qt(),Qt=()=>{p.time("[store]GetEmpConfigPath");let i;for(let e of Kt){let t=Wt.resolve(o.root,e);if(Vt.existsSync(t)){i=t;break}}return p.timeEnd("[store]GetEmpConfigPath"),i}});import Zt from"net";import Yt from"os";async function J(i,e="localhost"){if(i!==es&&(i<Ue||i>fe))throw new Error(`Port number must lie between ${Ue} and ${fe}`);let t=i,s=ts(),r;e&&!s.has(e)?r=new Set([e]):r=s;let n=new Set(["EADDRINUSE","EACCES"]);for(;t<=fe;)try{return await is(t,r)}catch(l){if(!n.has(l.code))throw l;t+=1}throw new Error("No available ports found")}var Ue,fe,es,ts,ss,is,ue=h(()=>{"use strict";a();Ue=1024,fe=65535,es=443,ts=()=>{let i=Yt.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(i))if(t)for(let s of t)e.add(s.address);return e},ss=(i,e)=>new Promise((t,s)=>{let r=Zt.createServer();r.unref(),r.on("error",s),r.listen(i,e,()=>{let{port:n}=r.address();r.close(()=>{t(n)})})}),is=async(i,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let s of e)try{await ss(i,s)}catch(r){if(!t.has(r.code))throw r}return i}});import Je from"url";import rs from"chalk";var ge,T,de=h(()=>{"use strict";a();L();w();ge=class{imf={protocol:"",port:8e3,pathname:"/"};host="0.0.0.0";urls={lanUrlForConfig:"",lanUrlForTerminal:j("unavailable"),localUrlForTerminal:"",localUrlForBrowser:""};setup(e){e.host&&(this.host=e.host),e.protocol&&(this.imf.protocol=e.protocol),e.pathname&&(this.imf.pathname=e.pathname),e.port&&(this.imf.port=e.port),this.setupUrls()}setupUrls(){let{host:e}=this,t=e==="0.0.0.0"||e==="::",s;if(t){s="localhost";try{this.urls.lanUrlForConfig=this.getLanIp(),this.urls.lanUrlForConfig&&(/^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(this.urls.lanUrlForConfig)?this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig):this.urls.lanUrlForConfig="")}catch{}}else s=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(s),this.urls.localUrlForBrowser=this.formatUrl(s)}getLanIp=N;formatUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return Je.format({protocol:t,hostname:e,port:s,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return Je.format({protocol:t,hostname:e,port:rs.bold(s),pathname:r})}},T=new ge});import{exec as os}from"child_process";import{promisify as ns}from"util";var qe,_e,as,ps,Ve,We=h(()=>{"use strict";a();y();O();qe=ns(os),_e=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],as=async()=>{let i=process.env.BROWSER;if(!i||!_e.includes(i)){let{stdout:e}=await qe("ps cax");i=_e.find(t=>e.includes(t))}return i},ps=async i=>{if(process.platform==="darwin")try{let t=await as();if(t){let s=`osascript openChrome.applescript "${encodeURI(i)}" "${t}"`;return await qe(s,{cwd:o.resource.dir}),!0}}catch(t){p.debug(t)}try{let{default:t}=await import("open");return await t(i),!0}catch(t){return p.error("Failed to open start URL."),p.error(t),!1}},Ve=ps});var ye,_,be=h(()=>{"use strict";a();ue();de();w();y();ye=class{isADB=!1;isHttps=!1;get isHttpBase(){let e=o.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}async setup(){if(this.isADB=!!o.empOptions.autoDevBase&&o.mode==="development"&&!this.isHttpBase,!this.isADB)return;let{server:e,https:t}=o.empOptions.server||{};this.isHttps=e==="https"||typeof e=="object"&&e.type==="https"||t===!0;let s=T.getLanIp(),r=this.isHttps?"https":"http",n=o.empOptions.server?.port||8e3;n=await J(n,s),o.empOptions.base=`${r}://${s}:${n}/`,o.empOptions.server=g({port:n,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${s}:${n}/ws`}},o.empOptions.server)}},_=new ye});import Xe from"fs/promises";var P,G=h(()=>{"use strict";a();L();ue();de();O();We();w();y();be();P=class{sf={protocol:"http",host:"0.0.0.0",port:8e3,publicPath:"",publicHasHttp:!1,isOpenBrower:!1,url:"",urls:{localUrlForBrowser:"",localUrlForTerminal:"",lanUrlForTerminal:"",lanUrlForConfig:""}};static httpsType="default";async adaptServer(){this.sf.publicPath=o.rsConfig.output?.publicPath==="auto"?"/":o.rsConfig.output?.publicPath||"/",this.sf.isOpenBrower=!!o.empConfig.server.open,this.sf.protocol=this.isHttps?"https":"http",this.sf.host=o.empConfig.server.host?o.empConfig.server.host:this.sf.host,this.sf.port=o.empConfig.server.port,await this.serverPort(),T.setup(this.sf),this.sf.publicPath&&(this.sf.publicPath.indexOf("http://")>-1||this.sf.publicPath.indexOf("https://")>-1)?(this.sf.url=this.sf.publicPath,this.sf.publicHasHttp=!0,this.sf.urls.localUrlForTerminal=T.prettyPrintUrl("localhost")):(this.sf.urls=T.urls,this.sf.url=this.sf.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this.sf;this.sf.publicHasHttp?(p.info(`${E("\u279C")} Local: ${p.link(e.localUrlForTerminal)}`),p.info(`${E("\u279C")} Network: ${p.link(this.sf.publicPath)}`)):(p.info(`${E("\u279C")} Local: ${p.link(e.localUrlForTerminal)}`),p.info(`${E("\u279C")} Network: ${p.link(e.lanUrlForTerminal)}
11
+ `)),this.sf.isOpenBrower&&Ve(this.sf.url)}async setup(e,t){p.time(`[${e}]Setup`),await o.setup(e,t),o.debug.clearLog&&le(),p.title(`${e}`),await this.adaptServer(),p.time(`[${e}]Run`),await this.run(),p.timeEnd(`[${e}]Run`),this.afterRun(),p.timeEnd(`[${e}]Setup`)}async run(){}afterRun(){process.on("SIGINT",function(){process.exit()})}get isHttps(){let{server:e,https:t,http2:s}=o.empConfig.server||{};return e==="https"||typeof e=="object"&&e.type==="https"||t===!0||s===!0}getcert(){return Promise.all([Xe.readFile(o.resource.key),Xe.readFile(o.resource.cert)])}async serverPort(){if(_.isADB)return;let{port:e,host:t}=this.sf,s=await J(e,t);s!==e&&(this.sf.port=s,o.rsConfig.devServer?.port&&(o.rsConfig.devServer.port=s))}}});var q,Ke=h(()=>{"use strict";a();y();q=class{externals={};externalAssets={js:[],css:[]};exp=/^([0-9a-zA-Z_\s]+)@(.*)/;config;importMap={imports:{}};isEmpshare=!1;async setup(){(o.empConfig.empShare.name||o.empConfig.empShare.fastMode?.runtimeHost)&&(this.isEmpshare=!0),this.config=o.empConfig.empShare,this.config.name=this.config.name?this.config.name:o.uniqueName,(o.empConfig.empShare.fastMode?.runtimeHost||o.empConfig.empShare.fastMode?.runtimeLib)&&o.empConfig.empShareFastMode.setup(),this.config.shareLib&&this.setShareLib(),this.prepareEsm()}get useImportMap(){return this.config.useImportMap&&o.empConfig.isESM}get pluginConfig(){let e={...this.config};return delete e.shareLib,delete e.useImportMap,delete e.fastMode,{manifest:!1,dts:!1,dev:{disableDynamicRemoteTypeHints:!0},...e}}prepareEsm(){if(o.empConfig.isESM){this.config.library={type:"module"};let e=this.config.remotes||{};for(let[t,s]of Object.entries(e))if(typeof s=="string"){let r=s.match(this.exp)||[];r.length>0&&(e[t]=r[2])}this.config.remotes=e}}async setShareLib(){let e=this.config,t=[];if(typeof e.shareLib=="object")for(let[s,r]of Object.entries(e.shareLib)){let n={};if(n.module=s,typeof r=="string"){let l=r.match(this.exp)||[];l.length>0?(n.global=l[1],n.entry=l[2],n.type="js",t.push(n),n={}):(n.global="",n.entry=r,n.type="js",t.push(n),n={})}else Array.isArray(r)?r.map(l=>{if(!l)return;if(l.split("?")[0].endsWith(".css"))n.entry=l,n.type="css";else{let v=l.match(this.exp)||[];v.length>0?(n.global=v[1],n.entry=v[2],n.type="js"):(n.global="",n.entry=l,n.type="js")}t.push(n),n={}}):typeof r=="object"&&r.entry&&(n.entry=r.entry,n.global=r.global,n.type=r.type,t.push(n),n={})}await Promise.all([this.setExternalAssets(t)])}async setExternalAssets(e=[]){if(e.length>0){let t=[];t=t.concat(e),t.map(s=>{s.type=s.type||"js",s.type==="js"&&s.module?(s.global?this.externals[s.module]=s.global:o.empConfig.isESM&&(this.useImportMap?(this.externals[s.module]=s.module,this.importMap.imports[s.module]=s.entry):this.externals[s.module]=s.entry),s.entry&&!o.empConfig.isESM&&this.externalAssets.js.push(s.entry)):s.type==="css"&&s.entry&&this.externalAssets.css.push(s.entry)})}}}});var V,Qe=h(()=>{"use strict";a();y();V=class{fastMode={runtimeHost:"",runtimeLib:"",externals:{},globalVal:"EMP_ADAPTER",framework:"react"};externalMF={"@module-federation/runtime":"MFRuntime","@module-federation/sdk":"MFSDK"};externalReact={react:"React","react-dom":"ReactDOM","react-router-dom":"ReactRouterDOM"};externals={};getRuntimeLib(e){return`${e}/runtime${o.mode==="development"?".development":""}.umd.js`}setup(){this.fastMode=o.deepAssign(this.fastMode,o.empConfig.empShare.fastMode),this.injectLib(),this.setExternals()}injectLib(){let{runtimeHost:e,runtimeLib:t}=this.fastMode;if(e||t){let s=t||this.getRuntimeLib(e);o.empConfig.empShareLib.externalAssets.js.push(s)}}setExternals(){for(let[e,t]of Object.entries(this.externalMF))this.externals[e]=`${this.fastMode.globalVal}.${t}`;if(this.fastMode.framework==="react")for(let[e,t]of Object.entries(this.externalReact))this.externals[e]=`${this.fastMode.globalVal}.${t}`;Object.entries(this.fastMode.externals).length>0&&(this.externals=o.deepAssign(this.externals,this.fastMode.externals)),o.empConfig.empShareLib.externals=o.deepAssign(o.empConfig.empShareLib.externals,this.externals)}}});var I,ve=h(()=>{"use strict";a();I={rule:{mjs:"mjs",typescript:"typescript",javascript:"javascript",sourceMap:"sourceMapLoader",inline:"inline",svg:"svg",image:"image",font:"fonts",svga:"svga",sass:"sass",less:"less",css:"css"},use:{swc:"swc",sourceMap:"sourceMapLoader",sass:"sassLoader",less:"lessLoader"},plugin:{bundleAnalyzer:"bundleAnalyzerPlugin",define:"definePlugin",copy:"copyRspackPlugin",progress:"progressPlugin",empShare:"empShare",html:{prefix:"html-plugin-",empSharePrefix:"html-plugin-empShare-",importMapPrefix:"html-plugin-import-map-",hooks:{empShareLib:"HtmlEmpShareLibPluginName",importMap:"HtmlImportMapPlugin"}},rsdoctor:"rsdoctor"},minimizer:{minJs:"minJs",minCss:"minCss"}}});import et from"html-webpack-plugin";var Ze,W,Ye,X,ls,K,Ce=h(()=>{"use strict";a();w();y();ve();Ze=I.plugin.html.hooks.importMap,W=class{importMap;chunk;constructor(e,t){this.importMap=e,this.chunk=t}apply(e){e.hooks.compilation.tap(Ze,t=>{et.getHooks(t).alterAssetTagGroups.tapAsync(Ze,(s,r)=>{if(!s.plugin.userOptions.chunks?.includes(this.chunk))return r(null,s);s.headTags.push({tagName:"script",attributes:{type:"importmap"},innerHTML:`${JSON.stringify(this.importMap,null,2)}`,voidTag:!1,meta:{plugin:void 0}}),r(null,s)})})}},Ye=I.plugin.html.hooks.empShareLib,X=class{chunk;files;constructor(e,t){this.files=g({js:[],css:[]},e),this.chunk=t}apply(e){e.hooks.compilation.tap(Ye,t=>{let s=this.files;et.getHooks(t).alterAssetTagGroups.tapAsync(Ye,(r,n)=>{if(!r.plugin.userOptions.chunks?.includes(this.chunk))return n(null,r);s.js.map(l=>{r.headTags.push({tagName:"script",attributes:{src:l},voidTag:!1,meta:{plugin:void 0}})}),s.css.map(l=>{r.headTags.push({tagName:"link",attributes:{rel:"stylesheet",href:l},voidTag:!1,meta:{plugin:void 0}})}),n(null,r)})})}},ls=()=>{let i=[`import 'core-js/${o.empConfig.build.coreJsFeatures}'`].join(`
12
+ `);return me(i)},K=class{constructor(){}apply(e){let{webpack:t}=e;new t.EntryPlugin(e.context,ls(),{name:void 0}).apply(e)}}});var Q,tt=h(()=>{"use strict";a();y();be();Ce();Q=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){await _.setup(),this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){o.empConfig.build.polyfill==="entry"&&o.chain.plugin("empPolyfill").use(K),this.op.beforePlugin&&await this.op.beforePlugin()}async afterPlugin(){this.op.afterPlugin&&await this.op.afterPlugin()}async beforeModule(){this.op.beforeModule&&await this.op.beforeModule()}async afterModule(){this.op.afterModule&&await this.op.afterModule()}async beforeEmpPlugin(){this.op.beforeEmpPlugin&&await this.op.beforeEmpPlugin()}async afterEmpPlugin(){this.op.afterEmpPlugin&&await this.op.afterEmpPlugin()}async beforeBuild(){this.op.beforeBuild&&await this.op.beforeBuild()}async afterBulid(){this.op.afterBulid&&await this.op.afterBulid()}async beforeDevServe(){this.op.beforeDevServe&&await this.op.beforeDevServe()}async afterDevServe(){this.op.afterDevServe&&await this.op.afterDevServe()}async beforeServe(){this.op.beforeServe&&await this.op.beforeServe()}async afterServe(){this.op.afterServe&&await this.op.afterServe()}}});import cs from"fs";var we,st,it=h(()=>{"use strict";a();z();Be();w();G();Ke();Qe();tt();we=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},g(e,t)}empShareFastMode=new V;empShareLib=new q;isESM=!1;async autoDevSet(){this.store.mode==="development"&&this.store.empOptions.autoDevBase}checkIsESM(e){return["es3","es5"].indexOf(e)===-1}lifeCycle;async setup(e){this.store=e,await this.syncEmpOptions(),this.lifeCycle=new Q(this.store.empOptions.lifeCycle),await this.lifeCycle.afterGetEmpOptions(),this.isESM=this.checkIsESM(this.build.target),this.store.empOptions.target?(this.target=this.store.empOptions.target,Array.isArray(this.target)&&!this.target.includes(this.build.target)&&this.target.push(this.build.target)):this.target=["web",this.build.target];let{appSrc:t,base:s,appEntry:r}=this.store.empOptions;t&&(this.appSrc=t),s&&(this.base=s),r&&(this.appEntry=r),this.store.empConfig.empShare&&await this.empShareLib.setup()}async chain(){this.store.empOptions.chain&&await this.store.empOptions.chain(this.store.chain)}async plugins(){let e=[];this.store.empOptions.plugins&&Array.isArray(this.store.empOptions.plugins)&&this.store.empOptions.plugins.length>0&&(this.store.empOptions.plugins.map(t=>{e.push(t.rsConfig(this.store))}),await Promise.all(e))}get debug(){let e=!1;return this.store.cliOptions.doctor&&(e={supports:{generateTileGraph:!0}}),this.assign({loggerLevel:"info",clearLog:!0,progress:!0,showRsconfig:!1,showPerformance:!1,rspackCache:!0,rsdoctor:e,infrastructureLogging:{appendOnly:!0,level:"warn"},newTreeshaking:this.store.empConfig.isESM},this.store.empOptions.debug)}get build(){let e=this.store.empOptions.build?.staticDir?`${this.store.empOptions.build?.staticDir}/`:"";return this.assign({outDir:"dist",staticDir:e,assetsDir:"assets",publicDir:"public",chunkIds:this.store.isDev?"named":"deterministic",moduleIds:this.store.isDev?"named":"deterministic",sourcemap:this.store.isDev,minify:!this.store.isDev,minOptions:{},cssminOptions:{},target:"es5",polyfill:!1,polyfillInclude:[],coreJsFeatures:"stable",externalHelpers:!1,browserslist:this.store.browserslistOptions.default,swcConfig:{},devtool:"source-map"},{...this.store.empOptions.build,staticDir:e})}get html(){let e=this.store.empOptions.html?.template?{}:{charset:{charset:"utf-8"},"http-equiv":{"http-equiv":"X-UA-Compatible",content:"IE=edge"},viewport:{name:"viewport",content:"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"},keywords:{keywords:""},description:{description:""}};return this.assign({lang:"zh-CN",title:"EMP",inject:"body",minify:!this.store.isDev,scriptLoading:this.isESM?"module":"defer",meta:e,files:{css:[],js:[]},tags:{headTags:[],bodyTags:[]}},this.store.empOptions.html)}get entries(){return this.store.empOptions.entries?this.store.empOptions.entries:{}}get server(){let e={host:"0.0.0.0",port:8e3,open:process.platform==="darwin",hot:!0,watchFiles:["src/**/*.html"],static:[{directory:this.store.publicDir,watch:this.store.isDev}],allowedHosts:["all"],historyApiFallback:!0,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":"X-Requested-With, content-type, Authorization"}};return this.store.empOptions.server?.http2&&(P.httpsType="h2",delete this.store.empOptions.server.http2),this.assign(e,this.store.empOptions.server)}get empShare(){return this.assign({name:"",filename:"emp.js",shared:{}},this.store.empOptions.empShare)}get css(){return this.assign({sass:{mode:"modern"}},this.store.empOptions.css)}get output(){let e=(this.store.isDev,".[contenthash:8]"),t=this.store.isDev?"":".[contenthash:8]",{assetsDir:s,staticDir:r}=this.store.empConfig.build,n={publicPath:this.store.empConfig.base?this.store.empConfig.base:"auto",crossOriginLoading:"anonymous",filename:`${r}js/[name]${e}.js`,cssFilename:`${r}css/[name]${t}.css`,cssChunkFilename:`${r}css/[name]${t}.css`,assetModuleFilename:`${r}${s}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!0,uniqueName:this.store.uniqueName};return this.assign(n,this.store.empOptions.output)}get define(){let e={mode:this.store.mode,env:this.store.cliOptions.env};return this.store.empOptions.define&&(e={...e,...this.store.empOptions.define}),this.setDefine(e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",s={};return Object.keys(e).map(r=>{t==="all"?(s[`import.meta.env.${r}`]=JSON.stringify(e[r]),s[`process.env.${r}`]=JSON.stringify(e[r])):t==="esm"?s[`import.meta.env.${r}`]=JSON.stringify(e[r]):t==="cjs"?s[`process.env.${r}`]=JSON.stringify(e[r]):t==="none"&&(s[`${r}`]=JSON.stringify(e[r]))}),s}get externals(){return this.assign(this.empShareLib.externals,this.store.empOptions.externals)}get resolve(){return g({alias:{src:this.store.resolve("src"),"@":this.store.resolve("src")},extensions:["...",".js",".jsx",".mjs",".ts",".tsx",".css",".less",".scss",".sass",".json",".wasm",".vue",".svg",".svga"]},this.store.empOptions.resolve)}async syncEmpOptions(){p.time("[store][empConfig]SyncEmpOptions");let e=await He();if(!e||!cs.existsSync(e))return;let t=await Ie(e);typeof t=="function"?this.store.empOptions=await t(this.store):this.store.empOptions=t||{},p.timeEnd("[store][empConfig]SyncEmpOptions")}get moduleTransformRule(){let{moduleTransform:e}=this.store.empOptions,t=this.assign({defaultExclude:!1},e),s={and:[],not:[]};return t.defaultExclude===!0&&s.and.push(/(node_modules|bower_components)/),t?.exclude&&(s.and=s.and.concat(t.exclude)),e?.include&&(s.not=t.include),s}get cacheDir(){return this.store.empOptions.cacheDir?this.store.empOptions.cacheDir:"node_modules/.emp-cache"}get ignoreWarnings(){return this.store.empOptions.ignoreWarnings?this.store.empOptions.ignoreWarnings:[/Conflicting order/]}get autoPages(){let e;return this.store.empOptions.autoPages&&(e=typeof this.store.empOptions.autoPages=="boolean"?{}:this.store.empOptions.autoPages,e=this.assign({path:"pages"},e)),e}},st=new we});import ms from"fs-extra";var xe,rt,ot=h(()=>{"use strict";a();xe=class{store;async setup(e){this.store=e;let t=[this.common(),this.stats(),this.devServer(),this.optimization(),this.checkTsconfig()];await Promise.all(t)}async common(){this.store.merge({node:{global:!0},experiments:{outputModule:this.store.empConfig.isESM,topLevelAwait:!0,css:!0},target:this.store.empConfig.target,infrastructureLogging:this.store.empConfig.debug.infrastructureLogging,context:this.store.root,mode:this.store.mode,cache:this.store.empConfig.debug.rspackCache,devtool:this.store.empConfig.build.sourcemap?this.store.empConfig.build.devtool:!1,output:this.store.empConfig.output,resolve:this.store.empConfig.resolve,externals:this.store.empConfig.externals,ignoreWarnings:this.store.empConfig.ignoreWarnings,watchOptions:{ignored:["**/node_modules/**","**/@mf-types/**"]}})}async checkTsconfig(){let e=this.store.resolve("tsconfig.json");if(await ms.exists(e)){let s={tsConfig:e};this.store.merge({resolve:s})}}async stats(){this.store.merge({stats:{colors:!0,all:!1,assets:!1,chunks:!1,timings:!0,version:!0}})}async devServer(){this.store.merge({devServer:this.store.empConfig.server})}async optimization(){let e={moduleIds:this.store.empConfig.build.moduleIds,chunkIds:this.store.empConfig.build.chunkIds,minimize:this.store.empConfig.build.minify,splitChunks:{chunks:"async",cacheGroups:{}}};this.store.empConfig.build.polyfill&&(e.splitChunks.cacheGroups={}),this.store.chain.merge({optimization:e})}},rt=new xe});var Se,nt,at=h(()=>{"use strict";a();Se=class{store;async setup(e){this.store=e;let t=[this.sass(),this.less(),this.css()];await Promise.all(t)}async sass(){let{rule:e,use:t}=this.store.chainName,s={},{sass:r}=this.store.empConfig.css||{sass:{}};r.mode==="modern"&&(s.implementation=r.implementation?r.implementation:C.resolve("sass-embedded"),s.api=r.api?r.api:"legacy",s.sourceMap=this.store.empConfig.build.sourcemap,r.sassOptions&&(s.sassOptions=r.sassOptions)),this.store.chain.merge({module:{rule:{[e.sass]:{test:/\.(sass|scss)$/,use:{[t.sass]:{loader:C.resolve("sass-loader"),options:s}},type:"css/auto"}}}})}async less(){let{rule:e,use:t}=this.store.chainName,s={loader:C.resolve("less-loader"),options:{lessOptions:{javascriptEnabled:!0}}};this.store.chain.merge({module:{rule:{[e.less]:{test:/\.less$/,use:{[t.less]:s},type:"css/auto"}}}})}async css(){let{rule:e}=this.store.chainName;this.store.chain.merge({module:{rule:{[e.css]:{test:/\.css$/,use:{},type:"css/auto"}}}})}},nt=new Se});import x from"path";import hs from"html-webpack-plugin";var Ee,pt,lt=h(()=>{"use strict";a();z();w();Ce();Ee=class{store;entriesConfig={};async setup(e){this.store=e,await this.init(),this.toConfig()}setHtmlConfig(e,t){return e.template=this.setTemplate(e.template),e.favicon=this.setFavicion(e.favicon),e.chunks=t,e.filename=`${t[0]}.html`,this.store.empConfig.base&&(e.publicPath=this.store.empConfig.base),e.tags=e.tags||{},e}setChunk(e){return e.replace(x.extname(e),"").replace(`${this.store.empConfig.appSrc}${x.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(x.join("template","index.html"))}setFavicion(e){return e?this.store.resolve(e):this.store.empResolve(x.join("template","favicon.ico"))}setEntryItem(e,t,s){s=s||this.store.resolve(x.join(this.store.empConfig.appSrc,e));let r=this.setChunk(e),n=[s];this.entriesConfig[r]={entry:{[r]:n},html:this.setHtmlConfig(t,[r])},this.store.entries[r]=n}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`${this.store.chainName.plugin.html.prefix}${t}`).use(hs,[e]),this.store.empConfig.empShareLib&&(e.files=g(e.files,this.store.empConfig.empShareLib.externalAssets)),this.store.chain.plugin(`${this.store.chainName.plugin.html.empSharePrefix}${t}`).use(X,[e.files,t]),this.store.empConfig.empShareLib.useImportMap&&this.store.chain.plugin(`${this.store.chainName.plugin.html.importMapPrefix}${t}`).use(W,[this.store.empConfig.empShareLib.importMap,t])}setRspackEntry(e){this.store.merge({entry:e})}async init(){this.store.empConfig.autoPages?await this.setAutoPage():(await this.setDefaultEntry(),this.setEntryByConfig())}async setAutoPage(){p.time("setAutoPage");let e=this.store.empConfig.autoPages?.path||"pages",t=x.join(this.store.appSrc,e),s=x.join(t,"**","*.{ts,tsx,jsx,js}"),r=await D([s],{windowsPathsNoEscape:!0});r=r.map(n=>n.replace(`${t}${x.sep}`,"")),r.map(n=>{let l=this.store.empConfig.entries[n]||{};this.setEntryItem(n,{...this.store.empConfig.html,...l},x.join(t,n))}),p.timeEnd("setAutoPage")}async setDefaultEntry(){p.time("[store][empConfig]SetDefaultEntry");let e=x.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}"),t=await D([e],{windowsPathsNoEscape:!0});if(t[0]){let s=x.join(this.store.empConfig.appSrc,Object.keys(this.store.empConfig.entries).length>0&&this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index");this.setEntryItem(s,this.store.empConfig.html,t[0])}p.timeEnd("[store][empConfig]SetDefaultEntry")}setEntryByConfig(){if(Object.keys(this.store.empConfig.entries).length>0)for(let[e,t]of Object.entries(this.store.empConfig.entries))this.setEntryItem(e,{...this.store.empConfig.html,...t})}toConfig(){for(let[e,t]of Object.entries(this.entriesConfig))this.setRspackHtmlPlugin(t.html,e),this.setRspackEntry(t.entry)}},pt=new Ee});import ct from"path";var Oe,mt,ht=h(()=>{"use strict";a();w();Oe=class{store;swcJsOptions={};swcTsOptions={};coreJs={version:"3",alias:"",path:""};async setup(e){this.store=e,this.swcInitOptions(),await this.run()}async run(){let e=[this.jsDataUrl(),this.files(),this.scripts(),this.rspackGenerator(),this.rspackParser()];await this.store.empConfig.lifeCycle.beforeModule(),await Promise.all(e),await this.store.empConfig.lifeCycle.afterModule()}rspackGenerator(){let e=this.store.isDev?"[path][name]-[local]-[hash:5]":"[local]-[hash:5]";this.store.chain.merge({module:{generator:{css:{localIdentName:e},"css/auto":{localIdentName:e},"css/module":{localIdentName:e}}}})}rspackParser(){this.store.chain.merge({module:{parser:{css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return this.store.empConfig.build.polyfill}swcParser(e){switch(e){case"js":return{syntax:"ecmascript",jsx:!0,decorators:!0,decoratorsBeforeExport:!1};case"ts":return{syntax:"typescript",decorators:!0,tsx:!0,dynamicImport:!0}}}swcJsc(e){let{target:t,externalHelpers:s}=this.store.empConfig.build;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:s,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:g(this.swcJsc(e),{...this.store.empConfig.build.swcConfig}),isModule:"unknown"};return this.isPolyfill&&(delete t.jsc.target,t.env={coreJs:this.swcCoreVersion,targets:this.store.empConfig.build.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill),this.store.empConfig.build.polyfill==="usage"&&(t.env.shippedProposals=!0,t.env.include=this.store.empConfig.build.polyfillInclude)),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build;e&&this.store.chain.resolve.alias.set("@swc/helpers",ct.dirname(C.resolve("@swc/helpers/package.json"))),this.coreJs.path=C.resolve("core-js/package.json");let t=pe(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=ct.dirname(this.coreJs.path),this.store.empConfig.build.polyfill&&(this.store.chain.resolve.alias.set("core-js",this.coreJs.alias),this.store.chain.module.rule("javascript").exclude.add(/core-js/),this.store.chain.module.rule("typescript").exclude.add(/core-js/)),this.swcTsOptions=this.swcOptions("ts"),this.swcJsOptions=this.swcOptions("js")}jsDataUrl(){this.store.chain.module.rule("jsDataUrl").merge({mimetype:{or:["text/javascript","application/javascript"]}}).resolve.set("fullySpecified",!1).end().use("swcJsParser").loader("builtin:swc-loader").options(this.swcJsOptions)}async scripts(){let e=[],{rule:t,use:s}=this.store.chainName;this.store.chain.merge({module:{parser:{javascript:{exportsPresence:"error",importExportsPresence:"error"}},rule:{[t.mjs]:{test:/\.m?js/,resolve:{fullySpecified:!1}},[t.typescript]:{test:/\.(ts|tsx)$/,exclude:e,use:{[s.swc]:{loader:"builtin:swc-loader",options:this.swcTsOptions}}},[t.javascript]:{test:/\.((m|c)?js|jsx)$/,exclude:e,use:{[s.swc]:{loader:"builtin:swc-loader",options:this.swcJsOptions}}},[t.sourceMap]:{test:/\.[tj]sx?$/,enforce:"pre",use:{[s.sourceMap]:{loader:C.resolve("source-map-loader")}}}}}})}async files(){let{rule:e}=this.store.chainName;this.store.chain.merge({module:{rule:{[e.svg]:{test:/\.svg$/,type:"asset/resource"}}}}),this.store.chain.merge({module:{rule:{[e.inline]:{resourceQuery:/inline/,type:"asset/inline"}}}}),this.store.chain.merge({module:{rule:{[e.image]:{test:/\.(png|jpe?g|gif|webp|ico)$/i,type:"asset/resource"},[e.font]:{test:/\.(|otf|ttf|eot|woff|woff2)$/i,type:"asset/resource"},[e.svga]:{test:/\.(svga)$/i,type:"asset/resource"}}}})}},mt=new Oe});import ft from"fs";import{ModuleFederationPlugin as fs}from"@module-federation/enhanced/rspack";import H from"@rspack/core";var Pe,ut,gt=h(()=>{"use strict";a();Pe=class{store;async setup(e){this.store=e;let t=[this.define(),this.anylayze(),this.progress(),this.copy(),this.empShare(),this.minify(),this.redoctor()];await this.store.empConfig.lifeCycle.beforePlugin(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterPlugin()}async anylayze(){if(!this.store.cliOptions.analyze)return;let{default:{BundleAnalyzerPlugin:e}}=await import("webpack-bundle-analyzer");this.store.chain.plugin(this.store.chainName.plugin.bundleAnalyzer).use(e,[{analyzerPort:this.store.empConfig.server.port,defaultSizes:"gzip",analyzerHost:this.store.getLanIp()||"127.0.0.1"}])}async define(){this.store.chain.plugin(this.store.chainName.plugin.define).use(H.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");ft.existsSync(e)&&ft.readdirSync(e).length>0&&this.store.chain.plugin(this.store.chainName.plugin.copy).use(H.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve(this.store.empConfig.build.outDir)}]}])}async progress(){this.store.empConfig.debug.progress&&this.store.chain.plugin(this.store.chainName.plugin.progress).use(H.ProgressPlugin,[{prefix:"EMP"}])}async empShare(){let{isEmpshare:e}=this.store.empConfig.empShareLib;if(!e)return;let t=fs;this.store.chain.plugin(this.store.chainName.plugin.empShare).use(t,[this.store.empConfig.empShareLib.pluginConfig])}minify(){this.store.chain.optimization.minimize(this.store.mode==="production"),this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minJs).use(H.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]),this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(H.LightningCssMinimizerRspackPlugin,[this.store.empConfig.build.cssminOptions])}redoctor(){if(!this.store.empConfig.debug.rsdoctor)return;let{RsdoctorRspackPlugin:e}=C("@rsdoctor/rspack-plugin"),t={};typeof this.store.empConfig.debug.rsdoctor=="object"&&(t=this.store.empConfig.debug.rsdoctor),this.store.chain.plugin(this.store.chainName.plugin.rsdoctor).use(e,[t])}},ut=new Pe});var ke,dt,yt=h(()=>{"use strict";a();ot();at();lt();ht();gt();ke=class{store;async setup(e){this.store=e;let t=[rt.setup(this.store),mt.setup(this.store),ut.setup(this.store),pt.setup(this.store),nt.setup(this.store)];await Promise.all(t),await this.store.empConfig.lifeCycle.beforeEmpPlugin(),await this.store.empConfig.plugins(),await this.store.empConfig.lifeCycle.afterEmpPlugin(),await this.store.empConfig.chain()}},dt=new ke});import us from"fs/promises";import S from"path";import gs from"util";import ds from"webpack-chain";var $e,o,y=h(()=>{"use strict";a();O();w();it();yt();ve();$e=class{empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=S.resolve(m,c).replace(`${S.sep}dist${S.sep}index.js`,"");empSource=S.resolve(this.empRoot,"dist");resolve=e=>S.isAbsolute(e)?e:S.resolve(this.root,e);empResolve=e=>S.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};chainName=I;cacheDir="";mode="development";cliMode="dev";isDev=!0;cliOptions;chain;rsConfig;empOptions={};empConfig;vCompare=ce;deepAssign=g;getLanIp=N;entries={};debug;async setup(e,t){p.time("[store]Setup"),await this.initVars(e,t),this.empConfig=st,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new ds,await dt.setup(this),this.setLogger(),this.toConfig(),this.logConfig(),p.timeEnd("[store]Setup")}async initVars(e,t){this.cliOptions=t||{},this.cliMode="prod",this.mode=e==="dev"?"development":"production",this.isDev=this.mode==="development",process.env.NODE_ENV=e==="dev"?"development":"production";let s=C(this.empResolve("package.json")),r=C(this.resolve("package.json"));this.empPkg={...this.empPkg,...s},this.pkg={...this.pkg,...r},this.resource.dir=S.join(this.empRoot,"resource"),this.resource.cert=S.join(this.resource.dir,"emp.cert"),this.resource.key=S.join(this.resource.dir,"emp.key")}initPaths(){this.appSrc=this.resolve(this.empConfig.appSrc),this.outDir=this.resolve(this.empConfig.build.outDir),this.publicDir=this.resolve(this.empConfig.build.publicDir),this.cacheDir=this.resolve(this.empConfig.cacheDir)}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),p.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}`,brandName:"EMP",logLevel:e})}merge(e){this.chain.merge(e)}toConfig(){this.rsConfig=this.chain.toConfig()}logConfig(){if(this.debug.showRsconfig)if(typeof this.debug.showRsconfig=="string"){let e=S.join(this.root,this.debug.showRsconfig);us.writeFile(e,JSON.stringify(this.rsConfig,null,2))}else{this.debug.clearLog=!1;let e={colors:!0,depth:null},t=typeof this.debug.showRsconfig=="object"?g(e,this.debug.showRsconfig):e;console.log(p.link("[Compile Config]")),console.log(gs.inspect(this.rsConfig,t))}}get browserslistOptions(){return{default:["chrome >= 87","edge >= 88","firefox >= 78","safari >= 14"],h5:["iOS >= 9","Android >= 4.4","last 2 versions","> 0.2%","not dead"],node:["node >= 16"]}}get uniqueName(){return this.pkg.name.replaceAll("/","_").replaceAll("@","_").replaceAll("-","_")}},o=new $e});import ys from"fs";import k from"path";import{gzipSizeSync as bs}from"gzip-size";function Os(i,e){let t=[i,e],s=["File","Size","Gzipped"].reduce((r,n,l)=>{let d=t[l],v=n;return d&&(v=n.length<d?n+" ".repeat(d-n.length):n),`${r+v} `}," ");console.log(M.bold(s))}async function bt(i){let e=i.toJson({all:!1,assets:!0,timings:!0}),s=e.assets.filter(u=>xs(u.name)).map(Es);s.sort((u,A)=>u.size-A.size);let r=Math.max(...s.map(u=>u.sizeLabel.length)),n=Math.max(...s.map(u=>(u.folder+k.sep+u.name).length));Os(n,r);let l=0,d=0;s.forEach(u=>{let{sizeLabel:A}=u,{name:Pt,folder:kt,gzipSizeLabel:$t}=u,Ae=(kt+k.sep+Pt).length,Fe=A.length;if(l+=u.size,d+=u.gzippedSize,Fe<r){let ie=" ".repeat(r-Fe);A+=ie}let Ne=j(u.folder+k.sep)+Ps(u.name);if(Ae<n){let ie=" ".repeat(n-Ae);Ne+=ie}p.info(` ${Ne} ${j(A)} ${$t}`)});let v=`${M.bold("Total size:")} ${Z(l)}`,R=`${M.bold("Gzipped size:")} ${Z(d)}`;p.info(`
13
13
  ${v}
14
- ${F}
14
+ ${R}
15
15
  `),p.info(`${E("\u2713")} Ready in ${U(Number(e.time))}
16
- `)}function Y(i=0){p.info(`${E("\u2713")} Ready in ${U(Number(i))}`)}var vs,Cs,ws,xs,Ss,Es,Z,Ps,ee=h(()=>{"use strict";a();L();y();O();C();vs=/\.html$/,Cs=/\.(?:js|mjs|cjs|jsx)$/,ws=/\.css$/,xs=i=>!/\.map$/.test(i)&&!/\.LICENSE\.txt$/.test(i),Ss=i=>i>300*1e3?re:i>100*1e3?B:oe,Es=i=>{let e=i.name.split("?")[0],t=Z(i.size),s=k.basename(e),r=k.join(k.basename(o.empConfig.build.outDir),k.dirname(e)),n=ys.readFileSync(k.join(o.empConfig.build.outDir,e)),l=n.length,d=bs(n),v=Ss(d)(Z(d));return{size:l,folder:r,name:s,gzippedSize:d,sizeLabel:t,gzipSizeLabel:v}};Z=i=>{let e=i/1e3;return`${e.toFixed(e<1?2:1)} kB`},Ps=i=>Cs.test(i)?B(i):ws.test(i)?E(i):vs.test(i)?M(i):ne(i)});var vt={};R(vt,{default:()=>Ms});import{rspack as ks}from"@rspack/core";import{RspackDevServer as $s}from"@rspack/dev-server";var Me,Ms,Ct=h(()=>{"use strict";a();ee();O();C();G();y();Me=class extends P{get rspackDevConfig(){return g(o.rsConfig,{stats:{all:!1,colors:!0,assets:!1,chunks:!1,entrypoints:!1,timings:!1,version:!1,errors:!0,warnings:!0},devServer:{open:!1,setupExitSignals:!0}})}async devServerConfig(){let e=Object.assign({},o.rsConfig.devServer);if(this.isHttps&&(e.https===!0&&delete e.https,!e.server)){let[t,s]=await this.getcert();e.server={type:"https",options:{key:t,cert:s}}}return e}async run(){let e=ks(this.rspackDevConfig);if(!o.rsConfig.devServer){p.error("devServer is not defined in config");return}let t=await this.devServerConfig(),s=new $s(t,e);this.startOpen(),o.empConfig.lifeCycle.beforeDevServe&&await o.empConfig.lifeCycle.beforeDevServe(),await s.start();let r=n=>{let l=n?.toJson({all:!1,colors:!1,assets:!1,chunks:!1,timings:!0});Y(l.time)};o.debug.showPerformance&&e.hooks.afterDone.tap("done",r),s.middleware?.waitUntilValid(n=>{o.debug.showPerformance||r(n),o.empConfig.lifeCycle.afterDevServe&&o.empConfig.lifeCycle.afterDevServe()})}},Ms=new Me});import js from"https";import Ls from"compression";import Ds from"cors";import Ts from"express";var te,wt=h(()=>{"use strict";a();G();te=class extends P{app;async init(){let e=Ts();e.use(Ls()),e.use(Ds()),this.app=e}async server(){if(this.isHttps){let[e,t]=await this.getcert();js.createServer(typeof this.isHttps!="boolean"?this.isHttps:{key:e,cert:t},this.app).listen(this.sf.port,async()=>{this.startOpen(),await this.onReady()})}else this.app.listen(this.sf.port,async()=>{this.startOpen(),await this.onReady()})}async onReady(){}async middleware(){}async start(){await this.init(),await this.middleware(),await this.server()}}});var je={};R(je,{ServeScript:()=>se,default:()=>zs});import Fs from"fs";import As from"fs/promises";import Rs from"path";import Ns from"express";var se,zs,Le=h(()=>{"use strict";a();ee();O();y();wt();se=class extends te{timing=0;async run(){if(this.timing=Date.now(),!Fs.existsSync(o.outDir))return p.sysError(`emp serve must be executed after emp build,${o.outDir} not exist!`);o.empConfig.lifeCycle.beforeServe&&await o.empConfig.lifeCycle.beforeServe(),this.start()}async middleware(){let e=o.resolve(o.rsConfig.output?.path);this.app.use(Ns.static(e));let t=await As.readFile(Rs.join(e,"index.html"),"utf8");this.app.get("*",(s,r)=>r.send(t))}async onReady(){Y(Date.now()-this.timing),o.empConfig.lifeCycle.afterServe&&await o.empConfig.lifeCycle.afterServe()}},zs=new se});var xt={};R(xt,{default:()=>Is});import{rspack as Gs}from"@rspack/core";var De,Is,St=h(()=>{"use strict";a();ee();O();G();y();De=class extends P{isWatchMode=!1;rspackConfig;isuseServe=!1;isStartServe=!1;watchMode(){this.isWatchMode&&this.rspackConfig.optimization&&(this.rspackConfig.optimization.moduleIds="named",this.rspackConfig.optimization.chunkIds="named",this.rspackConfig.watch=!0)}async startServe(){if(!this.isuseServe||this.isStartServe)return;this.isStartServe=!0;let{default:e}=await Promise.resolve().then(()=>(Le(),je));await e.setup("serve",o.cliOptions)}async run(){await o.empConfig.lifeCycle.beforeBuild(),this.isWatchMode=!!o.cliOptions.watch,this.isuseServe=!!o.cliOptions.serve,this.rspackConfig=o.rsConfig,this.isWatchMode&&this.watchMode(),Gs(this.rspackConfig,async(e,t)=>{if(e!==null){p.error(e.stack||e),e.message&&p.error(e.message);return}if(!t){p.red("Stats is Undefined.");return}t.hasErrors()&&(p.error(t.toString({all:!1,colors:!0,errors:!0})),p.red("Failed to compile."),process.exit(1)),t.hasWarnings()&&(p.yellow("Compiled with warnings."),p.warn(t.toString({all:!1,chunks:!1,assets:!1,colors:!0,errors:!0,warnings:!0}))),await bt(t),this.startServe(),await o.empConfig.lifeCycle.afterBulid()})}},Is=new De});a();import{rspack as un}from"@rspack/core";import dn from"html-webpack-plugin";a();y();import Hs from"process";import{program as $}from"commander";function Et(){$.version(o.empPkg.version,"-v, --version").usage("<command> [options]"),$.command("dev").description("Dev \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-h, --hot","\u662F\u5426\u4F7F\u7528\u70ED\u66F4\u65B0 \u9ED8\u8BA4\u542F\u52A8").option("-o, --open","\u662F\u5426\u6253\u5F00\u8C03\u8BD5\u9875\u9762 \u9ED8\u8BA4\u4E0D\u6253\u5F00").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-ev, --env-vars <key=value>","\u5B9A\u4E49\u4E00\u4E2A\u73AF\u5883\u53D8\u91CF -ev key=value \u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u91CD\u590D\u8C03\u7528 -ev key=value -ev key=value",(i,e)=>{let[t,s]=i.split("=");return e[t]=s,e},{}).action(async i=>{let{default:e}=await Promise.resolve().then(()=>(Ct(),vt));await e.setup("dev",i)}),$.command("build").description("Build \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-a, --analyze","\u751F\u6210\u5206\u6790\u62A5\u544A \u9ED8\u8BA4\u4E3A false").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-w, --watch","watch \u6A21\u5F0F").option("-sv, --serve","watch \u6A21\u5F0F\u4E0B\u542F\u52A8serve").option("-ev, --env-vars <key=value>","\u5B9A\u4E49\u4E00\u4E2A\u73AF\u5883\u53D8\u91CF -ev key=value \u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u91CD\u590D\u8C03\u7528 -ev key=value -ev key=value",(i,e)=>{let[t,s]=i.split("=");return e[t]=s,e},{}).action(async i=>{let{default:e}=await Promise.resolve().then(()=>(St(),xt));await e.setup("build",i)}),$.command("serve").description("Server \u6A21\u5F0F").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").action(async i=>{let{default:e}=await Promise.resolve().then(()=>(Le(),je));await e.setup("serve",i)}),$.command("dts").description("\u62C9\u53D6 remote \u9879\u76EE\u7684 d.ts").option("-p, --typingsPath <typingsPath>","\u4E0B\u8F7D\u76EE\u5F55").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").action(i=>{}),$.command("init").description("\u521D\u59CB\u5316 emp \u9879\u76EE").option("-d, --data [data]","JSON\u6570\u636E http\u5730\u5740 \u6216\u8005 \u6587\u4EF6\u8DEF\u5F84\u76F8\u5BF9\u3001\u7EDD\u5BF9\u8DEF\u5F84").action(i=>{}),$.parse(Hs.argv)}a();z();y();import Ot from"fs/promises";import Te from"path";var Bs=/(?:(?:import|export)\s?(?:type)?\s?(?:(?:\{[^;\n]+\})|(?:[^;\n]+))\s?from\s?['"][^;\n]+['"])|(?:import\(['"][^;\n]+?['"]\))/g,Us=/(?:import|export)\s?(?:type)?\s?\{?.+\}?\s?from\s?['"](.+)['"]/,Js=/import\(['"]([^;\n]+?)['"]\)/,Fe=class{list=[];outDir=o.resolve("dist");aliasName="@empjs/cli";async setup(e,t){e&&(this.outDir=e),t&&(this.aliasName=t);let s=await this.readDts();await this.writeCode(s)}async readDts(){this.list=await D([`${o.empConfig.build.outDir}/**/*.d.ts`],{windowsPathsNoEscape:!0});let e=[];this.list.map(s=>{s=o.resolve(s),e.push(this.readFile(s))});let t=await Promise.all(e);return t=t.map(s=>this.replaceAliasPath(s)),t}async readFile(e){let t=await Ot.readFile(e,{encoding:"utf-8"});return{src:e,code:t}}replaceAliasPath({src:e,code:t}){t=t.replace(Bs,r=>{let n=r.match(Us);if(n||(n=r.match(Js)),n&&n[1]){let l=n[1];if(!l.startsWith("."))return r;let d=Te.resolve(Te.dirname(e),l).replace(this.outDir,this.aliasName);return r.replace(n[1],d)}return r});let s=e.replace(this.outDir,this.aliasName).replace(".d.ts","");return s.endsWith("/index")&&(s=s.replace("/index","")),t=this.warpDeclareModule(s,t),{code:t,src:e,mod:s}}warpDeclareModule(e,t){return`declare module '${e}' {\r
16
+ `)}function Y(i=0){p.info(`${E("\u2713")} Ready in ${U(Number(i))}`)}var vs,Cs,ws,xs,Ss,Es,Z,Ps,ee=h(()=>{"use strict";a();L();y();O();w();vs=/\.html$/,Cs=/\.(?:js|mjs|cjs|jsx)$/,ws=/\.css$/,xs=i=>!/\.map$/.test(i)&&!/\.LICENSE\.txt$/.test(i),Ss=i=>i>300*1e3?re:i>100*1e3?B:oe,Es=i=>{let e=i.name.split("?")[0],t=Z(i.size),s=k.basename(e),r=k.join(k.basename(o.empConfig.build.outDir),k.dirname(e)),n=ys.readFileSync(k.join(o.empConfig.build.outDir,e)),l=n.length,d=bs(n),v=Ss(d)(Z(d));return{size:l,folder:r,name:s,gzippedSize:d,sizeLabel:t,gzipSizeLabel:v}};Z=i=>{let e=i/1e3;return`${e.toFixed(e<1?2:1)} kB`},Ps=i=>Cs.test(i)?B(i):ws.test(i)?E(i):vs.test(i)?M(i):ne(i)});var vt={};F(vt,{default:()=>Ms});import{rspack as ks}from"@rspack/core";import{RspackDevServer as $s}from"@rspack/dev-server";var Me,Ms,Ct=h(()=>{"use strict";a();ee();O();w();G();y();Me=class extends P{get rspackDevConfig(){return g(o.rsConfig,{stats:{all:!1,colors:!0,assets:!1,chunks:!1,entrypoints:!1,timings:!1,version:!1,errors:!0,warnings:!0},devServer:{open:!1,setupExitSignals:!0}})}async devServerConfig(){let e=Object.assign({},o.rsConfig.devServer);if(this.isHttps&&(e.https===!0&&delete e.https,!e.server)){let[t,s]=await this.getcert();e.server={type:"https",options:{key:t,cert:s}}}return e}async run(){let e=ks(this.rspackDevConfig);if(!o.rsConfig.devServer){p.error("devServer is not defined in config");return}let t=await this.devServerConfig(),s=new $s(t,e);this.startOpen(),o.empConfig.lifeCycle.beforeDevServe&&await o.empConfig.lifeCycle.beforeDevServe(),await s.start();let r=n=>{let l=n?.toJson({all:!1,colors:!1,assets:!1,chunks:!1,timings:!0});Y(l.time)};o.debug.showPerformance&&e.hooks.afterDone.tap("done",r),s.middleware?.waitUntilValid(n=>{o.debug.showPerformance||r(n),o.empConfig.lifeCycle.afterDevServe&&o.empConfig.lifeCycle.afterDevServe()})}},Ms=new Me});import js from"https";import Ls from"compression";import Ds from"cors";import Ts from"express";var te,wt=h(()=>{"use strict";a();G();te=class extends P{app;async init(){let e=Ts();e.use(Ls()),e.use(Ds()),this.app=e}async server(){if(this.isHttps){let[e,t]=await this.getcert();js.createServer(typeof this.isHttps!="boolean"?this.isHttps:{key:e,cert:t},this.app).listen(this.sf.port,async()=>{this.startOpen(),await this.onReady()})}else this.app.listen(this.sf.port,async()=>{this.startOpen(),await this.onReady()})}async onReady(){}async middleware(){}async start(){await this.init(),await this.middleware(),await this.server()}}});var je={};F(je,{ServeScript:()=>se,default:()=>zs});import Rs from"fs";import As from"fs/promises";import Fs from"path";import Ns from"express";var se,zs,Le=h(()=>{"use strict";a();ee();O();y();wt();se=class extends te{timing=0;async run(){if(this.timing=Date.now(),!Rs.existsSync(o.outDir))return p.sysError(`emp serve must be executed after emp build,${o.outDir} not exist!`);o.empConfig.lifeCycle.beforeServe&&await o.empConfig.lifeCycle.beforeServe(),this.start()}async middleware(){let e=o.resolve(o.rsConfig.output?.path);this.app.use(Ns.static(e));let t=await As.readFile(Fs.join(e,"index.html"),"utf8");this.app.get("*",(s,r)=>r.send(t))}async onReady(){Y(Date.now()-this.timing),o.empConfig.lifeCycle.afterServe&&await o.empConfig.lifeCycle.afterServe()}},zs=new se});var xt={};F(xt,{default:()=>Is});import{rspack as Gs}from"@rspack/core";var De,Is,St=h(()=>{"use strict";a();ee();O();G();y();De=class extends P{isWatchMode=!1;rspackConfig;isuseServe=!1;isStartServe=!1;watchMode(){this.isWatchMode&&this.rspackConfig.optimization&&(this.rspackConfig.optimization.moduleIds="named",this.rspackConfig.optimization.chunkIds="named",this.rspackConfig.watch=!0)}async startServe(){if(!this.isuseServe||this.isStartServe)return;this.isStartServe=!0;let{default:e}=await Promise.resolve().then(()=>(Le(),je));await e.setup("serve",o.cliOptions)}async run(){await o.empConfig.lifeCycle.beforeBuild(),this.isWatchMode=!!o.cliOptions.watch,this.isuseServe=!!o.cliOptions.serve,this.rspackConfig=o.rsConfig,this.isWatchMode&&this.watchMode(),Gs(this.rspackConfig,async(e,t)=>{if(e!==null){p.error(e.stack||e),e.message&&p.error(e.message);return}if(!t){p.red("Stats is Undefined.");return}t.hasErrors()&&(p.error(t.toString({all:!1,colors:!0,errors:!0})),p.red("Failed to compile."),process.exit(1)),t.hasWarnings()&&(p.yellow("Compiled with warnings."),p.warn(t.toString({all:!1,chunks:!1,assets:!1,colors:!0,errors:!0,warnings:!0}))),await bt(t),this.startServe(),await o.empConfig.lifeCycle.afterBulid()})}},Is=new De});a();import{rspack as un}from"@rspack/core";import dn from"html-webpack-plugin";a();y();import Hs from"process";import{program as $}from"commander";function Et(){$.version(o.empPkg.version,"-v, --version").usage("<command> [options]"),$.command("dev").description("Dev \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-rd, --doctor","\u5F00\u542Frsdoctor,\u53EF\u901A\u8FC7debug.rsdoctor\u64CD\u4F5C").option("-h, --hot","\u662F\u5426\u4F7F\u7528\u70ED\u66F4\u65B0 \u9ED8\u8BA4\u542F\u52A8").option("-o, --open","\u662F\u5426\u6253\u5F00\u8C03\u8BD5\u9875\u9762 \u9ED8\u8BA4\u4E0D\u6253\u5F00").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-ev, --env-vars <key=value>","\u5B9A\u4E49\u4E00\u4E2A\u73AF\u5883\u53D8\u91CF -ev key=value \u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u91CD\u590D\u8C03\u7528 -ev key=value -ev key=value",(i,e)=>{let[t,s]=i.split("=");return e[t]=s,e},{}).action(async i=>{let{default:e}=await Promise.resolve().then(()=>(Ct(),vt));await e.setup("dev",i)}),$.command("build").description("Build \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-rd, --doctor","\u5F00\u542Frsdoctor,\u53EF\u901A\u8FC7debug.rsdoctor\u64CD\u4F5C").option("-a, --analyze","\u751F\u6210\u5206\u6790\u62A5\u544A \u9ED8\u8BA4\u4E3A false").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-w, --watch","watch \u6A21\u5F0F").option("-sv, --serve","watch \u6A21\u5F0F\u4E0B\u542F\u52A8serve").option("-ev, --env-vars <key=value>","\u5B9A\u4E49\u4E00\u4E2A\u73AF\u5883\u53D8\u91CF -ev key=value \u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u91CD\u590D\u8C03\u7528 -ev key=value -ev key=value",(i,e)=>{let[t,s]=i.split("=");return e[t]=s,e},{}).action(async i=>{let{default:e}=await Promise.resolve().then(()=>(St(),xt));await e.setup("build",i)}),$.command("serve").description("Server \u6A21\u5F0F").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").action(async i=>{let{default:e}=await Promise.resolve().then(()=>(Le(),je));await e.setup("serve",i)}),$.command("dts").description("\u62C9\u53D6 remote \u9879\u76EE\u7684 d.ts").option("-p, --typingsPath <typingsPath>","\u4E0B\u8F7D\u76EE\u5F55").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").action(i=>{}),$.command("init").description("\u521D\u59CB\u5316 emp \u9879\u76EE").option("-d, --data [data]","JSON\u6570\u636E http\u5730\u5740 \u6216\u8005 \u6587\u4EF6\u8DEF\u5F84\u76F8\u5BF9\u3001\u7EDD\u5BF9\u8DEF\u5F84").action(i=>{}),$.parse(Hs.argv)}a();z();y();import Ot from"fs/promises";import Te from"path";var Bs=/(?:(?:import|export)\s?(?:type)?\s?(?:(?:\{[^;\n]+\})|(?:[^;\n]+))\s?from\s?['"][^;\n]+['"])|(?:import\(['"][^;\n]+?['"]\))/g,Us=/(?:import|export)\s?(?:type)?\s?\{?.+\}?\s?from\s?['"](.+)['"]/,Js=/import\(['"]([^;\n]+?)['"]\)/,Re=class{list=[];outDir=o.resolve("dist");aliasName="@empjs/cli";async setup(e,t){e&&(this.outDir=e),t&&(this.aliasName=t);let s=await this.readDts();await this.writeCode(s)}async readDts(){this.list=await D([`${o.empConfig.build.outDir}/**/*.d.ts`],{windowsPathsNoEscape:!0});let e=[];this.list.map(s=>{s=o.resolve(s),e.push(this.readFile(s))});let t=await Promise.all(e);return t=t.map(s=>this.replaceAliasPath(s)),t}async readFile(e){let t=await Ot.readFile(e,{encoding:"utf-8"});return{src:e,code:t}}replaceAliasPath({src:e,code:t}){t=t.replace(Bs,r=>{let n=r.match(Us);if(n||(n=r.match(Js)),n&&n[1]){let l=n[1];if(!l.startsWith("."))return r;let d=Te.resolve(Te.dirname(e),l).replace(this.outDir,this.aliasName);return r.replace(n[1],d)}return r});let s=e.replace(this.outDir,this.aliasName).replace(".d.ts","");return s.endsWith("/index")&&(s=s.replace("/index","")),t=this.warpDeclareModule(s,t),{code:t,src:e,mod:s}}warpDeclareModule(e,t){return`declare module '${e}' {\r
17
17
  ${t}}\r
18
- `}async writeCode(e){let t="";e.map(s=>{t+=s.code}),await Ot.writeFile(Te.join(this.outDir.replace("dist","types"),"type.d.ts"),t)}},_s=new Fe;y();z();function Cn(i){return i}export{dn as HtmlWebpackPlugin,Cn as defineConfig,_s as dts,Ge as empHelper,un as rspack,Et as runScript,o as store};
18
+ `}async writeCode(e){let t="";e.map(s=>{t+=s.code}),await Ot.writeFile(Te.join(this.outDir.replace("dist","types"),"type.d.ts"),t)}},_s=new Re;y();z();function Cn(i){return i}export{dn as HtmlWebpackPlugin,Cn as defineConfig,_s as dts,Ge as empHelper,un as rspack,Et as runScript,o as store};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empjs/cli",
3
- "version": "3.1.0-beta.2",
3
+ "version": "3.1.0-rc.2",
4
4
  "description": "emp",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -68,19 +68,20 @@
68
68
  "tsup": "^8.1.0"
69
69
  },
70
70
  "dependencies": {
71
- "@module-federation/enhanced": "0.3.3",
72
- "@rspack/core": "1.0.0-beta.1",
73
- "@rspack/dev-server": "1.0.0-beta.1",
71
+ "@module-federation/enhanced": "0.6.0",
72
+ "@rsdoctor/rspack-plugin": "^0.3.11",
73
+ "@rspack/core": "1.0.0",
74
+ "@rspack/dev-server": "1.0.0",
74
75
  "@swc/helpers": "^0.5.12",
75
76
  "address": "^2.0.2",
76
77
  "ansi-html-community": "^0.0.8",
77
78
  "chalk": "^5.3.0",
78
79
  "commander": "^11.1.0",
79
80
  "compression": "^1.7.4",
80
- "core-js": "^3.37.0",
81
+ "core-js": "^3.38.1",
81
82
  "cors": "^2.8.5",
82
83
  "default-gateway": "^7.2.2",
83
- "express": "^4.18.2",
84
+ "express": "^4.19.2",
84
85
  "fs-extra": "^11.2.0",
85
86
  "glob": "^10.3.15",
86
87
  "gzip-size": "^7.0.0",