@empjs/cli 3.10.8-1 → 3.10.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Di=Object.create;var ue=Object.defineProperty;var Ti=Object.getOwnPropertyDescriptor;var Ri=Object.getOwnPropertyNames;var ji=Object.getPrototypeOf,Ai=Object.prototype.hasOwnProperty;var w=(s,e)=>()=>(s&&(e=s(s=0)),e);var X=(s,e)=>{for(var t in e)ue(s,t,{get:e[t],enumerable:!0})},Lt=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ri(e))!Ai.call(s,r)&&r!==t&&ue(s,r,{get:()=>e[r],enumerable:!(i=Ti(e,r))||i.enumerable});return s};var d=(s,e,t)=>(t=s!=null?Di(ji(s)):{},Lt(e||!s||!s.__esModule?ue(t,"default",{value:s,enumerable:!0}):t,s)),Ni=s=>Lt(ue({},"__esModule",{value:!0}),s);var p=w(()=>{"use strict"});var me,ze=w(()=>{me={name:"@empjs/cli",version:"3.10.8-1",description:"emp",license:"MIT",type:"module",files:["dist","bin","resource","template","types","tsconfig"],maintainers:["xuhongbin","ckken","doerme"],repository:{type:"git",url:"git+https://github.com/empjs/emp.git",directory:"packages/cli"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},keywords:["rspack","rust","typescript"],bin:{emp:"./bin/emp.js"},main:"dist/index.js",types:"dist/index.d.ts",exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.js"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}},"./emp-tsconfig.json":{default:"./tsconfig/react.json"},"./tsconfig/base":{default:"./tsconfig/base.json"},"./tsconfig/react":{default:"./tsconfig/react.json"},"./tsconfig/vue":{default:"./tsconfig/vue.json"},"./client":{types:"./types/react/index.d.ts",default:"./types/react/index.d.ts"},"./types/base":{types:"./types/base/index.d.ts",default:"./types/base/index.d.ts"},"./types/vue":{types:"./types/vue/index.d.ts",default:"./types/vue/index.d.ts"},"./types/react":{types:"./types/react/index.d.ts",default:"./types/react/index.d.ts"}},scripts:{dev:"tsup --watch --env.ENV dev",build:"tsup --env.ENV prod","dev-rs":"rslib build --watch --env-mode development","build-rs":"rslib build --env-mode production",ph:"pnpm publish --no-git-checks"},engines:{node:">=18.0.0"},author:"Ken",devDependencies:{"@types/compression":"^1.7.2","@types/connect":"^3.4.38","@types/cors":"^2.8.12","@types/default-gateway":"^7.2.1","@types/fs-extra":"^11.0.4","@types/react":"^18.3.2","@types/serve-static":"^1.15.8","@types/watchpack":"^2.4.3","@types/webpack":"^5.28.4","@types/webpack-bundle-analyzer":"^4.6.2","@types/webpack-sources":"^3.2.2",chokidar:"^4.0.3",vue:"^3.5.21"},dependencies:{"@empjs/chain":"workspace:*","@rsdoctor/rspack-plugin":"1.3.16","@rspack/core":"1.6.8","@rspack/dev-server":"1.1.4","@swc/helpers":"^0.5.17","@vue/tsconfig":"^0.8.1",address:"^2.0.2",chalk:"^5.3.0",commander:"11.1.0",compression:"1.8.1",connect:"3.7.0","core-js":"^3.41.0",cors:"2.8.5","default-gateway":"7.2.2","fs-extra":"11.3.1",glob:"11.0.3","gzip-size":"7.0.0","html-webpack-plugin":"5.6.4",jiti:"2.6.1","less-loader":"^12.2.0",open:"10.2.0","sass-embedded":"1.93.2","sass-loader":"16.0.5","serve-static":"2.2.0","ts-checker-rspack-plugin":"1.1.6","typescript-plugin-css-modules":"5.2.0","webpack-bundle-analyzer":"4.10.2"}}});function Wt(s,e={}){let t=e.entryType||e.type;if(t==="both"&&(t=D.FILE_DIR_TYPE),t&&(e.type=t),s){if(typeof s!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(t&&!It.includes(t))throw new Error(`readdirp: Invalid type passed. Use one of ${It.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=s,new We(e)}var M,zt,z,D,He,Ht,Li,It,Ii,$i,Mi,zi,$t,Mt,We,Gt=w(()=>{"use strict";p();M=require("fs/promises"),zt=require("stream"),z=require("path"),D={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},He={root:".",fileFilter:s=>!0,directoryFilter:s=>!0,type:D.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(He);Ht="READDIRP_RECURSIVE_ERROR",Li=new Set(["ENOENT","EPERM","EACCES","ELOOP",Ht]),It=[D.DIR_TYPE,D.EVERYTHING_TYPE,D.FILE_DIR_TYPE,D.FILE_TYPE],Ii=new Set([D.DIR_TYPE,D.EVERYTHING_TYPE,D.FILE_DIR_TYPE]),$i=new Set([D.EVERYTHING_TYPE,D.FILE_DIR_TYPE,D.FILE_TYPE]),Mi=s=>Li.has(s.code),zi=process.platform==="win32",$t=s=>!0,Mt=s=>{if(s===void 0)return $t;if(typeof s=="function")return s;if(typeof s=="string"){let e=s.trim();return t=>t.basename===e}if(Array.isArray(s)){let e=s.map(t=>t.trim());return t=>e.some(i=>t.basename===i)}return $t},We=class extends zt.Readable{constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={...He,...e},{root:i,type:r}=t;this._fileFilter=Mt(t.fileFilter),this._directoryFilter=Mt(t.directoryFilter);let o=t.lstat?M.lstat:M.stat;zi?this._stat=a=>o(a,{bigint:!0}):this._stat=o,this._maxDepth=t.depth??He.depth,this._wantsDir=r?Ii.has(r):!1,this._wantsFile=r?$i.has(r):!1,this._wantsEverything=r===D.EVERYTHING_TYPE,this._root=(0,z.resolve)(i),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(i,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let t=this.parent,i=t&&t.files;if(i&&i.length>0){let{path:r,depth:o}=t,a=i.splice(0,e).map(l=>this._formatEntry(l,r)),n=await Promise.all(a);for(let l of n){if(!l)continue;if(this.destroyed)return;let f=await this._getEntryType(l);f==="directory"&&this._directoryFilter(l)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(l.fullPath,o+1)),this._wantsDir&&(this.push(l),e--)):(f==="file"||this._includeAsFile(l))&&this._fileFilter(l)&&this._wantsFile&&(this.push(l),e--)}}else{let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}}async _exploreDir(e,t){let i;try{i=await(0,M.readdir)(e,this._rdOptions)}catch(r){this._onError(r)}return{files:i,depth:t,path:e}}async _formatEntry(e,t){let i,r=this._isDirent?e.name:e;try{let o=(0,z.resolve)((0,z.join)(t,r));i={path:(0,z.relative)(this._root,o),fullPath:o,basename:r},i[this._statsProp]=this._isDirent?e:await this._stat(o)}catch(o){this._onError(o);return}return i}_onError(e){Mi(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return"";let t=e[this._statsProp];if(t.isFile())return"file";if(t.isDirectory())return"directory";if(t&&t.isSymbolicLink()){let i=e.fullPath;try{let r=await(0,M.realpath)(i),o=await(0,M.lstat)(r);if(o.isFile())return"file";if(o.isDirectory()){let a=r.length;if(i.startsWith(r)&&i.substr(a,1)===z.sep){let n=new Error(`Circular symlink detected: "${i}" points to "${r}"`);return n.code=Ht,this._onError(n)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}}});function Ut(s,e,t,i,r){let o=(a,n)=>{t(s),r(a,n,{watchedPath:s}),n&&s!==n&&ye(P.resolve(s,n),V,P.join(s,n))};try{return(0,Y.watch)(s,{persistent:e.persistent},o)}catch(a){i(a);return}}var Y,F,P,Bt,Hi,Be,Jt,ve,be,Je,Wi,Gi,Ui,Vt,_,N,Bi,Ji,V,de,K,Vi,Yi,qi,Ue,ie,Xi,re,Yt,ge,ye,Ki,Ge,Qi,we,qt=w(()=>{"use strict";p();Y=require("fs"),F=require("fs/promises"),P=d(require("path"),1),Bt=require("os"),Hi="data",Be="end",Jt="close",ve=()=>{},be=process.platform,Je=be==="win32",Wi=be==="darwin",Gi=be==="linux",Ui=be==="freebsd",Vt=(0,Bt.type)()==="OS400",_={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},N=_,Bi="watch",Ji={lstat:F.lstat,stat:F.stat},V="listeners",de="errHandlers",K="rawEmitters",Vi=[V,de,K],Yi=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),qi=s=>Yi.has(P.extname(s).slice(1).toLowerCase()),Ue=(s,e)=>{s instanceof Set?s.forEach(e):e(s)},ie=(s,e,t)=>{let i=s[e];i instanceof Set||(s[e]=i=new Set([i])),i.add(t)},Xi=s=>e=>{let t=s[e];t instanceof Set?t.clear():delete s[e]},re=(s,e,t)=>{let i=s[e];i instanceof Set?i.delete(t):i===t&&delete s[e]},Yt=s=>s instanceof Set?s.size===0:!s,ge=new Map;ye=(s,e,t,i,r)=>{let o=ge.get(s);o&&Ue(o[e],a=>{a(t,i,r)})},Ki=(s,e,t,i)=>{let{listener:r,errHandler:o,rawEmitter:a}=i,n=ge.get(e),l;if(!t.persistent)return l=Ut(s,t,r,o,a),l?l.close.bind(l):void 0;if(n)ie(n,V,r),ie(n,de,o),ie(n,K,a);else{if(l=Ut(s,t,ye.bind(null,e,V),o,ye.bind(null,e,K)),!l)return;l.on(N.ERROR,async f=>{let c=ye.bind(null,e,de);if(n&&(n.watcherUnusable=!0),Je&&f.code==="EPERM")try{await(await(0,F.open)(s,"r")).close(),c(f)}catch{}else c(f)}),n={listeners:r,errHandlers:o,rawEmitters:a,watcher:l},ge.set(e,n)}return()=>{re(n,V,r),re(n,de,o),re(n,K,a),Yt(n.listeners)&&(n.watcher.close(),ge.delete(e),Vi.forEach(Xi(n)),n.watcher=void 0,Object.freeze(n))}},Ge=new Map,Qi=(s,e,t,i)=>{let{listener:r,rawEmitter:o}=i,a=Ge.get(e),n=a&&a.options;return n&&(n.persistent<t.persistent||n.interval>t.interval)&&((0,Y.unwatchFile)(e),a=void 0),a?(ie(a,V,r),ie(a,K,o)):(a={listeners:r,rawEmitters:o,options:t,watcher:(0,Y.watchFile)(e,t,(l,f)=>{Ue(a.rawEmitters,m=>{m(N.CHANGE,e,{curr:l,prev:f})});let c=l.mtimeMs;(l.size!==f.size||c>f.mtimeMs||c===0)&&Ue(a.listeners,m=>m(s,l))})},Ge.set(e,a)),()=>{re(a,V,r),re(a,K,o),Yt(a.listeners)&&(Ge.delete(e),(0,Y.unwatchFile)(e),a.options=a.watcher=void 0,Object.freeze(a))}},we=class{constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(e,t){let i=this.fsw.options,r=P.dirname(e),o=P.basename(e);this.fsw._getWatchedDir(r).add(o);let n=P.resolve(e),l={persistent:i.persistent};t||(t=ve);let f;if(i.usePolling){let c=i.interval!==i.binaryInterval;l.interval=c&&qi(o)?i.binaryInterval:i.interval,f=Qi(e,n,l,{listener:t,rawEmitter:this.fsw._emitRaw})}else f=Ki(e,n,l,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return f}_handleFile(e,t,i){if(this.fsw.closed)return;let r=P.dirname(e),o=P.basename(e),a=this.fsw._getWatchedDir(r),n=t;if(a.has(o))return;let l=async(c,m)=>{if(this.fsw._throttle(Bi,e,5)){if(!m||m.mtimeMs===0)try{let u=await(0,F.stat)(e);if(this.fsw.closed)return;let b=u.atimeMs,C=u.mtimeMs;if((!b||b<=C||C!==n.mtimeMs)&&this.fsw._emit(N.CHANGE,e,u),(Wi||Gi||Ui)&&n.ino!==u.ino){this.fsw._closeFile(c),n=u;let E=this._watchWithNodeFs(e,l);E&&this.fsw._addPathCloser(c,E)}else n=u}catch{this.fsw._remove(r,o)}else if(a.has(o)){let u=m.atimeMs,b=m.mtimeMs;(!u||u<=b||b!==n.mtimeMs)&&this.fsw._emit(N.CHANGE,e,m),n=m}}},f=this._watchWithNodeFs(e,l);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(N.ADD,e,0))return;this.fsw._emit(N.ADD,e,t)}return f}async _handleSymlink(e,t,i,r){if(this.fsw.closed)return;let o=e.fullPath,a=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let n;try{n=await(0,F.realpath)(i)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(a.has(r)?this.fsw._symlinkPaths.get(o)!==n&&(this.fsw._symlinkPaths.set(o,n),this.fsw._emit(N.CHANGE,i,e.stats)):(a.add(r),this.fsw._symlinkPaths.set(o,n),this.fsw._emit(N.ADD,i,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(o))return!0;this.fsw._symlinkPaths.set(o,!0)}_handleRead(e,t,i,r,o,a,n){if(e=P.join(e,""),n=this.fsw._throttle("readdir",e,1e3),!n)return;let l=this.fsw._getWatchedDir(i.path),f=new Set,c=this.fsw._readdirp(e,{fileFilter:m=>i.filterPath(m),directoryFilter:m=>i.filterDir(m)});if(c)return c.on(Hi,async m=>{if(this.fsw.closed){c=void 0;return}let u=m.path,b=P.join(e,u);if(f.add(u),!(m.stats.isSymbolicLink()&&await this._handleSymlink(m,e,b,u))){if(this.fsw.closed){c=void 0;return}(u===r||!r&&!l.has(u))&&(this.fsw._incrReadyCount(),b=P.join(o,P.relative(o,b)),this._addToNodeFs(b,t,i,a+1))}}).on(N.ERROR,this._boundHandleError),new Promise((m,u)=>{if(!c)return u();c.once(Be,()=>{if(this.fsw.closed){c=void 0;return}let b=n?n.clear():!1;m(void 0),l.getChildren().filter(C=>C!==e&&!f.has(C)).forEach(C=>{this.fsw._remove(e,C)}),c=void 0,b&&this._handleRead(e,!1,i,r,o,a,n)})})}async _handleDir(e,t,i,r,o,a,n){let l=this.fsw._getWatchedDir(P.dirname(e)),f=l.has(P.basename(e));!(i&&this.fsw.options.ignoreInitial)&&!o&&!f&&this.fsw._emit(N.ADD_DIR,e,t),l.add(P.basename(e)),this.fsw._getWatchedDir(e);let c,m,u=this.fsw.options.depth;if((u==null||r<=u)&&!this.fsw._symlinkPaths.has(n)){if(!o&&(await this._handleRead(e,i,a,o,e,r,c),this.fsw.closed))return;m=this._watchWithNodeFs(e,(b,C)=>{C&&C.mtimeMs===0||this._handleRead(b,!1,a,o,e,r,c)})}return m}async _addToNodeFs(e,t,i,r,o){let a=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return a(),!1;let n=this.fsw._getWatchHelpers(e);i&&(n.filterPath=l=>i.filterPath(l),n.filterDir=l=>i.filterDir(l));try{let l=await Ji[n.statMethod](n.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(n.watchPath,l))return a(),!1;let f=this.fsw.options.followSymlinks,c;if(l.isDirectory()){let m=P.resolve(e),u=f?await(0,F.realpath)(e):e;if(this.fsw.closed||(c=await this._handleDir(n.watchPath,l,t,r,o,n,u),this.fsw.closed))return;m!==u&&u!==void 0&&this.fsw._symlinkPaths.set(m,u)}else if(l.isSymbolicLink()){let m=f?await(0,F.realpath)(e):e;if(this.fsw.closed)return;let u=P.dirname(n.watchPath);if(this.fsw._getWatchedDir(u).add(n.watchPath),this.fsw._emit(N.ADD,n.watchPath,l),c=await this._handleDir(u,l,t,r,e,n,m),this.fsw.closed)return;m!==void 0&&this.fsw._symlinkPaths.set(P.resolve(e),m)}else c=this._handleFile(n.watchPath,l,t);return a(),c&&this.fsw._addPathCloser(e,c),!1}catch(l){if(this.fsw._handleError(l))return a(),e}}}});function Ce(s){return Array.isArray(s)?s:[s]}function or(s){return typeof s=="function"?s:typeof s=="string"?e=>s===e:s instanceof RegExp?e=>s.test(e):typeof s=="object"&&s!==null?e=>{if(s.path===e)return!0;if(s.recursive){let t=y.relative(s.path,e);return t?!t.startsWith("..")&&!y.isAbsolute(t):!1}return!1}:()=>!1}function nr(s){if(typeof s!="string")throw new Error("string expected");s=y.normalize(s),s=s.replace(/\\/g,"/");let e=!1;s.startsWith("//")&&(e=!0);let t=/\/\//;for(;s.match(t);)s=s.replace(t,"/");return e&&(s="/"+s),s}function Kt(s,e,t){let i=nr(e);for(let r=0;r<s.length;r++){let o=s[r];if(o(i,t))return!0}return!1}function ar(s,e){if(s==null)throw new TypeError("anymatch: specify first argument");let i=Ce(s).map(r=>or(r));return e==null?(r,o)=>Kt(i,r,o):Kt(i,e)}function fr(s,e={}){let t=new Ee(e);return t.add(s),t}var ts,Pe,ss,y,Ve,Zi,is,er,tr,sr,Xt,ir,rr,Ye,Qt,Zt,rs,es,lr,cr,qe,pr,hr,Xe,Ee,os,ns=w(()=>{"use strict";p();ts=require("fs"),Pe=require("fs/promises"),ss=require("events"),y=d(require("path"),1);Gt();qt();Ve="/",Zi="//",is=".",er="..",tr="string",sr=/\\/g,Xt=/\/\//,ir=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,rr=/^\.[/\\]/;Ye=s=>typeof s=="object"&&s!==null&&!(s instanceof RegExp);Qt=s=>{let e=Ce(s).flat();if(!e.every(t=>typeof t===tr))throw new TypeError(`Non-string provided as watch path: ${e}`);return e.map(rs)},Zt=s=>{let e=s.replace(sr,Ve),t=!1;for(e.startsWith(Zi)&&(t=!0);e.match(Xt);)e=e.replace(Xt,Ve);return t&&(e=Ve+e),e},rs=s=>Zt(y.normalize(Zt(s))),es=(s="")=>e=>typeof e=="string"?rs(y.isAbsolute(e)?e:y.join(s,e)):e,lr=(s,e)=>y.isAbsolute(s)?s:y.join(e,s),cr=Object.freeze(new Set),qe=class{constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;t&&e!==is&&e!==er&&t.add(e)}async remove(e){let{items:t}=this;if(!t||(t.delete(e),t.size>0))return;let i=this.path;try{await(0,Pe.readdir)(i)}catch{this._removeWatcher&&this._removeWatcher(y.dirname(i),y.basename(i))}}has(e){let{items:t}=this;if(t)return t.has(e)}getChildren(){let{items:e}=this;return e?[...e.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=ve,this.items=cr,Object.freeze(this)}},pr="stat",hr="lstat",Xe=class{constructor(e,t,i){this.fsw=i;let r=e;this.path=e=e.replace(rr,""),this.watchPath=r,this.fullWatchPath=y.resolve(r),this.dirParts=[],this.dirParts.forEach(o=>{o.length>1&&o.pop()}),this.followSymlinks=t,this.statMethod=t?pr:hr}entryPath(e){return y.join(this.watchPath,y.relative(this.watchPath,e.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let i=this.entryPath(e);return this.fsw._isntIgnored(i,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}},Ee=class extends ss.EventEmitter{constructor(e={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},r={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?Ce(e.ignored):Ce([]),awaitWriteFinish:t===!0?i:typeof t=="object"?{...i,...t}:!1};Vt&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let o=process.env.CHOKIDAR_USEPOLLING;if(o!==void 0){let l=o.toLowerCase();l==="false"||l==="0"?r.usePolling=!1:l==="true"||l==="1"?r.usePolling=!0:r.usePolling=!!l}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let n=0;this._emitReady=()=>{n++,n>=this._readyCount&&(this._emitReady=ve,this._readyEmitted=!0,process.nextTick(()=>this.emit(_.READY)))},this._emitRaw=(...l)=>this.emit(_.RAW,...l),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new we(this),Object.freeze(r)}_addIgnoredPath(e){if(Ye(e)){for(let t of this._ignoredPaths)if(Ye(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),typeof e=="string")for(let t of this._ignoredPaths)Ye(t)&&t.path===e&&this._ignoredPaths.delete(t)}add(e,t,i){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let o=Qt(e);return r&&(o=o.map(a=>lr(a,r))),o.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let n=await this._nodeFsHandler._addToNodeFs(a,!i,void 0,0,t);return n&&this._emitReady(),n})).then(a=>{this.closed||a.forEach(n=>{n&&this.add(y.dirname(n),y.basename(t||n))})}),this}unwatch(e){if(this.closed)return this;let t=Qt(e),{cwd:i}=this.options;return t.forEach(r=>{!y.isAbsolute(r)&&!this._closers.has(r)&&(i&&(r=y.join(i,r)),r=y.resolve(r)),this._closePath(r),this._addIgnoredPath(r),this._watched.has(r)&&this._addIgnoredPath({path:r,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(t=>t.forEach(i=>{let r=i();r instanceof Promise&&e.push(r)})),this._streams.forEach(t=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(t=>t.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((t,i)=>{let o=(this.options.cwd?y.relative(this.options.cwd,i):i)||is;e[o]=t.getChildren().sort()}),e}emitWithAll(e,t){this.emit(e,...t),e!==_.ERROR&&this.emit(_.ALL,e,...t)}async _emit(e,t,i){if(this.closed)return;let r=this.options;Je&&(t=y.normalize(t)),r.cwd&&(t=y.relative(r.cwd,t));let o=[t];i!=null&&o.push(i);let a=r.awaitWriteFinish,n;if(a&&(n=this._pendingWrites.get(t)))return n.lastChange=new Date,this;if(r.atomic){if(e===_.UNLINK)return this._pendingUnlinks.set(t,[e,...o]),setTimeout(()=>{this._pendingUnlinks.forEach((l,f)=>{this.emit(...l),this.emit(_.ALL,...l),this._pendingUnlinks.delete(f)})},typeof r.atomic=="number"?r.atomic:100),this;e===_.ADD&&this._pendingUnlinks.has(t)&&(e=_.CHANGE,this._pendingUnlinks.delete(t))}if(a&&(e===_.ADD||e===_.CHANGE)&&this._readyEmitted){let l=(f,c)=>{f?(e=_.ERROR,o[0]=f,this.emitWithAll(e,o)):c&&(o.length>1?o[1]=c:o.push(c),this.emitWithAll(e,o))};return this._awaitWriteFinish(t,a.stabilityThreshold,e,l),this}if(e===_.CHANGE&&!this._throttle(_.CHANGE,t,50))return this;if(r.alwaysStat&&i===void 0&&(e===_.ADD||e===_.ADD_DIR||e===_.CHANGE)){let l=r.cwd?y.join(r.cwd,t):t,f;try{f=await(0,Pe.stat)(l)}catch{}if(!f||this.closed)return;o.push(f)}return this.emitWithAll(e,o),this}_handleError(e){let t=e&&e.code;return e&&t!=="ENOENT"&&t!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||t!=="EPERM"&&t!=="EACCES")&&this.emit(_.ERROR,e),e||this.closed}_throttle(e,t,i){this._throttled.has(e)||this._throttled.set(e,new Map);let r=this._throttled.get(e);if(!r)throw new Error("invalid throttle");let o=r.get(t);if(o)return o.count++,!1;let a,n=()=>{let f=r.get(t),c=f?f.count:0;return r.delete(t),clearTimeout(a),f&&clearTimeout(f.timeoutObject),c};a=setTimeout(n,i);let l={timeoutObject:a,clear:n,count:0};return r.set(t,l),l}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,t,i,r){let o=this.options.awaitWriteFinish;if(typeof o!="object")return;let a=o.pollInterval,n,l=e;this.options.cwd&&!y.isAbsolute(e)&&(l=y.join(this.options.cwd,e));let f=new Date,c=this._pendingWrites;function m(u){(0,ts.stat)(l,(b,C)=>{if(b||!c.has(e)){b&&b.code!=="ENOENT"&&r(b);return}let E=Number(new Date);u&&C.size!==u.size&&(c.get(e).lastChange=E);let O=c.get(e);E-O.lastChange>=t?(c.delete(e),r(void 0,C)):n=setTimeout(m,a,C)})}c.has(e)||(c.set(e,{lastChange:f,cancelWait:()=>(c.delete(e),clearTimeout(n),i)}),n=setTimeout(m,a))}_isIgnored(e,t){if(this.options.atomic&&ir.test(e))return!0;if(!this._userIgnored){let{cwd:i}=this.options,o=(this.options.ignored||[]).map(es(i)),n=[...[...this._ignoredPaths].map(es(i)),...o];this._userIgnored=ar(n,void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new Xe(e,this.options.followSymlinks,this)}_getWatchedDir(e){let t=y.resolve(e);return this._watched.has(t)||this._watched.set(t,new qe(t,this._boundRemove)),this._watched.get(t)}_hasReadPermissions(e){return this.options.ignorePermissionErrors?!0:!!(Number(e.mode)&256)}_remove(e,t,i){let r=y.join(e,t),o=y.resolve(r);if(i=i??(this._watched.has(r)||this._watched.has(o)),!this._throttle("remove",r,100))return;!i&&this._watched.size===1&&this.add(e,t,!0),this._getWatchedDir(r).getChildren().forEach(u=>this._remove(r,u));let l=this._getWatchedDir(e),f=l.has(t);l.remove(t),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let c=r;if(this.options.cwd&&(c=y.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(c)&&this._pendingWrites.get(c).cancelWait()===_.ADD)return;this._watched.delete(r),this._watched.delete(o);let m=i?_.UNLINK_DIR:_.UNLINK;f&&!this._isIgnored(r)&&this._emit(m,r),this._closePath(r)}_closePath(e){this._closeFile(e);let t=y.dirname(e);this._getWatchedDir(t).remove(y.basename(e))}_closeFile(e){let t=this._closers.get(e);t&&(t.forEach(i=>i()),this._closers.delete(e))}_addPathCloser(e,t){if(!t)return;let i=this._closers.get(e);i||(i=[],this._closers.set(e,i)),i.push(t)}_readdirp(e,t){if(this.closed)return;let i={type:_.ALL,alwaysStat:!0,lstat:!0,...t,depth:0},r=Wt(e,i);return this._streams.add(r),r.once(Jt,()=>{r=void 0}),r.once(Be,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};os={watch:fr,FSWatcher:Ee}});var k,ur,G,mr,dr,gr,Ke,_e,yr,wr,Q,Qe,vr,Ze,Z,x,ee=w(()=>{"use strict";p();k=d(require("chalk"),1),ur=k.default.hex("#1abc9c"),G=k.default.hex("#16a085"),mr=k.default.hex("#2ecc71"),dr=k.default.hex("#27ae60"),gr=k.default.hex("#e74c3c"),Ke=k.default.hex("#c0392b"),_e=k.default.hex("#f1c40f"),yr=k.default.hex("#f39c12"),wr=k.default.hex("#3498db"),Q=k.default.hex("#2980b9"),Qe=k.default.hex("#ecf0f1"),vr=k.default.hex("#fd79a8"),Ze=k.default.hex("#e84393"),Z=k.default.hex("#7f8c8d"),x={lightGreen:ur,green:G,lightCyan:mr,cyan:dr,lightRed:gr,red:Ke,yellow:_e,orange:yr,lightBlue:wr,blue:Q,white:Qe,lightMagenta:vr,magenta:Ze,gray:Z}});var as,oe,h,L=w(()=>{"use strict";p();ee();as=!1,oe=class{brandName="";fullName="";logLevel=as?"debug":"info";isLogTime=as;setup({brandName:e,logLevel:t,fullName:i}){this.brandName=` [${e}] `,this.fullName=` ${i} `,this.fullName=x.green.bold(this.fullName),t&&(this.logLevel=t)}time=(...e)=>this.isLogTime&&console.time(...e);timeEnd=(...e)=>this.isLogTime&&console.timeEnd(...e);debug=(...e)=>["debug"].includes(this.logLevel)&&console.log(...e);info=(...e)=>["debug","info"].includes(this.logLevel)&&console.log(...e);warn=(...e)=>["debug","info","warn"].includes(this.logLevel)&&console.warn(...e);error=(...e)=>["debug","info","warn","error"].includes(this.logLevel)&&console.error(...e);blue=e=>{console.log(`${x.lightBlue(this.brandName)}${x.blue(` ${e} `)}
1
+ "use strict";var Di=Object.create;var ue=Object.defineProperty;var Ti=Object.getOwnPropertyDescriptor;var Ri=Object.getOwnPropertyNames;var ji=Object.getPrototypeOf,Ai=Object.prototype.hasOwnProperty;var w=(s,e)=>()=>(s&&(e=s(s=0)),e);var X=(s,e)=>{for(var t in e)ue(s,t,{get:e[t],enumerable:!0})},Lt=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ri(e))!Ai.call(s,r)&&r!==t&&ue(s,r,{get:()=>e[r],enumerable:!(i=Ti(e,r))||i.enumerable});return s};var d=(s,e,t)=>(t=s!=null?Di(ji(s)):{},Lt(e||!s||!s.__esModule?ue(t,"default",{value:s,enumerable:!0}):t,s)),Ni=s=>Lt(ue({},"__esModule",{value:!0}),s);var p=w(()=>{"use strict"});var me,ze=w(()=>{me={name:"@empjs/cli",version:"3.10.8",description:"emp",license:"MIT",type:"module",files:["dist","bin","resource","template","types","tsconfig"],maintainers:["xuhongbin","ckken","doerme"],repository:{type:"git",url:"git+https://github.com/empjs/emp.git",directory:"packages/cli"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},keywords:["rspack","rust","typescript"],bin:{emp:"./bin/emp.js"},main:"dist/index.js",types:"dist/index.d.ts",exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.js"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}},"./emp-tsconfig.json":{default:"./tsconfig/react.json"},"./tsconfig/base":{default:"./tsconfig/base.json"},"./tsconfig/react":{default:"./tsconfig/react.json"},"./tsconfig/vue":{default:"./tsconfig/vue.json"},"./client":{types:"./types/react/index.d.ts",default:"./types/react/index.d.ts"},"./types/base":{types:"./types/base/index.d.ts",default:"./types/base/index.d.ts"},"./types/vue":{types:"./types/vue/index.d.ts",default:"./types/vue/index.d.ts"},"./types/react":{types:"./types/react/index.d.ts",default:"./types/react/index.d.ts"}},scripts:{dev:"tsup --watch --env.ENV dev",build:"tsup --env.ENV prod","dev-rs":"rslib build --watch --env-mode development","build-rs":"rslib build --env-mode production",ph:"pnpm publish --no-git-checks"},engines:{node:">=18.0.0"},author:"Ken",devDependencies:{"@types/compression":"^1.7.2","@types/connect":"^3.4.38","@types/cors":"^2.8.12","@types/default-gateway":"^7.2.1","@types/fs-extra":"^11.0.4","@types/react":"^18.3.2","@types/serve-static":"^1.15.8","@types/watchpack":"^2.4.3","@types/webpack":"^5.28.4","@types/webpack-bundle-analyzer":"^4.6.2","@types/webpack-sources":"^3.2.2",chokidar:"^4.0.3",vue:"^3.5.21"},dependencies:{"@empjs/chain":"workspace:*","@rsdoctor/rspack-plugin":"1.3.16","@rspack/core":"1.6.8","@rspack/dev-server":"1.1.4","@swc/helpers":"^0.5.17","@vue/tsconfig":"^0.8.1",address:"^2.0.2",chalk:"^5.3.0",commander:"11.1.0",compression:"1.8.1",connect:"3.7.0","core-js":"^3.41.0",cors:"2.8.5","default-gateway":"7.2.2","fs-extra":"11.3.1",glob:"11.0.3","gzip-size":"7.0.0","html-webpack-plugin":"5.6.4",jiti:"2.6.1","less-loader":"^12.2.0",open:"10.2.0","sass-embedded":"1.93.2","sass-loader":"16.0.5","serve-static":"2.2.0","ts-checker-rspack-plugin":"1.1.6","typescript-plugin-css-modules":"5.2.0","webpack-bundle-analyzer":"4.10.2"}}});function Wt(s,e={}){let t=e.entryType||e.type;if(t==="both"&&(t=D.FILE_DIR_TYPE),t&&(e.type=t),s){if(typeof s!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(t&&!It.includes(t))throw new Error(`readdirp: Invalid type passed. Use one of ${It.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=s,new We(e)}var M,zt,z,D,He,Ht,Li,It,Ii,$i,Mi,zi,$t,Mt,We,Gt=w(()=>{"use strict";p();M=require("fs/promises"),zt=require("stream"),z=require("path"),D={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},He={root:".",fileFilter:s=>!0,directoryFilter:s=>!0,type:D.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(He);Ht="READDIRP_RECURSIVE_ERROR",Li=new Set(["ENOENT","EPERM","EACCES","ELOOP",Ht]),It=[D.DIR_TYPE,D.EVERYTHING_TYPE,D.FILE_DIR_TYPE,D.FILE_TYPE],Ii=new Set([D.DIR_TYPE,D.EVERYTHING_TYPE,D.FILE_DIR_TYPE]),$i=new Set([D.EVERYTHING_TYPE,D.FILE_DIR_TYPE,D.FILE_TYPE]),Mi=s=>Li.has(s.code),zi=process.platform==="win32",$t=s=>!0,Mt=s=>{if(s===void 0)return $t;if(typeof s=="function")return s;if(typeof s=="string"){let e=s.trim();return t=>t.basename===e}if(Array.isArray(s)){let e=s.map(t=>t.trim());return t=>e.some(i=>t.basename===i)}return $t},We=class extends zt.Readable{constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={...He,...e},{root:i,type:r}=t;this._fileFilter=Mt(t.fileFilter),this._directoryFilter=Mt(t.directoryFilter);let o=t.lstat?M.lstat:M.stat;zi?this._stat=a=>o(a,{bigint:!0}):this._stat=o,this._maxDepth=t.depth??He.depth,this._wantsDir=r?Ii.has(r):!1,this._wantsFile=r?$i.has(r):!1,this._wantsEverything=r===D.EVERYTHING_TYPE,this._root=(0,z.resolve)(i),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(i,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let t=this.parent,i=t&&t.files;if(i&&i.length>0){let{path:r,depth:o}=t,a=i.splice(0,e).map(l=>this._formatEntry(l,r)),n=await Promise.all(a);for(let l of n){if(!l)continue;if(this.destroyed)return;let f=await this._getEntryType(l);f==="directory"&&this._directoryFilter(l)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(l.fullPath,o+1)),this._wantsDir&&(this.push(l),e--)):(f==="file"||this._includeAsFile(l))&&this._fileFilter(l)&&this._wantsFile&&(this.push(l),e--)}}else{let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}}async _exploreDir(e,t){let i;try{i=await(0,M.readdir)(e,this._rdOptions)}catch(r){this._onError(r)}return{files:i,depth:t,path:e}}async _formatEntry(e,t){let i,r=this._isDirent?e.name:e;try{let o=(0,z.resolve)((0,z.join)(t,r));i={path:(0,z.relative)(this._root,o),fullPath:o,basename:r},i[this._statsProp]=this._isDirent?e:await this._stat(o)}catch(o){this._onError(o);return}return i}_onError(e){Mi(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return"";let t=e[this._statsProp];if(t.isFile())return"file";if(t.isDirectory())return"directory";if(t&&t.isSymbolicLink()){let i=e.fullPath;try{let r=await(0,M.realpath)(i),o=await(0,M.lstat)(r);if(o.isFile())return"file";if(o.isDirectory()){let a=r.length;if(i.startsWith(r)&&i.substr(a,1)===z.sep){let n=new Error(`Circular symlink detected: "${i}" points to "${r}"`);return n.code=Ht,this._onError(n)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}}});function Ut(s,e,t,i,r){let o=(a,n)=>{t(s),r(a,n,{watchedPath:s}),n&&s!==n&&ye(P.resolve(s,n),V,P.join(s,n))};try{return(0,Y.watch)(s,{persistent:e.persistent},o)}catch(a){i(a);return}}var Y,F,P,Bt,Hi,Be,Jt,ve,be,Je,Wi,Gi,Ui,Vt,_,N,Bi,Ji,V,de,K,Vi,Yi,qi,Ue,ie,Xi,re,Yt,ge,ye,Ki,Ge,Qi,we,qt=w(()=>{"use strict";p();Y=require("fs"),F=require("fs/promises"),P=d(require("path"),1),Bt=require("os"),Hi="data",Be="end",Jt="close",ve=()=>{},be=process.platform,Je=be==="win32",Wi=be==="darwin",Gi=be==="linux",Ui=be==="freebsd",Vt=(0,Bt.type)()==="OS400",_={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},N=_,Bi="watch",Ji={lstat:F.lstat,stat:F.stat},V="listeners",de="errHandlers",K="rawEmitters",Vi=[V,de,K],Yi=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),qi=s=>Yi.has(P.extname(s).slice(1).toLowerCase()),Ue=(s,e)=>{s instanceof Set?s.forEach(e):e(s)},ie=(s,e,t)=>{let i=s[e];i instanceof Set||(s[e]=i=new Set([i])),i.add(t)},Xi=s=>e=>{let t=s[e];t instanceof Set?t.clear():delete s[e]},re=(s,e,t)=>{let i=s[e];i instanceof Set?i.delete(t):i===t&&delete s[e]},Yt=s=>s instanceof Set?s.size===0:!s,ge=new Map;ye=(s,e,t,i,r)=>{let o=ge.get(s);o&&Ue(o[e],a=>{a(t,i,r)})},Ki=(s,e,t,i)=>{let{listener:r,errHandler:o,rawEmitter:a}=i,n=ge.get(e),l;if(!t.persistent)return l=Ut(s,t,r,o,a),l?l.close.bind(l):void 0;if(n)ie(n,V,r),ie(n,de,o),ie(n,K,a);else{if(l=Ut(s,t,ye.bind(null,e,V),o,ye.bind(null,e,K)),!l)return;l.on(N.ERROR,async f=>{let c=ye.bind(null,e,de);if(n&&(n.watcherUnusable=!0),Je&&f.code==="EPERM")try{await(await(0,F.open)(s,"r")).close(),c(f)}catch{}else c(f)}),n={listeners:r,errHandlers:o,rawEmitters:a,watcher:l},ge.set(e,n)}return()=>{re(n,V,r),re(n,de,o),re(n,K,a),Yt(n.listeners)&&(n.watcher.close(),ge.delete(e),Vi.forEach(Xi(n)),n.watcher=void 0,Object.freeze(n))}},Ge=new Map,Qi=(s,e,t,i)=>{let{listener:r,rawEmitter:o}=i,a=Ge.get(e),n=a&&a.options;return n&&(n.persistent<t.persistent||n.interval>t.interval)&&((0,Y.unwatchFile)(e),a=void 0),a?(ie(a,V,r),ie(a,K,o)):(a={listeners:r,rawEmitters:o,options:t,watcher:(0,Y.watchFile)(e,t,(l,f)=>{Ue(a.rawEmitters,m=>{m(N.CHANGE,e,{curr:l,prev:f})});let c=l.mtimeMs;(l.size!==f.size||c>f.mtimeMs||c===0)&&Ue(a.listeners,m=>m(s,l))})},Ge.set(e,a)),()=>{re(a,V,r),re(a,K,o),Yt(a.listeners)&&(Ge.delete(e),(0,Y.unwatchFile)(e),a.options=a.watcher=void 0,Object.freeze(a))}},we=class{constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(e,t){let i=this.fsw.options,r=P.dirname(e),o=P.basename(e);this.fsw._getWatchedDir(r).add(o);let n=P.resolve(e),l={persistent:i.persistent};t||(t=ve);let f;if(i.usePolling){let c=i.interval!==i.binaryInterval;l.interval=c&&qi(o)?i.binaryInterval:i.interval,f=Qi(e,n,l,{listener:t,rawEmitter:this.fsw._emitRaw})}else f=Ki(e,n,l,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return f}_handleFile(e,t,i){if(this.fsw.closed)return;let r=P.dirname(e),o=P.basename(e),a=this.fsw._getWatchedDir(r),n=t;if(a.has(o))return;let l=async(c,m)=>{if(this.fsw._throttle(Bi,e,5)){if(!m||m.mtimeMs===0)try{let u=await(0,F.stat)(e);if(this.fsw.closed)return;let b=u.atimeMs,C=u.mtimeMs;if((!b||b<=C||C!==n.mtimeMs)&&this.fsw._emit(N.CHANGE,e,u),(Wi||Gi||Ui)&&n.ino!==u.ino){this.fsw._closeFile(c),n=u;let E=this._watchWithNodeFs(e,l);E&&this.fsw._addPathCloser(c,E)}else n=u}catch{this.fsw._remove(r,o)}else if(a.has(o)){let u=m.atimeMs,b=m.mtimeMs;(!u||u<=b||b!==n.mtimeMs)&&this.fsw._emit(N.CHANGE,e,m),n=m}}},f=this._watchWithNodeFs(e,l);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(N.ADD,e,0))return;this.fsw._emit(N.ADD,e,t)}return f}async _handleSymlink(e,t,i,r){if(this.fsw.closed)return;let o=e.fullPath,a=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let n;try{n=await(0,F.realpath)(i)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(a.has(r)?this.fsw._symlinkPaths.get(o)!==n&&(this.fsw._symlinkPaths.set(o,n),this.fsw._emit(N.CHANGE,i,e.stats)):(a.add(r),this.fsw._symlinkPaths.set(o,n),this.fsw._emit(N.ADD,i,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(o))return!0;this.fsw._symlinkPaths.set(o,!0)}_handleRead(e,t,i,r,o,a,n){if(e=P.join(e,""),n=this.fsw._throttle("readdir",e,1e3),!n)return;let l=this.fsw._getWatchedDir(i.path),f=new Set,c=this.fsw._readdirp(e,{fileFilter:m=>i.filterPath(m),directoryFilter:m=>i.filterDir(m)});if(c)return c.on(Hi,async m=>{if(this.fsw.closed){c=void 0;return}let u=m.path,b=P.join(e,u);if(f.add(u),!(m.stats.isSymbolicLink()&&await this._handleSymlink(m,e,b,u))){if(this.fsw.closed){c=void 0;return}(u===r||!r&&!l.has(u))&&(this.fsw._incrReadyCount(),b=P.join(o,P.relative(o,b)),this._addToNodeFs(b,t,i,a+1))}}).on(N.ERROR,this._boundHandleError),new Promise((m,u)=>{if(!c)return u();c.once(Be,()=>{if(this.fsw.closed){c=void 0;return}let b=n?n.clear():!1;m(void 0),l.getChildren().filter(C=>C!==e&&!f.has(C)).forEach(C=>{this.fsw._remove(e,C)}),c=void 0,b&&this._handleRead(e,!1,i,r,o,a,n)})})}async _handleDir(e,t,i,r,o,a,n){let l=this.fsw._getWatchedDir(P.dirname(e)),f=l.has(P.basename(e));!(i&&this.fsw.options.ignoreInitial)&&!o&&!f&&this.fsw._emit(N.ADD_DIR,e,t),l.add(P.basename(e)),this.fsw._getWatchedDir(e);let c,m,u=this.fsw.options.depth;if((u==null||r<=u)&&!this.fsw._symlinkPaths.has(n)){if(!o&&(await this._handleRead(e,i,a,o,e,r,c),this.fsw.closed))return;m=this._watchWithNodeFs(e,(b,C)=>{C&&C.mtimeMs===0||this._handleRead(b,!1,a,o,e,r,c)})}return m}async _addToNodeFs(e,t,i,r,o){let a=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return a(),!1;let n=this.fsw._getWatchHelpers(e);i&&(n.filterPath=l=>i.filterPath(l),n.filterDir=l=>i.filterDir(l));try{let l=await Ji[n.statMethod](n.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(n.watchPath,l))return a(),!1;let f=this.fsw.options.followSymlinks,c;if(l.isDirectory()){let m=P.resolve(e),u=f?await(0,F.realpath)(e):e;if(this.fsw.closed||(c=await this._handleDir(n.watchPath,l,t,r,o,n,u),this.fsw.closed))return;m!==u&&u!==void 0&&this.fsw._symlinkPaths.set(m,u)}else if(l.isSymbolicLink()){let m=f?await(0,F.realpath)(e):e;if(this.fsw.closed)return;let u=P.dirname(n.watchPath);if(this.fsw._getWatchedDir(u).add(n.watchPath),this.fsw._emit(N.ADD,n.watchPath,l),c=await this._handleDir(u,l,t,r,e,n,m),this.fsw.closed)return;m!==void 0&&this.fsw._symlinkPaths.set(P.resolve(e),m)}else c=this._handleFile(n.watchPath,l,t);return a(),c&&this.fsw._addPathCloser(e,c),!1}catch(l){if(this.fsw._handleError(l))return a(),e}}}});function Ce(s){return Array.isArray(s)?s:[s]}function or(s){return typeof s=="function"?s:typeof s=="string"?e=>s===e:s instanceof RegExp?e=>s.test(e):typeof s=="object"&&s!==null?e=>{if(s.path===e)return!0;if(s.recursive){let t=y.relative(s.path,e);return t?!t.startsWith("..")&&!y.isAbsolute(t):!1}return!1}:()=>!1}function nr(s){if(typeof s!="string")throw new Error("string expected");s=y.normalize(s),s=s.replace(/\\/g,"/");let e=!1;s.startsWith("//")&&(e=!0);let t=/\/\//;for(;s.match(t);)s=s.replace(t,"/");return e&&(s="/"+s),s}function Kt(s,e,t){let i=nr(e);for(let r=0;r<s.length;r++){let o=s[r];if(o(i,t))return!0}return!1}function ar(s,e){if(s==null)throw new TypeError("anymatch: specify first argument");let i=Ce(s).map(r=>or(r));return e==null?(r,o)=>Kt(i,r,o):Kt(i,e)}function fr(s,e={}){let t=new Ee(e);return t.add(s),t}var ts,Pe,ss,y,Ve,Zi,is,er,tr,sr,Xt,ir,rr,Ye,Qt,Zt,rs,es,lr,cr,qe,pr,hr,Xe,Ee,os,ns=w(()=>{"use strict";p();ts=require("fs"),Pe=require("fs/promises"),ss=require("events"),y=d(require("path"),1);Gt();qt();Ve="/",Zi="//",is=".",er="..",tr="string",sr=/\\/g,Xt=/\/\//,ir=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,rr=/^\.[/\\]/;Ye=s=>typeof s=="object"&&s!==null&&!(s instanceof RegExp);Qt=s=>{let e=Ce(s).flat();if(!e.every(t=>typeof t===tr))throw new TypeError(`Non-string provided as watch path: ${e}`);return e.map(rs)},Zt=s=>{let e=s.replace(sr,Ve),t=!1;for(e.startsWith(Zi)&&(t=!0);e.match(Xt);)e=e.replace(Xt,Ve);return t&&(e=Ve+e),e},rs=s=>Zt(y.normalize(Zt(s))),es=(s="")=>e=>typeof e=="string"?rs(y.isAbsolute(e)?e:y.join(s,e)):e,lr=(s,e)=>y.isAbsolute(s)?s:y.join(e,s),cr=Object.freeze(new Set),qe=class{constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;t&&e!==is&&e!==er&&t.add(e)}async remove(e){let{items:t}=this;if(!t||(t.delete(e),t.size>0))return;let i=this.path;try{await(0,Pe.readdir)(i)}catch{this._removeWatcher&&this._removeWatcher(y.dirname(i),y.basename(i))}}has(e){let{items:t}=this;if(t)return t.has(e)}getChildren(){let{items:e}=this;return e?[...e.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=ve,this.items=cr,Object.freeze(this)}},pr="stat",hr="lstat",Xe=class{constructor(e,t,i){this.fsw=i;let r=e;this.path=e=e.replace(rr,""),this.watchPath=r,this.fullWatchPath=y.resolve(r),this.dirParts=[],this.dirParts.forEach(o=>{o.length>1&&o.pop()}),this.followSymlinks=t,this.statMethod=t?pr:hr}entryPath(e){return y.join(this.watchPath,y.relative(this.watchPath,e.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let i=this.entryPath(e);return this.fsw._isntIgnored(i,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}},Ee=class extends ss.EventEmitter{constructor(e={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},r={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?Ce(e.ignored):Ce([]),awaitWriteFinish:t===!0?i:typeof t=="object"?{...i,...t}:!1};Vt&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let o=process.env.CHOKIDAR_USEPOLLING;if(o!==void 0){let l=o.toLowerCase();l==="false"||l==="0"?r.usePolling=!1:l==="true"||l==="1"?r.usePolling=!0:r.usePolling=!!l}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let n=0;this._emitReady=()=>{n++,n>=this._readyCount&&(this._emitReady=ve,this._readyEmitted=!0,process.nextTick(()=>this.emit(_.READY)))},this._emitRaw=(...l)=>this.emit(_.RAW,...l),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new we(this),Object.freeze(r)}_addIgnoredPath(e){if(Ye(e)){for(let t of this._ignoredPaths)if(Ye(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),typeof e=="string")for(let t of this._ignoredPaths)Ye(t)&&t.path===e&&this._ignoredPaths.delete(t)}add(e,t,i){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let o=Qt(e);return r&&(o=o.map(a=>lr(a,r))),o.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let n=await this._nodeFsHandler._addToNodeFs(a,!i,void 0,0,t);return n&&this._emitReady(),n})).then(a=>{this.closed||a.forEach(n=>{n&&this.add(y.dirname(n),y.basename(t||n))})}),this}unwatch(e){if(this.closed)return this;let t=Qt(e),{cwd:i}=this.options;return t.forEach(r=>{!y.isAbsolute(r)&&!this._closers.has(r)&&(i&&(r=y.join(i,r)),r=y.resolve(r)),this._closePath(r),this._addIgnoredPath(r),this._watched.has(r)&&this._addIgnoredPath({path:r,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(t=>t.forEach(i=>{let r=i();r instanceof Promise&&e.push(r)})),this._streams.forEach(t=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(t=>t.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((t,i)=>{let o=(this.options.cwd?y.relative(this.options.cwd,i):i)||is;e[o]=t.getChildren().sort()}),e}emitWithAll(e,t){this.emit(e,...t),e!==_.ERROR&&this.emit(_.ALL,e,...t)}async _emit(e,t,i){if(this.closed)return;let r=this.options;Je&&(t=y.normalize(t)),r.cwd&&(t=y.relative(r.cwd,t));let o=[t];i!=null&&o.push(i);let a=r.awaitWriteFinish,n;if(a&&(n=this._pendingWrites.get(t)))return n.lastChange=new Date,this;if(r.atomic){if(e===_.UNLINK)return this._pendingUnlinks.set(t,[e,...o]),setTimeout(()=>{this._pendingUnlinks.forEach((l,f)=>{this.emit(...l),this.emit(_.ALL,...l),this._pendingUnlinks.delete(f)})},typeof r.atomic=="number"?r.atomic:100),this;e===_.ADD&&this._pendingUnlinks.has(t)&&(e=_.CHANGE,this._pendingUnlinks.delete(t))}if(a&&(e===_.ADD||e===_.CHANGE)&&this._readyEmitted){let l=(f,c)=>{f?(e=_.ERROR,o[0]=f,this.emitWithAll(e,o)):c&&(o.length>1?o[1]=c:o.push(c),this.emitWithAll(e,o))};return this._awaitWriteFinish(t,a.stabilityThreshold,e,l),this}if(e===_.CHANGE&&!this._throttle(_.CHANGE,t,50))return this;if(r.alwaysStat&&i===void 0&&(e===_.ADD||e===_.ADD_DIR||e===_.CHANGE)){let l=r.cwd?y.join(r.cwd,t):t,f;try{f=await(0,Pe.stat)(l)}catch{}if(!f||this.closed)return;o.push(f)}return this.emitWithAll(e,o),this}_handleError(e){let t=e&&e.code;return e&&t!=="ENOENT"&&t!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||t!=="EPERM"&&t!=="EACCES")&&this.emit(_.ERROR,e),e||this.closed}_throttle(e,t,i){this._throttled.has(e)||this._throttled.set(e,new Map);let r=this._throttled.get(e);if(!r)throw new Error("invalid throttle");let o=r.get(t);if(o)return o.count++,!1;let a,n=()=>{let f=r.get(t),c=f?f.count:0;return r.delete(t),clearTimeout(a),f&&clearTimeout(f.timeoutObject),c};a=setTimeout(n,i);let l={timeoutObject:a,clear:n,count:0};return r.set(t,l),l}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,t,i,r){let o=this.options.awaitWriteFinish;if(typeof o!="object")return;let a=o.pollInterval,n,l=e;this.options.cwd&&!y.isAbsolute(e)&&(l=y.join(this.options.cwd,e));let f=new Date,c=this._pendingWrites;function m(u){(0,ts.stat)(l,(b,C)=>{if(b||!c.has(e)){b&&b.code!=="ENOENT"&&r(b);return}let E=Number(new Date);u&&C.size!==u.size&&(c.get(e).lastChange=E);let O=c.get(e);E-O.lastChange>=t?(c.delete(e),r(void 0,C)):n=setTimeout(m,a,C)})}c.has(e)||(c.set(e,{lastChange:f,cancelWait:()=>(c.delete(e),clearTimeout(n),i)}),n=setTimeout(m,a))}_isIgnored(e,t){if(this.options.atomic&&ir.test(e))return!0;if(!this._userIgnored){let{cwd:i}=this.options,o=(this.options.ignored||[]).map(es(i)),n=[...[...this._ignoredPaths].map(es(i)),...o];this._userIgnored=ar(n,void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new Xe(e,this.options.followSymlinks,this)}_getWatchedDir(e){let t=y.resolve(e);return this._watched.has(t)||this._watched.set(t,new qe(t,this._boundRemove)),this._watched.get(t)}_hasReadPermissions(e){return this.options.ignorePermissionErrors?!0:!!(Number(e.mode)&256)}_remove(e,t,i){let r=y.join(e,t),o=y.resolve(r);if(i=i??(this._watched.has(r)||this._watched.has(o)),!this._throttle("remove",r,100))return;!i&&this._watched.size===1&&this.add(e,t,!0),this._getWatchedDir(r).getChildren().forEach(u=>this._remove(r,u));let l=this._getWatchedDir(e),f=l.has(t);l.remove(t),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let c=r;if(this.options.cwd&&(c=y.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(c)&&this._pendingWrites.get(c).cancelWait()===_.ADD)return;this._watched.delete(r),this._watched.delete(o);let m=i?_.UNLINK_DIR:_.UNLINK;f&&!this._isIgnored(r)&&this._emit(m,r),this._closePath(r)}_closePath(e){this._closeFile(e);let t=y.dirname(e);this._getWatchedDir(t).remove(y.basename(e))}_closeFile(e){let t=this._closers.get(e);t&&(t.forEach(i=>i()),this._closers.delete(e))}_addPathCloser(e,t){if(!t)return;let i=this._closers.get(e);i||(i=[],this._closers.set(e,i)),i.push(t)}_readdirp(e,t){if(this.closed)return;let i={type:_.ALL,alwaysStat:!0,lstat:!0,...t,depth:0},r=Wt(e,i);return this._streams.add(r),r.once(Jt,()=>{r=void 0}),r.once(Be,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};os={watch:fr,FSWatcher:Ee}});var k,ur,G,mr,dr,gr,Ke,_e,yr,wr,Q,Qe,vr,Ze,Z,x,ee=w(()=>{"use strict";p();k=d(require("chalk"),1),ur=k.default.hex("#1abc9c"),G=k.default.hex("#16a085"),mr=k.default.hex("#2ecc71"),dr=k.default.hex("#27ae60"),gr=k.default.hex("#e74c3c"),Ke=k.default.hex("#c0392b"),_e=k.default.hex("#f1c40f"),yr=k.default.hex("#f39c12"),wr=k.default.hex("#3498db"),Q=k.default.hex("#2980b9"),Qe=k.default.hex("#ecf0f1"),vr=k.default.hex("#fd79a8"),Ze=k.default.hex("#e84393"),Z=k.default.hex("#7f8c8d"),x={lightGreen:ur,green:G,lightCyan:mr,cyan:dr,lightRed:gr,red:Ke,yellow:_e,orange:yr,lightBlue:wr,blue:Q,white:Qe,lightMagenta:vr,magenta:Ze,gray:Z}});var as,oe,h,L=w(()=>{"use strict";p();ee();as=!1,oe=class{brandName="";fullName="";logLevel=as?"debug":"info";isLogTime=as;setup({brandName:e,logLevel:t,fullName:i}){this.brandName=` [${e}] `,this.fullName=` ${i} `,this.fullName=x.green.bold(this.fullName),t&&(this.logLevel=t)}time=(...e)=>this.isLogTime&&console.time(...e);timeEnd=(...e)=>this.isLogTime&&console.timeEnd(...e);debug=(...e)=>["debug"].includes(this.logLevel)&&console.log(...e);info=(...e)=>["debug","info"].includes(this.logLevel)&&console.log(...e);warn=(...e)=>["debug","info","warn"].includes(this.logLevel)&&console.warn(...e);error=(...e)=>["debug","info","warn","error"].includes(this.logLevel)&&console.error(...e);blue=e=>{console.log(`${x.lightBlue(this.brandName)}${x.blue(` ${e} `)}
2
2
  `)};cyan=e=>{console.log(`${x.lightCyan(this.brandName)}${x.cyan(` ${e} `)}
3
3
  `)};magenta=e=>{console.log(`${x.lightMagenta(this.brandName)}${x.magenta(` ${e} `)}
4
4
  `)};green=e=>{console.log(`${x.lightGreen(this.brandName)}${x.green(` ${e} `)}
@@ -8,7 +8,7 @@
8
8
  `)};link=e=>x.blue(e);title=e=>{console.log(`${this.fullName}${x.yellow.underline(`${e}`)}
9
9
  `)}},h=new oe});var it={};X(it,{clearConsole:()=>tt,deepAssign:()=>T,ensureArray:()=>br,getLanIp:()=>q,getPkgVersion:()=>et,importJsVm:()=>st,jsonFilter:()=>Cr,timeFormat:()=>Se,vCompare:()=>xe});function tt(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function T(s,...e){for(let t of e)for(let i in t){let r=t[i],o=s[i];if(Object(r)==r&&Object(o)===o){s[i]=T(o,r);continue}s[i]=t[i]}return s}var ls,cs,ps,hs,q,et,br,Cr,xe,Se,st,I=w(()=>{"use strict";p();ls=require("address"),cs=d(require("chalk"),1),ps=require("default-gateway"),hs=d(require("fs-extra"),1),q=()=>{let s="127.0.0.1";try{let{int:e}=(0,ps.gateway4sync)();return(0,ls.ip)(e||"")||s}catch{return s}},et=s=>{try{let{version:e}=hs.default.readJSONSync(s);return e}catch{return}};br=s=>Array.isArray(s)?s:[s],Cr=(s={},e=[])=>Object.keys(s).filter(t=>!e.includes(t)).reduce((t,i)=>(t[i]=s[i],t),{}),xe=(s="",e="")=>{let t=s.replace("^","").split("."),i=e.replace("^","").split("."),r=Math.max(t.length,i.length),o=0;for(let a=0;a<r;a++){let n=t.length>a?t[a]:0,l=isNaN(Number(n))?n.charCodeAt():Number(n),f=i.length>a?i[a]:0,c=isNaN(Number(f))?f.charCodeAt():Number(f);if(l<c){o=-1;break}else if(l>c){o=1;break}}return o},Se=s=>{s=s/1e3;let e=i=>cs.default.bold(i);if(s<1)return`${s*1e3} ms`;if(s<10){let i=s>=.01?2:3;return`${e(s.toFixed(i))} s`}if(s<60)return`${e(s.toFixed(1))} s`;let t=s/60;return`${e(t.toFixed(2))} m`},st=s=>`data:text/javascript,${s}`});var rt={};X(rt,{chalk:()=>fs.default,color:()=>x,glob:()=>ne.glob,logger:()=>h,utils:()=>it});var fs,ne,te=w(()=>{"use strict";p();fs=d(require("chalk"),1),ne=require("glob");ee();L();I()});var ot,us,nt,Er,ms,ds,gs,ys,ke=w(()=>{"use strict";p();ot=d(require("fs"),1),us=require("jiti"),nt=d(require("path"),1);$();ze();L();Er=["emp-config.ts","emp-config.js","emp.config.ts","emp.config.js","emp-config.mjs","emp-config.cjs","emp-config.mts","emp-config.cts","emp.config.mjs","emp.config.cjs","emp.config.mts","emp.config.cts"],ms=(0,us.createJiti)(__filename,{interopDefault:!0,fsCache:!0,moduleCache:!0,cacheVersion:me.version}),ds=async()=>{let s="store.getEmpConfigPath";h.time(s);let e=Er.map(r=>nt.default.resolve(g.root,r)),t=await Promise.all(e.map(r=>ot.default.promises.access(r).then(()=>!0,()=>!1))),i=e.find((r,o)=>t[o]);return h.timeEnd(s),i},gs=async()=>{let s=nt.default.join(g.root,"tsconfig.json");return await ot.default.promises.access(s).then(()=>!0,()=>!1)||(s=void 0),s},ys=()=>{let s=[__filename];return g.rootPaths.pkg&&s.push(g.rootPaths.pkg),g.rootPaths.empConfig&&s.push(g.rootPaths.empConfig),g.rootPaths.tsConfig&&s.push(g.rootPaths.tsConfig),s}});var at,ws,lt=w(()=>{"use strict";p();at=d(require("@empjs/chain"),1),ws={rule:{mjs:"mjs",typescript:"typescript",javascript:"javascript",sourceMap:"sourceMapLoader",inline:"inline",raw:"raw",svg:"svg",image:"image",font:"fonts",svga:"svga",sass:"sass",less:"less",css:"css"},use:{swc:"swc",sourceMap:"sourceMapLoader",sass:"sassLoader",less:"lessLoader"},plugin:{tsCheckerRspackPlugin:"TsCheckerRspackPlugin",bundleAnalyzer:"bundleAnalyzerPlugin",define:"definePlugin",copy:"copyRspackPlugin",progress:"progressPlugin",html:{prefix:"html-plugin-"},rsdoctor:"rsdoctor",sourceMapDevTool:"sourceMapDevTool"},minimizer:{minJs:"minJs",minCss:"minCss"}}});var Oe,vs=w(()=>{"use strict";p();Oe=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){this.op.beforePlugin&&await this.op.beforePlugin()}async afterPlugin(){this.op.afterPlugin&&await this.op.afterPlugin()}async beforeModule(){this.op.beforeModule&&await this.op.beforeModule()}async afterModule(){this.op.afterModule&&await this.op.afterModule()}async beforeEmpPlugin(){this.op.beforeEmpPlugin&&await this.op.beforeEmpPlugin()}async afterEmpPlugin(){this.op.afterEmpPlugin&&await this.op.afterEmpPlugin()}async beforeBuild(){this.op.beforeBuild&&await this.op.beforeBuild()}async afterBulid(){this.op.afterBulid&&await this.op.afterBulid()}async beforeDevServe(){this.op.beforeDevServe&&await this.op.beforeDevServe()}async afterDevServe(){this.op.afterDevServe&&await this.op.afterDevServe()}async beforeServe(){this.op.beforeServe&&await this.op.beforeServe()}async afterServe(){this.op.afterServe&&await this.op.afterServe()}}});var ct,bs,Cs=w(()=>{"use strict";p();te();ke();I();vs();ct=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},T(e,t)}isESM=!1;checkIsESM(e){return["es3","es5"].indexOf(e)===-1}lifeCycle;async setup(e){this.store=e,await this.syncEmpOptions(),await this.setupEmpOptions(),this.lifeCycle=new Oe(this.store.empOptions.lifeCycle),await this.lifeCycle.afterGetEmpOptions(),this.isESM=this.checkIsESM(this.build.target),this.store.empOptions.target?(this.target=this.store.empOptions.target,Array.isArray(this.target)&&!this.target.includes(this.build.target)&&this.target.push(this.build.target)):this.target=["web",this.build.target];let{appSrc:t,base:i,appEntry:r}=this.store.empOptions;t&&(this.appSrc=t),i&&(this.base=i),r&&(this.appEntry=r)}async setupEmpOptions(){await this.store.server.setupOnEmpOptionSync()}async chain(){this.store.empOptions.chain&&await this.store.empOptions.chain(this.store.chain)}async plugins(){let e=[];this.store.empOptions.plugins&&Array.isArray(this.store.empOptions.plugins)&&this.store.empOptions.plugins.length>0&&(this.store.empOptions.plugins.map(t=>{e.push(t.rsConfig(this.store))}),await Promise.all(e))}get debug(){let e=!1;return this.store.cliOptions.doctor&&(e={}),this.assign({loggerLevel:"info",clearLog:!0,progress:!0,showRsconfig:!1,showPerformance:!1,rsdoctor:e,infrastructureLogging:{appendOnly:!0,level:"warn"},newTreeshaking:this.store.empConfig.isESM,devShowAllLog:!1,showScriptDebug:!1,cssChunkingPlugin:!0,warnRuleAsWarning:!0},this.store.empOptions.debug)}get build(){let e=this.store.empOptions.build?.staticDir?`${this.store.empOptions.build?.staticDir}/`:"",t={js:this.store.isDev?"cheap-module-source-map":"source-map",css:!1};return this.store.empOptions.build?.sourcemap===!0&&(t.css=!0,t.js=this.store.isDev?"cheap-module-source-map":"source-map"),this.store.empOptions.build?.devtool&&(t.js=this.store.empOptions.build?.devtool),this.assign({outDir:"dist",staticDir:e,assetsDir:"assets",publicDir:"public",chunkIds:this.store.isDev?"named":"deterministic",moduleIds:this.store.isDev?"named":"deterministic",sourcemap:t,minify:!this.store.isDev,minOptions:{},cssminOptions:{},target:"es5",polyfill:{mode:void 0,entryCdn:void 0,splitChunks:!1,include:[],coreJsFeatures:"stable",externalHelpers:!1,browserslist:this.store.browserslistOptions.default},swcConfig:{},devtool:this.store.isDev?"cheap-module-source-map":"source-map"},{...this.store.empOptions.build,staticDir:e})}get html(){let e=this.store.empOptions.html?.template?{}:{charset:{charset:"utf-8"},"http-equiv":{"http-equiv":"X-UA-Compatible",content:"IE=edge"},viewport:{name:"viewport",content:"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"},keywords:{keywords:""},description:{description:""}};return this.assign({lang:"zh-CN",title:"EMP",inject:"body",minify:!this.store.isDev,scriptLoading:this.isESM?"module":"defer",meta:e,cache:this.cache!==!1,tags:[]},this.store.empOptions.html)}get entries(){return this.store.empOptions.entries?this.store.empOptions.entries:{}}get server(){let e={host:"0.0.0.0",port:8e3,open:process.platform==="darwin",hot:!0,watchFiles:["src/**/*.html"],static:[{directory:this.store.publicDir,watch:this.store.isDev}],allowedHosts:["all"],historyApiFallback:!0,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":"X-Requested-With, content-type, Authorization"}};return this.store.empOptions.server?.http2&&(this.store.server.httpsType="h2",delete this.store.empOptions.server.http2),this.assign(e,this.store.empOptions.server)}get css(){return this.assign({sass:{mode:"modern",warnRuleAsWarning:this.store.empConfig.debug.warnRuleAsWarning},less:{lessOptions:{javascriptEnabled:!0,math:"always"}},prifixName:""},this.store.empOptions.css)}get output(){let e=(this.store.isDev,".[contenthash:8]"),t=this.store.isDev?"":".[contenthash:8]",{assetsDir:i,staticDir:r}=this.store.empConfig.build,o={publicPath:this.store.empConfig.base?this.store.empConfig.base:"auto",crossOriginLoading:"anonymous",filename:`${r}js/[name]${e}.js`,cssFilename:`${r}css/[name]${t}.css`,cssChunkFilename:`${r}css/[name]${t}.css`,assetModuleFilename:`${r}${i}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!this.store.isDev,uniqueName:this.store.uniqueName};return this.assign(o,this.store.empOptions.output)}get define(){let e={mode:this.store.mode,env:this.store.cliOptions.env};return this.store.empOptions.define&&(e={...e,...this.store.empOptions.define}),this.setDefine(e)}get tsCheckerRspackPlugin(){let e={};if(this.store.empOptions.tsCheckerRspackPlugin)typeof this.store.empOptions.tsCheckerRspackPlugin=="object"&&(e=this.store.empOptions.tsCheckerRspackPlugin);else return!1;return this.assign({},e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",i={};return Object.keys(e).map(r=>{t==="all"?(i[`import.meta.env.${r}`]=JSON.stringify(e[r]),i[`process.env.${r}`]=JSON.stringify(e[r])):t==="esm"?i[`import.meta.env.${r}`]=JSON.stringify(e[r]):t==="cjs"?i[`process.env.${r}`]=JSON.stringify(e[r]):t==="none"&&(i[`${r}`]=JSON.stringify(e[r]))}),i}get externals(){return this.assign({},this.store.empOptions.externals)}get resolve(){return T({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="store.jiti.loadConfig.empConfig";if(h.time(e),!this.store.rootPaths.empConfig)return;let{default:t}=await ms(this.store.rootPaths.empConfig);typeof t=="function"?this.store.empOptions=await t(this.store):this.store.empOptions=t||{},h.timeEnd(e)}get moduleTransformRule(){let{moduleTransform:e}=this.store.empOptions,t=this.assign({defaultExclude:!1},e),i={and:[],not:[]};return t.defaultExclude===!0&&i.and.push(/(node_modules|bower_components)/),t?.exclude&&(i.and=i.and.concat(t.exclude)),e?.include&&(i.not=t.include),i}get cacheDir(){return this.store.empOptions.cacheDir?this.store.empOptions.cacheDir:"node_modules/.emp-cache"}get cache(){return this.store.empOptions.cache===!1?!1:this.store.empOptions.cache?this.store.empOptions.cache:"persistent"}get ignoreWarnings(){return this.store.empOptions.ignoreWarnings?this.store.empOptions.ignoreWarnings:[/Conflicting order/]}get autoPages(){let e;return this.store.empOptions.autoPages&&(e=typeof this.store.empOptions.autoPages=="boolean"?{}:this.store.empOptions.autoPages,e=this.assign({path:"pages"},e)),e}},bs=new ct});var Es,pt,Ps,_s=w(()=>{"use strict";p();Es=d(require("fs-extra"),1);ke();pt=class{store;async setup(e){this.store=e;let t=[this.common(),this.stats(),this.devServer(),this.optimization(),this.checkTsconfig()];await Promise.all(t)}get cache(){if(this.store.empConfig.cache===!1)return!1;let e={type:this.store.empConfig.cache==="persistent"?"persistent":"memory",buildDependencies:ys(),version:this.store.empConfig.server.port?`${this.store.empPkg.version}_${this.store.empConfig.server.port}`:this.store.empPkg.version};return typeof this.store.empConfig.cache=="object"&&(e=this.store.deepAssign(e,this.store.empConfig.cache)),e}get name(){let e=this.store.empConfig.server.port?`_${this.store.empConfig.server.port}`:"";return this.store.pkg.name+e}async common(){this.store.merge({name:this.name,node:{global:!0},experiments:{nativeWatcher:!0,lazyBarrel:!0,inlineConst:!0,inlineEnum:!0,typeReexportsPresence:!0,outputModule:this.store.empConfig.isESM,topLevelAwait:!0,asyncWebAssembly:!0,css:!0,rspackFuture:{bundlerInfo:{force:!1}},cache:this.cache,incremental:"advance-silent",parallelLoader:!0},lazyCompilation:this.store.isDev,target:this.store.empConfig.target,infrastructureLogging:this.store.empConfig.debug.infrastructureLogging,context:this.store.root,mode:this.store.mode,cache:!!this.store.empConfig.cache,devtool:this.store.empConfig.build.sourcemap.js,output:this.store.empConfig.output,resolve:this.store.empConfig.resolve,externals:this.store.empConfig.externals,ignoreWarnings:this.store.empConfig.ignoreWarnings,watchOptions:{ignored:["**/node_modules/**","**/@mf-types/**"]}})}async checkTsconfig(){let e=this.store.resolve("tsconfig.json");if(await Es.default.exists(e)){let i={};this.store.isOldRspack?i.tsConfigPath=e:i.tsConfig=e,this.store.merge({resolve:i})}}async stats(){this.store.merge({stats:{colors:!0,all:!1,assets:!1,chunks:!1,timings:!0,version:!0}})}async devServer(){this.store.merge({devServer:this.store.empConfig.server})}async optimization(){let e={moduleIds:this.store.empConfig.build.moduleIds,chunkIds:this.store.empConfig.build.chunkIds,minimize:this.store.empConfig.build.minify,splitChunks:{chunks:"all",minSize:2e4,minChunks:1,automaticNameDelimiter:"-",cacheGroups:{vendors:{test:/[\\/]node_modules[\\/]/,name:"vendor",priority:-10,reuseExistingChunk:!0},default:{minChunks:2,priority:-20,reuseExistingChunk:!0}}}};this.store.empConfig.build.polyfill.mode==="entry"&&this.store.empConfig.build.polyfill.splitChunks&&!this.store.empConfig.build.polyfill.entryCdn&&(e.splitChunks.cacheGroups.coreJs={test:/[\\/]node_modules[\\/](core-js)[\\/]/,name:"coreJs",chunks:"all",enforce:!0}),this.store.chain.merge({optimization:e})}},Ps=new pt});var ht,xs,Ss=w(()=>{"use strict";p();ht=class{store;async setup(e){this.store=e;let t=[this.sass(),this.less(),this.css()];await Promise.all(t)}async sass(){let{rule:e,use:t}=this.store.chainName,i={},{sass:r}=this.store.empConfig.css;r.mode==="modern"&&(i.implementation=r.implementation?r.implementation:require.resolve("sass-embedded"),i.api="modern-compiler",i.sourceMap=this.store.empConfig.build.sourcemap.css,r.sassOptions&&(i.sassOptions=r.sassOptions)),typeof r.additionalData<"u"&&(i.additionalData=r.additionalData),typeof r.warnRuleAsWarning<"u"&&(i.warnRuleAsWarning=r.warnRuleAsWarning),typeof r.webpackImporter<"u"&&(i.webpackImporter=r.webpackImporter),this.store.chain.merge({module:{rule:{[e.sass]:{test:/\.(sass|scss)$/,use:{[t.sass]:{loader:require.resolve("sass-loader"),options:i}},type:"css/auto"}}}})}async less(){let{rule:e,use:t}=this.store.chainName,{lessOptions:i}=this.store.empConfig.css.less,r={loader:require.resolve("less-loader"),options:{lessOptions:i}};this.store.chain.merge({module:{rule:{[e.less]:{test:/\.less$/,use:{[t.less]:r},type:"css/auto"}}}})}async css(){let{rule:e}=this.store.chainName;this.store.chain.merge({module:{rule:{[e.css]:{test:/\.css$/,use:{},type:"css/auto"}}}})}},xs=new ht});function Pr(){let s=[`import 'core-js/${g.empConfig.build.polyfill.coreJsFeatures}'`].join(`
10
10
  `);return st(s)}var Te,De,ae,Re=w(()=>{"use strict";p();Te=d(require("html-webpack-plugin"),1);I();$();De=class{constructor(){}apply(e){let{webpack:t}=e;g.empConfig.build.polyfill.entryCdn||new t.EntryPlugin(e.context,Pr(),{name:void 0}).apply(e)}},ae=class{PluginName="HtmlEmpInjectPlugin";chunk="";files=[];constructor(e,t="",i=""){this.PluginName=`${this.PluginName}-${t}`,this.files=e,this.chunk=i}apply(e){e.hooks.compilation.tap(this.PluginName,t=>{Te.default.getHooks(t).alterAssetTagGroups.tapPromise(this.PluginName,async i=>(this.chunk&&!i.plugin.userOptions.chunks?.includes(this.chunk)||this.files.map(r=>{let{pos:o,...a}=r;(o==="body"?i.bodyTags:i.headTags).push({attributes:{},voidTag:!1,meta:{plugin:void 0},tagName:"script",...a})}),i))})}}});var R,ft,ks,Os=w(()=>{"use strict";p();R=d(require("path"),1);te();Re();ft=class{store;entriesConfig={};async setup(e){this.store=e,await this.init(),this.toConfig()}setHtmlConfig(e,t){return e.template=this.setTemplate(e.template),e.favicon=this.setFavicion(e.favicon),e.chunks=t,e.filename=`${t[0]}.html`,this.store.empConfig.base&&(e.publicPath=this.store.empConfig.base),this.prepareAndSetAsset(e),e}prepareAndSetAsset(e){let t=e.chunks?e.chunks[0]:void 0;this.store.injectTags(e.tags,t?`injectTags-${t}`:"injectTags",t),delete e.tags}injectPolyfill(){if(!this.store.empConfig.build.polyfill.entryCdn)return;let e=[{attributes:{src:this.store.empConfig.build.polyfill.entryCdn},tagName:"script",pos:"head"}];this.store.injectTags(e,"injectEMPPolyfill")}setChunk(e){return e.replace(R.default.extname(e),"").replace(`${this.store.empConfig.appSrc}${R.default.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(R.default.join("template","index.html"))}setFavicion(e){if(e!=="")return e?this.store.resolve(e):this.store.empResolve(R.default.join("template","favicon.ico"))}setEntryItem(e,t,i){i=i||this.store.resolve(R.default.join(this.store.empConfig.appSrc,e));let r=this.setChunk(e),o=[i];this.entriesConfig[r]={entry:{[r]:o},html:this.setHtmlConfig(t,[r])},this.store.entries[r]=o}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`${this.store.chainName.plugin.html.prefix}${t}`).use(Te.default,[e])}setRspackEntry(e){this.store.merge({entry:e})}async init(){this.injectPolyfill(),this.store.empConfig.autoPages?await this.setAutoPage():(await this.setDefaultEntry(),this.setEntryByConfig())}async setAutoPage(){h.time("setAutoPage");let e=this.store.empConfig.autoPages?.path||"pages",t=R.default.join(this.store.appSrc,e),i=R.default.join(t,"**","*.{ts,tsx,jsx,js}"),r=await(0,ne.glob)([i],{windowsPathsNoEscape:!0});r=r.map(o=>o.replace(`${t}${R.default.sep}`,"")),r.map(o=>{let a=this.store.empConfig.entries[o]||{};this.setEntryItem(o,{...this.store.empConfig.html,...a},R.default.join(t,o))}),h.timeEnd("setAutoPage")}async setDefaultEntry(){let e="store.empConfig.setDefaultEntry";h.time(e);let t=R.default.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}"),i=await(0,ne.glob)([t],{windowsPathsNoEscape:!0});if(i[0]){let r=R.default.join(this.store.empConfig.appSrc,Object.keys(this.store.empConfig.entries).length>0&&this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index");this.setEntryItem(r,this.store.empConfig.html,i[0])}h.timeEnd(e)}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)}},ks=new ft});var ut,mt,Ds,Ts=w(()=>{"use strict";p();ut=d(require("path"),1);I();mt=class{store;swcJsOptions={};swcTsOptions={};coreJs={version:"3",alias:"",path:""};async setup(e){this.store=e,this.swcInitOptions(),await this.run()}async run(){let e=[this.jsDataUrl(),this.files(),this.scripts(),this.rspackGenerator(),this.rspackParser()];await this.store.empConfig.lifeCycle.beforeModule(),await Promise.all(e),await this.store.empConfig.lifeCycle.afterModule()}rspackGenerator(){let e=this.store.empConfig.css?.prifixName?`${this.store.empConfig.css?.prifixName}-`:"",t=this.store.isDev?`${e}[id]-[local]-[hash:base64:8]`:`${e}[local]-[hash:5]`;this.store.chain.merge({module:{generator:{"css/auto":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:t,esModule:!0},css:{exportsOnly:!1,esModule:!0},"css/module":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:t,esModule:!0},json:{JSONParse:!0}}}})}rspackParser(){this.store.chain.merge({module:{parser:{javascript:{dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,url:!0,importMeta:!0},css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return!!this.store.empConfig.build.polyfill.mode}swcParser(e){switch(e){case"js":return{syntax:"ecmascript",jsx:!0,decorators:!0,decoratorsBeforeExport:!1};case"ts":return{syntax:"typescript",decorators:!0,tsx:!0,dynamicImport:!0}}}swcJsc(e){let{target:t,polyfill:i}=this.store.empConfig.build,{externalHelpers:r}=i;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:r,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:T(this.swcJsc(e),{...this.store.empConfig.build.swcConfig}),isModule:"unknown"};return this.isPolyfill&&(delete t.jsc.target,t.env={coreJs:this.swcCoreVersion,targets:this.store.empConfig.build.polyfill.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill.mode),this.store.empConfig.build.polyfill.mode==="usage"&&(t.env.shippedProposals=!0,t.env.include=this.store.empConfig.build.polyfill.include)),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build.polyfill;e&&this.store.chain.resolve.alias.set("@swc/helpers",ut.default.dirname(require.resolve("@swc/helpers/package.json"))),this.coreJs.path=require.resolve("core-js/package.json");let t=et(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=ut.default.dirname(this.coreJs.path),this.store.empConfig.build.polyfill.mode&&(this.store.chain.resolve.alias.set("core-js",this.coreJs.alias),this.store.chain.module.rule("javascript").exclude.add(/core-js/),this.store.chain.module.rule("typescript").exclude.add(/core-js/)),this.swcTsOptions=this.swcOptions("ts"),this.swcJsOptions=this.swcOptions("js")}jsDataUrl(){this.store.chain.module.rule("jsDataUrl").merge({mimetype:{or:["text/javascript","application/javascript"]}}).resolve.set("fullySpecified",!1).end().use("swcJsParser").loader("builtin:swc-loader").options(this.swcJsOptions)}async scripts(){let e=[],{rule:t,use:i}=this.store.chainName;this.store.chain.merge({module:{parser:{javascript:{exportsPresence:"error",importExportsPresence:"error"}},rule:{[t.mjs]:{test:/\.m?js/,resolve:{fullySpecified:!1}},[t.typescript]:{test:/\.(ts|tsx)$/,exclude:e,use:{[i.swc]:{loader:"builtin:swc-loader",options:this.swcTsOptions}}},[t.javascript]:{test:/\.((m|c)?js|jsx)$/,exclude:e,use:{[i.swc]:{loader:"builtin:swc-loader",options:this.swcJsOptions}}}}}})}async files(){let{rule:e}=this.store.chainName;this.store.chain.merge({module:{rule:{[e.svg]:{test:/\.svg$/,type:"asset/resource"}}}}),this.store.chain.merge({module:{rule:{[e.inline]:{resourceQuery:/inline/,type:"asset/inline"}}}}),this.store.chain.merge({module:{rule:{[e.raw]:{resourceQuery:/raw/,type:"asset/source"}}}}),this.store.chain.merge({module:{rule:{[e.image]:{test:/\.(png|jpe?g|gif|webp|ico)$/i,type:"asset/resource"},[e.font]:{test:/\.(|otf|ttf|eot|woff|woff2)$/i,type:"asset/resource"},[e.svga]:{test:/\.(svga)$/i,type:"asset/resource"}}}})}},Ds=new mt});var H,dt,Rs,gt,js,As=w(()=>{"use strict";p();H=d(require("@rspack/core"),1),dt=d(require("fs"),1),Rs=require("ts-checker-rspack-plugin");Re();gt=class{store;async setup(e){this.store=e;let t=[this.define(),this.anylayze(),this.progress(),this.copy(),this.minify(),this.redoctor(),this.sourceMapDevToolPlugin(),this.tsCheckerRspackPlugin(),this.cssChunkingPlugin()];this.beforeLifeCycle(),await this.store.empConfig.lifeCycle.beforePlugin(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterPlugin()}beforeLifeCycle(){let{store:e}=this;e.empConfig.build.polyfill.mode==="entry"&&e.chain.plugin("empPolyfill").use(De)}async anylayze(){if(!this.store.cliOptions.analyze)return;let{default:{BundleAnalyzerPlugin:e}}=await import("webpack-bundle-analyzer");this.store.chain.plugin(this.store.chainName.plugin.bundleAnalyzer).use(e,[{analyzerPort:this.store.empConfig.server.port,defaultSizes:"gzip",analyzerHost:this.store.getLanIp()||"127.0.0.1"}])}tsCheckerRspackPlugin(){if(this.store.empConfig.tsCheckerRspackPlugin===!1)return!1;this.store.chain.plugin(this.store.chainName.plugin.tsCheckerRspackPlugin).use(Rs.TsCheckerRspackPlugin,[this.store.empConfig.tsCheckerRspackPlugin])}async define(){this.store.chain.plugin(this.store.chainName.plugin.define).use(H.default.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");dt.default.existsSync(e)&&dt.default.readdirSync(e).length>0&&this.store.chain.plugin(this.store.chainName.plugin.copy).use(H.default.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve(this.store.empConfig.build.outDir),noErrorOnMissing:!0,globOptions:{ignore:["**/.DS_Store"]}}]}])}async progress(){if(this.store.mode==="development")return;let e={};this.store.isOldRspack||(e={template:"{bar:25.green/white}{spinner:.green}{percent}% {wide_msg:.dim}",tick:void 0,progressChars:"\u25A9\u25A9"}),this.store.chain.plugin(this.store.chainName.plugin.progress).use(H.default.ProgressPlugin,[e])}minify(){this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minJs).use(H.default.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]);let{SwcCssMinimizerRspackPlugin:e,LightningCssMinimizerRspackPlugin:t}=H.default;e?this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(e,[this.store.empConfig.build.cssminOptions]):t&&this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(t,[this.store.empConfig.build.cssminOptions])}redoctor(){if(!this.store.empConfig.debug.rsdoctor)return;let{RsdoctorRspackPlugin:e}=require("@rsdoctor/rspack-plugin"),t={};typeof this.store.empConfig.debug.rsdoctor=="object"&&(t=this.store.empConfig.debug.rsdoctor),this.store.chain.plugin(this.store.chainName.plugin.rsdoctor).use(e,[t])}sourceMapDevToolPlugin(){typeof this.store.empConfig.build.sourcemap=="object"&&this.store.empConfig.build.sourcemap?.devToolPluginOptions&&this.store.chain.plugin(this.store.chainName.plugin.sourceMapDevTool).use(H.default.SourceMapDevToolPlugin,[this.store.empConfig.build.sourcemap.devToolPluginOptions])}circularDependency(){this.store.chain.plugin("circularDependency").use(H.default.CircularDependencyRspackPlugin,[{}])}cssChunkingPlugin(){this.store.empConfig.debug.cssChunkingPlugin&&this.store.chain.plugin("CssChunkingPlugin").use(H.default.experiments.CssChunkingPlugin,[{}])}},js=new gt});var yt,Ns,Fs=w(()=>{"use strict";p();_s();Ss();Os();Ts();As();yt=class{store;async setup(e){this.store=e;let t=[Ps.setup(this.store),Ds.setup(this.store),js.setup(this.store),ks.setup(this.store),xs.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()}},Ns=new yt});async function je(s,e=void 0){if(s!==_r&&(s<Ls||s>wt))throw new Error(`Port number must lie between ${Ls} and ${wt}`);let t=s,i=xr(),r;e&&!i.has(e)?r=new Set([e]):r=i;let o=new Set(["EADDRINUSE","EACCES"]);for(;t<=wt;)try{return await kr(t,r)}catch(a){if(!o.has(a.code))throw a;t+=1}throw new Error("No available ports found")}var Is,$s,Ls,wt,_r,xr,Sr,kr,Ms=w(()=>{"use strict";p();Is=d(require("net"),1),$s=d(require("os"),1),Ls=1024,wt=65535,_r=443,xr=()=>{let s=$s.default.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(s))if(t)for(let i of t)e.add(i.address);return e},Sr=(s,e)=>new Promise((t,i)=>{let r=Is.default.createServer();r.unref(),r.on("error",i),r.listen(s,e,()=>{let{port:o}=r.address();r.close(()=>{t(o)})})}),kr=async(s,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let i of e)try{await Sr(s,i)}catch(r){if(!t.has(r.code))throw r}return s}});var zs,vt,bt,Ae,Hs=w(()=>{"use strict";p();zs=d(require("chalk"),1);ee();vt=d(require("url"),1);I();bt=class{imf={protocol:"",port:8e3,pathname:"/"};host="0.0.0.0";urls={lanUrlForConfig:"",lanUrlForTerminal:Z("unavailable"),localUrlForTerminal:"",localUrlForBrowser:""};setup(e){e.host&&(this.host=e.host),e.protocol&&(this.imf.protocol=e.protocol),e.pathname&&(this.imf.pathname=e.pathname),e.port&&(this.imf.port=e.port),this.setupUrls()}setupUrls(){let{host:e}=this,t=e==="0.0.0.0"||e==="::",i;if(t){i="localhost";try{this.urls.lanUrlForConfig=this.getLanIp(),this.urls.lanUrlForConfig&&(/^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(this.urls.lanUrlForConfig)?this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig):this.urls.lanUrlForConfig="")}catch{}}else i=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(i),this.urls.localUrlForBrowser=this.formatUrl(i)}getLanIp=q;formatUrl(e){let{protocol:t,port:i,pathname:r}=this.imf;return vt.default.format({protocol:t,hostname:e,port:i,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:i,pathname:r}=this.imf;return vt.default.format({protocol:t,hostname:e,port:zs.default.bold(i),pathname:r})}},Ae=new bt});var Gs,Us,Bs,Ws,Or,Dr,Js,Vs=w(()=>{"use strict";p();Gs=require("child_process"),Us=require("util");$();L();Bs=(0,Us.promisify)(Gs.exec),Ws=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],Or=async()=>{let s=process.env.BROWSER;if(!s||!Ws.includes(s)){let{stdout:e}=await Bs("ps cax");s=Ws.find(t=>e.includes(t))}return s},Dr=async s=>{if(process.platform==="darwin")try{let t=await Or();if(t){let i=`osascript openChrome.applescript "${encodeURI(s)}" "${t}"`;return await Bs(i,{cwd:g.resource.dir}),!0}}catch(t){h.debug(t)}try{let{default:t}=await import("open");return await t(s),!0}catch(t){return h.error("Failed to open start URL."),h.error(t),!1}},Js=Dr});var Ct,Ne,Ys=w(()=>{"use strict";p();Ct=d(require("fs/promises"),1);te();ee();Ms();Hs();Vs();I();Ne=class{ip=q();host=this.ip;isAutoDevBase=!1;isHttps=!1;httpsType="default";protocol="http";port=8e3;store;publicPath="/";publicHasHttp=!1;isOpenBrower=!1;url="";urls={localUrlForBrowser:"",localUrlForTerminal:"",lanUrlForTerminal:"",lanUrlForConfig:""};constructor(e){this.store=e}async setupOnEmpOptionSync(){this.store.cliAction!=="build"&&(this.port=await je(this.port),this.setHttps(),await this.setAutoDevBase())}get config(){return{}}async setupOnStore(){if(this.store.cliAction==="build")return;let{store:e}=this;this.publicPath=e.rsConfig.output?.publicPath==="auto"?"/":e.rsConfig.output?.publicPath||"/",this.isOpenBrower=!!e.empConfig.server.open,this.protocol=this.isHttps?"https":"http",this.host=e.empConfig.server.host?e.empConfig.server.host:this.ip,e.empConfig.server.port&&e.empConfig.server.port!==this.port&&(this.port=await je(e.empConfig.server.port)),Ae.setup(this),this.publicPath&&(this.publicPath.indexOf("http://")>-1||this.publicPath.indexOf("https://")>-1)?(this.url=this.publicPath,this.publicHasHttp=!0,this.urls.localUrlForTerminal=Ae.prettyPrintUrl("localhost")):(this.urls=Ae.urls,this.url=this.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this;this.publicHasHttp?(h.info(`${G("\u279C")} Local: ${h.link(e.localUrlForTerminal)}`),h.info(`${G("\u279C")} Network: ${h.link(this.publicPath)}`)):(h.info(`${G("\u279C")} Local: ${h.link(e.localUrlForTerminal)}`),h.info(`${G("\u279C")} Network: ${h.link(e.lanUrlForTerminal)}
11
- `)),this.isOpenBrower&&Js(this.url)}async getcert(){let{store:e}=this,t=this.store.rsConfig.devServer||{server:{type:"http"}};if(typeof t.server=="object"&&t.server.type==="https"&&t.server.options&&t.server.options.key&&t.server.options.cert)return t.server.options;let[i,r]=await Promise.all([Ct.default.readFile(e.resource.key),Ct.default.readFile(e.resource.cert)]);return{key:i,cert:r}}setHttps(){let{store:e}=this,{server:t,https:i}=e.empOptions.server||{};this.isHttps=t==="https"||typeof t=="object"&&t.type==="https"||i===!0}async setAutoDevBase(){let{store:e}=this;this.isAutoDevBase=!!e.empOptions.autoDevBase&&e.mode==="development"&&!this.isHttpBase,this.isAutoDevBase&&(this.protocol=this.isHttps?"https":"http",e.empOptions.server?.port&&(this.port=e.empOptions.server.port),this.port=await je(this.port),e.empOptions.base=`${this.protocol}://${this.host}:${this.port}/`,e.empOptions.server=e.deepAssign({port:this.port,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${this.host}:${this.port}/ws`}},e.empOptions.server))}get isHttpBase(){let e=this.store.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}}});var qs,j,Xs,Et,Pt,g,$=w(()=>{"use strict";p();qs=d(require("fs/promises"),1),j=d(require("path"),1),Xs=d(require("util"),1),Et=require("@rspack/core");ke();L();I();lt();Cs();Fs();Ys();lt();Re();Pt=class{rspack=Et.rspack;rspackVersion=Et.rspack.rspackVersion;isOldRspack=xe(this.rspackVersion,"1.0.0")===-1;empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=j.default.resolve(__dirname,__filename).replace(`${j.default.sep}dist${j.default.sep}index.js`,"");empSource=j.default.resolve(this.empRoot,"dist");resolve=e=>j.default.isAbsolute(e)?e:j.default.resolve(this.root,e);empResolve=e=>j.default.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};chainName=ws;server=new Ne(this);cacheDir="";mode="development";cliMode="dev";isDev=!0;chain;rsConfig;empOptions={};empConfig;entries={};debug;cliAction;cliOptions;rootPaths={empConfig:void 0,tsConfig:void 0,pkg:void 0};beforeSetup;afterSetup;async setup(e,t){this.cliAction=e||this.cliAction,this.cliOptions=t||this.cliOptions;let i="store.setup";h.time(i),this.beforeSetup&&await this.beforeSetup();let[r,o]=await Promise.all([ds(),gs()]);this.rootPaths.empConfig=r,this.rootPaths.tsConfig=o,this.rootPaths.pkg=this.resolve("package.json"),await this.initVars(this.cliAction,this.cliOptions),this.empConfig=bs,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new at.default,await Ns.setup(this),this.setLogger(),this.toConfig(),this.logConfig(),await this.server.setupOnStore(),this.afterSetup&&await this.afterSetup(),h.timeEnd(i),this.debug.clearLog&&tt()}async initVars(e,t){this.cliAction=e,this.cliOptions=t||{},this.cliMode="prod",this.mode=e==="dev"?"development":"production",this.isDev=this.mode==="development",process.env.NODE_ENV=e==="dev"?"development":"production";let i=require(this.empResolve("package.json")),r=require(this.resolve("package.json"));this.empPkg={...this.empPkg,...i},this.pkg={...this.pkg,...r},this.resource.dir=j.default.join(this.empRoot,"resource"),this.resource.cert=j.default.join(this.resource.dir,"emp.cert"),this.resource.key=j.default.join(this.resource.dir,"emp.key")}initPaths(){this.appSrc=this.resolve(this.empConfig.appSrc),this.outDir=this.resolve(this.empConfig.build.outDir),this.publicDir=this.resolve(this.empConfig.build.publicDir),this.cacheDir=this.resolve(this.empConfig.cacheDir)}loggerExtensionName="";setLoggerExtensionName(e){this.loggerExtensionName=e}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),h.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}${this.loggerExtensionName?" "+this.loggerExtensionName:""}`,brandName:"EMP",logLevel:e})}merge(e){this.chain.merge(e)}toConfig(){this.rsConfig=this.chain.toConfig()}logConfig(){if(this.debug.showRsconfig)if(typeof this.debug.showRsconfig=="string"){let e=j.default.join(this.root,this.debug.showRsconfig);qs.default.writeFile(e,JSON.stringify(this.rsConfig,null,2))}else{this.debug.clearLog=!1;let e={colors:!0,depth:null},t=typeof this.debug.showRsconfig=="object"?T(e,this.debug.showRsconfig):e;console.log(h.link("[Compile Config]")),console.log(Xs.default.inspect(this.rsConfig,t))}}get browserslistOptions(){return{default:["chrome >= 87","edge >= 88","firefox >= 78","safari >= 14"],h5:["iOS >= 9","Android >= 4.4","last 2 versions","> 0.2%","not dead"],node:["node >= 16"]}}get uniqueName(){return this.encodeVarName(this.pkg.name)}encodeVarName(e){return e.replaceAll("/","_").replaceAll("@","_").replaceAll("-","_")}vCompare=xe;deepAssign=T;getLanIp=q;injectTags(e=[],t="",i=""){this.chain.plugin(`${ae}-${t}`).use(ae,[e,t,i])}},g=new Pt});function Lr(s,e){let t=[s,e],i=["File","Size","Gzipped"].reduce((r,o,a)=>{let n=t[a],l=o;return n&&(l=o.length<n?o+" ".repeat(n-o.length):o),`${r+l} `}," ");console.log(Q.bold(i))}async function Zs(s){let e=s.toJson({all:!1,assets:!0,timings:!0}),i=e.assets.filter(c=>Ar(c.name)).map(Fr);i.sort((c,m)=>c.size-m.size);let r=Math.max(...i.map(c=>c.sizeLabel.length)),o=Math.max(...i.map(c=>(c.folder+W.default.sep+c.name).length));Lr(o,r);let a=0,n=0;i.forEach(c=>{let{sizeLabel:m}=c,{name:u,folder:b,gzipSizeLabel:C}=c,E=(b+W.default.sep+u).length,O=m.length;if(a+=c.size,n+=c.gzippedSize,O<r){let A=" ".repeat(r-O);m+=A}let S=Z(c.folder+W.default.sep)+Ir(c.name);if(E<o){let A=" ".repeat(o-E);S+=A}h.info(` ${S} ${Z(m)} ${C}`)});let l=`${Q.bold("Total size:")} ${Fe(a)}`,f=`${Q.bold("Gzipped size:")} ${Fe(n)}`;h.info(`
11
+ `)),this.isOpenBrower&&Js(this.url)}async getcert(){let{store:e}=this,t=this.store.rsConfig.devServer||{server:{type:"http"}};if(typeof t.server=="object"&&t.server.type==="https"&&t.server.options&&t.server.options.key&&t.server.options.cert)return t.server.options;let[i,r]=await Promise.all([Ct.default.readFile(e.resource.key),Ct.default.readFile(e.resource.cert)]);return{key:i,cert:r}}setHttps(){let{store:e}=this,{server:t,https:i}=e.empOptions.server||{};this.isHttps=t==="https"||typeof t=="object"&&t.type==="https"||i===!0}async setAutoDevBase(){let{store:e}=this;this.isAutoDevBase=!!e.empOptions.autoDevBase&&e.mode==="development"&&!this.isHttpBase,this.isAutoDevBase&&(this.protocol=this.isHttps?"https":"http",e.empOptions.server?.port&&(this.port=e.empOptions.server.port),this.port=await je(this.port),e.empOptions.base=`${this.protocol}://${this.host}:${this.port}/`,e.empOptions.server=e.deepAssign({port:this.port,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${this.host}:${this.port}/ws`}},e.empOptions.server))}get isHttpBase(){let e=this.store.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}}});var qs,j,Xs,Et,Pt,g,$=w(()=>{"use strict";p();qs=d(require("fs/promises"),1),j=d(require("path"),1),Xs=d(require("util"),1),Et=require("@rspack/core");ke();L();I();lt();Cs();Fs();Ys();lt();Re();Pt=class{rspack=Et.rspack;rspackVersion=Et.rspack.rspackVersion;isOldRspack=xe(this.rspackVersion,"1.0.0")===-1;empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=j.default.resolve(__dirname,__filename).replace(`${j.default.sep}dist${j.default.sep}index.js`,"");empSource=j.default.resolve(this.empRoot,"dist");resolve=e=>j.default.isAbsolute(e)?e:j.default.resolve(this.root,e);empResolve=e=>j.default.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};chainName=ws;server=new Ne(this);cacheDir="";mode="development";cliMode="dev";isDev=!0;chain;rsConfig;empOptions={};empConfig;entries={};debug;cliAction;cliOptions;rootPaths={empConfig:void 0,tsConfig:void 0,pkg:void 0};async setup(e,t){this.cliAction=e||this.cliAction,this.cliOptions=t||this.cliOptions;let i="store.setup";h.time(i);let[r,o]=await Promise.all([ds(),gs()]);this.rootPaths.empConfig=r,this.rootPaths.tsConfig=o,this.rootPaths.pkg=this.resolve("package.json"),await this.initVars(this.cliAction,this.cliOptions),this.empConfig=bs,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new at.default,await Ns.setup(this),this.setLogger(),this.toConfig(),this.logConfig(),await this.server.setupOnStore(),h.timeEnd(i),this.debug.clearLog&&tt()}async initVars(e,t){this.cliAction=e,this.cliOptions=t||{},this.cliMode="prod",this.mode=e==="dev"?"development":"production",this.isDev=this.mode==="development",process.env.NODE_ENV=e==="dev"?"development":"production";let i=require(this.empResolve("package.json")),r=require(this.resolve("package.json"));this.empPkg={...this.empPkg,...i},this.pkg={...this.pkg,...r},this.resource.dir=j.default.join(this.empRoot,"resource"),this.resource.cert=j.default.join(this.resource.dir,"emp.cert"),this.resource.key=j.default.join(this.resource.dir,"emp.key")}initPaths(){this.appSrc=this.resolve(this.empConfig.appSrc),this.outDir=this.resolve(this.empConfig.build.outDir),this.publicDir=this.resolve(this.empConfig.build.publicDir),this.cacheDir=this.resolve(this.empConfig.cacheDir)}loggerExtensionName="";setLoggerExtensionName(e){this.loggerExtensionName=e}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),h.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}${this.loggerExtensionName?" "+this.loggerExtensionName:""}`,brandName:"EMP",logLevel:e})}merge(e){this.chain.merge(e)}toConfig(){this.rsConfig=this.chain.toConfig()}logConfig(){if(this.debug.showRsconfig)if(typeof this.debug.showRsconfig=="string"){let e=j.default.join(this.root,this.debug.showRsconfig);qs.default.writeFile(e,JSON.stringify(this.rsConfig,null,2))}else{this.debug.clearLog=!1;let e={colors:!0,depth:null},t=typeof this.debug.showRsconfig=="object"?T(e,this.debug.showRsconfig):e;console.log(h.link("[Compile Config]")),console.log(Xs.default.inspect(this.rsConfig,t))}}get browserslistOptions(){return{default:["chrome >= 87","edge >= 88","firefox >= 78","safari >= 14"],h5:["iOS >= 9","Android >= 4.4","last 2 versions","> 0.2%","not dead"],node:["node >= 16"]}}get uniqueName(){return this.encodeVarName(this.pkg.name)}encodeVarName(e){return e.replaceAll("/","_").replaceAll("@","_").replaceAll("-","_")}vCompare=xe;deepAssign=T;getLanIp=q;injectTags(e=[],t="",i=""){this.chain.plugin(`${ae}-${t}`).use(ae,[e,t,i])}},g=new Pt});function Lr(s,e){let t=[s,e],i=["File","Size","Gzipped"].reduce((r,o,a)=>{let n=t[a],l=o;return n&&(l=o.length<n?o+" ".repeat(n-o.length):o),`${r+l} `}," ");console.log(Q.bold(i))}async function Zs(s){let e=s.toJson({all:!1,assets:!0,timings:!0}),i=e.assets.filter(c=>Ar(c.name)).map(Fr);i.sort((c,m)=>c.size-m.size);let r=Math.max(...i.map(c=>c.sizeLabel.length)),o=Math.max(...i.map(c=>(c.folder+W.default.sep+c.name).length));Lr(o,r);let a=0,n=0;i.forEach(c=>{let{sizeLabel:m}=c,{name:u,folder:b,gzipSizeLabel:C}=c,E=(b+W.default.sep+u).length,O=m.length;if(a+=c.size,n+=c.gzippedSize,O<r){let A=" ".repeat(r-O);m+=A}let S=Z(c.folder+W.default.sep)+Ir(c.name);if(E<o){let A=" ".repeat(o-E);S+=A}h.info(` ${S} ${Z(m)} ${C}`)});let l=`${Q.bold("Total size:")} ${Fe(a)}`,f=`${Q.bold("Gzipped size:")} ${Fe(n)}`;h.info(`
12
12
  ${l}
13
13
  ${f}
14
14
  `),h.info(`${U.default.green("ready ")}Built in ${Se(Number(e.time))}
package/dist/index.d.cts CHANGED
@@ -359,8 +359,6 @@ declare class GlobalStore {
359
359
  cliAction: CliActionType;
360
360
  cliOptions: CliOptionsType;
361
361
  rootPaths: StoreRootPaths;
362
- beforeSetup?: () => Promise<void> | void;
363
- afterSetup?: () => Promise<void> | void;
364
362
  setup(cliAction?: CliActionType, cliOptions?: any): Promise<void>;
365
363
  /**
366
364
  * 初始化 基础变量
package/dist/index.d.ts CHANGED
@@ -359,8 +359,6 @@ declare class GlobalStore {
359
359
  cliAction: CliActionType;
360
360
  cliOptions: CliOptionsType;
361
361
  rootPaths: StoreRootPaths;
362
- beforeSetup?: () => Promise<void> | void;
363
- afterSetup?: () => Promise<void> | void;
364
362
  setup(cliAction?: CliActionType, cliOptions?: any): Promise<void>;
365
363
  /**
366
364
  * 初始化 基础变量
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {createRequire as __createRequire} from 'module';var require=__createRequire(import.meta.url);
2
- var Vs=Object.defineProperty;var k=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var v=(s,e)=>()=>(s&&(e=s(s=0)),e);var Z=(s,e)=>{for(var t in e)Vs(s,t,{get:e[t],enumerable:!0})};import Ys from"path";import{fileURLToPath as qs}from"url";var vt,Xs,w,g,p=v(()=>{"use strict";vt=()=>qs(import.meta.url),Xs=()=>Ys.dirname(vt()),w=Xs(),g=vt()});var ae,Ae=v(()=>{ae={name:"@empjs/cli",version:"3.10.8-1",description:"emp",license:"MIT",type:"module",files:["dist","bin","resource","template","types","tsconfig"],maintainers:["xuhongbin","ckken","doerme"],repository:{type:"git",url:"git+https://github.com/empjs/emp.git",directory:"packages/cli"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},keywords:["rspack","rust","typescript"],bin:{emp:"./bin/emp.js"},main:"dist/index.js",types:"dist/index.d.ts",exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.js"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}},"./emp-tsconfig.json":{default:"./tsconfig/react.json"},"./tsconfig/base":{default:"./tsconfig/base.json"},"./tsconfig/react":{default:"./tsconfig/react.json"},"./tsconfig/vue":{default:"./tsconfig/vue.json"},"./client":{types:"./types/react/index.d.ts",default:"./types/react/index.d.ts"},"./types/base":{types:"./types/base/index.d.ts",default:"./types/base/index.d.ts"},"./types/vue":{types:"./types/vue/index.d.ts",default:"./types/vue/index.d.ts"},"./types/react":{types:"./types/react/index.d.ts",default:"./types/react/index.d.ts"}},scripts:{dev:"tsup --watch --env.ENV dev",build:"tsup --env.ENV prod","dev-rs":"rslib build --watch --env-mode development","build-rs":"rslib build --env-mode production",ph:"pnpm publish --no-git-checks"},engines:{node:">=18.0.0"},author:"Ken",devDependencies:{"@types/compression":"^1.7.2","@types/connect":"^3.4.38","@types/cors":"^2.8.12","@types/default-gateway":"^7.2.1","@types/fs-extra":"^11.0.4","@types/react":"^18.3.2","@types/serve-static":"^1.15.8","@types/watchpack":"^2.4.3","@types/webpack":"^5.28.4","@types/webpack-bundle-analyzer":"^4.6.2","@types/webpack-sources":"^3.2.2",chokidar:"^4.0.3",vue:"^3.5.21"},dependencies:{"@empjs/chain":"workspace:*","@rsdoctor/rspack-plugin":"1.3.16","@rspack/core":"1.6.8","@rspack/dev-server":"1.1.4","@swc/helpers":"^0.5.17","@vue/tsconfig":"^0.8.1",address:"^2.0.2",chalk:"^5.3.0",commander:"11.1.0",compression:"1.8.1",connect:"3.7.0","core-js":"^3.41.0",cors:"2.8.5","default-gateway":"7.2.2","fs-extra":"11.3.1",glob:"11.0.3","gzip-size":"7.0.0","html-webpack-plugin":"5.6.4",jiti:"2.6.1","less-loader":"^12.2.0",open:"10.2.0","sass-embedded":"1.93.2","sass-loader":"16.0.5","serve-static":"2.2.0","ts-checker-rspack-plugin":"1.1.6","typescript-plugin-css-modules":"5.2.0","webpack-bundle-analyzer":"4.10.2"}}});import{stat as Qs,lstat as bt,readdir as Zs,realpath as ei}from"fs/promises";import{Readable as ti}from"stream";import{resolve as Ct,relative as si,join as ii,sep as ri}from"path";function St(s,e={}){let t=e.entryType||e.type;if(t==="both"&&(t=T.FILE_DIR_TYPE),t&&(e.type=t),s){if(typeof s!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(t&&!Et.includes(t))throw new Error(`readdirp: Invalid type passed. Use one of ${Et.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=s,new Fe(e)}var T,Ne,_t,oi,Et,ni,ai,li,ci,Pt,xt,Fe,kt=v(()=>{"use strict";p();T={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},Ne={root:".",fileFilter:s=>!0,directoryFilter:s=>!0,type:T.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(Ne);_t="READDIRP_RECURSIVE_ERROR",oi=new Set(["ENOENT","EPERM","EACCES","ELOOP",_t]),Et=[T.DIR_TYPE,T.EVERYTHING_TYPE,T.FILE_DIR_TYPE,T.FILE_TYPE],ni=new Set([T.DIR_TYPE,T.EVERYTHING_TYPE,T.FILE_DIR_TYPE]),ai=new Set([T.EVERYTHING_TYPE,T.FILE_DIR_TYPE,T.FILE_TYPE]),li=s=>oi.has(s.code),ci=process.platform==="win32",Pt=s=>!0,xt=s=>{if(s===void 0)return Pt;if(typeof s=="function")return s;if(typeof s=="string"){let e=s.trim();return t=>t.basename===e}if(Array.isArray(s)){let e=s.map(t=>t.trim());return t=>e.some(i=>t.basename===i)}return Pt},Fe=class extends ti{constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={...Ne,...e},{root:i,type:r}=t;this._fileFilter=xt(t.fileFilter),this._directoryFilter=xt(t.directoryFilter);let o=t.lstat?bt:Qs;ci?this._stat=a=>o(a,{bigint:!0}):this._stat=o,this._maxDepth=t.depth??Ne.depth,this._wantsDir=r?ni.has(r):!1,this._wantsFile=r?ai.has(r):!1,this._wantsEverything=r===T.EVERYTHING_TYPE,this._root=Ct(i),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(i,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let t=this.parent,i=t&&t.files;if(i&&i.length>0){let{path:r,depth:o}=t,a=i.splice(0,e).map(l=>this._formatEntry(l,r)),n=await Promise.all(a);for(let l of n){if(!l)continue;if(this.destroyed)return;let f=await this._getEntryType(l);f==="directory"&&this._directoryFilter(l)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(l.fullPath,o+1)),this._wantsDir&&(this.push(l),e--)):(f==="file"||this._includeAsFile(l))&&this._fileFilter(l)&&this._wantsFile&&(this.push(l),e--)}}else{let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}}async _exploreDir(e,t){let i;try{i=await Zs(e,this._rdOptions)}catch(r){this._onError(r)}return{files:i,depth:t,path:e}}async _formatEntry(e,t){let i,r=this._isDirent?e.name:e;try{let o=Ct(ii(t,r));i={path:si(this._root,o),fullPath:o,basename:r},i[this._statsProp]=this._isDirent?e:await this._stat(o)}catch(o){this._onError(o);return}return i}_onError(e){li(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return"";let t=e[this._statsProp];if(t.isFile())return"file";if(t.isDirectory())return"directory";if(t&&t.isSymbolicLink()){let i=e.fullPath;try{let r=await ei(i),o=await bt(r);if(o.isFile())return"file";if(o.isDirectory()){let a=r.length;if(i.startsWith(r)&&i.substr(a,1)===ri){let n=new Error(`Circular symlink detected: "${i}" points to "${r}"`);return n.code=_t,this._onError(n)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}}});import{watchFile as pi,unwatchFile as Ot,watch as hi}from"fs";import{open as fi,stat as Tt,lstat as ui,realpath as Le}from"fs/promises";import*as P from"path";import{type as mi}from"os";function Dt(s,e,t,i,r){let o=(a,n)=>{t(s),r(a,n,{watchedPath:s}),n&&s!==n&&pe(P.resolve(s,n),G,P.join(s,n))};try{return hi(s,{persistent:e.persistent},o)}catch(a){i(a);return}}var di,Me,Rt,fe,ue,ze,gi,yi,wi,jt,x,A,vi,bi,G,le,V,Ci,Ei,Pi,$e,ee,xi,te,At,ce,pe,_i,Ie,Si,he,Nt=v(()=>{"use strict";p();di="data",Me="end",Rt="close",fe=()=>{},ue=process.platform,ze=ue==="win32",gi=ue==="darwin",yi=ue==="linux",wi=ue==="freebsd",jt=mi()==="OS400",x={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},A=x,vi="watch",bi={lstat:ui,stat:Tt},G="listeners",le="errHandlers",V="rawEmitters",Ci=[G,le,V],Ei=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),Pi=s=>Ei.has(P.extname(s).slice(1).toLowerCase()),$e=(s,e)=>{s instanceof Set?s.forEach(e):e(s)},ee=(s,e,t)=>{let i=s[e];i instanceof Set||(s[e]=i=new Set([i])),i.add(t)},xi=s=>e=>{let t=s[e];t instanceof Set?t.clear():delete s[e]},te=(s,e,t)=>{let i=s[e];i instanceof Set?i.delete(t):i===t&&delete s[e]},At=s=>s instanceof Set?s.size===0:!s,ce=new Map;pe=(s,e,t,i,r)=>{let o=ce.get(s);o&&$e(o[e],a=>{a(t,i,r)})},_i=(s,e,t,i)=>{let{listener:r,errHandler:o,rawEmitter:a}=i,n=ce.get(e),l;if(!t.persistent)return l=Dt(s,t,r,o,a),l?l.close.bind(l):void 0;if(n)ee(n,G,r),ee(n,le,o),ee(n,V,a);else{if(l=Dt(s,t,pe.bind(null,e,G),o,pe.bind(null,e,V)),!l)return;l.on(A.ERROR,async f=>{let c=pe.bind(null,e,le);if(n&&(n.watcherUnusable=!0),ze&&f.code==="EPERM")try{await(await fi(s,"r")).close(),c(f)}catch{}else c(f)}),n={listeners:r,errHandlers:o,rawEmitters:a,watcher:l},ce.set(e,n)}return()=>{te(n,G,r),te(n,le,o),te(n,V,a),At(n.listeners)&&(n.watcher.close(),ce.delete(e),Ci.forEach(xi(n)),n.watcher=void 0,Object.freeze(n))}},Ie=new Map,Si=(s,e,t,i)=>{let{listener:r,rawEmitter:o}=i,a=Ie.get(e),n=a&&a.options;return n&&(n.persistent<t.persistent||n.interval>t.interval)&&(Ot(e),a=void 0),a?(ee(a,G,r),ee(a,V,o)):(a={listeners:r,rawEmitters:o,options:t,watcher:pi(e,t,(l,f)=>{$e(a.rawEmitters,m=>{m(A.CHANGE,e,{curr:l,prev:f})});let c=l.mtimeMs;(l.size!==f.size||c>f.mtimeMs||c===0)&&$e(a.listeners,m=>m(s,l))})},Ie.set(e,a)),()=>{te(a,G,r),te(a,V,o),At(a.listeners)&&(Ie.delete(e),Ot(e),a.options=a.watcher=void 0,Object.freeze(a))}},he=class{constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(e,t){let i=this.fsw.options,r=P.dirname(e),o=P.basename(e);this.fsw._getWatchedDir(r).add(o);let n=P.resolve(e),l={persistent:i.persistent};t||(t=fe);let f;if(i.usePolling){let c=i.interval!==i.binaryInterval;l.interval=c&&Pi(o)?i.binaryInterval:i.interval,f=Si(e,n,l,{listener:t,rawEmitter:this.fsw._emitRaw})}else f=_i(e,n,l,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return f}_handleFile(e,t,i){if(this.fsw.closed)return;let r=P.dirname(e),o=P.basename(e),a=this.fsw._getWatchedDir(r),n=t;if(a.has(o))return;let l=async(c,m)=>{if(this.fsw._throttle(vi,e,5)){if(!m||m.mtimeMs===0)try{let u=await Tt(e);if(this.fsw.closed)return;let b=u.atimeMs,C=u.mtimeMs;if((!b||b<=C||C!==n.mtimeMs)&&this.fsw._emit(A.CHANGE,e,u),(gi||yi||wi)&&n.ino!==u.ino){this.fsw._closeFile(c),n=u;let E=this._watchWithNodeFs(e,l);E&&this.fsw._addPathCloser(c,E)}else n=u}catch{this.fsw._remove(r,o)}else if(a.has(o)){let u=m.atimeMs,b=m.mtimeMs;(!u||u<=b||b!==n.mtimeMs)&&this.fsw._emit(A.CHANGE,e,m),n=m}}},f=this._watchWithNodeFs(e,l);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(A.ADD,e,0))return;this.fsw._emit(A.ADD,e,t)}return f}async _handleSymlink(e,t,i,r){if(this.fsw.closed)return;let o=e.fullPath,a=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let n;try{n=await Le(i)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(a.has(r)?this.fsw._symlinkPaths.get(o)!==n&&(this.fsw._symlinkPaths.set(o,n),this.fsw._emit(A.CHANGE,i,e.stats)):(a.add(r),this.fsw._symlinkPaths.set(o,n),this.fsw._emit(A.ADD,i,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(o))return!0;this.fsw._symlinkPaths.set(o,!0)}_handleRead(e,t,i,r,o,a,n){if(e=P.join(e,""),n=this.fsw._throttle("readdir",e,1e3),!n)return;let l=this.fsw._getWatchedDir(i.path),f=new Set,c=this.fsw._readdirp(e,{fileFilter:m=>i.filterPath(m),directoryFilter:m=>i.filterDir(m)});if(c)return c.on(di,async m=>{if(this.fsw.closed){c=void 0;return}let u=m.path,b=P.join(e,u);if(f.add(u),!(m.stats.isSymbolicLink()&&await this._handleSymlink(m,e,b,u))){if(this.fsw.closed){c=void 0;return}(u===r||!r&&!l.has(u))&&(this.fsw._incrReadyCount(),b=P.join(o,P.relative(o,b)),this._addToNodeFs(b,t,i,a+1))}}).on(A.ERROR,this._boundHandleError),new Promise((m,u)=>{if(!c)return u();c.once(Me,()=>{if(this.fsw.closed){c=void 0;return}let b=n?n.clear():!1;m(void 0),l.getChildren().filter(C=>C!==e&&!f.has(C)).forEach(C=>{this.fsw._remove(e,C)}),c=void 0,b&&this._handleRead(e,!1,i,r,o,a,n)})})}async _handleDir(e,t,i,r,o,a,n){let l=this.fsw._getWatchedDir(P.dirname(e)),f=l.has(P.basename(e));!(i&&this.fsw.options.ignoreInitial)&&!o&&!f&&this.fsw._emit(A.ADD_DIR,e,t),l.add(P.basename(e)),this.fsw._getWatchedDir(e);let c,m,u=this.fsw.options.depth;if((u==null||r<=u)&&!this.fsw._symlinkPaths.has(n)){if(!o&&(await this._handleRead(e,i,a,o,e,r,c),this.fsw.closed))return;m=this._watchWithNodeFs(e,(b,C)=>{C&&C.mtimeMs===0||this._handleRead(b,!1,a,o,e,r,c)})}return m}async _addToNodeFs(e,t,i,r,o){let a=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return a(),!1;let n=this.fsw._getWatchHelpers(e);i&&(n.filterPath=l=>i.filterPath(l),n.filterDir=l=>i.filterDir(l));try{let l=await bi[n.statMethod](n.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(n.watchPath,l))return a(),!1;let f=this.fsw.options.followSymlinks,c;if(l.isDirectory()){let m=P.resolve(e),u=f?await Le(e):e;if(this.fsw.closed||(c=await this._handleDir(n.watchPath,l,t,r,o,n,u),this.fsw.closed))return;m!==u&&u!==void 0&&this.fsw._symlinkPaths.set(m,u)}else if(l.isSymbolicLink()){let m=f?await Le(e):e;if(this.fsw.closed)return;let u=P.dirname(n.watchPath);if(this.fsw._getWatchedDir(u).add(n.watchPath),this.fsw._emit(A.ADD,n.watchPath,l),c=await this._handleDir(u,l,t,r,e,n,m),this.fsw.closed)return;m!==void 0&&this.fsw._symlinkPaths.set(P.resolve(e),m)}else c=this._handleFile(n.watchPath,l,t);return a(),c&&this.fsw._addPathCloser(e,c),!1}catch(l){if(this.fsw._handleError(l))return a(),e}}}});import{stat as ki}from"fs";import{stat as Oi,readdir as Di}from"fs/promises";import{EventEmitter as Ti}from"events";import*as y from"path";function me(s){return Array.isArray(s)?s:[s]}function Ii(s){return typeof s=="function"?s:typeof s=="string"?e=>s===e:s instanceof RegExp?e=>s.test(e):typeof s=="object"&&s!==null?e=>{if(s.path===e)return!0;if(s.recursive){let t=y.relative(s.path,e);return t?!t.startsWith("..")&&!y.isAbsolute(t):!1}return!1}:()=>!1}function $i(s){if(typeof s!="string")throw new Error("string expected");s=y.normalize(s),s=s.replace(/\\/g,"/");let e=!1;s.startsWith("//")&&(e=!0);let t=/\/\//;for(;s.match(t);)s=s.replace(t,"/");return e&&(s="/"+s),s}function Lt(s,e,t){let i=$i(e);for(let r=0;r<s.length;r++){let o=s[r];if(o(i,t))return!0}return!1}function Mi(s,e){if(s==null)throw new TypeError("anymatch: specify first argument");let i=me(s).map(r=>Ii(r));return e==null?(r,o)=>Lt(i,r,o):Lt(i,e)}function Ui(s,e={}){let t=new de(e);return t.add(s),t}var He,Ri,zt,ji,Ai,Ni,Ft,Fi,Li,We,It,$t,Ht,Mt,zi,Hi,Ge,Wi,Gi,Ue,de,Wt,Gt=v(()=>{"use strict";p();kt();Nt();He="/",Ri="//",zt=".",ji="..",Ai="string",Ni=/\\/g,Ft=/\/\//,Fi=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,Li=/^\.[/\\]/;We=s=>typeof s=="object"&&s!==null&&!(s instanceof RegExp);It=s=>{let e=me(s).flat();if(!e.every(t=>typeof t===Ai))throw new TypeError(`Non-string provided as watch path: ${e}`);return e.map(Ht)},$t=s=>{let e=s.replace(Ni,He),t=!1;for(e.startsWith(Ri)&&(t=!0);e.match(Ft);)e=e.replace(Ft,He);return t&&(e=He+e),e},Ht=s=>$t(y.normalize($t(s))),Mt=(s="")=>e=>typeof e=="string"?Ht(y.isAbsolute(e)?e:y.join(s,e)):e,zi=(s,e)=>y.isAbsolute(s)?s:y.join(e,s),Hi=Object.freeze(new Set),Ge=class{constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;t&&e!==zt&&e!==ji&&t.add(e)}async remove(e){let{items:t}=this;if(!t||(t.delete(e),t.size>0))return;let i=this.path;try{await Di(i)}catch{this._removeWatcher&&this._removeWatcher(y.dirname(i),y.basename(i))}}has(e){let{items:t}=this;if(t)return t.has(e)}getChildren(){let{items:e}=this;return e?[...e.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=fe,this.items=Hi,Object.freeze(this)}},Wi="stat",Gi="lstat",Ue=class{constructor(e,t,i){this.fsw=i;let r=e;this.path=e=e.replace(Li,""),this.watchPath=r,this.fullWatchPath=y.resolve(r),this.dirParts=[],this.dirParts.forEach(o=>{o.length>1&&o.pop()}),this.followSymlinks=t,this.statMethod=t?Wi:Gi}entryPath(e){return y.join(this.watchPath,y.relative(this.watchPath,e.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let i=this.entryPath(e);return this.fsw._isntIgnored(i,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}},de=class extends Ti{constructor(e={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},r={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?me(e.ignored):me([]),awaitWriteFinish:t===!0?i:typeof t=="object"?{...i,...t}:!1};jt&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let o=process.env.CHOKIDAR_USEPOLLING;if(o!==void 0){let l=o.toLowerCase();l==="false"||l==="0"?r.usePolling=!1:l==="true"||l==="1"?r.usePolling=!0:r.usePolling=!!l}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let n=0;this._emitReady=()=>{n++,n>=this._readyCount&&(this._emitReady=fe,this._readyEmitted=!0,process.nextTick(()=>this.emit(x.READY)))},this._emitRaw=(...l)=>this.emit(x.RAW,...l),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new he(this),Object.freeze(r)}_addIgnoredPath(e){if(We(e)){for(let t of this._ignoredPaths)if(We(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),typeof e=="string")for(let t of this._ignoredPaths)We(t)&&t.path===e&&this._ignoredPaths.delete(t)}add(e,t,i){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let o=It(e);return r&&(o=o.map(a=>zi(a,r))),o.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let n=await this._nodeFsHandler._addToNodeFs(a,!i,void 0,0,t);return n&&this._emitReady(),n})).then(a=>{this.closed||a.forEach(n=>{n&&this.add(y.dirname(n),y.basename(t||n))})}),this}unwatch(e){if(this.closed)return this;let t=It(e),{cwd:i}=this.options;return t.forEach(r=>{!y.isAbsolute(r)&&!this._closers.has(r)&&(i&&(r=y.join(i,r)),r=y.resolve(r)),this._closePath(r),this._addIgnoredPath(r),this._watched.has(r)&&this._addIgnoredPath({path:r,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(t=>t.forEach(i=>{let r=i();r instanceof Promise&&e.push(r)})),this._streams.forEach(t=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(t=>t.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((t,i)=>{let o=(this.options.cwd?y.relative(this.options.cwd,i):i)||zt;e[o]=t.getChildren().sort()}),e}emitWithAll(e,t){this.emit(e,...t),e!==x.ERROR&&this.emit(x.ALL,e,...t)}async _emit(e,t,i){if(this.closed)return;let r=this.options;ze&&(t=y.normalize(t)),r.cwd&&(t=y.relative(r.cwd,t));let o=[t];i!=null&&o.push(i);let a=r.awaitWriteFinish,n;if(a&&(n=this._pendingWrites.get(t)))return n.lastChange=new Date,this;if(r.atomic){if(e===x.UNLINK)return this._pendingUnlinks.set(t,[e,...o]),setTimeout(()=>{this._pendingUnlinks.forEach((l,f)=>{this.emit(...l),this.emit(x.ALL,...l),this._pendingUnlinks.delete(f)})},typeof r.atomic=="number"?r.atomic:100),this;e===x.ADD&&this._pendingUnlinks.has(t)&&(e=x.CHANGE,this._pendingUnlinks.delete(t))}if(a&&(e===x.ADD||e===x.CHANGE)&&this._readyEmitted){let l=(f,c)=>{f?(e=x.ERROR,o[0]=f,this.emitWithAll(e,o)):c&&(o.length>1?o[1]=c:o.push(c),this.emitWithAll(e,o))};return this._awaitWriteFinish(t,a.stabilityThreshold,e,l),this}if(e===x.CHANGE&&!this._throttle(x.CHANGE,t,50))return this;if(r.alwaysStat&&i===void 0&&(e===x.ADD||e===x.ADD_DIR||e===x.CHANGE)){let l=r.cwd?y.join(r.cwd,t):t,f;try{f=await Oi(l)}catch{}if(!f||this.closed)return;o.push(f)}return this.emitWithAll(e,o),this}_handleError(e){let t=e&&e.code;return e&&t!=="ENOENT"&&t!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||t!=="EPERM"&&t!=="EACCES")&&this.emit(x.ERROR,e),e||this.closed}_throttle(e,t,i){this._throttled.has(e)||this._throttled.set(e,new Map);let r=this._throttled.get(e);if(!r)throw new Error("invalid throttle");let o=r.get(t);if(o)return o.count++,!1;let a,n=()=>{let f=r.get(t),c=f?f.count:0;return r.delete(t),clearTimeout(a),f&&clearTimeout(f.timeoutObject),c};a=setTimeout(n,i);let l={timeoutObject:a,clear:n,count:0};return r.set(t,l),l}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,t,i,r){let o=this.options.awaitWriteFinish;if(typeof o!="object")return;let a=o.pollInterval,n,l=e;this.options.cwd&&!y.isAbsolute(e)&&(l=y.join(this.options.cwd,e));let f=new Date,c=this._pendingWrites;function m(u){ki(l,(b,C)=>{if(b||!c.has(e)){b&&b.code!=="ENOENT"&&r(b);return}let E=Number(new Date);u&&C.size!==u.size&&(c.get(e).lastChange=E);let D=c.get(e);E-D.lastChange>=t?(c.delete(e),r(void 0,C)):n=setTimeout(m,a,C)})}c.has(e)||(c.set(e,{lastChange:f,cancelWait:()=>(c.delete(e),clearTimeout(n),i)}),n=setTimeout(m,a))}_isIgnored(e,t){if(this.options.atomic&&Fi.test(e))return!0;if(!this._userIgnored){let{cwd:i}=this.options,o=(this.options.ignored||[]).map(Mt(i)),n=[...[...this._ignoredPaths].map(Mt(i)),...o];this._userIgnored=Mi(n,void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new Ue(e,this.options.followSymlinks,this)}_getWatchedDir(e){let t=y.resolve(e);return this._watched.has(t)||this._watched.set(t,new Ge(t,this._boundRemove)),this._watched.get(t)}_hasReadPermissions(e){return this.options.ignorePermissionErrors?!0:!!(Number(e.mode)&256)}_remove(e,t,i){let r=y.join(e,t),o=y.resolve(r);if(i=i??(this._watched.has(r)||this._watched.has(o)),!this._throttle("remove",r,100))return;!i&&this._watched.size===1&&this.add(e,t,!0),this._getWatchedDir(r).getChildren().forEach(u=>this._remove(r,u));let l=this._getWatchedDir(e),f=l.has(t);l.remove(t),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let c=r;if(this.options.cwd&&(c=y.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(c)&&this._pendingWrites.get(c).cancelWait()===x.ADD)return;this._watched.delete(r),this._watched.delete(o);let m=i?x.UNLINK_DIR:x.UNLINK;f&&!this._isIgnored(r)&&this._emit(m,r),this._closePath(r)}_closePath(e){this._closeFile(e);let t=y.dirname(e);this._getWatchedDir(t).remove(y.basename(e))}_closeFile(e){let t=this._closers.get(e);t&&(t.forEach(i=>i()),this._closers.delete(e))}_addPathCloser(e,t){if(!t)return;let i=this._closers.get(e);i||(i=[],this._closers.set(e,i)),i.push(t)}_readdirp(e,t){if(this.closed)return;let i={type:x.ALL,alwaysStat:!0,lstat:!0,...t,depth:0},r=St(e,i);return this._streams.add(r),r.once(Rt,()=>{r=void 0}),r.once(Me,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};Wt={watch:Ui,FSWatcher:de}});import O from"chalk";var Bi,M,Ji,Vi,Yi,Be,ge,qi,Xi,Y,Je,Ki,Ve,q,_,X=v(()=>{"use strict";p();Bi=O.hex("#1abc9c"),M=O.hex("#16a085"),Ji=O.hex("#2ecc71"),Vi=O.hex("#27ae60"),Yi=O.hex("#e74c3c"),Be=O.hex("#c0392b"),ge=O.hex("#f1c40f"),qi=O.hex("#f39c12"),Xi=O.hex("#3498db"),Y=O.hex("#2980b9"),Je=O.hex("#ecf0f1"),Ki=O.hex("#fd79a8"),Ve=O.hex("#e84393"),q=O.hex("#7f8c8d"),_={lightGreen:Bi,green:M,lightCyan:Ji,cyan:Vi,lightRed:Yi,red:Be,yellow:ge,orange:qi,lightBlue:Xi,blue:Y,white:Je,lightMagenta:Ki,magenta:Ve,gray:q}});var Ut,ye,h,L=v(()=>{"use strict";p();X();Ut=!1,ye=class{brandName="";fullName="";logLevel=Ut?"debug":"info";isLogTime=Ut;setup({brandName:e,logLevel:t,fullName:i}){this.brandName=` [${e}] `,this.fullName=` ${i} `,this.fullName=_.green.bold(this.fullName),t&&(this.logLevel=t)}time=(...e)=>this.isLogTime&&console.time(...e);timeEnd=(...e)=>this.isLogTime&&console.timeEnd(...e);debug=(...e)=>["debug"].includes(this.logLevel)&&console.log(...e);info=(...e)=>["debug","info"].includes(this.logLevel)&&console.log(...e);warn=(...e)=>["debug","info","warn"].includes(this.logLevel)&&console.warn(...e);error=(...e)=>["debug","info","warn","error"].includes(this.logLevel)&&console.error(...e);blue=e=>{console.log(`${_.lightBlue(this.brandName)}${_.blue(` ${e} `)}
2
+ var Vs=Object.defineProperty;var k=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var v=(s,e)=>()=>(s&&(e=s(s=0)),e);var Z=(s,e)=>{for(var t in e)Vs(s,t,{get:e[t],enumerable:!0})};import Ys from"path";import{fileURLToPath as qs}from"url";var vt,Xs,w,g,p=v(()=>{"use strict";vt=()=>qs(import.meta.url),Xs=()=>Ys.dirname(vt()),w=Xs(),g=vt()});var ae,Ae=v(()=>{ae={name:"@empjs/cli",version:"3.10.8",description:"emp",license:"MIT",type:"module",files:["dist","bin","resource","template","types","tsconfig"],maintainers:["xuhongbin","ckken","doerme"],repository:{type:"git",url:"git+https://github.com/empjs/emp.git",directory:"packages/cli"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},keywords:["rspack","rust","typescript"],bin:{emp:"./bin/emp.js"},main:"dist/index.js",types:"dist/index.d.ts",exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.js"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}},"./emp-tsconfig.json":{default:"./tsconfig/react.json"},"./tsconfig/base":{default:"./tsconfig/base.json"},"./tsconfig/react":{default:"./tsconfig/react.json"},"./tsconfig/vue":{default:"./tsconfig/vue.json"},"./client":{types:"./types/react/index.d.ts",default:"./types/react/index.d.ts"},"./types/base":{types:"./types/base/index.d.ts",default:"./types/base/index.d.ts"},"./types/vue":{types:"./types/vue/index.d.ts",default:"./types/vue/index.d.ts"},"./types/react":{types:"./types/react/index.d.ts",default:"./types/react/index.d.ts"}},scripts:{dev:"tsup --watch --env.ENV dev",build:"tsup --env.ENV prod","dev-rs":"rslib build --watch --env-mode development","build-rs":"rslib build --env-mode production",ph:"pnpm publish --no-git-checks"},engines:{node:">=18.0.0"},author:"Ken",devDependencies:{"@types/compression":"^1.7.2","@types/connect":"^3.4.38","@types/cors":"^2.8.12","@types/default-gateway":"^7.2.1","@types/fs-extra":"^11.0.4","@types/react":"^18.3.2","@types/serve-static":"^1.15.8","@types/watchpack":"^2.4.3","@types/webpack":"^5.28.4","@types/webpack-bundle-analyzer":"^4.6.2","@types/webpack-sources":"^3.2.2",chokidar:"^4.0.3",vue:"^3.5.21"},dependencies:{"@empjs/chain":"workspace:*","@rsdoctor/rspack-plugin":"1.3.16","@rspack/core":"1.6.8","@rspack/dev-server":"1.1.4","@swc/helpers":"^0.5.17","@vue/tsconfig":"^0.8.1",address:"^2.0.2",chalk:"^5.3.0",commander:"11.1.0",compression:"1.8.1",connect:"3.7.0","core-js":"^3.41.0",cors:"2.8.5","default-gateway":"7.2.2","fs-extra":"11.3.1",glob:"11.0.3","gzip-size":"7.0.0","html-webpack-plugin":"5.6.4",jiti:"2.6.1","less-loader":"^12.2.0",open:"10.2.0","sass-embedded":"1.93.2","sass-loader":"16.0.5","serve-static":"2.2.0","ts-checker-rspack-plugin":"1.1.6","typescript-plugin-css-modules":"5.2.0","webpack-bundle-analyzer":"4.10.2"}}});import{stat as Qs,lstat as bt,readdir as Zs,realpath as ei}from"fs/promises";import{Readable as ti}from"stream";import{resolve as Ct,relative as si,join as ii,sep as ri}from"path";function St(s,e={}){let t=e.entryType||e.type;if(t==="both"&&(t=T.FILE_DIR_TYPE),t&&(e.type=t),s){if(typeof s!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(t&&!Et.includes(t))throw new Error(`readdirp: Invalid type passed. Use one of ${Et.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=s,new Fe(e)}var T,Ne,_t,oi,Et,ni,ai,li,ci,Pt,xt,Fe,kt=v(()=>{"use strict";p();T={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},Ne={root:".",fileFilter:s=>!0,directoryFilter:s=>!0,type:T.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(Ne);_t="READDIRP_RECURSIVE_ERROR",oi=new Set(["ENOENT","EPERM","EACCES","ELOOP",_t]),Et=[T.DIR_TYPE,T.EVERYTHING_TYPE,T.FILE_DIR_TYPE,T.FILE_TYPE],ni=new Set([T.DIR_TYPE,T.EVERYTHING_TYPE,T.FILE_DIR_TYPE]),ai=new Set([T.EVERYTHING_TYPE,T.FILE_DIR_TYPE,T.FILE_TYPE]),li=s=>oi.has(s.code),ci=process.platform==="win32",Pt=s=>!0,xt=s=>{if(s===void 0)return Pt;if(typeof s=="function")return s;if(typeof s=="string"){let e=s.trim();return t=>t.basename===e}if(Array.isArray(s)){let e=s.map(t=>t.trim());return t=>e.some(i=>t.basename===i)}return Pt},Fe=class extends ti{constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let t={...Ne,...e},{root:i,type:r}=t;this._fileFilter=xt(t.fileFilter),this._directoryFilter=xt(t.directoryFilter);let o=t.lstat?bt:Qs;ci?this._stat=a=>o(a,{bigint:!0}):this._stat=o,this._maxDepth=t.depth??Ne.depth,this._wantsDir=r?ni.has(r):!1,this._wantsFile=r?ai.has(r):!1,this._wantsEverything=r===T.EVERYTHING_TYPE,this._root=Ct(i),this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(i,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let t=this.parent,i=t&&t.files;if(i&&i.length>0){let{path:r,depth:o}=t,a=i.splice(0,e).map(l=>this._formatEntry(l,r)),n=await Promise.all(a);for(let l of n){if(!l)continue;if(this.destroyed)return;let f=await this._getEntryType(l);f==="directory"&&this._directoryFilter(l)?(o<=this._maxDepth&&this.parents.push(this._exploreDir(l.fullPath,o+1)),this._wantsDir&&(this.push(l),e--)):(f==="file"||this._includeAsFile(l))&&this._fileFilter(l)&&this._wantsFile&&(this.push(l),e--)}}else{let r=this.parents.pop();if(!r){this.push(null);break}if(this.parent=await r,this.destroyed)return}}}catch(t){this.destroy(t)}finally{this.reading=!1}}}async _exploreDir(e,t){let i;try{i=await Zs(e,this._rdOptions)}catch(r){this._onError(r)}return{files:i,depth:t,path:e}}async _formatEntry(e,t){let i,r=this._isDirent?e.name:e;try{let o=Ct(ii(t,r));i={path:si(this._root,o),fullPath:o,basename:r},i[this._statsProp]=this._isDirent?e:await this._stat(o)}catch(o){this._onError(o);return}return i}_onError(e){li(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return"";let t=e[this._statsProp];if(t.isFile())return"file";if(t.isDirectory())return"directory";if(t&&t.isSymbolicLink()){let i=e.fullPath;try{let r=await ei(i),o=await bt(r);if(o.isFile())return"file";if(o.isDirectory()){let a=r.length;if(i.startsWith(r)&&i.substr(a,1)===ri){let n=new Error(`Circular symlink detected: "${i}" points to "${r}"`);return n.code=_t,this._onError(n)}return"directory"}}catch(r){return this._onError(r),""}}}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}}});import{watchFile as pi,unwatchFile as Ot,watch as hi}from"fs";import{open as fi,stat as Tt,lstat as ui,realpath as Le}from"fs/promises";import*as P from"path";import{type as mi}from"os";function Dt(s,e,t,i,r){let o=(a,n)=>{t(s),r(a,n,{watchedPath:s}),n&&s!==n&&pe(P.resolve(s,n),G,P.join(s,n))};try{return hi(s,{persistent:e.persistent},o)}catch(a){i(a);return}}var di,Me,Rt,fe,ue,ze,gi,yi,wi,jt,x,A,vi,bi,G,le,V,Ci,Ei,Pi,$e,ee,xi,te,At,ce,pe,_i,Ie,Si,he,Nt=v(()=>{"use strict";p();di="data",Me="end",Rt="close",fe=()=>{},ue=process.platform,ze=ue==="win32",gi=ue==="darwin",yi=ue==="linux",wi=ue==="freebsd",jt=mi()==="OS400",x={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},A=x,vi="watch",bi={lstat:ui,stat:Tt},G="listeners",le="errHandlers",V="rawEmitters",Ci=[G,le,V],Ei=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),Pi=s=>Ei.has(P.extname(s).slice(1).toLowerCase()),$e=(s,e)=>{s instanceof Set?s.forEach(e):e(s)},ee=(s,e,t)=>{let i=s[e];i instanceof Set||(s[e]=i=new Set([i])),i.add(t)},xi=s=>e=>{let t=s[e];t instanceof Set?t.clear():delete s[e]},te=(s,e,t)=>{let i=s[e];i instanceof Set?i.delete(t):i===t&&delete s[e]},At=s=>s instanceof Set?s.size===0:!s,ce=new Map;pe=(s,e,t,i,r)=>{let o=ce.get(s);o&&$e(o[e],a=>{a(t,i,r)})},_i=(s,e,t,i)=>{let{listener:r,errHandler:o,rawEmitter:a}=i,n=ce.get(e),l;if(!t.persistent)return l=Dt(s,t,r,o,a),l?l.close.bind(l):void 0;if(n)ee(n,G,r),ee(n,le,o),ee(n,V,a);else{if(l=Dt(s,t,pe.bind(null,e,G),o,pe.bind(null,e,V)),!l)return;l.on(A.ERROR,async f=>{let c=pe.bind(null,e,le);if(n&&(n.watcherUnusable=!0),ze&&f.code==="EPERM")try{await(await fi(s,"r")).close(),c(f)}catch{}else c(f)}),n={listeners:r,errHandlers:o,rawEmitters:a,watcher:l},ce.set(e,n)}return()=>{te(n,G,r),te(n,le,o),te(n,V,a),At(n.listeners)&&(n.watcher.close(),ce.delete(e),Ci.forEach(xi(n)),n.watcher=void 0,Object.freeze(n))}},Ie=new Map,Si=(s,e,t,i)=>{let{listener:r,rawEmitter:o}=i,a=Ie.get(e),n=a&&a.options;return n&&(n.persistent<t.persistent||n.interval>t.interval)&&(Ot(e),a=void 0),a?(ee(a,G,r),ee(a,V,o)):(a={listeners:r,rawEmitters:o,options:t,watcher:pi(e,t,(l,f)=>{$e(a.rawEmitters,m=>{m(A.CHANGE,e,{curr:l,prev:f})});let c=l.mtimeMs;(l.size!==f.size||c>f.mtimeMs||c===0)&&$e(a.listeners,m=>m(s,l))})},Ie.set(e,a)),()=>{te(a,G,r),te(a,V,o),At(a.listeners)&&(Ie.delete(e),Ot(e),a.options=a.watcher=void 0,Object.freeze(a))}},he=class{constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(e,t){let i=this.fsw.options,r=P.dirname(e),o=P.basename(e);this.fsw._getWatchedDir(r).add(o);let n=P.resolve(e),l={persistent:i.persistent};t||(t=fe);let f;if(i.usePolling){let c=i.interval!==i.binaryInterval;l.interval=c&&Pi(o)?i.binaryInterval:i.interval,f=Si(e,n,l,{listener:t,rawEmitter:this.fsw._emitRaw})}else f=_i(e,n,l,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return f}_handleFile(e,t,i){if(this.fsw.closed)return;let r=P.dirname(e),o=P.basename(e),a=this.fsw._getWatchedDir(r),n=t;if(a.has(o))return;let l=async(c,m)=>{if(this.fsw._throttle(vi,e,5)){if(!m||m.mtimeMs===0)try{let u=await Tt(e);if(this.fsw.closed)return;let b=u.atimeMs,C=u.mtimeMs;if((!b||b<=C||C!==n.mtimeMs)&&this.fsw._emit(A.CHANGE,e,u),(gi||yi||wi)&&n.ino!==u.ino){this.fsw._closeFile(c),n=u;let E=this._watchWithNodeFs(e,l);E&&this.fsw._addPathCloser(c,E)}else n=u}catch{this.fsw._remove(r,o)}else if(a.has(o)){let u=m.atimeMs,b=m.mtimeMs;(!u||u<=b||b!==n.mtimeMs)&&this.fsw._emit(A.CHANGE,e,m),n=m}}},f=this._watchWithNodeFs(e,l);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(A.ADD,e,0))return;this.fsw._emit(A.ADD,e,t)}return f}async _handleSymlink(e,t,i,r){if(this.fsw.closed)return;let o=e.fullPath,a=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let n;try{n=await Le(i)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(a.has(r)?this.fsw._symlinkPaths.get(o)!==n&&(this.fsw._symlinkPaths.set(o,n),this.fsw._emit(A.CHANGE,i,e.stats)):(a.add(r),this.fsw._symlinkPaths.set(o,n),this.fsw._emit(A.ADD,i,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(o))return!0;this.fsw._symlinkPaths.set(o,!0)}_handleRead(e,t,i,r,o,a,n){if(e=P.join(e,""),n=this.fsw._throttle("readdir",e,1e3),!n)return;let l=this.fsw._getWatchedDir(i.path),f=new Set,c=this.fsw._readdirp(e,{fileFilter:m=>i.filterPath(m),directoryFilter:m=>i.filterDir(m)});if(c)return c.on(di,async m=>{if(this.fsw.closed){c=void 0;return}let u=m.path,b=P.join(e,u);if(f.add(u),!(m.stats.isSymbolicLink()&&await this._handleSymlink(m,e,b,u))){if(this.fsw.closed){c=void 0;return}(u===r||!r&&!l.has(u))&&(this.fsw._incrReadyCount(),b=P.join(o,P.relative(o,b)),this._addToNodeFs(b,t,i,a+1))}}).on(A.ERROR,this._boundHandleError),new Promise((m,u)=>{if(!c)return u();c.once(Me,()=>{if(this.fsw.closed){c=void 0;return}let b=n?n.clear():!1;m(void 0),l.getChildren().filter(C=>C!==e&&!f.has(C)).forEach(C=>{this.fsw._remove(e,C)}),c=void 0,b&&this._handleRead(e,!1,i,r,o,a,n)})})}async _handleDir(e,t,i,r,o,a,n){let l=this.fsw._getWatchedDir(P.dirname(e)),f=l.has(P.basename(e));!(i&&this.fsw.options.ignoreInitial)&&!o&&!f&&this.fsw._emit(A.ADD_DIR,e,t),l.add(P.basename(e)),this.fsw._getWatchedDir(e);let c,m,u=this.fsw.options.depth;if((u==null||r<=u)&&!this.fsw._symlinkPaths.has(n)){if(!o&&(await this._handleRead(e,i,a,o,e,r,c),this.fsw.closed))return;m=this._watchWithNodeFs(e,(b,C)=>{C&&C.mtimeMs===0||this._handleRead(b,!1,a,o,e,r,c)})}return m}async _addToNodeFs(e,t,i,r,o){let a=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return a(),!1;let n=this.fsw._getWatchHelpers(e);i&&(n.filterPath=l=>i.filterPath(l),n.filterDir=l=>i.filterDir(l));try{let l=await bi[n.statMethod](n.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(n.watchPath,l))return a(),!1;let f=this.fsw.options.followSymlinks,c;if(l.isDirectory()){let m=P.resolve(e),u=f?await Le(e):e;if(this.fsw.closed||(c=await this._handleDir(n.watchPath,l,t,r,o,n,u),this.fsw.closed))return;m!==u&&u!==void 0&&this.fsw._symlinkPaths.set(m,u)}else if(l.isSymbolicLink()){let m=f?await Le(e):e;if(this.fsw.closed)return;let u=P.dirname(n.watchPath);if(this.fsw._getWatchedDir(u).add(n.watchPath),this.fsw._emit(A.ADD,n.watchPath,l),c=await this._handleDir(u,l,t,r,e,n,m),this.fsw.closed)return;m!==void 0&&this.fsw._symlinkPaths.set(P.resolve(e),m)}else c=this._handleFile(n.watchPath,l,t);return a(),c&&this.fsw._addPathCloser(e,c),!1}catch(l){if(this.fsw._handleError(l))return a(),e}}}});import{stat as ki}from"fs";import{stat as Oi,readdir as Di}from"fs/promises";import{EventEmitter as Ti}from"events";import*as y from"path";function me(s){return Array.isArray(s)?s:[s]}function Ii(s){return typeof s=="function"?s:typeof s=="string"?e=>s===e:s instanceof RegExp?e=>s.test(e):typeof s=="object"&&s!==null?e=>{if(s.path===e)return!0;if(s.recursive){let t=y.relative(s.path,e);return t?!t.startsWith("..")&&!y.isAbsolute(t):!1}return!1}:()=>!1}function $i(s){if(typeof s!="string")throw new Error("string expected");s=y.normalize(s),s=s.replace(/\\/g,"/");let e=!1;s.startsWith("//")&&(e=!0);let t=/\/\//;for(;s.match(t);)s=s.replace(t,"/");return e&&(s="/"+s),s}function Lt(s,e,t){let i=$i(e);for(let r=0;r<s.length;r++){let o=s[r];if(o(i,t))return!0}return!1}function Mi(s,e){if(s==null)throw new TypeError("anymatch: specify first argument");let i=me(s).map(r=>Ii(r));return e==null?(r,o)=>Lt(i,r,o):Lt(i,e)}function Ui(s,e={}){let t=new de(e);return t.add(s),t}var He,Ri,zt,ji,Ai,Ni,Ft,Fi,Li,We,It,$t,Ht,Mt,zi,Hi,Ge,Wi,Gi,Ue,de,Wt,Gt=v(()=>{"use strict";p();kt();Nt();He="/",Ri="//",zt=".",ji="..",Ai="string",Ni=/\\/g,Ft=/\/\//,Fi=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,Li=/^\.[/\\]/;We=s=>typeof s=="object"&&s!==null&&!(s instanceof RegExp);It=s=>{let e=me(s).flat();if(!e.every(t=>typeof t===Ai))throw new TypeError(`Non-string provided as watch path: ${e}`);return e.map(Ht)},$t=s=>{let e=s.replace(Ni,He),t=!1;for(e.startsWith(Ri)&&(t=!0);e.match(Ft);)e=e.replace(Ft,He);return t&&(e=He+e),e},Ht=s=>$t(y.normalize($t(s))),Mt=(s="")=>e=>typeof e=="string"?Ht(y.isAbsolute(e)?e:y.join(s,e)):e,zi=(s,e)=>y.isAbsolute(s)?s:y.join(e,s),Hi=Object.freeze(new Set),Ge=class{constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;t&&e!==zt&&e!==ji&&t.add(e)}async remove(e){let{items:t}=this;if(!t||(t.delete(e),t.size>0))return;let i=this.path;try{await Di(i)}catch{this._removeWatcher&&this._removeWatcher(y.dirname(i),y.basename(i))}}has(e){let{items:t}=this;if(t)return t.has(e)}getChildren(){let{items:e}=this;return e?[...e.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=fe,this.items=Hi,Object.freeze(this)}},Wi="stat",Gi="lstat",Ue=class{constructor(e,t,i){this.fsw=i;let r=e;this.path=e=e.replace(Li,""),this.watchPath=r,this.fullWatchPath=y.resolve(r),this.dirParts=[],this.dirParts.forEach(o=>{o.length>1&&o.pop()}),this.followSymlinks=t,this.statMethod=t?Wi:Gi}entryPath(e){return y.join(this.watchPath,y.relative(this.watchPath,e.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let i=this.entryPath(e);return this.fsw._isntIgnored(i,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}},de=class extends Ti{constructor(e={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},r={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?me(e.ignored):me([]),awaitWriteFinish:t===!0?i:typeof t=="object"?{...i,...t}:!1};jt&&(r.usePolling=!0),r.atomic===void 0&&(r.atomic=!r.usePolling);let o=process.env.CHOKIDAR_USEPOLLING;if(o!==void 0){let l=o.toLowerCase();l==="false"||l==="0"?r.usePolling=!1:l==="true"||l==="1"?r.usePolling=!0:r.usePolling=!!l}let a=process.env.CHOKIDAR_INTERVAL;a&&(r.interval=Number.parseInt(a,10));let n=0;this._emitReady=()=>{n++,n>=this._readyCount&&(this._emitReady=fe,this._readyEmitted=!0,process.nextTick(()=>this.emit(x.READY)))},this._emitRaw=(...l)=>this.emit(x.RAW,...l),this._boundRemove=this._remove.bind(this),this.options=r,this._nodeFsHandler=new he(this),Object.freeze(r)}_addIgnoredPath(e){if(We(e)){for(let t of this._ignoredPaths)if(We(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),typeof e=="string")for(let t of this._ignoredPaths)We(t)&&t.path===e&&this._ignoredPaths.delete(t)}add(e,t,i){let{cwd:r}=this.options;this.closed=!1,this._closePromise=void 0;let o=It(e);return r&&(o=o.map(a=>zi(a,r))),o.forEach(a=>{this._removeIgnoredPath(a)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=o.length,Promise.all(o.map(async a=>{let n=await this._nodeFsHandler._addToNodeFs(a,!i,void 0,0,t);return n&&this._emitReady(),n})).then(a=>{this.closed||a.forEach(n=>{n&&this.add(y.dirname(n),y.basename(t||n))})}),this}unwatch(e){if(this.closed)return this;let t=It(e),{cwd:i}=this.options;return t.forEach(r=>{!y.isAbsolute(r)&&!this._closers.has(r)&&(i&&(r=y.join(i,r)),r=y.resolve(r)),this._closePath(r),this._addIgnoredPath(r),this._watched.has(r)&&this._addIgnoredPath({path:r,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(t=>t.forEach(i=>{let r=i();r instanceof Promise&&e.push(r)})),this._streams.forEach(t=>t.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(t=>t.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((t,i)=>{let o=(this.options.cwd?y.relative(this.options.cwd,i):i)||zt;e[o]=t.getChildren().sort()}),e}emitWithAll(e,t){this.emit(e,...t),e!==x.ERROR&&this.emit(x.ALL,e,...t)}async _emit(e,t,i){if(this.closed)return;let r=this.options;ze&&(t=y.normalize(t)),r.cwd&&(t=y.relative(r.cwd,t));let o=[t];i!=null&&o.push(i);let a=r.awaitWriteFinish,n;if(a&&(n=this._pendingWrites.get(t)))return n.lastChange=new Date,this;if(r.atomic){if(e===x.UNLINK)return this._pendingUnlinks.set(t,[e,...o]),setTimeout(()=>{this._pendingUnlinks.forEach((l,f)=>{this.emit(...l),this.emit(x.ALL,...l),this._pendingUnlinks.delete(f)})},typeof r.atomic=="number"?r.atomic:100),this;e===x.ADD&&this._pendingUnlinks.has(t)&&(e=x.CHANGE,this._pendingUnlinks.delete(t))}if(a&&(e===x.ADD||e===x.CHANGE)&&this._readyEmitted){let l=(f,c)=>{f?(e=x.ERROR,o[0]=f,this.emitWithAll(e,o)):c&&(o.length>1?o[1]=c:o.push(c),this.emitWithAll(e,o))};return this._awaitWriteFinish(t,a.stabilityThreshold,e,l),this}if(e===x.CHANGE&&!this._throttle(x.CHANGE,t,50))return this;if(r.alwaysStat&&i===void 0&&(e===x.ADD||e===x.ADD_DIR||e===x.CHANGE)){let l=r.cwd?y.join(r.cwd,t):t,f;try{f=await Oi(l)}catch{}if(!f||this.closed)return;o.push(f)}return this.emitWithAll(e,o),this}_handleError(e){let t=e&&e.code;return e&&t!=="ENOENT"&&t!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||t!=="EPERM"&&t!=="EACCES")&&this.emit(x.ERROR,e),e||this.closed}_throttle(e,t,i){this._throttled.has(e)||this._throttled.set(e,new Map);let r=this._throttled.get(e);if(!r)throw new Error("invalid throttle");let o=r.get(t);if(o)return o.count++,!1;let a,n=()=>{let f=r.get(t),c=f?f.count:0;return r.delete(t),clearTimeout(a),f&&clearTimeout(f.timeoutObject),c};a=setTimeout(n,i);let l={timeoutObject:a,clear:n,count:0};return r.set(t,l),l}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,t,i,r){let o=this.options.awaitWriteFinish;if(typeof o!="object")return;let a=o.pollInterval,n,l=e;this.options.cwd&&!y.isAbsolute(e)&&(l=y.join(this.options.cwd,e));let f=new Date,c=this._pendingWrites;function m(u){ki(l,(b,C)=>{if(b||!c.has(e)){b&&b.code!=="ENOENT"&&r(b);return}let E=Number(new Date);u&&C.size!==u.size&&(c.get(e).lastChange=E);let D=c.get(e);E-D.lastChange>=t?(c.delete(e),r(void 0,C)):n=setTimeout(m,a,C)})}c.has(e)||(c.set(e,{lastChange:f,cancelWait:()=>(c.delete(e),clearTimeout(n),i)}),n=setTimeout(m,a))}_isIgnored(e,t){if(this.options.atomic&&Fi.test(e))return!0;if(!this._userIgnored){let{cwd:i}=this.options,o=(this.options.ignored||[]).map(Mt(i)),n=[...[...this._ignoredPaths].map(Mt(i)),...o];this._userIgnored=Mi(n,void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new Ue(e,this.options.followSymlinks,this)}_getWatchedDir(e){let t=y.resolve(e);return this._watched.has(t)||this._watched.set(t,new Ge(t,this._boundRemove)),this._watched.get(t)}_hasReadPermissions(e){return this.options.ignorePermissionErrors?!0:!!(Number(e.mode)&256)}_remove(e,t,i){let r=y.join(e,t),o=y.resolve(r);if(i=i??(this._watched.has(r)||this._watched.has(o)),!this._throttle("remove",r,100))return;!i&&this._watched.size===1&&this.add(e,t,!0),this._getWatchedDir(r).getChildren().forEach(u=>this._remove(r,u));let l=this._getWatchedDir(e),f=l.has(t);l.remove(t),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let c=r;if(this.options.cwd&&(c=y.relative(this.options.cwd,r)),this.options.awaitWriteFinish&&this._pendingWrites.has(c)&&this._pendingWrites.get(c).cancelWait()===x.ADD)return;this._watched.delete(r),this._watched.delete(o);let m=i?x.UNLINK_DIR:x.UNLINK;f&&!this._isIgnored(r)&&this._emit(m,r),this._closePath(r)}_closePath(e){this._closeFile(e);let t=y.dirname(e);this._getWatchedDir(t).remove(y.basename(e))}_closeFile(e){let t=this._closers.get(e);t&&(t.forEach(i=>i()),this._closers.delete(e))}_addPathCloser(e,t){if(!t)return;let i=this._closers.get(e);i||(i=[],this._closers.set(e,i)),i.push(t)}_readdirp(e,t){if(this.closed)return;let i={type:x.ALL,alwaysStat:!0,lstat:!0,...t,depth:0},r=St(e,i);return this._streams.add(r),r.once(Rt,()=>{r=void 0}),r.once(Me,()=>{r&&(this._streams.delete(r),r=void 0)}),r}};Wt={watch:Ui,FSWatcher:de}});import O from"chalk";var Bi,M,Ji,Vi,Yi,Be,ge,qi,Xi,Y,Je,Ki,Ve,q,_,X=v(()=>{"use strict";p();Bi=O.hex("#1abc9c"),M=O.hex("#16a085"),Ji=O.hex("#2ecc71"),Vi=O.hex("#27ae60"),Yi=O.hex("#e74c3c"),Be=O.hex("#c0392b"),ge=O.hex("#f1c40f"),qi=O.hex("#f39c12"),Xi=O.hex("#3498db"),Y=O.hex("#2980b9"),Je=O.hex("#ecf0f1"),Ki=O.hex("#fd79a8"),Ve=O.hex("#e84393"),q=O.hex("#7f8c8d"),_={lightGreen:Bi,green:M,lightCyan:Ji,cyan:Vi,lightRed:Yi,red:Be,yellow:ge,orange:qi,lightBlue:Xi,blue:Y,white:Je,lightMagenta:Ki,magenta:Ve,gray:q}});var Ut,ye,h,L=v(()=>{"use strict";p();X();Ut=!1,ye=class{brandName="";fullName="";logLevel=Ut?"debug":"info";isLogTime=Ut;setup({brandName:e,logLevel:t,fullName:i}){this.brandName=` [${e}] `,this.fullName=` ${i} `,this.fullName=_.green.bold(this.fullName),t&&(this.logLevel=t)}time=(...e)=>this.isLogTime&&console.time(...e);timeEnd=(...e)=>this.isLogTime&&console.timeEnd(...e);debug=(...e)=>["debug"].includes(this.logLevel)&&console.log(...e);info=(...e)=>["debug","info"].includes(this.logLevel)&&console.log(...e);warn=(...e)=>["debug","info","warn"].includes(this.logLevel)&&console.warn(...e);error=(...e)=>["debug","info","warn","error"].includes(this.logLevel)&&console.error(...e);blue=e=>{console.log(`${_.lightBlue(this.brandName)}${_.blue(` ${e} `)}
3
3
  `)};cyan=e=>{console.log(`${_.lightCyan(this.brandName)}${_.cyan(` ${e} `)}
4
4
  `)};magenta=e=>{console.log(`${_.lightMagenta(this.brandName)}${_.magenta(` ${e} `)}
5
5
  `)};green=e=>{console.log(`${_.lightGreen(this.brandName)}${_.green(` ${e} `)}
@@ -9,7 +9,7 @@ var Vs=Object.defineProperty;var k=(s=>typeof require<"u"?require:typeof Proxy<"
9
9
  `)};link=e=>_.blue(e);title=e=>{console.log(`${this.fullName}${_.yellow.underline(`${e}`)}
10
10
  `)}},h=new ye});var Ke={};Z(Ke,{clearConsole:()=>qe,deepAssign:()=>R,ensureArray:()=>sr,getLanIp:()=>U,getPkgVersion:()=>Ye,importJsVm:()=>Xe,jsonFilter:()=>ir,timeFormat:()=>ve,vCompare:()=>we});import{ip as Qi}from"address";import Zi from"chalk";import{gateway4sync as er}from"default-gateway";import tr from"fs-extra";function qe(){process.stdout.write(process.platform==="win32"?"\x1B[2J\x1B[0f":"\x1B[2J\x1B[3J\x1B[H")}function R(s,...e){for(let t of e)for(let i in t){let r=t[i],o=s[i];if(Object(r)==r&&Object(o)===o){s[i]=R(o,r);continue}s[i]=t[i]}return s}var U,Ye,sr,ir,we,ve,Xe,I=v(()=>{"use strict";p();U=()=>{let s="127.0.0.1";try{let{int:e}=er();return Qi(e||"")||s}catch{return s}},Ye=s=>{try{let{version:e}=tr.readJSONSync(s);return e}catch{return}};sr=s=>Array.isArray(s)?s:[s],ir=(s={},e=[])=>Object.keys(s).filter(t=>!e.includes(t)).reduce((t,i)=>(t[i]=s[i],t),{}),we=(s="",e="")=>{let t=s.replace("^","").split("."),i=e.replace("^","").split("."),r=Math.max(t.length,i.length),o=0;for(let a=0;a<r;a++){let n=t.length>a?t[a]:0,l=isNaN(Number(n))?n.charCodeAt():Number(n),f=i.length>a?i[a]:0,c=isNaN(Number(f))?f.charCodeAt():Number(f);if(l<c){o=-1;break}else if(l>c){o=1;break}}return o},ve=s=>{s=s/1e3;let e=i=>Zi.bold(i);if(s<1)return`${s*1e3} ms`;if(s<10){let i=s>=.01?2:3;return`${e(s.toFixed(i))} s`}if(s<60)return`${e(s.toFixed(1))} s`;let t=s/60;return`${e(t.toFixed(2))} m`},Xe=s=>`data:text/javascript,${s}`});var Bt={};Z(Bt,{chalk:()=>rr,color:()=>_,glob:()=>be,logger:()=>h,utils:()=>Ke});import rr from"chalk";import{glob as be}from"glob";var K=v(()=>{"use strict";p();X();L();I()});import Jt from"fs";import{createJiti as or}from"jiti";import Vt from"path";var nr,Yt,qt,Xt,Kt,Ce=v(()=>{"use strict";p();$();Ae();L();nr=["emp-config.ts","emp-config.js","emp.config.ts","emp.config.js","emp-config.mjs","emp-config.cjs","emp-config.mts","emp-config.cts","emp.config.mjs","emp.config.cjs","emp.config.mts","emp.config.cts"],Yt=or(g,{interopDefault:!0,fsCache:!0,moduleCache:!0,cacheVersion:ae.version}),qt=async()=>{let s="store.getEmpConfigPath";h.time(s);let e=nr.map(r=>Vt.resolve(d.root,r)),t=await Promise.all(e.map(r=>Jt.promises.access(r).then(()=>!0,()=>!1))),i=e.find((r,o)=>t[o]);return h.timeEnd(s),i},Xt=async()=>{let s=Vt.join(d.root,"tsconfig.json");return await Jt.promises.access(s).then(()=>!0,()=>!1)||(s=void 0),s},Kt=()=>{let s=[g];return d.rootPaths.pkg&&s.push(d.rootPaths.pkg),d.rootPaths.empConfig&&s.push(d.rootPaths.empConfig),d.rootPaths.tsConfig&&s.push(d.rootPaths.tsConfig),s}});import Qt from"@empjs/chain";var Zt,Qe=v(()=>{"use strict";p();Zt={rule:{mjs:"mjs",typescript:"typescript",javascript:"javascript",sourceMap:"sourceMapLoader",inline:"inline",raw:"raw",svg:"svg",image:"image",font:"fonts",svga:"svga",sass:"sass",less:"less",css:"css"},use:{swc:"swc",sourceMap:"sourceMapLoader",sass:"sassLoader",less:"lessLoader"},plugin:{tsCheckerRspackPlugin:"TsCheckerRspackPlugin",bundleAnalyzer:"bundleAnalyzerPlugin",define:"definePlugin",copy:"copyRspackPlugin",progress:"progressPlugin",html:{prefix:"html-plugin-"},rsdoctor:"rsdoctor",sourceMapDevTool:"sourceMapDevTool"},minimizer:{minJs:"minJs",minCss:"minCss"}}});var Ee,es=v(()=>{"use strict";p();Ee=class{op={};constructor(e={}){this.op=e}async afterGetEmpOptions(){this.op.afterGetEmpOptions&&await this.op.afterGetEmpOptions()}async beforePlugin(){this.op.beforePlugin&&await this.op.beforePlugin()}async afterPlugin(){this.op.afterPlugin&&await this.op.afterPlugin()}async beforeModule(){this.op.beforeModule&&await this.op.beforeModule()}async afterModule(){this.op.afterModule&&await this.op.afterModule()}async beforeEmpPlugin(){this.op.beforeEmpPlugin&&await this.op.beforeEmpPlugin()}async afterEmpPlugin(){this.op.afterEmpPlugin&&await this.op.afterEmpPlugin()}async beforeBuild(){this.op.beforeBuild&&await this.op.beforeBuild()}async afterBulid(){this.op.afterBulid&&await this.op.afterBulid()}async beforeDevServe(){this.op.beforeDevServe&&await this.op.beforeDevServe()}async afterDevServe(){this.op.afterDevServe&&await this.op.afterDevServe()}async beforeServe(){this.op.beforeServe&&await this.op.beforeServe()}async afterServe(){this.op.afterServe&&await this.op.afterServe()}}});var Ze,ts,ss=v(()=>{"use strict";p();K();Ce();I();es();Ze=class{store;appSrc="src";appEntry="";base="";target=[];assign(e,t){return t=t||{},R(e,t)}isESM=!1;checkIsESM(e){return["es3","es5"].indexOf(e)===-1}lifeCycle;async setup(e){this.store=e,await this.syncEmpOptions(),await this.setupEmpOptions(),this.lifeCycle=new Ee(this.store.empOptions.lifeCycle),await this.lifeCycle.afterGetEmpOptions(),this.isESM=this.checkIsESM(this.build.target),this.store.empOptions.target?(this.target=this.store.empOptions.target,Array.isArray(this.target)&&!this.target.includes(this.build.target)&&this.target.push(this.build.target)):this.target=["web",this.build.target];let{appSrc:t,base:i,appEntry:r}=this.store.empOptions;t&&(this.appSrc=t),i&&(this.base=i),r&&(this.appEntry=r)}async setupEmpOptions(){await this.store.server.setupOnEmpOptionSync()}async chain(){this.store.empOptions.chain&&await this.store.empOptions.chain(this.store.chain)}async plugins(){let e=[];this.store.empOptions.plugins&&Array.isArray(this.store.empOptions.plugins)&&this.store.empOptions.plugins.length>0&&(this.store.empOptions.plugins.map(t=>{e.push(t.rsConfig(this.store))}),await Promise.all(e))}get debug(){let e=!1;return this.store.cliOptions.doctor&&(e={}),this.assign({loggerLevel:"info",clearLog:!0,progress:!0,showRsconfig:!1,showPerformance:!1,rsdoctor:e,infrastructureLogging:{appendOnly:!0,level:"warn"},newTreeshaking:this.store.empConfig.isESM,devShowAllLog:!1,showScriptDebug:!1,cssChunkingPlugin:!0,warnRuleAsWarning:!0},this.store.empOptions.debug)}get build(){let e=this.store.empOptions.build?.staticDir?`${this.store.empOptions.build?.staticDir}/`:"",t={js:this.store.isDev?"cheap-module-source-map":"source-map",css:!1};return this.store.empOptions.build?.sourcemap===!0&&(t.css=!0,t.js=this.store.isDev?"cheap-module-source-map":"source-map"),this.store.empOptions.build?.devtool&&(t.js=this.store.empOptions.build?.devtool),this.assign({outDir:"dist",staticDir:e,assetsDir:"assets",publicDir:"public",chunkIds:this.store.isDev?"named":"deterministic",moduleIds:this.store.isDev?"named":"deterministic",sourcemap:t,minify:!this.store.isDev,minOptions:{},cssminOptions:{},target:"es5",polyfill:{mode:void 0,entryCdn:void 0,splitChunks:!1,include:[],coreJsFeatures:"stable",externalHelpers:!1,browserslist:this.store.browserslistOptions.default},swcConfig:{},devtool:this.store.isDev?"cheap-module-source-map":"source-map"},{...this.store.empOptions.build,staticDir:e})}get html(){let e=this.store.empOptions.html?.template?{}:{charset:{charset:"utf-8"},"http-equiv":{"http-equiv":"X-UA-Compatible",content:"IE=edge"},viewport:{name:"viewport",content:"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"},keywords:{keywords:""},description:{description:""}};return this.assign({lang:"zh-CN",title:"EMP",inject:"body",minify:!this.store.isDev,scriptLoading:this.isESM?"module":"defer",meta:e,cache:this.cache!==!1,tags:[]},this.store.empOptions.html)}get entries(){return this.store.empOptions.entries?this.store.empOptions.entries:{}}get server(){let e={host:"0.0.0.0",port:8e3,open:process.platform==="darwin",hot:!0,watchFiles:["src/**/*.html"],static:[{directory:this.store.publicDir,watch:this.store.isDev}],allowedHosts:["all"],historyApiFallback:!0,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":"X-Requested-With, content-type, Authorization"}};return this.store.empOptions.server?.http2&&(this.store.server.httpsType="h2",delete this.store.empOptions.server.http2),this.assign(e,this.store.empOptions.server)}get css(){return this.assign({sass:{mode:"modern",warnRuleAsWarning:this.store.empConfig.debug.warnRuleAsWarning},less:{lessOptions:{javascriptEnabled:!0,math:"always"}},prifixName:""},this.store.empOptions.css)}get output(){let e=(this.store.isDev,".[contenthash:8]"),t=this.store.isDev?"":".[contenthash:8]",{assetsDir:i,staticDir:r}=this.store.empConfig.build,o={publicPath:this.store.empConfig.base?this.store.empConfig.base:"auto",crossOriginLoading:"anonymous",filename:`${r}js/[name]${e}.js`,cssFilename:`${r}css/[name]${t}.css`,cssChunkFilename:`${r}css/[name]${t}.css`,assetModuleFilename:`${r}${i}/[name]${e}[ext][query]`,path:this.store.outDir,clean:!this.store.isDev,uniqueName:this.store.uniqueName};return this.assign(o,this.store.empOptions.output)}get define(){let e={mode:this.store.mode,env:this.store.cliOptions.env};return this.store.empOptions.define&&(e={...e,...this.store.empOptions.define}),this.setDefine(e)}get tsCheckerRspackPlugin(){let e={};if(this.store.empOptions.tsCheckerRspackPlugin)typeof this.store.empOptions.tsCheckerRspackPlugin=="object"&&(e=this.store.empOptions.tsCheckerRspackPlugin);else return!1;return this.assign({},e)}setDefine(e){let t=this.store.empOptions.defineFix?this.store.empOptions.defineFix:this.isESM?"esm":"cjs",i={};return Object.keys(e).map(r=>{t==="all"?(i[`import.meta.env.${r}`]=JSON.stringify(e[r]),i[`process.env.${r}`]=JSON.stringify(e[r])):t==="esm"?i[`import.meta.env.${r}`]=JSON.stringify(e[r]):t==="cjs"?i[`process.env.${r}`]=JSON.stringify(e[r]):t==="none"&&(i[`${r}`]=JSON.stringify(e[r]))}),i}get externals(){return this.assign({},this.store.empOptions.externals)}get resolve(){return R({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="store.jiti.loadConfig.empConfig";if(h.time(e),!this.store.rootPaths.empConfig)return;let{default:t}=await Yt(this.store.rootPaths.empConfig);typeof t=="function"?this.store.empOptions=await t(this.store):this.store.empOptions=t||{},h.timeEnd(e)}get moduleTransformRule(){let{moduleTransform:e}=this.store.empOptions,t=this.assign({defaultExclude:!1},e),i={and:[],not:[]};return t.defaultExclude===!0&&i.and.push(/(node_modules|bower_components)/),t?.exclude&&(i.and=i.and.concat(t.exclude)),e?.include&&(i.not=t.include),i}get cacheDir(){return this.store.empOptions.cacheDir?this.store.empOptions.cacheDir:"node_modules/.emp-cache"}get cache(){return this.store.empOptions.cache===!1?!1:this.store.empOptions.cache?this.store.empOptions.cache:"persistent"}get ignoreWarnings(){return this.store.empOptions.ignoreWarnings?this.store.empOptions.ignoreWarnings:[/Conflicting order/]}get autoPages(){let e;return this.store.empOptions.autoPages&&(e=typeof this.store.empOptions.autoPages=="boolean"?{}:this.store.empOptions.autoPages,e=this.assign({path:"pages"},e)),e}},ts=new Ze});import ar from"fs-extra";var et,is,rs=v(()=>{"use strict";p();Ce();et=class{store;async setup(e){this.store=e;let t=[this.common(),this.stats(),this.devServer(),this.optimization(),this.checkTsconfig()];await Promise.all(t)}get cache(){if(this.store.empConfig.cache===!1)return!1;let e={type:this.store.empConfig.cache==="persistent"?"persistent":"memory",buildDependencies:Kt(),version:this.store.empConfig.server.port?`${this.store.empPkg.version}_${this.store.empConfig.server.port}`:this.store.empPkg.version};return typeof this.store.empConfig.cache=="object"&&(e=this.store.deepAssign(e,this.store.empConfig.cache)),e}get name(){let e=this.store.empConfig.server.port?`_${this.store.empConfig.server.port}`:"";return this.store.pkg.name+e}async common(){this.store.merge({name:this.name,node:{global:!0},experiments:{nativeWatcher:!0,lazyBarrel:!0,inlineConst:!0,inlineEnum:!0,typeReexportsPresence:!0,outputModule:this.store.empConfig.isESM,topLevelAwait:!0,asyncWebAssembly:!0,css:!0,rspackFuture:{bundlerInfo:{force:!1}},cache:this.cache,incremental:"advance-silent",parallelLoader:!0},lazyCompilation:this.store.isDev,target:this.store.empConfig.target,infrastructureLogging:this.store.empConfig.debug.infrastructureLogging,context:this.store.root,mode:this.store.mode,cache:!!this.store.empConfig.cache,devtool:this.store.empConfig.build.sourcemap.js,output:this.store.empConfig.output,resolve:this.store.empConfig.resolve,externals:this.store.empConfig.externals,ignoreWarnings:this.store.empConfig.ignoreWarnings,watchOptions:{ignored:["**/node_modules/**","**/@mf-types/**"]}})}async checkTsconfig(){let e=this.store.resolve("tsconfig.json");if(await ar.exists(e)){let i={};this.store.isOldRspack?i.tsConfigPath=e:i.tsConfig=e,this.store.merge({resolve:i})}}async stats(){this.store.merge({stats:{colors:!0,all:!1,assets:!1,chunks:!1,timings:!0,version:!0}})}async devServer(){this.store.merge({devServer:this.store.empConfig.server})}async optimization(){let e={moduleIds:this.store.empConfig.build.moduleIds,chunkIds:this.store.empConfig.build.chunkIds,minimize:this.store.empConfig.build.minify,splitChunks:{chunks:"all",minSize:2e4,minChunks:1,automaticNameDelimiter:"-",cacheGroups:{vendors:{test:/[\\/]node_modules[\\/]/,name:"vendor",priority:-10,reuseExistingChunk:!0},default:{minChunks:2,priority:-20,reuseExistingChunk:!0}}}};this.store.empConfig.build.polyfill.mode==="entry"&&this.store.empConfig.build.polyfill.splitChunks&&!this.store.empConfig.build.polyfill.entryCdn&&(e.splitChunks.cacheGroups.coreJs={test:/[\\/]node_modules[\\/](core-js)[\\/]/,name:"coreJs",chunks:"all",enforce:!0}),this.store.chain.merge({optimization:e})}},is=new et});var tt,os,ns=v(()=>{"use strict";p();tt=class{store;async setup(e){this.store=e;let t=[this.sass(),this.less(),this.css()];await Promise.all(t)}async sass(){let{rule:e,use:t}=this.store.chainName,i={},{sass:r}=this.store.empConfig.css;r.mode==="modern"&&(i.implementation=r.implementation?r.implementation:k.resolve("sass-embedded"),i.api="modern-compiler",i.sourceMap=this.store.empConfig.build.sourcemap.css,r.sassOptions&&(i.sassOptions=r.sassOptions)),typeof r.additionalData<"u"&&(i.additionalData=r.additionalData),typeof r.warnRuleAsWarning<"u"&&(i.warnRuleAsWarning=r.warnRuleAsWarning),typeof r.webpackImporter<"u"&&(i.webpackImporter=r.webpackImporter),this.store.chain.merge({module:{rule:{[e.sass]:{test:/\.(sass|scss)$/,use:{[t.sass]:{loader:k.resolve("sass-loader"),options:i}},type:"css/auto"}}}})}async less(){let{rule:e,use:t}=this.store.chainName,{lessOptions:i}=this.store.empConfig.css.less,r={loader:k.resolve("less-loader"),options:{lessOptions:i}};this.store.chain.merge({module:{rule:{[e.less]:{test:/\.less$/,use:{[t.less]:r},type:"css/auto"}}}})}async css(){let{rule:e}=this.store.chainName;this.store.chain.merge({module:{rule:{[e.css]:{test:/\.css$/,use:{},type:"css/auto"}}}})}},os=new tt});import st from"html-webpack-plugin";function lr(){let s=[`import 'core-js/${d.empConfig.build.polyfill.coreJsFeatures}'`].join(`
11
11
  `);return Xe(s)}var Pe,se,xe=v(()=>{"use strict";p();I();$();Pe=class{constructor(){}apply(e){let{webpack:t}=e;d.empConfig.build.polyfill.entryCdn||new t.EntryPlugin(e.context,lr(),{name:void 0}).apply(e)}},se=class{PluginName="HtmlEmpInjectPlugin";chunk="";files=[];constructor(e,t="",i=""){this.PluginName=`${this.PluginName}-${t}`,this.files=e,this.chunk=i}apply(e){e.hooks.compilation.tap(this.PluginName,t=>{st.getHooks(t).alterAssetTagGroups.tapPromise(this.PluginName,async i=>(this.chunk&&!i.plugin.userOptions.chunks?.includes(this.chunk)||this.files.map(r=>{let{pos:o,...a}=r;(o==="body"?i.bodyTags:i.headTags).push({attributes:{},voidTag:!1,meta:{plugin:void 0},tagName:"script",...a})}),i))})}}});import N from"path";var it,as,ls=v(()=>{"use strict";p();K();xe();it=class{store;entriesConfig={};async setup(e){this.store=e,await this.init(),this.toConfig()}setHtmlConfig(e,t){return e.template=this.setTemplate(e.template),e.favicon=this.setFavicion(e.favicon),e.chunks=t,e.filename=`${t[0]}.html`,this.store.empConfig.base&&(e.publicPath=this.store.empConfig.base),this.prepareAndSetAsset(e),e}prepareAndSetAsset(e){let t=e.chunks?e.chunks[0]:void 0;this.store.injectTags(e.tags,t?`injectTags-${t}`:"injectTags",t),delete e.tags}injectPolyfill(){if(!this.store.empConfig.build.polyfill.entryCdn)return;let e=[{attributes:{src:this.store.empConfig.build.polyfill.entryCdn},tagName:"script",pos:"head"}];this.store.injectTags(e,"injectEMPPolyfill")}setChunk(e){return e.replace(N.extname(e),"").replace(`${this.store.empConfig.appSrc}${N.sep}`,"")}setTemplate(e){return e?this.store.resolve(e):this.store.empResolve(N.join("template","index.html"))}setFavicion(e){if(e!=="")return e?this.store.resolve(e):this.store.empResolve(N.join("template","favicon.ico"))}setEntryItem(e,t,i){i=i||this.store.resolve(N.join(this.store.empConfig.appSrc,e));let r=this.setChunk(e),o=[i];this.entriesConfig[r]={entry:{[r]:o},html:this.setHtmlConfig(t,[r])},this.store.entries[r]=o}setRspackHtmlPlugin(e,t){this.store.chain.plugin(`${this.store.chainName.plugin.html.prefix}${t}`).use(st,[e])}setRspackEntry(e){this.store.merge({entry:e})}async init(){this.injectPolyfill(),this.store.empConfig.autoPages?await this.setAutoPage():(await this.setDefaultEntry(),this.setEntryByConfig())}async setAutoPage(){h.time("setAutoPage");let e=this.store.empConfig.autoPages?.path||"pages",t=N.join(this.store.appSrc,e),i=N.join(t,"**","*.{ts,tsx,jsx,js}"),r=await be([i],{windowsPathsNoEscape:!0});r=r.map(o=>o.replace(`${t}${N.sep}`,"")),r.map(o=>{let a=this.store.empConfig.entries[o]||{};this.setEntryItem(o,{...this.store.empConfig.html,...a},N.join(t,o))}),h.timeEnd("setAutoPage")}async setDefaultEntry(){let e="store.empConfig.setDefaultEntry";h.time(e);let t=N.join(this.store.appSrc,this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index.{ts,tsx,jsx,js}"),i=await be([t],{windowsPathsNoEscape:!0});if(i[0]){let r=N.join(this.store.empConfig.appSrc,Object.keys(this.store.empConfig.entries).length>0&&this.store.empConfig.appEntry?this.store.empConfig.appEntry:"index");this.setEntryItem(r,this.store.empConfig.html,i[0])}h.timeEnd(e)}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)}},as=new it});import cs from"path";var rt,ps,hs=v(()=>{"use strict";p();I();rt=class{store;swcJsOptions={};swcTsOptions={};coreJs={version:"3",alias:"",path:""};async setup(e){this.store=e,this.swcInitOptions(),await this.run()}async run(){let e=[this.jsDataUrl(),this.files(),this.scripts(),this.rspackGenerator(),this.rspackParser()];await this.store.empConfig.lifeCycle.beforeModule(),await Promise.all(e),await this.store.empConfig.lifeCycle.afterModule()}rspackGenerator(){let e=this.store.empConfig.css?.prifixName?`${this.store.empConfig.css?.prifixName}-`:"",t=this.store.isDev?`${e}[id]-[local]-[hash:base64:8]`:`${e}[local]-[hash:5]`;this.store.chain.merge({module:{generator:{"css/auto":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:t,esModule:!0},css:{exportsOnly:!1,esModule:!0},"css/module":{exportsConvention:"as-is",exportsOnly:!1,localIdentName:t,esModule:!0},json:{JSONParse:!0}}}})}rspackParser(){this.store.chain.merge({module:{parser:{javascript:{dynamicImportMode:"lazy",dynamicImportPrefetch:!1,dynamicImportPreload:!1,url:!0,importMeta:!0},css:{namedExports:!1},"css/auto":{namedExports:!1},"css/module":{namedExports:!1}}}})}get isPolyfill(){return!!this.store.empConfig.build.polyfill.mode}swcParser(e){switch(e){case"js":return{syntax:"ecmascript",jsx:!0,decorators:!0,decoratorsBeforeExport:!1};case"ts":return{syntax:"typescript",decorators:!0,tsx:!0,dynamicImport:!0}}}swcJsc(e){let{target:t,polyfill:i}=this.store.empConfig.build,{externalHelpers:r}=i;return{parser:this.swcParser(e),transform:{},target:t,externalHelpers:r,preserveAllComments:!0}}get swcCoreVersion(){let[e,t]=this.coreJs.version.split(".");return`${e}.${t}`}swcOptions(e){let t={jsc:R(this.swcJsc(e),{...this.store.empConfig.build.swcConfig}),isModule:"unknown"};return this.isPolyfill&&(delete t.jsc.target,t.env={coreJs:this.swcCoreVersion,targets:this.store.empConfig.build.polyfill.browserslist},this.store.empConfig.isESM||(t.env.mode=this.store.empConfig.build.polyfill.mode),this.store.empConfig.build.polyfill.mode==="usage"&&(t.env.shippedProposals=!0,t.env.include=this.store.empConfig.build.polyfill.include)),t}swcInitOptions(){let{externalHelpers:e}=this.store.empConfig.build.polyfill;e&&this.store.chain.resolve.alias.set("@swc/helpers",cs.dirname(k.resolve("@swc/helpers/package.json"))),this.coreJs.path=k.resolve("core-js/package.json");let t=Ye(this.coreJs.path);t&&(this.coreJs.version=t),this.coreJs.alias=cs.dirname(this.coreJs.path),this.store.empConfig.build.polyfill.mode&&(this.store.chain.resolve.alias.set("core-js",this.coreJs.alias),this.store.chain.module.rule("javascript").exclude.add(/core-js/),this.store.chain.module.rule("typescript").exclude.add(/core-js/)),this.swcTsOptions=this.swcOptions("ts"),this.swcJsOptions=this.swcOptions("js")}jsDataUrl(){this.store.chain.module.rule("jsDataUrl").merge({mimetype:{or:["text/javascript","application/javascript"]}}).resolve.set("fullySpecified",!1).end().use("swcJsParser").loader("builtin:swc-loader").options(this.swcJsOptions)}async scripts(){let e=[],{rule:t,use:i}=this.store.chainName;this.store.chain.merge({module:{parser:{javascript:{exportsPresence:"error",importExportsPresence:"error"}},rule:{[t.mjs]:{test:/\.m?js/,resolve:{fullySpecified:!1}},[t.typescript]:{test:/\.(ts|tsx)$/,exclude:e,use:{[i.swc]:{loader:"builtin:swc-loader",options:this.swcTsOptions}}},[t.javascript]:{test:/\.((m|c)?js|jsx)$/,exclude:e,use:{[i.swc]:{loader:"builtin:swc-loader",options:this.swcJsOptions}}}}}})}async files(){let{rule:e}=this.store.chainName;this.store.chain.merge({module:{rule:{[e.svg]:{test:/\.svg$/,type:"asset/resource"}}}}),this.store.chain.merge({module:{rule:{[e.inline]:{resourceQuery:/inline/,type:"asset/inline"}}}}),this.store.chain.merge({module:{rule:{[e.raw]:{resourceQuery:/raw/,type:"asset/source"}}}}),this.store.chain.merge({module:{rule:{[e.image]:{test:/\.(png|jpe?g|gif|webp|ico)$/i,type:"asset/resource"},[e.font]:{test:/\.(|otf|ttf|eot|woff|woff2)$/i,type:"asset/resource"},[e.svga]:{test:/\.(svga)$/i,type:"asset/resource"}}}})}},ps=new rt});import z from"@rspack/core";import fs from"fs";import{TsCheckerRspackPlugin as cr}from"ts-checker-rspack-plugin";var ot,us,ms=v(()=>{"use strict";p();xe();ot=class{store;async setup(e){this.store=e;let t=[this.define(),this.anylayze(),this.progress(),this.copy(),this.minify(),this.redoctor(),this.sourceMapDevToolPlugin(),this.tsCheckerRspackPlugin(),this.cssChunkingPlugin()];this.beforeLifeCycle(),await this.store.empConfig.lifeCycle.beforePlugin(),await Promise.all(t),await this.store.empConfig.lifeCycle.afterPlugin()}beforeLifeCycle(){let{store:e}=this;e.empConfig.build.polyfill.mode==="entry"&&e.chain.plugin("empPolyfill").use(Pe)}async anylayze(){if(!this.store.cliOptions.analyze)return;let{default:{BundleAnalyzerPlugin:e}}=await import("webpack-bundle-analyzer");this.store.chain.plugin(this.store.chainName.plugin.bundleAnalyzer).use(e,[{analyzerPort:this.store.empConfig.server.port,defaultSizes:"gzip",analyzerHost:this.store.getLanIp()||"127.0.0.1"}])}tsCheckerRspackPlugin(){if(this.store.empConfig.tsCheckerRspackPlugin===!1)return!1;this.store.chain.plugin(this.store.chainName.plugin.tsCheckerRspackPlugin).use(cr,[this.store.empConfig.tsCheckerRspackPlugin])}async define(){this.store.chain.plugin(this.store.chainName.plugin.define).use(z.DefinePlugin,[this.store.empConfig.define])}async copy(){let e=this.store.resolve("public");fs.existsSync(e)&&fs.readdirSync(e).length>0&&this.store.chain.plugin(this.store.chainName.plugin.copy).use(z.CopyRspackPlugin,[{patterns:[{from:e,to:this.store.resolve(this.store.empConfig.build.outDir),noErrorOnMissing:!0,globOptions:{ignore:["**/.DS_Store"]}}]}])}async progress(){if(this.store.mode==="development")return;let e={};this.store.isOldRspack||(e={template:"{bar:25.green/white}{spinner:.green}{percent}% {wide_msg:.dim}",tick:void 0,progressChars:"\u25A9\u25A9"}),this.store.chain.plugin(this.store.chainName.plugin.progress).use(z.ProgressPlugin,[e])}minify(){this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minJs).use(z.SwcJsMinimizerRspackPlugin,[this.store.empConfig.build.minOptions]);let{SwcCssMinimizerRspackPlugin:e,LightningCssMinimizerRspackPlugin:t}=z;e?this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(e,[this.store.empConfig.build.cssminOptions]):t&&this.store.chain.optimization.minimizer(this.store.chainName.minimizer.minCss).use(t,[this.store.empConfig.build.cssminOptions])}redoctor(){if(!this.store.empConfig.debug.rsdoctor)return;let{RsdoctorRspackPlugin:e}=k("@rsdoctor/rspack-plugin"),t={};typeof this.store.empConfig.debug.rsdoctor=="object"&&(t=this.store.empConfig.debug.rsdoctor),this.store.chain.plugin(this.store.chainName.plugin.rsdoctor).use(e,[t])}sourceMapDevToolPlugin(){typeof this.store.empConfig.build.sourcemap=="object"&&this.store.empConfig.build.sourcemap?.devToolPluginOptions&&this.store.chain.plugin(this.store.chainName.plugin.sourceMapDevTool).use(z.SourceMapDevToolPlugin,[this.store.empConfig.build.sourcemap.devToolPluginOptions])}circularDependency(){this.store.chain.plugin("circularDependency").use(z.CircularDependencyRspackPlugin,[{}])}cssChunkingPlugin(){this.store.empConfig.debug.cssChunkingPlugin&&this.store.chain.plugin("CssChunkingPlugin").use(z.experiments.CssChunkingPlugin,[{}])}},us=new ot});var nt,ds,gs=v(()=>{"use strict";p();rs();ns();ls();hs();ms();nt=class{store;async setup(e){this.store=e;let t=[is.setup(this.store),ps.setup(this.store),us.setup(this.store),as.setup(this.store),os.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()}},ds=new nt});import pr from"net";import hr from"os";async function _e(s,e=void 0){if(s!==fr&&(s<ys||s>at))throw new Error(`Port number must lie between ${ys} and ${at}`);let t=s,i=ur(),r;e&&!i.has(e)?r=new Set([e]):r=i;let o=new Set(["EADDRINUSE","EACCES"]);for(;t<=at;)try{return await dr(t,r)}catch(a){if(!o.has(a.code))throw a;t+=1}throw new Error("No available ports found")}var ys,at,fr,ur,mr,dr,ws=v(()=>{"use strict";p();ys=1024,at=65535,fr=443,ur=()=>{let s=hr.networkInterfaces(),e=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(s))if(t)for(let i of t)e.add(i.address);return e},mr=(s,e)=>new Promise((t,i)=>{let r=pr.createServer();r.unref(),r.on("error",i),r.listen(s,e,()=>{let{port:o}=r.address();r.close(()=>{t(o)})})}),dr=async(s,e)=>{let t=new Set(["EADDRNOTAVAIL","EINVAL"]);for(let i of e)try{await mr(s,i)}catch(r){if(!t.has(r.code))throw r}return s}});import gr from"chalk";import vs from"url";var lt,Se,bs=v(()=>{"use strict";p();X();I();lt=class{imf={protocol:"",port:8e3,pathname:"/"};host="0.0.0.0";urls={lanUrlForConfig:"",lanUrlForTerminal:q("unavailable"),localUrlForTerminal:"",localUrlForBrowser:""};setup(e){e.host&&(this.host=e.host),e.protocol&&(this.imf.protocol=e.protocol),e.pathname&&(this.imf.pathname=e.pathname),e.port&&(this.imf.port=e.port),this.setupUrls()}setupUrls(){let{host:e}=this,t=e==="0.0.0.0"||e==="::",i;if(t){i="localhost";try{this.urls.lanUrlForConfig=this.getLanIp(),this.urls.lanUrlForConfig&&(/^10[.]|^172[.](1[6-9]|2[0-9]|3[0-1])[.]|^192[.]168[.]/.test(this.urls.lanUrlForConfig)?this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig):this.urls.lanUrlForConfig="")}catch{}}else i=e,this.urls.lanUrlForConfig=e,this.urls.lanUrlForTerminal=this.prettyPrintUrl(this.urls.lanUrlForConfig);this.urls.localUrlForTerminal=this.prettyPrintUrl(i),this.urls.localUrlForBrowser=this.formatUrl(i)}getLanIp=U;formatUrl(e){let{protocol:t,port:i,pathname:r}=this.imf;return vs.format({protocol:t,hostname:e,port:i,pathname:r})}prettyPrintUrl(e){let{protocol:t,port:i,pathname:r}=this.imf;return vs.format({protocol:t,hostname:e,port:gr.bold(i),pathname:r})}},Se=new lt});import{exec as yr}from"child_process";import{promisify as wr}from"util";var Es,Cs,vr,br,Ps,xs=v(()=>{"use strict";p();$();L();Es=wr(yr),Cs=["Google Chrome Canary","Google Chrome Dev","Google Chrome Beta","Google Chrome","Microsoft Edge","Brave Browser","Vivaldi","Chromium"],vr=async()=>{let s=process.env.BROWSER;if(!s||!Cs.includes(s)){let{stdout:e}=await Es("ps cax");s=Cs.find(t=>e.includes(t))}return s},br=async s=>{if(process.platform==="darwin")try{let t=await vr();if(t){let i=`osascript openChrome.applescript "${encodeURI(s)}" "${t}"`;return await Es(i,{cwd:d.resource.dir}),!0}}catch(t){h.debug(t)}try{let{default:t}=await import("open");return await t(s),!0}catch(t){return h.error("Failed to open start URL."),h.error(t),!1}},Ps=br});import _s from"fs/promises";var ke,Ss=v(()=>{"use strict";p();K();X();ws();bs();xs();I();ke=class{ip=U();host=this.ip;isAutoDevBase=!1;isHttps=!1;httpsType="default";protocol="http";port=8e3;store;publicPath="/";publicHasHttp=!1;isOpenBrower=!1;url="";urls={localUrlForBrowser:"",localUrlForTerminal:"",lanUrlForTerminal:"",lanUrlForConfig:""};constructor(e){this.store=e}async setupOnEmpOptionSync(){this.store.cliAction!=="build"&&(this.port=await _e(this.port),this.setHttps(),await this.setAutoDevBase())}get config(){return{}}async setupOnStore(){if(this.store.cliAction==="build")return;let{store:e}=this;this.publicPath=e.rsConfig.output?.publicPath==="auto"?"/":e.rsConfig.output?.publicPath||"/",this.isOpenBrower=!!e.empConfig.server.open,this.protocol=this.isHttps?"https":"http",this.host=e.empConfig.server.host?e.empConfig.server.host:this.ip,e.empConfig.server.port&&e.empConfig.server.port!==this.port&&(this.port=await _e(e.empConfig.server.port)),Se.setup(this),this.publicPath&&(this.publicPath.indexOf("http://")>-1||this.publicPath.indexOf("https://")>-1)?(this.url=this.publicPath,this.publicHasHttp=!0,this.urls.localUrlForTerminal=Se.prettyPrintUrl("localhost")):(this.urls=Se.urls,this.url=this.urls.localUrlForBrowser)}startOpen(){let{urls:e}=this;this.publicHasHttp?(h.info(`${M("\u279C")} Local: ${h.link(e.localUrlForTerminal)}`),h.info(`${M("\u279C")} Network: ${h.link(this.publicPath)}`)):(h.info(`${M("\u279C")} Local: ${h.link(e.localUrlForTerminal)}`),h.info(`${M("\u279C")} Network: ${h.link(e.lanUrlForTerminal)}
12
- `)),this.isOpenBrower&&Ps(this.url)}async getcert(){let{store:e}=this,t=this.store.rsConfig.devServer||{server:{type:"http"}};if(typeof t.server=="object"&&t.server.type==="https"&&t.server.options&&t.server.options.key&&t.server.options.cert)return t.server.options;let[i,r]=await Promise.all([_s.readFile(e.resource.key),_s.readFile(e.resource.cert)]);return{key:i,cert:r}}setHttps(){let{store:e}=this,{server:t,https:i}=e.empOptions.server||{};this.isHttps=t==="https"||typeof t=="object"&&t.type==="https"||i===!0}async setAutoDevBase(){let{store:e}=this;this.isAutoDevBase=!!e.empOptions.autoDevBase&&e.mode==="development"&&!this.isHttpBase,this.isAutoDevBase&&(this.protocol=this.isHttps?"https":"http",e.empOptions.server?.port&&(this.port=e.empOptions.server.port),this.port=await _e(this.port),e.empOptions.base=`${this.protocol}://${this.host}:${this.port}/`,e.empOptions.server=e.deepAssign({port:this.port,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${this.host}:${this.port}/ws`}},e.empOptions.server))}get isHttpBase(){let e=this.store.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}}});import Cr from"fs/promises";import F from"path";import Er from"util";import{rspack as ks}from"@rspack/core";var ct,d,$=v(()=>{"use strict";p();Ce();L();I();Qe();ss();gs();Ss();Qe();xe();ct=class{rspack=ks;rspackVersion=ks.rspackVersion;isOldRspack=we(this.rspackVersion,"1.0.0")===-1;empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=F.resolve(w,g).replace(`${F.sep}dist${F.sep}index.js`,"");empSource=F.resolve(this.empRoot,"dist");resolve=e=>F.isAbsolute(e)?e:F.resolve(this.root,e);empResolve=e=>F.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};chainName=Zt;server=new ke(this);cacheDir="";mode="development";cliMode="dev";isDev=!0;chain;rsConfig;empOptions={};empConfig;entries={};debug;cliAction;cliOptions;rootPaths={empConfig:void 0,tsConfig:void 0,pkg:void 0};beforeSetup;afterSetup;async setup(e,t){this.cliAction=e||this.cliAction,this.cliOptions=t||this.cliOptions;let i="store.setup";h.time(i),this.beforeSetup&&await this.beforeSetup();let[r,o]=await Promise.all([qt(),Xt()]);this.rootPaths.empConfig=r,this.rootPaths.tsConfig=o,this.rootPaths.pkg=this.resolve("package.json"),await this.initVars(this.cliAction,this.cliOptions),this.empConfig=ts,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new Qt,await ds.setup(this),this.setLogger(),this.toConfig(),this.logConfig(),await this.server.setupOnStore(),this.afterSetup&&await this.afterSetup(),h.timeEnd(i),this.debug.clearLog&&qe()}async initVars(e,t){this.cliAction=e,this.cliOptions=t||{},this.cliMode="prod",this.mode=e==="dev"?"development":"production",this.isDev=this.mode==="development",process.env.NODE_ENV=e==="dev"?"development":"production";let i=k(this.empResolve("package.json")),r=k(this.resolve("package.json"));this.empPkg={...this.empPkg,...i},this.pkg={...this.pkg,...r},this.resource.dir=F.join(this.empRoot,"resource"),this.resource.cert=F.join(this.resource.dir,"emp.cert"),this.resource.key=F.join(this.resource.dir,"emp.key")}initPaths(){this.appSrc=this.resolve(this.empConfig.appSrc),this.outDir=this.resolve(this.empConfig.build.outDir),this.publicDir=this.resolve(this.empConfig.build.publicDir),this.cacheDir=this.resolve(this.empConfig.cacheDir)}loggerExtensionName="";setLoggerExtensionName(e){this.loggerExtensionName=e}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),h.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}${this.loggerExtensionName?" "+this.loggerExtensionName:""}`,brandName:"EMP",logLevel:e})}merge(e){this.chain.merge(e)}toConfig(){this.rsConfig=this.chain.toConfig()}logConfig(){if(this.debug.showRsconfig)if(typeof this.debug.showRsconfig=="string"){let e=F.join(this.root,this.debug.showRsconfig);Cr.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"?R(e,this.debug.showRsconfig):e;console.log(h.link("[Compile Config]")),console.log(Er.inspect(this.rsConfig,t))}}get browserslistOptions(){return{default:["chrome >= 87","edge >= 88","firefox >= 78","safari >= 14"],h5:["iOS >= 9","Android >= 4.4","last 2 versions","> 0.2%","not dead"],node:["node >= 16"]}}get uniqueName(){return this.encodeVarName(this.pkg.name)}encodeVarName(e){return e.replaceAll("/","_").replaceAll("@","_").replaceAll("-","_")}vCompare=we;deepAssign=R;getLanIp=U;injectTags(e=[],t="",i=""){this.chain.plugin(`${se}-${t}`).use(se,[e,t,i])}},d=new ct});import Pr from"fs";import H from"path";import B from"chalk";import{gzipSizeSync as xr}from"gzip-size";function Rr(s,e){let t=[s,e],i=["File","Size","Gzipped"].reduce((r,o,a)=>{let n=t[a],l=o;return n&&(l=o.length<n?o+" ".repeat(n-o.length):o),`${r+l} `}," ");console.log(Y.bold(i))}async function Os(s){let e=s.toJson({all:!1,assets:!0,timings:!0}),i=e.assets.filter(c=>Or(c.name)).map(Tr);i.sort((c,m)=>c.size-m.size);let r=Math.max(...i.map(c=>c.sizeLabel.length)),o=Math.max(...i.map(c=>(c.folder+H.sep+c.name).length));Rr(o,r);let a=0,n=0;i.forEach(c=>{let{sizeLabel:m}=c,{name:u,folder:b,gzipSizeLabel:C}=c,E=(b+H.sep+u).length,D=m.length;if(a+=c.size,n+=c.gzippedSize,D<r){let j=" ".repeat(r-D);m+=j}let S=q(c.folder+H.sep)+jr(c.name);if(E<o){let j=" ".repeat(o-E);S+=j}h.info(` ${S} ${q(m)} ${C}`)});let l=`${Y.bold("Total size:")} ${Oe(a)}`,f=`${Y.bold("Gzipped size:")} ${Oe(n)}`;h.info(`
12
+ `)),this.isOpenBrower&&Ps(this.url)}async getcert(){let{store:e}=this,t=this.store.rsConfig.devServer||{server:{type:"http"}};if(typeof t.server=="object"&&t.server.type==="https"&&t.server.options&&t.server.options.key&&t.server.options.cert)return t.server.options;let[i,r]=await Promise.all([_s.readFile(e.resource.key),_s.readFile(e.resource.cert)]);return{key:i,cert:r}}setHttps(){let{store:e}=this,{server:t,https:i}=e.empOptions.server||{};this.isHttps=t==="https"||typeof t=="object"&&t.type==="https"||i===!0}async setAutoDevBase(){let{store:e}=this;this.isAutoDevBase=!!e.empOptions.autoDevBase&&e.mode==="development"&&!this.isHttpBase,this.isAutoDevBase&&(this.protocol=this.isHttps?"https":"http",e.empOptions.server?.port&&(this.port=e.empOptions.server.port),this.port=await _e(this.port),e.empOptions.base=`${this.protocol}://${this.host}:${this.port}/`,e.empOptions.server=e.deepAssign({port:this.port,client:{webSocketURL:`${this.isHttps?"wss":"ws"}://${this.host}:${this.port}/ws`}},e.empOptions.server))}get isHttpBase(){let e=this.store.empOptions.base||"";return e.indexOf("http://")>-1||e.indexOf("https://")>-1}}});import Cr from"fs/promises";import F from"path";import Er from"util";import{rspack as ks}from"@rspack/core";var ct,d,$=v(()=>{"use strict";p();Ce();L();I();Qe();ss();gs();Ss();Qe();xe();ct=class{rspack=ks;rspackVersion=ks.rspackVersion;isOldRspack=we(this.rspackVersion,"1.0.0")===-1;empPkg={dependencies:{},devDependencies:{},version:"2.0.0",name:""};pkg={dependencies:{},devDependencies:{},version:"0.0.0",name:""};root=process.cwd();empRoot=F.resolve(w,g).replace(`${F.sep}dist${F.sep}index.js`,"");empSource=F.resolve(this.empRoot,"dist");resolve=e=>F.isAbsolute(e)?e:F.resolve(this.root,e);empResolve=e=>F.resolve(this.empRoot,e);appSrc="";outDir="";publicDir="";resource={dir:"",key:"",cert:""};chainName=Zt;server=new ke(this);cacheDir="";mode="development";cliMode="dev";isDev=!0;chain;rsConfig;empOptions={};empConfig;entries={};debug;cliAction;cliOptions;rootPaths={empConfig:void 0,tsConfig:void 0,pkg:void 0};async setup(e,t){this.cliAction=e||this.cliAction,this.cliOptions=t||this.cliOptions;let i="store.setup";h.time(i);let[r,o]=await Promise.all([qt(),Xt()]);this.rootPaths.empConfig=r,this.rootPaths.tsConfig=o,this.rootPaths.pkg=this.resolve("package.json"),await this.initVars(this.cliAction,this.cliOptions),this.empConfig=ts,await this.empConfig.setup(this),this.debug={...this.empConfig.debug},this.initPaths(),this.chain=new Qt,await ds.setup(this),this.setLogger(),this.toConfig(),this.logConfig(),await this.server.setupOnStore(),h.timeEnd(i),this.debug.clearLog&&qe()}async initVars(e,t){this.cliAction=e,this.cliOptions=t||{},this.cliMode="prod",this.mode=e==="dev"?"development":"production",this.isDev=this.mode==="development",process.env.NODE_ENV=e==="dev"?"development":"production";let i=k(this.empResolve("package.json")),r=k(this.resolve("package.json"));this.empPkg={...this.empPkg,...i},this.pkg={...this.pkg,...r},this.resource.dir=F.join(this.empRoot,"resource"),this.resource.cert=F.join(this.resource.dir,"emp.cert"),this.resource.key=F.join(this.resource.dir,"emp.key")}initPaths(){this.appSrc=this.resolve(this.empConfig.appSrc),this.outDir=this.resolve(this.empConfig.build.outDir),this.publicDir=this.resolve(this.empConfig.build.publicDir),this.cacheDir=this.resolve(this.empConfig.cacheDir)}loggerExtensionName="";setLoggerExtensionName(e){this.loggerExtensionName=e}setLogger(){let e=this.cliMode==="dev"?"debug":"info";this.debug.loggerLevel&&(e=this.debug.loggerLevel),h.setup({fullName:`EMP\u26A1${this.empPkg.version}${this.cliMode==="dev"?".DEV":""}${this.loggerExtensionName?" "+this.loggerExtensionName:""}`,brandName:"EMP",logLevel:e})}merge(e){this.chain.merge(e)}toConfig(){this.rsConfig=this.chain.toConfig()}logConfig(){if(this.debug.showRsconfig)if(typeof this.debug.showRsconfig=="string"){let e=F.join(this.root,this.debug.showRsconfig);Cr.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"?R(e,this.debug.showRsconfig):e;console.log(h.link("[Compile Config]")),console.log(Er.inspect(this.rsConfig,t))}}get browserslistOptions(){return{default:["chrome >= 87","edge >= 88","firefox >= 78","safari >= 14"],h5:["iOS >= 9","Android >= 4.4","last 2 versions","> 0.2%","not dead"],node:["node >= 16"]}}get uniqueName(){return this.encodeVarName(this.pkg.name)}encodeVarName(e){return e.replaceAll("/","_").replaceAll("@","_").replaceAll("-","_")}vCompare=we;deepAssign=R;getLanIp=U;injectTags(e=[],t="",i=""){this.chain.plugin(`${se}-${t}`).use(se,[e,t,i])}},d=new ct});import Pr from"fs";import H from"path";import B from"chalk";import{gzipSizeSync as xr}from"gzip-size";function Rr(s,e){let t=[s,e],i=["File","Size","Gzipped"].reduce((r,o,a)=>{let n=t[a],l=o;return n&&(l=o.length<n?o+" ".repeat(n-o.length):o),`${r+l} `}," ");console.log(Y.bold(i))}async function Os(s){let e=s.toJson({all:!1,assets:!0,timings:!0}),i=e.assets.filter(c=>Or(c.name)).map(Tr);i.sort((c,m)=>c.size-m.size);let r=Math.max(...i.map(c=>c.sizeLabel.length)),o=Math.max(...i.map(c=>(c.folder+H.sep+c.name).length));Rr(o,r);let a=0,n=0;i.forEach(c=>{let{sizeLabel:m}=c,{name:u,folder:b,gzipSizeLabel:C}=c,E=(b+H.sep+u).length,D=m.length;if(a+=c.size,n+=c.gzippedSize,D<r){let j=" ".repeat(r-D);m+=j}let S=q(c.folder+H.sep)+jr(c.name);if(E<o){let j=" ".repeat(o-E);S+=j}h.info(` ${S} ${q(m)} ${C}`)});let l=`${Y.bold("Total size:")} ${Oe(a)}`,f=`${Y.bold("Gzipped size:")} ${Oe(n)}`;h.info(`
13
13
  ${l}
14
14
  ${f}
15
15
  `),h.info(`${B.green("ready ")}Built in ${ve(Number(e.time))}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empjs/cli",
3
- "version": "3.10.8-1",
3
+ "version": "3.10.8",
4
4
  "description": "emp",
5
5
  "license": "MIT",
6
6
  "type": "module",