@empjs/cli 3.0.0-rc.1 → 3.0.0-rc.10
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.d.ts +2 -2
- package/dist/index.js +6 -6
- package/dist/script/dev.d.ts +1 -1
- package/dist/script/httpBase.d.ts +1 -1
- package/dist/store/empConfig.d.ts +10 -4
- package/dist/store/empShare/fastMode.d.ts +18 -0
- package/dist/store/{empShareLib.d.ts → empShare/index.d.ts} +3 -4
- package/dist/store/index.d.ts +8 -4
- package/dist/store/lifeCycle.d.ts +4 -0
- package/dist/store/rspack/common.d.ts +1 -0
- package/dist/store/rspack/entries.d.ts +16 -2
- package/dist/store/rspack/hook.d.ts +7 -5
- package/dist/types/config.d.ts +61 -9
- package/emp-tsconfig.json +4 -13
- package/package.json +95 -110
- package/template/favicon-128.ico +0 -0
- package/template/favicon-256.ico +0 -0
- package/template/favicon-64.ico +0 -0
- package/template/favicon.ico +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export type { EmpOptions } from './types/config';
|
|
2
|
-
import type { EmpOptions } from './types/config';
|
|
3
2
|
import type { GlobalStore } from './store';
|
|
3
|
+
import type { EmpOptions } from './types/config';
|
|
4
4
|
export type { EMP3PluginType, EMP3PluginFnType } from './types/plugin';
|
|
5
|
-
import store from './store';
|
|
6
5
|
import runScript from './script';
|
|
7
6
|
import dts from './script/dts';
|
|
7
|
+
import store from './store';
|
|
8
8
|
export type EMPConfigFn = (store: GlobalStore) => EmpOptions | Promise<EmpOptions>;
|
|
9
9
|
export type EMPConfigExport = EmpOptions | EMPConfigFn;
|
|
10
10
|
export declare function defineConfig(config: EMPConfigExport): EMPConfigExport;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
var
|
|
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,Ge=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),n=[s];this.entriesConfig[i]={entry:{[i]:n},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]),this.store.empConfig.empShareLib.useImportMap&&this.store.chain.plugin(`html-plugin-import-map-${t}`).use(D,[this.store.empConfig.empShareLib.importMap])}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,ze,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"}}}})}},ze=new K});var ee,He,Ue=l(()=>{"use strict";Ee();Le();Fe();Ge();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),ze.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} `)}
|
|
1
|
+
var vt=Object.defineProperty;var l=(i,e)=>()=>(i&&(e=i(i=0)),e);var _=(i,e)=>{for(var t in e)vt(i,t,{get:e[t],enumerable:!0})};import h from"chalk";var W,p,v=l(()=>{"use strict";W=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
2
|
`)};cyan=e=>{console.log(`${h.white.bgCyan(this.pname)}${h.cyan.bgWhite(` ${e} `)}
|
|
4
3
|
`)};magenta=e=>{console.log(`${h.white.bgMagenta(this.pname)}${h.magenta.bgWhite(` ${e} `)}
|
|
5
4
|
`)};green=e=>{console.log(`${h.white.bgGreen(this.pname)}${h.green.bgWhite(` ${e} `)}
|
|
@@ -7,10 +6,11 @@ var dt=Object.defineProperty;var l=(r,e)=>()=>(r&&(e=r(r=0)),e);var J=(r,e)=>{fo
|
|
|
7
6
|
`)};red=e=>{console.log(`${h.white.bgRed(this.pname)}${h.red.bgWhite(` ${e} `)}
|
|
8
7
|
`)};sysError=e=>{console.log(`${h.white.bgRed(" System Error Tips ")}${h.red.bgWhite(` ${e} `)}
|
|
9
8
|
`)};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=o.empConfig.empShare,this.version=o.empConfig.empShare.mfVersion,this.isEmpshare=!!o.empConfig.empShare.name,this.config.shareLib&&this.setShareLib(),this.prepareEsm()}get useImportMap(){return this.config.useImportMap&&o.empConfig.isESM}get pluginConfig(){let e={...this.config};return delete e.mfVersion,delete e.shareLib,delete e.useImportMap,{manifest:!1,dts:!1,dev:!1,...e}}prepareEsm(){if(o.empConfig.isESM){this.config.library={type:"module"};let e=this.config.remotes||{};for(let[t,s]of Object.entries(e))if(typeof s=="string"){let 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 n={};if(n.module=s,typeof i=="string"){let p=i.match(this.exp)||[];p.length>0?(n.global=p[1],n.entry=p[2],n.type="js",t.push(n),n={}):(n.global="",n.entry=i,n.type="js",t.push(n),n={})}else Array.isArray(i)?i.map(p=>{if(!p)return;if(p.split("?")[0].endsWith(".css"))n.entry=p,n.type="css";else{let g=p.match(this.exp)||[];g.length>0?(n.global=g[1],n.entry=g[2],n.type="js"):(n.global="",n.entry=p,n.type="js")}t.push(n),n={}}):typeof i=="object"&&i.entry&&(n.entry=i.entry,n.global=i.global,n.type=i.type,t.push(n),n={})}await Promise.all([this.setExternalAssets(t)])}async setExternalAssets(e=[]){if(e.length>0){let t=[];t=t.concat(e),t.map(s=>{s.type=s.type||"js",s.type==="js"&&s.module?(s.global?this.externals[s.module]=s.global:o.empConfig.isESM&&(this.useImportMap?(this.externals[s.module]=s.module,this.importMap.imports[s.module]=s.entry):this.externals[s.module]=s.entry),s.entry&&!o.empConfig.isESM&&this.externalAssets.js.push(s.entry)):s.type==="css"&&s.entry&&this.externalAssets.css.push(s.entry)})}}}});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=o.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}setup(){if(this.isADB=!!o.empOptions.autoDevBase&&o.mode==="development"&&!this.isHttpBase,!this.isADB)return;let{server:e,https:t}=o.empOptions.server||{};this.isHttps=e==="https"||typeof e=="object"&&e.type==="https"||t===!0;let s=E.getLanIp(),i=this.isHttps?"https":"http",n=o.empOptions.server?.port||8e3;o.empOptions.base=`${i}://${s}:${n}/`,o.empOptions.server=f({port:n,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${s}:${n}/ws`}},o.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(){o.empConfig.build.polyfill==="entry"&&o.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,n={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(n,this.store.empOptions.output)}get define(){let e={mode:this.store.mode,env:this.store.cliOptions.env};return this.store.empOptions.define&&(e={...e,...this.store.empOptions.define}),this.setDefine(e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",s={};return Object.keys(e).map(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,o,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"]}}},o=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:o.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 Gt from"net";import zt 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 n=new Set(["EADDRINUSE","EACCES"]);for(;t<=ae;)try{return await Nt(t,i)}catch(p){if(!n.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=zt.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=Gt.createServer();i.unref(),i.on("error",s),i.listen(r,e,()=>{let{port:n}=i.address();i.close(()=>{t(n)})})}),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 G from"chalk";var C,z=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=o.rsConfig.output?.publicPath==="auto"?"/":o.rsConfig.output?.publicPath||"/",this.sf.isOpenBrower=!!o.empConfig.server.open,this.sf.protocol=this.isHttps?"https":"http",this.sf.host=o.empConfig.server.host?o.empConfig.server.host:this.sf.host,this.sf.port=o.empConfig.server.port,await this.serverPort(),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(`${G.greenBright("\u279C")} Local: ${a.link(e.localUrlForTerminal)}`),a.info(`${G.greenBright("\u279C")} Network: ${a.link(this.sf.publicPath)}`)):(a.info(`${G.greenBright("\u279C")} Local: ${a.link(e.localUrlForTerminal)}`),a.info(`${G.greenBright("\u279C")} Network: ${a.link(e.lanUrlForTerminal)}
|
|
11
|
-
`)),this.sf.isOpenBrower&&Ye(this.sf.url)}async setup(e,t){await o.setup(e,t),o.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}=o.empConfig.server||{};return e==="https"||typeof e=="object"&&e.type==="https"||t===!0}getcert(){return Promise.all([st.readFile(o.resource.key),st.readFile(o.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,o.rsConfig.devServer?.port&&(o.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,n,p)=>{let m=t[p],g=n;return m&&(g=n.length<m?n+" ".repeat(m-n.length):n),`${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)),n=Math.max(...s.map(c=>(c.folder+w.sep+c.name).length));Zt(n,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<n){let N=" ".repeat(n-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(`
|
|
9
|
+
`)}},p=new W});import{ip as Ct}from"address";import wt from"chalk";import{gateway4sync as xt}from"default-gateway";import St from"fs-extra";function Ce(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function f(i,...e){for(let t of e)for(let s in t){let r=t[s],n=i[s];if(Object(r)==r&&Object(n)===n){i[s]=f(n,r);continue}i[s]=t[s]}return i}var M,ve,j,we,xe,y=l(()=>{"use strict";M=()=>{let{int:i}=xt();return Ct(i||"")||"127.0.0.1"},ve=i=>{try{let{version:e}=St.readJSONSync(i);return e}catch{return}};j=(i="",e="")=>{let t=i.replace("^","").split("."),s=e.replace("^","").split("."),r=Math.max(t.length,s.length),n=0;for(let a=0;a<r;a++){let m=t.length>a?t[a]:0,g=isNaN(Number(m))?m.charCodeAt():Number(m),O=s.length>a?s[a]:0,c=isNaN(Number(O))?O.charCodeAt():Number(O);if(g<c){n=-1;break}else if(g>c){n=1;break}}return n},we=i=>{i=i/1e3;let e=s=>wt.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`},xe=i=>`data:text/javascript,${i}`});import{readFile as Et}from"node:fs/promises";import Se from"node:module";import{dirname as Ot}from"node:path";import V from"node:path";import{fileURLToPath as Pt}from"node:url";var Ee,kt,X,L,Oe,Pe,q=l(()=>{"use strict";Ee=Pt(import.meta.url),kt=Ot(Ee),X=async i=>{try{let e=await Et(i);return JSON.parse(e)}catch(e){console.error(e)}},L=Se.createRequire(import.meta.url),Oe=(i,e)=>{let t=L;return e&&(t=Se.createRequire(e)),t.resolve(i)},Pe=V.resolve(kt,Ee).replace(`${V.sep}dist${V.sep}index.js`,"")});var T,ke=l(()=>{"use strict";u();T=class{externals={};externalAssets={js:[],css:[]};exp=/^([0-9a-zA-Z_\s]+)@(.*)/;config;importMap={imports:{}};isEmpshare=!1;async setup(){this.config=o.empConfig.empShare,this.isEmpshare=!!o.empConfig.empShare.name,o.empConfig.empShare.fastMode&&o.empConfig.empShareFastMode.setup(),this.config.shareLib&&this.setShareLib(),this.prepareEsm()}get useImportMap(){return this.config.useImportMap&&o.empConfig.isESM}get pluginConfig(){let e={...this.config};return delete e.shareLib,delete e.useImportMap,delete e.fastMode,{manifest:!1,dts:!1,...e}}prepareEsm(){if(o.empConfig.isESM){this.config.library={type:"module"};let e=this.config.remotes||{};for(let[t,s]of Object.entries(e))if(typeof s=="string"){let r=s.match(this.exp)||[];r.length>0&&(e[t]=r[2])}this.config.remotes=e}}async setShareLib(){let e=this.config,t=[];if(typeof e.shareLib=="object")for(let[s,r]of Object.entries(e.shareLib)){let n={};if(n.module=s,typeof r=="string"){let a=r.match(this.exp)||[];a.length>0?(n.global=a[1],n.entry=a[2],n.type="js",t.push(n),n={}):(n.global="",n.entry=r,n.type="js",t.push(n),n={})}else Array.isArray(r)?r.map(a=>{if(!a)return;if(a.split("?")[0].endsWith(".css"))n.entry=a,n.type="css";else{let g=a.match(this.exp)||[];g.length>0?(n.global=g[1],n.entry=g[2],n.type="js"):(n.global="",n.entry=a,n.type="js")}t.push(n),n={}}):typeof r=="object"&&r.entry&&(n.entry=r.entry,n.global=r.global,n.type=r.type,t.push(n),n={})}await Promise.all([this.setExternalAssets(t)])}async setExternalAssets(e=[]){if(e.length>0){let t=[];t=t.concat(e),t.map(s=>{s.type=s.type||"js",s.type==="js"&&s.module?(s.global?this.externals[s.module]=s.global:o.empConfig.isESM&&(this.useImportMap?(this.externals[s.module]=s.module,this.importMap.imports[s.module]=s.entry):this.externals[s.module]=s.entry),s.entry&&!o.empConfig.isESM&&this.externalAssets.js.push(s.entry)):s.type==="css"&&s.entry&&this.externalAssets.css.push(s.entry)})}}}});var D,$e=l(()=>{"use strict";u();D=class{fastMode={runtimeHost:"",runtimeLib:"",externals:{},globalVal:"EmpShareLib",framework:"react"};externalMF={"@module-federation/runtime":"MFRuntime","@module-federation/sdk":"MFSDK"};externalReact={react:"React","react-dom":"ReactDOM","react-router-dom":"ReactRouterDOM"};externals={};getRuntimeLib(e){return`${e}/runtime${o.mode==="development"?".development":""}.umd.js`}setup(){this.fastMode=o.deepAssign(this.fastMode,o.empConfig.empShare.fastMode),this.injectLib(),this.setExternals()}injectLib(){let{runtimeHost:e,runtimeLib:t}=this.fastMode;if(e||t){let s=t||this.getRuntimeLib(e);o.empConfig.empShareLib.externalAssets.js.push(s)}}setExternals(){for(let[e,t]of Object.entries(this.externalMF))this.externals[e]=`${this.fastMode.globalVal}.${t}`;if(this.fastMode.framework==="react")for(let[e,t]of Object.entries(this.externalReact))this.externals[e]=`${this.fastMode.globalVal}.${t}`;Object.entries(this.fastMode.externals).length>0&&(this.externals=o.deepAssign(this.externals,this.fastMode.externals)),o.empConfig.empShareLib.externals=o.deepAssign(o.empConfig.empShareLib.externals,this.externals)}}});import Me from"url";import je from"chalk";var K,E,Q=l(()=>{"use strict";y();K=class{imf={protocol:"",port:8e3,pathname:"/"};host="0.0.0.0";urls={lanUrlForConfig:"",lanUrlForTerminal:je.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=M;formatUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return Me.format({protocol:t,hostname:e,port:s,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return Me.format({protocol:t,hostname:e,port:je.bold(s),pathname:r})}},E=new K});var Y,R,Z=l(()=>{"use strict";Q();y();u();Y=class{isADB=!1;isHttps=!1;get isHttpBase(){let e=o.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}setup(){if(this.isADB=!!o.empOptions.autoDevBase&&o.mode==="development"&&!this.isHttpBase,!this.isADB)return;let{server:e,https:t}=o.empOptions.server||{};this.isHttps=e==="https"||typeof e=="object"&&e.type==="https"||t===!0;let s=E.getLanIp(),r=this.isHttps?"https":"http",n=o.empOptions.server?.port||8e3;o.empOptions.base=`${r}://${s}:${n}/`,o.empOptions.server=f({port:n,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${s}:${n}/ws`}},o.empOptions.server)}},R=new Y});import De from"html-webpack-plugin";var Le,F,Te,A,$t,B,ee=l(()=>{"use strict";y();u();Le="HtmlImportMapPlugin",F=class{importMap;chunk;constructor(e,t){this.importMap=e,this.chunk=t}apply(e){e.hooks.compilation.tap(Le,t=>{De.getHooks(t).alterAssetTagGroups.tapAsync(Le,(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)})})}},Te="HtmlEmpShareLibPlugin",A=class{chunk;files;constructor(e,t){this.files=f({js:[],css:[]},e),this.chunk=t}apply(e){e.hooks.compilation.tap(Te,t=>{let s=this.files;De.getHooks(t).alterAssetTagGroups.tapAsync(Te,(r,n)=>{if(!r.plugin.userOptions.chunks?.includes(this.chunk))return n(null,r);s.js.map(a=>{r.headTags.push({tagName:"script",attributes:{src:a},voidTag:!1,meta:{plugin:void 0}})}),s.css.map(a=>{r.headTags.push({tagName:"link",attributes:{rel:"stylesheet",href:a},voidTag:!1,meta:{plugin:void 0}})}),n(null,r)})})}},$t=()=>{let i=[`import 'core-js/${o.empConfig.build.coreJsFeatures}'`].join(`
|
|
10
|
+
`);return xe(i)},B=class{constructor(){}apply(e){let{webpack:t}=e;new t.EntryPlugin(e.context,$t(),{name:void 0}).apply(e)}}});var z,Re=l(()=>{"use strict";u();Z();ee();z=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){R.setup(),this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){o.empConfig.build.polyfill==="entry"&&o.chain.plugin("empPolyfill").use(B),this.op.beforePlugin&&await this.op.beforePlugin()}async afterPlugin(){this.op.afterPlugin&&await this.op.afterPlugin()}async beforeModule(){this.op.beforeModule&&await this.op.beforeModule()}async afterModule(){this.op.afterModule&&await this.op.afterModule()}async beforeEmpPlugin(){this.op.beforeEmpPlugin&&await this.op.beforeEmpPlugin()}async afterEmpPlugin(){this.op.afterEmpPlugin&&await this.op.afterEmpPlugin()}async beforeBuild(){this.op.beforeBuild&&await this.op.beforeBuild()}async afterBulid(){this.op.afterBulid&&await this.op.afterBulid()}async beforeDevServe(){this.op.beforeDevServe&&await this.op.beforeDevServe()}async afterDevServe(){this.op.afterDevServe&&await this.op.afterDevServe()}async beforeServe(){this.op.beforeServe&&await this.op.beforeServe()}async afterServe(){this.op.afterServe&&await this.op.afterServe()}}});import Mt from"node:fs";var te,Fe,Ae=l(()=>{"use strict";y();ke();$e();Re();te=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},f(e,t)}empShareFastMode=new D;empShareLib=new T;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 z(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,polyfillInclude:["es.object.values","es.object.entries","es.array.flat"],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:{}},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,n={publicPath:this.store.empConfig.base?this.store.empConfig.base:"auto",crossOriginLoading:"anonymous",filename:`${r}js/[name]${e}.js`,cssFilename:`${r}css/[name]${t}.css`,cssChunkFilename:`${r}css/[name]${t}.css`,assetModuleFilename:`${r}${s}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!0};return this.store.isDev&&this.store.empConfig.empShare.dts!==!1&&(n.clean=!1),this.assign(n,this.store.empOptions.output)}get define(){let e={mode:this.store.mode,env:this.store.cliOptions.env};return this.store.empOptions.define&&(e={...e,...this.store.empOptions.define}),this.setDefine(e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",s={};return Object.keys(e).map(r=>{(t==="all"||t==="esm")&&(s[`import.meta.env.${r}`]=JSON.stringify(e[r])),(t==="all"||t==="cjs")&&(s[`process.env.${r}`]=JSON.stringify(e[r])),s[`${r}`]=JSON.stringify(e[r])}),s}get externals(){return this.assign(this.empShareLib.externals,this.store.empOptions.externals)}get resolve(){return 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(!Mt.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"}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}},Fe=new te});import jt from"fs-extra";var se,Be,ze=l(()=>{"use strict";se=class{store;async setup(e){this.store=e;let t=[this.common(),this.stats(),this.devServer(),this.optimization(),this.checkTsconfig()];await Promise.all(t)}async common(){this.store.merge({node:{global:!0},experiments:{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,ignoreWarnings:this.store.empConfig.ignoreWarnings})}async checkTsconfig(){let e=this.store.resolve("tsconfig.json");if(await jt.exists(e)){let s={tsConfigPath:e};this.store.merge({resolve:s})}}async stats(){this.store.merge({stats:{colors:!0,all:!1,assets:!1,chunks:!1,timings:!0,version:!0}})}async devServer(){this.store.merge({devServer:this.store.empConfig.server})}async optimization(){let e={moduleIds:this.store.empConfig.build.moduleIds,chunkIds:this.store.empConfig.build.chunkIds,minimize:this.store.empConfig.build.minify,splitChunks:{chunks:"async",cacheGroups:{}}};this.store.empConfig.build.polyfill&&(e.splitChunks.cacheGroups={}),this.store.chain.merge({optimization:e})}},Be=new se});var ie,Ie,Ge=l(()=>{"use strict";ie=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"}}}})}},Ie=new ie});import b from"node:path";import He from"fast-glob";import Lt from"html-webpack-plugin";var re,Ue,Ne=l(()=>{"use strict";y();ee();re=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(b.extname(e),"").replace(`${this.store.empConfig.appSrc}${b.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(b.join("template","index.html"))}setFavicion(e){return e?this.store.resolve(e):this.store.empResolve(b.join("template","favicon.ico"))}setEntryItem(e,t,s){s=s||this.store.resolve(b.join(this.store.empConfig.appSrc,e));let r=this.setChunk(e),n=[s];this.entriesConfig[r]={entry:{[r]:n},html:this.setHtmlConfig(t,[r])},this.store.entries[r]=n}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`html-plugin-${t}`).use(Lt,[e]),this.store.empConfig.empShareLib&&(e.files=f(e.files,this.store.empConfig.empShareLib.externalAssets)),this.store.chain.plugin(`html-plugin-empShare-${t}`).use(A,[e.files,t]),this.store.empConfig.empShareLib.useImportMap&&this.store.chain.plugin(`html-plugin-import-map-${t}`).use(F,[this.store.empConfig.empShareLib.importMap,t])}setRspackEntry(e){this.store.merge({entry:e})}async init(){this.store.empConfig.autoPages?await this.setAutoPage():(await this.setDefaultEntry(),this.setEntryByConfig())}async setAutoPage(){let e=this.store.empConfig.autoPages?.path||"pages",t=b.join(this.store.appSrc,e),s=b.join(t,"**","*.{ts,tsx,jsx,js}"),r=await He([s]);r=r.map(n=>n.replace(`${t}${b.sep}`,"")),r.map(n=>{let a=this.store.empConfig.entries[n]||{};this.setEntryItem(n,{...this.store.empConfig.html,...a},b.join(t,n))})}async setDefaultEntry(){let e=b.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}").replace(/\\/g,"/"),t=await He([e]);if(t[0]){let s=b.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])}}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)}},Ue=new re});import Je from"node:path";var oe,_e,We=l(()=>{"use strict";q();y();oe=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 this.store.empConfig.lifeCycle.beforeModule(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterModule()}rspackGenerator(){let e=this.store.isDev?"[path][name]-[local]-[hash:5]":"[local]-[hash:5]";this.store.chain.merge({module:{generator:{css:{localIdentName:e},"css/auto":{localIdentName:e},"css/module":{localIdentName:e}}}})}rspackParser(){this.store.chain.merge({module:{parser:{css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return this.store.empConfig.build.polyfill}swcParser(e){switch(e){case"js":return{syntax:"ecmascript",jsx:!0,decorators:!0,decoratorsBeforeExport:!1};case"ts":return{syntax:"typescript",decorators:!0,tsx:!0,dynamicImport:!0}}}swcJsc(e){let{target:t,externalHelpers:s}=this.store.empConfig.build;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:s,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:f(this.swcJsc(e),{...this.store.empConfig.build.swcConfig}),isModule:"unknown"};return this.isPolyfill&&(delete t.jsc.target,t.env={coreJs:this.swcCoreVersion,targets:this.store.empConfig.build.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill),this.store.empConfig.build.polyfill==="usage"&&(t.env.shippedProposals=!0,t.env.include=this.store.empConfig.build.polyfillInclude)),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build;e&&this.store.chain.resolve.alias.set("@swc/helpers",Je.dirname(L.resolve("@swc/helpers/package.json"))),this.coreJs.path=L.resolve("core-js/package.json");let t=ve(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=Je.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"}}}})}},_e=new oe});import Ve from"fs";import{ModuleFederationPlugin as Tt}from"@module-federation/enhanced/rspack";import k from"@rspack/core";var ne,Xe,qe=l(()=>{"use strict";ne=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");Ve.existsSync(e)&&Ve.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=Tt;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,[{}])}},Xe=new ne});var ae,Ke,Qe=l(()=>{"use strict";ze();Ge();Ne();We();qe();ae=class{store;async setup(e){this.store=e;let t=[Be.setup(this.store),_e.setup(this.store),Xe.setup(this.store),Ue.setup(this.store),Ie.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()}},Ke=new ae});import Dt from"node:fs/promises";import C from"node:path";import{pathToFileURL as Rt}from"node:url";import Ft from"node:util";import At from"webpack-chain";var pe,o,u=l(()=>{"use strict";v();q();y();Ae();Qe();pe=class{empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=Pe;empSource=C.resolve(this.empRoot,"dist");resolve=e=>C.isAbsolute(e)?e:C.resolve(this.root,e);empResolve=e=>C.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};cacheDir="";mode="development";cliMode="dev";isDev=!0;cliOptions;chain;rsConfig;empOptions={};empConfig;vCompare=j;deepAssign=f;getLanIp=M;entries={};debug;async setup(e,t){await this.initVars(e,t),this.empConfig=Fe,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new At,await Ke.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",process.env.NODE_ENV=e==="dev"?"development":"production";let s=await X(this.empResolve("package.json")),r=await X(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=C.join(this.empRoot,"resource"),this.resource.cert=C.join(this.resource.dir,"emp.cert"),this.resource.key=C.join(this.resource.dir,"emp.key")}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),p.setup({pname:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}`,logLevel:e})}merge(e){this.chain.merge(e)}importResolve(e,t){return Oe(e,t)}importFileUrl(e){return Rt(e).toString()}toConfig(){this.rsConfig=this.chain.toConfig()}logConfig(){if(this.debug.showRsconfig)if(typeof this.debug.showRsconfig=="string"){let e=C.join(this.root,this.debug.showRsconfig);Dt.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"?f(e,this.debug.showRsconfig):e;console.log(p.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"]}}},o=new pe});import Bt from"node:fs";import w from"node:path";import d from"chalk";import{gzipSizeSync as zt}from"gzip-size";function _t(i,e){let t=[i,e],s=["File","Size","Gzipped"].reduce((r,n,a)=>{let m=t[a],g=n;return m&&(g=n.length<m?n+" ".repeat(m-n.length):n),`${r+g} `}," ");console.log(d.bold.blue(s))}async function Ye(i){let e=i.toJson({all:!1,assets:!0,timings:!0});$(e.time);let s=e.assets.filter(c=>Ut(c.name)).map(Jt);s.sort((c,P)=>c.size-P.size);let r=Math.max(...s.map(c=>c.sizeLabel.length)),n=Math.max(...s.map(c=>(c.folder+w.sep+c.name).length));_t(n,r);let a=0,m=0;s.forEach(c=>{let{sizeLabel:P}=c,{name:dt,folder:yt,gzipSizeLabel:bt}=c,de=(yt+w.sep+dt).length,ye=P.length;if(a+=c.size,m+=c.gzippedSize,ye<r){let J=" ".repeat(r-ye);P+=J}let be=d.gray(c.folder+w.sep)+Wt(c.name);if(de<n){let J=" ".repeat(n-de);be+=J}p.info(` ${be} ${d.gray(P)} ${bt}`)});let g=`${d.bold.blue("Total size:")} ${I(a)}`,O=`${d.bold.blue("Gzipped size:")} ${I(m)}`;p.info(`
|
|
12
11
|
${g}
|
|
13
12
|
${O}
|
|
14
|
-
`)}function $(
|
|
13
|
+
`)}function $(i=0){p.info(`${d.greenBright("\u2713")} Ready in ${we(Number(i))}`)}var It,Gt,Ht,Ut,Nt,Jt,I,Wt,G=l(()=>{"use strict";u();v();y();It=/\.html$/,Gt=/\.(?:js|mjs|cjs|jsx)$/,Ht=/\.css$/,Ut=i=>!/\.map$/.test(i)&&!/\.LICENSE\.txt$/.test(i),Nt=i=>i>300*1e3?d.red:i>100*1e3?d.yellow:d.white,Jt=i=>{let e=i.name.split("?")[0],t=I(i.size),s=w.basename(e),r=w.join(w.basename(o.empConfig.build.outDir),w.dirname(e)),n=Bt.readFileSync(w.join(o.empConfig.build.outDir,e)),a=n.length,m=zt(n),g=Nt(m)(I(m));return{size:a,folder:r,name:s,gzippedSize:m,sizeLabel:t,gzipSizeLabel:g}};I=i=>{let e=i/1e3;return`${e.toFixed(e<1?2:1)} kB`},Wt=i=>Gt.test(i)?d.yellowBright(i):Ht.test(i)?d.greenBright(i):It.test(i)?d.blueBright(i):d.magenta(i)});import Vt from"net";import Xt from"os";async function et(i,e="localhost"){if(i!==qt&&(i<Ze||i>le))throw new Error(`Port number must lie between ${Ze} and ${le}`);let t=i,s=Kt(),r;e&&!s.has(e)?r=new Set([e]):r=s;let n=new Set(["EADDRINUSE","EACCES"]);for(;t<=le;)try{return await Yt(t,r)}catch(a){if(!n.has(a.code))throw a;t+=1}throw new Error("No available ports found")}var Ze,le,qt,Kt,Qt,Yt,tt=l(()=>{"use strict";Ze=1024,le=65535,qt=443,Kt=()=>{let i=Xt.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},Qt=(i,e)=>new Promise((t,s)=>{let r=Vt.createServer();r.unref(),r.on("error",s),r.listen(i,e,()=>{let{port:n}=r.address();r.close(()=>{t(n)})})}),Yt=async(i,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let s of e)try{await Qt(i,s)}catch(r){if(!t.has(r.code))throw r}return i}});import{exec as Zt}from"node:child_process";import{promisify as es}from"node:util";var it,st,ts,ss,rt,ot=l(()=>{"use strict";u();v();it=es(Zt),st=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],ts=async()=>{let i=process.env.BROWSER;if(!i||!st.includes(i)){let{stdout:e}=await it("ps cax");i=st.find(t=>e.includes(t))}return i},ss=async i=>{if(process.platform==="darwin")try{let t=await ts();if(t){let s=`osascript openChrome.applescript "${encodeURI(i)}" "${t}"`;return await it(s,{cwd:o.resource.dir}),!0}}catch(t){p.debug(t)}try{let{default:t}=await import("open");return await t(i),!0}catch(t){return p.error("Failed to open start URL."),p.error(t),!1}},rt=ss});import nt from"node:fs/promises";import H from"chalk";var x,U=l(()=>{"use strict";tt();Q();v();ot();y();u();Z();x=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=o.rsConfig.output?.publicPath==="auto"?"/":o.rsConfig.output?.publicPath||"/",this.sf.isOpenBrower=!!o.empConfig.server.open,this.sf.protocol=this.isHttps?"https":"http",this.sf.host=o.empConfig.server.host?o.empConfig.server.host:this.sf.host,this.sf.port=o.empConfig.server.port,await this.serverPort(),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?(p.info(`${H.greenBright("\u279C")} Local: ${p.link(e.localUrlForTerminal)}`),p.info(`${H.greenBright("\u279C")} Network: ${p.link(this.sf.publicPath)}`)):(p.info(`${H.greenBright("\u279C")} Local: ${p.link(e.localUrlForTerminal)}`),p.info(`${H.greenBright("\u279C")} Network: ${p.link(e.lanUrlForTerminal)}
|
|
14
|
+
`)),this.sf.isOpenBrower&&rt(this.sf.url)}async setup(e,t){await o.setup(e,t),o.debug.clearLog&&Ce(),p.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}=o.empConfig.server||{};return e==="https"||typeof e=="object"&&e.type==="https"||t===!0}getcert(){return Promise.all([nt.readFile(o.resource.key),nt.readFile(o.resource.cert)])}async serverPort(){if(R.isADB)return;let{port:e,host:t}=this.sf,s=await et(e,t);s!==e&&(this.sf.port=s,o.rsConfig.devServer?.port&&(o.rsConfig.devServer.port=s))}}});var at={};_(at,{default:()=>os});import{rspack as is}from"@rspack/core";import{RspackDevServer as rs}from"@rspack/dev-server";var ce,os,pt=l(()=>{"use strict";G();v();y();U();u();ce=class extends x{get rspackDevConfig(){return f(o.rsConfig,{stats:{all:!1,colors:!0,assets:!1,chunks:!1,entrypoints:!1,timings:!1,version:!1,errors:!0,warnings:!0},devServer:{open:!1,setupExitSignals:!0}})}async devServerConfig(){let e=Object.assign({},o.rsConfig.devServer);if(this.isHttps&&(e.https===!0&&delete e.https,!e.server)){let[t,s]=await this.getcert();e.server={type:"https",options:{key:t,cert:s}}}return e}async run(){let e=is(this.rspackDevConfig);if(!o.rsConfig.devServer){p.error("devServer is not defined in config");return}let t=await this.devServerConfig(),s=new rs(t,e);this.startOpen(),o.empConfig.lifeCycle.beforeDevServe&&await o.empConfig.lifeCycle.beforeDevServe(),await s.start();let r=n=>{let a=n?.toJson({all:!1,colors:!1,assets:!1,chunks:!1,timings:!0});$(a.time)};o.debug.showPerformance&&e.hooks.afterDone.tap("done",r),s.middleware?.waitUntilValid(n=>{o.debug.showPerformance||r(n),o.empConfig.lifeCycle.afterDevServe&&o.empConfig.lifeCycle.afterDevServe()})}},os=new ce});var lt={};_(lt,{default:()=>as});import{rspack as ns}from"@rspack/core";var me,as,ct=l(()=>{"use strict";G();v();U();u();me=class extends x{async run(){o.empConfig.lifeCycle.beforeBuild&&await o.empConfig.lifeCycle.beforeBuild(),ns(o.rsConfig,async(e,t)=>{if(e!==null){p.error(e.stack||e),e.message&&p.error(e.message);return}if(!t){p.red("Stats is Undefined.");return}t.hasErrors()&&(p.error(t.toString({colors:!0,children:!0})),p.red("Failed to compile."),process.exit(1)),t.hasWarnings()&&(p.yellow("Compiled with warnings."),p.warn(t.toString({colors:!0,children:!0}))),await Ye(t),o.empConfig.lifeCycle.afterBulid&&await o.empConfig.lifeCycle.afterBulid()})}},as=new me});import ps from"https";import ls from"compression";import cs from"cors";import ms from"express";var N,mt=l(()=>{"use strict";U();N=class extends x{app;async init(){let e=ms();e.use(ls()),e.use(cs()),this.app=e}async server(){if(this.isHttps){let[e,t]=await this.getcert();ps.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 ht={};_(ht,{default:()=>ds});import hs from"node:fs";import fs from"node:fs/promises";import us from"path";import gs from"express";var he,ds,ft=l(()=>{"use strict";G();v();u();mt();he=class extends N{timing=0;async run(){if(this.timing=Date.now(),!hs.existsSync(o.outDir))return p.sysError(`emp serve must be executed after emp build,${o.outDir} not exist!`);o.empConfig.lifeCycle.beforeServe&&await o.empConfig.lifeCycle.beforeServe(),this.start()}async middleware(){let e=o.resolve(o.rsConfig.output?.path);this.app.use(gs.static(e));let t=await fs.readFile(us.join(e,"index.html"),"utf8");this.app.get("*",(s,r)=>r.send(t))}async onReady(){$(Date.now()-this.timing),o.empConfig.lifeCycle.afterServe&&await o.empConfig.lifeCycle.afterServe()}},ds=new he});v();y();u();import fe,{exit as ys}from"node:process";import{program as S}from"commander";function ut(){let i="20.0.0";j(i,fe.versions.node)===1&&(p.sysError(`\u5F53\u524D\u7248\u672C\u4E3Av${fe.versions.node} \u6700\u4F4E\u8981\u6C42\u4E3Av${i}`),ys(0)),S.version(o.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(()=>(pt(),at));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(()=>(ct(),lt));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(()=>(ft(),ht));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(fe.argv)}u();import gt from"node:fs/promises";import ue from"node:path";import bs from"fast-glob";var vs=/(?:(?:import|export)\s?(?:type)?\s?(?:(?:\{[^;\n]+\})|(?:[^;\n]+))\s?from\s?['"][^;\n]+['"])|(?:import\(['"][^;\n]+?['"]\))/g,Cs=/(?:import|export)\s?(?:type)?\s?\{?.+\}?\s?from\s?['"](.+)['"]/,ws=/import\(['"]([^;\n]+?)['"]\)/,ge=class{list=[];outDir=o.resolve("dist");aliasName="@empjs/cli";async setup(e,t){e&&(this.outDir=e),t&&(this.aliasName=t);let s=await this.readDts();await this.writeCode(s)}async readDts(){this.list=await bs([`${o.empConfig.build.outDir}/**/*.d.ts`]);let e=[];this.list.map(s=>{s=o.resolve(s),e.push(this.readFile(s))});let t=await Promise.all(e);return t=t.map(s=>this.replaceAliasPath(s)),t}async readFile(e){let t=await gt.readFile(e,{encoding:"utf-8"});return{src:e,code:t}}replaceAliasPath({src:e,code:t}){t=t.replace(vs,r=>{let n=r.match(Cs);if(n||(n=r.match(ws)),n&&n[1]){let a=n[1];if(!a.startsWith("."))return r;let m=ue.resolve(ue.dirname(e),a).replace(this.outDir,this.aliasName);return r.replace(n[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
|
|
16
|
+
`}async writeCode(e){let t="";e.map(s=>{t+=s.code}),await gt.writeFile(ue.join(this.outDir.replace("dist","types"),"type.d.ts"),t)}},xs=new ge;u();function so(i){return i}export{so as defineConfig,xs as dts,ut as runScript,o as store};
|
package/dist/script/dev.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { GlobalStore } from '../store';
|
|
2
|
-
import { BuildType, DebugType, EMPShareType, HtmlType, RsTarget, ServerType } from '../types/config';
|
|
3
|
-
import { Output } from '@rspack/core';
|
|
4
|
-
import { EMPShareLib } from '../store/
|
|
1
|
+
import type { GlobalStore } from '../store';
|
|
2
|
+
import type { BuildType, DebugType, EMPShareType, HtmlType, RsTarget, ServerType } from '../types/config';
|
|
3
|
+
import type { Output } from '@rspack/core';
|
|
4
|
+
import { EMPShareLib } from '../store/empShare';
|
|
5
|
+
import { EmpShareFastMode } from '../store/empShare/fastMode';
|
|
5
6
|
import { LifeCycle } from '../store/lifeCycle';
|
|
6
7
|
export declare class EmpConfig {
|
|
7
8
|
private store;
|
|
@@ -25,6 +26,7 @@ export declare class EmpConfig {
|
|
|
25
26
|
base: string;
|
|
26
27
|
target: RsTarget;
|
|
27
28
|
private assign;
|
|
29
|
+
empShareFastMode: EmpShareFastMode;
|
|
28
30
|
empShareLib: EMPShareLib;
|
|
29
31
|
/**
|
|
30
32
|
* 是否启动 esm 模块
|
|
@@ -56,6 +58,10 @@ export declare class EmpConfig {
|
|
|
56
58
|
syncEmpOptions(): Promise<void>;
|
|
57
59
|
get moduleTransformRule(): any;
|
|
58
60
|
get cacheDir(): string;
|
|
61
|
+
get ignoreWarnings(): (RegExp | ((args_0: Error, args_1: import("@rspack/core").Compilation, ...args_2: unknown[]) => boolean))[];
|
|
62
|
+
get autoPages(): {
|
|
63
|
+
path: string;
|
|
64
|
+
} | undefined;
|
|
59
65
|
}
|
|
60
66
|
declare const _default: EmpConfig;
|
|
61
67
|
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EMPShareFastModeType } from '../../types/config';
|
|
2
|
+
export declare class EmpShareFastMode {
|
|
3
|
+
fastMode: Required<EMPShareFastModeType>;
|
|
4
|
+
externalMF: {
|
|
5
|
+
'@module-federation/runtime': string;
|
|
6
|
+
'@module-federation/sdk': string;
|
|
7
|
+
};
|
|
8
|
+
externalReact: {
|
|
9
|
+
react: string;
|
|
10
|
+
'react-dom': string;
|
|
11
|
+
'react-router-dom': string;
|
|
12
|
+
};
|
|
13
|
+
externals: any;
|
|
14
|
+
getRuntimeLib(runtimeHost: string): string;
|
|
15
|
+
setup(): void;
|
|
16
|
+
injectLib(): void;
|
|
17
|
+
setExternals(): void;
|
|
18
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
1
|
+
import type { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
|
|
2
|
+
import type { Configuration } from '@rspack/core';
|
|
3
|
+
import type { EMPShareType } from '../../types/config';
|
|
4
4
|
export type externalAssetsType = {
|
|
5
5
|
js: string[];
|
|
6
6
|
css: string[];
|
|
@@ -17,7 +17,6 @@ export declare class EMPShareLib {
|
|
|
17
17
|
private exp;
|
|
18
18
|
config: EMPShareType;
|
|
19
19
|
importMap: ImportMapType;
|
|
20
|
-
version: EMPShareType['mfVersion'];
|
|
21
20
|
isEmpshare: boolean;
|
|
22
21
|
setup(): Promise<void>;
|
|
23
22
|
/**
|
package/dist/store/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { EMPModeType } from '../types/env';
|
|
2
|
-
import WPChain from 'webpack-chain';
|
|
3
1
|
import type { Configuration as RsConfig, RspackOptions } from '@rspack/core';
|
|
4
|
-
import type { EmpOptions } from '../types/config';
|
|
5
|
-
import { EmpConfig } from '../store/empConfig';
|
|
6
2
|
import { deepAssign } from '../helper/utils';
|
|
3
|
+
import { type EmpConfig } from '../store/empConfig';
|
|
4
|
+
import type { EmpOptions } from '../types/config';
|
|
5
|
+
import type { EMPModeType } from '../types/env';
|
|
6
|
+
import WPChain from 'webpack-chain';
|
|
7
7
|
export declare class GlobalStore {
|
|
8
8
|
/**
|
|
9
9
|
* EMP Version
|
|
@@ -79,6 +79,10 @@ export declare class GlobalStore {
|
|
|
79
79
|
vCompare: (preVersion?: string, lastVersion?: string) => number;
|
|
80
80
|
deepAssign: typeof deepAssign;
|
|
81
81
|
getLanIp: () => string;
|
|
82
|
+
entries: {
|
|
83
|
+
[chunkName: string]: RspackOptions['entry'];
|
|
84
|
+
};
|
|
85
|
+
debug: EmpConfig['debug'];
|
|
82
86
|
setup(mode: string, cliOptions: any): Promise<void>;
|
|
83
87
|
/**
|
|
84
88
|
* 初始化 基础变量
|
|
@@ -5,6 +5,10 @@ export declare class LifeCycle {
|
|
|
5
5
|
afterGetEmpOptions(): Promise<void>;
|
|
6
6
|
beforePlugin(): Promise<void>;
|
|
7
7
|
afterPlugin(): Promise<void>;
|
|
8
|
+
beforeModule(): Promise<void>;
|
|
9
|
+
afterModule(): Promise<void>;
|
|
10
|
+
beforeEmpPlugin(): Promise<void>;
|
|
11
|
+
afterEmpPlugin(): Promise<void>;
|
|
8
12
|
beforeBuild(): Promise<void>;
|
|
9
13
|
afterBulid(): Promise<void>;
|
|
10
14
|
beforeDevServe(): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { RspackOptions } from '@rspack/core';
|
|
1
2
|
import type { GlobalStore } from '../../store';
|
|
2
|
-
import { EmpConfig } from '../empConfig';
|
|
3
|
-
import { RspackOptions } from '@rspack/core';
|
|
3
|
+
import type { EmpConfig } from '../empConfig';
|
|
4
4
|
type EntriesConfigType = {
|
|
5
5
|
[chunk: string]: {
|
|
6
6
|
html: EmpConfig['html'];
|
|
@@ -12,13 +12,27 @@ declare class RspackEntries {
|
|
|
12
12
|
entriesConfig: EntriesConfigType;
|
|
13
13
|
setup(store: GlobalStore): Promise<void>;
|
|
14
14
|
private setHtmlConfig;
|
|
15
|
+
/**
|
|
16
|
+
* chunk name 格式化 去除 后缀
|
|
17
|
+
* @param filename
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
15
20
|
private setChunk;
|
|
16
21
|
private setTemplate;
|
|
17
22
|
private setFavicion;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param filename 文件名
|
|
26
|
+
* @param op html plugin 配置
|
|
27
|
+
* @param absPath 文件 绝对路径
|
|
28
|
+
*/
|
|
18
29
|
private setEntryItem;
|
|
19
30
|
setRspackHtmlPlugin(config: EmpConfig['html'], chunk: string): void;
|
|
20
31
|
setRspackEntry(entry: RspackOptions['entry']): void;
|
|
21
32
|
init(): Promise<void>;
|
|
33
|
+
setAutoPage(): Promise<void>;
|
|
34
|
+
setDefaultEntry(): Promise<void>;
|
|
35
|
+
setEntryByConfig(): void;
|
|
22
36
|
toConfig(): void;
|
|
23
37
|
}
|
|
24
38
|
declare const _default: RspackEntries;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { EMPShareLib } from '
|
|
3
|
-
import {
|
|
1
|
+
import type { Compiler } from '@rspack/core';
|
|
2
|
+
import type { EMPShareLib } from '../../store/empShare';
|
|
3
|
+
import type { HtmlType } from '../../types/config';
|
|
4
4
|
export declare const HtmlImportMapPluginName = "HtmlImportMapPlugin";
|
|
5
5
|
export declare class HtmlImportMapPlugin {
|
|
6
6
|
importMap: EMPShareLib['importMap'];
|
|
7
|
-
|
|
7
|
+
chunk: string;
|
|
8
|
+
constructor(importMap: EMPShareLib['importMap'], chunk: string);
|
|
8
9
|
apply(compiler: any): void;
|
|
9
10
|
}
|
|
10
11
|
export declare const HtmlEmpShareLibPluginName = "HtmlEmpShareLibPlugin";
|
|
11
12
|
export declare class HtmlEmpShareLibPlugin {
|
|
13
|
+
chunk: string;
|
|
12
14
|
files: {
|
|
13
15
|
css: string[];
|
|
14
16
|
js: string[];
|
|
15
17
|
};
|
|
16
|
-
constructor(files: HtmlType['files']);
|
|
18
|
+
constructor(files: HtmlType['files'], chunk: string);
|
|
17
19
|
apply(compiler: any): void;
|
|
18
20
|
}
|
|
19
21
|
export declare class EmpPolyfillPlugin {
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import type { InspectOptions } from 'node:util';
|
|
2
3
|
import type { Configuration as RsConfig } from '@rspack/core';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { EMP3PluginType } from './plugin';
|
|
7
|
-
import { InspectOptions } from 'node:util';
|
|
4
|
+
import type { Externals, HtmlRspackPluginOptions, Output, Resolve, RuleSetRule, SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
|
|
5
|
+
import type { Configuration as devServerConfig } from '@rspack/dev-server';
|
|
6
|
+
import type { ModuleFederationPluginOptions } from '../store/empShare';
|
|
8
7
|
import type { LifeCycle } from '../store/lifeCycle';
|
|
9
|
-
import type
|
|
8
|
+
import type Chain from 'webpack-chain';
|
|
9
|
+
import type { EMP3PluginType } from './plugin';
|
|
10
10
|
export type LoggerType = 'debug' | 'info' | 'warn' | 'error';
|
|
11
11
|
export type DebugType = {
|
|
12
12
|
loggerLevel: LoggerType;
|
|
@@ -100,6 +100,11 @@ export type BuildType = {
|
|
|
100
100
|
* @default false
|
|
101
101
|
*/
|
|
102
102
|
polyfill?: 'entry' | 'usage' | false;
|
|
103
|
+
/**
|
|
104
|
+
* 手动注入兼容代码,避免usage出现分析纰漏问题
|
|
105
|
+
* @default ['es.object.values', 'es.object.entries', 'es.array.flat']
|
|
106
|
+
*/
|
|
107
|
+
polyfillInclude?: string[];
|
|
103
108
|
/**
|
|
104
109
|
* 选择core-js的兼容版本有助于切换适当的代码体积
|
|
105
110
|
* @default stable
|
|
@@ -114,6 +119,15 @@ export type BuildType = {
|
|
|
114
119
|
* 浏览器 兼容版本
|
|
115
120
|
*/
|
|
116
121
|
browserslist: string[];
|
|
122
|
+
/**
|
|
123
|
+
* swc 配置
|
|
124
|
+
*/
|
|
125
|
+
swcConfig: {
|
|
126
|
+
transform?: {
|
|
127
|
+
useDefineForClassFields?: boolean;
|
|
128
|
+
};
|
|
129
|
+
preserveAllComments?: boolean;
|
|
130
|
+
};
|
|
117
131
|
};
|
|
118
132
|
export type JscTarget = 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022';
|
|
119
133
|
export interface HtmlType extends HtmlRspackPluginOptions {
|
|
@@ -167,6 +181,28 @@ export interface ModuleTransform {
|
|
|
167
181
|
*/
|
|
168
182
|
defaultExclude?: boolean;
|
|
169
183
|
}
|
|
184
|
+
export type EMPShareFastModeType = {
|
|
185
|
+
/**
|
|
186
|
+
* 共享库目录 优先读取 runtimeLib
|
|
187
|
+
*/
|
|
188
|
+
runtimeHost?: string;
|
|
189
|
+
/**
|
|
190
|
+
* 共享库全路径
|
|
191
|
+
*/
|
|
192
|
+
runtimeLib?: string;
|
|
193
|
+
/**
|
|
194
|
+
* 额外的库添加
|
|
195
|
+
*/
|
|
196
|
+
externals?: any;
|
|
197
|
+
/**
|
|
198
|
+
* 当为 UMD时 暴露到 window 的全局变量
|
|
199
|
+
*/
|
|
200
|
+
globalVal?: string;
|
|
201
|
+
/**
|
|
202
|
+
* 默认支持React
|
|
203
|
+
*/
|
|
204
|
+
framework?: 'react';
|
|
205
|
+
};
|
|
170
206
|
export type EMPShareType = ModuleFederationPluginOptions & {
|
|
171
207
|
/**
|
|
172
208
|
* emp 基于库共享模块
|
|
@@ -178,10 +214,9 @@ export type EMPShareType = ModuleFederationPluginOptions & {
|
|
|
178
214
|
*/
|
|
179
215
|
useImportMap?: boolean;
|
|
180
216
|
/**
|
|
181
|
-
*
|
|
182
|
-
* @default 1
|
|
217
|
+
* 快速模式
|
|
183
218
|
*/
|
|
184
|
-
|
|
219
|
+
fastMode?: EMPShareFastModeType;
|
|
185
220
|
};
|
|
186
221
|
export type EMPshareLibItemType = {
|
|
187
222
|
[module: string]: {
|
|
@@ -217,6 +252,13 @@ export type ExternalsItemType = {
|
|
|
217
252
|
type?: string;
|
|
218
253
|
};
|
|
219
254
|
export type RsTarget = RsConfig['target'];
|
|
255
|
+
export type AutoPagesType = {
|
|
256
|
+
/**
|
|
257
|
+
* 基于src寻找入口目录
|
|
258
|
+
* @default pages
|
|
259
|
+
*/
|
|
260
|
+
path?: string;
|
|
261
|
+
};
|
|
220
262
|
export type EmpOptions = {
|
|
221
263
|
/**
|
|
222
264
|
* publicPath 根路径 可参考webpack,业务模式默认为 auto
|
|
@@ -233,6 +275,11 @@ export type EmpOptions = {
|
|
|
233
275
|
* 启动后 自动设置 base 为当前 Ip+port的路径如 base = http://127.0.0.1:8080/ 并且固定 ws 方便代理调试
|
|
234
276
|
*/
|
|
235
277
|
autoDevBase?: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* 启动后 进入自动搜寻入口的方式
|
|
280
|
+
* 可以通过 html 或 entries 设置 模版配置
|
|
281
|
+
*/
|
|
282
|
+
autoPages?: boolean | AutoPagesType;
|
|
236
283
|
/**
|
|
237
284
|
* 项目代码路径
|
|
238
285
|
* @default 'src'
|
|
@@ -295,4 +342,9 @@ export type EmpOptions = {
|
|
|
295
342
|
* emp 执行周期
|
|
296
343
|
*/
|
|
297
344
|
lifeCycle?: LifeCycle;
|
|
345
|
+
/**
|
|
346
|
+
* ignoreWarnings
|
|
347
|
+
* @default [/Conflicting order/]
|
|
348
|
+
*/
|
|
349
|
+
ignoreWarnings?: RsConfig['ignoreWarnings'];
|
|
298
350
|
};
|
package/emp-tsconfig.json
CHANGED
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
"types": ["@empjs/cli/client"],
|
|
4
4
|
"plugins": [{ "name": "typescript-plugin-css-modules" }],
|
|
5
5
|
"target": "ESNext",
|
|
6
|
-
"lib": [
|
|
7
|
-
"DOM",
|
|
8
|
-
"DOM.Iterable",
|
|
9
|
-
"ESNext"
|
|
10
|
-
],
|
|
6
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
11
7
|
"allowJs": true,
|
|
12
8
|
"skipLibCheck": true,
|
|
13
9
|
"esModuleInterop": true,
|
|
@@ -23,11 +19,6 @@
|
|
|
23
19
|
"jsx": "preserve",
|
|
24
20
|
"verbatimModuleSyntax": true
|
|
25
21
|
},
|
|
26
|
-
"include": [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"exclude": [
|
|
30
|
-
"dist",
|
|
31
|
-
"nodule_modules"
|
|
32
|
-
]
|
|
33
|
-
}
|
|
22
|
+
"include": ["src"],
|
|
23
|
+
"exclude": ["dist", "nodule_modules"]
|
|
24
|
+
}
|
package/package.json
CHANGED
|
@@ -1,111 +1,96 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
"express": "^4.18.2",
|
|
98
|
-
"fast-glob": "^3.3.1",
|
|
99
|
-
"fs-extra": "^11.2.0",
|
|
100
|
-
"gzip-size": "^7.0.0",
|
|
101
|
-
"html-entities": "^2.5.2",
|
|
102
|
-
"html-webpack-plugin": "^5.6.0",
|
|
103
|
-
"less-loader": "^12.2.0",
|
|
104
|
-
"open": "^10.1.0",
|
|
105
|
-
"sass-loader": "^14.2.0",
|
|
106
|
-
"strip-ansi": "^7.1.0",
|
|
107
|
-
"typescript-plugin-css-modules": "^5.1.0",
|
|
108
|
-
"webpack-bundle-analyzer": "^4.10.2",
|
|
109
|
-
"webpack-chain": "^6.5.1"
|
|
110
|
-
}
|
|
111
|
-
}
|
|
2
|
+
"name": "@empjs/cli",
|
|
3
|
+
"version": "3.0.0-rc.10",
|
|
4
|
+
"description": "emp",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": ["dist", "bin", "resource", "template", "client.d.ts", "emp-tsconfig.json"],
|
|
8
|
+
"maintainers": ["xuhongbin", "ckken", "doerme"],
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/empjs/emp.git",
|
|
12
|
+
"directory": "packages/cli"
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"keywords": ["rspack", "rust", "typescript"],
|
|
18
|
+
"bin": {
|
|
19
|
+
"emp": "./bin/emp.js"
|
|
20
|
+
},
|
|
21
|
+
"main": "dist/index.js",
|
|
22
|
+
"module": "dist/index.js",
|
|
23
|
+
"types": "dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"import": {
|
|
27
|
+
"default": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"require": {
|
|
31
|
+
"default": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"./emp-tsconfig.json": "./emp-tsconfig.json"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"d": "rimraf dist && pnpm run esdev:build",
|
|
39
|
+
"b": "rimraf dist && pnpm run esbuild:build",
|
|
40
|
+
"dev": "rimraf dist && pnpm run /^esdev:.*/",
|
|
41
|
+
"esdev:build": "cross-env ENV=dev node esbuild.js",
|
|
42
|
+
"esdev:tsc": "tsc -w",
|
|
43
|
+
"esdev:tsc-alias": "tsc-alias -w",
|
|
44
|
+
"build": "rimraf dist && pnpm run /^esbuild:.*/",
|
|
45
|
+
"esbuild:build": "cross-env ENV=prod node esbuild.js",
|
|
46
|
+
"esbuild:tsc": "tsc && tsc-alias",
|
|
47
|
+
"dts": "node dts-bundle.js"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=20.0.0"
|
|
51
|
+
},
|
|
52
|
+
"author": "Ken",
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/compression": "^1.7.2",
|
|
55
|
+
"@types/cors": "^2.8.12",
|
|
56
|
+
"@types/default-gateway": "^7.2.1",
|
|
57
|
+
"@types/express": "^4.17.13",
|
|
58
|
+
"@types/fs-extra": "^11.0.4",
|
|
59
|
+
"@types/node": "^20.8.7",
|
|
60
|
+
"@types/watchpack": "^2.4.3",
|
|
61
|
+
"@types/webpack": "^5.28.4",
|
|
62
|
+
"@types/webpack-bundle-analyzer": "^4.6.2",
|
|
63
|
+
"@types/webpack-hot-middleware": "^2.25.9",
|
|
64
|
+
"@types/webpack-sources": "^3.2.2",
|
|
65
|
+
"cross-env": "^7.0.3",
|
|
66
|
+
"esbuild": "^0.19.5",
|
|
67
|
+
"rimraf": "^5.0.5",
|
|
68
|
+
"tsc-alias": "^1.8.8"
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"@module-federation/enhanced": "^0.1.12",
|
|
72
|
+
"@rspack/core": "0.6.4",
|
|
73
|
+
"@rspack/dev-server": "0.6.4",
|
|
74
|
+
"@swc/helpers": "^0.5.11",
|
|
75
|
+
"address": "^2.0.2",
|
|
76
|
+
"ansi-html-community": "^0.0.8",
|
|
77
|
+
"chalk": "^5.3.0",
|
|
78
|
+
"commander": "^11.1.0",
|
|
79
|
+
"compression": "^1.7.4",
|
|
80
|
+
"core-js": "^3.37.0",
|
|
81
|
+
"cors": "^2.8.5",
|
|
82
|
+
"default-gateway": "^7.2.2",
|
|
83
|
+
"express": "^4.18.2",
|
|
84
|
+
"fast-glob": "^3.3.1",
|
|
85
|
+
"fs-extra": "^11.2.0",
|
|
86
|
+
"gzip-size": "^7.0.0",
|
|
87
|
+
"html-webpack-plugin": "^5.6.0",
|
|
88
|
+
"less-loader": "^12.2.0",
|
|
89
|
+
"open": "^10.1.0",
|
|
90
|
+
"sass-loader": "^14.2.0",
|
|
91
|
+
"strip-ansi": "^7.1.0",
|
|
92
|
+
"typescript-plugin-css-modules": "^5.1.0",
|
|
93
|
+
"webpack-bundle-analyzer": "^4.10.2",
|
|
94
|
+
"webpack-chain": "^6.5.1"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/template/favicon.ico
CHANGED
|
Binary file
|