@empjs/cli 3.0.0-rc.2 → 3.0.0-rc.2-1

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.js CHANGED
@@ -1,16 +1,16 @@
1
- var dt=Object.defineProperty;var l=(r,e)=>()=>(r&&(e=r(r=0)),e);var J=(r,e)=>{for(var t in e)dt(r,t,{get:e[t],enumerable:!0})};import{fileURLToPath as yt}from"node:url";import{dirname as bt}from"node:path";import{readFile as vt}from"node:fs/promises";import be from"node:module";import _ from"node:path";var ve,Ct,V,T,Ce,we,W=l(()=>{"use strict";ve=yt(import.meta.url),Ct=bt(ve),V=async r=>{try{let e=await vt(r);return JSON.parse(e)}catch(e){console.error(e)}},T=be.createRequire(import.meta.url),Ce=(r,e)=>{let t=T;return e&&(t=be.createRequire(e)),t.resolve(r)},we=_.resolve(Ct,ve).replace(`${_.sep}dist${_.sep}index.js`,"")});import k from"@rspack/core";import xe from"fs";import{ModuleFederationPlugin as wt}from"@module-federation/enhanced/rspack";var X,Se,Ee=l(()=>{"use strict";X=class{store;async setup(e){this.store=e;let t=[this.define(),this.anylayze(),this.progress(),this.copy(),this.empShare(),this.minify()];await this.store.empConfig.lifeCycle.beforePlugin(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterPlugin()}async anylayze(){if(!this.store.cliOptions.analyze)return;let{default:{BundleAnalyzerPlugin:e}}=await import("webpack-bundle-analyzer");this.store.chain.plugin("bundleAnalyzerPlugin").use(e,[{analyzerPort:this.store.empConfig.server.port,defaultSizes:"gzip",analyzerHost:this.store.getLanIp()||"127.0.0.1"}])}async define(){this.store.chain.plugin("definePlugin").use(k.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");xe.existsSync(e)&&xe.readdirSync(e).length>0&&this.store.chain.plugin("copyRspackPlugin").use(k.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve("dist")}]}])}async progress(){this.store.empConfig.debug.progress&&this.store.chain.plugin("progressPlugin").use(k.ProgressPlugin,[{prefix:"EMP"}])}async empShare(){let{isEmpshare:e}=this.store.empConfig.empShareLib;if(!e)return;let t=wt;this.store.chain.plugin("empShare").use(t,[this.store.empConfig.empShareLib.pluginConfig])}minify(){this.store.chain.optimization.minimize(this.store.mode==="production"),this.store.chain.optimization.minimizer("minJs").use(k.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]),this.store.chain.optimization.minimizer("minCss").use(k.SwcCssMinimizerRspackPlugin,[{}])}},Se=new X});import xt from"chalk";import St from"fs-extra";import{ip as Et}from"address";import{gateway4sync as Ot}from"default-gateway";function Pe(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function f(r,...e){for(let t of e)for(let s in t){let i=t[s],o=r[s];if(Object(i)==i&&Object(o)===o){r[s]=f(o,i);continue}r[s]=t[s]}return r}var j,Oe,L,ke,$e,y=l(()=>{"use strict";j=()=>{let{int:r}=Ot();return Et(r||"")||"127.0.0.1"},Oe=r=>{try{let{version:e}=St.readJSONSync(r);return e}catch{return}};L=(r="",e="")=>{let t=r.replace("^","").split("."),s=e.replace("^","").split("."),i=Math.max(t.length,s.length),o=0;for(let p=0;p<i;p++){let m=t.length>p?t[p]:0,g=isNaN(Number(m))?m.charCodeAt():Number(m),O=s.length>p?s[p]:0,c=isNaN(Number(O))?O.charCodeAt():Number(O);if(g<c){o=-1;break}else if(g>c){o=1;break}}return o},ke=r=>{r=r/1e3;let e=s=>xt.bold(s);if(r<1)return`${r*1e3} ms`;if(r<10){let s=r>=.01?2:3;return`${e(r.toFixed(s))} s`}if(r<60)return`${e(r.toFixed(1))} s`;let t=r/60;return`${e(t.toFixed(2))} m`},$e=r=>`data:text/javascript,${r}`});import Te from"node:path";var q,je,Le=l(()=>{"use strict";W();y();q=class{store;swcJsOptions={};swcTsOptions={};coreJs={version:"3",alias:"",path:""};async setup(e){this.store=e;let t=[this.files(),this.scripts(),this.rspackGenerator(),this.rspackParser()];await Promise.all(t)}rspackGenerator(){let e=this.store.isDev?"[path][name]-[local]-[hash:5]":"[local]-[hash:5]";this.store.chain.merge({module:{generator:{css:{localIdentName:e},"css/auto":{localIdentName:e},"css/module":{localIdentName:e}}}})}rspackParser(){this.store.chain.merge({module:{parser:{css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return this.store.empConfig.build.polyfill}swcParser(e){switch(e){case"js":return{syntax:"ecmascript",jsx:!0,decorators:!0,decoratorsBeforeExport:!1};case"ts":return{syntax:"typescript",decorators:!0,tsx:!0,dynamicImport:!0}}}swcJsc(e){let{target:t,externalHelpers:s}=this.store.empConfig.build;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:s,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:this.swcJsc(e),isModule:"unknown"};return this.isPolyfill&&(delete t.jsc.target,t.env={coreJs:this.swcCoreVersion,targets:this.store.empConfig.build.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill),this.store.empConfig.build.polyfill==="usage"&&(t.env.shippedProposals=!0,t.env.include=["es.object.values","es.array.flat"])),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build;e&&this.store.chain.resolve.alias.set("@swc/helpers",Te.dirname(T.resolve("@swc/helpers/package.json"))),this.coreJs.path=T.resolve("core-js/package.json");let t=Oe(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=Te.dirname(this.coreJs.path),this.store.empConfig.build.polyfill&&(this.store.chain.resolve.alias.set("core-js",this.coreJs.alias),this.store.chain.module.rule("javascript").exclude.add(/core-js/),this.store.chain.module.rule("typescript").exclude.add(/core-js/)),this.swcTsOptions=this.swcOptions("ts"),this.swcJsOptions=this.swcOptions("js")}async scripts(){this.swcInitOptions();let e=!1,t=[];this.store.chain.merge({module:{parser:{javascript:{exportsPresence:"error",importExportsPresence:"error"}},rule:{mjs:{test:/\.m?js/,resolve:{fullySpecified:!1}},typescript:{test:/\.(ts|tsx)$/,exclude:t,sideEffects:e,use:{swc:{loader:"builtin:swc-loader",options:this.swcTsOptions}}},javascript:{test:/\.(js|jsx)$/,exclude:t,sideEffects:e,use:{swc:{loader:"builtin:swc-loader",options:this.swcJsOptions}}}}}})}async files(){this.store.chain.merge({module:{rule:{svg:{test:/\.svg$/,type:"asset/resource"}}}}),this.store.chain.merge({module:{rule:{inline:{resourceQuery:/inline/,type:"asset/inline"}}}}),this.store.chain.merge({module:{rule:{image:{test:/\.(png|jpe?g|gif|webp|ico)$/i,type:"asset/resource"},fonts:{test:/\.(|otf|ttf|eot|woff|woff2)$/i,type:"asset/resource"},svga:{test:/\.(svga)$/i,type:"asset/resource"}}}})}},je=new q});var Q,De,Fe=l(()=>{"use strict";Q=class{store;async setup(e){this.store=e;let t=[this.common(),this.stats(),this.devServer(),this.optimization()];await Promise.all(t)}async common(){this.store.merge({node:{global:!0},experiments:{rspackFuture:{newTreeshaking:this.store.empConfig.debug.newTreeshaking},outputModule:this.store.empConfig.isESM,topLevelAwait:!0},target:this.store.empConfig.target,infrastructureLogging:this.store.empConfig.debug.infrastructureLogging,context:this.store.root,mode:this.store.mode,cache:this.store.empConfig.debug.rspackCache,devtool:this.store.empConfig.build.sourcemap?"source-map":!1,builtins:{},output:this.store.empConfig.output,resolve:this.store.empConfig.resolve,externals:this.store.empConfig.externals})}async stats(){this.store.merge({stats:{colors:!0,all:!1,assets:!1,chunks:!1,timings:!0,version:!0}})}async devServer(){this.store.merge({devServer:this.store.empConfig.server})}async optimization(){let e={moduleIds:this.store.empConfig.build.moduleIds,chunkIds:this.store.empConfig.build.chunkIds,minimize:this.store.empConfig.build.minify,splitChunks:{chunks:"async",cacheGroups:{}}};this.store.empConfig.build.polyfill&&(e.splitChunks.cacheGroups={}),this.store.chain.merge({optimization:e})}},De=new Q});import Ae from"html-webpack-plugin";var Me,D,Re,F,Pt,M,Y=l(()=>{"use strict";y();u();Me="HtmlImportMapPlugin",D=class{importMap;chunk;constructor(e,t){this.importMap=e,this.chunk=t}apply(e){e.hooks.compilation.tap(Me,t=>{Ae.getHooks(t).alterAssetTagGroups.tapAsync(Me,(s,i)=>{if(!s.plugin.userOptions.chunks?.includes(this.chunk))return i(null,s);s.headTags.push({tagName:"script",attributes:{type:"importmap"},innerHTML:`${JSON.stringify(this.importMap,null,2)}`,voidTag:!1,meta:{plugin:void 0}}),i(null,s)})})}},Re="HtmlEmpShareLibPlugin",F=class{chunk;files;constructor(e,t){this.files=f({js:[],css:[]},e),this.chunk=t}apply(e){e.hooks.compilation.tap(Re,t=>{let s=this.files;Ae.getHooks(t).alterAssetTagGroups.tapAsync(Re,(i,o)=>{if(!i.plugin.userOptions.chunks?.includes(this.chunk))return o(null,i);s.js.map(p=>{i.headTags.push({tagName:"script",attributes:{src:p},voidTag:!1,meta:{plugin:void 0}})}),s.css.map(p=>{i.headTags.push({tagName:"link",attributes:{rel:"stylesheet",href:p},voidTag:!1,meta:{plugin:void 0}})}),o(null,i)})})}},Pt=()=>{let r=[`import 'core-js/${n.empConfig.build.coreJsFeatures}'`].join(`
2
- `);return $e(r)},M=class{constructor(){}apply(e){let{webpack:t}=e;new t.EntryPlugin(e.context,Pt(),{name:void 0}).apply(e)}}});import kt from"html-webpack-plugin";import $t from"fast-glob";import x from"node:path";var Z,Be,ze=l(()=>{"use strict";y();Y();Z=class{store;entriesConfig={};async setup(e){this.store=e,await this.init(),this.toConfig()}setHtmlConfig(e,t){return e.template=this.setTemplate(e.template),e.favicon=this.setFavicion(e.favicon),e.chunks=t,e.filename=`${t[0]}.html`,this.store.empConfig.base&&(e.publicPath=this.store.empConfig.base),e.tags=e.tags||{},e}setChunk(e){return e.replace(x.extname(e),"").replace(`${this.store.empConfig.appSrc}${x.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(x.join("template","index.html"))}setFavicion(e){return e?this.store.resolve(e):this.store.empResolve(x.join("template","favicon.ico"))}setEntryItem(e,t,s){s=s||this.store.resolve(x.join(this.store.empConfig.appSrc,e));let i=this.setChunk(e),o=[s];this.entriesConfig[i]={entry:{[i]:o},html:this.setHtmlConfig(t,[i])}}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`html-plugin-${t}`).use(kt,[e]),this.store.empConfig.empShareLib&&(e.files=f(e.files,this.store.empConfig.empShareLib.externalAssets)),this.store.chain.plugin(`html-plugin-empShare-${t}`).use(F,[e.files,t]),this.store.empConfig.empShareLib.useImportMap&&this.store.chain.plugin(`html-plugin-import-map-${t}`).use(D,[this.store.empConfig.empShareLib.importMap,t])}setRspackEntry(e){this.store.merge({entry:e})}async init(){let e=x.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}").replace(/\\/g,"/"),t=await $t([e]);if(t[0]){let s=x.join(this.store.empConfig.appSrc,Object.keys(this.store.empConfig.entries).length>0&&this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index");this.setEntryItem(s,this.store.empConfig.html,t[0])}if(Object.keys(this.store.empConfig.entries).length>0)for(let[s,i]of Object.entries(this.store.empConfig.entries))this.setEntryItem(s,{...this.store.empConfig.html,...i})}toConfig(){for(let[e,t]of Object.entries(this.entriesConfig))this.setRspackHtmlPlugin(t.html,e),this.setRspackEntry(t.entry)}},Be=new Z});var K,Ge,Ie=l(()=>{"use strict";K=class{store;async setup(e){this.store=e;let t=[this.sass(),this.less(),this.css()];await Promise.all(t)}async sass(){let e={loader:this.store.importResolve("sass-loader"),options:{}};this.store.chain.merge({module:{rule:{sass:{test:/\.(sass|scss)$/,use:{sassLoader:e},type:"css/auto"}}}})}async less(){let e={loader:this.store.importResolve("less-loader"),options:{lessOptions:{javascriptEnabled:!0}}};this.store.chain.merge({module:{rule:{less:{test:/\.less$/,use:{lessLoader:e},type:"css/auto"}}}})}async css(){this.store.chain.merge({module:{rule:{css:{test:/\.css$/,use:{},type:"css/auto"}}}})}},Ge=new K});var ee,He,Ue=l(()=>{"use strict";Ee();Le();Fe();ze();Ie();ee=class{store;async setup(e){this.store=e;let t=[De.setup(this.store),je.setup(this.store),Se.setup(this.store),Be.setup(this.store),Ge.setup(this.store)];await Promise.all(t),await this.store.empConfig.plugins(),await this.store.empConfig.chain()}},He=new ee});import h from"chalk";var te,a,b=l(()=>{"use strict";te=class{pname="";logLevel="debug";setup({pname:e,logLevel:t}){this.pname=e,t&&(this.logLevel=t)}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.white.bgBlue(this.pname)}${h.blue.bgWhite(` ${e} `)}
3
- `)};cyan=e=>{console.log(`${h.white.bgCyan(this.pname)}${h.cyan.bgWhite(` ${e} `)}
4
- `)};magenta=e=>{console.log(`${h.white.bgMagenta(this.pname)}${h.magenta.bgWhite(` ${e} `)}
5
- `)};green=e=>{console.log(`${h.white.bgGreen(this.pname)}${h.green.bgWhite(` ${e} `)}
6
- `)};yellow=e=>{console.log(`${h.white.bgYellow(this.pname)}${h.yellow.bgWhite(` ${e} `)}
7
- `)};red=e=>{console.log(`${h.white.bgRed(this.pname)}${h.red.bgWhite(` ${e} `)}
8
- `)};sysError=e=>{console.log(`${h.white.bgRed(" System Error Tips ")}${h.red.bgWhite(` ${e} `)}
9
- `)};link=e=>h.hex("#3498db")(e);title=e=>{console.log(`${h.greenBright.bold(`${this.pname}`)} ${h.bgGreenBright(` ${e} `)}
10
- `)}},a=new te});var R,Ne=l(()=>{"use strict";u();R=class{externals={};externalAssets={js:[],css:[]};exp=/^([0-9a-zA-Z_\s]+)@(.*)/;config;importMap={imports:{}};version;isEmpshare=!1;async setup(){this.config=n.empConfig.empShare,this.version=n.empConfig.empShare.mfVersion,this.isEmpshare=!!n.empConfig.empShare.name,this.config.shareLib&&this.setShareLib(),this.prepareEsm()}get useImportMap(){return this.config.useImportMap&&n.empConfig.isESM}get pluginConfig(){let e={...this.config};return delete e.mfVersion,delete e.shareLib,delete e.useImportMap,{manifest:!1,dts:!1,dev:!1,...e}}prepareEsm(){if(n.empConfig.isESM){this.config.library={type:"module"};let e=this.config.remotes||{};for(let[t,s]of Object.entries(e))if(typeof s=="string"){let i=s.match(this.exp)||[];i.length>0&&(e[t]=i[2])}this.config.remotes=e}}async setShareLib(){let e=this.config,t=[];if(typeof e.shareLib=="object")for(let[s,i]of Object.entries(e.shareLib)){let o={};if(o.module=s,typeof i=="string"){let p=i.match(this.exp)||[];p.length>0?(o.global=p[1],o.entry=p[2],o.type="js",t.push(o),o={}):(o.global="",o.entry=i,o.type="js",t.push(o),o={})}else Array.isArray(i)?i.map(p=>{if(!p)return;if(p.split("?")[0].endsWith(".css"))o.entry=p,o.type="css";else{let g=p.match(this.exp)||[];g.length>0?(o.global=g[1],o.entry=g[2],o.type="js"):(o.global="",o.entry=p,o.type="js")}t.push(o),o={}}):typeof i=="object"&&i.entry&&(o.entry=i.entry,o.global=i.global,o.type=i.type,t.push(o),o={})}await Promise.all([this.setExternalAssets(t)])}async setExternalAssets(e=[]){if(e.length>0){let t=[];t=t.concat(e),t.map(s=>{s.type=s.type||"js",s.type==="js"&&s.module?(s.global?this.externals[s.module]=s.global:n.empConfig.isESM&&(this.useImportMap?(this.externals[s.module]=s.module,this.importMap.imports[s.module]=s.entry):this.externals[s.module]=s.entry),s.entry&&!n.empConfig.isESM&&this.externalAssets.js.push(s.entry)):s.type==="css"&&s.entry&&this.externalAssets.css.push(s.entry)})}}}});import Je from"url";import _e from"chalk";var se,E,re=l(()=>{"use strict";y();se=class{imf={protocol:"",port:8e3,pathname:"/"};host="0.0.0.0";urls={lanUrlForConfig:"",lanUrlForTerminal:_e.gray("unavailable"),localUrlForTerminal:"",localUrlForBrowser:""};setup(e){e.host&&(this.host=e.host),e.protocol&&(this.imf.protocol=e.protocol),e.pathname&&(this.imf.pathname=e.pathname),e.port&&(this.imf.port=e.port),this.setupUrls()}setupUrls(){let{host:e}=this,t=e==="0.0.0.0"||e==="::",s;if(t){s="localhost";try{this.urls.lanUrlForConfig=this.getLanIp(),this.urls.lanUrlForConfig&&(/^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(this.urls.lanUrlForConfig)?this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig):this.urls.lanUrlForConfig="")}catch{}}else s=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(s),this.urls.localUrlForBrowser=this.formatUrl(s)}getLanIp=j;formatUrl(e){let{protocol:t,port:s,pathname:i}=this.imf;return Je.format({protocol:t,hostname:e,port:s,pathname:i})}prettyPrintUrl(e){let{protocol:t,port:s,pathname:i}=this.imf;return Je.format({protocol:t,hostname:e,port:_e.bold(s),pathname:i})}},E=new se});var ie,A,oe=l(()=>{"use strict";re();y();u();ie=class{isADB=!1;isHttps=!1;get isHttpBase(){let e=n.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}setup(){if(this.isADB=!!n.empOptions.autoDevBase&&n.mode==="development"&&!this.isHttpBase,!this.isADB)return;let{server:e,https:t}=n.empOptions.server||{};this.isHttps=e==="https"||typeof e=="object"&&e.type==="https"||t===!0;let s=E.getLanIp(),i=this.isHttps?"https":"http",o=n.empOptions.server?.port||8e3;n.empOptions.base=`${i}://${s}:${o}/`,n.empOptions.server=f({port:o,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${s}:${o}/ws`}},n.empOptions.server)}},A=new ie});var B,Ve=l(()=>{"use strict";oe();u();Y();B=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){A.setup(),this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){n.empConfig.build.polyfill==="entry"&&n.chain.plugin("empPolyfill").use(M),this.op.beforePlugin&&await this.op.beforePlugin()}async afterPlugin(){this.op.afterPlugin&&await this.op.afterPlugin()}async beforeBuild(){this.op.beforeBuild&&await this.op.beforeBuild()}async afterBulid(){this.op.afterBulid&&await this.op.afterBulid()}async beforeDevServe(){console.log(this.op),this.op.beforeDevServe&&await this.op.beforeDevServe()}async afterDevServe(){this.op.afterDevServe&&await this.op.afterDevServe()}async beforeServe(){this.op.beforeServe&&await this.op.beforeServe()}async afterServe(){this.op.afterServe&&await this.op.afterServe()}}});import Tt from"node:fs";var ne,We,Xe=l(()=>{"use strict";y();Ne();Ve();ne=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},f(e,t)}empShareLib=new R;isESM=!1;async autoDevSet(){this.store.mode==="development"&&this.store.empOptions.autoDevBase}checkIsESM(e){return["es3","es5"].indexOf(e)===-1}lifeCycle;async setup(e){this.store=e,await this.syncEmpOptions(),this.lifeCycle=new B(this.store.empOptions.lifeCycle),await this.lifeCycle.afterGetEmpOptions(),this.isESM=this.checkIsESM(this.build.target),this.store.empOptions.target?(this.target=this.store.empOptions.target,Array.isArray(this.target)&&!this.target.includes(this.build.target)&&this.target.push(this.build.target)):this.target=["web",this.build.target];let{appSrc:t,base:s,appEntry:i}=this.store.empOptions;t&&(this.appSrc=t),s&&(this.base=s),i&&(this.appEntry=i),this.store.empConfig.empShare&&await this.empShareLib.setup()}async chain(){this.store.empOptions.chain&&await this.store.empOptions.chain(this.store.chain)}async plugins(){let e=[];this.store.empOptions.plugins&&Array.isArray(this.store.empOptions.plugins)&&this.store.empOptions.plugins.length>0&&(this.store.empOptions.plugins.map(t=>{e.push(t.rsConfig(this.store))}),await Promise.all(e))}get debug(){return this.assign({loggerLevel:"info",clearLog:!0,progress:!0,showRsconfig:!1,showPerformance:!1,rspackCache:!0,infrastructureLogging:{appendOnly:!0,level:"warn"},newTreeshaking:this.store.empConfig.isESM},this.store.empOptions.debug)}get build(){let e=this.store.empOptions.build?.staticDir?`${this.store.empOptions.build?.staticDir}/`:"";return this.assign({outDir:"dist",staticDir:e,assetsDir:"assets",publicDir:"public",chunkIds:this.store.isDev?"named":"deterministic",moduleIds:this.store.isDev?"named":"deterministic",sourcemap:!0,minify:!this.store.isDev,minOptions:{},target:"es5",polyfill:!1,coreJsFeatures:"stable",externalHelpers:!1,browserslist:this.store.browserslistOptions.default},{...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:{content:"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"},keywords:{keywords:""},description:{description:""}};return this.assign({lang:"zh-CN",title:"EMP",inject:"body",minify:!this.store.isDev,scriptLoading:this.isESM?"module":"defer",meta:e,files:{css:[],js:[]},tags:{headTags:[],bodyTags:[]}},this.store.empOptions.html)}get entries(){return this.store.empOptions.entries?this.store.empOptions.entries:{}}get server(){let e={host:"0.0.0.0",port:8e3,open:process.platform==="darwin",hot:!0,watchFiles:["src/**/*.html"],static:[{directory:this.store.publicDir,watch:this.store.isDev}],allowedHosts:["all"],historyApiFallback:!0,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":"X-Requested-With, content-type, Authorization"}};return this.assign(e,this.store.empOptions.server)}get empShare(){return this.assign({name:"",filename:"emp.js",shared:{},mfVersion:1.5},this.store.empOptions.empShare)}get css(){return this.assign({postcss:[]},this.store.empOptions.css)}get output(){let e=(this.store.isDev,".[contenthash:8]"),t=this.store.isDev?"":".[contenthash:8]",{assetsDir:s,staticDir:i}=this.store.empConfig.build,o={publicPath:this.store.empConfig.base?this.store.empConfig.base:"auto",crossOriginLoading:"anonymous",filename:`${i}js/[name]${e}.js`,cssFilename:`${i}css/[name]${t}.css`,cssChunkFilename:`${i}css/[name]${t}.css`,assetModuleFilename:`${i}${s}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!0};return this.assign(o,this.store.empOptions.output)}get define(){let e={mode:this.store.mode,env:this.store.cliOptions.env};return this.store.empOptions.define&&(e={...e,...this.store.empOptions.define}),this.setDefine(e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",s={};return Object.keys(e).map(i=>{(t==="all"||t==="esm")&&(s[`import.meta.env.${i}`]=JSON.stringify(e[i])),(t==="all"||t==="cjs")&&(s[`process.env.${i}`]=JSON.stringify(e[i])),s[`${i}`]=JSON.stringify(e[i])}),s}get externals(){return this.assign(this.empShareLib.externals,this.store.empOptions.externals)}get resolve(){return f({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(){let e=this.store.resolve("emp-config.js");if(!Tt.existsSync(e))return;let{default:t}=await import(this.store.importFileUrl(e));typeof t=="function"?this.store.empOptions=await t(this.store):this.store.empOptions=t||{}}get moduleTransformRule(){let{moduleTransform:e}=this.store.empOptions,t=this.assign({defaultExclude:!1},e),s={and:[],not:[]};return t.defaultExclude===!0&&s.and.push(/(node_modules|bower_components)/),t?.exclude&&(s.and=s.and.concat(t.exclude)),e?.include&&(s.not=t.include),s}get cacheDir(){return this.store.empOptions.cacheDir?this.store.empOptions.cacheDir:"node_modules/.emp-cache"}},We=new ne});import v from"node:path";import jt from"node:fs/promises";import Lt from"webpack-chain";import{pathToFileURL as Dt}from"node:url";import Ft from"node:util";var pe,n,u=l(()=>{"use strict";W();Ue();b();Xe();y();pe=class{empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=we;empSource=v.resolve(this.empRoot,"dist");resolve=e=>v.isAbsolute(e)?e:v.resolve(this.root,e);empResolve=e=>v.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};cacheDir="";mode="development";cliMode="dev";isDev=!0;cliOptions;chain;rsConfig;empOptions={};empConfig;vCompare=L;deepAssign=f;getLanIp=j;async setup(e,t){await this.initVars(e,t),this.empConfig=We,await this.empConfig.setup(this),this.initPaths(),this.chain=new Lt,await He.setup(this),this.setLogger(),this.toConfig(),this.logConfig()}async initVars(e,t){this.cliOptions=t||{},this.cliMode="prod",this.mode=e==="dev"?"development":"production",this.isDev=this.mode==="development";let s=await V(this.empResolve("package.json")),i=await V(this.resolve("package.json"));this.empPkg={...this.empPkg,...s},this.pkg={...this.pkg,...i}}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),this.resource.dir=v.join(this.empRoot,"resource"),this.resource.cert=v.join(this.resource.dir,"emp.cert"),this.resource.key=v.join(this.resource.dir,"emp.key")}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.empConfig.debug.loggerLevel&&(e=this.empConfig.debug.loggerLevel),a.setup({pname:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}`,logLevel:e})}merge(e){this.chain.merge(e)}importResolve(e,t){return Ce(e,t)}importFileUrl(e){return Dt(e).toString()}toConfig(){this.rsConfig=this.chain.toConfig()}logConfig(){if(this.empConfig.debug.showRsconfig)if(typeof this.empConfig.debug.showRsconfig=="string"){let e=v.join(this.root,this.empConfig.debug.showRsconfig);jt.writeFile(e,JSON.stringify(this.rsConfig,null,2))}else{let e={colors:!0,depth:null},t=typeof this.empConfig.debug.showRsconfig=="object"?f(e,this.empConfig.debug.showRsconfig):e;console.log(a.link("[Compile Config]")),console.log(Ft.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 >= 20"]}}},n=new pe});import{exec as Mt}from"node:child_process";import{promisify as Rt}from"node:util";var Qe,qe,At,Bt,Ye,Ze=l(()=>{"use strict";b();u();Qe=Rt(Mt),qe=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],At=async()=>{let r=process.env.BROWSER;if(!r||!qe.includes(r)){let{stdout:e}=await Qe("ps cax");r=qe.find(t=>e.includes(t))}return r},Bt=async r=>{if(process.platform==="darwin")try{let t=await At();if(t){let s=`osascript openChrome.applescript "${encodeURI(r)}" "${t}"`;return await Qe(s,{cwd:n.resource.dir}),!0}}catch(t){a.debug(t)}try{let{default:t}=await import("open");return await t(r),!0}catch(t){return a.error("Failed to open start URL."),a.error(t),!1}},Ye=Bt});import zt from"net";import Gt from"os";async function et(r,e="localhost"){if(r!==It&&(r<Ke||r>ae))throw new Error(`Port number must lie between ${Ke} and ${ae}`);let t=r,s=Ht(),i;e&&!s.has(e)?i=new Set([e]):i=s;let o=new Set(["EADDRINUSE","EACCES"]);for(;t<=ae;)try{return await Nt(t,i)}catch(p){if(!o.has(p.code))throw p;t+=1}throw new Error("No available ports found")}var Ke,ae,It,Ht,Ut,Nt,tt=l(()=>{"use strict";Ke=1024,ae=65535,It=443,Ht=()=>{let r=Gt.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(r))if(t)for(let s of t)e.add(s.address);return e},Ut=(r,e)=>new Promise((t,s)=>{let i=zt.createServer();i.unref(),i.on("error",s),i.listen(r,e,()=>{let{port:o}=i.address();i.close(()=>{t(o)})})}),Nt=async(r,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let s of e)try{await Ut(r,s)}catch(i){if(!t.has(i.code))throw i}return r}});import st from"node:fs/promises";import z from"chalk";var C,G=l(()=>{"use strict";b();u();y();re();Ze();tt();oe();C=class{sf={protocol:"http",host:"0.0.0.0",port:8e3,publicPath:"",publicHasHttp:!1,isOpenBrower:!1,url:"",urls:{localUrlForBrowser:"",localUrlForTerminal:"",lanUrlForTerminal:"",lanUrlForConfig:""}};async adaptServer(){this.sf.publicPath=n.rsConfig.output?.publicPath==="auto"?"/":n.rsConfig.output?.publicPath||"/",this.sf.isOpenBrower=!!n.empConfig.server.open,this.sf.protocol=this.isHttps?"https":"http",this.sf.host=n.empConfig.server.host?n.empConfig.server.host:this.sf.host,this.sf.port=n.empConfig.server.port,await this.serverPort(),E.setup(this.sf),this.sf.publicPath&&(this.sf.publicPath.indexOf("http://")>-1||this.sf.publicPath.indexOf("https://")>-1)?(this.sf.url=this.sf.publicPath,this.sf.publicHasHttp=!0,this.sf.urls.localUrlForTerminal=E.prettyPrintUrl("localhost")):(this.sf.urls=E.urls,this.sf.url=this.sf.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this.sf;this.sf.publicHasHttp?(a.info(`${z.greenBright("\u279C")} Local: ${a.link(e.localUrlForTerminal)}`),a.info(`${z.greenBright("\u279C")} Network: ${a.link(this.sf.publicPath)}`)):(a.info(`${z.greenBright("\u279C")} Local: ${a.link(e.localUrlForTerminal)}`),a.info(`${z.greenBright("\u279C")} Network: ${a.link(e.lanUrlForTerminal)}
11
- `)),this.sf.isOpenBrower&&Ye(this.sf.url)}async setup(e,t){await n.setup(e,t),n.empConfig.debug.clearLog&&Pe(),a.title(`${e}`),await this.adaptServer(),await this.run(),this.afterRun()}async run(){}afterRun(){process.on("SIGINT",function(){process.exit()})}get isHttps(){let{server:e,https:t}=n.empConfig.server||{};return e==="https"||typeof e=="object"&&e.type==="https"||t===!0}getcert(){return Promise.all([st.readFile(n.resource.key),st.readFile(n.resource.cert)])}async serverPort(){if(A.isADB)return;let{port:e,host:t}=this.sf,s=await et(e,t);s!==e&&(this.sf.port=s,n.rsConfig.devServer?.port&&(n.rsConfig.devServer.port=s))}}});import d from"chalk";import w from"node:path";import{gzipSizeSync as Jt}from"gzip-size";import _t from"node:fs";function Zt(r,e){let t=[r,e],s=["File","Size","Gzipped"].reduce((i,o,p)=>{let m=t[p],g=o;return m&&(g=o.length<m?o+" ".repeat(m-o.length):o),`${i+g} `}," ");console.log(d.bold.blue(s))}async function rt(r){let e=r.toJson({all:!1,assets:!0,timings:!0});$(e.time);let s=e.assets.filter(c=>qt(c.name)).map(Yt);s.sort((c,P)=>c.size-P.size);let i=Math.max(...s.map(c=>c.sizeLabel.length)),o=Math.max(...s.map(c=>(c.folder+w.sep+c.name).length));Zt(o,i);let p=0,m=0;s.forEach(c=>{let{sizeLabel:P}=c,{name:ft,folder:ut,gzipSizeLabel:gt}=c,ge=(ut+w.sep+ft).length,de=P.length;if(p+=c.size,m+=c.gzippedSize,de<i){let N=" ".repeat(i-de);P+=N}let ye=d.gray(c.folder+w.sep)+Kt(c.name);if(ge<o){let N=" ".repeat(o-ge);ye+=N}a.info(` ${ye} ${d.gray(P)} ${gt}`)});let g=`${d.bold.blue("Total size:")} ${I(p)}`,O=`${d.bold.blue("Gzipped size:")} ${I(m)}`;a.info(`
1
+ var dt=Object.defineProperty;var l=(i,e)=>()=>(i&&(e=i(i=0)),e);var J=(i,e)=>{for(var t in e)dt(i,t,{get:e[t],enumerable:!0})};import{fileURLToPath as yt}from"node:url";import{dirname as bt}from"node:path";import{readFile as vt}from"node:fs/promises";import be from"node:module";import _ from"node:path";var ve,Ct,V,T,Ce,we,W=l(()=>{"use strict";ve=yt(import.meta.url),Ct=bt(ve),V=async i=>{try{let e=await vt(i);return JSON.parse(e)}catch(e){console.error(e)}},T=be.createRequire(import.meta.url),Ce=(i,e)=>{let t=T;return e&&(t=be.createRequire(e)),t.resolve(i)},we=_.resolve(Ct,ve).replace(`${_.sep}dist${_.sep}index.js`,"")});import k from"@rspack/core";import xe from"fs";import{ModuleFederationPlugin as wt}from"@module-federation/enhanced/rspack";var X,Se,Ee=l(()=>{"use strict";X=class{store;async setup(e){this.store=e;let t=[this.define(),this.anylayze(),this.progress(),this.copy(),this.empShare(),this.minify()];await this.store.empConfig.lifeCycle.beforePlugin(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterPlugin()}async anylayze(){if(!this.store.cliOptions.analyze)return;let{default:{BundleAnalyzerPlugin:e}}=await import("webpack-bundle-analyzer");this.store.chain.plugin("bundleAnalyzerPlugin").use(e,[{analyzerPort:this.store.empConfig.server.port,defaultSizes:"gzip",analyzerHost:this.store.getLanIp()||"127.0.0.1"}])}async define(){this.store.chain.plugin("definePlugin").use(k.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");xe.existsSync(e)&&xe.readdirSync(e).length>0&&this.store.chain.plugin("copyRspackPlugin").use(k.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve("dist")}]}])}async progress(){this.store.empConfig.debug.progress&&this.store.chain.plugin("progressPlugin").use(k.ProgressPlugin,[{prefix:"EMP"}])}async empShare(){let{isEmpshare:e}=this.store.empConfig.empShareLib;if(!e)return;let t=wt;this.store.chain.plugin("empShare").use(t,[this.store.empConfig.empShareLib.pluginConfig])}minify(){this.store.chain.optimization.minimize(this.store.mode==="production"),this.store.chain.optimization.minimizer("minJs").use(k.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]),this.store.chain.optimization.minimizer("minCss").use(k.SwcCssMinimizerRspackPlugin,[{}])}},Se=new X});import xt from"chalk";import St from"fs-extra";import{ip as Et}from"address";import{gateway4sync as Ot}from"default-gateway";function Pe(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function h(i,...e){for(let t of e)for(let s in t){let r=t[s],o=i[s];if(Object(r)==r&&Object(o)===o){i[s]=h(o,r);continue}i[s]=t[s]}return i}var j,Oe,L,ke,$e,y=l(()=>{"use strict";j=()=>{let{int:i}=Ot();return Et(i||"")||"127.0.0.1"},Oe=i=>{try{let{version:e}=St.readJSONSync(i);return e}catch{return}};L=(i="",e="")=>{let t=i.replace("^","").split("."),s=e.replace("^","").split("."),r=Math.max(t.length,s.length),o=0;for(let p=0;p<r;p++){let m=t.length>p?t[p]:0,g=isNaN(Number(m))?m.charCodeAt():Number(m),O=s.length>p?s[p]:0,c=isNaN(Number(O))?O.charCodeAt():Number(O);if(g<c){o=-1;break}else if(g>c){o=1;break}}return o},ke=i=>{i=i/1e3;let e=s=>xt.bold(s);if(i<1)return`${i*1e3} ms`;if(i<10){let s=i>=.01?2:3;return`${e(i.toFixed(s))} s`}if(i<60)return`${e(i.toFixed(1))} s`;let t=i/60;return`${e(t.toFixed(2))} m`},$e=i=>`data:text/javascript,${i}`});import Te from"node:path";var q,je,Le=l(()=>{"use strict";W();y();q=class{store;swcJsOptions={};swcTsOptions={};coreJs={version:"3",alias:"",path:""};async setup(e){this.store=e;let t=[this.files(),this.scripts(),this.rspackGenerator(),this.rspackParser()];await Promise.all(t)}rspackGenerator(){let e=this.store.isDev?"[path][name]-[local]-[hash:5]":"[local]-[hash:5]";this.store.chain.merge({module:{generator:{css:{localIdentName:e},"css/auto":{localIdentName:e},"css/module":{localIdentName:e}}}})}rspackParser(){this.store.chain.merge({module:{parser:{css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return this.store.empConfig.build.polyfill}swcParser(e){switch(e){case"js":return{syntax:"ecmascript",jsx:!0,decorators:!0,decoratorsBeforeExport:!1};case"ts":return{syntax:"typescript",decorators:!0,tsx:!0,dynamicImport:!0}}}swcJsc(e){let{target:t,externalHelpers:s}=this.store.empConfig.build;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:s,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:h(this.swcJsc(e),this.store.empConfig.build.swcConfig),isModule:"unknown"};return this.isPolyfill&&(delete t.jsc.target,t.env={coreJs:this.swcCoreVersion,targets:this.store.empConfig.build.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill),this.store.empConfig.build.polyfill==="usage"&&(t.env.shippedProposals=!0,t.env.include=["es.object.values","es.array.flat"])),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build;e&&this.store.chain.resolve.alias.set("@swc/helpers",Te.dirname(T.resolve("@swc/helpers/package.json"))),this.coreJs.path=T.resolve("core-js/package.json");let t=Oe(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=Te.dirname(this.coreJs.path),this.store.empConfig.build.polyfill&&(this.store.chain.resolve.alias.set("core-js",this.coreJs.alias),this.store.chain.module.rule("javascript").exclude.add(/core-js/),this.store.chain.module.rule("typescript").exclude.add(/core-js/)),this.swcTsOptions=this.swcOptions("ts"),this.swcJsOptions=this.swcOptions("js")}async scripts(){this.swcInitOptions();let e=!1,t=[];this.store.chain.merge({module:{parser:{javascript:{exportsPresence:"error",importExportsPresence:"error"}},rule:{mjs:{test:/\.m?js/,resolve:{fullySpecified:!1}},typescript:{test:/\.(ts|tsx)$/,exclude:t,sideEffects:e,use:{swc:{loader:"builtin:swc-loader",options:this.swcTsOptions}}},javascript:{test:/\.(js|jsx)$/,exclude:t,sideEffects:e,use:{swc:{loader:"builtin:swc-loader",options:this.swcJsOptions}}}}}})}async files(){this.store.chain.merge({module:{rule:{svg:{test:/\.svg$/,type:"asset/resource"}}}}),this.store.chain.merge({module:{rule:{inline:{resourceQuery:/inline/,type:"asset/inline"}}}}),this.store.chain.merge({module:{rule:{image:{test:/\.(png|jpe?g|gif|webp|ico)$/i,type:"asset/resource"},fonts:{test:/\.(|otf|ttf|eot|woff|woff2)$/i,type:"asset/resource"},svga:{test:/\.(svga)$/i,type:"asset/resource"}}}})}},je=new q});var Q,De,Fe=l(()=>{"use strict";Q=class{store;async setup(e){this.store=e;let t=[this.common(),this.stats(),this.devServer(),this.optimization()];await Promise.all(t)}async common(){this.store.merge({node:{global:!0},experiments:{rspackFuture:{newTreeshaking:this.store.empConfig.debug.newTreeshaking},outputModule:this.store.empConfig.isESM,topLevelAwait:!0},target:this.store.empConfig.target,infrastructureLogging:this.store.empConfig.debug.infrastructureLogging,context:this.store.root,mode:this.store.mode,cache:this.store.empConfig.debug.rspackCache,devtool:this.store.empConfig.build.sourcemap?"source-map":!1,builtins:{},output:this.store.empConfig.output,resolve:this.store.empConfig.resolve,externals:this.store.empConfig.externals})}async stats(){this.store.merge({stats:{colors:!0,all:!1,assets:!1,chunks:!1,timings:!0,version:!0}})}async devServer(){this.store.merge({devServer:this.store.empConfig.server})}async optimization(){let e={moduleIds:this.store.empConfig.build.moduleIds,chunkIds:this.store.empConfig.build.chunkIds,minimize:this.store.empConfig.build.minify,splitChunks:{chunks:"async",cacheGroups:{}}};this.store.empConfig.build.polyfill&&(e.splitChunks.cacheGroups={}),this.store.chain.merge({optimization:e})}},De=new Q});import Ae from"html-webpack-plugin";var Me,D,Re,F,Pt,M,Y=l(()=>{"use strict";y();u();Me="HtmlImportMapPlugin",D=class{importMap;chunk;constructor(e,t){this.importMap=e,this.chunk=t}apply(e){e.hooks.compilation.tap(Me,t=>{Ae.getHooks(t).alterAssetTagGroups.tapAsync(Me,(s,r)=>{if(!s.plugin.userOptions.chunks?.includes(this.chunk))return r(null,s);s.headTags.push({tagName:"script",attributes:{type:"importmap"},innerHTML:`${JSON.stringify(this.importMap,null,2)}`,voidTag:!1,meta:{plugin:void 0}}),r(null,s)})})}},Re="HtmlEmpShareLibPlugin",F=class{chunk;files;constructor(e,t){this.files=h({js:[],css:[]},e),this.chunk=t}apply(e){e.hooks.compilation.tap(Re,t=>{let s=this.files;Ae.getHooks(t).alterAssetTagGroups.tapAsync(Re,(r,o)=>{if(!r.plugin.userOptions.chunks?.includes(this.chunk))return o(null,r);s.js.map(p=>{r.headTags.push({tagName:"script",attributes:{src:p},voidTag:!1,meta:{plugin:void 0}})}),s.css.map(p=>{r.headTags.push({tagName:"link",attributes:{rel:"stylesheet",href:p},voidTag:!1,meta:{plugin:void 0}})}),o(null,r)})})}},Pt=()=>{let i=[`import 'core-js/${n.empConfig.build.coreJsFeatures}'`].join(`
2
+ `);return $e(i)},M=class{constructor(){}apply(e){let{webpack:t}=e;new t.EntryPlugin(e.context,Pt(),{name:void 0}).apply(e)}}});import kt from"html-webpack-plugin";import $t from"fast-glob";import x from"node:path";var Z,Be,ze=l(()=>{"use strict";y();Y();Z=class{store;entriesConfig={};async setup(e){this.store=e,await this.init(),this.toConfig()}setHtmlConfig(e,t){return e.template=this.setTemplate(e.template),e.favicon=this.setFavicion(e.favicon),e.chunks=t,e.filename=`${t[0]}.html`,this.store.empConfig.base&&(e.publicPath=this.store.empConfig.base),e.tags=e.tags||{},e}setChunk(e){return e.replace(x.extname(e),"").replace(`${this.store.empConfig.appSrc}${x.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(x.join("template","index.html"))}setFavicion(e){return e?this.store.resolve(e):this.store.empResolve(x.join("template","favicon.ico"))}setEntryItem(e,t,s){s=s||this.store.resolve(x.join(this.store.empConfig.appSrc,e));let r=this.setChunk(e),o=[s];this.entriesConfig[r]={entry:{[r]:o},html:this.setHtmlConfig(t,[r])}}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`html-plugin-${t}`).use(kt,[e]),this.store.empConfig.empShareLib&&(e.files=h(e.files,this.store.empConfig.empShareLib.externalAssets)),this.store.chain.plugin(`html-plugin-empShare-${t}`).use(F,[e.files,t]),this.store.empConfig.empShareLib.useImportMap&&this.store.chain.plugin(`html-plugin-import-map-${t}`).use(D,[this.store.empConfig.empShareLib.importMap,t])}setRspackEntry(e){this.store.merge({entry:e})}async init(){let e=x.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}").replace(/\\/g,"/"),t=await $t([e]);if(t[0]){let s=x.join(this.store.empConfig.appSrc,Object.keys(this.store.empConfig.entries).length>0&&this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index");this.setEntryItem(s,this.store.empConfig.html,t[0])}if(Object.keys(this.store.empConfig.entries).length>0)for(let[s,r]of Object.entries(this.store.empConfig.entries))this.setEntryItem(s,{...this.store.empConfig.html,...r})}toConfig(){for(let[e,t]of Object.entries(this.entriesConfig))this.setRspackHtmlPlugin(t.html,e),this.setRspackEntry(t.entry)}},Be=new Z});var K,Ge,Ie=l(()=>{"use strict";K=class{store;async setup(e){this.store=e;let t=[this.sass(),this.less(),this.css()];await Promise.all(t)}async sass(){let e={loader:this.store.importResolve("sass-loader"),options:{}};this.store.chain.merge({module:{rule:{sass:{test:/\.(sass|scss)$/,use:{sassLoader:e},type:"css/auto"}}}})}async less(){let e={loader:this.store.importResolve("less-loader"),options:{lessOptions:{javascriptEnabled:!0}}};this.store.chain.merge({module:{rule:{less:{test:/\.less$/,use:{lessLoader:e},type:"css/auto"}}}})}async css(){this.store.chain.merge({module:{rule:{css:{test:/\.css$/,use:{},type:"css/auto"}}}})}},Ge=new K});var ee,He,Ue=l(()=>{"use strict";Ee();Le();Fe();ze();Ie();ee=class{store;async setup(e){this.store=e;let t=[De.setup(this.store),je.setup(this.store),Se.setup(this.store),Be.setup(this.store),Ge.setup(this.store)];await Promise.all(t),await this.store.empConfig.plugins(),await this.store.empConfig.chain()}},He=new ee});import f from"chalk";var te,a,b=l(()=>{"use strict";te=class{pname="";logLevel="debug";setup({pname:e,logLevel:t}){this.pname=e,t&&(this.logLevel=t)}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.white.bgBlue(this.pname)}${f.blue.bgWhite(` ${e} `)}
3
+ `)};cyan=e=>{console.log(`${f.white.bgCyan(this.pname)}${f.cyan.bgWhite(` ${e} `)}
4
+ `)};magenta=e=>{console.log(`${f.white.bgMagenta(this.pname)}${f.magenta.bgWhite(` ${e} `)}
5
+ `)};green=e=>{console.log(`${f.white.bgGreen(this.pname)}${f.green.bgWhite(` ${e} `)}
6
+ `)};yellow=e=>{console.log(`${f.white.bgYellow(this.pname)}${f.yellow.bgWhite(` ${e} `)}
7
+ `)};red=e=>{console.log(`${f.white.bgRed(this.pname)}${f.red.bgWhite(` ${e} `)}
8
+ `)};sysError=e=>{console.log(`${f.white.bgRed(" System Error Tips ")}${f.red.bgWhite(` ${e} `)}
9
+ `)};link=e=>f.hex("#3498db")(e);title=e=>{console.log(`${f.greenBright.bold(`${this.pname}`)} ${f.bgGreenBright(` ${e} `)}
10
+ `)}},a=new te});var R,Ne=l(()=>{"use strict";u();R=class{externals={};externalAssets={js:[],css:[]};exp=/^([0-9a-zA-Z_\s]+)@(.*)/;config;importMap={imports:{}};version;isEmpshare=!1;async setup(){this.config=n.empConfig.empShare,this.version=n.empConfig.empShare.mfVersion,this.isEmpshare=!!n.empConfig.empShare.name,this.config.shareLib&&this.setShareLib(),this.prepareEsm()}get useImportMap(){return this.config.useImportMap&&n.empConfig.isESM}get pluginConfig(){let e={...this.config};return delete e.mfVersion,delete e.shareLib,delete e.useImportMap,{manifest:!1,dts:!1,dev:!1,...e}}prepareEsm(){if(n.empConfig.isESM){this.config.library={type:"module"};let e=this.config.remotes||{};for(let[t,s]of Object.entries(e))if(typeof s=="string"){let r=s.match(this.exp)||[];r.length>0&&(e[t]=r[2])}this.config.remotes=e}}async setShareLib(){let e=this.config,t=[];if(typeof e.shareLib=="object")for(let[s,r]of Object.entries(e.shareLib)){let o={};if(o.module=s,typeof r=="string"){let p=r.match(this.exp)||[];p.length>0?(o.global=p[1],o.entry=p[2],o.type="js",t.push(o),o={}):(o.global="",o.entry=r,o.type="js",t.push(o),o={})}else Array.isArray(r)?r.map(p=>{if(!p)return;if(p.split("?")[0].endsWith(".css"))o.entry=p,o.type="css";else{let g=p.match(this.exp)||[];g.length>0?(o.global=g[1],o.entry=g[2],o.type="js"):(o.global="",o.entry=p,o.type="js")}t.push(o),o={}}):typeof r=="object"&&r.entry&&(o.entry=r.entry,o.global=r.global,o.type=r.type,t.push(o),o={})}await Promise.all([this.setExternalAssets(t)])}async setExternalAssets(e=[]){if(e.length>0){let t=[];t=t.concat(e),t.map(s=>{s.type=s.type||"js",s.type==="js"&&s.module?(s.global?this.externals[s.module]=s.global:n.empConfig.isESM&&(this.useImportMap?(this.externals[s.module]=s.module,this.importMap.imports[s.module]=s.entry):this.externals[s.module]=s.entry),s.entry&&!n.empConfig.isESM&&this.externalAssets.js.push(s.entry)):s.type==="css"&&s.entry&&this.externalAssets.css.push(s.entry)})}}}});import Je from"url";import _e from"chalk";var se,E,ie=l(()=>{"use strict";y();se=class{imf={protocol:"",port:8e3,pathname:"/"};host="0.0.0.0";urls={lanUrlForConfig:"",lanUrlForTerminal:_e.gray("unavailable"),localUrlForTerminal:"",localUrlForBrowser:""};setup(e){e.host&&(this.host=e.host),e.protocol&&(this.imf.protocol=e.protocol),e.pathname&&(this.imf.pathname=e.pathname),e.port&&(this.imf.port=e.port),this.setupUrls()}setupUrls(){let{host:e}=this,t=e==="0.0.0.0"||e==="::",s;if(t){s="localhost";try{this.urls.lanUrlForConfig=this.getLanIp(),this.urls.lanUrlForConfig&&(/^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(this.urls.lanUrlForConfig)?this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig):this.urls.lanUrlForConfig="")}catch{}}else s=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(s),this.urls.localUrlForBrowser=this.formatUrl(s)}getLanIp=j;formatUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return Je.format({protocol:t,hostname:e,port:s,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return Je.format({protocol:t,hostname:e,port:_e.bold(s),pathname:r})}},E=new se});var re,A,oe=l(()=>{"use strict";ie();y();u();re=class{isADB=!1;isHttps=!1;get isHttpBase(){let e=n.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}setup(){if(this.isADB=!!n.empOptions.autoDevBase&&n.mode==="development"&&!this.isHttpBase,!this.isADB)return;let{server:e,https:t}=n.empOptions.server||{};this.isHttps=e==="https"||typeof e=="object"&&e.type==="https"||t===!0;let s=E.getLanIp(),r=this.isHttps?"https":"http",o=n.empOptions.server?.port||8e3;n.empOptions.base=`${r}://${s}:${o}/`,n.empOptions.server=h({port:o,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${s}:${o}/ws`}},n.empOptions.server)}},A=new re});var B,Ve=l(()=>{"use strict";oe();u();Y();B=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){A.setup(),this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){n.empConfig.build.polyfill==="entry"&&n.chain.plugin("empPolyfill").use(M),this.op.beforePlugin&&await this.op.beforePlugin()}async afterPlugin(){this.op.afterPlugin&&await this.op.afterPlugin()}async beforeBuild(){this.op.beforeBuild&&await this.op.beforeBuild()}async afterBulid(){this.op.afterBulid&&await this.op.afterBulid()}async beforeDevServe(){console.log(this.op),this.op.beforeDevServe&&await this.op.beforeDevServe()}async afterDevServe(){this.op.afterDevServe&&await this.op.afterDevServe()}async beforeServe(){this.op.beforeServe&&await this.op.beforeServe()}async afterServe(){this.op.afterServe&&await this.op.afterServe()}}});import Tt from"node:fs";var ne,We,Xe=l(()=>{"use strict";y();Ne();Ve();ne=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},h(e,t)}empShareLib=new R;isESM=!1;async autoDevSet(){this.store.mode==="development"&&this.store.empOptions.autoDevBase}checkIsESM(e){return["es3","es5"].indexOf(e)===-1}lifeCycle;async setup(e){this.store=e,await this.syncEmpOptions(),this.lifeCycle=new B(this.store.empOptions.lifeCycle),await this.lifeCycle.afterGetEmpOptions(),this.isESM=this.checkIsESM(this.build.target),this.store.empOptions.target?(this.target=this.store.empOptions.target,Array.isArray(this.target)&&!this.target.includes(this.build.target)&&this.target.push(this.build.target)):this.target=["web",this.build.target];let{appSrc:t,base:s,appEntry:r}=this.store.empOptions;t&&(this.appSrc=t),s&&(this.base=s),r&&(this.appEntry=r),this.store.empConfig.empShare&&await this.empShareLib.setup()}async chain(){this.store.empOptions.chain&&await this.store.empOptions.chain(this.store.chain)}async plugins(){let e=[];this.store.empOptions.plugins&&Array.isArray(this.store.empOptions.plugins)&&this.store.empOptions.plugins.length>0&&(this.store.empOptions.plugins.map(t=>{e.push(t.rsConfig(this.store))}),await Promise.all(e))}get debug(){return this.assign({loggerLevel:"info",clearLog:!0,progress:!0,showRsconfig:!1,showPerformance:!1,rspackCache:!0,infrastructureLogging:{appendOnly:!0,level:"warn"},newTreeshaking:this.store.empConfig.isESM},this.store.empOptions.debug)}get build(){let e=this.store.empOptions.build?.staticDir?`${this.store.empOptions.build?.staticDir}/`:"";return this.assign({outDir:"dist",staticDir:e,assetsDir:"assets",publicDir:"public",chunkIds:this.store.isDev?"named":"deterministic",moduleIds:this.store.isDev?"named":"deterministic",sourcemap:!0,minify:!this.store.isDev,minOptions:{},target:"es5",polyfill:!1,coreJsFeatures:"stable",externalHelpers:!1,browserslist:this.store.browserslistOptions.default,swcConfig:{}},{...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:{content:"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"},keywords:{keywords:""},description:{description:""}};return this.assign({lang:"zh-CN",title:"EMP",inject:"body",minify:!this.store.isDev,scriptLoading:this.isESM?"module":"defer",meta:e,files:{css:[],js:[]},tags:{headTags:[],bodyTags:[]}},this.store.empOptions.html)}get entries(){return this.store.empOptions.entries?this.store.empOptions.entries:{}}get server(){let e={host:"0.0.0.0",port:8e3,open:process.platform==="darwin",hot:!0,watchFiles:["src/**/*.html"],static:[{directory:this.store.publicDir,watch:this.store.isDev}],allowedHosts:["all"],historyApiFallback:!0,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":"X-Requested-With, content-type, Authorization"}};return this.assign(e,this.store.empOptions.server)}get empShare(){return this.assign({name:"",filename:"emp.js",shared:{},mfVersion:1.5},this.store.empOptions.empShare)}get css(){return this.assign({postcss:[]},this.store.empOptions.css)}get output(){let e=(this.store.isDev,".[contenthash:8]"),t=this.store.isDev?"":".[contenthash:8]",{assetsDir:s,staticDir:r}=this.store.empConfig.build,o={publicPath:this.store.empConfig.base?this.store.empConfig.base:"auto",crossOriginLoading:"anonymous",filename:`${r}js/[name]${e}.js`,cssFilename:`${r}css/[name]${t}.css`,cssChunkFilename:`${r}css/[name]${t}.css`,assetModuleFilename:`${r}${s}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!0};return this.assign(o,this.store.empOptions.output)}get define(){let e={mode:this.store.mode,env:this.store.cliOptions.env};return this.store.empOptions.define&&(e={...e,...this.store.empOptions.define}),this.setDefine(e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",s={};return Object.keys(e).map(r=>{(t==="all"||t==="esm")&&(s[`import.meta.env.${r}`]=JSON.stringify(e[r])),(t==="all"||t==="cjs")&&(s[`process.env.${r}`]=JSON.stringify(e[r])),s[`${r}`]=JSON.stringify(e[r])}),s}get externals(){return this.assign(this.empShareLib.externals,this.store.empOptions.externals)}get resolve(){return h({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(){let e=this.store.resolve("emp-config.js");if(!Tt.existsSync(e))return;let{default:t}=await import(this.store.importFileUrl(e));typeof t=="function"?this.store.empOptions=await t(this.store):this.store.empOptions=t||{}}get moduleTransformRule(){let{moduleTransform:e}=this.store.empOptions,t=this.assign({defaultExclude:!1},e),s={and:[],not:[]};return t.defaultExclude===!0&&s.and.push(/(node_modules|bower_components)/),t?.exclude&&(s.and=s.and.concat(t.exclude)),e?.include&&(s.not=t.include),s}get cacheDir(){return this.store.empOptions.cacheDir?this.store.empOptions.cacheDir:"node_modules/.emp-cache"}},We=new ne});import v from"node:path";import jt from"node:fs/promises";import Lt from"webpack-chain";import{pathToFileURL as Dt}from"node:url";import Ft from"node:util";var pe,n,u=l(()=>{"use strict";W();Ue();b();Xe();y();pe=class{empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=we;empSource=v.resolve(this.empRoot,"dist");resolve=e=>v.isAbsolute(e)?e:v.resolve(this.root,e);empResolve=e=>v.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};cacheDir="";mode="development";cliMode="dev";isDev=!0;cliOptions;chain;rsConfig;empOptions={};empConfig;vCompare=L;deepAssign=h;getLanIp=j;async setup(e,t){await this.initVars(e,t),this.empConfig=We,await this.empConfig.setup(this),this.initPaths(),this.chain=new Lt,await He.setup(this),this.setLogger(),this.toConfig(),this.logConfig()}async initVars(e,t){this.cliOptions=t||{},this.cliMode="prod",this.mode=e==="dev"?"development":"production",this.isDev=this.mode==="development";let s=await V(this.empResolve("package.json")),r=await V(this.resolve("package.json"));this.empPkg={...this.empPkg,...s},this.pkg={...this.pkg,...r}}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),this.resource.dir=v.join(this.empRoot,"resource"),this.resource.cert=v.join(this.resource.dir,"emp.cert"),this.resource.key=v.join(this.resource.dir,"emp.key")}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.empConfig.debug.loggerLevel&&(e=this.empConfig.debug.loggerLevel),a.setup({pname:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}`,logLevel:e})}merge(e){this.chain.merge(e)}importResolve(e,t){return Ce(e,t)}importFileUrl(e){return Dt(e).toString()}toConfig(){this.rsConfig=this.chain.toConfig()}logConfig(){if(this.empConfig.debug.showRsconfig)if(typeof this.empConfig.debug.showRsconfig=="string"){let e=v.join(this.root,this.empConfig.debug.showRsconfig);jt.writeFile(e,JSON.stringify(this.rsConfig,null,2))}else{let e={colors:!0,depth:null},t=typeof this.empConfig.debug.showRsconfig=="object"?h(e,this.empConfig.debug.showRsconfig):e;console.log(a.link("[Compile Config]")),console.log(Ft.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 >= 20"]}}},n=new pe});import{exec as Mt}from"node:child_process";import{promisify as Rt}from"node:util";var Qe,qe,At,Bt,Ye,Ze=l(()=>{"use strict";b();u();Qe=Rt(Mt),qe=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],At=async()=>{let i=process.env.BROWSER;if(!i||!qe.includes(i)){let{stdout:e}=await Qe("ps cax");i=qe.find(t=>e.includes(t))}return i},Bt=async i=>{if(process.platform==="darwin")try{let t=await At();if(t){let s=`osascript openChrome.applescript "${encodeURI(i)}" "${t}"`;return await Qe(s,{cwd:n.resource.dir}),!0}}catch(t){a.debug(t)}try{let{default:t}=await import("open");return await t(i),!0}catch(t){return a.error("Failed to open start URL."),a.error(t),!1}},Ye=Bt});import zt from"net";import Gt from"os";async function et(i,e="localhost"){if(i!==It&&(i<Ke||i>ae))throw new Error(`Port number must lie between ${Ke} and ${ae}`);let t=i,s=Ht(),r;e&&!s.has(e)?r=new Set([e]):r=s;let o=new Set(["EADDRINUSE","EACCES"]);for(;t<=ae;)try{return await Nt(t,r)}catch(p){if(!o.has(p.code))throw p;t+=1}throw new Error("No available ports found")}var Ke,ae,It,Ht,Ut,Nt,tt=l(()=>{"use strict";Ke=1024,ae=65535,It=443,Ht=()=>{let i=Gt.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(i))if(t)for(let s of t)e.add(s.address);return e},Ut=(i,e)=>new Promise((t,s)=>{let r=zt.createServer();r.unref(),r.on("error",s),r.listen(i,e,()=>{let{port:o}=r.address();r.close(()=>{t(o)})})}),Nt=async(i,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let s of e)try{await Ut(i,s)}catch(r){if(!t.has(r.code))throw r}return i}});import st from"node:fs/promises";import z from"chalk";var C,G=l(()=>{"use strict";b();u();y();ie();Ze();tt();oe();C=class{sf={protocol:"http",host:"0.0.0.0",port:8e3,publicPath:"",publicHasHttp:!1,isOpenBrower:!1,url:"",urls:{localUrlForBrowser:"",localUrlForTerminal:"",lanUrlForTerminal:"",lanUrlForConfig:""}};async adaptServer(){this.sf.publicPath=n.rsConfig.output?.publicPath==="auto"?"/":n.rsConfig.output?.publicPath||"/",this.sf.isOpenBrower=!!n.empConfig.server.open,this.sf.protocol=this.isHttps?"https":"http",this.sf.host=n.empConfig.server.host?n.empConfig.server.host:this.sf.host,this.sf.port=n.empConfig.server.port,await this.serverPort(),E.setup(this.sf),this.sf.publicPath&&(this.sf.publicPath.indexOf("http://")>-1||this.sf.publicPath.indexOf("https://")>-1)?(this.sf.url=this.sf.publicPath,this.sf.publicHasHttp=!0,this.sf.urls.localUrlForTerminal=E.prettyPrintUrl("localhost")):(this.sf.urls=E.urls,this.sf.url=this.sf.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this.sf;this.sf.publicHasHttp?(a.info(`${z.greenBright("\u279C")} Local: ${a.link(e.localUrlForTerminal)}`),a.info(`${z.greenBright("\u279C")} Network: ${a.link(this.sf.publicPath)}`)):(a.info(`${z.greenBright("\u279C")} Local: ${a.link(e.localUrlForTerminal)}`),a.info(`${z.greenBright("\u279C")} Network: ${a.link(e.lanUrlForTerminal)}
11
+ `)),this.sf.isOpenBrower&&Ye(this.sf.url)}async setup(e,t){await n.setup(e,t),n.empConfig.debug.clearLog&&Pe(),a.title(`${e}`),await this.adaptServer(),await this.run(),this.afterRun()}async run(){}afterRun(){process.on("SIGINT",function(){process.exit()})}get isHttps(){let{server:e,https:t}=n.empConfig.server||{};return e==="https"||typeof e=="object"&&e.type==="https"||t===!0}getcert(){return Promise.all([st.readFile(n.resource.key),st.readFile(n.resource.cert)])}async serverPort(){if(A.isADB)return;let{port:e,host:t}=this.sf,s=await et(e,t);s!==e&&(this.sf.port=s,n.rsConfig.devServer?.port&&(n.rsConfig.devServer.port=s))}}});import d from"chalk";import w from"node:path";import{gzipSizeSync as Jt}from"gzip-size";import _t from"node:fs";function Zt(i,e){let t=[i,e],s=["File","Size","Gzipped"].reduce((r,o,p)=>{let m=t[p],g=o;return m&&(g=o.length<m?o+" ".repeat(m-o.length):o),`${r+g} `}," ");console.log(d.bold.blue(s))}async function it(i){let e=i.toJson({all:!1,assets:!0,timings:!0});$(e.time);let s=e.assets.filter(c=>qt(c.name)).map(Yt);s.sort((c,P)=>c.size-P.size);let r=Math.max(...s.map(c=>c.sizeLabel.length)),o=Math.max(...s.map(c=>(c.folder+w.sep+c.name).length));Zt(o,r);let p=0,m=0;s.forEach(c=>{let{sizeLabel:P}=c,{name:ft,folder:ut,gzipSizeLabel:gt}=c,ge=(ut+w.sep+ft).length,de=P.length;if(p+=c.size,m+=c.gzippedSize,de<r){let N=" ".repeat(r-de);P+=N}let ye=d.gray(c.folder+w.sep)+Kt(c.name);if(ge<o){let N=" ".repeat(o-ge);ye+=N}a.info(` ${ye} ${d.gray(P)} ${gt}`)});let g=`${d.bold.blue("Total size:")} ${I(p)}`,O=`${d.bold.blue("Gzipped size:")} ${I(m)}`;a.info(`
12
12
  ${g}
13
13
  ${O}
14
- `)}function $(r=0){a.info(`${d.greenBright("\u2713")} Ready in ${ke(Number(r))}`)}var Vt,Wt,Xt,qt,Qt,Yt,I,Kt,H=l(()=>{"use strict";u();b();y();Vt=/\.html$/,Wt=/\.(?:js|mjs|cjs|jsx)$/,Xt=/\.css$/,qt=r=>!/\.map$/.test(r)&&!/\.LICENSE\.txt$/.test(r),Qt=r=>r>300*1e3?d.red:r>100*1e3?d.yellow:d.white,Yt=r=>{let e=r.name.split("?")[0],t=I(r.size),s=w.basename(e),i=w.join(w.basename(n.empConfig.build.outDir),w.dirname(e)),o=_t.readFileSync(w.join(n.empConfig.build.outDir,e)),p=o.length,m=Jt(o),g=Qt(m)(I(m));return{size:p,folder:i,name:s,gzippedSize:m,sizeLabel:t,gzipSizeLabel:g}};I=r=>{let e=r/1e3;return`${e.toFixed(e<1?2:1)} kB`},Kt=r=>Wt.test(r)?d.yellowBright(r):Xt.test(r)?d.greenBright(r):Vt.test(r)?d.blueBright(r):d.magenta(r)});var it={};J(it,{default:()=>ss});import{rspack as es}from"@rspack/core";import{RspackDevServer as ts}from"@rspack/dev-server";var le,ss,ot=l(()=>{"use strict";u();G();b();y();H();le=class extends C{get rspackDevConfig(){return f(n.rsConfig,{stats:{all:!1,colors:!0,assets:!1,chunks:!1,entrypoints:!1,timings:!1,version:!1,errors:!0,warnings:!0},devServer:{open:!1,setupExitSignals:!0}})}async devServerConfig(){let e=Object.assign({},n.rsConfig.devServer);if(this.isHttps&&(e.https===!0&&delete e.https,!e.server)){let[t,s]=await this.getcert();e.server={type:"https",options:{key:t,cert:s}}}return e}async run(){let e=es(this.rspackDevConfig);if(!n.rsConfig.devServer){a.error("devServer is not defined in config");return}let t=await this.devServerConfig(),s=new ts(t,e);this.startOpen(),n.empConfig.lifeCycle.beforeDevServe&&await n.empConfig.lifeCycle.beforeDevServe(),await s.start();let i=o=>{let p=o?.toJson({all:!1,colors:!1,assets:!1,chunks:!1,timings:!0});$(p.time)};n.empConfig.debug.showPerformance&&e.hooks.afterDone.tap("done",i),s.middleware?.waitUntilValid(o=>{n.empConfig.debug.showPerformance||i(o),n.empConfig.lifeCycle.afterDevServe&&n.empConfig.lifeCycle.afterDevServe()})}},ss=new le});var nt={};J(nt,{default:()=>is});import{rspack as rs}from"@rspack/core";var ce,is,pt=l(()=>{"use strict";b();u();G();H();ce=class extends C{async run(){n.empConfig.lifeCycle.beforeBuild&&await n.empConfig.lifeCycle.beforeBuild(),rs(n.rsConfig,async(e,t)=>{if(e!==null){a.error(e.stack||e),e.message&&a.error(e.message);return}if(!t){a.red("Stats is Undefined.");return}t.hasErrors()&&(a.error(t.toString({colors:!0,children:!0})),a.red("Failed to compile."),process.exit(1)),t.hasWarnings()&&(a.yellow("Compiled with warnings."),a.warn(t.toString({colors:!0,children:!0}))),await rt(t),n.empConfig.lifeCycle.afterBulid&&await n.empConfig.lifeCycle.afterBulid()})}},is=new ce});import os from"express";import ns from"cors";import ps from"compression";import as from"https";var U,at=l(()=>{"use strict";G();U=class extends C{app;async init(){let e=os();e.use(ps()),e.use(ns()),this.app=e}async server(){if(this.isHttps){let[e,t]=await this.getcert();as.createServer(typeof this.isHttps!="boolean"?this.isHttps:{key:e,cert:t},this.app).listen(this.sf.port,async()=>{this.startOpen(),await this.onReady()})}else this.app.listen(this.sf.port,async()=>{this.startOpen(),await this.onReady()})}async onReady(){}async middleware(){}async start(){await this.init(),await this.middleware(),await this.server()}}});var lt={};J(lt,{default:()=>fs});import ls from"express";import cs from"path";import ms from"node:fs/promises";import hs from"node:fs";var me,fs,ct=l(()=>{"use strict";at();u();b();H();me=class extends U{timing=0;async run(){if(this.timing=Date.now(),!hs.existsSync(n.outDir))return a.sysError(`emp serve must be executed after emp build,${n.outDir} not exist!`);n.empConfig.lifeCycle.beforeServe&&await n.empConfig.lifeCycle.beforeServe(),this.start()}async middleware(){let e=n.resolve(n.rsConfig.output?.path);this.app.use(ls.static(e));let t=await ms.readFile(cs.join(e,"index.html"),"utf8");this.app.get("*",(s,i)=>i.send(t))}async onReady(){$(Date.now()-this.timing),n.empConfig.lifeCycle.afterServe&&await n.empConfig.lifeCycle.afterServe()}},fs=new me});u();u();y();b();import{program as S}from"commander";import he,{exit as us}from"node:process";function mt(){let r="20.0.0";L(r,he.versions.node)===1&&(a.sysError(`\u5F53\u524D\u7248\u672C\u4E3Av${he.versions.node} \u6700\u4F4E\u8981\u6C42\u4E3Av${r}`),us(0)),S.version(n.empPkg.version,"-v, --version").usage("<command> [options]"),S.command("dev").description("Dev \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-h, --hot","\u662F\u5426\u4F7F\u7528\u70ED\u66F4\u65B0 \u9ED8\u8BA4\u542F\u52A8").option("-o, --open","\u662F\u5426\u6253\u5F00\u8C03\u8BD5\u9875\u9762 \u9ED8\u8BA4\u4E0D\u6253\u5F00").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-ev, --env-vars <key=value>","\u5B9A\u4E49\u4E00\u4E2A\u73AF\u5883\u53D8\u91CF -ev key=value \u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u91CD\u590D\u8C03\u7528 -ev key=value -ev key=value",(e,t)=>{let[s,i]=e.split("=");return t[s]=i,t},{}).action(async e=>{let{default:t}=await Promise.resolve().then(()=>(ot(),it));await t.setup("dev",e)}),S.command("build").description("Build \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-a, --analyze","\u751F\u6210\u5206\u6790\u62A5\u544A \u9ED8\u8BA4\u4E3A false").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-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",(e,t)=>{let[s,i]=e.split("=");return t[s]=i,t},{}).action(async e=>{let{default:t}=await Promise.resolve().then(()=>(pt(),nt));await t.setup("build",e)}),S.command("serve").description("Server \u6A21\u5F0F").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").action(async e=>{let{default:t}=await Promise.resolve().then(()=>(ct(),lt));await t.setup("serve",e)}),S.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(e=>{}),S.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(e=>{}),S.parse(he.argv)}u();import gs from"fast-glob";import ht from"node:fs/promises";import fe from"node:path";var ds=/(?:(?:import|export)\s?(?:type)?\s?(?:(?:\{[^;\n]+\})|(?:[^;\n]+))\s?from\s?['"][^;\n]+['"])|(?:import\(['"][^;\n]+?['"]\))/g,ys=/(?:import|export)\s?(?:type)?\s?\{?.+\}?\s?from\s?['"](.+)['"]/,bs=/import\(['"]([^;\n]+?)['"]\)/,ue=class{list=[];outDir=n.resolve("dist");aliasName="@empjs/cli";async setup(e,t){e&&(this.outDir=e),t&&(this.aliasName=t);let s=await this.readDts();await this.writeCode(s)}async readDts(){this.list=await gs([`${n.empConfig.build.outDir}/**/*.d.ts`]);let e=[];this.list.map(s=>{s=n.resolve(s),e.push(this.readFile(s))});let t=await Promise.all(e);return t=t.map(s=>this.replaceAliasPath(s)),t}async readFile(e){let t=await ht.readFile(e,{encoding:"utf-8"});return{src:e,code:t}}replaceAliasPath({src:e,code:t}){t=t.replace(ds,i=>{let o=i.match(ys);if(o||(o=i.match(bs)),o&&o[1]){let p=o[1];if(!p.startsWith("."))return i;let m=fe.resolve(fe.dirname(e),p).replace(this.outDir,this.aliasName);return i.replace(o[1],m)}return i});let s=e.replace(this.outDir,this.aliasName).replace(".d.ts","");return s.endsWith("/index")&&(s=s.replace("/index","")),t=this.warpDeclareModule(s,t),{code:t,src:e,mod:s}}warpDeclareModule(e,t){return`declare module '${e}' {\r
14
+ `)}function $(i=0){a.info(`${d.greenBright("\u2713")} Ready in ${ke(Number(i))}`)}var Vt,Wt,Xt,qt,Qt,Yt,I,Kt,H=l(()=>{"use strict";u();b();y();Vt=/\.html$/,Wt=/\.(?:js|mjs|cjs|jsx)$/,Xt=/\.css$/,qt=i=>!/\.map$/.test(i)&&!/\.LICENSE\.txt$/.test(i),Qt=i=>i>300*1e3?d.red:i>100*1e3?d.yellow:d.white,Yt=i=>{let e=i.name.split("?")[0],t=I(i.size),s=w.basename(e),r=w.join(w.basename(n.empConfig.build.outDir),w.dirname(e)),o=_t.readFileSync(w.join(n.empConfig.build.outDir,e)),p=o.length,m=Jt(o),g=Qt(m)(I(m));return{size:p,folder:r,name:s,gzippedSize:m,sizeLabel:t,gzipSizeLabel:g}};I=i=>{let e=i/1e3;return`${e.toFixed(e<1?2:1)} kB`},Kt=i=>Wt.test(i)?d.yellowBright(i):Xt.test(i)?d.greenBright(i):Vt.test(i)?d.blueBright(i):d.magenta(i)});var rt={};J(rt,{default:()=>ss});import{rspack as es}from"@rspack/core";import{RspackDevServer as ts}from"@rspack/dev-server";var le,ss,ot=l(()=>{"use strict";u();G();b();y();H();le=class extends C{get rspackDevConfig(){return h(n.rsConfig,{stats:{all:!1,colors:!0,assets:!1,chunks:!1,entrypoints:!1,timings:!1,version:!1,errors:!0,warnings:!0},devServer:{open:!1,setupExitSignals:!0}})}async devServerConfig(){let e=Object.assign({},n.rsConfig.devServer);if(this.isHttps&&(e.https===!0&&delete e.https,!e.server)){let[t,s]=await this.getcert();e.server={type:"https",options:{key:t,cert:s}}}return e}async run(){let e=es(this.rspackDevConfig);if(!n.rsConfig.devServer){a.error("devServer is not defined in config");return}let t=await this.devServerConfig(),s=new ts(t,e);this.startOpen(),n.empConfig.lifeCycle.beforeDevServe&&await n.empConfig.lifeCycle.beforeDevServe(),await s.start();let r=o=>{let p=o?.toJson({all:!1,colors:!1,assets:!1,chunks:!1,timings:!0});$(p.time)};n.empConfig.debug.showPerformance&&e.hooks.afterDone.tap("done",r),s.middleware?.waitUntilValid(o=>{n.empConfig.debug.showPerformance||r(o),n.empConfig.lifeCycle.afterDevServe&&n.empConfig.lifeCycle.afterDevServe()})}},ss=new le});var nt={};J(nt,{default:()=>rs});import{rspack as is}from"@rspack/core";var ce,rs,pt=l(()=>{"use strict";b();u();G();H();ce=class extends C{async run(){n.empConfig.lifeCycle.beforeBuild&&await n.empConfig.lifeCycle.beforeBuild(),is(n.rsConfig,async(e,t)=>{if(e!==null){a.error(e.stack||e),e.message&&a.error(e.message);return}if(!t){a.red("Stats is Undefined.");return}t.hasErrors()&&(a.error(t.toString({colors:!0,children:!0})),a.red("Failed to compile."),process.exit(1)),t.hasWarnings()&&(a.yellow("Compiled with warnings."),a.warn(t.toString({colors:!0,children:!0}))),await it(t),n.empConfig.lifeCycle.afterBulid&&await n.empConfig.lifeCycle.afterBulid()})}},rs=new ce});import os from"express";import ns from"cors";import ps from"compression";import as from"https";var U,at=l(()=>{"use strict";G();U=class extends C{app;async init(){let e=os();e.use(ps()),e.use(ns()),this.app=e}async server(){if(this.isHttps){let[e,t]=await this.getcert();as.createServer(typeof this.isHttps!="boolean"?this.isHttps:{key:e,cert:t},this.app).listen(this.sf.port,async()=>{this.startOpen(),await this.onReady()})}else this.app.listen(this.sf.port,async()=>{this.startOpen(),await this.onReady()})}async onReady(){}async middleware(){}async start(){await this.init(),await this.middleware(),await this.server()}}});var lt={};J(lt,{default:()=>fs});import ls from"express";import cs from"path";import ms from"node:fs/promises";import hs from"node:fs";var me,fs,ct=l(()=>{"use strict";at();u();b();H();me=class extends U{timing=0;async run(){if(this.timing=Date.now(),!hs.existsSync(n.outDir))return a.sysError(`emp serve must be executed after emp build,${n.outDir} not exist!`);n.empConfig.lifeCycle.beforeServe&&await n.empConfig.lifeCycle.beforeServe(),this.start()}async middleware(){let e=n.resolve(n.rsConfig.output?.path);this.app.use(ls.static(e));let t=await ms.readFile(cs.join(e,"index.html"),"utf8");this.app.get("*",(s,r)=>r.send(t))}async onReady(){$(Date.now()-this.timing),n.empConfig.lifeCycle.afterServe&&await n.empConfig.lifeCycle.afterServe()}},fs=new me});u();u();y();b();import{program as S}from"commander";import he,{exit as us}from"node:process";function mt(){let i="20.0.0";L(i,he.versions.node)===1&&(a.sysError(`\u5F53\u524D\u7248\u672C\u4E3Av${he.versions.node} \u6700\u4F4E\u8981\u6C42\u4E3Av${i}`),us(0)),S.version(n.empPkg.version,"-v, --version").usage("<command> [options]"),S.command("dev").description("Dev \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-h, --hot","\u662F\u5426\u4F7F\u7528\u70ED\u66F4\u65B0 \u9ED8\u8BA4\u542F\u52A8").option("-o, --open","\u662F\u5426\u6253\u5F00\u8C03\u8BD5\u9875\u9762 \u9ED8\u8BA4\u4E0D\u6253\u5F00").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-ev, --env-vars <key=value>","\u5B9A\u4E49\u4E00\u4E2A\u73AF\u5883\u53D8\u91CF -ev key=value \u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u91CD\u590D\u8C03\u7528 -ev key=value -ev key=value",(e,t)=>{let[s,r]=e.split("=");return t[s]=r,t},{}).action(async e=>{let{default:t}=await Promise.resolve().then(()=>(ot(),rt));await t.setup("dev",e)}),S.command("build").description("Build \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-a, --analyze","\u751F\u6210\u5206\u6790\u62A5\u544A \u9ED8\u8BA4\u4E3A false").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-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",(e,t)=>{let[s,r]=e.split("=");return t[s]=r,t},{}).action(async e=>{let{default:t}=await Promise.resolve().then(()=>(pt(),nt));await t.setup("build",e)}),S.command("serve").description("Server \u6A21\u5F0F").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").action(async e=>{let{default:t}=await Promise.resolve().then(()=>(ct(),lt));await t.setup("serve",e)}),S.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(e=>{}),S.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(e=>{}),S.parse(he.argv)}u();import gs from"fast-glob";import ht from"node:fs/promises";import fe from"node:path";var ds=/(?:(?:import|export)\s?(?:type)?\s?(?:(?:\{[^;\n]+\})|(?:[^;\n]+))\s?from\s?['"][^;\n]+['"])|(?:import\(['"][^;\n]+?['"]\))/g,ys=/(?:import|export)\s?(?:type)?\s?\{?.+\}?\s?from\s?['"](.+)['"]/,bs=/import\(['"]([^;\n]+?)['"]\)/,ue=class{list=[];outDir=n.resolve("dist");aliasName="@empjs/cli";async setup(e,t){e&&(this.outDir=e),t&&(this.aliasName=t);let s=await this.readDts();await this.writeCode(s)}async readDts(){this.list=await gs([`${n.empConfig.build.outDir}/**/*.d.ts`]);let e=[];this.list.map(s=>{s=n.resolve(s),e.push(this.readFile(s))});let t=await Promise.all(e);return t=t.map(s=>this.replaceAliasPath(s)),t}async readFile(e){let t=await ht.readFile(e,{encoding:"utf-8"});return{src:e,code:t}}replaceAliasPath({src:e,code:t}){t=t.replace(ds,r=>{let o=r.match(ys);if(o||(o=r.match(bs)),o&&o[1]){let p=o[1];if(!p.startsWith("."))return r;let m=fe.resolve(fe.dirname(e),p).replace(this.outDir,this.aliasName);return r.replace(o[1],m)}return r});let s=e.replace(this.outDir,this.aliasName).replace(".d.ts","");return s.endsWith("/index")&&(s=s.replace("/index","")),t=this.warpDeclareModule(s,t),{code:t,src:e,mod:s}}warpDeclareModule(e,t){return`declare module '${e}' {\r
15
15
  ${t}}\r
16
- `}async writeCode(e){let t="";e.map(s=>{t+=s.code}),await ht.writeFile(fe.join(this.outDir.replace("dist","types"),"type.d.ts"),t)}},vs=new ue;function Zi(r){return r}export{Zi as defineConfig,vs as dts,mt as runScript,n as store};
16
+ `}async writeCode(e){let t="";e.map(s=>{t+=s.code}),await ht.writeFile(fe.join(this.outDir.replace("dist","types"),"type.d.ts"),t)}},vs=new ue;function Zr(i){return i}export{Zr as defineConfig,vs as dts,mt as runScript,n as store};
@@ -114,6 +114,15 @@ export type BuildType = {
114
114
  * 浏览器 兼容版本
115
115
  */
116
116
  browserslist: string[];
117
+ /**
118
+ * swc 配置
119
+ */
120
+ swcConfig: {
121
+ transform?: {
122
+ useDefineForClassFields?: boolean;
123
+ };
124
+ preserveAllComments?: boolean;
125
+ };
117
126
  };
118
127
  export type JscTarget = 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022';
119
128
  export interface HtmlType extends HtmlRspackPluginOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empjs/cli",
3
- "version": "3.0.0-rc.2",
3
+ "version": "3.0.0-rc.2-1",
4
4
  "description": "emp",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,7 +14,8 @@
14
14
  ],
15
15
  "maintainers": [
16
16
  "xuhongbin",
17
- "ckken"
17
+ "ckken",
18
+ "doerme"
18
19
  ],
19
20
  "repository": {
20
21
  "type": "git",