@empjs/cli 3.0.0-rc.26 → 3.0.0-rc.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +17 -0
- package/dist/index.d.cts +691 -0
- package/dist/index.d.ts +691 -15
- package/dist/index.js +16 -16
- package/package.json +8 -19
- package/dist/helper/buildPrint.d.ts +0 -15
- package/dist/helper/getPort.d.ts +0 -6
- package/dist/helper/hmr/client.d.ts +0 -0
- package/dist/helper/hmr/config.d.ts +0 -0
- package/dist/helper/hmr/index.d.ts +0 -0
- package/dist/helper/hmr/overlay.d.ts +0 -0
- package/dist/helper/hmr/process-update.d.ts +0 -1
- package/dist/helper/index.d.ts +0 -4
- package/dist/helper/ipAddress.d.ts +0 -27
- package/dist/helper/logger.d.ts +0 -36
- package/dist/helper/nodePolyfill.d.ts +0 -7
- package/dist/helper/openBrowser.d.ts +0 -2
- package/dist/helper/utils.d.ts +0 -17
- package/dist/script/base.d.ts +0 -26
- package/dist/script/build.d.ts +0 -15
- package/dist/script/bundle.d.ts +0 -6
- package/dist/script/dev.d.ts +0 -9
- package/dist/script/devServer.d.ts +0 -0
- package/dist/script/dts.d.ts +0 -27
- package/dist/script/httpBase.d.ts +0 -10
- package/dist/script/index.d.ts +0 -1
- package/dist/script/serve.d.ts +0 -9
- package/dist/store/cycle/autoDevBase.d.ts +0 -8
- package/dist/store/empConfig.d.ts +0 -65
- package/dist/store/empShare/fastMode.d.ts +0 -18
- package/dist/store/empShare/index.d.ts +0 -30
- package/dist/store/index.d.ts +0 -125
- package/dist/store/lifeCycle.d.ts +0 -18
- package/dist/store/rspack/common.d.ts +0 -12
- package/dist/store/rspack/css.d.ts +0 -10
- package/dist/store/rspack/entries.d.ts +0 -39
- package/dist/store/rspack/hook.d.ts +0 -24
- package/dist/store/rspack/index.d.ts +0 -7
- package/dist/store/rspack/module.d.ts +0 -20
- package/dist/store/rspack/plugin.d.ts +0 -13
- package/dist/types/config.d.ts +0 -356
- package/dist/types/env.d.ts +0 -1
- package/dist/types/plugin.d.ts +0 -6
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)};cyan=e=>{console.log(`${
|
|
3
|
-
`)};magenta=e=>{console.log(`${
|
|
4
|
-
`)};green=e=>{console.log(`${
|
|
5
|
-
`)};yellow=e=>{console.log(`${
|
|
6
|
-
`)};red=e=>{console.log(`${
|
|
7
|
-
`)};sysError=e=>{console.log(`${
|
|
8
|
-
`)};link=e=>
|
|
9
|
-
`)}},
|
|
10
|
-
`);return re(i)},_=class{constructor(){}apply(e){let{webpack:t}=e;new t.EntryPlugin(e.context,Kt(),{name:void 0}).apply(e)}}});var V,Ve=l(()=>{"use strict";u();he();ue();V=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){await B.setup(),this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){o.empConfig.build.polyfill==="entry"&&o.chain.plugin("empPolyfill").use(_),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 Qt from"node:fs";var ge,We,qe=l(()=>{"use strict";h();Ie();Ge();Ve();ge=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},m(e,t)}empShareFastMode=new G;empShareLib=new I;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 V(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:{name:"viewport",content:"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"},keywords:{keywords:""},description:{description:""}};return this.assign({lang:"zh-CN",title:"EMP",inject:"body",minify:!this.store.isDev,scriptLoading:this.isESM?"module":"defer",meta:e,files:{css:[],js:[]},tags:{headTags:[],bodyTags:[]}},this.store.empOptions.html)}get entries(){return this.store.empOptions.entries?this.store.empOptions.entries:{}}get server(){let e={host:"0.0.0.0",port:8e3,open:process.platform==="darwin",hot:!0,watchFiles:["src/**/*.html"],static:[{directory:this.store.publicDir,watch:this.store.isDev}],allowedHosts:["all"],historyApiFallback:!0,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":"X-Requested-With, content-type, Authorization"}};return this.assign(e,this.store.empOptions.server)}get empShare(){return this.assign({name:"",filename:"emp.js",shared:{}},this.store.empOptions.empShare)}get css(){return this.assign({sass:{mode:"modern",api:"modern-compiler"}},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 m({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(!Qt.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}},We=new ge});import Zt from"fs-extra";var de,Xe,Ke=l(()=>{"use strict";de=class{store;async setup(e){this.store=e;let t=[this.common(),this.stats(),this.devServer(),this.optimization(),this.checkTsconfig()];await Promise.all(t)}async common(){this.store.merge({node:{global:!0},experiments:{outputModule:this.store.empConfig.isESM,topLevelAwait:!0},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,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 Zt.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})}},Xe=new de});var ye,Qe,Ze=l(()=>{"use strict";z();ye=class{store;async setup(e){this.store=e;let t=[this.sass(),this.less(),this.css()];await Promise.all(t)}async sass(){let e={},t=this.store.empConfig.css?.sass;t&&t.mode==="modern"&&(e.implementation=t.implementation?t.implementation:E.resolve("sass-embedded"),e.api=t.api,t.sassOptions&&(e.sassOptions=t.sassOptions));let s={loader:E.resolve("sass-loader"),options:e};this.store.chain.merge({module:{rule:{sass:{test:/\.(sass|scss)$/,use:{sassLoader:s},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"}}}})}},Qe=new ye});import v from"node:path";import Yt from"html-webpack-plugin";var be,Ye,et=l(()=>{"use strict";h();h();ue();be=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(v.extname(e),"").replace(`${this.store.empConfig.appSrc}${v.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(v.join("template","index.html"))}setFavicion(e){return e?this.store.resolve(e):this.store.empResolve(v.join("template","favicon.ico"))}setEntryItem(e,t,s){s=s||this.store.resolve(v.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(Yt,[e]),this.store.empConfig.empShareLib&&(e.files=m(e.files,this.store.empConfig.empShareLib.externalAssets)),this.store.chain.plugin(`html-plugin-empShare-${t}`).use(J,[e.files,t]),this.store.empConfig.empShareLib.useImportMap&&this.store.chain.plugin(`html-plugin-import-map-${t}`).use(U,[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=v.join(this.store.appSrc,e),s=v.join(t,"**","*.{ts,tsx,jsx,js}"),r=await P([s],{windowsPathsNoEscape:!0});r=r.map(n=>n.replace(`${t}${v.sep}`,"")),r.map(n=>{let a=this.store.empConfig.entries[n]||{};this.setEntryItem(n,{...this.store.empConfig.html,...a},v.join(t,n))})}async setDefaultEntry(){let e=v.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}"),t=await P([e],{windowsPathsNoEscape:!0});if(t[0]){let s=v.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)}},Ye=new be});import tt from"node:path";var ve,st,it=l(()=>{"use strict";z();h();ve=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:m(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",tt.dirname(E.resolve("@swc/helpers/package.json"))),this.coreJs.path=E.resolve("core-js/package.json");let t=se(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=tt.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:/\.((m|c)?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"}}}})}},st=new ve});import rt from"fs";import{ModuleFederationPlugin as es}from"@module-federation/enhanced/rspack";import F from"@rspack/core";var Ce,ot,nt=l(()=>{"use strict";Ce=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(F.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");rt.existsSync(e)&&rt.readdirSync(e).length>0&&this.store.chain.plugin("copyRspackPlugin").use(F.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve(this.store.empConfig.build.outDir)}]}])}async progress(){this.store.empConfig.debug.progress&&this.store.chain.plugin("progressPlugin").use(F.ProgressPlugin,[{prefix:"EMP"}])}async empShare(){let{isEmpshare:e}=this.store.empConfig.empShareLib;if(!e)return;let t=es;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(F.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]),this.store.chain.optimization.minimizer("minCss").use(F.SwcCssMinimizerRspackPlugin,[{}])}},ot=new Ce});var we,at,pt=l(()=>{"use strict";Ke();Ze();et();it();nt();we=class{store;async setup(e){this.store=e;let t=[Xe.setup(this.store),st.setup(this.store),ot.setup(this.store),Ye.setup(this.store),Qe.setup(this.store)];await Promise.all(t),await this.store.empConfig.lifeCycle.beforeEmpPlugin(),await this.store.empConfig.plugins(),await this.store.empConfig.lifeCycle.afterEmpPlugin(),await this.store.empConfig.chain()}},at=new we});import ts from"node:fs/promises";import C from"node:path";import{pathToFileURL as ss}from"node:url";import is from"node:util";import rs from"webpack-chain";var xe,o,u=l(()=>{"use strict";b();z();h();qe();pt();xe=class{empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=ze;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=R;deepAssign=m;getLanIp=T;entries={};debug;async setup(e,t){await this.initVars(e,t),this.empConfig=We,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new rs,await at.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 ae(this.empResolve("package.json")),r=await ae(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({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}`,brandName:"EMP",logLevel:e})}merge(e){this.chain.merge(e)}importResolve(e,t){return Ne(e,t)}importFileUrl(e){return ss(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);ts.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"?m(e,this.debug.showRsconfig):e;console.log(p.link("[Compile Config]")),console.log(is.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 xe});import os from"node:fs";import w from"node:path";import{gzipSizeSync as ns}from"gzip-size";function hs(i,e){let t=[i,e],s=["File","Size","Gzipped"].reduce((r,n,a)=>{let f=t[a],d=n;return f&&(d=n.length<f?n+" ".repeat(f-n.length):n),`${r+d} `}," ");console.log(S.bold(s))}async function lt(i){let e=i.toJson({all:!1,assets:!0,timings:!0}),s=e.assets.filter(c=>cs(c.name)).map(fs);s.sort((c,M)=>c.size-M.size);let r=Math.max(...s.map(c=>c.sizeLabel.length)),n=Math.max(...s.map(c=>(c.folder+w.sep+c.name).length));hs(n,r);let a=0,f=0;s.forEach(c=>{let{sizeLabel:M}=c,{name:St,folder:Et,gzipSizeLabel:Ot}=c,je=(Et+w.sep+St).length,Le=M.length;if(a+=c.size,f+=c.gzippedSize,Le<r){let Y=" ".repeat(r-Le);M+=Y}let De=D(c.folder+w.sep)+us(c.name);if(je<n){let Y=" ".repeat(n-je);De+=Y}p.info(` ${De} ${D(M)} ${Ot}`)});let d=`${S.bold("Total size:")} ${W(a)}`,$=`${S.bold("Gzipped size:")} ${W(f)}`;p.info(`
|
|
11
|
-
${
|
|
12
|
-
${
|
|
13
|
-
`),
|
|
14
|
-
`)}function
|
|
15
|
-
`)),this.sf.isOpenBrower&&
|
|
1
|
+
var Rt=Object.defineProperty;var c=(i,e)=>()=>(i&&(e=i(i=0)),e);var A=(i,e)=>{for(var t in e)Rt(i,t,{get:e[t],enumerable:!0})};var a=c(()=>{"use strict"});import b from"chalk";var Ft,x,At,Nt,It,ne,B,zt,Gt,j,ae,Ht,pe,L,h,D=c(()=>{"use strict";a();Ft=b.hex("#1abc9c"),x=b.hex("#16a085"),At=b.hex("#2ecc71"),Nt=b.hex("#27ae60"),It=b.hex("#e74c3c"),ne=b.hex("#c0392b"),B=b.hex("#f1c40f"),zt=b.hex("#f39c12"),Gt=b.hex("#3498db"),j=b.hex("#2980b9"),ae=b.hex("#ecf0f1"),Ht=b.hex("#fd79a8"),pe=b.hex("#e84393"),L=b.hex("#7f8c8d"),h={lightGreen:Ft,green:x,lightCyan:At,cyan:Nt,lightRed:It,red:ne,yellow:B,orange:zt,lightBlue:Gt,blue:j,white:ae,lightMagenta:Ht,magenta:pe,gray:L}});var le,l,S=c(()=>{"use strict";a();D();le=class{brandName="";fullName="";logLevel="debug";setup({brandName:e,logLevel:t,fullName:s}){this.brandName=` [${e}] `,this.fullName=` ${s} `,this.fullName=h.green.bold(this.fullName),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.lightBlue(this.brandName)}${h.blue(` ${e} `)}
|
|
2
|
+
`)};cyan=e=>{console.log(`${h.lightCyan(this.brandName)}${h.cyan(` ${e} `)}
|
|
3
|
+
`)};magenta=e=>{console.log(`${h.lightMagenta(this.brandName)}${h.magenta(` ${e} `)}
|
|
4
|
+
`)};green=e=>{console.log(`${h.lightGreen(this.brandName)}${h.green(` ${e} `)}
|
|
5
|
+
`)};yellow=e=>{console.log(`${h.yellow(this.brandName)}${h.orange(` ${e} `)}
|
|
6
|
+
`)};red=e=>{console.log(`${h.lightRed(this.brandName)}${h.red(` ${e} `)}
|
|
7
|
+
`)};sysError=e=>{console.log(`${h.lightRed(" System Error Tips ")}${h.red(` ${e} `)}
|
|
8
|
+
`)};link=e=>h.blue(e);title=e=>{console.log(`${this.fullName}${h.yellow.underline(`${e}`)}
|
|
9
|
+
`)}},l=new le});var he={};A(he,{clearConsole:()=>me,deepAssign:()=>g,ensureArray:()=>Vt,getLanIp:()=>N,getPkgVersion:()=>ce,importJsVm:()=>fe,jsonFilter:()=>Wt,timeFormat:()=>U,vCompare:()=>I});import{ip as Bt}from"address";import Ut from"chalk";import{gateway4sync as Jt}from"default-gateway";import _t from"fs-extra";function me(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function g(i,...e){for(let t of e)for(let s in t){let r=t[s],n=i[s];if(Object(r)==r&&Object(n)===n){i[s]=g(n,r);continue}i[s]=t[s]}return i}var N,ce,Vt,Wt,I,U,fe,C=c(()=>{"use strict";a();N=()=>{let{int:i}=Jt();return Bt(i||"")||"127.0.0.1"},ce=i=>{try{let{version:e}=_t.readJSONSync(i);return e}catch{return}};Vt=i=>Array.isArray(i)?i:[i],Wt=(i={},e=[])=>Object.keys(i).filter(t=>!e.includes(t)).reduce((t,s)=>(t[s]=i[s],t),{}),I=(i="",e="")=>{let t=i.replace("^","").split("."),s=e.replace("^","").split("."),r=Math.max(t.length,s.length),n=0;for(let p=0;p<r;p++){let d=t.length>p?t[p]:0,v=isNaN(Number(d))?d.charCodeAt():Number(d),R=s.length>p?s[p]:0,u=isNaN(Number(R))?R.charCodeAt():Number(R);if(v<u){n=-1;break}else if(v>u){n=1;break}}return n},U=i=>{i=i/1e3;let e=s=>Ut.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`},fe=i=>`data:text/javascript,${i}`});import{readFile as qt}from"fs/promises";import He from"module";import{dirname as Xt}from"path";import ue from"path";import{fileURLToPath as Kt}from"url";var J,Qt,ge,$,Be,Ue,z=c(()=>{"use strict";a();J=Kt(import.meta.url),Qt=Xt(J),ge=async i=>{try{let e=await qt(i);return JSON.parse(e)}catch(e){console.error(e)}},$=He.createRequire(import.meta.url),Be=(i,e)=>{let t=$;return e&&(t=He.createRequire(e)),t.resolve(i)},Ue=ue.resolve(Qt,J).replace(`${ue.sep}dist${ue.sep}index.js`,"")});var Je={};A(Je,{chalk:()=>Zt,color:()=>h,glob:()=>E,logger:()=>l,utils:()=>he});import Zt from"chalk";import{glob as E}from"glob";var G=c(()=>{"use strict";a();D();C();S()});import Yt from"path";import es from"jiti";var _e,Ve,We=c(()=>{"use strict";a();G();y();z();_e=es(J,{esmResolve:!0,requireCache:!1,interopDefault:!0}),Ve=async()=>{let i=Yt.join(o.root,"emp{-,.}config.{ts,js,mjs,cjs,mts,cts}");return(await E([i],{windowsPathsNoEscape:!0})||[])[0]}});var _,qe=c(()=>{"use strict";a();y();_=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 p=r.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=r,n.type="js",t.push(n),n={})}else Array.isArray(r)?r.map(p=>{if(!p)return;if(p.split("?")[0].endsWith(".css"))n.entry=p,n.type="css";else{let v=p.match(this.exp)||[];v.length>0?(n.global=v[1],n.entry=v[2],n.type="js"):(n.global="",n.entry=p,n.type="js")}t.push(n),n={}}):typeof r=="object"&&r.entry&&(n.entry=r.entry,n.global=r.global,n.type=r.type,t.push(n),n={})}await Promise.all([this.setExternalAssets(t)])}async setExternalAssets(e=[]){if(e.length>0){let t=[];t=t.concat(e),t.map(s=>{s.type=s.type||"js",s.type==="js"&&s.module?(s.global?this.externals[s.module]=s.global:o.empConfig.isESM&&(this.useImportMap?(this.externals[s.module]=s.module,this.importMap.imports[s.module]=s.entry):this.externals[s.module]=s.entry),s.entry&&!o.empConfig.isESM&&this.externalAssets.js.push(s.entry)):s.type==="css"&&s.entry&&this.externalAssets.css.push(s.entry)})}}}});var V,Xe=c(()=>{"use strict";a();y();V=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 ts from"net";import ss from"os";async function W(i,e="localhost"){if(i!==is&&(i<Ke||i>de))throw new Error(`Port number must lie between ${Ke} and ${de}`);let t=i,s=rs(),r;e&&!s.has(e)?r=new Set([e]):r=s;let n=new Set(["EADDRINUSE","EACCES"]);for(;t<=de;)try{return await ns(t,r)}catch(p){if(!n.has(p.code))throw p;t+=1}throw new Error("No available ports found")}var Ke,de,is,rs,os,ns,ye=c(()=>{"use strict";a();Ke=1024,de=65535,is=443,rs=()=>{let i=ss.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},os=(i,e)=>new Promise((t,s)=>{let r=ts.createServer();r.unref(),r.on("error",s),r.listen(i,e,()=>{let{port:n}=r.address();r.close(()=>{t(n)})})}),ns=async(i,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let s of e)try{await os(i,s)}catch(r){if(!t.has(r.code))throw r}return i}});import Qe from"url";import as from"chalk";var be,T,ve=c(()=>{"use strict";a();D();C();be=class{imf={protocol:"",port:8e3,pathname:"/"};host="0.0.0.0";urls={lanUrlForConfig:"",lanUrlForTerminal:L("unavailable"),localUrlForTerminal:"",localUrlForBrowser:""};setup(e){e.host&&(this.host=e.host),e.protocol&&(this.imf.protocol=e.protocol),e.pathname&&(this.imf.pathname=e.pathname),e.port&&(this.imf.port=e.port),this.setupUrls()}setupUrls(){let{host:e}=this,t=e==="0.0.0.0"||e==="::",s;if(t){s="localhost";try{this.urls.lanUrlForConfig=this.getLanIp(),this.urls.lanUrlForConfig&&(/^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(this.urls.lanUrlForConfig)?this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig):this.urls.lanUrlForConfig="")}catch{}}else s=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(s),this.urls.localUrlForBrowser=this.formatUrl(s)}getLanIp=N;formatUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return Qe.format({protocol:t,hostname:e,port:s,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:s,pathname:r}=this.imf;return Qe.format({protocol:t,hostname:e,port:as.bold(s),pathname:r})}},T=new be});var Ce,q,we=c(()=>{"use strict";a();ye();ve();C();y();Ce=class{isADB=!1;isHttps=!1;get isHttpBase(){let e=o.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}async setup(){if(this.isADB=!!o.empOptions.autoDevBase&&o.mode==="development"&&!this.isHttpBase,!this.isADB)return;let{server:e,https:t}=o.empOptions.server||{};this.isHttps=e==="https"||typeof e=="object"&&e.type==="https"||t===!0;let s=T.getLanIp(),r=this.isHttps?"https":"http",n=o.empOptions.server?.port||8e3;n=await W(n,s),o.empOptions.base=`${r}://${s}:${n}/`,o.empOptions.server=g({port:n,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${s}:${n}/ws`}},o.empOptions.server)}},q=new Ce});import et from"html-webpack-plugin";var Ze,X,Ye,K,ps,Q,xe=c(()=>{"use strict";a();C();y();Ze="HtmlImportMapPlugin",X=class{importMap;chunk;constructor(e,t){this.importMap=e,this.chunk=t}apply(e){e.hooks.compilation.tap(Ze,t=>{et.getHooks(t).alterAssetTagGroups.tapAsync(Ze,(s,r)=>{if(!s.plugin.userOptions.chunks?.includes(this.chunk))return r(null,s);s.headTags.push({tagName:"script",attributes:{type:"importmap"},innerHTML:`${JSON.stringify(this.importMap,null,2)}`,voidTag:!1,meta:{plugin:void 0}}),r(null,s)})})}},Ye="HtmlEmpShareLibPlugin",K=class{chunk;files;constructor(e,t){this.files=g({js:[],css:[]},e),this.chunk=t}apply(e){e.hooks.compilation.tap(Ye,t=>{let s=this.files;et.getHooks(t).alterAssetTagGroups.tapAsync(Ye,(r,n)=>{if(!r.plugin.userOptions.chunks?.includes(this.chunk))return n(null,r);s.js.map(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}})}),n(null,r)})})}},ps=()=>{let i=[`import 'core-js/${o.empConfig.build.coreJsFeatures}'`].join(`
|
|
10
|
+
`);return fe(i)},Q=class{constructor(){}apply(e){let{webpack:t}=e;new t.EntryPlugin(e.context,ps(),{name:void 0}).apply(e)}}});var Z,tt=c(()=>{"use strict";a();y();we();xe();Z=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){await q.setup(),this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){o.empConfig.build.polyfill==="entry"&&o.chain.plugin("empPolyfill").use(Q),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 ls from"fs";var Se,st,it=c(()=>{"use strict";a();We();C();qe();Xe();tt();Se=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},g(e,t)}empShareFastMode=new V;empShareLib=new _;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:{name:"viewport",content:"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"},keywords:{keywords:""},description:{description:""}};return this.assign({lang:"zh-CN",title:"EMP",inject:"body",minify:!this.store.isDev,scriptLoading:this.isESM?"module":"defer",meta:e,files:{css:[],js:[]},tags:{headTags:[],bodyTags:[]}},this.store.empOptions.html)}get entries(){return this.store.empOptions.entries?this.store.empOptions.entries:{}}get server(){let e={host:"0.0.0.0",port:8e3,open:process.platform==="darwin",hot:!0,watchFiles:["src/**/*.html"],static:[{directory:this.store.publicDir,watch:this.store.isDev}],allowedHosts:["all"],historyApiFallback:!0,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":"X-Requested-With, content-type, Authorization"}};return this.assign(e,this.store.empOptions.server)}get empShare(){return this.assign({name:"",filename:"emp.js",shared:{}},this.store.empOptions.empShare)}get css(){return this.assign({sass:{mode:"modern",api:"modern-compiler"}},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 g({alias:{src:this.store.resolve("src"),"@":this.store.resolve("src")},extensions:["...",".js",".jsx",".mjs",".ts",".tsx",".css",".less",".scss",".sass",".json",".wasm",".vue",".svg",".svga"]},this.store.empOptions.resolve)}async syncEmpOptions(){let e=await Ve();if(!e||!ls.existsSync(e))return;let t=await _e(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}},st=new Se});import cs from"fs-extra";var Ee,rt,ot=c(()=>{"use strict";a();Ee=class{store;async setup(e){this.store=e;let t=[this.common(),this.stats(),this.devServer(),this.optimization(),this.checkTsconfig()];await Promise.all(t)}async common(){this.store.merge({node:{global:!0},experiments:{outputModule:this.store.empConfig.isESM,topLevelAwait:!0},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,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 cs.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})}},rt=new Ee});var Oe,nt,at=c(()=>{"use strict";a();z();Oe=class{store;async setup(e){this.store=e;let t=[this.sass(),this.less(),this.css()];await Promise.all(t)}async sass(){let e={},t=this.store.empConfig.css?.sass;t&&t.mode==="modern"&&(e.implementation=t.implementation?t.implementation:$.resolve("sass-embedded"),e.api=t.api,t.sassOptions&&(e.sassOptions=t.sassOptions));let s={loader:$.resolve("sass-loader"),options:e};this.store.chain.merge({module:{rule:{sass:{test:/\.(sass|scss)$/,use:{sassLoader:s},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"}}}})}},nt=new Oe});import w from"path";import ms from"html-webpack-plugin";var Pe,pt,lt=c(()=>{"use strict";a();G();C();xe();Pe=class{store;entriesConfig={};async setup(e){this.store=e,await this.init(),this.toConfig()}setHtmlConfig(e,t){return e.template=this.setTemplate(e.template),e.favicon=this.setFavicion(e.favicon),e.chunks=t,e.filename=`${t[0]}.html`,this.store.empConfig.base&&(e.publicPath=this.store.empConfig.base),e.tags=e.tags||{},e}setChunk(e){return e.replace(w.extname(e),"").replace(`${this.store.empConfig.appSrc}${w.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(w.join("template","index.html"))}setFavicion(e){return e?this.store.resolve(e):this.store.empResolve(w.join("template","favicon.ico"))}setEntryItem(e,t,s){s=s||this.store.resolve(w.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(ms,[e]),this.store.empConfig.empShareLib&&(e.files=g(e.files,this.store.empConfig.empShareLib.externalAssets)),this.store.chain.plugin(`html-plugin-empShare-${t}`).use(K,[e.files,t]),this.store.empConfig.empShareLib.useImportMap&&this.store.chain.plugin(`html-plugin-import-map-${t}`).use(X,[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=w.join(this.store.appSrc,e),s=w.join(t,"**","*.{ts,tsx,jsx,js}"),r=await E([s],{windowsPathsNoEscape:!0});r=r.map(n=>n.replace(`${t}${w.sep}`,"")),r.map(n=>{let p=this.store.empConfig.entries[n]||{};this.setEntryItem(n,{...this.store.empConfig.html,...p},w.join(t,n))})}async setDefaultEntry(){let e=w.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}"),t=await E([e],{windowsPathsNoEscape:!0});if(t[0]){let s=w.join(this.store.empConfig.appSrc,Object.keys(this.store.empConfig.entries).length>0&&this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index");this.setEntryItem(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)}},pt=new Pe});import ct from"path";var ke,mt,ft=c(()=>{"use strict";a();z();C();ke=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:g(this.swcJsc(e),{...this.store.empConfig.build.swcConfig}),isModule:"unknown"};return this.isPolyfill&&(delete t.jsc.target,t.env={coreJs:this.swcCoreVersion,targets:this.store.empConfig.build.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill),this.store.empConfig.build.polyfill==="usage"&&(t.env.shippedProposals=!0,t.env.include=this.store.empConfig.build.polyfillInclude)),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build;e&&this.store.chain.resolve.alias.set("@swc/helpers",ct.dirname($.resolve("@swc/helpers/package.json"))),this.coreJs.path=$.resolve("core-js/package.json");let t=ce(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=ct.dirname(this.coreJs.path),this.store.empConfig.build.polyfill&&(this.store.chain.resolve.alias.set("core-js",this.coreJs.alias),this.store.chain.module.rule("javascript").exclude.add(/core-js/),this.store.chain.module.rule("typescript").exclude.add(/core-js/)),this.swcTsOptions=this.swcOptions("ts"),this.swcJsOptions=this.swcOptions("js")}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:/\.((m|c)?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"}}}})}},mt=new ke});import ht from"fs";import{ModuleFederationPlugin as fs}from"@module-federation/enhanced/rspack";import H from"@rspack/core";var $e,ut,gt=c(()=>{"use strict";a();$e=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(H.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");ht.existsSync(e)&&ht.readdirSync(e).length>0&&this.store.chain.plugin("copyRspackPlugin").use(H.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve(this.store.empConfig.build.outDir)}]}])}async progress(){this.store.empConfig.debug.progress&&this.store.chain.plugin("progressPlugin").use(H.ProgressPlugin,[{prefix:"EMP"}])}async empShare(){let{isEmpshare:e}=this.store.empConfig.empShareLib;if(!e)return;let t=fs;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(H.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]),this.store.chain.optimization.minimizer("minCss").use(H.SwcCssMinimizerRspackPlugin,[{}])}},ut=new $e});var Me,dt,yt=c(()=>{"use strict";a();ot();at();lt();ft();gt();Me=class{store;async setup(e){this.store=e;let t=[rt.setup(this.store),mt.setup(this.store),ut.setup(this.store),pt.setup(this.store),nt.setup(this.store)];await Promise.all(t),await this.store.empConfig.lifeCycle.beforeEmpPlugin(),await this.store.empConfig.plugins(),await this.store.empConfig.lifeCycle.afterEmpPlugin(),await this.store.empConfig.chain()}},dt=new Me});import hs from"fs/promises";import O from"path";import{pathToFileURL as us}from"url";import gs from"util";import ds from"webpack-chain";var je,o,y=c(()=>{"use strict";a();S();z();C();it();yt();je=class{empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=Ue;empSource=O.resolve(this.empRoot,"dist");resolve=e=>O.isAbsolute(e)?e:O.resolve(this.root,e);empResolve=e=>O.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};cacheDir="";mode="development";cliMode="dev";isDev=!0;cliOptions;chain;rsConfig;empOptions={};empConfig;vCompare=I;deepAssign=g;getLanIp=N;entries={};debug;async setup(e,t){await this.initVars(e,t),this.empConfig=st,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new ds,await dt.setup(this),this.setLogger(),this.toConfig(),this.logConfig()}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 ge(this.empResolve("package.json")),r=await ge(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=O.join(this.empRoot,"resource"),this.resource.cert=O.join(this.resource.dir,"emp.cert"),this.resource.key=O.join(this.resource.dir,"emp.key")}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),l.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}`,brandName:"EMP",logLevel:e})}merge(e){this.chain.merge(e)}importResolve(e,t){return Be(e,t)}importFileUrl(e){return us(e).toString()}toConfig(){this.rsConfig=this.chain.toConfig()}logConfig(){if(this.debug.showRsconfig)if(typeof this.debug.showRsconfig=="string"){let e=O.join(this.root,this.debug.showRsconfig);hs.writeFile(e,JSON.stringify(this.rsConfig,null,2))}else{this.debug.clearLog=!1;let e={colors:!0,depth:null},t=typeof this.debug.showRsconfig=="object"?g(e,this.debug.showRsconfig):e;console.log(l.link("[Compile Config]")),console.log(gs.inspect(this.rsConfig,t))}}get browserslistOptions(){return{default:["chrome >= 87","edge >= 88","firefox >= 78","safari >= 14"],h5:["iOS >= 9","Android >= 4.4","last 2 versions","> 0.2%","not dead"],node:["node >= 20"]}}},o=new je});import ys from"fs";import P from"path";import{gzipSizeSync as bs}from"gzip-size";function Os(i,e){let t=[i,e],s=["File","Size","Gzipped"].reduce((r,n,p)=>{let d=t[p],v=n;return d&&(v=n.length<d?n+" ".repeat(d-n.length):n),`${r+v} `}," ");console.log(j.bold(s))}async function bt(i){let e=i.toJson({all:!1,assets:!0,timings:!0}),s=e.assets.filter(u=>xs(u.name)).map(Es);s.sort((u,F)=>u.size-F.size);let r=Math.max(...s.map(u=>u.sizeLabel.length)),n=Math.max(...s.map(u=>(u.folder+P.sep+u.name).length));Os(n,r);let p=0,d=0;s.forEach(u=>{let{sizeLabel:F}=u,{name:Lt,folder:Dt,gzipSizeLabel:Tt}=u,Ie=(Dt+P.sep+Lt).length,ze=F.length;if(p+=u.size,d+=u.gzippedSize,ze<r){let oe=" ".repeat(r-ze);F+=oe}let Ge=L(u.folder+P.sep)+Ps(u.name);if(Ie<n){let oe=" ".repeat(n-Ie);Ge+=oe}l.info(` ${Ge} ${L(F)} ${Tt}`)});let v=`${j.bold("Total size:")} ${Y(p)}`,R=`${j.bold("Gzipped size:")} ${Y(d)}`;l.info(`
|
|
11
|
+
${v}
|
|
12
|
+
${R}
|
|
13
|
+
`),l.info(`${x("\u2713")} Ready in ${U(Number(e.time))}
|
|
14
|
+
`)}function ee(i=0){l.info(`${x("\u2713")} Ready in ${U(Number(i))}`)}var vs,Cs,ws,xs,Ss,Es,Y,Ps,te=c(()=>{"use strict";a();D();y();S();C();vs=/\.html$/,Cs=/\.(?:js|mjs|cjs|jsx)$/,ws=/\.css$/,xs=i=>!/\.map$/.test(i)&&!/\.LICENSE\.txt$/.test(i),Ss=i=>i>300*1e3?ne:i>100*1e3?B:ae,Es=i=>{let e=i.name.split("?")[0],t=Y(i.size),s=P.basename(e),r=P.join(P.basename(o.empConfig.build.outDir),P.dirname(e)),n=ys.readFileSync(P.join(o.empConfig.build.outDir,e)),p=n.length,d=bs(n),v=Ss(d)(Y(d));return{size:p,folder:r,name:s,gzippedSize:d,sizeLabel:t,gzipSizeLabel:v}};Y=i=>{let e=i/1e3;return`${e.toFixed(e<1?2:1)} kB`},Ps=i=>Cs.test(i)?B(i):ws.test(i)?x(i):vs.test(i)?j(i):pe(i)});import{exec as ks}from"child_process";import{promisify as $s}from"util";var Ct,vt,Ms,js,wt,xt=c(()=>{"use strict";a();y();S();Ct=$s(ks),vt=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],Ms=async()=>{let i=process.env.BROWSER;if(!i||!vt.includes(i)){let{stdout:e}=await Ct("ps cax");i=vt.find(t=>e.includes(t))}return i},js=async i=>{if(process.platform==="darwin")try{let t=await Ms();if(t){let s=`osascript openChrome.applescript "${encodeURI(i)}" "${t}"`;return await Ct(s,{cwd:o.resource.dir}),!0}}catch(t){l.debug(t)}try{let{default:t}=await import("open");return await t(i),!0}catch(t){return l.error("Failed to open start URL."),l.error(t),!1}},wt=js});import St from"fs/promises";var k,se=c(()=>{"use strict";a();D();ye();ve();S();xt();C();y();we();k=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(),T.setup(this.sf),this.sf.publicPath&&(this.sf.publicPath.indexOf("http://")>-1||this.sf.publicPath.indexOf("https://")>-1)?(this.sf.url=this.sf.publicPath,this.sf.publicHasHttp=!0,this.sf.urls.localUrlForTerminal=T.prettyPrintUrl("localhost")):(this.sf.urls=T.urls,this.sf.url=this.sf.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this.sf;this.sf.publicHasHttp?(l.info(`${x("\u279C")} Local: ${l.link(e.localUrlForTerminal)}`),l.info(`${x("\u279C")} Network: ${l.link(this.sf.publicPath)}`)):(l.info(`${x("\u279C")} Local: ${l.link(e.localUrlForTerminal)}`),l.info(`${x("\u279C")} Network: ${l.link(e.lanUrlForTerminal)}
|
|
15
|
+
`)),this.sf.isOpenBrower&&wt(this.sf.url)}async setup(e,t){await o.setup(e,t),o.debug.clearLog&&me(),l.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(q.isADB)return;let{port:e,host:t}=this.sf,s=await W(e,t);s!==e&&(this.sf.port=s,o.rsConfig.devServer?.port&&(o.rsConfig.devServer.port=s))}}});var Et={};A(Et,{default:()=>Ts});import{rspack as Ls}from"@rspack/core";import{RspackDevServer as Ds}from"@rspack/dev-server";var Le,Ts,Ot=c(()=>{"use strict";a();te();S();C();se();y();Le=class extends k{get rspackDevConfig(){return g(o.rsConfig,{stats:{all:!1,colors:!0,assets:!1,chunks:!1,entrypoints:!1,timings:!1,version:!1,errors:!0,warnings:!0},devServer:{open:!1,setupExitSignals:!0}})}async devServerConfig(){let e=Object.assign({},o.rsConfig.devServer);if(this.isHttps&&(e.https===!0&&delete e.https,!e.server)){let[t,s]=await this.getcert();e.server={type:"https",options:{key:t,cert:s}}}return e}async run(){let e=Ls(this.rspackDevConfig);if(!o.rsConfig.devServer){l.error("devServer is not defined in config");return}let t=await this.devServerConfig(),s=new Ds(t,e);this.startOpen(),o.empConfig.lifeCycle.beforeDevServe&&await o.empConfig.lifeCycle.beforeDevServe(),await s.start();let r=n=>{let p=n?.toJson({all:!1,colors:!1,assets:!1,chunks:!1,timings:!0});ee(p.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()})}},Ts=new Le});import Rs from"https";import Fs from"compression";import As from"cors";import Ns from"express";var ie,Pt=c(()=>{"use strict";a();se();ie=class extends k{app;async init(){let e=Ns();e.use(Fs()),e.use(As()),this.app=e}async server(){if(this.isHttps){let[e,t]=await this.getcert();Rs.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 De={};A(De,{ServeScript:()=>re,default:()=>Bs});import Is from"fs";import zs from"fs/promises";import Gs from"path";import Hs from"express";var re,Bs,Te=c(()=>{"use strict";a();te();S();y();Pt();re=class extends ie{timing=0;async run(){if(this.timing=Date.now(),!Is.existsSync(o.outDir))return l.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(Hs.static(e));let t=await zs.readFile(Gs.join(e,"index.html"),"utf8");this.app.get("*",(s,r)=>r.send(t))}async onReady(){ee(Date.now()-this.timing),o.empConfig.lifeCycle.afterServe&&await o.empConfig.lifeCycle.afterServe()}},Bs=new re});var kt={};A(kt,{default:()=>Js});import{rspack as Us}from"@rspack/core";var Re,Js,$t=c(()=>{"use strict";a();te();S();se();y();Re=class extends k{isWatchMode=!1;rspackConfig;isuseServe=!1;isStartServe=!1;watchMode(){this.isWatchMode&&this.rspackConfig.optimization&&(this.rspackConfig.optimization.moduleIds="named",this.rspackConfig.optimization.chunkIds="named",this.rspackConfig.watch=!0)}async startServe(){if(!this.isuseServe||this.isStartServe)return;this.isStartServe=!0;let{default:e}=await Promise.resolve().then(()=>(Te(),De));await e.setup("serve",o.cliOptions)}async run(){o.empConfig.lifeCycle.beforeBuild&&await o.empConfig.lifeCycle.beforeBuild(),this.isWatchMode=!!o.cliOptions.watch,this.isuseServe=!!o.cliOptions.serve,this.rspackConfig=o.rsConfig,this.isWatchMode&&this.watchMode(),Us(this.rspackConfig,async(e,t)=>{if(e!==null){l.error(e.stack||e),e.message&&l.error(e.message);return}if(!t){l.red("Stats is Undefined.");return}t.hasErrors()&&(l.error(t.toString({all:!1,colors:!0,errors:!0})),l.red("Failed to compile."),process.exit(1)),t.hasWarnings()&&(l.yellow("Compiled with warnings."),l.warn(t.toString({all:!1,chunks:!1,assets:!1,colors:!0,errors:!0,warnings:!0}))),await bt(t),this.startServe(),o.empConfig.lifeCycle.afterBulid&&await o.empConfig.lifeCycle.afterBulid()})}},Js=new Re});a();import{rspack as wn}from"@rspack/core";import Sn from"html-webpack-plugin";a();S();C();y();import Fe,{exit as _s}from"process";import{program as M}from"commander";function Mt(){let i="20.0.0";I(i,Fe.versions.node)===1&&(l.sysError(`\u5F53\u524D\u7248\u672C\u4E3Av${Fe.versions.node} \u6700\u4F4E\u8981\u6C42\u4E3Av${i}`),_s(0)),M.version(o.empPkg.version,"-v, --version").usage("<command> [options]"),M.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(),Et));await t.setup("dev",e)}),M.command("build").description("Build \u6A21\u5F0F").option("-e, --env <env>","\u90E8\u7F72\u73AF\u5883 dev\u3001test\u3001prod").option("-a, --analyze","\u751F\u6210\u5206\u6790\u62A5\u544A \u9ED8\u8BA4\u4E3A false").option("-t, --ts","\u751F\u6210\u7C7B\u578B\u6587\u4EF6 \u9ED8\u8BA4\u4E3A false").option("-pr, --profile","\u7EDF\u8BA1\u6A21\u5757\u6D88\u8017").option("-cl, --clearLog <clearLog>","\u6E05\u7A7A\u65E5\u5FD7 \u9ED8\u8BA4\u4E3A true").option("-w, --watch","watch \u6A21\u5F0F").option("-sv, --serve","watch \u6A21\u5F0F\u4E0B\u542F\u52A8serve").option("-ev, --env-vars <key=value>","\u5B9A\u4E49\u4E00\u4E2A\u73AF\u5883\u53D8\u91CF -ev key=value \u591A\u4E2A\u73AF\u5883\u53D8\u91CF\u91CD\u590D\u8C03\u7528 -ev key=value -ev key=value",(e,t)=>{let[s,r]=e.split("=");return t[s]=r,t},{}).action(async e=>{let{default:t}=await Promise.resolve().then(()=>($t(),kt));await t.setup("build",e)}),M.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(()=>(Te(),De));await t.setup("serve",e)}),M.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=>{}),M.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=>{}),M.parse(Fe.argv)}a();G();y();import jt from"fs/promises";import Ae from"path";var Vs=/(?:(?:import|export)\s?(?:type)?\s?(?:(?:\{[^;\n]+\})|(?:[^;\n]+))\s?from\s?['"][^;\n]+['"])|(?:import\(['"][^;\n]+?['"]\))/g,Ws=/(?:import|export)\s?(?:type)?\s?\{?.+\}?\s?from\s?['"](.+)['"]/,qs=/import\(['"]([^;\n]+?)['"]\)/,Ne=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 E([`${o.empConfig.build.outDir}/**/*.d.ts`],{windowsPathsNoEscape:!0});let e=[];this.list.map(s=>{s=o.resolve(s),e.push(this.readFile(s))});let t=await Promise.all(e);return t=t.map(s=>this.replaceAliasPath(s)),t}async readFile(e){let t=await jt.readFile(e,{encoding:"utf-8"});return{src:e,code:t}}replaceAliasPath({src:e,code:t}){t=t.replace(Vs,r=>{let n=r.match(Ws);if(n||(n=r.match(qs)),n&&n[1]){let p=n[1];if(!p.startsWith("."))return r;let d=Ae.resolve(Ae.dirname(e),p).replace(this.outDir,this.aliasName);return r.replace(n[1],d)}return r});let s=e.replace(this.outDir,this.aliasName).replace(".d.ts","");return s.endsWith("/index")&&(s=s.replace("/index","")),t=this.warpDeclareModule(s,t),{code:t,src:e,mod:s}}warpDeclareModule(e,t){return`declare module '${e}' {\r
|
|
16
16
|
${t}}\r
|
|
17
|
-
`}async writeCode(e){let t="";e.map(s=>{t+=s.code}),await
|
|
17
|
+
`}async writeCode(e){let t="";e.map(s=>{t+=s.code}),await jt.writeFile(Ae.join(this.outDir.replace("dist","types"),"type.d.ts"),t)}},Xs=new Ne;y();G();function kn(i){return i}export{Sn as HtmlWebpackPlugin,kn as defineConfig,Xs as dts,Je as empHelper,wn as rspack,Mt as runScript,o as store};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empjs/cli",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.28",
|
|
4
4
|
"description": "emp",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"emp": "./bin/emp.js"
|
|
20
20
|
},
|
|
21
21
|
"main": "dist/index.js",
|
|
22
|
-
"module": "dist/index.js",
|
|
23
22
|
"types": "dist/index.d.ts",
|
|
24
23
|
"exports": {
|
|
25
24
|
".": {
|
|
@@ -28,26 +27,18 @@
|
|
|
28
27
|
"types": "./dist/index.d.ts"
|
|
29
28
|
},
|
|
30
29
|
"require": {
|
|
31
|
-
"default": "./dist/index.
|
|
32
|
-
"types": "./dist/index.d.
|
|
30
|
+
"default": "./dist/index.cjs",
|
|
31
|
+
"types": "./dist/index.d.cts"
|
|
33
32
|
}
|
|
34
33
|
},
|
|
35
34
|
"./emp-tsconfig.json": "./emp-tsconfig.json"
|
|
36
35
|
},
|
|
37
36
|
"scripts": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
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"
|
|
37
|
+
"dev": "tsup --watch --env.ENV dev",
|
|
38
|
+
"build": "tsup --env.ENV prod"
|
|
48
39
|
},
|
|
49
40
|
"engines": {
|
|
50
|
-
"node": ">=
|
|
41
|
+
"node": ">=18.0.0"
|
|
51
42
|
},
|
|
52
43
|
"author": "Ken",
|
|
53
44
|
"devDependencies": {
|
|
@@ -63,10 +54,7 @@
|
|
|
63
54
|
"@types/webpack-bundle-analyzer": "^4.6.2",
|
|
64
55
|
"@types/webpack-hot-middleware": "^2.25.9",
|
|
65
56
|
"@types/webpack-sources": "^3.2.2",
|
|
66
|
-
"
|
|
67
|
-
"esbuild": "^0.19.5",
|
|
68
|
-
"rimraf": "^5.0.5",
|
|
69
|
-
"tsc-alias": "^1.8.8"
|
|
57
|
+
"tsup": "^8.0.2"
|
|
70
58
|
},
|
|
71
59
|
"dependencies": {
|
|
72
60
|
"@module-federation/enhanced": "^0.1.15",
|
|
@@ -86,6 +74,7 @@
|
|
|
86
74
|
"glob": "^10.3.15",
|
|
87
75
|
"gzip-size": "^7.0.0",
|
|
88
76
|
"html-webpack-plugin": "^5.6.0",
|
|
77
|
+
"jiti": "^1.21.0",
|
|
89
78
|
"less-loader": "^12.2.0",
|
|
90
79
|
"open": "^10.1.0",
|
|
91
80
|
"sass-embedded": "^1.77.2",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Stats } from '@rspack/core';
|
|
2
|
-
export declare const HTML_REGEX: RegExp;
|
|
3
|
-
export declare const JS_REGEX: RegExp;
|
|
4
|
-
export declare const TS_REGEX: RegExp;
|
|
5
|
-
export declare const SCRIPT_REGEX: RegExp;
|
|
6
|
-
export declare const TS_AND_JSX_REGEX: RegExp;
|
|
7
|
-
export declare const SVG_REGEX: RegExp;
|
|
8
|
-
export declare const CSS_REGEX: RegExp;
|
|
9
|
-
export declare const LESS_REGEX: RegExp;
|
|
10
|
-
export declare const SASS_REGEX: RegExp;
|
|
11
|
-
export declare const CSS_MODULES_REGEX: RegExp;
|
|
12
|
-
export declare const NODE_MODULES_REGEX: RegExp;
|
|
13
|
-
export declare const filterAsset: (asset: string) => boolean;
|
|
14
|
-
export declare function printFileSizes(stats: Stats): Promise<void>;
|
|
15
|
-
export declare function timeDone(mis?: number | string): void;
|
package/dist/helper/getPort.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function (hash: any, moduleMap: any, options: any): void;
|
package/dist/helper/index.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
type IpAdressOpt = {
|
|
2
|
-
protocol?: string;
|
|
3
|
-
port?: number;
|
|
4
|
-
pathname?: string;
|
|
5
|
-
host?: string;
|
|
6
|
-
};
|
|
7
|
-
declare class IpAdress {
|
|
8
|
-
imf: {
|
|
9
|
-
protocol: string;
|
|
10
|
-
port: number;
|
|
11
|
-
pathname: string;
|
|
12
|
-
};
|
|
13
|
-
host: string;
|
|
14
|
-
urls: {
|
|
15
|
-
lanUrlForConfig: string;
|
|
16
|
-
lanUrlForTerminal: string;
|
|
17
|
-
localUrlForTerminal: string;
|
|
18
|
-
localUrlForBrowser: string;
|
|
19
|
-
};
|
|
20
|
-
setup(o: IpAdressOpt): void;
|
|
21
|
-
private setupUrls;
|
|
22
|
-
getLanIp: () => string;
|
|
23
|
-
formatUrl(hostname: string): string;
|
|
24
|
-
prettyPrintUrl(hostname: string): string;
|
|
25
|
-
}
|
|
26
|
-
declare const _default: IpAdress;
|
|
27
|
-
export default _default;
|
package/dist/helper/logger.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export type LoggerType = 'debug' | 'info' | 'warn' | 'error';
|
|
2
|
-
export declare const lightGreen: import("chalk").ChalkInstance;
|
|
3
|
-
export declare const green: import("chalk").ChalkInstance;
|
|
4
|
-
export declare const lightCyan: import("chalk").ChalkInstance;
|
|
5
|
-
export declare const cyan: import("chalk").ChalkInstance;
|
|
6
|
-
export declare const lightRed: import("chalk").ChalkInstance;
|
|
7
|
-
export declare const red: import("chalk").ChalkInstance;
|
|
8
|
-
export declare const yellow: import("chalk").ChalkInstance;
|
|
9
|
-
export declare const orange: import("chalk").ChalkInstance;
|
|
10
|
-
export declare const lightBlue: import("chalk").ChalkInstance;
|
|
11
|
-
export declare const blue: import("chalk").ChalkInstance;
|
|
12
|
-
export declare const white: import("chalk").ChalkInstance;
|
|
13
|
-
export declare const lightMagenta: import("chalk").ChalkInstance;
|
|
14
|
-
export declare const magenta: import("chalk").ChalkInstance;
|
|
15
|
-
export declare const gray: import("chalk").ChalkInstance;
|
|
16
|
-
declare class Logger {
|
|
17
|
-
brandName: string;
|
|
18
|
-
fullName: string;
|
|
19
|
-
logLevel: string;
|
|
20
|
-
setup({ brandName, logLevel, fullName }: any): void;
|
|
21
|
-
debug: (...args: any[]) => false | void;
|
|
22
|
-
info: (...args: any[]) => false | void;
|
|
23
|
-
warn: (...args: any[]) => false | void;
|
|
24
|
-
error: (...args: any[]) => false | void;
|
|
25
|
-
blue: (msg: string) => void;
|
|
26
|
-
cyan: (msg: string) => void;
|
|
27
|
-
magenta: (msg: string) => void;
|
|
28
|
-
green: (msg: string) => void;
|
|
29
|
-
yellow: (msg: string) => void;
|
|
30
|
-
red: (msg: string) => void;
|
|
31
|
-
sysError: (msg: string) => void;
|
|
32
|
-
link: (msg: string) => string;
|
|
33
|
-
title: (msg: string) => void;
|
|
34
|
-
}
|
|
35
|
-
declare const _default: Logger;
|
|
36
|
-
export default _default;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export declare const __filename: string;
|
|
3
|
-
export declare const __dirname: string;
|
|
4
|
-
export declare const getFileJson: (url: string) => Promise<any>;
|
|
5
|
-
export declare const require: NodeRequire;
|
|
6
|
-
export declare const importResolve: (scope: string, importMetaUrl?: string) => string;
|
|
7
|
-
export declare const empRoot: string;
|
package/dist/helper/utils.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { glob } from 'glob';
|
|
2
|
-
export { glob };
|
|
3
|
-
export declare const getLanIp: () => string;
|
|
4
|
-
export declare const getPkgVersion: (pkgPath: string) => any;
|
|
5
|
-
export declare function clearConsole(): void;
|
|
6
|
-
export declare function deepAssign<T>(target: any, ...sources: any): T;
|
|
7
|
-
export declare const ensureArray: <T>(params: T | T[]) => T[];
|
|
8
|
-
/**
|
|
9
|
-
* json Filter
|
|
10
|
-
* @param d
|
|
11
|
-
* @param keys
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
export declare const jsonFilter: (d?: any, notIncludeKeys?: string[]) => any;
|
|
15
|
-
export declare const vCompare: (preVersion?: string, lastVersion?: string) => number;
|
|
16
|
-
export declare const timeFormat: (seconds: number) => string;
|
|
17
|
-
export declare const importJsVm: (content: string) => string;
|
package/dist/script/base.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export declare class BaseScript {
|
|
3
|
-
sf: {
|
|
4
|
-
protocol: string;
|
|
5
|
-
host: string;
|
|
6
|
-
port: number;
|
|
7
|
-
publicPath: string;
|
|
8
|
-
publicHasHttp: boolean;
|
|
9
|
-
isOpenBrower: boolean;
|
|
10
|
-
url: string;
|
|
11
|
-
urls: {
|
|
12
|
-
localUrlForBrowser: string;
|
|
13
|
-
localUrlForTerminal: string;
|
|
14
|
-
lanUrlForTerminal: string;
|
|
15
|
-
lanUrlForConfig: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
adaptServer(): Promise<void>;
|
|
19
|
-
startOpen(): void;
|
|
20
|
-
setup(cliName: string, o: any): Promise<void>;
|
|
21
|
-
run(): Promise<void>;
|
|
22
|
-
afterRun(): void;
|
|
23
|
-
get isHttps(): boolean;
|
|
24
|
-
getcert(): Promise<[Buffer, Buffer]>;
|
|
25
|
-
serverPort(): Promise<void>;
|
|
26
|
-
}
|
package/dist/script/build.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseScript } from '../script/base';
|
|
2
|
-
declare class BuildScript extends BaseScript {
|
|
3
|
-
private isWatchMode;
|
|
4
|
-
private rspackConfig;
|
|
5
|
-
private isuseServe;
|
|
6
|
-
private isStartServe;
|
|
7
|
-
/**
|
|
8
|
-
* 解决 watch mode 报错问题
|
|
9
|
-
*/
|
|
10
|
-
private watchMode;
|
|
11
|
-
private startServe;
|
|
12
|
-
run(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
declare const _default: BuildScript;
|
|
15
|
-
export default _default;
|
package/dist/script/bundle.d.ts
DELETED
package/dist/script/dev.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type RspackOptions } from '@rspack/core';
|
|
2
|
-
import { BaseScript } from '../script/base';
|
|
3
|
-
declare class DevScript extends BaseScript {
|
|
4
|
-
get rspackDevConfig(): RspackOptions;
|
|
5
|
-
devServerConfig(): Promise<import("@rspack/core").DevServer>;
|
|
6
|
-
run(): Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
declare const _default: DevScript;
|
|
9
|
-
export default _default;
|
|
File without changes
|
package/dist/script/dts.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
declare class DTSBundle {
|
|
2
|
-
list: string[];
|
|
3
|
-
outDir: string;
|
|
4
|
-
aliasName: string;
|
|
5
|
-
setup(outDir: string, aliasName: string): Promise<void>;
|
|
6
|
-
readDts(): Promise<any[]>;
|
|
7
|
-
readFile(src: string): Promise<{
|
|
8
|
-
src: string;
|
|
9
|
-
code: string;
|
|
10
|
-
}>;
|
|
11
|
-
replaceAliasPath({ src, code }: {
|
|
12
|
-
src: string;
|
|
13
|
-
code: string;
|
|
14
|
-
}): {
|
|
15
|
-
code: string;
|
|
16
|
-
src: string;
|
|
17
|
-
mod: string;
|
|
18
|
-
};
|
|
19
|
-
warpDeclareModule(mod: string, code: string): string;
|
|
20
|
-
writeCode(bs: {
|
|
21
|
-
src: string;
|
|
22
|
-
code: string;
|
|
23
|
-
mod: string;
|
|
24
|
-
}[]): Promise<void>;
|
|
25
|
-
}
|
|
26
|
-
declare const _default: DTSBundle;
|
|
27
|
-
export default _default;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type Express } from 'express';
|
|
2
|
-
import { BaseScript } from '../script/base';
|
|
3
|
-
export declare class HttpServer extends BaseScript {
|
|
4
|
-
app: Express;
|
|
5
|
-
init(): Promise<void>;
|
|
6
|
-
server(): Promise<void>;
|
|
7
|
-
onReady(): Promise<void>;
|
|
8
|
-
middleware(): Promise<void>;
|
|
9
|
-
start(): Promise<void>;
|
|
10
|
-
}
|
package/dist/script/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function runScript(): void;
|
package/dist/script/serve.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { HttpServer } from './httpBase';
|
|
2
|
-
export declare class ServeScript extends HttpServer {
|
|
3
|
-
timing: number;
|
|
4
|
-
run(): Promise<void>;
|
|
5
|
-
middleware(): Promise<void>;
|
|
6
|
-
onReady(): Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
declare const _default: ServeScript;
|
|
9
|
-
export default _default;
|