@empjs/cli 3.9.2-beta.1 → 3.9.2-beta.3

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,17 +1,17 @@
1
- "use strict";var ls=Object.create;var B=Object.defineProperty;var cs=Object.getOwnPropertyDescriptor;var ms=Object.getOwnPropertyNames;var us=Object.getPrototypeOf,hs=Object.prototype.hasOwnProperty;var c=(s,e)=>()=>(s&&(e=s(s=0)),e);var R=(s,e)=>{for(var t in e)B(s,t,{get:e[t],enumerable:!0})},Je=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ms(e))!hs.call(s,r)&&r!==t&&B(s,r,{get:()=>e[r],enumerable:!(i=cs(e,r))||i.enumerable});return s};var l=(s,e,t)=>(t=s!=null?ls(us(s)):{},Je(e||!s||!s.__esModule?B(t,"default",{value:s,enumerable:!0}):t,s)),fs=s=>Je(B({},"__esModule",{value:!0}),s);var o=c(()=>{"use strict"});var d,ds,x,ys,vs,bs,ne,H,Cs,ws,N,pe,xs,ae,L,f,A=c(()=>{"use strict";o();d=l(require("chalk"),1),ds=d.default.hex("#1abc9c"),x=d.default.hex("#16a085"),ys=d.default.hex("#2ecc71"),vs=d.default.hex("#27ae60"),bs=d.default.hex("#e74c3c"),ne=d.default.hex("#c0392b"),H=d.default.hex("#f1c40f"),Cs=d.default.hex("#f39c12"),ws=d.default.hex("#3498db"),N=d.default.hex("#2980b9"),pe=d.default.hex("#ecf0f1"),xs=d.default.hex("#fd79a8"),ae=d.default.hex("#e84393"),L=d.default.hex("#7f8c8d"),f={lightGreen:ds,green:x,lightCyan:ys,cyan:vs,lightRed:bs,red:ne,yellow:H,orange:Cs,lightBlue:ws,blue:N,white:pe,lightMagenta:xs,magenta:ae,gray:L}});var le,n,$=c(()=>{"use strict";o();A();le=class{brandName="";fullName="";logLevel="debug";isLogTime=!1;setup({brandName:e,logLevel:t,fullName:i}){this.brandName=` [${e}] `,this.fullName=` ${i} `,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
- `)};cyan=e=>{console.log(`${f.lightCyan(this.brandName)}${f.cyan(` ${e} `)}
3
- `)};magenta=e=>{console.log(`${f.lightMagenta(this.brandName)}${f.magenta(` ${e} `)}
4
- `)};green=e=>{console.log(`${f.lightGreen(this.brandName)}${f.green(` ${e} `)}
5
- `)};yellow=e=>{console.log(`${f.yellow(this.brandName)}${f.orange(` ${e} `)}
6
- `)};red=e=>{console.log(`${f.lightRed(this.brandName)}${f.red(` ${e} `)}
7
- `)};sysError=e=>{console.log(`${f.lightRed(" System Error Tips ")}${f.red(` ${e} `)}
8
- `)};link=e=>f.blue(e);title=e=>{console.log(`${this.fullName}${f.yellow.underline(`${e}`)}
9
- `)}},n=new le});var ce,Ve,me,Ss,We,qe,Xe,Ke,J=c(()=>{"use strict";o();ce=l(require("fs"),1),Ve=require("jiti"),me=l(require("path"),1);S();$();Ss=["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"],We=(0,Ve.createJiti)(__filename,{interopDefault:!0}),qe=async()=>{n.time("[store]GetEmpConfigPath");let s=Ss.map(i=>me.default.resolve(p.root,i)),e=await Promise.all(s.map(i=>ce.default.promises.access(i).then(()=>!0,()=>!1))),t=s.find((i,r)=>e[r]);return n.timeEnd("[store]GetEmpConfigPath"),t},Xe=async()=>{let s=me.default.join(p.root,"tsconfig.json");return await ce.default.promises.access(s).then(()=>!0,()=>!1)||(s=void 0),s},Ke=()=>{let s=[__filename];return p.rootPaths.pkg&&s.push(p.rootPaths.pkg),p.rootPaths.empConfig&&s.push(p.rootPaths.empConfig),p.rootPaths.tsConfig&&s.push(p.rootPaths.tsConfig),s}});var ge={};R(ge,{clearConsole:()=>he,deepAssign:()=>v,ensureArray:()=>ks,getLanIp:()=>D,getPkgVersion:()=>ue,importJsVm:()=>fe,jsonFilter:()=>Os,timeFormat:()=>V,vCompare:()=>_});function he(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function v(s,...e){for(let t of e)for(let i in t){let r=t[i],a=s[i];if(Object(r)==r&&Object(a)===a){s[i]=v(a,r);continue}s[i]=t[i]}return s}var Qe,Ye,Ze,et,D,ue,ks,Os,_,V,fe,w=c(()=>{"use strict";o();Qe=require("address"),Ye=l(require("chalk"),1),Ze=require("default-gateway"),et=l(require("fs-extra"),1),D=()=>{let s="127.0.0.1";try{let{int:e}=(0,Ze.gateway4sync)();return(0,Qe.ip)(e||"")||s}catch{return s}},ue=s=>{try{let{version:e}=et.default.readJSONSync(s);return e}catch{return}};ks=s=>Array.isArray(s)?s:[s],Os=(s={},e=[])=>Object.keys(s).filter(t=>!e.includes(t)).reduce((t,i)=>(t[i]=s[i],t),{}),_=(s="",e="")=>{let t=s.replace("^","").split("."),i=e.replace("^","").split("."),r=Math.max(t.length,i.length),a=0;for(let u=0;u<r;u++){let h=t.length>u?t[u]:0,y=isNaN(Number(h))?h.charCodeAt():Number(h),j=i.length>u?i[u]:0,g=isNaN(Number(j))?j.charCodeAt():Number(j);if(y<g){a=-1;break}else if(y>g){a=1;break}}return a},V=s=>{s=s/1e3;let e=i=>Ye.default.bold(i);if(s<1)return`${s*1e3} ms`;if(s<10){let i=s>=.01?2:3;return`${e(s.toFixed(i))} s`}if(s<60)return`${e(s.toFixed(1))} s`;let t=s/60;return`${e(t.toFixed(2))} m`},fe=s=>`data:text/javascript,${s}`});var de,tt,ye=c(()=>{"use strict";o();de=l(require("@empjs/chain"),1),tt={rule:{mjs:"mjs",typescript:"typescript",javascript:"javascript",sourceMap:"sourceMapLoader",inline:"inline",raw:"raw",svg:"svg",image:"image",font:"fonts",svga:"svga",sass:"sass",less:"less",css:"css"},use:{swc:"swc",sourceMap:"sourceMapLoader",sass:"sassLoader",less:"lessLoader"},plugin:{tsCheckerRspackPlugin:"TsCheckerRspackPlugin",bundleAnalyzer:"bundleAnalyzerPlugin",define:"definePlugin",copy:"copyRspackPlugin",progress:"progressPlugin",html:{prefix:"html-plugin-"},rsdoctor:"rsdoctor",sourceMapDevTool:"sourceMapDevTool"},minimizer:{minJs:"minJs",minCss:"minCss"}}});var ve={};R(ve,{chalk:()=>st.default,color:()=>f,glob:()=>F.glob,logger:()=>n,utils:()=>ge});var st,F,z=c(()=>{"use strict";o();st=l(require("chalk"),1),F=require("glob");A();$();w()});var W,it=c(()=>{"use strict";o();W=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){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 be,rt,ot=c(()=>{"use strict";o();z();J();w();it();be=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},v(e,t)}isESM=!1;checkIsESM(e){return["es3","es5"].indexOf(e)===-1}lifeCycle;async setup(e){this.store=e,await this.syncEmpOptions(),await this.setupEmpOptions(),this.lifeCycle=new W(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:i,appEntry:r}=this.store.empOptions;t&&(this.appSrc=t),i&&(this.base=i),r&&(this.appEntry=r)}async setupEmpOptions(){await this.store.server.setupOnEmpOptionSync()}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={}),this.assign({loggerLevel:"info",clearLog:!1,progress:!0,showRsconfig:!1,showPerformance:!1,rsdoctor:e,infrastructureLogging:{appendOnly:!0,level:"warn"},newTreeshaking:this.store.empConfig.isESM,devShowAllLog:!1,showScriptDebug:!1,parallelCodeSplitting:!0,cssChunkingPlugin:!0,warnRuleAsWarning:!0},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:{mode:void 0,entryCdn:void 0,splitChunks:!1,include:[],coreJsFeatures:"stable",externalHelpers:!1,browserslist:this.store.browserslistOptions.default},swcConfig:{},devtool:this.store.isDev?"cheap-module-source-map":"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,cache:this.cache!==!1,tags:[]},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&&(this.store.server.httpsType="h2",delete this.store.empOptions.server.http2),this.assign(e,this.store.empOptions.server)}get css(){return this.assign({sass:{mode:"modern",warnRuleAsWarning:this.store.empConfig.debug.warnRuleAsWarning},prifixName:""},this.store.empOptions.css)}get output(){let e=(this.store.isDev,".[contenthash:8]"),t=this.store.isDev?"":".[contenthash:8]",{assetsDir:i,staticDir:r}=this.store.empConfig.build,a={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}${i}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!this.store.isDev,uniqueName:this.store.uniqueName};return this.assign(a,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)}get tsCheckerRspackPlugin(){let e={};if(this.store.empOptions.tsCheckerRspackPlugin)typeof this.store.empOptions.tsCheckerRspackPlugin=="object"&&(e=this.store.empOptions.tsCheckerRspackPlugin);else return!1;return this.assign({},e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",i={};return Object.keys(e).map(r=>{t==="all"?(i[`import.meta.env.${r}`]=JSON.stringify(e[r]),i[`process.env.${r}`]=JSON.stringify(e[r])):t==="esm"?i[`import.meta.env.${r}`]=JSON.stringify(e[r]):t==="cjs"?i[`process.env.${r}`]=JSON.stringify(e[r]):t==="none"&&(i[`${r}`]=JSON.stringify(e[r]))}),i}get externals(){return this.assign({},this.store.empOptions.externals)}get resolve(){return v({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(){if(n.time("[store][empConfig]SyncEmpOptions"),!this.store.rootPaths.empConfig)return;let e=await We(this.store.rootPaths.empConfig);typeof e=="function"?this.store.empOptions=await e(this.store):this.store.empOptions=e||{},n.timeEnd("[store][empConfig]SyncEmpOptions")}get moduleTransformRule(){let{moduleTransform:e}=this.store.empOptions,t=this.assign({defaultExclude:!1},e),i={and:[],not:[]};return t.defaultExclude===!0&&i.and.push(/(node_modules|bower_components)/),t?.exclude&&(i.and=i.and.concat(t.exclude)),e?.include&&(i.not=t.include),i}get cacheDir(){return this.store.empOptions.cacheDir?this.store.empOptions.cacheDir:"node_modules/.emp-cache"}get cache(){return this.store.empOptions.cache===!1?!1:this.store.empOptions.cache?this.store.empOptions.cache:"persistent"}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}},rt=new be});var nt,Ce,pt,at=c(()=>{"use strict";o();nt=l(require("fs-extra"),1);J();Ce=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({name:this.store.pkg.name,node:{global:!0},experiments:{nativeWatcher:!1,outputModule:this.store.empConfig.isESM,topLevelAwait:!0,asyncWebAssembly:!0,css:!0,rspackFuture:{bundlerInfo:{force:!1}},cache:{type:this.store.empConfig.cache==="persistent"?"persistent":"memory",buildDependencies:Ke(),version:this.store.empPkg.version},incremental:"advance-silent",parallelCodeSplitting:this.store.empConfig.debug.parallelCodeSplitting,parallelLoader:!0},target:this.store.empConfig.target,infrastructureLogging:this.store.empConfig.debug.infrastructureLogging,context:this.store.root,mode:this.store.mode,cache:!!this.store.empConfig.cache,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 nt.default.exists(e)){let i={};this.store.isOldRspack?i.tsConfigPath=e:i.tsConfig=e,this.store.merge({resolve:i})}}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.mode==="entry"&&this.store.empConfig.build.polyfill.splitChunks&&!this.store.empConfig.build.polyfill.entryCdn&&(e.splitChunks.cacheGroups.coreJs={test:/[\\/]node_modules[\\/](core-js)[\\/]/,name:"coreJs",chunks:"all",enforce:!0}),this.store.chain.merge({optimization:e})}},pt=new Ce});var we,lt,ct=c(()=>{"use strict";o();we=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,i={},{sass:r}=this.store.empConfig.css;r.mode==="modern"&&(i.implementation=r.implementation?r.implementation:require.resolve("sass-embedded"),i.api="modern-compiler",i.sourceMap=this.store.empConfig.build.sourcemap,r.sassOptions&&(i.sassOptions=r.sassOptions)),typeof r.warnRuleAsWarning<"u"&&(i.warnRuleAsWarning=r.warnRuleAsWarning),typeof r.webpackImporter<"u"&&(i.webpackImporter=r.webpackImporter),this.store.chain.merge({module:{rule:{[e.sass]:{test:/\.(sass|scss)$/,use:{[t.sass]:{loader:require.resolve("sass-loader"),options:i}},type:"css/auto"}}}})}async less(){let{rule:e,use:t}=this.store.chainName,i={loader:require.resolve("less-loader"),options:{lessOptions:{javascriptEnabled:!0}}};this.store.chain.merge({module:{rule:{[e.less]:{test:/\.less$/,use:{[t.less]:i},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"}}}})}},lt=new we});function Ps(){let s=[`import 'core-js/${p.empConfig.build.polyfill.coreJsFeatures}'`].join(`
10
- `);return fe(s)}var X,q,G,K=c(()=>{"use strict";o();X=l(require("html-webpack-plugin"),1);w();S();q=class{constructor(){}apply(e){let{webpack:t}=e;p.empConfig.build.polyfill.entryCdn||new t.EntryPlugin(e.context,Ps(),{name:void 0}).apply(e)}},G=class{PluginName="HtmlEmpInjectPlugin";chunk="";files=[];constructor(e,t="",i=""){this.PluginName=`${this.PluginName}-${t}`,this.files=e,this.chunk=i}apply(e){e.hooks.compilation.tap(this.PluginName,t=>{X.default.getHooks(t).alterAssetTagGroups.tapPromise(this.PluginName,async i=>(this.chunk&&!i.plugin.userOptions.chunks?.includes(this.chunk)||this.files.map(r=>{let{pos:a,...u}=r;(a==="body"?i.bodyTags:i.headTags).push({attributes:{},voidTag:!1,meta:{plugin:void 0},tagName:"script",...u})}),i))})}}});var b,xe,mt,ut=c(()=>{"use strict";o();b=l(require("path"),1);z();K();xe=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),this.prepareAndSetAsset(e),e}prepareAndSetAsset(e){let t=e.chunks?e.chunks[0]:void 0;this.store.injectTags(e.tags,t?`injectTags-${t}`:"injectTags",t),delete e.tags}injectPolyfill(){if(!this.store.empConfig.build.polyfill.entryCdn)return;let e=[{attributes:{src:this.store.empConfig.build.polyfill.entryCdn},tagName:"script",pos:"head"}];this.store.injectTags(e,"injectEMPPolyfill")}setChunk(e){return e.replace(b.default.extname(e),"").replace(`${this.store.empConfig.appSrc}${b.default.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(b.default.join("template","index.html"))}setFavicion(e){if(e!=="")return e?this.store.resolve(e):this.store.empResolve(b.default.join("template","favicon.ico"))}setEntryItem(e,t,i){i=i||this.store.resolve(b.default.join(this.store.empConfig.appSrc,e));let r=this.setChunk(e),a=[i];this.entriesConfig[r]={entry:{[r]:a},html:this.setHtmlConfig(t,[r])},this.store.entries[r]=a}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`${this.store.chainName.plugin.html.prefix}${t}`).use(X.default,[e])}setRspackEntry(e){this.store.merge({entry:e})}async init(){this.injectPolyfill(),this.store.empConfig.autoPages?await this.setAutoPage():(await this.setDefaultEntry(),this.setEntryByConfig())}async setAutoPage(){n.time("setAutoPage");let e=this.store.empConfig.autoPages?.path||"pages",t=b.default.join(this.store.appSrc,e),i=b.default.join(t,"**","*.{ts,tsx,jsx,js}"),r=await(0,F.glob)([i],{windowsPathsNoEscape:!0});r=r.map(a=>a.replace(`${t}${b.default.sep}`,"")),r.map(a=>{let u=this.store.empConfig.entries[a]||{};this.setEntryItem(a,{...this.store.empConfig.html,...u},b.default.join(t,a))}),n.timeEnd("setAutoPage")}async setDefaultEntry(){n.time("[store][empConfig]SetDefaultEntry");let e=b.default.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}"),t=await(0,F.glob)([e],{windowsPathsNoEscape:!0});if(t[0]){let i=b.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(i,this.store.empConfig.html,t[0])}n.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 xe});var Se,ke,ht,ft=c(()=>{"use strict";o();Se=l(require("path"),1);w();ke=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.empConfig.css?.prifixName?`${this.store.empConfig.css?.prifixName}-`:"",t=this.store.isDev?`${e}[path][name]-[local]-[hash:5]`:`${e}[local]-[hash:5]`;this.store.chain.merge({module:{generator:{"css/auto":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:t,esModule:!0},css:{exportsOnly:!1,esModule:!0},"css/module":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:t,esModule:!0},json:{JSONParse:!0}}}})}rspackParser(){this.store.chain.merge({module:{parser:{javascript:{dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,url:!0,importMeta:!0},css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return!!this.store.empConfig.build.polyfill.mode}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,polyfill:i}=this.store.empConfig.build,{externalHelpers:r}=i;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:r,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:v(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.polyfill.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill.mode),this.store.empConfig.build.polyfill.mode==="usage"&&(t.env.shippedProposals=!0,t.env.include=this.store.empConfig.build.polyfill.include)),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build.polyfill;e&&this.store.chain.resolve.alias.set("@swc/helpers",Se.default.dirname(require.resolve("@swc/helpers/package.json"))),this.coreJs.path=require.resolve("core-js/package.json");let t=ue(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=Se.default.dirname(this.coreJs.path),this.store.empConfig.build.polyfill.mode&&(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:i}=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:{[i.swc]:{loader:"builtin:swc-loader",options:this.swcTsOptions}}},[t.javascript]:{test:/\.((m|c)?js|jsx)$/,exclude:e,use:{[i.swc]:{loader:"builtin:swc-loader",options:this.swcJsOptions}}}}}})}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.raw]:{resourceQuery:/raw/,type:"asset/source"}}}}),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"}}}})}},ht=new ke});var P,Oe,gt,Pe,dt,yt=c(()=>{"use strict";o();P=l(require("@rspack/core"),1),Oe=l(require("fs"),1),gt=require("ts-checker-rspack-plugin");K();Pe=class{store;async setup(e){this.store=e;let t=[this.define(),this.anylayze(),this.progress(),this.copy(),this.minify(),this.redoctor(),this.tsCheckerRspackPlugin(),this.cssChunkingPlugin()];this.beforeLifeCycle(),await this.store.empConfig.lifeCycle.beforePlugin(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterPlugin()}beforeLifeCycle(){let{store:e}=this;e.empConfig.build.polyfill.mode==="entry"&&e.chain.plugin("empPolyfill").use(q)}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"}])}tsCheckerRspackPlugin(){if(this.store.empConfig.tsCheckerRspackPlugin===!1)return!1;this.store.chain.plugin(this.store.chainName.plugin.tsCheckerRspackPlugin).use(gt.TsCheckerRspackPlugin,[this.store.empConfig.tsCheckerRspackPlugin])}async define(){this.store.chain.plugin(this.store.chainName.plugin.define).use(P.default.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");Oe.default.existsSync(e)&&Oe.default.readdirSync(e).length>0&&this.store.chain.plugin(this.store.chainName.plugin.copy).use(P.default.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve(this.store.empConfig.build.outDir),noErrorOnMissing:!0,globOptions:{ignore:["**/.DS_Store"]}}]}])}async progress(){if(!this.store.empConfig.debug.progress)return;let e={};this.store.isOldRspack||(e={template:"{bar:25.green/white}{spinner:.green}{percent}% {wide_msg:.dim}",tick:void 0,progressChars:"\u25A9\u25A9"}),this.store.chain.plugin(this.store.chainName.plugin.progress).use(P.default.ProgressPlugin,[e])}minify(){this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minJs).use(P.default.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]);let{SwcCssMinimizerRspackPlugin:e,LightningCssMinimizerRspackPlugin:t}=P.default;e?this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(e,[this.store.empConfig.build.cssminOptions]):t&&this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(t,[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])}sourceMapDevToolPlugin(){if(!this.store.empConfig.build.sourcemap)return;let e={};typeof this.store.empConfig.build.sourcemap=="object"&&(e=this.store.empConfig.build.sourcemap),this.store.chain.plugin(this.store.chainName.plugin.sourceMapDevTool).use(P.default.SourceMapDevToolPlugin,[e])}circularDependency(){this.store.chain.plugin("circularDependency").use(P.default.CircularDependencyRspackPlugin,[{}])}cssChunkingPlugin(){this.store.empConfig.debug.cssChunkingPlugin&&this.store.chain.plugin("CssChunkingPlugin").use(P.default.experiments.CssChunkingPlugin,[{}])}},dt=new Pe});var Ee,vt,bt=c(()=>{"use strict";o();at();ct();ut();ft();yt();Ee=class{store;async setup(e){this.store=e;let t=[pt.setup(this.store),ht.setup(this.store),dt.setup(this.store),mt.setup(this.store),lt.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()}},vt=new Ee});async function Q(s,e=void 0){if(s!==Es&&(s<Ct||s>je))throw new Error(`Port number must lie between ${Ct} and ${je}`);let t=s,i=js(),r;e&&!i.has(e)?r=new Set([e]):r=i;let a=new Set(["EADDRINUSE","EACCES"]);for(;t<=je;)try{return await Ts(t,r)}catch(u){if(!a.has(u.code))throw u;t+=1}throw new Error("No available ports found")}var wt,xt,Ct,je,Es,js,$s,Ts,St=c(()=>{"use strict";o();wt=l(require("net"),1),xt=l(require("os"),1),Ct=1024,je=65535,Es=443,js=()=>{let s=xt.default.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(s))if(t)for(let i of t)e.add(i.address);return e},$s=(s,e)=>new Promise((t,i)=>{let r=wt.default.createServer();r.unref(),r.on("error",i),r.listen(s,e,()=>{let{port:a}=r.address();r.close(()=>{t(a)})})}),Ts=async(s,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let i of e)try{await $s(s,i)}catch(r){if(!t.has(r.code))throw r}return s}});var kt,$e,Te,Y,Ot=c(()=>{"use strict";o();kt=l(require("chalk"),1);A();$e=l(require("url"),1);w();Te=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==="::",i;if(t){i="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 i=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(i),this.urls.localUrlForBrowser=this.formatUrl(i)}getLanIp=D;formatUrl(e){let{protocol:t,port:i,pathname:r}=this.imf;return $e.default.format({protocol:t,hostname:e,port:i,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:i,pathname:r}=this.imf;return $e.default.format({protocol:t,hostname:e,port:kt.default.bold(i),pathname:r})}},Y=new Te});var Et,jt,$t,Pt,Ds,Rs,Tt,Dt=c(()=>{"use strict";o();Et=require("child_process"),jt=require("util");S();$();$t=(0,jt.promisify)(Et.exec),Pt=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],Ds=async()=>{let s=process.env.BROWSER;if(!s||!Pt.includes(s)){let{stdout:e}=await $t("ps cax");s=Pt.find(t=>e.includes(t))}return s},Rs=async s=>{if(process.platform==="darwin")try{let t=await Ds();if(t){let i=`osascript openChrome.applescript "${encodeURI(s)}" "${t}"`;return await $t(i,{cwd:p.resource.dir}),!0}}catch(t){n.debug(t)}try{let{default:t}=await import("open");return await t(s),!0}catch(t){return n.error("Failed to open start URL."),n.error(t),!1}},Tt=Rs});var De,Z,Rt=c(()=>{"use strict";o();De=l(require("fs/promises"),1);z();A();St();Ot();Dt();w();Z=class{ip=D();host=this.ip;isAutoDevBase=!1;isHttps=!1;httpsType="default";protocol="http";port=8e3;store;publicPath="/";publicHasHttp=!1;isOpenBrower=!1;url="";urls={localUrlForBrowser:"",localUrlForTerminal:"",lanUrlForTerminal:"",lanUrlForConfig:""};constructor(e){this.store=e}async setupOnEmpOptionSync(){this.store.cliAction!=="build"&&(this.port=await Q(this.port),this.setHttps(),await this.setAutoDevBase())}get config(){return{}}async setupOnStore(){if(this.store.cliAction==="build")return;let{store:e}=this;this.publicPath=e.rsConfig.output?.publicPath==="auto"?"/":e.rsConfig.output?.publicPath||"/",this.isOpenBrower=!!e.empConfig.server.open,this.protocol=this.isHttps?"https":"http",this.host=e.empConfig.server.host?e.empConfig.server.host:this.ip,e.empConfig.server.port&&e.empConfig.server.port!==this.port&&(this.port=await Q(e.empConfig.server.port)),Y.setup(this),this.publicPath&&(this.publicPath.indexOf("http://")>-1||this.publicPath.indexOf("https://")>-1)?(this.url=this.publicPath,this.publicHasHttp=!0,this.urls.localUrlForTerminal=Y.prettyPrintUrl("localhost")):(this.urls=Y.urls,this.url=this.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this;this.publicHasHttp?(n.info(`${x("\u279C")} Local: ${n.link(e.localUrlForTerminal)}`),n.info(`${x("\u279C")} Network: ${n.link(this.publicPath)}`)):(n.info(`${x("\u279C")} Local: ${n.link(e.localUrlForTerminal)}`),n.info(`${x("\u279C")} Network: ${n.link(e.lanUrlForTerminal)}
11
- `)),this.isOpenBrower&&Tt(this.url)}async getcert(){let{store:e}=this,t=this.store.rsConfig.devServer||{server:{type:"http"}};if(typeof t.server=="object"&&t.server.type==="https"&&t.server.options&&t.server.options.key&&t.server.options.cert)return t.server.options;let[i,r]=await Promise.all([De.default.readFile(e.resource.key),De.default.readFile(e.resource.cert)]);return{key:i,cert:r}}setHttps(){let{store:e}=this,{server:t,https:i}=e.empOptions.server||{};this.isHttps=t==="https"||typeof t=="object"&&t.type==="https"||i===!0}async setAutoDevBase(){let{store:e}=this;this.isAutoDevBase=!!e.empOptions.autoDevBase&&e.mode==="development"&&!this.isHttpBase,this.isAutoDevBase&&(this.protocol=this.isHttps?"https":"http",e.empOptions.server?.port&&(this.port=e.empOptions.server.port),this.port=await Q(this.port),e.empOptions.base=`${this.protocol}://${this.host}:${this.port}/`,e.empOptions.server=e.deepAssign({port:this.port,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${this.host}:${this.port}/ws`}},e.empOptions.server))}get isHttpBase(){let e=this.store.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}}});var Nt,C,Lt,At,Re,p,S=c(()=>{"use strict";o();Nt=l(require("fs/promises"),1),C=l(require("path"),1),Lt=l(require("util"),1),At=require("@rspack/core");J();$();w();ye();ot();bt();Rt();ye();K();Re=class{rspackVersion=At.rspack.rspackVersion;isOldRspack=_(this.rspackVersion,"1.0.0")===-1;empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=C.default.resolve(__dirname,__filename).replace(`${C.default.sep}dist${C.default.sep}index.js`,"");empSource=C.default.resolve(this.empRoot,"dist");resolve=e=>C.default.isAbsolute(e)?e:C.default.resolve(this.root,e);empResolve=e=>C.default.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};chainName=tt;server=new Z(this);cacheDir="";mode="development";cliMode="dev";isDev=!0;cliOptions;chain;rsConfig;empOptions={};empConfig;entries={};debug;cliAction;rootPaths={empConfig:void 0,tsConfig:void 0,pkg:void 0};async setup(e,t){n.time("[store]Setup");let[i,r]=await Promise.all([qe(),Xe()]);this.rootPaths.empConfig=i,this.rootPaths.tsConfig=r,this.rootPaths.pkg=this.resolve("package.json"),await this.initVars(e,t),this.empConfig=rt,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new de.default,await vt.setup(this),this.setLogger(),this.toConfig(),this.logConfig(),await this.server.setupOnStore(),n.timeEnd("[store]Setup")}async initVars(e,t){this.cliAction=e,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 i=require(this.empResolve("package.json")),r=require(this.resolve("package.json"));this.empPkg={...this.empPkg,...i},this.pkg={...this.pkg,...r},this.resource.dir=C.default.join(this.empRoot,"resource"),this.resource.cert=C.default.join(this.resource.dir,"emp.cert"),this.resource.key=C.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)}loggerExtensionName="";setLoggerExtensionName(e){this.loggerExtensionName=e}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),n.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}${this.loggerExtensionName?" "+this.loggerExtensionName:""}`,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=C.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"?v(e,this.debug.showRsconfig):e;console.log(n.link("[Compile Config]")),console.log(Lt.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.encodeVarName(this.pkg.name)}encodeVarName(e){return e.replaceAll("/","_").replaceAll("@","_").replaceAll("-","_")}vCompare=_;deepAssign=v;getLanIp=D;injectTags(e=[],t="",i=""){this.chain.plugin(`${G}-${t}`).use(G,[e,t,i])}},p=new Re});function Gs(s,e){let t=[s,e],i=["File","Size","Gzipped"].reduce((r,a,u)=>{let h=t[u],y=a;return h&&(y=a.length<h?a+" ".repeat(h-a.length):a),`${r+y} `}," ");console.log(N.bold(i))}async function zt(s){let e=s.toJson({all:!1,assets:!0,timings:!0}),i=e.assets.filter(g=>Ms(g.name)).map(zs);i.sort((g,O)=>g.size-O.size);let r=Math.max(...i.map(g=>g.sizeLabel.length)),a=Math.max(...i.map(g=>(g.folder+E.default.sep+g.name).length));Gs(a,r);let u=0,h=0;i.forEach(g=>{let{sizeLabel:O}=g,{name:ns,folder:ps,gzipSizeLabel:as}=g,Ue=(ps+E.default.sep+ns).length,Be=O.length;if(u+=g.size,h+=g.gzippedSize,Be<r){let oe=" ".repeat(r-Be);O+=oe}let He=L(g.folder+E.default.sep)+Is(g.name);if(Ue<a){let oe=" ".repeat(a-Ue);He+=oe}n.info(` ${He} ${L(O)} ${as}`)});let y=`${N.bold("Total size:")} ${ee(u)}`,j=`${N.bold("Gzipped size:")} ${ee(h)}`;n.info(`
1
+ "use strict";var cs=Object.create;var H=Object.defineProperty;var ms=Object.getOwnPropertyDescriptor;var us=Object.getOwnPropertyNames;var hs=Object.getPrototypeOf,fs=Object.prototype.hasOwnProperty;var c=(s,e)=>()=>(s&&(e=s(s=0)),e);var R=(s,e)=>{for(var t in e)H(s,t,{get:e[t],enumerable:!0})},Je=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of us(e))!fs.call(s,r)&&r!==t&&H(s,r,{get:()=>e[r],enumerable:!(i=ms(e,r))||i.enumerable});return s};var l=(s,e,t)=>(t=s!=null?cs(hs(s)):{},Je(e||!s||!s.__esModule?H(t,"default",{value:s,enumerable:!0}):t,s)),gs=s=>Je(H({},"__esModule",{value:!0}),s);var o=c(()=>{"use strict"});var d,ys,x,vs,bs,Cs,pe,J,ws,xs,N,ae,Ss,le,L,h,A=c(()=>{"use strict";o();d=l(require("chalk"),1),ys=d.default.hex("#1abc9c"),x=d.default.hex("#16a085"),vs=d.default.hex("#2ecc71"),bs=d.default.hex("#27ae60"),Cs=d.default.hex("#e74c3c"),pe=d.default.hex("#c0392b"),J=d.default.hex("#f1c40f"),ws=d.default.hex("#f39c12"),xs=d.default.hex("#3498db"),N=d.default.hex("#2980b9"),ae=d.default.hex("#ecf0f1"),Ss=d.default.hex("#fd79a8"),le=d.default.hex("#e84393"),L=d.default.hex("#7f8c8d"),h={lightGreen:ys,green:x,lightCyan:vs,cyan:bs,lightRed:Cs,red:pe,yellow:J,orange:ws,lightBlue:xs,blue:N,white:ae,lightMagenta:Ss,magenta:le,gray:L}});var F,n,O=c(()=>{"use strict";o();A();F=class{brandName="";fullName="";logLevel="debug";isLogTime=!1;setup({brandName:e,logLevel:t,fullName:i}){this.brandName=` [${e}] `,this.fullName=` ${i} `,this.fullName=h.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(`${h.lightBlue(this.brandName)}${h.blue(` ${e} `)}
2
+ `)};cyan=e=>{console.log(`${h.lightCyan(this.brandName)}${h.cyan(` ${e} `)}
3
+ `)};magenta=e=>{console.log(`${h.lightMagenta(this.brandName)}${h.magenta(` ${e} `)}
4
+ `)};green=e=>{console.log(`${h.lightGreen(this.brandName)}${h.green(` ${e} `)}
5
+ `)};yellow=e=>{console.log(`${h.yellow(this.brandName)}${h.orange(` ${e} `)}
6
+ `)};red=e=>{console.log(`${h.lightRed(this.brandName)}${h.red(` ${e} `)}
7
+ `)};sysError=e=>{console.log(`${h.lightRed(" System Error Tips ")}${h.red(` ${e} `)}
8
+ `)};link=e=>h.blue(e);title=e=>{console.log(`${this.fullName}${h.yellow.underline(`${e}`)}
9
+ `)}},n=new F});var ce,Ve,me,ks,We,qe,Xe,Ke,_=c(()=>{"use strict";o();ce=l(require("fs"),1),Ve=require("jiti"),me=l(require("path"),1);S();O();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"],We=(0,Ve.createJiti)(__filename,{interopDefault:!0}),qe=async()=>{n.time("[store]GetEmpConfigPath");let s=ks.map(i=>me.default.resolve(p.root,i)),e=await Promise.all(s.map(i=>ce.default.promises.access(i).then(()=>!0,()=>!1))),t=s.find((i,r)=>e[r]);return n.timeEnd("[store]GetEmpConfigPath"),t},Xe=async()=>{let s=me.default.join(p.root,"tsconfig.json");return await ce.default.promises.access(s).then(()=>!0,()=>!1)||(s=void 0),s},Ke=()=>{let s=[__filename];return p.rootPaths.pkg&&s.push(p.rootPaths.pkg),p.rootPaths.empConfig&&s.push(p.rootPaths.empConfig),p.rootPaths.tsConfig&&s.push(p.rootPaths.tsConfig),s}});var ge={};R(ge,{clearConsole:()=>he,deepAssign:()=>v,ensureArray:()=>Os,getLanIp:()=>D,getPkgVersion:()=>ue,importJsVm:()=>fe,jsonFilter:()=>Ps,timeFormat:()=>W,vCompare:()=>V});function he(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function v(s,...e){for(let t of e)for(let i in t){let r=t[i],a=s[i];if(Object(r)==r&&Object(a)===a){s[i]=v(a,r);continue}s[i]=t[i]}return s}var Qe,Ye,Ze,et,D,ue,Os,Ps,V,W,fe,w=c(()=>{"use strict";o();Qe=require("address"),Ye=l(require("chalk"),1),Ze=require("default-gateway"),et=l(require("fs-extra"),1),D=()=>{let s="127.0.0.1";try{let{int:e}=(0,Ze.gateway4sync)();return(0,Qe.ip)(e||"")||s}catch{return s}},ue=s=>{try{let{version:e}=et.default.readJSONSync(s);return e}catch{return}};Os=s=>Array.isArray(s)?s:[s],Ps=(s={},e=[])=>Object.keys(s).filter(t=>!e.includes(t)).reduce((t,i)=>(t[i]=s[i],t),{}),V=(s="",e="")=>{let t=s.replace("^","").split("."),i=e.replace("^","").split("."),r=Math.max(t.length,i.length),a=0;for(let u=0;u<r;u++){let f=t.length>u?t[u]:0,y=isNaN(Number(f))?f.charCodeAt():Number(f),j=i.length>u?i[u]:0,g=isNaN(Number(j))?j.charCodeAt():Number(j);if(y<g){a=-1;break}else if(y>g){a=1;break}}return a},W=s=>{s=s/1e3;let e=i=>Ye.default.bold(i);if(s<1)return`${s*1e3} ms`;if(s<10){let i=s>=.01?2:3;return`${e(s.toFixed(i))} s`}if(s<60)return`${e(s.toFixed(1))} s`;let t=s/60;return`${e(t.toFixed(2))} m`},fe=s=>`data:text/javascript,${s}`});var de,tt,ye=c(()=>{"use strict";o();de=l(require("@empjs/chain"),1),tt={rule:{mjs:"mjs",typescript:"typescript",javascript:"javascript",sourceMap:"sourceMapLoader",inline:"inline",raw:"raw",svg:"svg",image:"image",font:"fonts",svga:"svga",sass:"sass",less:"less",css:"css"},use:{swc:"swc",sourceMap:"sourceMapLoader",sass:"sassLoader",less:"lessLoader"},plugin:{tsCheckerRspackPlugin:"TsCheckerRspackPlugin",bundleAnalyzer:"bundleAnalyzerPlugin",define:"definePlugin",copy:"copyRspackPlugin",progress:"progressPlugin",html:{prefix:"html-plugin-"},rsdoctor:"rsdoctor",sourceMapDevTool:"sourceMapDevTool"},minimizer:{minJs:"minJs",minCss:"minCss"}}});var ve={};R(ve,{chalk:()=>st.default,color:()=>h,glob:()=>z.glob,logger:()=>n,utils:()=>ge});var st,z,G=c(()=>{"use strict";o();st=l(require("chalk"),1),z=require("glob");A();O();w()});var q,it=c(()=>{"use strict";o();q=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){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 be,rt,ot=c(()=>{"use strict";o();G();_();w();it();be=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},v(e,t)}isESM=!1;checkIsESM(e){return["es3","es5"].indexOf(e)===-1}lifeCycle;async setup(e){this.store=e,await this.syncEmpOptions(),await this.setupEmpOptions(),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:i,appEntry:r}=this.store.empOptions;t&&(this.appSrc=t),i&&(this.base=i),r&&(this.appEntry=r)}async setupEmpOptions(){await this.store.server.setupOnEmpOptionSync()}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={}),this.assign({loggerLevel:"info",clearLog:!1,progress:!0,showRsconfig:!1,showPerformance:!1,rsdoctor:e,infrastructureLogging:{appendOnly:!0,level:"warn"},newTreeshaking:this.store.empConfig.isESM,devShowAllLog:!1,showScriptDebug:!1,parallelCodeSplitting:!0,cssChunkingPlugin:!0,warnRuleAsWarning:!0},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:{mode:void 0,entryCdn:void 0,splitChunks:!1,include:[],coreJsFeatures:"stable",externalHelpers:!1,browserslist:this.store.browserslistOptions.default},swcConfig:{},devtool:this.store.isDev?"cheap-module-source-map":"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,cache:this.cache!==!1,tags:[]},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&&(this.store.server.httpsType="h2",delete this.store.empOptions.server.http2),this.assign(e,this.store.empOptions.server)}get css(){return this.assign({sass:{mode:"modern",warnRuleAsWarning:this.store.empConfig.debug.warnRuleAsWarning},prifixName:""},this.store.empOptions.css)}get output(){let e=(this.store.isDev,".[contenthash:8]"),t=this.store.isDev?"":".[contenthash:8]",{assetsDir:i,staticDir:r}=this.store.empConfig.build,a={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}${i}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!this.store.isDev,uniqueName:this.store.uniqueName};return this.assign(a,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)}get tsCheckerRspackPlugin(){let e={};if(this.store.empOptions.tsCheckerRspackPlugin)typeof this.store.empOptions.tsCheckerRspackPlugin=="object"&&(e=this.store.empOptions.tsCheckerRspackPlugin);else return!1;return this.assign({},e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",i={};return Object.keys(e).map(r=>{t==="all"?(i[`import.meta.env.${r}`]=JSON.stringify(e[r]),i[`process.env.${r}`]=JSON.stringify(e[r])):t==="esm"?i[`import.meta.env.${r}`]=JSON.stringify(e[r]):t==="cjs"?i[`process.env.${r}`]=JSON.stringify(e[r]):t==="none"&&(i[`${r}`]=JSON.stringify(e[r]))}),i}get externals(){return this.assign({},this.store.empOptions.externals)}get resolve(){return v({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(){if(n.time("[store][empConfig]SyncEmpOptions"),!this.store.rootPaths.empConfig)return;let e=await We(this.store.rootPaths.empConfig);typeof e=="function"?this.store.empOptions=await e(this.store):this.store.empOptions=e||{},n.timeEnd("[store][empConfig]SyncEmpOptions")}get moduleTransformRule(){let{moduleTransform:e}=this.store.empOptions,t=this.assign({defaultExclude:!1},e),i={and:[],not:[]};return t.defaultExclude===!0&&i.and.push(/(node_modules|bower_components)/),t?.exclude&&(i.and=i.and.concat(t.exclude)),e?.include&&(i.not=t.include),i}get cacheDir(){return this.store.empOptions.cacheDir?this.store.empOptions.cacheDir:"node_modules/.emp-cache"}get cache(){return this.store.empOptions.cache===!1?!1:this.store.empOptions.cache?this.store.empOptions.cache:"persistent"}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}},rt=new be});var nt,Ce,pt,at=c(()=>{"use strict";o();nt=l(require("fs-extra"),1);_();Ce=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({name:this.store.pkg.name,node:{global:!0},experiments:{nativeWatcher:!1,outputModule:this.store.empConfig.isESM,topLevelAwait:!0,asyncWebAssembly:!0,css:!0,rspackFuture:{bundlerInfo:{force:!1}},cache:{type:this.store.empConfig.cache==="persistent"?"persistent":"memory",buildDependencies:Ke(),version:this.store.empPkg.version},incremental:"advance-silent",parallelCodeSplitting:this.store.empConfig.debug.parallelCodeSplitting,parallelLoader:!0},target:this.store.empConfig.target,infrastructureLogging:this.store.empConfig.debug.infrastructureLogging,context:this.store.root,mode:this.store.mode,cache:!!this.store.empConfig.cache,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 nt.default.exists(e)){let i={};this.store.isOldRspack?i.tsConfigPath=e:i.tsConfig=e,this.store.merge({resolve:i})}}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.mode==="entry"&&this.store.empConfig.build.polyfill.splitChunks&&!this.store.empConfig.build.polyfill.entryCdn&&(e.splitChunks.cacheGroups.coreJs={test:/[\\/]node_modules[\\/](core-js)[\\/]/,name:"coreJs",chunks:"all",enforce:!0}),this.store.chain.merge({optimization:e})}},pt=new Ce});var we,lt,ct=c(()=>{"use strict";o();we=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,i={},{sass:r}=this.store.empConfig.css;r.mode==="modern"&&(i.implementation=r.implementation?r.implementation:require.resolve("sass-embedded"),i.api="modern-compiler",i.sourceMap=this.store.empConfig.build.sourcemap,r.sassOptions&&(i.sassOptions=r.sassOptions)),typeof r.warnRuleAsWarning<"u"&&(i.warnRuleAsWarning=r.warnRuleAsWarning),typeof r.webpackImporter<"u"&&(i.webpackImporter=r.webpackImporter),this.store.chain.merge({module:{rule:{[e.sass]:{test:/\.(sass|scss)$/,use:{[t.sass]:{loader:require.resolve("sass-loader"),options:i}},type:"css/auto"}}}})}async less(){let{rule:e,use:t}=this.store.chainName,i={loader:require.resolve("less-loader"),options:{lessOptions:{javascriptEnabled:!0}}};this.store.chain.merge({module:{rule:{[e.less]:{test:/\.less$/,use:{[t.less]:i},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"}}}})}},lt=new we});function Es(){let s=[`import 'core-js/${p.empConfig.build.polyfill.coreJsFeatures}'`].join(`
10
+ `);return fe(s)}var K,X,I,Q=c(()=>{"use strict";o();K=l(require("html-webpack-plugin"),1);w();S();X=class{constructor(){}apply(e){let{webpack:t}=e;p.empConfig.build.polyfill.entryCdn||new t.EntryPlugin(e.context,Es(),{name:void 0}).apply(e)}},I=class{PluginName="HtmlEmpInjectPlugin";chunk="";files=[];constructor(e,t="",i=""){this.PluginName=`${this.PluginName}-${t}`,this.files=e,this.chunk=i}apply(e){e.hooks.compilation.tap(this.PluginName,t=>{K.default.getHooks(t).alterAssetTagGroups.tapPromise(this.PluginName,async i=>(this.chunk&&!i.plugin.userOptions.chunks?.includes(this.chunk)||this.files.map(r=>{let{pos:a,...u}=r;(a==="body"?i.bodyTags:i.headTags).push({attributes:{},voidTag:!1,meta:{plugin:void 0},tagName:"script",...u})}),i))})}}});var b,xe,mt,ut=c(()=>{"use strict";o();b=l(require("path"),1);G();Q();xe=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),this.prepareAndSetAsset(e),e}prepareAndSetAsset(e){let t=e.chunks?e.chunks[0]:void 0;this.store.injectTags(e.tags,t?`injectTags-${t}`:"injectTags",t),delete e.tags}injectPolyfill(){if(!this.store.empConfig.build.polyfill.entryCdn)return;let e=[{attributes:{src:this.store.empConfig.build.polyfill.entryCdn},tagName:"script",pos:"head"}];this.store.injectTags(e,"injectEMPPolyfill")}setChunk(e){return e.replace(b.default.extname(e),"").replace(`${this.store.empConfig.appSrc}${b.default.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(b.default.join("template","index.html"))}setFavicion(e){if(e!=="")return e?this.store.resolve(e):this.store.empResolve(b.default.join("template","favicon.ico"))}setEntryItem(e,t,i){i=i||this.store.resolve(b.default.join(this.store.empConfig.appSrc,e));let r=this.setChunk(e),a=[i];this.entriesConfig[r]={entry:{[r]:a},html:this.setHtmlConfig(t,[r])},this.store.entries[r]=a}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`${this.store.chainName.plugin.html.prefix}${t}`).use(K.default,[e])}setRspackEntry(e){this.store.merge({entry:e})}async init(){this.injectPolyfill(),this.store.empConfig.autoPages?await this.setAutoPage():(await this.setDefaultEntry(),this.setEntryByConfig())}async setAutoPage(){n.time("setAutoPage");let e=this.store.empConfig.autoPages?.path||"pages",t=b.default.join(this.store.appSrc,e),i=b.default.join(t,"**","*.{ts,tsx,jsx,js}"),r=await(0,z.glob)([i],{windowsPathsNoEscape:!0});r=r.map(a=>a.replace(`${t}${b.default.sep}`,"")),r.map(a=>{let u=this.store.empConfig.entries[a]||{};this.setEntryItem(a,{...this.store.empConfig.html,...u},b.default.join(t,a))}),n.timeEnd("setAutoPage")}async setDefaultEntry(){n.time("[store][empConfig]SetDefaultEntry");let e=b.default.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}"),t=await(0,z.glob)([e],{windowsPathsNoEscape:!0});if(t[0]){let i=b.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(i,this.store.empConfig.html,t[0])}n.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 xe});var Se,ke,ht,ft=c(()=>{"use strict";o();Se=l(require("path"),1);w();ke=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.empConfig.css?.prifixName?`${this.store.empConfig.css?.prifixName}-`:"",t=this.store.isDev?`${e}[path][name]-[local]-[hash:5]`:`${e}[local]-[hash:5]`;this.store.chain.merge({module:{generator:{"css/auto":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:t,esModule:!0},css:{exportsOnly:!1,esModule:!0},"css/module":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:t,esModule:!0},json:{JSONParse:!0}}}})}rspackParser(){this.store.chain.merge({module:{parser:{javascript:{dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,url:!0,importMeta:!0},css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return!!this.store.empConfig.build.polyfill.mode}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,polyfill:i}=this.store.empConfig.build,{externalHelpers:r}=i;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:r,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:v(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.polyfill.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill.mode),this.store.empConfig.build.polyfill.mode==="usage"&&(t.env.shippedProposals=!0,t.env.include=this.store.empConfig.build.polyfill.include)),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build.polyfill;e&&this.store.chain.resolve.alias.set("@swc/helpers",Se.default.dirname(require.resolve("@swc/helpers/package.json"))),this.coreJs.path=require.resolve("core-js/package.json");let t=ue(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=Se.default.dirname(this.coreJs.path),this.store.empConfig.build.polyfill.mode&&(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:i}=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:{[i.swc]:{loader:"builtin:swc-loader",options:this.swcTsOptions}}},[t.javascript]:{test:/\.((m|c)?js|jsx)$/,exclude:e,use:{[i.swc]:{loader:"builtin:swc-loader",options:this.swcJsOptions}}}}}})}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.raw]:{resourceQuery:/raw/,type:"asset/source"}}}}),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"}}}})}},ht=new ke});var P,Oe,gt,Pe,dt,yt=c(()=>{"use strict";o();P=l(require("@rspack/core"),1),Oe=l(require("fs"),1),gt=require("ts-checker-rspack-plugin");Q();Pe=class{store;async setup(e){this.store=e;let t=[this.define(),this.anylayze(),this.progress(),this.copy(),this.minify(),this.redoctor(),this.tsCheckerRspackPlugin(),this.cssChunkingPlugin()];this.beforeLifeCycle(),await this.store.empConfig.lifeCycle.beforePlugin(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterPlugin()}beforeLifeCycle(){let{store:e}=this;e.empConfig.build.polyfill.mode==="entry"&&e.chain.plugin("empPolyfill").use(X)}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"}])}tsCheckerRspackPlugin(){if(this.store.empConfig.tsCheckerRspackPlugin===!1)return!1;this.store.chain.plugin(this.store.chainName.plugin.tsCheckerRspackPlugin).use(gt.TsCheckerRspackPlugin,[this.store.empConfig.tsCheckerRspackPlugin])}async define(){this.store.chain.plugin(this.store.chainName.plugin.define).use(P.default.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");Oe.default.existsSync(e)&&Oe.default.readdirSync(e).length>0&&this.store.chain.plugin(this.store.chainName.plugin.copy).use(P.default.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve(this.store.empConfig.build.outDir),noErrorOnMissing:!0,globOptions:{ignore:["**/.DS_Store"]}}]}])}async progress(){if(!this.store.empConfig.debug.progress)return;let e={};this.store.isOldRspack||(e={template:"{bar:25.green/white}{spinner:.green}{percent}% {wide_msg:.dim}",tick:void 0,progressChars:"\u25A9\u25A9"}),this.store.chain.plugin(this.store.chainName.plugin.progress).use(P.default.ProgressPlugin,[e])}minify(){this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minJs).use(P.default.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]);let{SwcCssMinimizerRspackPlugin:e,LightningCssMinimizerRspackPlugin:t}=P.default;e?this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(e,[this.store.empConfig.build.cssminOptions]):t&&this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(t,[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])}sourceMapDevToolPlugin(){if(!this.store.empConfig.build.sourcemap)return;let e={};typeof this.store.empConfig.build.sourcemap=="object"&&(e=this.store.empConfig.build.sourcemap),this.store.chain.plugin(this.store.chainName.plugin.sourceMapDevTool).use(P.default.SourceMapDevToolPlugin,[e])}circularDependency(){this.store.chain.plugin("circularDependency").use(P.default.CircularDependencyRspackPlugin,[{}])}cssChunkingPlugin(){this.store.empConfig.debug.cssChunkingPlugin&&this.store.chain.plugin("CssChunkingPlugin").use(P.default.experiments.CssChunkingPlugin,[{}])}},dt=new Pe});var Ee,vt,bt=c(()=>{"use strict";o();at();ct();ut();ft();yt();Ee=class{store;async setup(e){this.store=e;let t=[pt.setup(this.store),ht.setup(this.store),dt.setup(this.store),mt.setup(this.store),lt.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()}},vt=new Ee});async function Y(s,e=void 0){if(s!==js&&(s<Ct||s>je))throw new Error(`Port number must lie between ${Ct} and ${je}`);let t=s,i=$s(),r;e&&!i.has(e)?r=new Set([e]):r=i;let a=new Set(["EADDRINUSE","EACCES"]);for(;t<=je;)try{return await Ds(t,r)}catch(u){if(!a.has(u.code))throw u;t+=1}throw new Error("No available ports found")}var wt,xt,Ct,je,js,$s,Ts,Ds,St=c(()=>{"use strict";o();wt=l(require("net"),1),xt=l(require("os"),1),Ct=1024,je=65535,js=443,$s=()=>{let s=xt.default.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(s))if(t)for(let i of t)e.add(i.address);return e},Ts=(s,e)=>new Promise((t,i)=>{let r=wt.default.createServer();r.unref(),r.on("error",i),r.listen(s,e,()=>{let{port:a}=r.address();r.close(()=>{t(a)})})}),Ds=async(s,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let i of e)try{await Ts(s,i)}catch(r){if(!t.has(r.code))throw r}return s}});var kt,$e,Te,Z,Ot=c(()=>{"use strict";o();kt=l(require("chalk"),1);A();$e=l(require("url"),1);w();Te=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==="::",i;if(t){i="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 i=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(i),this.urls.localUrlForBrowser=this.formatUrl(i)}getLanIp=D;formatUrl(e){let{protocol:t,port:i,pathname:r}=this.imf;return $e.default.format({protocol:t,hostname:e,port:i,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:i,pathname:r}=this.imf;return $e.default.format({protocol:t,hostname:e,port:kt.default.bold(i),pathname:r})}},Z=new Te});var Et,jt,$t,Pt,Rs,Ns,Tt,Dt=c(()=>{"use strict";o();Et=require("child_process"),jt=require("util");S();O();$t=(0,jt.promisify)(Et.exec),Pt=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],Rs=async()=>{let s=process.env.BROWSER;if(!s||!Pt.includes(s)){let{stdout:e}=await $t("ps cax");s=Pt.find(t=>e.includes(t))}return s},Ns=async s=>{if(process.platform==="darwin")try{let t=await Rs();if(t){let i=`osascript openChrome.applescript "${encodeURI(s)}" "${t}"`;return await $t(i,{cwd:p.resource.dir}),!0}}catch(t){n.debug(t)}try{let{default:t}=await import("open");return await t(s),!0}catch(t){return n.error("Failed to open start URL."),n.error(t),!1}},Tt=Ns});var De,ee,Rt=c(()=>{"use strict";o();De=l(require("fs/promises"),1);G();A();St();Ot();Dt();w();ee=class{ip=D();host=this.ip;isAutoDevBase=!1;isHttps=!1;httpsType="default";protocol="http";port=8e3;store;publicPath="/";publicHasHttp=!1;isOpenBrower=!1;url="";urls={localUrlForBrowser:"",localUrlForTerminal:"",lanUrlForTerminal:"",lanUrlForConfig:""};constructor(e){this.store=e}async setupOnEmpOptionSync(){this.store.cliAction!=="build"&&(this.port=await Y(this.port),this.setHttps(),await this.setAutoDevBase())}get config(){return{}}async setupOnStore(){if(this.store.cliAction==="build")return;let{store:e}=this;this.publicPath=e.rsConfig.output?.publicPath==="auto"?"/":e.rsConfig.output?.publicPath||"/",this.isOpenBrower=!!e.empConfig.server.open,this.protocol=this.isHttps?"https":"http",this.host=e.empConfig.server.host?e.empConfig.server.host:this.ip,e.empConfig.server.port&&e.empConfig.server.port!==this.port&&(this.port=await Y(e.empConfig.server.port)),Z.setup(this),this.publicPath&&(this.publicPath.indexOf("http://")>-1||this.publicPath.indexOf("https://")>-1)?(this.url=this.publicPath,this.publicHasHttp=!0,this.urls.localUrlForTerminal=Z.prettyPrintUrl("localhost")):(this.urls=Z.urls,this.url=this.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this;this.publicHasHttp?(n.info(`${x("\u279C")} Local: ${n.link(e.localUrlForTerminal)}`),n.info(`${x("\u279C")} Network: ${n.link(this.publicPath)}`)):(n.info(`${x("\u279C")} Local: ${n.link(e.localUrlForTerminal)}`),n.info(`${x("\u279C")} Network: ${n.link(e.lanUrlForTerminal)}
11
+ `)),this.isOpenBrower&&Tt(this.url)}async getcert(){let{store:e}=this,t=this.store.rsConfig.devServer||{server:{type:"http"}};if(typeof t.server=="object"&&t.server.type==="https"&&t.server.options&&t.server.options.key&&t.server.options.cert)return t.server.options;let[i,r]=await Promise.all([De.default.readFile(e.resource.key),De.default.readFile(e.resource.cert)]);return{key:i,cert:r}}setHttps(){let{store:e}=this,{server:t,https:i}=e.empOptions.server||{};this.isHttps=t==="https"||typeof t=="object"&&t.type==="https"||i===!0}async setAutoDevBase(){let{store:e}=this;this.isAutoDevBase=!!e.empOptions.autoDevBase&&e.mode==="development"&&!this.isHttpBase,this.isAutoDevBase&&(this.protocol=this.isHttps?"https":"http",e.empOptions.server?.port&&(this.port=e.empOptions.server.port),this.port=await Y(this.port),e.empOptions.base=`${this.protocol}://${this.host}:${this.port}/`,e.empOptions.server=e.deepAssign({port:this.port,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${this.host}:${this.port}/ws`}},e.empOptions.server))}get isHttpBase(){let e=this.store.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}}});var Nt,C,Lt,At,Re,p,S=c(()=>{"use strict";o();Nt=l(require("fs/promises"),1),C=l(require("path"),1),Lt=l(require("util"),1),At=require("@rspack/core");_();O();w();ye();ot();bt();Rt();ye();Q();Re=class{rspackVersion=At.rspack.rspackVersion;isOldRspack=V(this.rspackVersion,"1.0.0")===-1;empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=C.default.resolve(__dirname,__filename).replace(`${C.default.sep}dist${C.default.sep}index.js`,"");empSource=C.default.resolve(this.empRoot,"dist");resolve=e=>C.default.isAbsolute(e)?e:C.default.resolve(this.root,e);empResolve=e=>C.default.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};chainName=tt;server=new ee(this);cacheDir="";mode="development";cliMode="dev";isDev=!0;cliOptions;chain;rsConfig;empOptions={};empConfig;entries={};debug;cliAction;rootPaths={empConfig:void 0,tsConfig:void 0,pkg:void 0};async setup(e,t){n.time("[store]Setup");let[i,r]=await Promise.all([qe(),Xe()]);this.rootPaths.empConfig=i,this.rootPaths.tsConfig=r,this.rootPaths.pkg=this.resolve("package.json"),await this.initVars(e,t),this.empConfig=rt,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new de.default,await vt.setup(this),this.setLogger(),this.toConfig(),this.logConfig(),await this.server.setupOnStore(),n.timeEnd("[store]Setup")}async initVars(e,t){this.cliAction=e,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 i=require(this.empResolve("package.json")),r=require(this.resolve("package.json"));this.empPkg={...this.empPkg,...i},this.pkg={...this.pkg,...r},this.resource.dir=C.default.join(this.empRoot,"resource"),this.resource.cert=C.default.join(this.resource.dir,"emp.cert"),this.resource.key=C.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)}loggerExtensionName="";setLoggerExtensionName(e){this.loggerExtensionName=e}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),n.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}${this.loggerExtensionName?" "+this.loggerExtensionName:""}`,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=C.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"?v(e,this.debug.showRsconfig):e;console.log(n.link("[Compile Config]")),console.log(Lt.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.encodeVarName(this.pkg.name)}encodeVarName(e){return e.replaceAll("/","_").replaceAll("@","_").replaceAll("-","_")}vCompare=V;deepAssign=v;getLanIp=D;injectTags(e=[],t="",i=""){this.chain.plugin(`${I}-${t}`).use(I,[e,t,i])}},p=new Re});function Is(s,e){let t=[s,e],i=["File","Size","Gzipped"].reduce((r,a,u)=>{let f=t[u],y=a;return f&&(y=a.length<f?a+" ".repeat(f-a.length):a),`${r+y} `}," ");console.log(N.bold(i))}async function zt(s){let e=s.toJson({all:!1,assets:!0,timings:!0}),i=e.assets.filter(g=>Fs(g.name)).map(Gs);i.sort((g,k)=>g.size-k.size);let r=Math.max(...i.map(g=>g.sizeLabel.length)),a=Math.max(...i.map(g=>(g.folder+E.default.sep+g.name).length));Is(a,r);let u=0,f=0;i.forEach(g=>{let{sizeLabel:k}=g,{name:ps,folder:as,gzipSizeLabel:ls}=g,Ue=(as+E.default.sep+ps).length,Be=k.length;if(u+=g.size,f+=g.gzippedSize,Be<r){let ne=" ".repeat(r-Be);k+=ne}let He=L(g.folder+E.default.sep)+Us(g.name);if(Ue<a){let ne=" ".repeat(a-Ue);He+=ne}n.info(` ${He} ${L(k)} ${ls}`)});let y=`${N.bold("Total size:")} ${te(u)}`,j=`${N.bold("Gzipped size:")} ${te(f)}`;n.info(`
12
12
  ${y}
13
13
  ${j}
14
- `),n.info(`${x("\u2713")} Ready in ${V(Number(e.time))}
15
- `)}function te(s=0){n.info(`${x("\u2713")} Ready in ${V(Number(s))}`)}var Mt,E,Ft,Ns,Ls,As,Ms,Fs,zs,ee,Is,se=c(()=>{"use strict";o();Mt=l(require("fs"),1),E=l(require("path"),1),Ft=require("gzip-size");A();S();$();w();Ns=/\.html$/,Ls=/\.(?:js|mjs|cjs|jsx)$/,As=/\.css$/,Ms=s=>!/\.map$/.test(s)&&!/\.LICENSE\.txt$/.test(s),Fs=s=>s>300*1e3?ne:s>100*1e3?H:pe,zs=s=>{let e=s.name.split("?")[0],t=ee(s.size),i=E.default.basename(e),r=E.default.join(E.default.basename(p.empConfig.build.outDir),E.default.dirname(e)),a=Mt.default.readFileSync(E.default.join(p.empConfig.build.outDir,e)),u=a.length,h=(0,Ft.gzipSizeSync)(a),y=Fs(h)(ee(h));return{size:u,folder:r,name:i,gzippedSize:h,sizeLabel:t,gzipSizeLabel:y}};ee=s=>{let e=s/1e3;return`${e.toFixed(e<1?2:1)} kB`},Is=s=>Ls.test(s)?H(s):As.test(s)?x(s):Ns.test(s)?N(s):ae(s)});var T,ie=c(()=>{"use strict";o();$();w();S();T=class{async setup(e,t){n.time(`[${e}]Setup`),await p.setup(e,t),p.debug.clearLog&&he(),n.title(`${e}`),n.time(`[${e}]Run`),await this.run(),this.processExit(),n.timeEnd(`[${e}]Run`),n.timeEnd(`[${e}]Setup`)}async run(){}processExit(){process.on("SIGINT",function(){process.exit()})}}});var Gt,It,I,Ut=c(()=>{"use strict";o();Gt=require("@rspack/dev-server"),It=l(require("connect"),1),I=class{async setup(e,t,i,r=()=>{}){if(!t.devServer)return console.warn("rspackConfig.devServer need!");let a=new Gt.RspackDevServer(t.devServer,e);return await a.start(),a.middleware?.waitUntilValid(r),a}async beforeCompiler(e){return e.devServer.app=()=>(0,It.default)(),e.devServer.server&&e.devServer.server.type==="https"&&(e.devServer.server.type="http2"),e}}});var Ne,Bt,Ht,Jt,_t,Vt,Le,Wt,qt,M,U,Xt=c(()=>{"use strict";o();Ne=l(require("fs"),1),Bt=l(require("fs/promises"),1),Ht=l(require("compression"),1),Jt=l(require("connect"),1),_t=l(require("cors"),1),Vt=l(require("http2"),1),Le=l(require("path"),1),Wt=l(require("serve-static"),1),qt=require("url"),M=(0,Jt.default)();M.use((0,Ht.default)());M.use((0,_t.default)());U=class{async setup(e,t=()=>{}){let i="index",r=Object.keys(e.rsConfig.entry);if(r.length===0)return e.logger.sysError("emp serve must include entry!");if(r.includes(i)||(i=r[0]),!Ne.default.existsSync(e.outDir))return e.logger.sysError(`emp serve must be executed after emp build,${e.outDir} not exist!`);let a=e.resolve(e.rsConfig.output?.path);M.use((0,Wt.default)(a));let u=await Bt.default.readFile(Le.default.join(a,`${i}.html`),"utf8");if(M.use((h,y,j)=>{let O=(0,qt.parse)(h.url||"",!0).pathname;if(O&&O!=="/"&&Ne.default.existsSync(Le.default.join(a,O)))return j();y.setHeader("Content-Type","text/html"),y.end(u)}),e.server.isHttps){let{key:h,cert:y}=await e.server.getcert();Vt.default.createSecureServer(typeof e.server.isHttps!="boolean"?e.server.isHttps:{key:h,cert:y,allowHTTP1:!0},M).listen(e.server.port,t)}else require("http").createServer(M).listen(e.server.port,t)}}});var Ae=c(()=>{"use strict";o();Ut();Xt()});var Yt={};R(Yt,{default:()=>Us});var Qt,Kt,Me,Us,Zt=c(()=>{"use strict";o();Qt=require("@rspack/core");se();w();ie();Ae();S();Kt=new I,Me=class extends T{get stats(){return{all:p.empConfig.debug.devShowAllLog,colors:!0,assets:!1,chunks:!1,entrypoints:!1,timings:!1,version:!1,errors:!0,warnings:!0}}async getRspackDevConfig(){let e=v(p.rsConfig,{stats:this.stats,devServer:{open:!1,setupExitSignals:!0,port:p.server.port}}),{devServer:t}=e;if(p.server.isHttps&&(!t.server||t.server.type==="https"&&!t.server.options)){let{key:i,cert:r}=await p.server.getcert();t.server={type:"https",options:{key:i,cert:r}}}return Object.hasOwn(t,"https")&&delete t.https,e}async run(){let{server:e}=p,t=await this.getRspackDevConfig();t=await Kt.beforeCompiler(t);let i=(0,Qt.rspack)(t);await p.empConfig.lifeCycle.beforeDevServe(),e.startOpen(),await Kt.setup(i,t,p,async r=>{this.showTimeDone(r),await p.empConfig.lifeCycle.afterDevServe()}),p.debug.showPerformance&&i.hooks.afterDone.tap("done",this.showTimeDone)}showTimeDone=e=>{let t=e?.toJson({all:!1,colors:!1,assets:!1,chunks:!1,timings:!0});te(t.time)}},Us=new Me});var Fe={};R(Fe,{ServeScript:()=>re,default:()=>Hs});var Bs,es,re,Hs,ze=c(()=>{"use strict";o();se();ie();Ae();S();Bs=new U,es=0,re=class extends T{async run(){es=Date.now(),await p.empConfig.lifeCycle.beforeServe(),await Bs.setup(p,this.onReady)}onReady=async()=>{p.server.startOpen(),te(Date.now()-es),await p.empConfig.lifeCycle.afterServe()}},Hs=new re});var ss={};R(ss,{default:()=>Js});var ts,Ge,Js,is=c(()=>{"use strict";o();ts=require("@rspack/core");se();$();ie();S();Ge=class extends T{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(),Fe));await e.setup("serve",p.cliOptions)}async run(){await p.empConfig.lifeCycle.beforeBuild(),this.isWatchMode=!!p.cliOptions.watch,this.isuseServe=!!p.cliOptions.serve,this.rspackConfig=p.rsConfig,this.isWatchMode&&this.watchMode(),(0,ts.rspack)(this.rspackConfig,async(e,t)=>{if(console.log(`
16
- `),p.debug.showScriptDebug&&console.log(t?.toString()),e!==null){n.error(e.stack||e),e.message&&n.error(e.message);return}if(!t){n.red("Stats is Undefined.");return}t.hasErrors()&&(n.error(t.toString({all:!1,colors:!0,errors:!0})),n.red("Failed to compile."),process.exit(1)),t.hasWarnings()&&(n.yellow("Compiled with warnings."),n.warn(t.toString({all:!1,chunks:!1,assets:!1,colors:!0,errors:!0,warnings:!0}))),await zt(t),this.startServe(),await p.empConfig.lifeCycle.afterBulid()})}},Js=new Ge});var Vs={};R(Vs,{defineConfig:()=>_s,empHelper:()=>ve,program:()=>k.program,rspack:()=>os.rspack,runScript:()=>Ie,store:()=>p});module.exports=fs(Vs);o();var os=require("@rspack/core");o();var rs=l(require("process"),1),k=require("commander");var _e={name:"@empjs/cli",version:"3.9.2-beta.1",description:"emp",license:"MIT",type:"module",files:["dist","bin","resource","template","client.d.ts","emp-tsconfig.json"],maintainers:["xuhongbin","ckken","doerme"],repository:{type:"git",url:"git+https://github.com/empjs/emp.git",directory:"packages/cli"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},keywords:["rspack","rust","typescript"],bin:{emp:"./bin/emp.js"},main:"dist/index.js",types:"dist/index.d.ts",exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.js"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}},"./emp-tsconfig.json":"./emp-tsconfig.json"},scripts:{dev:"tsup --watch --env.ENV dev",build:"tsup --env.ENV prod",ph:"pnpm publish --no-git-checks"},engines:{node:">=16.0.0"},author:"Ken",devDependencies:{"@types/compression":"^1.7.2","@types/connect":"^3.4.38","@types/cors":"^2.8.12","@types/default-gateway":"^7.2.1","@types/fs-extra":"^11.0.4","@types/node":"^20.8.7","@types/react":"^18.3.2","@types/serve-static":"^1.15.8","@types/watchpack":"^2.4.3","@types/webpack":"^5.28.4","@types/webpack-bundle-analyzer":"^4.6.2","@types/webpack-sources":"^3.2.2",tsup:"^8.4.0"},dependencies:{"typescript-plugin-css-modules":"5.2.0","@rsdoctor/rspack-plugin":"1.1.8","@rspack/core":"1.4.10","@rspack/dev-server":"1.1.3","@swc/helpers":"^0.5.17",address:"^2.0.2",chalk:"^5.3.0",commander:"^11.1.0",compression:"^1.7.4",connect:"^3.7.0","core-js":"^3.41.0",cors:"^2.8.5","default-gateway":"^7.2.2","fs-extra":"^11.2.0",glob:"^11.0.1","gzip-size":"^7.0.0","html-webpack-plugin":"5.6.3",jiti:"2.0.0","less-loader":"^12.2.0",open:"^10.1.0","sass-embedded":"1.89.2","sass-loader":"^16.0.5","serve-static":"^2.2.0","ts-checker-rspack-plugin":"^1.1.4","webpack-bundle-analyzer":"^4.10.2","@empjs/chain":"workspace:*"}};async function Ie(){k.program.version(_e.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",(s,e)=>{let[t,i]=s.split("=");return e[t]=i,e},{}).action(async s=>{let{default:e}=await Promise.resolve().then(()=>(Zt(),Yt));await e.setup("dev",s)}),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",(s,e)=>{let[t,i]=s.split("=");return e[t]=i,e},{}).action(async s=>{let{default:e}=await Promise.resolve().then(()=>(is(),ss));await e.setup("build",s)}),k.program.command("serve").description("Server \u6A21\u5F0F").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").action(async s=>{let{default:e}=await Promise.resolve().then(()=>(ze(),Fe));await e.setup("serve",s)}),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(s=>{}),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(s=>{}),k.program.parse(rs.default.argv)}S();z();function _s(s){return s}0&&(module.exports={defineConfig,empHelper,program,rspack,runScript,store});
14
+ `),n.info(`${x("\u2713")} Ready in ${W(Number(e.time))}
15
+ `)}function se(s=0){n.info(`${x("\u2713")} Ready in ${W(Number(s))}`)}var Mt,E,Ft,Ls,As,Ms,Fs,zs,Gs,te,Us,ie=c(()=>{"use strict";o();Mt=l(require("fs"),1),E=l(require("path"),1),Ft=require("gzip-size");A();S();O();w();Ls=/\.html$/,As=/\.(?:js|mjs|cjs|jsx)$/,Ms=/\.css$/,Fs=s=>!/\.map$/.test(s)&&!/\.LICENSE\.txt$/.test(s),zs=s=>s>300*1e3?pe:s>100*1e3?J:ae,Gs=s=>{let e=s.name.split("?")[0],t=te(s.size),i=E.default.basename(e),r=E.default.join(E.default.basename(p.empConfig.build.outDir),E.default.dirname(e)),a=Mt.default.readFileSync(E.default.join(p.empConfig.build.outDir,e)),u=a.length,f=(0,Ft.gzipSizeSync)(a),y=zs(f)(te(f));return{size:u,folder:r,name:i,gzippedSize:f,sizeLabel:t,gzipSizeLabel:y}};te=s=>{let e=s/1e3;return`${e.toFixed(e<1?2:1)} kB`},Us=s=>As.test(s)?J(s):Ms.test(s)?x(s):Ls.test(s)?N(s):le(s)});var $,re=c(()=>{"use strict";o();O();w();S();$=class{async setup(e,t){n.time(`[${e}]Setup`),await p.setup(e,t),p.debug.clearLog&&he(),n.title(`${e}`),n.time(`[${e}]Run`),await this.run(),this.processExit(),n.timeEnd(`[${e}]Run`),n.timeEnd(`[${e}]Setup`)}async run(){}processExit(){process.on("SIGINT",function(){process.exit()})}}});var Gt,It,U,Ut=c(()=>{"use strict";o();Gt=require("@rspack/dev-server"),It=l(require("connect"),1),U=class{async setup(e,t,i,r=()=>{}){if(!t.devServer)return console.warn("rspackConfig.devServer need!");let a=new Gt.RspackDevServer(t.devServer,e);return await a.start(),a.middleware?.waitUntilValid(r),a}async beforeCompiler(e){return e.devServer.app=()=>(0,It.default)(),e.devServer.server&&e.devServer.server.type==="https"&&(e.devServer.server.type="http2"),e}}});var Ne,Bt,Ht,Jt,_t,Vt,Le,Wt,qt,M,B,Xt=c(()=>{"use strict";o();Ne=l(require("fs"),1),Bt=l(require("fs/promises"),1),Ht=l(require("compression"),1),Jt=l(require("connect"),1),_t=l(require("cors"),1),Vt=l(require("http2"),1),Le=l(require("path"),1),Wt=l(require("serve-static"),1),qt=require("url"),M=(0,Jt.default)();M.use((0,Ht.default)());M.use((0,_t.default)());B=class{async setup(e,t=()=>{}){let i="index",r=Object.keys(e.rsConfig.entry);if(r.length===0)return e.logger.sysError("emp serve must include entry!");if(r.includes(i)||(i=r[0]),!Ne.default.existsSync(e.outDir))return e.logger.sysError(`emp serve must be executed after emp build,${e.outDir} not exist!`);let a=e.resolve(e.rsConfig.output?.path);M.use((0,Wt.default)(a));let u=await Bt.default.readFile(Le.default.join(a,`${i}.html`),"utf8");if(M.use((f,y,j)=>{let k=(0,qt.parse)(f.url||"",!0).pathname;if(k&&k!=="/"&&Ne.default.existsSync(Le.default.join(a,k)))return j();y.setHeader("Content-Type","text/html"),y.end(u)}),e.server.isHttps){let{key:f,cert:y}=await e.server.getcert();Vt.default.createSecureServer(typeof e.server.isHttps!="boolean"?e.server.isHttps:{key:f,cert:y,allowHTTP1:!0},M).listen(e.server.port,t)}else require("http").createServer(M).listen(e.server.port,t)}}});var Ae=c(()=>{"use strict";o();Ut();Xt()});var Yt={};R(Yt,{default:()=>Bs});var Qt,Kt,Me,Bs,Zt=c(()=>{"use strict";o();Qt=require("@rspack/core");ie();w();re();Ae();S();Kt=new U,Me=class extends ${get stats(){return{all:p.empConfig.debug.devShowAllLog,colors:!0,assets:!1,chunks:!1,entrypoints:!1,timings:!1,version:!1,errors:!0,warnings:!0}}async getRspackDevConfig(){let e=v(p.rsConfig,{stats:this.stats,devServer:{open:!1,setupExitSignals:!0,port:p.server.port}}),{devServer:t}=e;if(p.server.isHttps&&(!t.server||t.server.type==="https"&&!t.server.options)){let{key:i,cert:r}=await p.server.getcert();t.server={type:"https",options:{key:i,cert:r}}}return Object.hasOwn(t,"https")&&delete t.https,e}async run(){let{server:e}=p,t=await this.getRspackDevConfig();t=await Kt.beforeCompiler(t);let i=(0,Qt.rspack)(t);await p.empConfig.lifeCycle.beforeDevServe(),e.startOpen(),await Kt.setup(i,t,p,async r=>{this.showTimeDone(r),await p.empConfig.lifeCycle.afterDevServe()}),p.debug.showPerformance&&i.hooks.afterDone.tap("done",this.showTimeDone)}showTimeDone=e=>{let t=e?.toJson({all:!1,colors:!1,assets:!1,chunks:!1,timings:!0});se(t.time)}},Bs=new Me});var Fe={};R(Fe,{ServeScript:()=>oe,default:()=>Js});var Hs,es,oe,Js,ze=c(()=>{"use strict";o();ie();re();Ae();S();Hs=new B,es=0,oe=class extends ${async run(){es=Date.now(),await p.empConfig.lifeCycle.beforeServe(),await Hs.setup(p,this.onReady)}onReady=async()=>{p.server.startOpen(),se(Date.now()-es),await p.empConfig.lifeCycle.afterServe()}},Js=new oe});var ss={};R(ss,{default:()=>_s});var ts,Ge,_s,is=c(()=>{"use strict";o();ts=require("@rspack/core");ie();O();re();S();Ge=class extends ${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(),Fe));await e.setup("serve",p.cliOptions)}async run(){await p.empConfig.lifeCycle.beforeBuild(),this.isWatchMode=!!p.cliOptions.watch,this.isuseServe=!!p.cliOptions.serve,this.rspackConfig=p.rsConfig,this.isWatchMode&&this.watchMode(),(0,ts.rspack)(this.rspackConfig,async(e,t)=>{if(console.log(`
16
+ `),p.debug.showScriptDebug&&console.log(t?.toString()),e!==null){n.error(e.stack||e),e.message&&n.error(e.message);return}if(!t){n.red("Stats is Undefined.");return}t.hasErrors()&&(n.error(t.toString({all:!1,colors:!0,errors:!0})),n.red("Failed to compile."),process.exit(1)),t.hasWarnings()&&(n.yellow("Compiled with warnings."),n.warn(t.toString({all:!1,chunks:!1,assets:!1,colors:!0,errors:!0,warnings:!0}))),await zt(t),this.startServe(),await p.empConfig.lifeCycle.afterBulid()})}},_s=new Ge});var Ws={};R(Ws,{Logger:()=>F,color:()=>h,defineConfig:()=>Vs,empHelper:()=>ve,program:()=>ns.program,rspack:()=>os.rspack,runScript:()=>Ie,store:()=>p});module.exports=gs(Ws);o();var os=require("@rspack/core"),ns=require("commander");o();var rs=l(require("process"),1),T=require("commander");var _e={name:"@empjs/cli",version:"3.9.2-beta.3",description:"emp",license:"MIT",type:"module",files:["dist","bin","resource","template","client.d.ts","emp-tsconfig.json"],maintainers:["xuhongbin","ckken","doerme"],repository:{type:"git",url:"git+https://github.com/empjs/emp.git",directory:"packages/cli"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},keywords:["rspack","rust","typescript"],bin:{emp:"./bin/emp.js"},main:"dist/index.js",types:"dist/index.d.ts",exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.js"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}},"./emp-tsconfig.json":"./emp-tsconfig.json"},scripts:{dev:"tsup --watch --env.ENV dev",build:"tsup --env.ENV prod",ph:"pnpm publish --no-git-checks"},engines:{node:">=16.0.0"},author:"Ken",devDependencies:{"@types/compression":"^1.7.2","@types/connect":"^3.4.38","@types/cors":"^2.8.12","@types/default-gateway":"^7.2.1","@types/fs-extra":"^11.0.4","@types/node":"^20.8.7","@types/react":"^18.3.2","@types/serve-static":"^1.15.8","@types/watchpack":"^2.4.3","@types/webpack":"^5.28.4","@types/webpack-bundle-analyzer":"^4.6.2","@types/webpack-sources":"^3.2.2",tsup:"^8.4.0"},dependencies:{"typescript-plugin-css-modules":"5.2.0","@rsdoctor/rspack-plugin":"1.1.8","@rspack/core":"1.4.10","@rspack/dev-server":"1.1.3","@swc/helpers":"^0.5.17",address:"^2.0.2",chalk:"^5.3.0",commander:"^11.1.0",compression:"^1.7.4",connect:"^3.7.0","core-js":"^3.41.0",cors:"^2.8.5","default-gateway":"^7.2.2","fs-extra":"^11.2.0",glob:"^11.0.1","gzip-size":"^7.0.0","html-webpack-plugin":"5.6.3",jiti:"2.0.0","less-loader":"^12.2.0",open:"^10.1.0","sass-embedded":"1.89.2","sass-loader":"^16.0.5","serve-static":"^2.2.0","ts-checker-rspack-plugin":"^1.1.4","webpack-bundle-analyzer":"^4.10.2","@empjs/chain":"workspace:*"}};async function Ie(){T.program.version(_e.version,"-v, --version").usage("<command> [options]"),T.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",(s,e)=>{let[t,i]=s.split("=");return e[t]=i,e},{}).action(async s=>{let{default:e}=await Promise.resolve().then(()=>(Zt(),Yt));await e.setup("dev",s)}),T.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",(s,e)=>{let[t,i]=s.split("=");return e[t]=i,e},{}).action(async s=>{let{default:e}=await Promise.resolve().then(()=>(is(),ss));await e.setup("build",s)}),T.program.command("serve").description("Server \u6A21\u5F0F").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").action(async s=>{let{default:e}=await Promise.resolve().then(()=>(ze(),Fe));await e.setup("serve",s)}),T.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(s=>{}),T.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(s=>{}),T.program.parse(rs.default.argv)}S();O();G();function Vs(s){return s}0&&(module.exports={Logger,color,defineConfig,empHelper,program,rspack,runScript,store});
17
17
  if (module.exports.default) module.exports = module.exports.default;
package/dist/index.d.cts CHANGED
@@ -7,10 +7,10 @@ import { HtmlTagObject } from 'html-webpack-plugin';
7
7
  import { Options } from 'sass-embedded';
8
8
  import Chain from '@empjs/chain';
9
9
  import { TsCheckerRspackPluginOptions } from 'ts-checker-rspack-plugin/lib/plugin-options';
10
+ export { program } from 'commander';
10
11
  import * as chalk from 'chalk';
11
12
  import chalk__default from 'chalk';
12
13
  import { glob } from 'glob';
13
- export { program } from 'commander';
14
14
 
15
15
  type LifeCycleOptions = Partial<LifeCycle>;
16
16
  declare class LifeCycle {
@@ -753,4 +753,4 @@ type EMPConfigFn = (store: GlobalStore) => EmpOptions | Promise<EmpOptions>;
753
753
  type EMPConfigExport = EmpOptions | EMPConfigFn;
754
754
  declare function defineConfig(config: EMPConfigExport): EMPConfigExport;
755
755
 
756
- export { type EMP3PluginFnType, type EMP3PluginType, type EMPConfigExport, type EMPConfigFn, type EmpOptions, GlobalStore, defineConfig, index as empHelper, runScript, _default$2 as store };
756
+ export { type EMP3PluginFnType, type EMP3PluginType, type EMPConfigExport, type EMPConfigFn, type EmpOptions, GlobalStore, Logger, _default$1 as color, defineConfig, index as empHelper, runScript, _default$2 as store };
package/dist/index.d.ts CHANGED
@@ -7,10 +7,10 @@ import { HtmlTagObject } from 'html-webpack-plugin';
7
7
  import { Options } from 'sass-embedded';
8
8
  import Chain from '@empjs/chain';
9
9
  import { TsCheckerRspackPluginOptions } from 'ts-checker-rspack-plugin/lib/plugin-options';
10
+ export { program } from 'commander';
10
11
  import * as chalk from 'chalk';
11
12
  import chalk__default from 'chalk';
12
13
  import { glob } from 'glob';
13
- export { program } from 'commander';
14
14
 
15
15
  type LifeCycleOptions = Partial<LifeCycle>;
16
16
  declare class LifeCycle {
@@ -753,4 +753,4 @@ type EMPConfigFn = (store: GlobalStore) => EmpOptions | Promise<EmpOptions>;
753
753
  type EMPConfigExport = EmpOptions | EMPConfigFn;
754
754
  declare function defineConfig(config: EMPConfigExport): EMPConfigExport;
755
755
 
756
- export { type EMP3PluginFnType, type EMP3PluginType, type EMPConfigExport, type EMPConfigFn, type EmpOptions, GlobalStore, defineConfig, index as empHelper, runScript, _default$2 as store };
756
+ export { type EMP3PluginFnType, type EMP3PluginType, type EMPConfigExport, type EMPConfigFn, type EmpOptions, GlobalStore, Logger, _default$1 as color, defineConfig, index as empHelper, runScript, _default$2 as store };
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
2
- var Rt=Object.defineProperty;var v=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var m=(s,e)=>()=>(s&&(e=s(s=0)),e);var F=(s,e)=>{for(var t in e)Rt(s,t,{get:e[t],enumerable:!0})};import Nt from"path";import{fileURLToPath as At}from"url";var Ne,Lt,c,l,o=m(()=>{"use strict";Ne=()=>At(import.meta.url),Lt=()=>Nt.dirname(Ne()),c=Lt(),l=Ne()});import y from"chalk";var Ft,S,zt,Gt,It,oe,B,Ut,Bt,N,ne,Ht,pe,A,f,L=m(()=>{"use strict";o();Ft=y.hex("#1abc9c"),S=y.hex("#16a085"),zt=y.hex("#2ecc71"),Gt=y.hex("#27ae60"),It=y.hex("#e74c3c"),oe=y.hex("#c0392b"),B=y.hex("#f1c40f"),Ut=y.hex("#f39c12"),Bt=y.hex("#3498db"),N=y.hex("#2980b9"),ne=y.hex("#ecf0f1"),Ht=y.hex("#fd79a8"),pe=y.hex("#e84393"),A=y.hex("#7f8c8d"),f={lightGreen:Ft,green:S,lightCyan:zt,cyan:Gt,lightRed:It,red:oe,yellow:B,orange:Ut,lightBlue:Bt,blue:N,white:ne,lightMagenta:Ht,magenta:pe,gray:A}});var ae,n,E=m(()=>{"use strict";o();L();ae=class{brandName="";fullName="";logLevel="debug";isLogTime=!1;setup({brandName:e,logLevel:t,fullName:i}){this.brandName=` [${e}] `,this.fullName=` ${i} `,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
- `)};cyan=e=>{console.log(`${f.lightCyan(this.brandName)}${f.cyan(` ${e} `)}
4
- `)};magenta=e=>{console.log(`${f.lightMagenta(this.brandName)}${f.magenta(` ${e} `)}
5
- `)};green=e=>{console.log(`${f.lightGreen(this.brandName)}${f.green(` ${e} `)}
6
- `)};yellow=e=>{console.log(`${f.yellow(this.brandName)}${f.orange(` ${e} `)}
7
- `)};red=e=>{console.log(`${f.lightRed(this.brandName)}${f.red(` ${e} `)}
8
- `)};sysError=e=>{console.log(`${f.lightRed(" System Error Tips ")}${f.red(` ${e} `)}
9
- `)};link=e=>f.blue(e);title=e=>{console.log(`${this.fullName}${f.yellow.underline(`${e}`)}
10
- `)}},n=new ae});import Le from"fs";import{createJiti as Jt}from"jiti";import Me from"path";var _t,Fe,ze,Ge,Ie,H=m(()=>{"use strict";o();k();E();_t=["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"],Fe=Jt(l,{interopDefault:!0}),ze=async()=>{n.time("[store]GetEmpConfigPath");let s=_t.map(i=>Me.resolve(a.root,i)),e=await Promise.all(s.map(i=>Le.promises.access(i).then(()=>!0,()=>!1))),t=s.find((i,r)=>e[r]);return n.timeEnd("[store]GetEmpConfigPath"),t},Ge=async()=>{let s=Me.join(a.root,"tsconfig.json");return await Le.promises.access(s).then(()=>!0,()=>!1)||(s=void 0),s},Ie=()=>{let s=[l];return a.rootPaths.pkg&&s.push(a.rootPaths.pkg),a.rootPaths.empConfig&&s.push(a.rootPaths.empConfig),a.rootPaths.tsConfig&&s.push(a.rootPaths.tsConfig),s}});var ue={};F(ue,{clearConsole:()=>ce,deepAssign:()=>b,ensureArray:()=>Kt,getLanIp:()=>R,getPkgVersion:()=>le,importJsVm:()=>me,jsonFilter:()=>Qt,timeFormat:()=>_,vCompare:()=>J});import{ip as Vt}from"address";import Wt from"chalk";import{gateway4sync as qt}from"default-gateway";import Xt from"fs-extra";function ce(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function b(s,...e){for(let t of e)for(let i in t){let r=t[i],p=s[i];if(Object(r)==r&&Object(p)===p){s[i]=b(p,r);continue}s[i]=t[i]}return s}var R,le,Kt,Qt,J,_,me,C=m(()=>{"use strict";o();R=()=>{let s="127.0.0.1";try{let{int:e}=qt();return Vt(e||"")||s}catch{return s}},le=s=>{try{let{version:e}=Xt.readJSONSync(s);return e}catch{return}};Kt=s=>Array.isArray(s)?s:[s],Qt=(s={},e=[])=>Object.keys(s).filter(t=>!e.includes(t)).reduce((t,i)=>(t[i]=s[i],t),{}),J=(s="",e="")=>{let t=s.replace("^","").split("."),i=e.replace("^","").split("."),r=Math.max(t.length,i.length),p=0;for(let u=0;u<r;u++){let h=t.length>u?t[u]:0,d=isNaN(Number(h))?h.charCodeAt():Number(h),P=i.length>u?i[u]:0,g=isNaN(Number(P))?P.charCodeAt():Number(P);if(d<g){p=-1;break}else if(d>g){p=1;break}}return p},_=s=>{s=s/1e3;let e=i=>Wt.bold(i);if(s<1)return`${s*1e3} ms`;if(s<10){let i=s>=.01?2:3;return`${e(s.toFixed(i))} s`}if(s<60)return`${e(s.toFixed(1))} s`;let t=s/60;return`${e(t.toFixed(2))} m`},me=s=>`data:text/javascript,${s}`});import Ue from"@empjs/chain";var Be,he=m(()=>{"use strict";o();Be={rule:{mjs:"mjs",typescript:"typescript",javascript:"javascript",sourceMap:"sourceMapLoader",inline:"inline",raw:"raw",svg:"svg",image:"image",font:"fonts",svga:"svga",sass:"sass",less:"less",css:"css"},use:{swc:"swc",sourceMap:"sourceMapLoader",sass:"sassLoader",less:"lessLoader"},plugin:{tsCheckerRspackPlugin:"TsCheckerRspackPlugin",bundleAnalyzer:"bundleAnalyzerPlugin",define:"definePlugin",copy:"copyRspackPlugin",progress:"progressPlugin",html:{prefix:"html-plugin-"},rsdoctor:"rsdoctor",sourceMapDevTool:"sourceMapDevTool"},minimizer:{minJs:"minJs",minCss:"minCss"}}});var He={};F(He,{chalk:()=>Yt,color:()=>f,glob:()=>V,logger:()=>n,utils:()=>ue});import Yt from"chalk";import{glob as V}from"glob";var z=m(()=>{"use strict";o();L();E();C()});var W,Je=m(()=>{"use strict";o();W=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){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 fe,_e,Ve=m(()=>{"use strict";o();z();H();C();Je();fe=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},b(e,t)}isESM=!1;checkIsESM(e){return["es3","es5"].indexOf(e)===-1}lifeCycle;async setup(e){this.store=e,await this.syncEmpOptions(),await this.setupEmpOptions(),this.lifeCycle=new W(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:i,appEntry:r}=this.store.empOptions;t&&(this.appSrc=t),i&&(this.base=i),r&&(this.appEntry=r)}async setupEmpOptions(){await this.store.server.setupOnEmpOptionSync()}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={}),this.assign({loggerLevel:"info",clearLog:!1,progress:!0,showRsconfig:!1,showPerformance:!1,rsdoctor:e,infrastructureLogging:{appendOnly:!0,level:"warn"},newTreeshaking:this.store.empConfig.isESM,devShowAllLog:!1,showScriptDebug:!1,parallelCodeSplitting:!0,cssChunkingPlugin:!0,warnRuleAsWarning:!0},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:{mode:void 0,entryCdn:void 0,splitChunks:!1,include:[],coreJsFeatures:"stable",externalHelpers:!1,browserslist:this.store.browserslistOptions.default},swcConfig:{},devtool:this.store.isDev?"cheap-module-source-map":"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,cache:this.cache!==!1,tags:[]},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&&(this.store.server.httpsType="h2",delete this.store.empOptions.server.http2),this.assign(e,this.store.empOptions.server)}get css(){return this.assign({sass:{mode:"modern",warnRuleAsWarning:this.store.empConfig.debug.warnRuleAsWarning},prifixName:""},this.store.empOptions.css)}get output(){let e=(this.store.isDev,".[contenthash:8]"),t=this.store.isDev?"":".[contenthash:8]",{assetsDir:i,staticDir:r}=this.store.empConfig.build,p={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}${i}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!this.store.isDev,uniqueName:this.store.uniqueName};return this.assign(p,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)}get tsCheckerRspackPlugin(){let e={};if(this.store.empOptions.tsCheckerRspackPlugin)typeof this.store.empOptions.tsCheckerRspackPlugin=="object"&&(e=this.store.empOptions.tsCheckerRspackPlugin);else return!1;return this.assign({},e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",i={};return Object.keys(e).map(r=>{t==="all"?(i[`import.meta.env.${r}`]=JSON.stringify(e[r]),i[`process.env.${r}`]=JSON.stringify(e[r])):t==="esm"?i[`import.meta.env.${r}`]=JSON.stringify(e[r]):t==="cjs"?i[`process.env.${r}`]=JSON.stringify(e[r]):t==="none"&&(i[`${r}`]=JSON.stringify(e[r]))}),i}get externals(){return this.assign({},this.store.empOptions.externals)}get resolve(){return b({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(){if(n.time("[store][empConfig]SyncEmpOptions"),!this.store.rootPaths.empConfig)return;let e=await Fe(this.store.rootPaths.empConfig);typeof e=="function"?this.store.empOptions=await e(this.store):this.store.empOptions=e||{},n.timeEnd("[store][empConfig]SyncEmpOptions")}get moduleTransformRule(){let{moduleTransform:e}=this.store.empOptions,t=this.assign({defaultExclude:!1},e),i={and:[],not:[]};return t.defaultExclude===!0&&i.and.push(/(node_modules|bower_components)/),t?.exclude&&(i.and=i.and.concat(t.exclude)),e?.include&&(i.not=t.include),i}get cacheDir(){return this.store.empOptions.cacheDir?this.store.empOptions.cacheDir:"node_modules/.emp-cache"}get cache(){return this.store.empOptions.cache===!1?!1:this.store.empOptions.cache?this.store.empOptions.cache:"persistent"}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}},_e=new fe});import Zt from"fs-extra";var ge,We,qe=m(()=>{"use strict";o();H();ge=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({name:this.store.pkg.name,node:{global:!0},experiments:{nativeWatcher:!1,outputModule:this.store.empConfig.isESM,topLevelAwait:!0,asyncWebAssembly:!0,css:!0,rspackFuture:{bundlerInfo:{force:!1}},cache:{type:this.store.empConfig.cache==="persistent"?"persistent":"memory",buildDependencies:Ie(),version:this.store.empPkg.version},incremental:"advance-silent",parallelCodeSplitting:this.store.empConfig.debug.parallelCodeSplitting,parallelLoader:!0},target:this.store.empConfig.target,infrastructureLogging:this.store.empConfig.debug.infrastructureLogging,context:this.store.root,mode:this.store.mode,cache:!!this.store.empConfig.cache,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 Zt.exists(e)){let i={};this.store.isOldRspack?i.tsConfigPath=e:i.tsConfig=e,this.store.merge({resolve:i})}}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.mode==="entry"&&this.store.empConfig.build.polyfill.splitChunks&&!this.store.empConfig.build.polyfill.entryCdn&&(e.splitChunks.cacheGroups.coreJs={test:/[\\/]node_modules[\\/](core-js)[\\/]/,name:"coreJs",chunks:"all",enforce:!0}),this.store.chain.merge({optimization:e})}},We=new ge});var de,Xe,Ke=m(()=>{"use strict";o();de=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,i={},{sass:r}=this.store.empConfig.css;r.mode==="modern"&&(i.implementation=r.implementation?r.implementation:v.resolve("sass-embedded"),i.api="modern-compiler",i.sourceMap=this.store.empConfig.build.sourcemap,r.sassOptions&&(i.sassOptions=r.sassOptions)),typeof r.warnRuleAsWarning<"u"&&(i.warnRuleAsWarning=r.warnRuleAsWarning),typeof r.webpackImporter<"u"&&(i.webpackImporter=r.webpackImporter),this.store.chain.merge({module:{rule:{[e.sass]:{test:/\.(sass|scss)$/,use:{[t.sass]:{loader:v.resolve("sass-loader"),options:i}},type:"css/auto"}}}})}async less(){let{rule:e,use:t}=this.store.chainName,i={loader:v.resolve("less-loader"),options:{lessOptions:{javascriptEnabled:!0}}};this.store.chain.merge({module:{rule:{[e.less]:{test:/\.less$/,use:{[t.less]:i},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"}}}})}},Xe=new de});import ye from"html-webpack-plugin";function es(){let s=[`import 'core-js/${a.empConfig.build.polyfill.coreJsFeatures}'`].join(`
11
- `);return me(s)}var q,G,X=m(()=>{"use strict";o();C();k();q=class{constructor(){}apply(e){let{webpack:t}=e;a.empConfig.build.polyfill.entryCdn||new t.EntryPlugin(e.context,es(),{name:void 0}).apply(e)}},G=class{PluginName="HtmlEmpInjectPlugin";chunk="";files=[];constructor(e,t="",i=""){this.PluginName=`${this.PluginName}-${t}`,this.files=e,this.chunk=i}apply(e){e.hooks.compilation.tap(this.PluginName,t=>{ye.getHooks(t).alterAssetTagGroups.tapPromise(this.PluginName,async i=>(this.chunk&&!i.plugin.userOptions.chunks?.includes(this.chunk)||this.files.map(r=>{let{pos:p,...u}=r;(p==="body"?i.bodyTags:i.headTags).push({attributes:{},voidTag:!1,meta:{plugin:void 0},tagName:"script",...u})}),i))})}}});import w from"path";var ve,Qe,Ye=m(()=>{"use strict";o();z();X();ve=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),this.prepareAndSetAsset(e),e}prepareAndSetAsset(e){let t=e.chunks?e.chunks[0]:void 0;this.store.injectTags(e.tags,t?`injectTags-${t}`:"injectTags",t),delete e.tags}injectPolyfill(){if(!this.store.empConfig.build.polyfill.entryCdn)return;let e=[{attributes:{src:this.store.empConfig.build.polyfill.entryCdn},tagName:"script",pos:"head"}];this.store.injectTags(e,"injectEMPPolyfill")}setChunk(e){return e.replace(w.extname(e),"").replace(`${this.store.empConfig.appSrc}${w.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(w.join("template","index.html"))}setFavicion(e){if(e!=="")return e?this.store.resolve(e):this.store.empResolve(w.join("template","favicon.ico"))}setEntryItem(e,t,i){i=i||this.store.resolve(w.join(this.store.empConfig.appSrc,e));let r=this.setChunk(e),p=[i];this.entriesConfig[r]={entry:{[r]:p},html:this.setHtmlConfig(t,[r])},this.store.entries[r]=p}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`${this.store.chainName.plugin.html.prefix}${t}`).use(ye,[e])}setRspackEntry(e){this.store.merge({entry:e})}async init(){this.injectPolyfill(),this.store.empConfig.autoPages?await this.setAutoPage():(await this.setDefaultEntry(),this.setEntryByConfig())}async setAutoPage(){n.time("setAutoPage");let e=this.store.empConfig.autoPages?.path||"pages",t=w.join(this.store.appSrc,e),i=w.join(t,"**","*.{ts,tsx,jsx,js}"),r=await V([i],{windowsPathsNoEscape:!0});r=r.map(p=>p.replace(`${t}${w.sep}`,"")),r.map(p=>{let u=this.store.empConfig.entries[p]||{};this.setEntryItem(p,{...this.store.empConfig.html,...u},w.join(t,p))}),n.timeEnd("setAutoPage")}async setDefaultEntry(){n.time("[store][empConfig]SetDefaultEntry");let e=w.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}"),t=await V([e],{windowsPathsNoEscape:!0});if(t[0]){let i=w.join(this.store.empConfig.appSrc,Object.keys(this.store.empConfig.entries).length>0&&this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index");this.setEntryItem(i,this.store.empConfig.html,t[0])}n.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)}},Qe=new ve});import Ze from"path";var be,et,tt=m(()=>{"use strict";o();C();be=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.empConfig.css?.prifixName?`${this.store.empConfig.css?.prifixName}-`:"",t=this.store.isDev?`${e}[path][name]-[local]-[hash:5]`:`${e}[local]-[hash:5]`;this.store.chain.merge({module:{generator:{"css/auto":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:t,esModule:!0},css:{exportsOnly:!1,esModule:!0},"css/module":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:t,esModule:!0},json:{JSONParse:!0}}}})}rspackParser(){this.store.chain.merge({module:{parser:{javascript:{dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,url:!0,importMeta:!0},css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return!!this.store.empConfig.build.polyfill.mode}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,polyfill:i}=this.store.empConfig.build,{externalHelpers:r}=i;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:r,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:b(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.polyfill.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill.mode),this.store.empConfig.build.polyfill.mode==="usage"&&(t.env.shippedProposals=!0,t.env.include=this.store.empConfig.build.polyfill.include)),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build.polyfill;e&&this.store.chain.resolve.alias.set("@swc/helpers",Ze.dirname(v.resolve("@swc/helpers/package.json"))),this.coreJs.path=v.resolve("core-js/package.json");let t=le(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=Ze.dirname(this.coreJs.path),this.store.empConfig.build.polyfill.mode&&(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:i}=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:{[i.swc]:{loader:"builtin:swc-loader",options:this.swcTsOptions}}},[t.javascript]:{test:/\.((m|c)?js|jsx)$/,exclude:e,use:{[i.swc]:{loader:"builtin:swc-loader",options:this.swcJsOptions}}}}}})}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.raw]:{resourceQuery:/raw/,type:"asset/source"}}}}),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"}}}})}},et=new be});import j from"@rspack/core";import st from"fs";import{TsCheckerRspackPlugin as ts}from"ts-checker-rspack-plugin";var Ce,it,rt=m(()=>{"use strict";o();X();Ce=class{store;async setup(e){this.store=e;let t=[this.define(),this.anylayze(),this.progress(),this.copy(),this.minify(),this.redoctor(),this.tsCheckerRspackPlugin(),this.cssChunkingPlugin()];this.beforeLifeCycle(),await this.store.empConfig.lifeCycle.beforePlugin(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterPlugin()}beforeLifeCycle(){let{store:e}=this;e.empConfig.build.polyfill.mode==="entry"&&e.chain.plugin("empPolyfill").use(q)}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"}])}tsCheckerRspackPlugin(){if(this.store.empConfig.tsCheckerRspackPlugin===!1)return!1;this.store.chain.plugin(this.store.chainName.plugin.tsCheckerRspackPlugin).use(ts,[this.store.empConfig.tsCheckerRspackPlugin])}async define(){this.store.chain.plugin(this.store.chainName.plugin.define).use(j.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");st.existsSync(e)&&st.readdirSync(e).length>0&&this.store.chain.plugin(this.store.chainName.plugin.copy).use(j.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve(this.store.empConfig.build.outDir),noErrorOnMissing:!0,globOptions:{ignore:["**/.DS_Store"]}}]}])}async progress(){if(!this.store.empConfig.debug.progress)return;let e={};this.store.isOldRspack||(e={template:"{bar:25.green/white}{spinner:.green}{percent}% {wide_msg:.dim}",tick:void 0,progressChars:"\u25A9\u25A9"}),this.store.chain.plugin(this.store.chainName.plugin.progress).use(j.ProgressPlugin,[e])}minify(){this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minJs).use(j.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]);let{SwcCssMinimizerRspackPlugin:e,LightningCssMinimizerRspackPlugin:t}=j;e?this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(e,[this.store.empConfig.build.cssminOptions]):t&&this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(t,[this.store.empConfig.build.cssminOptions])}redoctor(){if(!this.store.empConfig.debug.rsdoctor)return;let{RsdoctorRspackPlugin:e}=v("@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])}sourceMapDevToolPlugin(){if(!this.store.empConfig.build.sourcemap)return;let e={};typeof this.store.empConfig.build.sourcemap=="object"&&(e=this.store.empConfig.build.sourcemap),this.store.chain.plugin(this.store.chainName.plugin.sourceMapDevTool).use(j.SourceMapDevToolPlugin,[e])}circularDependency(){this.store.chain.plugin("circularDependency").use(j.CircularDependencyRspackPlugin,[{}])}cssChunkingPlugin(){this.store.empConfig.debug.cssChunkingPlugin&&this.store.chain.plugin("CssChunkingPlugin").use(j.experiments.CssChunkingPlugin,[{}])}},it=new Ce});var we,ot,nt=m(()=>{"use strict";o();qe();Ke();Ye();tt();rt();we=class{store;async setup(e){this.store=e;let t=[We.setup(this.store),et.setup(this.store),it.setup(this.store),Qe.setup(this.store),Xe.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()}},ot=new we});import ss from"net";import is from"os";async function K(s,e=void 0){if(s!==rs&&(s<pt||s>xe))throw new Error(`Port number must lie between ${pt} and ${xe}`);let t=s,i=os(),r;e&&!i.has(e)?r=new Set([e]):r=i;let p=new Set(["EADDRINUSE","EACCES"]);for(;t<=xe;)try{return await ps(t,r)}catch(u){if(!p.has(u.code))throw u;t+=1}throw new Error("No available ports found")}var pt,xe,rs,os,ns,ps,at=m(()=>{"use strict";o();pt=1024,xe=65535,rs=443,os=()=>{let s=is.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(s))if(t)for(let i of t)e.add(i.address);return e},ns=(s,e)=>new Promise((t,i)=>{let r=ss.createServer();r.unref(),r.on("error",i),r.listen(s,e,()=>{let{port:p}=r.address();r.close(()=>{t(p)})})}),ps=async(s,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let i of e)try{await ns(s,i)}catch(r){if(!t.has(r.code))throw r}return s}});import as from"chalk";import lt from"url";var Se,Q,ct=m(()=>{"use strict";o();L();C();Se=class{imf={protocol:"",port:8e3,pathname:"/"};host="0.0.0.0";urls={lanUrlForConfig:"",lanUrlForTerminal:A("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==="::",i;if(t){i="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 i=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(i),this.urls.localUrlForBrowser=this.formatUrl(i)}getLanIp=R;formatUrl(e){let{protocol:t,port:i,pathname:r}=this.imf;return lt.format({protocol:t,hostname:e,port:i,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:i,pathname:r}=this.imf;return lt.format({protocol:t,hostname:e,port:as.bold(i),pathname:r})}},Q=new Se});import{exec as ls}from"child_process";import{promisify as cs}from"util";var ut,mt,ms,us,ht,ft=m(()=>{"use strict";o();k();E();ut=cs(ls),mt=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],ms=async()=>{let s=process.env.BROWSER;if(!s||!mt.includes(s)){let{stdout:e}=await ut("ps cax");s=mt.find(t=>e.includes(t))}return s},us=async s=>{if(process.platform==="darwin")try{let t=await ms();if(t){let i=`osascript openChrome.applescript "${encodeURI(s)}" "${t}"`;return await ut(i,{cwd:a.resource.dir}),!0}}catch(t){n.debug(t)}try{let{default:t}=await import("open");return await t(s),!0}catch(t){return n.error("Failed to open start URL."),n.error(t),!1}},ht=us});import gt from"fs/promises";var Y,dt=m(()=>{"use strict";o();z();L();at();ct();ft();C();Y=class{ip=R();host=this.ip;isAutoDevBase=!1;isHttps=!1;httpsType="default";protocol="http";port=8e3;store;publicPath="/";publicHasHttp=!1;isOpenBrower=!1;url="";urls={localUrlForBrowser:"",localUrlForTerminal:"",lanUrlForTerminal:"",lanUrlForConfig:""};constructor(e){this.store=e}async setupOnEmpOptionSync(){this.store.cliAction!=="build"&&(this.port=await K(this.port),this.setHttps(),await this.setAutoDevBase())}get config(){return{}}async setupOnStore(){if(this.store.cliAction==="build")return;let{store:e}=this;this.publicPath=e.rsConfig.output?.publicPath==="auto"?"/":e.rsConfig.output?.publicPath||"/",this.isOpenBrower=!!e.empConfig.server.open,this.protocol=this.isHttps?"https":"http",this.host=e.empConfig.server.host?e.empConfig.server.host:this.ip,e.empConfig.server.port&&e.empConfig.server.port!==this.port&&(this.port=await K(e.empConfig.server.port)),Q.setup(this),this.publicPath&&(this.publicPath.indexOf("http://")>-1||this.publicPath.indexOf("https://")>-1)?(this.url=this.publicPath,this.publicHasHttp=!0,this.urls.localUrlForTerminal=Q.prettyPrintUrl("localhost")):(this.urls=Q.urls,this.url=this.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this;this.publicHasHttp?(n.info(`${S("\u279C")} Local: ${n.link(e.localUrlForTerminal)}`),n.info(`${S("\u279C")} Network: ${n.link(this.publicPath)}`)):(n.info(`${S("\u279C")} Local: ${n.link(e.localUrlForTerminal)}`),n.info(`${S("\u279C")} Network: ${n.link(e.lanUrlForTerminal)}
12
- `)),this.isOpenBrower&&ht(this.url)}async getcert(){let{store:e}=this,t=this.store.rsConfig.devServer||{server:{type:"http"}};if(typeof t.server=="object"&&t.server.type==="https"&&t.server.options&&t.server.options.key&&t.server.options.cert)return t.server.options;let[i,r]=await Promise.all([gt.readFile(e.resource.key),gt.readFile(e.resource.cert)]);return{key:i,cert:r}}setHttps(){let{store:e}=this,{server:t,https:i}=e.empOptions.server||{};this.isHttps=t==="https"||typeof t=="object"&&t.type==="https"||i===!0}async setAutoDevBase(){let{store:e}=this;this.isAutoDevBase=!!e.empOptions.autoDevBase&&e.mode==="development"&&!this.isHttpBase,this.isAutoDevBase&&(this.protocol=this.isHttps?"https":"http",e.empOptions.server?.port&&(this.port=e.empOptions.server.port),this.port=await K(this.port),e.empOptions.base=`${this.protocol}://${this.host}:${this.port}/`,e.empOptions.server=e.deepAssign({port:this.port,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${this.host}:${this.port}/ws`}},e.empOptions.server))}get isHttpBase(){let e=this.store.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}}});import hs from"fs/promises";import x from"path";import fs from"util";import{rspack as gs}from"@rspack/core";var ke,a,k=m(()=>{"use strict";o();H();E();C();he();Ve();nt();dt();he();X();ke=class{rspackVersion=gs.rspackVersion;isOldRspack=J(this.rspackVersion,"1.0.0")===-1;empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=x.resolve(c,l).replace(`${x.sep}dist${x.sep}index.js`,"");empSource=x.resolve(this.empRoot,"dist");resolve=e=>x.isAbsolute(e)?e:x.resolve(this.root,e);empResolve=e=>x.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};chainName=Be;server=new Y(this);cacheDir="";mode="development";cliMode="dev";isDev=!0;cliOptions;chain;rsConfig;empOptions={};empConfig;entries={};debug;cliAction;rootPaths={empConfig:void 0,tsConfig:void 0,pkg:void 0};async setup(e,t){n.time("[store]Setup");let[i,r]=await Promise.all([ze(),Ge()]);this.rootPaths.empConfig=i,this.rootPaths.tsConfig=r,this.rootPaths.pkg=this.resolve("package.json"),await this.initVars(e,t),this.empConfig=_e,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new Ue,await ot.setup(this),this.setLogger(),this.toConfig(),this.logConfig(),await this.server.setupOnStore(),n.timeEnd("[store]Setup")}async initVars(e,t){this.cliAction=e,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 i=v(this.empResolve("package.json")),r=v(this.resolve("package.json"));this.empPkg={...this.empPkg,...i},this.pkg={...this.pkg,...r},this.resource.dir=x.join(this.empRoot,"resource"),this.resource.cert=x.join(this.resource.dir,"emp.cert"),this.resource.key=x.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)}loggerExtensionName="";setLoggerExtensionName(e){this.loggerExtensionName=e}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),n.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}${this.loggerExtensionName?" "+this.loggerExtensionName:""}`,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.join(this.root,this.debug.showRsconfig);hs.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"?b(e,this.debug.showRsconfig):e;console.log(n.link("[Compile Config]")),console.log(fs.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.encodeVarName(this.pkg.name)}encodeVarName(e){return e.replaceAll("/","_").replaceAll("@","_").replaceAll("-","_")}vCompare=J;deepAssign=b;getLanIp=R;injectTags(e=[],t="",i=""){this.chain.plugin(`${G}-${t}`).use(G,[e,t,i])}},a=new ke});import ds from"fs";import $ from"path";import{gzipSizeSync as ys}from"gzip-size";function ks(s,e){let t=[s,e],i=["File","Size","Gzipped"].reduce((r,p,u)=>{let h=t[u],d=p;return h&&(d=p.length<h?p+" ".repeat(h-p.length):p),`${r+d} `}," ");console.log(N.bold(i))}async function yt(s){let e=s.toJson({all:!1,assets:!0,timings:!0}),i=e.assets.filter(g=>ws(g.name)).map(Ss);i.sort((g,O)=>g.size-O.size);let r=Math.max(...i.map(g=>g.sizeLabel.length)),p=Math.max(...i.map(g=>(g.folder+$.sep+g.name).length));ks(p,r);let u=0,h=0;i.forEach(g=>{let{sizeLabel:O}=g,{name:$t,folder:Tt,gzipSizeLabel:Dt}=g,Te=(Tt+$.sep+$t).length,De=O.length;if(u+=g.size,h+=g.gzippedSize,De<r){let re=" ".repeat(r-De);O+=re}let Re=A(g.folder+$.sep)+Os(g.name);if(Te<p){let re=" ".repeat(p-Te);Re+=re}n.info(` ${Re} ${A(O)} ${Dt}`)});let d=`${N.bold("Total size:")} ${Z(u)}`,P=`${N.bold("Gzipped size:")} ${Z(h)}`;n.info(`
2
+ var Rt=Object.defineProperty;var v=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var m=(s,e)=>()=>(s&&(e=s(s=0)),e);var F=(s,e)=>{for(var t in e)Rt(s,t,{get:e[t],enumerable:!0})};import Nt from"path";import{fileURLToPath as Lt}from"url";var Ne,At,c,l,o=m(()=>{"use strict";Ne=()=>Lt(import.meta.url),At=()=>Nt.dirname(Ne()),c=At(),l=Ne()});import y from"chalk";var Ft,S,zt,Gt,It,ne,B,Ut,Bt,N,pe,Ht,ae,L,h,A=m(()=>{"use strict";o();Ft=y.hex("#1abc9c"),S=y.hex("#16a085"),zt=y.hex("#2ecc71"),Gt=y.hex("#27ae60"),It=y.hex("#e74c3c"),ne=y.hex("#c0392b"),B=y.hex("#f1c40f"),Ut=y.hex("#f39c12"),Bt=y.hex("#3498db"),N=y.hex("#2980b9"),pe=y.hex("#ecf0f1"),Ht=y.hex("#fd79a8"),ae=y.hex("#e84393"),L=y.hex("#7f8c8d"),h={lightGreen:Ft,green:S,lightCyan:zt,cyan:Gt,lightRed:It,red:ne,yellow:B,orange:Ut,lightBlue:Bt,blue:N,white:pe,lightMagenta:Ht,magenta:ae,gray:L}});var H,n,P=m(()=>{"use strict";o();A();H=class{brandName="";fullName="";logLevel="debug";isLogTime=!1;setup({brandName:e,logLevel:t,fullName:i}){this.brandName=` [${e}] `,this.fullName=` ${i} `,this.fullName=h.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(`${h.lightBlue(this.brandName)}${h.blue(` ${e} `)}
3
+ `)};cyan=e=>{console.log(`${h.lightCyan(this.brandName)}${h.cyan(` ${e} `)}
4
+ `)};magenta=e=>{console.log(`${h.lightMagenta(this.brandName)}${h.magenta(` ${e} `)}
5
+ `)};green=e=>{console.log(`${h.lightGreen(this.brandName)}${h.green(` ${e} `)}
6
+ `)};yellow=e=>{console.log(`${h.yellow(this.brandName)}${h.orange(` ${e} `)}
7
+ `)};red=e=>{console.log(`${h.lightRed(this.brandName)}${h.red(` ${e} `)}
8
+ `)};sysError=e=>{console.log(`${h.lightRed(" System Error Tips ")}${h.red(` ${e} `)}
9
+ `)};link=e=>h.blue(e);title=e=>{console.log(`${this.fullName}${h.yellow.underline(`${e}`)}
10
+ `)}},n=new H});import Ae from"fs";import{createJiti as Jt}from"jiti";import Me from"path";var _t,Fe,ze,Ge,Ie,J=m(()=>{"use strict";o();k();P();_t=["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"],Fe=Jt(l,{interopDefault:!0}),ze=async()=>{n.time("[store]GetEmpConfigPath");let s=_t.map(i=>Me.resolve(a.root,i)),e=await Promise.all(s.map(i=>Ae.promises.access(i).then(()=>!0,()=>!1))),t=s.find((i,r)=>e[r]);return n.timeEnd("[store]GetEmpConfigPath"),t},Ge=async()=>{let s=Me.join(a.root,"tsconfig.json");return await Ae.promises.access(s).then(()=>!0,()=>!1)||(s=void 0),s},Ie=()=>{let s=[l];return a.rootPaths.pkg&&s.push(a.rootPaths.pkg),a.rootPaths.empConfig&&s.push(a.rootPaths.empConfig),a.rootPaths.tsConfig&&s.push(a.rootPaths.tsConfig),s}});var ue={};F(ue,{clearConsole:()=>ce,deepAssign:()=>b,ensureArray:()=>Kt,getLanIp:()=>D,getPkgVersion:()=>le,importJsVm:()=>me,jsonFilter:()=>Qt,timeFormat:()=>V,vCompare:()=>_});import{ip as Vt}from"address";import Wt from"chalk";import{gateway4sync as qt}from"default-gateway";import Xt from"fs-extra";function ce(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function b(s,...e){for(let t of e)for(let i in t){let r=t[i],p=s[i];if(Object(r)==r&&Object(p)===p){s[i]=b(p,r);continue}s[i]=t[i]}return s}var D,le,Kt,Qt,_,V,me,C=m(()=>{"use strict";o();D=()=>{let s="127.0.0.1";try{let{int:e}=qt();return Vt(e||"")||s}catch{return s}},le=s=>{try{let{version:e}=Xt.readJSONSync(s);return e}catch{return}};Kt=s=>Array.isArray(s)?s:[s],Qt=(s={},e=[])=>Object.keys(s).filter(t=>!e.includes(t)).reduce((t,i)=>(t[i]=s[i],t),{}),_=(s="",e="")=>{let t=s.replace("^","").split("."),i=e.replace("^","").split("."),r=Math.max(t.length,i.length),p=0;for(let u=0;u<r;u++){let f=t.length>u?t[u]:0,d=isNaN(Number(f))?f.charCodeAt():Number(f),E=i.length>u?i[u]:0,g=isNaN(Number(E))?E.charCodeAt():Number(E);if(d<g){p=-1;break}else if(d>g){p=1;break}}return p},V=s=>{s=s/1e3;let e=i=>Wt.bold(i);if(s<1)return`${s*1e3} ms`;if(s<10){let i=s>=.01?2:3;return`${e(s.toFixed(i))} s`}if(s<60)return`${e(s.toFixed(1))} s`;let t=s/60;return`${e(t.toFixed(2))} m`},me=s=>`data:text/javascript,${s}`});import Ue from"@empjs/chain";var Be,he=m(()=>{"use strict";o();Be={rule:{mjs:"mjs",typescript:"typescript",javascript:"javascript",sourceMap:"sourceMapLoader",inline:"inline",raw:"raw",svg:"svg",image:"image",font:"fonts",svga:"svga",sass:"sass",less:"less",css:"css"},use:{swc:"swc",sourceMap:"sourceMapLoader",sass:"sassLoader",less:"lessLoader"},plugin:{tsCheckerRspackPlugin:"TsCheckerRspackPlugin",bundleAnalyzer:"bundleAnalyzerPlugin",define:"definePlugin",copy:"copyRspackPlugin",progress:"progressPlugin",html:{prefix:"html-plugin-"},rsdoctor:"rsdoctor",sourceMapDevTool:"sourceMapDevTool"},minimizer:{minJs:"minJs",minCss:"minCss"}}});var He={};F(He,{chalk:()=>Yt,color:()=>h,glob:()=>W,logger:()=>n,utils:()=>ue});import Yt from"chalk";import{glob as W}from"glob";var z=m(()=>{"use strict";o();A();P();C()});var q,Je=m(()=>{"use strict";o();q=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){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 fe,_e,Ve=m(()=>{"use strict";o();z();J();C();Je();fe=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},b(e,t)}isESM=!1;checkIsESM(e){return["es3","es5"].indexOf(e)===-1}lifeCycle;async setup(e){this.store=e,await this.syncEmpOptions(),await this.setupEmpOptions(),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:i,appEntry:r}=this.store.empOptions;t&&(this.appSrc=t),i&&(this.base=i),r&&(this.appEntry=r)}async setupEmpOptions(){await this.store.server.setupOnEmpOptionSync()}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={}),this.assign({loggerLevel:"info",clearLog:!1,progress:!0,showRsconfig:!1,showPerformance:!1,rsdoctor:e,infrastructureLogging:{appendOnly:!0,level:"warn"},newTreeshaking:this.store.empConfig.isESM,devShowAllLog:!1,showScriptDebug:!1,parallelCodeSplitting:!0,cssChunkingPlugin:!0,warnRuleAsWarning:!0},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:{mode:void 0,entryCdn:void 0,splitChunks:!1,include:[],coreJsFeatures:"stable",externalHelpers:!1,browserslist:this.store.browserslistOptions.default},swcConfig:{},devtool:this.store.isDev?"cheap-module-source-map":"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,cache:this.cache!==!1,tags:[]},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&&(this.store.server.httpsType="h2",delete this.store.empOptions.server.http2),this.assign(e,this.store.empOptions.server)}get css(){return this.assign({sass:{mode:"modern",warnRuleAsWarning:this.store.empConfig.debug.warnRuleAsWarning},prifixName:""},this.store.empOptions.css)}get output(){let e=(this.store.isDev,".[contenthash:8]"),t=this.store.isDev?"":".[contenthash:8]",{assetsDir:i,staticDir:r}=this.store.empConfig.build,p={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}${i}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!this.store.isDev,uniqueName:this.store.uniqueName};return this.assign(p,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)}get tsCheckerRspackPlugin(){let e={};if(this.store.empOptions.tsCheckerRspackPlugin)typeof this.store.empOptions.tsCheckerRspackPlugin=="object"&&(e=this.store.empOptions.tsCheckerRspackPlugin);else return!1;return this.assign({},e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",i={};return Object.keys(e).map(r=>{t==="all"?(i[`import.meta.env.${r}`]=JSON.stringify(e[r]),i[`process.env.${r}`]=JSON.stringify(e[r])):t==="esm"?i[`import.meta.env.${r}`]=JSON.stringify(e[r]):t==="cjs"?i[`process.env.${r}`]=JSON.stringify(e[r]):t==="none"&&(i[`${r}`]=JSON.stringify(e[r]))}),i}get externals(){return this.assign({},this.store.empOptions.externals)}get resolve(){return b({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(){if(n.time("[store][empConfig]SyncEmpOptions"),!this.store.rootPaths.empConfig)return;let e=await Fe(this.store.rootPaths.empConfig);typeof e=="function"?this.store.empOptions=await e(this.store):this.store.empOptions=e||{},n.timeEnd("[store][empConfig]SyncEmpOptions")}get moduleTransformRule(){let{moduleTransform:e}=this.store.empOptions,t=this.assign({defaultExclude:!1},e),i={and:[],not:[]};return t.defaultExclude===!0&&i.and.push(/(node_modules|bower_components)/),t?.exclude&&(i.and=i.and.concat(t.exclude)),e?.include&&(i.not=t.include),i}get cacheDir(){return this.store.empOptions.cacheDir?this.store.empOptions.cacheDir:"node_modules/.emp-cache"}get cache(){return this.store.empOptions.cache===!1?!1:this.store.empOptions.cache?this.store.empOptions.cache:"persistent"}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}},_e=new fe});import Zt from"fs-extra";var ge,We,qe=m(()=>{"use strict";o();J();ge=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({name:this.store.pkg.name,node:{global:!0},experiments:{nativeWatcher:!1,outputModule:this.store.empConfig.isESM,topLevelAwait:!0,asyncWebAssembly:!0,css:!0,rspackFuture:{bundlerInfo:{force:!1}},cache:{type:this.store.empConfig.cache==="persistent"?"persistent":"memory",buildDependencies:Ie(),version:this.store.empPkg.version},incremental:"advance-silent",parallelCodeSplitting:this.store.empConfig.debug.parallelCodeSplitting,parallelLoader:!0},target:this.store.empConfig.target,infrastructureLogging:this.store.empConfig.debug.infrastructureLogging,context:this.store.root,mode:this.store.mode,cache:!!this.store.empConfig.cache,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 Zt.exists(e)){let i={};this.store.isOldRspack?i.tsConfigPath=e:i.tsConfig=e,this.store.merge({resolve:i})}}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.mode==="entry"&&this.store.empConfig.build.polyfill.splitChunks&&!this.store.empConfig.build.polyfill.entryCdn&&(e.splitChunks.cacheGroups.coreJs={test:/[\\/]node_modules[\\/](core-js)[\\/]/,name:"coreJs",chunks:"all",enforce:!0}),this.store.chain.merge({optimization:e})}},We=new ge});var de,Xe,Ke=m(()=>{"use strict";o();de=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,i={},{sass:r}=this.store.empConfig.css;r.mode==="modern"&&(i.implementation=r.implementation?r.implementation:v.resolve("sass-embedded"),i.api="modern-compiler",i.sourceMap=this.store.empConfig.build.sourcemap,r.sassOptions&&(i.sassOptions=r.sassOptions)),typeof r.warnRuleAsWarning<"u"&&(i.warnRuleAsWarning=r.warnRuleAsWarning),typeof r.webpackImporter<"u"&&(i.webpackImporter=r.webpackImporter),this.store.chain.merge({module:{rule:{[e.sass]:{test:/\.(sass|scss)$/,use:{[t.sass]:{loader:v.resolve("sass-loader"),options:i}},type:"css/auto"}}}})}async less(){let{rule:e,use:t}=this.store.chainName,i={loader:v.resolve("less-loader"),options:{lessOptions:{javascriptEnabled:!0}}};this.store.chain.merge({module:{rule:{[e.less]:{test:/\.less$/,use:{[t.less]:i},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"}}}})}},Xe=new de});import ye from"html-webpack-plugin";function es(){let s=[`import 'core-js/${a.empConfig.build.polyfill.coreJsFeatures}'`].join(`
11
+ `);return me(s)}var X,G,K=m(()=>{"use strict";o();C();k();X=class{constructor(){}apply(e){let{webpack:t}=e;a.empConfig.build.polyfill.entryCdn||new t.EntryPlugin(e.context,es(),{name:void 0}).apply(e)}},G=class{PluginName="HtmlEmpInjectPlugin";chunk="";files=[];constructor(e,t="",i=""){this.PluginName=`${this.PluginName}-${t}`,this.files=e,this.chunk=i}apply(e){e.hooks.compilation.tap(this.PluginName,t=>{ye.getHooks(t).alterAssetTagGroups.tapPromise(this.PluginName,async i=>(this.chunk&&!i.plugin.userOptions.chunks?.includes(this.chunk)||this.files.map(r=>{let{pos:p,...u}=r;(p==="body"?i.bodyTags:i.headTags).push({attributes:{},voidTag:!1,meta:{plugin:void 0},tagName:"script",...u})}),i))})}}});import w from"path";var ve,Qe,Ye=m(()=>{"use strict";o();z();K();ve=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),this.prepareAndSetAsset(e),e}prepareAndSetAsset(e){let t=e.chunks?e.chunks[0]:void 0;this.store.injectTags(e.tags,t?`injectTags-${t}`:"injectTags",t),delete e.tags}injectPolyfill(){if(!this.store.empConfig.build.polyfill.entryCdn)return;let e=[{attributes:{src:this.store.empConfig.build.polyfill.entryCdn},tagName:"script",pos:"head"}];this.store.injectTags(e,"injectEMPPolyfill")}setChunk(e){return e.replace(w.extname(e),"").replace(`${this.store.empConfig.appSrc}${w.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(w.join("template","index.html"))}setFavicion(e){if(e!=="")return e?this.store.resolve(e):this.store.empResolve(w.join("template","favicon.ico"))}setEntryItem(e,t,i){i=i||this.store.resolve(w.join(this.store.empConfig.appSrc,e));let r=this.setChunk(e),p=[i];this.entriesConfig[r]={entry:{[r]:p},html:this.setHtmlConfig(t,[r])},this.store.entries[r]=p}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`${this.store.chainName.plugin.html.prefix}${t}`).use(ye,[e])}setRspackEntry(e){this.store.merge({entry:e})}async init(){this.injectPolyfill(),this.store.empConfig.autoPages?await this.setAutoPage():(await this.setDefaultEntry(),this.setEntryByConfig())}async setAutoPage(){n.time("setAutoPage");let e=this.store.empConfig.autoPages?.path||"pages",t=w.join(this.store.appSrc,e),i=w.join(t,"**","*.{ts,tsx,jsx,js}"),r=await W([i],{windowsPathsNoEscape:!0});r=r.map(p=>p.replace(`${t}${w.sep}`,"")),r.map(p=>{let u=this.store.empConfig.entries[p]||{};this.setEntryItem(p,{...this.store.empConfig.html,...u},w.join(t,p))}),n.timeEnd("setAutoPage")}async setDefaultEntry(){n.time("[store][empConfig]SetDefaultEntry");let e=w.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}"),t=await W([e],{windowsPathsNoEscape:!0});if(t[0]){let i=w.join(this.store.empConfig.appSrc,Object.keys(this.store.empConfig.entries).length>0&&this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index");this.setEntryItem(i,this.store.empConfig.html,t[0])}n.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)}},Qe=new ve});import Ze from"path";var be,et,tt=m(()=>{"use strict";o();C();be=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.empConfig.css?.prifixName?`${this.store.empConfig.css?.prifixName}-`:"",t=this.store.isDev?`${e}[path][name]-[local]-[hash:5]`:`${e}[local]-[hash:5]`;this.store.chain.merge({module:{generator:{"css/auto":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:t,esModule:!0},css:{exportsOnly:!1,esModule:!0},"css/module":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:t,esModule:!0},json:{JSONParse:!0}}}})}rspackParser(){this.store.chain.merge({module:{parser:{javascript:{dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,url:!0,importMeta:!0},css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return!!this.store.empConfig.build.polyfill.mode}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,polyfill:i}=this.store.empConfig.build,{externalHelpers:r}=i;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:r,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:b(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.polyfill.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill.mode),this.store.empConfig.build.polyfill.mode==="usage"&&(t.env.shippedProposals=!0,t.env.include=this.store.empConfig.build.polyfill.include)),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build.polyfill;e&&this.store.chain.resolve.alias.set("@swc/helpers",Ze.dirname(v.resolve("@swc/helpers/package.json"))),this.coreJs.path=v.resolve("core-js/package.json");let t=le(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=Ze.dirname(this.coreJs.path),this.store.empConfig.build.polyfill.mode&&(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:i}=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:{[i.swc]:{loader:"builtin:swc-loader",options:this.swcTsOptions}}},[t.javascript]:{test:/\.((m|c)?js|jsx)$/,exclude:e,use:{[i.swc]:{loader:"builtin:swc-loader",options:this.swcJsOptions}}}}}})}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.raw]:{resourceQuery:/raw/,type:"asset/source"}}}}),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"}}}})}},et=new be});import j from"@rspack/core";import st from"fs";import{TsCheckerRspackPlugin as ts}from"ts-checker-rspack-plugin";var Ce,it,rt=m(()=>{"use strict";o();K();Ce=class{store;async setup(e){this.store=e;let t=[this.define(),this.anylayze(),this.progress(),this.copy(),this.minify(),this.redoctor(),this.tsCheckerRspackPlugin(),this.cssChunkingPlugin()];this.beforeLifeCycle(),await this.store.empConfig.lifeCycle.beforePlugin(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterPlugin()}beforeLifeCycle(){let{store:e}=this;e.empConfig.build.polyfill.mode==="entry"&&e.chain.plugin("empPolyfill").use(X)}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"}])}tsCheckerRspackPlugin(){if(this.store.empConfig.tsCheckerRspackPlugin===!1)return!1;this.store.chain.plugin(this.store.chainName.plugin.tsCheckerRspackPlugin).use(ts,[this.store.empConfig.tsCheckerRspackPlugin])}async define(){this.store.chain.plugin(this.store.chainName.plugin.define).use(j.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");st.existsSync(e)&&st.readdirSync(e).length>0&&this.store.chain.plugin(this.store.chainName.plugin.copy).use(j.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve(this.store.empConfig.build.outDir),noErrorOnMissing:!0,globOptions:{ignore:["**/.DS_Store"]}}]}])}async progress(){if(!this.store.empConfig.debug.progress)return;let e={};this.store.isOldRspack||(e={template:"{bar:25.green/white}{spinner:.green}{percent}% {wide_msg:.dim}",tick:void 0,progressChars:"\u25A9\u25A9"}),this.store.chain.plugin(this.store.chainName.plugin.progress).use(j.ProgressPlugin,[e])}minify(){this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minJs).use(j.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]);let{SwcCssMinimizerRspackPlugin:e,LightningCssMinimizerRspackPlugin:t}=j;e?this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(e,[this.store.empConfig.build.cssminOptions]):t&&this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(t,[this.store.empConfig.build.cssminOptions])}redoctor(){if(!this.store.empConfig.debug.rsdoctor)return;let{RsdoctorRspackPlugin:e}=v("@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])}sourceMapDevToolPlugin(){if(!this.store.empConfig.build.sourcemap)return;let e={};typeof this.store.empConfig.build.sourcemap=="object"&&(e=this.store.empConfig.build.sourcemap),this.store.chain.plugin(this.store.chainName.plugin.sourceMapDevTool).use(j.SourceMapDevToolPlugin,[e])}circularDependency(){this.store.chain.plugin("circularDependency").use(j.CircularDependencyRspackPlugin,[{}])}cssChunkingPlugin(){this.store.empConfig.debug.cssChunkingPlugin&&this.store.chain.plugin("CssChunkingPlugin").use(j.experiments.CssChunkingPlugin,[{}])}},it=new Ce});var we,ot,nt=m(()=>{"use strict";o();qe();Ke();Ye();tt();rt();we=class{store;async setup(e){this.store=e;let t=[We.setup(this.store),et.setup(this.store),it.setup(this.store),Qe.setup(this.store),Xe.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()}},ot=new we});import ss from"net";import is from"os";async function Q(s,e=void 0){if(s!==rs&&(s<pt||s>xe))throw new Error(`Port number must lie between ${pt} and ${xe}`);let t=s,i=os(),r;e&&!i.has(e)?r=new Set([e]):r=i;let p=new Set(["EADDRINUSE","EACCES"]);for(;t<=xe;)try{return await ps(t,r)}catch(u){if(!p.has(u.code))throw u;t+=1}throw new Error("No available ports found")}var pt,xe,rs,os,ns,ps,at=m(()=>{"use strict";o();pt=1024,xe=65535,rs=443,os=()=>{let s=is.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(s))if(t)for(let i of t)e.add(i.address);return e},ns=(s,e)=>new Promise((t,i)=>{let r=ss.createServer();r.unref(),r.on("error",i),r.listen(s,e,()=>{let{port:p}=r.address();r.close(()=>{t(p)})})}),ps=async(s,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let i of e)try{await ns(s,i)}catch(r){if(!t.has(r.code))throw r}return s}});import as from"chalk";import lt from"url";var Se,Y,ct=m(()=>{"use strict";o();A();C();Se=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==="::",i;if(t){i="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 i=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(i),this.urls.localUrlForBrowser=this.formatUrl(i)}getLanIp=D;formatUrl(e){let{protocol:t,port:i,pathname:r}=this.imf;return lt.format({protocol:t,hostname:e,port:i,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:i,pathname:r}=this.imf;return lt.format({protocol:t,hostname:e,port:as.bold(i),pathname:r})}},Y=new Se});import{exec as ls}from"child_process";import{promisify as cs}from"util";var ut,mt,ms,us,ht,ft=m(()=>{"use strict";o();k();P();ut=cs(ls),mt=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],ms=async()=>{let s=process.env.BROWSER;if(!s||!mt.includes(s)){let{stdout:e}=await ut("ps cax");s=mt.find(t=>e.includes(t))}return s},us=async s=>{if(process.platform==="darwin")try{let t=await ms();if(t){let i=`osascript openChrome.applescript "${encodeURI(s)}" "${t}"`;return await ut(i,{cwd:a.resource.dir}),!0}}catch(t){n.debug(t)}try{let{default:t}=await import("open");return await t(s),!0}catch(t){return n.error("Failed to open start URL."),n.error(t),!1}},ht=us});import gt from"fs/promises";var Z,dt=m(()=>{"use strict";o();z();A();at();ct();ft();C();Z=class{ip=D();host=this.ip;isAutoDevBase=!1;isHttps=!1;httpsType="default";protocol="http";port=8e3;store;publicPath="/";publicHasHttp=!1;isOpenBrower=!1;url="";urls={localUrlForBrowser:"",localUrlForTerminal:"",lanUrlForTerminal:"",lanUrlForConfig:""};constructor(e){this.store=e}async setupOnEmpOptionSync(){this.store.cliAction!=="build"&&(this.port=await Q(this.port),this.setHttps(),await this.setAutoDevBase())}get config(){return{}}async setupOnStore(){if(this.store.cliAction==="build")return;let{store:e}=this;this.publicPath=e.rsConfig.output?.publicPath==="auto"?"/":e.rsConfig.output?.publicPath||"/",this.isOpenBrower=!!e.empConfig.server.open,this.protocol=this.isHttps?"https":"http",this.host=e.empConfig.server.host?e.empConfig.server.host:this.ip,e.empConfig.server.port&&e.empConfig.server.port!==this.port&&(this.port=await Q(e.empConfig.server.port)),Y.setup(this),this.publicPath&&(this.publicPath.indexOf("http://")>-1||this.publicPath.indexOf("https://")>-1)?(this.url=this.publicPath,this.publicHasHttp=!0,this.urls.localUrlForTerminal=Y.prettyPrintUrl("localhost")):(this.urls=Y.urls,this.url=this.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this;this.publicHasHttp?(n.info(`${S("\u279C")} Local: ${n.link(e.localUrlForTerminal)}`),n.info(`${S("\u279C")} Network: ${n.link(this.publicPath)}`)):(n.info(`${S("\u279C")} Local: ${n.link(e.localUrlForTerminal)}`),n.info(`${S("\u279C")} Network: ${n.link(e.lanUrlForTerminal)}
12
+ `)),this.isOpenBrower&&ht(this.url)}async getcert(){let{store:e}=this,t=this.store.rsConfig.devServer||{server:{type:"http"}};if(typeof t.server=="object"&&t.server.type==="https"&&t.server.options&&t.server.options.key&&t.server.options.cert)return t.server.options;let[i,r]=await Promise.all([gt.readFile(e.resource.key),gt.readFile(e.resource.cert)]);return{key:i,cert:r}}setHttps(){let{store:e}=this,{server:t,https:i}=e.empOptions.server||{};this.isHttps=t==="https"||typeof t=="object"&&t.type==="https"||i===!0}async setAutoDevBase(){let{store:e}=this;this.isAutoDevBase=!!e.empOptions.autoDevBase&&e.mode==="development"&&!this.isHttpBase,this.isAutoDevBase&&(this.protocol=this.isHttps?"https":"http",e.empOptions.server?.port&&(this.port=e.empOptions.server.port),this.port=await Q(this.port),e.empOptions.base=`${this.protocol}://${this.host}:${this.port}/`,e.empOptions.server=e.deepAssign({port:this.port,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${this.host}:${this.port}/ws`}},e.empOptions.server))}get isHttpBase(){let e=this.store.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}}});import hs from"fs/promises";import x from"path";import fs from"util";import{rspack as gs}from"@rspack/core";var ke,a,k=m(()=>{"use strict";o();J();P();C();he();Ve();nt();dt();he();K();ke=class{rspackVersion=gs.rspackVersion;isOldRspack=_(this.rspackVersion,"1.0.0")===-1;empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=x.resolve(c,l).replace(`${x.sep}dist${x.sep}index.js`,"");empSource=x.resolve(this.empRoot,"dist");resolve=e=>x.isAbsolute(e)?e:x.resolve(this.root,e);empResolve=e=>x.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};chainName=Be;server=new Z(this);cacheDir="";mode="development";cliMode="dev";isDev=!0;cliOptions;chain;rsConfig;empOptions={};empConfig;entries={};debug;cliAction;rootPaths={empConfig:void 0,tsConfig:void 0,pkg:void 0};async setup(e,t){n.time("[store]Setup");let[i,r]=await Promise.all([ze(),Ge()]);this.rootPaths.empConfig=i,this.rootPaths.tsConfig=r,this.rootPaths.pkg=this.resolve("package.json"),await this.initVars(e,t),this.empConfig=_e,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new Ue,await ot.setup(this),this.setLogger(),this.toConfig(),this.logConfig(),await this.server.setupOnStore(),n.timeEnd("[store]Setup")}async initVars(e,t){this.cliAction=e,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 i=v(this.empResolve("package.json")),r=v(this.resolve("package.json"));this.empPkg={...this.empPkg,...i},this.pkg={...this.pkg,...r},this.resource.dir=x.join(this.empRoot,"resource"),this.resource.cert=x.join(this.resource.dir,"emp.cert"),this.resource.key=x.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)}loggerExtensionName="";setLoggerExtensionName(e){this.loggerExtensionName=e}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),n.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}${this.loggerExtensionName?" "+this.loggerExtensionName:""}`,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.join(this.root,this.debug.showRsconfig);hs.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"?b(e,this.debug.showRsconfig):e;console.log(n.link("[Compile Config]")),console.log(fs.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.encodeVarName(this.pkg.name)}encodeVarName(e){return e.replaceAll("/","_").replaceAll("@","_").replaceAll("-","_")}vCompare=_;deepAssign=b;getLanIp=D;injectTags(e=[],t="",i=""){this.chain.plugin(`${G}-${t}`).use(G,[e,t,i])}},a=new ke});import ds from"fs";import $ from"path";import{gzipSizeSync as ys}from"gzip-size";function ks(s,e){let t=[s,e],i=["File","Size","Gzipped"].reduce((r,p,u)=>{let f=t[u],d=p;return f&&(d=p.length<f?p+" ".repeat(f-p.length):p),`${r+d} `}," ");console.log(N.bold(i))}async function yt(s){let e=s.toJson({all:!1,assets:!0,timings:!0}),i=e.assets.filter(g=>ws(g.name)).map(Ss);i.sort((g,O)=>g.size-O.size);let r=Math.max(...i.map(g=>g.sizeLabel.length)),p=Math.max(...i.map(g=>(g.folder+$.sep+g.name).length));ks(p,r);let u=0,f=0;i.forEach(g=>{let{sizeLabel:O}=g,{name:$t,folder:Tt,gzipSizeLabel:Dt}=g,Te=(Tt+$.sep+$t).length,De=O.length;if(u+=g.size,f+=g.gzippedSize,De<r){let oe=" ".repeat(r-De);O+=oe}let Re=L(g.folder+$.sep)+Os(g.name);if(Te<p){let oe=" ".repeat(p-Te);Re+=oe}n.info(` ${Re} ${L(O)} ${Dt}`)});let d=`${N.bold("Total size:")} ${ee(u)}`,E=`${N.bold("Gzipped size:")} ${ee(f)}`;n.info(`
13
13
  ${d}
14
- ${P}
15
- `),n.info(`${S("\u2713")} Ready in ${_(Number(e.time))}
16
- `)}function ee(s=0){n.info(`${S("\u2713")} Ready in ${_(Number(s))}`)}var vs,bs,Cs,ws,xs,Ss,Z,Os,te=m(()=>{"use strict";o();L();k();E();C();vs=/\.html$/,bs=/\.(?:js|mjs|cjs|jsx)$/,Cs=/\.css$/,ws=s=>!/\.map$/.test(s)&&!/\.LICENSE\.txt$/.test(s),xs=s=>s>300*1e3?oe:s>100*1e3?B:ne,Ss=s=>{let e=s.name.split("?")[0],t=Z(s.size),i=$.basename(e),r=$.join($.basename(a.empConfig.build.outDir),$.dirname(e)),p=ds.readFileSync($.join(a.empConfig.build.outDir,e)),u=p.length,h=ys(p),d=xs(h)(Z(h));return{size:u,folder:r,name:i,gzippedSize:h,sizeLabel:t,gzipSizeLabel:d}};Z=s=>{let e=s/1e3;return`${e.toFixed(e<1?2:1)} kB`},Os=s=>bs.test(s)?B(s):Cs.test(s)?S(s):vs.test(s)?N(s):pe(s)});var T,se=m(()=>{"use strict";o();E();C();k();T=class{async setup(e,t){n.time(`[${e}]Setup`),await a.setup(e,t),a.debug.clearLog&&ce(),n.title(`${e}`),n.time(`[${e}]Run`),await this.run(),this.processExit(),n.timeEnd(`[${e}]Run`),n.timeEnd(`[${e}]Setup`)}async run(){}processExit(){process.on("SIGINT",function(){process.exit()})}}});import{RspackDevServer as Ps}from"@rspack/dev-server";import Es from"connect";var I,vt=m(()=>{"use strict";o();I=class{async setup(e,t,i,r=()=>{}){if(!t.devServer)return console.warn("rspackConfig.devServer need!");let p=new Ps(t.devServer,e);return await p.start(),p.middleware?.waitUntilValid(r),p}async beforeCompiler(e){return e.devServer.app=()=>Es(),e.devServer.server&&e.devServer.server.type==="https"&&(e.devServer.server.type="http2"),e}}});import bt from"fs";import js from"fs/promises";import $s from"compression";import Ts from"connect";import Ds from"cors";import Rs from"http2";import Ct from"path";import Ns from"serve-static";import{parse as As}from"url";var M,U,wt=m(()=>{"use strict";o();M=Ts();M.use($s());M.use(Ds());U=class{async setup(e,t=()=>{}){let i="index",r=Object.keys(e.rsConfig.entry);if(r.length===0)return e.logger.sysError("emp serve must include entry!");if(r.includes(i)||(i=r[0]),!bt.existsSync(e.outDir))return e.logger.sysError(`emp serve must be executed after emp build,${e.outDir} not exist!`);let p=e.resolve(e.rsConfig.output?.path);M.use(Ns(p));let u=await js.readFile(Ct.join(p,`${i}.html`),"utf8");if(M.use((h,d,P)=>{let O=As(h.url||"",!0).pathname;if(O&&O!=="/"&&bt.existsSync(Ct.join(p,O)))return P();d.setHeader("Content-Type","text/html"),d.end(u)}),e.server.isHttps){let{key:h,cert:d}=await e.server.getcert();Rs.createSecureServer(typeof e.server.isHttps!="boolean"?e.server.isHttps:{key:h,cert:d,allowHTTP1:!0},M).listen(e.server.port,t)}else v("http").createServer(M).listen(e.server.port,t)}}});var Oe=m(()=>{"use strict";o();vt();wt()});var St={};F(St,{default:()=>Ms});import{rspack as Ls}from"@rspack/core";var xt,Pe,Ms,kt=m(()=>{"use strict";o();te();C();se();Oe();k();xt=new I,Pe=class extends T{get stats(){return{all:a.empConfig.debug.devShowAllLog,colors:!0,assets:!1,chunks:!1,entrypoints:!1,timings:!1,version:!1,errors:!0,warnings:!0}}async getRspackDevConfig(){let e=b(a.rsConfig,{stats:this.stats,devServer:{open:!1,setupExitSignals:!0,port:a.server.port}}),{devServer:t}=e;if(a.server.isHttps&&(!t.server||t.server.type==="https"&&!t.server.options)){let{key:i,cert:r}=await a.server.getcert();t.server={type:"https",options:{key:i,cert:r}}}return Object.hasOwn(t,"https")&&delete t.https,e}async run(){let{server:e}=a,t=await this.getRspackDevConfig();t=await xt.beforeCompiler(t);let i=Ls(t);await a.empConfig.lifeCycle.beforeDevServe(),e.startOpen(),await xt.setup(i,t,a,async r=>{this.showTimeDone(r),await a.empConfig.lifeCycle.afterDevServe()}),a.debug.showPerformance&&i.hooks.afterDone.tap("done",this.showTimeDone)}showTimeDone=e=>{let t=e?.toJson({all:!1,colors:!1,assets:!1,chunks:!1,timings:!0});ee(t.time)}},Ms=new Pe});var Ee={};F(Ee,{ServeScript:()=>ie,default:()=>zs});var Fs,Ot,ie,zs,je=m(()=>{"use strict";o();te();se();Oe();k();Fs=new U,Ot=0,ie=class extends T{async run(){Ot=Date.now(),await a.empConfig.lifeCycle.beforeServe(),await Fs.setup(a,this.onReady)}onReady=async()=>{a.server.startOpen(),ee(Date.now()-Ot),await a.empConfig.lifeCycle.afterServe()}},zs=new ie});var Pt={};F(Pt,{default:()=>Is});import{rspack as Gs}from"@rspack/core";var $e,Is,Et=m(()=>{"use strict";o();te();E();se();k();$e=class extends T{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(()=>(je(),Ee));await e.setup("serve",a.cliOptions)}async run(){await a.empConfig.lifeCycle.beforeBuild(),this.isWatchMode=!!a.cliOptions.watch,this.isuseServe=!!a.cliOptions.serve,this.rspackConfig=a.rsConfig,this.isWatchMode&&this.watchMode(),Gs(this.rspackConfig,async(e,t)=>{if(console.log(`
17
- `),a.debug.showScriptDebug&&console.log(t?.toString()),e!==null){n.error(e.stack||e),e.message&&n.error(e.message);return}if(!t){n.red("Stats is Undefined.");return}t.hasErrors()&&(n.error(t.toString({all:!1,colors:!0,errors:!0})),n.red("Failed to compile."),process.exit(1)),t.hasWarnings()&&(n.yellow("Compiled with warnings."),n.warn(t.toString({all:!1,chunks:!1,assets:!1,colors:!0,errors:!0,warnings:!0}))),await yt(t),this.startServe(),await a.empConfig.lifeCycle.afterBulid()})}},Is=new $e});o();import{rspack as Zo}from"@rspack/core";o();import Us from"process";import{program as D}from"commander";var Ae={name:"@empjs/cli",version:"3.9.2-beta.1",description:"emp",license:"MIT",type:"module",files:["dist","bin","resource","template","client.d.ts","emp-tsconfig.json"],maintainers:["xuhongbin","ckken","doerme"],repository:{type:"git",url:"git+https://github.com/empjs/emp.git",directory:"packages/cli"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},keywords:["rspack","rust","typescript"],bin:{emp:"./bin/emp.js"},main:"dist/index.js",types:"dist/index.d.ts",exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.js"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}},"./emp-tsconfig.json":"./emp-tsconfig.json"},scripts:{dev:"tsup --watch --env.ENV dev",build:"tsup --env.ENV prod",ph:"pnpm publish --no-git-checks"},engines:{node:">=16.0.0"},author:"Ken",devDependencies:{"@types/compression":"^1.7.2","@types/connect":"^3.4.38","@types/cors":"^2.8.12","@types/default-gateway":"^7.2.1","@types/fs-extra":"^11.0.4","@types/node":"^20.8.7","@types/react":"^18.3.2","@types/serve-static":"^1.15.8","@types/watchpack":"^2.4.3","@types/webpack":"^5.28.4","@types/webpack-bundle-analyzer":"^4.6.2","@types/webpack-sources":"^3.2.2",tsup:"^8.4.0"},dependencies:{"typescript-plugin-css-modules":"5.2.0","@rsdoctor/rspack-plugin":"1.1.8","@rspack/core":"1.4.10","@rspack/dev-server":"1.1.3","@swc/helpers":"^0.5.17",address:"^2.0.2",chalk:"^5.3.0",commander:"^11.1.0",compression:"^1.7.4",connect:"^3.7.0","core-js":"^3.41.0",cors:"^2.8.5","default-gateway":"^7.2.2","fs-extra":"^11.2.0",glob:"^11.0.1","gzip-size":"^7.0.0","html-webpack-plugin":"5.6.3",jiti:"2.0.0","less-loader":"^12.2.0",open:"^10.1.0","sass-embedded":"1.89.2","sass-loader":"^16.0.5","serve-static":"^2.2.0","ts-checker-rspack-plugin":"^1.1.4","webpack-bundle-analyzer":"^4.10.2","@empjs/chain":"workspace:*"}};async function jt(){D.version(Ae.version,"-v, --version").usage("<command> [options]"),D.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",(s,e)=>{let[t,i]=s.split("=");return e[t]=i,e},{}).action(async s=>{let{default:e}=await Promise.resolve().then(()=>(kt(),St));await e.setup("dev",s)}),D.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",(s,e)=>{let[t,i]=s.split("=");return e[t]=i,e},{}).action(async s=>{let{default:e}=await Promise.resolve().then(()=>(Et(),Pt));await e.setup("build",s)}),D.command("serve").description("Server \u6A21\u5F0F").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").action(async s=>{let{default:e}=await Promise.resolve().then(()=>(je(),Ee));await e.setup("serve",s)}),D.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(s=>{}),D.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(s=>{}),D.parse(Us.argv)}k();z();function sn(s){return s}export{sn as defineConfig,He as empHelper,D as program,Zo as rspack,jt as runScript,a as store};
14
+ ${E}
15
+ `),n.info(`${S("\u2713")} Ready in ${V(Number(e.time))}
16
+ `)}function te(s=0){n.info(`${S("\u2713")} Ready in ${V(Number(s))}`)}var vs,bs,Cs,ws,xs,Ss,ee,Os,se=m(()=>{"use strict";o();A();k();P();C();vs=/\.html$/,bs=/\.(?:js|mjs|cjs|jsx)$/,Cs=/\.css$/,ws=s=>!/\.map$/.test(s)&&!/\.LICENSE\.txt$/.test(s),xs=s=>s>300*1e3?ne:s>100*1e3?B:pe,Ss=s=>{let e=s.name.split("?")[0],t=ee(s.size),i=$.basename(e),r=$.join($.basename(a.empConfig.build.outDir),$.dirname(e)),p=ds.readFileSync($.join(a.empConfig.build.outDir,e)),u=p.length,f=ys(p),d=xs(f)(ee(f));return{size:u,folder:r,name:i,gzippedSize:f,sizeLabel:t,gzipSizeLabel:d}};ee=s=>{let e=s/1e3;return`${e.toFixed(e<1?2:1)} kB`},Os=s=>bs.test(s)?B(s):Cs.test(s)?S(s):vs.test(s)?N(s):ae(s)});var T,ie=m(()=>{"use strict";o();P();C();k();T=class{async setup(e,t){n.time(`[${e}]Setup`),await a.setup(e,t),a.debug.clearLog&&ce(),n.title(`${e}`),n.time(`[${e}]Run`),await this.run(),this.processExit(),n.timeEnd(`[${e}]Run`),n.timeEnd(`[${e}]Setup`)}async run(){}processExit(){process.on("SIGINT",function(){process.exit()})}}});import{RspackDevServer as Ps}from"@rspack/dev-server";import Es from"connect";var I,vt=m(()=>{"use strict";o();I=class{async setup(e,t,i,r=()=>{}){if(!t.devServer)return console.warn("rspackConfig.devServer need!");let p=new Ps(t.devServer,e);return await p.start(),p.middleware?.waitUntilValid(r),p}async beforeCompiler(e){return e.devServer.app=()=>Es(),e.devServer.server&&e.devServer.server.type==="https"&&(e.devServer.server.type="http2"),e}}});import bt from"fs";import js from"fs/promises";import $s from"compression";import Ts from"connect";import Ds from"cors";import Rs from"http2";import Ct from"path";import Ns from"serve-static";import{parse as Ls}from"url";var M,U,wt=m(()=>{"use strict";o();M=Ts();M.use($s());M.use(Ds());U=class{async setup(e,t=()=>{}){let i="index",r=Object.keys(e.rsConfig.entry);if(r.length===0)return e.logger.sysError("emp serve must include entry!");if(r.includes(i)||(i=r[0]),!bt.existsSync(e.outDir))return e.logger.sysError(`emp serve must be executed after emp build,${e.outDir} not exist!`);let p=e.resolve(e.rsConfig.output?.path);M.use(Ns(p));let u=await js.readFile(Ct.join(p,`${i}.html`),"utf8");if(M.use((f,d,E)=>{let O=Ls(f.url||"",!0).pathname;if(O&&O!=="/"&&bt.existsSync(Ct.join(p,O)))return E();d.setHeader("Content-Type","text/html"),d.end(u)}),e.server.isHttps){let{key:f,cert:d}=await e.server.getcert();Rs.createSecureServer(typeof e.server.isHttps!="boolean"?e.server.isHttps:{key:f,cert:d,allowHTTP1:!0},M).listen(e.server.port,t)}else v("http").createServer(M).listen(e.server.port,t)}}});var Oe=m(()=>{"use strict";o();vt();wt()});var St={};F(St,{default:()=>Ms});import{rspack as As}from"@rspack/core";var xt,Pe,Ms,kt=m(()=>{"use strict";o();se();C();ie();Oe();k();xt=new I,Pe=class extends T{get stats(){return{all:a.empConfig.debug.devShowAllLog,colors:!0,assets:!1,chunks:!1,entrypoints:!1,timings:!1,version:!1,errors:!0,warnings:!0}}async getRspackDevConfig(){let e=b(a.rsConfig,{stats:this.stats,devServer:{open:!1,setupExitSignals:!0,port:a.server.port}}),{devServer:t}=e;if(a.server.isHttps&&(!t.server||t.server.type==="https"&&!t.server.options)){let{key:i,cert:r}=await a.server.getcert();t.server={type:"https",options:{key:i,cert:r}}}return Object.hasOwn(t,"https")&&delete t.https,e}async run(){let{server:e}=a,t=await this.getRspackDevConfig();t=await xt.beforeCompiler(t);let i=As(t);await a.empConfig.lifeCycle.beforeDevServe(),e.startOpen(),await xt.setup(i,t,a,async r=>{this.showTimeDone(r),await a.empConfig.lifeCycle.afterDevServe()}),a.debug.showPerformance&&i.hooks.afterDone.tap("done",this.showTimeDone)}showTimeDone=e=>{let t=e?.toJson({all:!1,colors:!1,assets:!1,chunks:!1,timings:!0});te(t.time)}},Ms=new Pe});var Ee={};F(Ee,{ServeScript:()=>re,default:()=>zs});var Fs,Ot,re,zs,je=m(()=>{"use strict";o();se();ie();Oe();k();Fs=new U,Ot=0,re=class extends T{async run(){Ot=Date.now(),await a.empConfig.lifeCycle.beforeServe(),await Fs.setup(a,this.onReady)}onReady=async()=>{a.server.startOpen(),te(Date.now()-Ot),await a.empConfig.lifeCycle.afterServe()}},zs=new re});var Pt={};F(Pt,{default:()=>Is});import{rspack as Gs}from"@rspack/core";var $e,Is,Et=m(()=>{"use strict";o();se();P();ie();k();$e=class extends T{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(()=>(je(),Ee));await e.setup("serve",a.cliOptions)}async run(){await a.empConfig.lifeCycle.beforeBuild(),this.isWatchMode=!!a.cliOptions.watch,this.isuseServe=!!a.cliOptions.serve,this.rspackConfig=a.rsConfig,this.isWatchMode&&this.watchMode(),Gs(this.rspackConfig,async(e,t)=>{if(console.log(`
17
+ `),a.debug.showScriptDebug&&console.log(t?.toString()),e!==null){n.error(e.stack||e),e.message&&n.error(e.message);return}if(!t){n.red("Stats is Undefined.");return}t.hasErrors()&&(n.error(t.toString({all:!1,colors:!0,errors:!0})),n.red("Failed to compile."),process.exit(1)),t.hasWarnings()&&(n.yellow("Compiled with warnings."),n.warn(t.toString({all:!1,chunks:!1,assets:!1,colors:!0,errors:!0,warnings:!0}))),await yt(t),this.startServe(),await a.empConfig.lifeCycle.afterBulid()})}},Is=new $e});o();import{rspack as Zo}from"@rspack/core";import{program as tn}from"commander";o();import Us from"process";import{program as R}from"commander";var Le={name:"@empjs/cli",version:"3.9.2-beta.3",description:"emp",license:"MIT",type:"module",files:["dist","bin","resource","template","client.d.ts","emp-tsconfig.json"],maintainers:["xuhongbin","ckken","doerme"],repository:{type:"git",url:"git+https://github.com/empjs/emp.git",directory:"packages/cli"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},keywords:["rspack","rust","typescript"],bin:{emp:"./bin/emp.js"},main:"dist/index.js",types:"dist/index.d.ts",exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.js"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}},"./emp-tsconfig.json":"./emp-tsconfig.json"},scripts:{dev:"tsup --watch --env.ENV dev",build:"tsup --env.ENV prod",ph:"pnpm publish --no-git-checks"},engines:{node:">=16.0.0"},author:"Ken",devDependencies:{"@types/compression":"^1.7.2","@types/connect":"^3.4.38","@types/cors":"^2.8.12","@types/default-gateway":"^7.2.1","@types/fs-extra":"^11.0.4","@types/node":"^20.8.7","@types/react":"^18.3.2","@types/serve-static":"^1.15.8","@types/watchpack":"^2.4.3","@types/webpack":"^5.28.4","@types/webpack-bundle-analyzer":"^4.6.2","@types/webpack-sources":"^3.2.2",tsup:"^8.4.0"},dependencies:{"typescript-plugin-css-modules":"5.2.0","@rsdoctor/rspack-plugin":"1.1.8","@rspack/core":"1.4.10","@rspack/dev-server":"1.1.3","@swc/helpers":"^0.5.17",address:"^2.0.2",chalk:"^5.3.0",commander:"^11.1.0",compression:"^1.7.4",connect:"^3.7.0","core-js":"^3.41.0",cors:"^2.8.5","default-gateway":"^7.2.2","fs-extra":"^11.2.0",glob:"^11.0.1","gzip-size":"^7.0.0","html-webpack-plugin":"5.6.3",jiti:"2.0.0","less-loader":"^12.2.0",open:"^10.1.0","sass-embedded":"1.89.2","sass-loader":"^16.0.5","serve-static":"^2.2.0","ts-checker-rspack-plugin":"^1.1.4","webpack-bundle-analyzer":"^4.10.2","@empjs/chain":"workspace:*"}};async function jt(){R.version(Le.version,"-v, --version").usage("<command> [options]"),R.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",(s,e)=>{let[t,i]=s.split("=");return e[t]=i,e},{}).action(async s=>{let{default:e}=await Promise.resolve().then(()=>(kt(),St));await e.setup("dev",s)}),R.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",(s,e)=>{let[t,i]=s.split("=");return e[t]=i,e},{}).action(async s=>{let{default:e}=await Promise.resolve().then(()=>(Et(),Pt));await e.setup("build",s)}),R.command("serve").description("Server \u6A21\u5F0F").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").action(async s=>{let{default:e}=await Promise.resolve().then(()=>(je(),Ee));await e.setup("serve",s)}),R.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(s=>{}),R.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(s=>{}),R.parse(Us.argv)}k();P();z();function on(s){return s}export{H as Logger,h as color,on as defineConfig,He as empHelper,tn as program,Zo as rspack,jt as runScript,a as store};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empjs/cli",
3
- "version": "3.9.2-beta.1",
3
+ "version": "3.9.2-beta.3",
4
4
  "description": "emp",
5
5
  "license": "MIT",
6
6
  "type": "module",