@mahameru/cli 0.0.16 → 0.0.17
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/bin.js +583 -853
- package/mpm/assets/CartesianChart-B51AYOAb.js +2 -0
- package/mpm/assets/CategoricalChart-Co5NZKJw.js +11 -0
- package/mpm/assets/customer-insights-TeZ4O-CA.js +3 -0
- package/mpm/assets/dashboard-CJ1I00AU.js +2 -0
- package/mpm/assets/eye-DWDjYPPv.js +1 -0
- package/mpm/assets/index-C8qHc9ZS.js +108 -0
- package/mpm/assets/index-SBk3lk5W.css +1 -0
- package/mpm/assets/jsx-runtime-DIBGU2nq.js +1 -0
- package/mpm/assets/metrics-overview-BoKfDsgl.js +1 -0
- package/mpm/assets/not-found-BMYPEFbE.js +1 -0
- package/mpm/assets/project-DEpqfD40.js +1 -0
- package/mpm/assets/quick-actions-Dpas0JuQ.js +1 -0
- package/mpm/assets/recent-transactions-BVeaMgnN.js +1 -0
- package/mpm/assets/revenue-breakdown-e4JsCYXu.js +1 -0
- package/mpm/assets/sales-chart-BiTfVffl.js +1 -0
- package/mpm/assets/tooltipContext-D95ZMUkW.js +1 -0
- package/mpm/assets/top-products-Bhs_diJI.js +1 -0
- package/mpm/assets/trending-down-er9_YGzq.js +1 -0
- package/mpm/assets/trending-up-CnNmAQYy.js +1 -0
- package/mpm/favicon.svg +1 -0
- package/mpm/icons.svg +24 -0
- package/mpm/index.html +15 -0
- package/package.json +43 -53
- package/README.md +0 -115
package/bin.js
CHANGED
|
@@ -3,874 +3,604 @@
|
|
|
3
3
|
* ┌────────────────────────────────────────────┐
|
|
4
4
|
* │ │
|
|
5
5
|
* │ ▲ MahameruJS - CLI │
|
|
6
|
-
* │ Version: 0.0.
|
|
6
|
+
* │ Version: 0.0.17 │
|
|
7
7
|
* │ Built: 2026 │
|
|
8
8
|
* │ │
|
|
9
9
|
* │ Copyright (c) Bintan <hello@bintvn.co> │
|
|
10
10
|
* │ Licensed under the ISC License. │
|
|
11
11
|
* │ │
|
|
12
12
|
* └────────────────────────────────────────────┘
|
|
13
|
-
*/(()=>{var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
n
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
;const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
13
|
+
*/(()=>{"use strict";var e={634(e,t,o){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{
|
|
14
|
+
default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.build=function({rootPath:e}){return async()=>{
|
|
15
|
+
const t=".mahameru";const o=(0,l.join)(e,t)
|
|
16
|
+
;console.log(`${n.default.bold(n.default.cyan("▲ Mahameru"))} ${n.default.dim(`CLI v${s.version}`)}\n`);const r=(0,
|
|
17
|
+
i.default)(n.default.cyan(" Checking environment...")).start(),{tscJsPath:h,tscAliasJsPath:g}=(0,
|
|
18
|
+
c.ensureDevEnvironment)();try{r.text=n.default.cyan(" Starting build...\n"),await(0,d.deleteDirIfExists)(o),await(0,
|
|
19
|
+
f.buildConfigJson)(),await(0,p.generateRouteTypes)((0,l.join)(e,"routes"),(0,l.join)(o,"types","routes.d.ts"))
|
|
20
|
+
;const t="tsconfig.build.json",s=(0,l.join)(e,t),i=(0,l.join)(e,"tsconfig.json"),c=await(0,a.readFile)(i,"utf8")
|
|
21
|
+
;let y=null;try{y=JSON.parse(c),y.compilerOptions.outDir=".mahameru",y.compilerOptions.rootDir="src",await(0,
|
|
22
|
+
a.writeFile)(s,JSON.stringify(y,null,2))}catch(e){console.error(`Error parsing ${i}: ${e}`),process.exit(1)}
|
|
23
|
+
const v=await(0,u.runNodeScript)(h,["--project",t],e);0!==v&&(r.fail(n.default.red(" Build failed!")),await(0,
|
|
24
|
+
d.deleteDirIfExists)(o),process.exit(v));const w=await(0,u.runNodeScript)(g,["--project",t],e)
|
|
25
|
+
;0!==w&&(r.fail(n.default.red(" tsc-alias failed.")),await(0,d.deleteDirIfExists)(o),process.exit(w));const S=(0,
|
|
26
|
+
m.findUnresolvedAliases)(o);if(S.length>0){r.fail(n.default.red(" Build produced unresolved path aliases.")),
|
|
27
|
+
console.error(n.default.yellow("Please use tsconfig path aliases such as @/* and avoid package.json imports for app source files."))
|
|
28
|
+
;for(const e of S)console.error(n.default.red(` - ${e}`));process.exit(1)}await(0,d.deleteDirIfExists)(s),
|
|
29
|
+
r.succeed(n.default.green(" Build success."))}catch(e){r.fail(n.default.red(" Internal error.")),console.error(e),
|
|
30
|
+
process.exit(1)}}}
|
|
31
|
+
;const s=o(330),n=r(o(205)),i=r(o(720)),a=o(455),l=o(760),c=o(127),d=o(536),u=o(791),m=o(785),p=o(546),f=o(367)},
|
|
32
|
+
829(e,t,o){t.dev=function({version:e}){return async({host:t,port:o})=>{console.clear();const i=(0,
|
|
33
|
+
r.ensureDevEnvironment)();(0,s.printCliBanner)(e),await(0,n.startWatchedDevServer)({version:e,environment:i,host:t,
|
|
34
|
+
port:o})}};const r=o(127),s=o(872),n=o(583)},145(e,t,o){var r=this&&this.__importDefault||function(e){
|
|
35
|
+
return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.install=void 0
|
|
36
|
+
;const s=o(421),n=o(24),i=r(o(205)),a=o(760),l=o(921),c=o(337),d=o(471),u=r(o(720))
|
|
37
|
+
;t.install=(e,t)=>({host:t,port:o})=>{const r="linux"===process.platform,m="win32"===process.platform;let p="";try{p=(0,
|
|
38
|
+
c.getNodeModulesPath)()}catch(e){return void console.error(i.default.red(`❌ ${e.message}`))}const f=(0,
|
|
39
|
+
a.join)(p,"@mahameru","cli");try{
|
|
40
|
+
if(!(0,n.existsSync)(f))throw new Error("Mahameru is not installed on your system.\nPlease install it by running: `npm install -g @mahameru/cli`")
|
|
41
|
+
;if(r){
|
|
42
|
+
if(process.getuid&&0!==process.getuid())throw new Error("This action requires root privileges. Please run with sudo.")
|
|
43
|
+
;let r="";try{r=(0,s.execSync)("which mahameru",{stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{
|
|
44
|
+
throw new Error('Executable "mahameru" not found in PATH. Make sure it is installed globally.')}
|
|
45
|
+
!function({serviceName:e,appPath:t,mahameruInstalationPath:o,host:r,port:l}){const c=`/etc/systemd/system/${e}.service`
|
|
46
|
+
;try{
|
|
47
|
+
if((0,n.existsSync)(c))throw new Error(`Service "${e}" is already registered on this system. Please run uninstall command first if you want to update it.`)
|
|
48
|
+
;(0,n.mkdirSync)((0,a.join)(o,"logs"),{recursive:!0});const u=process.execPath,m=`[Unit]\nDescription=${(0,
|
|
49
|
+
d.toTitleCase)(e)}\nAfter=network.target\n\n[Service]\nType=simple\nUser=root\nWorkingDirectory=${o}\nExecStart=${u} ${t} pm start -d${r?` --host ${r}`:""}${l?` --port ${l}`:""}\nRestart=always\nEnvironment=NODE_ENV=production\nStandardOutput=append:${o}/logs/out.log\nStandardError=append:${o}/logs/error.log\n\n[Install]\nWantedBy=multi-user.target\n`
|
|
50
|
+
;console.log(i.default.cyan(`⏳ Writing service configuration to ${c}...`)),(0,n.writeFileSync)(c,m),
|
|
51
|
+
console.log(i.default.cyan("🔄 Reloading systemd daemon & enabling service...")),(0,
|
|
52
|
+
s.execSync)("systemctl daemon-reload"),(0,s.execSync)(`systemctl enable ${e}`);try{(0,s.execSync)(`systemctl stop ${e}`)
|
|
53
|
+
}catch{}(0,s.execSync)(`systemctl start ${e}`),console.log(i.default.green(`\n🚀 ${(0,
|
|
54
|
+
d.toTitleCase)(e)} successfully registered as a service!`)),
|
|
55
|
+
console.log(`🌍 Mahameru Process Manager running at http://${r}:${l}`),
|
|
56
|
+
console.log(`📝 To check service status, run: ${i.default.bold("mahameru pm status")}`)}catch(e){
|
|
57
|
+
console.error(i.default.red("❌ Failed to register service:"),e.message)}}({serviceName:e,appPath:r,
|
|
58
|
+
mahameruInstalationPath:f,host:t,port:o})}else if(m){let r="";try{r=(0,s.execSync)("where mahameru",{
|
|
59
|
+
stdio:["ignore","pipe","ignore"]}).toString().trim(),r.includes("\n")&&(r=r.split(/\r?\n/)[0]),
|
|
60
|
+
async function({serviceName:e,appPath:t,host:o,port:r}){const c=(0,u.default)(`Installing ${e} service...`).start();try{
|
|
61
|
+
t+=".cmd";const u=(0,a.join)(l.APPDATA_MAHAMERU_PATH,`${e}.exe`),m=(0,a.join)(l.APPDATA_MAHAMERU_PATH,`${e}.xml`)
|
|
62
|
+
;if(!(0,n.existsSync)(u)){c.text="Downloading assets..."
|
|
63
|
+
;const e="https://github.com/winsw/winsw/releases/download/v2.12.0/WinSW-x64.exe",t=await fetch(e,{method:"GET",
|
|
64
|
+
headers:{Accept:"*/*","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)"}})
|
|
65
|
+
;if(!t.ok)throw new Error(`Failed to download WinSW from ${e}. Status code: ${t.status}`);const o=await t.arrayBuffer()
|
|
66
|
+
;(0,n.writeFileSync)(u,Buffer.from(o)),c.succeed("Downloading WinSW binary... Done")}
|
|
67
|
+
const p=`pm start -d${o?` --host ${o}`:""}${r?` --port ${r}`:""}`,f=`<service>\n <id>mahameru-pm</id>\n <name>${(0,
|
|
68
|
+
d.toTitleCase)(e)}</name>\n <description>${(0,
|
|
69
|
+
d.toTitleCase)(e)}</description>\n <executable>cmd.exe</executable>\n <arguments>/c "${t}" ${p}</arguments>\n <log mode="roll"></log>\n </service>`
|
|
70
|
+
;(0,
|
|
71
|
+
n.writeFileSync)(m,f,"utf8"),c.text="Registering windows service...",(0,s.execSync)(`"${u}" install && "${u}" start`,{
|
|
72
|
+
cwd:l.APPDATA_MAHAMERU_PATH}),c.succeed(`\n🚀 ${(0,d.toTitleCase)(e)} successfully registered as a service!`),
|
|
73
|
+
console.log(`🌍 ${(0,
|
|
74
|
+
d.toTitleCase)(e)} running at http://${o}:${r}`),console.log(`📝 To check service status, run:\n - ${i.default.bold("mahameru pm status")}`)
|
|
75
|
+
}catch(e){
|
|
76
|
+
console.error(i.default.red(`❌ Error: ${e.message}`)),c.fail("Make sure you are running CMD/PowerShell as an Administrator.")
|
|
77
|
+
}}({serviceName:e,appPath:r,host:t,port:o})}catch{throw new Error('Executable "mahameru" not found in PATH.')}}
|
|
78
|
+
}catch(e){console.error(i.default.red(`❌ Error: ${e.message}`))}}},927(e,t,o){
|
|
79
|
+
var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
80
|
+
;Object.defineProperty(t,"__esModule",{value:!0}),t.pm=void 0
|
|
81
|
+
;const s=o(209),n=o(421),i=o(67),a=r(o(205)),l=r(o(30)),c=o(760),d=o(24),u=o(437),m=r(o(24)),p="win32"===process.platform?"\\\\.\\pipe\\mahameru_pm_ipc":"/tmp/mahameru_pm.sock",f=(0,
|
|
82
|
+
c.join)(__dirname,"mpm"),h={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",
|
|
83
|
+
".png":"image/png",".jpg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon"};function g(e){
|
|
84
|
+
return{pid:e.pid,createdAt:e.createdAt,isDisabled:e.isDisabled,name:e.name,description:e.description,version:e.version,
|
|
85
|
+
mode:e.mode,rootPath:e.rootPath,port:e.port,host:e.host,status:e.status}}t.pm=e=>async({host:t,port:r,daemon:y})=>{try{
|
|
86
|
+
const v=await(0,s.freePortFinder)(r),w=new Map,S=new Map,$=(0,i.createServer)((e,t)=>{
|
|
87
|
+
if(t.setHeader("Access-Control-Allow-Origin","*"),
|
|
88
|
+
t.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS"),
|
|
89
|
+
t.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization"),t.setHeader("X-Powered-By","MahameruJS"),
|
|
90
|
+
"OPTIONS"===e.method)return t.writeHead(204),t.end();if("/api/process"===e.url&&"GET"===e.method){t.writeHead(200,{
|
|
91
|
+
"Content-Type":"application/json"});const e=Array.from(w.values()).map(g);return t.end(JSON.stringify(e))}
|
|
92
|
+
if("GET"===e.method){const o="/"===e.url?"/index.html":e.url;let r=(0,c.join)(f,o)
|
|
93
|
+
;return r.startsWith(f)?void m.default.access(r,m.default.constants.F_OK,e=>{if(!e){const e=(0,
|
|
94
|
+
c.extname)(r).toLowerCase(),o=h[e]||"application/octet-stream";return t.writeHead(200,{"Content-Type":o}),
|
|
95
|
+
m.default.createReadStream(r).pipe(t)}{const e=(0,c.join)(f,"index.html")
|
|
96
|
+
;m.default.access(e,m.default.constants.F_OK,o=>o?(t.writeHead(404,{"Content-Type":"text/html"}),
|
|
97
|
+
t.end("<h1>404 - Frontend Build Not Found</h1>")):(t.writeHead(200,{"Content-Type":"text/html"}),
|
|
98
|
+
m.default.createReadStream(e).pipe(t)))}}):(t.writeHead(403,{"Content-Type":"text/plain"}),t.end("Forbidden"))}
|
|
99
|
+
return t.writeHead(404,{"Content-Type":"text/html"}),t.end("<h1>404 Not Found</h1>")}).on("close",()=>{
|
|
100
|
+
console.log("[MPM] HTTP server closed.")}).on("error",e=>{console.log("mpm error",e)}).listen(v,t,()=>{
|
|
101
|
+
process.send||y||(console.clear(),
|
|
102
|
+
console.log(`${a.default.bold(a.default.cyan("▲ Mahameru"))} ${a.default.dim(`Process Manager v${e}`)}\n`)),
|
|
103
|
+
console.log(`Server listening on host ${t} and port ${r}.`),
|
|
104
|
+
process.send||y||console.log(` ${a.default.bold(a.default.green("PID"))}: ${process.pid}\n ${a.default.bold(a.default.green("URL"))}: http://${t}:${r}\n${a.default.bold(a.default.green("API Endpoint"))}: http://${t}:${r}/api/process\n\n${a.default.dim("Press Ctrl+C to stop the server")}\n`)
|
|
105
|
+
});if("win32"!==process.platform){const e=o(896);e.existsSync(p)&&e.unlinkSync(p)}const P=e=>t=>{
|
|
106
|
+
const o=t.toString().trim();console.log(`[${e}] ${o}`)},M=e=>t=>{const o=t.toString().trim()
|
|
107
|
+
;console.error(`[${e} ERROR] ${o}`)},A=(e,o,s)=>({type:n,data:i})=>{if(e)if("ERROR"===n)e.write(JSON.stringify({
|
|
108
|
+
success:!1,message:i
|
|
109
|
+
}));else if("READY"===n)console.log(`[MPM] Project${o} successfully started by PM Daemon (PID: ${s.pid})`),
|
|
110
|
+
e.write(JSON.stringify({success:!0,message:`Project ${o} successfully started by PM Daemon (PID: ${s.pid})`,data:i,
|
|
111
|
+
mpmUrl:`http://${t}:${r}`}));else if("PROCESS_USAGE"===n){const e=w.get(o);e&&U.emit("process-usage",{data:i,
|
|
112
|
+
project:g(e)})}},_=e=>t=>{console.log(`[MPM] Project ${e} errored: ${t.message}`)},x=e=>({success:!0,data:e}),E=e=>({
|
|
113
|
+
success:!1,error:e}),T=e=>g(e),b=()=>Array.from(w.values()).map(g),D=e=>{console.log(`[MPM] ${e}`)},j=()=>{
|
|
114
|
+
U.emit("projects",b())},R=e=>{const t=(0,c.join)(e.rootPath,"node_modules","mahameru","dist","server.js");if(!(0,
|
|
115
|
+
d.existsSync)(t))throw new Error(`Mahameru package is not installed in ${e.rootPath} project. Please install it by running: npm install mahameru`)
|
|
116
|
+
;return t},k=e=>({MAHAMERU__SEND_PROCESS_USAGE_INTERVAL:"3000",MAHAMERU__ROOT_PATH:e.rootPath,
|
|
117
|
+
MAHAMERU__MODE:"production",...e.host?{MAHAMERU__HTTP_LISTEN_HOST:e.host.trim()}:{},...e.port?{
|
|
118
|
+
MAHAMERU__HTTP_LISTEN_PORT:e.port.toString().trim()}:{}}),N=(e,t,o=null)=>{t.stdout?.on("data",P(e.name)),
|
|
119
|
+
t.stderr?.on("data",M(e.name)),t.on("message",A(o,e.name,t)),t.on("error",_(e.name)),t.once("exit",o=>{
|
|
120
|
+
e.child===t&&w.has(e.name)&&(e.status=0===o||null===o?"stopped":"errored",e.pid=void 0,e.child=void 0,
|
|
121
|
+
U.emit("project-update",T(e)),j())})},O=(e,t)=>new Promise(o=>{const r=s=>{t.includes(s.type)&&(e.off("message",r),o(s))
|
|
122
|
+
};e.on("message",r)}),H=(e,t=null)=>new Promise((o,r)=>{let s=!1;const i=e=>{s||(s=!0,e())};try{const s=R(e),a=(0,
|
|
123
|
+
n.fork)(s,[],{cwd:e.rootPath,env:{...process.env,...k(e)},stdio:["inherit","pipe","pipe","ipc"]});e.status="stopped",
|
|
124
|
+
e.pid=a.pid,e.child=a,w.set(e.name,e),N(e,a,t),O(a,["READY","ERROR"]).then(({type:t,data:s})=>{"READY"===t?i(()=>{
|
|
125
|
+
e.status="running",e.pid=a.pid,e.child=a,w.set(e.name,e),o(e)}):"ERROR"===t&&i(()=>{e.status="errored",e.pid=void 0,
|
|
126
|
+
e.child=void 0,w.set(e.name,e),r(new Error("string"==typeof s?s:`Failed to start project ${e.name}`))})}),
|
|
127
|
+
a.once("error",t=>{i(()=>{e.status="errored",e.pid=void 0,e.child=void 0,w.set(e.name,e),r(t)})}),a.once("exit",t=>{
|
|
128
|
+
i(()=>{e.status=0===t||null===t?"stopped":"errored",e.pid=void 0,e.child=void 0,w.set(e.name,e),
|
|
129
|
+
r(new Error(`Project ${e.name} exited before ready${"number"==typeof t?` with code ${t}`:""}`))})})}catch(t){i(()=>{
|
|
130
|
+
e.status="errored",e.pid=void 0,e.child=void 0,w.set(e.name,e),r(t)})}}),C=e=>new Promise((t,o)=>{
|
|
131
|
+
if(!e.child)return e.status="stopped",e.pid=void 0,w.set(e.name,e),void t(e);const r=e.child;let s=!1;const n=e=>{
|
|
132
|
+
s||(s=!0,e())};O(r,["SHUTDOWN_DONE"]).then(({type:o})=>{"SHUTDOWN_DONE"===o&&n(()=>{e.status="stopped",e.pid=void 0,
|
|
133
|
+
e.child=void 0,w.set(e.name,e),t(e)})}),r.once("error",t=>{n(()=>{e.status="errored",e.pid=void 0,e.child=void 0,
|
|
134
|
+
w.set(e.name,e),o(t)})}),r.once("exit",r=>{n(()=>{e.status=0===r||null===r?"stopped":"errored",e.pid=void 0,
|
|
135
|
+
e.child=void 0,
|
|
136
|
+
w.set(e.name,e),0!==r&&null!==r?o(new Error(`Project ${e.name} exited during shutdown with code ${r}`)):t(e)})}),
|
|
137
|
+
r.send({type:"SHUTDOWN"})}),F=async e=>{D(`Delete requested for project "${e}"`);const t=w.get(e)
|
|
138
|
+
;if(!t)throw D(`Delete aborted. Project "${e}" not found`),new Error("Project not found");const o=T(t)
|
|
139
|
+
;t.child?(D(`Project "${e}" is running. Stopping before delete`),await C(t)):(t.status="stopped",t.pid=void 0,
|
|
140
|
+
t.child=void 0,w.set(t.name,t),D(`Project "${e}" already stopped. Proceeding to delete`));const r=w.get(e),s=r?T(r):o
|
|
141
|
+
;return D(`Deleting project "${e}" from registry`),w.delete(e),D(`Project "${e}" exists after delete: ${w.has(e)}`),
|
|
142
|
+
D(`Emitting project-delete for "${e}"`),U.emit("project-delete",s),j(),s},W=l.default.createServer(e=>{e.on("data",t=>{
|
|
143
|
+
try{const o=JSON.parse(t.toString());if("FORK_PROJECT"===o.command){
|
|
144
|
+
const t=o.payload,{name:r,description:s,version:n,projectRoot:i,port:a,host:l}=t,c=w.get(r)
|
|
145
|
+
;if(c&&"running"===c.status&&void 0!==c.child&&void 0!==c.pid)return void e.write(JSON.stringify({status:"error",
|
|
146
|
+
message:"Project already running"}));console.log(`[MPM] Starting project: ${r} (${i})`);const d={pid:void 0,
|
|
147
|
+
createdAt:c?.createdAt??(new Date).toISOString(),isDisabled:!1,name:r,mode:"production",description:s,version:n,
|
|
148
|
+
rootPath:i,host:l??null,port:a??null,status:"stopped"};w.set(r,d),H(d,e).then(e=>{
|
|
149
|
+
c?U.emit("project-update",T(e)):U.emit("project-create",T(e)),j()}).catch(t=>{e.write(JSON.stringify({success:!1,
|
|
150
|
+
error:t.message}))})}else if("STOP"===o.command){const t=o.payload,r=w.get(t.name)
|
|
151
|
+
;if(!r)return void e.write(JSON.stringify({success:!1,error:"Project not found"}));C(r).then(t=>{
|
|
152
|
+
U.emit("project-update",T(t)),j(),e.write(JSON.stringify(x(T(t))))}).catch(t=>{e.write(JSON.stringify(E(t.message)))})
|
|
153
|
+
}else if("START"===o.command);else if("RESTART"===o.command);else if("STATUS"===o.command){const t=o.payload
|
|
154
|
+
;if(w.has(t.name)){const{child:o,...r}=w.get(t.name);e.write(JSON.stringify({success:!0,data:r}))
|
|
155
|
+
}else e.write(JSON.stringify({success:!1,error:"Project not found"}))}}catch(t){e.write(JSON.stringify({success:!1,
|
|
156
|
+
error:t.message}))}})});W.listen(p,()=>{console.log(`[MPM] IPC Server listening on ${p}`)});const U=new u.Server($,{
|
|
157
|
+
cors:{origin:"*"},path:"/ws",serveClient:!1});U.on("connection",e=>{S.set(e.id,e)
|
|
158
|
+
;const t=Array.from(w.entries()).map(([e,t])=>g(t));e.emit("projects",t),e.on("getProjects",e=>e({success:!0,
|
|
159
|
+
data:Array.from(w.entries()).map(([e,t])=>g(t))})),e.on("start",(e,t)=>{const o=w.get(e)
|
|
160
|
+
;return o?o.child||"running"===o.status?t(E(`Project ${e} is already running`)):void H(o).then(e=>{
|
|
161
|
+
U.emit("project-update",T(e)),j(),t(x(T(e)))}).catch(e=>{t(E(e.message))}):t(E("Project not found"))}),
|
|
162
|
+
e.on("stop",(e,t)=>{const o=w.get(e);if(!o)return t(E("Project not found"));C(o).then(e=>{U.emit("project-update",T(e)),
|
|
163
|
+
j(),t(x(T(e)))}).catch(e=>{t(E(e.message))})});const o=e=>(t,o)=>{D(`Socket event "${e}" received for project "${t}"`),
|
|
164
|
+
F(t).then(e=>{D(`Invoking delete callback for project "${t}"`),o(x(e))}).catch(e=>{
|
|
165
|
+
D(`Delete failed for project "${t}": ${e.message}`),o(E(e.message))})};e.on("delete",o("delete")),
|
|
166
|
+
e.on("remove",o("remove")),e.on("disconnect",()=>{S.delete(e.id)})});const I=e=>{console.log(`[MPM] Received ${e}`),
|
|
167
|
+
S.forEach(e=>e.disconnect()),U.close(),W.close(),$.close(e=>{e&&console.log("[MPM]",e),process.exit(0)})}
|
|
168
|
+
;process.on("SIGINT",I),process.on("SIGTERM",I)}catch(e){console.log("mpm error",e),process.exit(1)}}},718(e,t,o){
|
|
169
|
+
var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
170
|
+
;Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;const s=r(o(139)),n=o(502),i=r(o(205)),a=o(24)
|
|
171
|
+
;t.App=class{initialized=!1;options;worker;appEnv;handleOnExit;constructor(e){if(this.options=e,
|
|
60
172
|
this.appEnv=this.buildAppEnv(),
|
|
61
173
|
!(0,a.existsSync)(this.options.workerPath))throw new Error("Cannot find Mahameru worker.");s.default.setupPrimary({
|
|
62
174
|
exec:this.options.workerPath,cwd:this.options.rootPath,stdio:["inherit","inherit","inherit","ipc"]})}async start(){
|
|
63
175
|
if(this.initialized)throw new Error("App has already been started.");this.worker=s.default.fork(this.appEnv),
|
|
64
|
-
this.initialized=!0,this.setupListeners()}stop(){return new Promise(
|
|
65
|
-
if(!this.worker||this.worker.isDead()||!this.initialized)return this.initialized=!1,void
|
|
66
|
-
;this.handleOnExit&&this.worker.removeListener("exit",this.handleOnExit);let
|
|
67
|
-
"SHUTDOWN_DONE"===
|
|
176
|
+
this.initialized=!0,this.setupListeners()}stop(){return new Promise(e=>{
|
|
177
|
+
if(!this.worker||this.worker.isDead()||!this.initialized)return this.initialized=!1,void e()
|
|
178
|
+
;this.handleOnExit&&this.worker.removeListener("exit",this.handleOnExit);let t=null;this.worker.once("message",o=>{
|
|
179
|
+
"SHUTDOWN_DONE"===o.type&&(t&&clearTimeout(t),this.initialized=!1,this.worker=void 0,e())}),this.worker.send({
|
|
68
180
|
type:"SHUTDOWN"
|
|
69
|
-
}),void 0!==this.options.gracefulShutdownTimeout&&this.options.gracefulShutdownTimeout>0&&(
|
|
70
|
-
this.worker&&!this.worker.isDead()&&(console.warn(
|
|
71
|
-
this.worker.disconnect(),this.worker.kill(),
|
|
72
|
-
this.worker&&this.worker.send({type:"DEV_HRM",data:{changedFile:
|
|
73
|
-
this.worker?(this.worker.once("message",
|
|
74
|
-
type:"GENERATE_ROUTE_TYPES"})):
|
|
75
|
-
;const
|
|
76
|
-
mode:
|
|
77
|
-
|
|
78
|
-
console.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
181
|
+
}),void 0!==this.options.gracefulShutdownTimeout&&this.options.gracefulShutdownTimeout>0&&(t=setTimeout(()=>{
|
|
182
|
+
this.worker&&!this.worker.isDead()&&(console.warn(i.default.yellow("[Mahameru] Graceful shutdown timed out, killing worker.")),
|
|
183
|
+
this.worker.disconnect(),this.worker.kill(),e())},this.options.gracefulShutdownTimeout))})}async devHRM(e){
|
|
184
|
+
this.worker&&this.worker.send({type:"DEV_HRM",data:{changedFile:e}})}generateTypes(){return new Promise((e,t)=>{
|
|
185
|
+
this.worker?(this.worker.once("message",t=>{"GENERATE_ROUTE_TYPES_DONE"===t.type&&e()}),this.worker.send({
|
|
186
|
+
type:"GENERATE_ROUTE_TYPES"})):t(new Error("Worker is not initialized."))})}setupListeners(){if(!this.worker)return
|
|
187
|
+
;const e=this.options.onMessage?this.options.onMessage:e=>{switch(e.type){case"READY":(0,n.printServerReady)({
|
|
188
|
+
dev:this.options.dev??!1,mode:this.options.dev?"development":"production",host:e.data?.host??"localhost",
|
|
189
|
+
port:e.data?.port??3e3});break;case"ERROR":
|
|
190
|
+
console.error(i.default.red("\n[Mahameru]"),e.data.message,e.data.stack??"",e.data.code??"");break;case"LOG":
|
|
191
|
+
console.log(e.data)}},t=this.options.onError?this.options.onError:e=>console.error(e)
|
|
192
|
+
;this.handleOnExit=this.options.onExit?this.options.onExit:e=>{
|
|
193
|
+
console.error(i.default.red(`[Mahameru] Dev server exited with code ${Number(e)}.`)),0!==e&&process.exit(e)},
|
|
194
|
+
this.worker.on("message",e),this.worker.on("error",t),this.worker.on("exit",this.handleOnExit)}buildAppEnv(){return{
|
|
82
195
|
MAHAMERU__ROOT_PATH:this.options.rootPath,...this.options.dev?{MAHAMERU__MODE:"development"}:{
|
|
83
196
|
MAHAMERU__MODE:"production"},...this.options.configFileName?{MAHAMERU__CONFIG_FILE:this.options.configFileName.trim()
|
|
84
197
|
}:{},...this.options.host?{MAHAMERU__HTTP_LISTEN_HOST:this.options.host.trim()}:{},...this.options.port?{
|
|
85
|
-
MAHAMERU__HTTP_LISTEN_PORT:this.options.port.toString().trim()}:{}}}}},
|
|
86
|
-
|
|
87
|
-
n.join)(process.cwd(),"node_modules","mahameru","dist","mahameru.js")),
|
|
88
|
-
n.join)(process.cwd(),"mahameru.config.ts")).default,
|
|
198
|
+
MAHAMERU__HTTP_LISTEN_PORT:this.options.port.toString().trim()}:{}}}}},367(e,t,o){t.buildConfigJson=async function(){
|
|
199
|
+
const e=(0,
|
|
200
|
+
r.createRequire)(__filename),{mahameruDefaultConfig:t}=e((0,n.join)(process.cwd(),"node_modules","mahameru","dist","mahameru.js")),o=e((0,
|
|
201
|
+
n.join)(process.cwd(),"mahameru.config.ts")).default,i=await o(t),a=JSON.stringify(i),l=(0,
|
|
89
202
|
n.join)(process.cwd(),".mahameru",".mahameru.config.json");return await(0,s.mkdir)((0,n.dirname)(l),{recursive:!0}),
|
|
90
|
-
await(0,s.writeFile)(l,a,"utf-8"),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
console.error(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
;(
|
|
106
|
-
|
|
107
|
-
;
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
203
|
+
await(0,s.writeFile)(l,a,"utf-8"),o};const r=o(339),s=o(455),n=o(760)},127(e,t,o){
|
|
204
|
+
var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
205
|
+
;Object.defineProperty(t,"__esModule",{value:!0}),t.ensureDevEnvironment=function(){const e=process.cwd(),t=(0,
|
|
206
|
+
n.join)(__dirname,"node_modules","tsx","dist","cli.mjs"),o=(0,
|
|
207
|
+
n.join)(__dirname,"node_modules","tsc-alias","dist","bin","index.js"),r=(0,
|
|
208
|
+
n.join)(e,"node_modules","typescript","bin","tsc")
|
|
209
|
+
;(0,a.isMahameruProjectDir)(e)||(console.error(s.default.red("Current directory is not a Node.js project.")),
|
|
210
|
+
process.exit(1));(0,i.existsSync)(t)||(console.error(s.default.red("Error: Runner 'tsx' is not installed.")),
|
|
211
|
+
console.error(s.default.yellow("Please install it by running: npm install -D tsx")),process.exit(1));(0,
|
|
212
|
+
i.existsSync)(o)||(console.error(s.default.red("Error: tsc-alias not installed.")),
|
|
213
|
+
console.error(s.default.yellow("Please install it by running: npm install -D tsc-alias")),process.exit(1));(0,
|
|
214
|
+
i.existsSync)(r)||(console.error(s.default.red("Error: TypeScript compiler (tsc) is not installed in this project.")),
|
|
215
|
+
console.error(s.default.yellow("Please install it by running: npm install -D typescript")),process.exit(1));return{
|
|
216
|
+
rootPath:e,tsxJsPath:t,tscJsPath:r,tscAliasJsPath:o}};const s=r(o(205)),n=o(760),i=o(24),a=o(813)},785(e,t,o){
|
|
217
|
+
t.findUnresolvedAliases=function(e){if(!(0,r.existsSync)(e))return[];const t=[e],o=new Set;for(;t.length>0;){
|
|
218
|
+
const e=t.pop();for(const n of(0,r.readdirSync)(e)){const i=(0,s.join)(e,n);if((0,r.statSync)(i).isDirectory()){
|
|
219
|
+
t.push(i);continue}if(!i.endsWith(".js"))continue;const a=(0,r.readFileSync)(i,"utf8")
|
|
220
|
+
;(a.includes("'@/")||a.includes('"@/'))&&o.add(i)}}return[...o]};const r=o(24),s=o(760)},546(e,t,o){
|
|
221
|
+
t.generateRouteTypes=async function(e,t){const o=[];await async function e(t,i=""){if(!(0,r.existsSync)(t))return
|
|
222
|
+
;const a=await(0,s.readdir)(t);for(const r of a){const a=(0,n.join)(t,r);if((await(0,s.stat)(a)).isDirectory()){
|
|
223
|
+
const t=r.startsWith("[")&&r.endsWith("]")?`:${r.slice(1,-1)}`:r;await e(a,`${i}/${t}`)
|
|
224
|
+
}else"route.ts"!==r&&"route.js"!==r||o.push(""===i?"/":i)}}(e)
|
|
225
|
+
;const i=`// Do not edit this file, it is generated by MahameruJS\n\ntype MahameruGeneratedRoutes = ${o.map(e=>`'${e}'`).join(" | ")||"string"};\n`,a=(0,
|
|
226
|
+
n.join)(process.cwd(),"mahameru.d.ts");await(0,s.mkdir)((0,n.dirname)(t),{recursive:!0}),await(0,
|
|
227
|
+
s.writeFile)(t,i.trim()),
|
|
113
228
|
await(0,s.writeFile)(a,'/// <reference path="./.mahameru/types/routes.d.ts" />\n\n// Do not edit this file, it is generated by MahameruJS\n')
|
|
114
|
-
};const r=
|
|
115
|
-
;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
console.log(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
;
|
|
150
|
-
|
|
151
|
-
;
|
|
152
|
-
;const e=0===A?1:A;A=e,R=R.then(()=>V(t,e)).catch(t=>{
|
|
153
|
-
console.error((0,l.red)("[Mahameru Dev] Build lifecycle failed.")),console.error(t)})};const N=c(j)
|
|
154
|
-
;async function V(e,a){const h=S.get(a)??Date.now(),c=P.get(a)??{emittedRuntimeFiles:new Set,
|
|
229
|
+
};const r=o(24),s=o(455),n=o(760)},872(e,t,o){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{
|
|
230
|
+
default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.printCliBanner=function(e){
|
|
231
|
+
console.log(`${s.default.bold(s.default.cyan("▲ Mahameru"))} ${s.default.dim(`CLI v${e}`)}\n`)};const s=r(o(205))},
|
|
232
|
+
502(e,t){t.printServerReady=function({mode:e,dev:t,host:o,port:r}){console.log("[32m Mahameru Server Ready![0m"),
|
|
233
|
+
console.log(` [1mMode:[22m [36m${e}[0m`),console.log(` [1mLocal:[22m [36mhttp://${o}:${r}[0m`),
|
|
234
|
+
console.log(` [1mHost:[22m ${o}`),console.log(` [1mPort:[22m ${r}\n`),
|
|
235
|
+
console.log("[90mPress Ctrl+C to stop the server[0m\n")}},791(e,t,o){t.runNodeScript=function(e,t,o){
|
|
236
|
+
return new Promise((s,n)=>{const i=(0,r.spawn)(process.execPath,[e,...t],{stdio:"inherit",cwd:o})
|
|
237
|
+
;i.on("message",e=>console.log(e)),i.on("close",e=>s(e??1)),i.on("error",n)})};const r=o(421)},583(e,t,o){
|
|
238
|
+
var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
239
|
+
;Object.defineProperty(t,"__esModule",{value:!0
|
|
240
|
+
}),t.startWatchedDevServer=async function({environment:e,host:t,port:o,version:r}){
|
|
241
|
+
let u,A=null,_=!1,x=null,E=!1,T=!0,b=!1,D=0
|
|
242
|
+
;const j=new Set,R=new Set,k=(0,i.join)(f,"node_modules","mahameru","dist","server.js");(0,
|
|
243
|
+
s.existsSync)(w)||(console.error(`${l.default.red("[Mahameru]")} ${(0,i.relative)(f,w)} does not exist!`),
|
|
244
|
+
process.exit(1));await(0,n.mkdir)(h,{recursive:!0});const N=(0,a.default)({
|
|
245
|
+
text:`${l.default.cyan("[Mahameru]")} Starting TypeScript watch...`,spinner:"triangle"}).start();await(0,
|
|
246
|
+
m.generateRouteTypes)((0,i.join)(f,"routes"),(0,i.join)(h,"types","routes.d.ts"));const O={workerPath:k,
|
|
247
|
+
configFileName:"mahameru.config.ts",dev:!0,host:t,port:o,rootPath:f};u=new d.App(O),
|
|
248
|
+
A=await async function({environment:e,spinner:t,onBuildStart:o,onBuildSuccess:r,onBuildFailure:a}){const c=(0,
|
|
249
|
+
i.resolve)((0,
|
|
250
|
+
i.join)(f,"node_modules","typescript")),{createWatchCompilerHost:d,createWatchProgram:u,formatDiagnosticsWithColorAndContext:m,formatDiagnostic:w,sys:$,createEmitAndSemanticDiagnosticsBuilderProgram:A}=p(c),_={
|
|
251
|
+
getCanonicalFileName:e=>e,getCurrentDirectory:()=>f,getNewLine:()=>$.newLine};let x=!1,E=!1,T=0
|
|
252
|
+
;const b=new Map,D=new Map;let j,R,k=Promise.resolve();const N=new Promise((e,t)=>{j=e,R=t}),O=d(v,{rootDir:y,outDir:h
|
|
253
|
+
},$,A,e=>{E=!0;const t=e.file?m([e],_):w(e,_);process.stderr.write(t.endsWith("\n")?t:`${t}\n`)},e=>{
|
|
254
|
+
const t=e.messageText.toString().trim();(function(e){
|
|
255
|
+
return e.includes("Starting compilation in watch mode...")||e.includes("File change detected. Starting incremental compilation...")
|
|
256
|
+
})(t)&&(T+=1,b.set(T,Date.now()),D.set(T,{emittedRuntimeFiles:new Set,changedRuntimeSourceFiles:new Set}),E=!1,o()),
|
|
257
|
+
function(e){
|
|
258
|
+
return["Starting compilation in watch mode...","File change detected. Starting incremental compilation...","Found 0 errors. Watching for file changes.","Watching for file changes."].some(t=>e.includes(t))
|
|
259
|
+
}(t)||console.log(`${l.default.yellow("[Mahameru TSC]")} ${t}`)}),H=P((0,i.resolve)((0,i.join)(h,"types"))),C=e=>{
|
|
260
|
+
const t=P((0,i.resolve)(e));return t===H||t.startsWith(`${H}/`)},F=O.watchFile?.bind(O)
|
|
261
|
+
;F&&(O.watchFile=(e,t,o,r)=>C(e)?{close(){}}:F(e,t,o,r));const W=O.watchDirectory?.bind(O)
|
|
262
|
+
;W&&(O.watchDirectory=(e,t,o,r)=>C(e)?{close(){}}:W(e,t,o,r));const U=O,I=U.writeFile?.bind(U)??$.writeFile.bind($)
|
|
263
|
+
;U.writeFile=(e,t,o,r,s,n)=>{I?.(e,t,o,r,s,n),q(e,s)};const J=O.afterProgramCreate;O.afterProgramCreate=e=>{J?.(e)
|
|
264
|
+
;const t=0===T?1:T;T=t,k=k.then(()=>B(e,t)).catch(e=>{
|
|
265
|
+
console.error(l.default.red("[Mahameru Dev] Build lifecycle failed.")),console.error(e)})};const L=u(O)
|
|
266
|
+
;async function B(e,o){const c=b.get(o)??Date.now(),d=D.get(o)??{emittedRuntimeFiles:new Set,
|
|
155
267
|
changedRuntimeSourceFiles:new Set}
|
|
156
|
-
;if(E)return
|
|
157
|
-
|
|
158
|
-
if(0===
|
|
159
|
-
|
|
160
|
-
return
|
|
161
|
-
fileContents:
|
|
162
|
-
await async function(
|
|
163
|
-
;await
|
|
164
|
-
|
|
165
|
-
return console.error(
|
|
166
|
-
l.red
|
|
167
|
-
|
|
168
|
-
changedRuntimeSourceFiles:[...
|
|
169
|
-
l.red
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
;(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
;
|
|
209
|
-
return t
|
|
210
|
-
|
|
211
|
-
;
|
|
212
|
-
;
|
|
213
|
-
;
|
|
214
|
-
;(
|
|
215
|
-
|
|
216
|
-
;
|
|
217
|
-
|
|
218
|
-
|
|
268
|
+
;if(E)return x||(x=!0,t.fail(`${l.default.red("[Mahameru]")} Initial TypeScript build failed.`),
|
|
269
|
+
R(new Error("Initial TypeScript build failed."))),D.delete(o),b.delete(o),void a();try{if(x)await async function(e){
|
|
270
|
+
if(0===e.length)return;const t=await async function(){if(!S){const e=(0,i.resolve)((0,
|
|
271
|
+
i.join)(__dirname,"node_modules","tsc-alias")),{prepareSingleFileReplaceTscAliasPaths:t}=p(e);S=t({configFile:v,outDir:h
|
|
272
|
+
})}return S}();for(const o of e){if(!(0,s.existsSync)(o))continue;const e=await(0,n.readFile)(o,"utf8"),r=t({
|
|
273
|
+
fileContents:e,filePath:o});r!==e&&await(0,n.writeFile)(o,r)}}([...d.emittedRuntimeFiles]);else{
|
|
274
|
+
await async function(e=3e4){const t=Date.now();for(;Date.now()-t<e;){if((0,s.existsSync)(g))return void await M(200)
|
|
275
|
+
;await M(100)}throw new Error("Timed out waiting for emitted dev runtime artifacts.")}();const e=(0,i.resolve)((0,
|
|
276
|
+
i.join)(__dirname,"node_modules","tsc-alias")),{replaceTscAliasPaths:t}=p(e);await t({configFile:v,outDir:h})}}catch(e){
|
|
277
|
+
return console.error(l.default.red("[Mahameru Alias] Alias rewrite failed.")),console.error(e),x||(x=!0,
|
|
278
|
+
t.fail(`${l.default.red("[Mahameru]")} Initial alias rewrite failed.`),R(e instanceof Error?e:new Error(String(e)))),
|
|
279
|
+
D.delete(o),b.delete(o),void a()}const u=Date.now()-c;try{await r({durationMs:u,
|
|
280
|
+
emittedRuntimeFiles:[...d.emittedRuntimeFiles],changedRuntimeSourceFiles:[...d.changedRuntimeSourceFiles],
|
|
281
|
+
initialBuild:!x})}catch(e){return console.error(l.default.red("[Mahameru Alias] Alias rewrite failed.")),
|
|
282
|
+
console.error(e),void a()}finally{D.delete(o),b.delete(o)}x||(x=!0,j())}function q(e,t){const o=(0,
|
|
283
|
+
i.resolve)(e),r=P(o),s=D.get(T);if(s&&function(e){const t=`${P((0,i.resolve)(g))}/`
|
|
284
|
+
;return e.startsWith(t)&&e.endsWith(".js")&&!e.endsWith(".d.ts")&&!e.endsWith(".map")}(r)){s.emittedRuntimeFiles.add(o)
|
|
285
|
+
;for(const e of function(e){if(!e)return[];const t=`${P((0,i.resolve)(y))}/`;return e.map(e=>(0,
|
|
286
|
+
i.resolve)(e.fileName)).filter(e=>{const o=P(e);return o.startsWith(t)&&o.endsWith(".ts")&&!o.endsWith(".d.ts")})
|
|
287
|
+
}(t))s.changedRuntimeSourceFiles.add(e)}}try{return await N,L}catch(e){throw L.close(),e}}({environment:e,spinner:N,
|
|
288
|
+
onBuildStart:()=>{T=!0},
|
|
289
|
+
onBuildSuccess:({durationMs:e,emittedRuntimeFiles:t,changedRuntimeSourceFiles:o,initialBuild:r})=>{if(D=e,T=!1,!r){
|
|
290
|
+
for(const e of t)j.add(e);for(const e of o)R.add(e)}T||!u?.initialized||_||(E||b||0!==j.size)&&W()},onBuildFailure:()=>{
|
|
291
|
+
T=!1,D=0,b=!1,j.clear(),R.clear(),x&&(clearTimeout(x),x=null)}
|
|
292
|
+
}),N.succeed(`${l.default.green("[Mahameru]")} Initial build completed.\n`),await u.start()
|
|
293
|
+
;const H=new c.Watchman([h,w]),C=new c.Watchman(y);let F=Promise.resolve();const W=()=>{x&&clearTimeout(x),
|
|
294
|
+
x=setTimeout(()=>{F=F.then(async()=>{if(_||!u)return;if(T)return void W();const e=[...j],t=[...R],o=b,r=E;if(E=!1,b=!1,
|
|
295
|
+
j.clear(),
|
|
296
|
+
R.clear(),x=null,r)return console.log(l.default.yellow("\n [Mahameru] Config file changed. Reloading server...\n")),
|
|
297
|
+
await u.stop(),u=new d.App(O),console.clear(),void await u.start();if(0===e.length&&!o)return
|
|
298
|
+
;const s=e[e.length-1],n=t[t.length-1]??(s?$(s):(0,i.resolve)(y)),a=Date.now();o?await u.devHRM():await u.devHRM(s)
|
|
299
|
+
;const c=Date.now()-a,m=D+c;console.log(`${l.default.green("[Mahameru Dev]")} Rebuilt ${(0,
|
|
300
|
+
i.relative)(f,n).replace(/\\/g,"/")} build: ${D}ms runtime: ${c}ms total: ${m}ms`)}).catch(e=>{
|
|
301
|
+
console.error(l.default.red("[Mahameru Dev] Hot reload failed.")),console.error(e)})},250)}
|
|
302
|
+
;H.on("all",({event:e,filePath:t})=>{const o=function(e){const t=(0,i.resolve)(e),o=P(t),r=P((0,i.resolve)(h)),s=P((0,
|
|
303
|
+
i.resolve)(g)),n=P((0,i.resolve)(w));if(!o.startsWith(`${r}/`)&&o!==n)return null
|
|
304
|
+
;if(o.endsWith(".d.ts")||o.endsWith(".map")||o.endsWith(".tsbuildinfo"))return null;if(o===n)return"config"
|
|
305
|
+
;if(!o.endsWith(".js"))return null;if(o.startsWith(`${s}/`))return"runtime";return null}(t)
|
|
306
|
+
;o&&("runtime"===o&&"delete"!==e&&"rename"!==e||((e,t)=>{"config"===e?E=!0:(j.add(t),R.add($(t))),T||W()})(o,t))}),
|
|
307
|
+
C.on("all",async({event:e,filePath:t,oldFilePath:o})=>{if("delete"!==e&&"rename"!==e)return;const r="rename"===e&&o?o:t
|
|
308
|
+
;(function(e){const t=`${P((0,i.resolve)(y))}/`;return P((0,i.resolve)(e)).startsWith(t)})(r)&&(await async function(e){
|
|
309
|
+
const t=(0,i.resolve)(e),o=(0,i.relative)(y,t);if(o.startsWith(".."))return;if(/\.[^\\/]+$/.test(o)){
|
|
310
|
+
const e=function(e){const t=(0,i.relative)(y,e);return(0,i.resolve)(g,t.replace(/\.ts$/i,".js"))}(t)
|
|
311
|
+
;return void await Promise.all([(0,n.rm)(e,{force:!0}).catch(()=>{}),(0,n.rm)(`${e}.map`,{force:!0}).catch(()=>{}),(0,
|
|
312
|
+
n.rm)(e.replace(/\.js$/i,".d.ts"),{force:!0}).catch(()=>{}),(0,n.rm)(e.replace(/\.js$/i,".d.ts.map"),{force:!0
|
|
313
|
+
}).catch(()=>{})])}await(0,n.rm)((0,i.resolve)(g,o),{recursive:!0,force:!0}).catch(()=>{})}(r),b=!0,R.add((0,
|
|
314
|
+
i.resolve)(r)),T||W())}),await H.start(),await C.start();const U=async(e=0)=>{_||(_=!0,x&&(clearTimeout(x),x=null),
|
|
315
|
+
H.stop(),C.stop(),await u.stop(),A?.close(),process.exit(e))};process.once("SIGINT",()=>{U(0)}),
|
|
316
|
+
process.once("SIGTERM",()=>{U(0)}),await new Promise(()=>{})}
|
|
317
|
+
;const s=o(24),n=o(455),i=o(760),a=r(o(720)),l=r(o(205)),c=o(376),d=o(718),u=o(995),m=o(546),p=(0,
|
|
318
|
+
u.createRequire)(__filename),f=process.cwd(),h=(0,i.join)(f,".mahameru"),g=h,y=(0,i.join)(f,"src"),v=(0,
|
|
319
|
+
i.join)(f,"tsconfig.json"),w=(0,i.join)(f,"mahameru.config.ts");let S=null;function $(e){const t=(0,i.relative)(g,e)
|
|
320
|
+
;return(0,i.resolve)(y,t.replace(/\.js$/i,".ts"))}function P(e){return e.replace(/\\/g,"/")}function M(e){
|
|
321
|
+
return new Promise(t=>{setTimeout(t,e)})}},536(e,t,o){t.deleteDirIfExists=async function(e){return await(0,r.rm)(e,{
|
|
322
|
+
recursive:!0,force:!0})},t.parsePort=function(e){const t=parseInt(e,10);return isNaN(t)?void 0:t}
|
|
323
|
+
;const r=o(455),s=o(161)},376(e,t,o){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
324
|
+
;Object.defineProperty(t,"__esModule",{value:!0}),t.Watchman=void 0
|
|
325
|
+
;const s=o(261),n=o(896),i=o(943),a=r(o(928)),l=/[*?[\]{}]/;class c extends s.EventEmitter{targets;abortControllers=[]
|
|
326
|
+
;renameBuffer=[];bufferTimeout=null;recentEvents=new Map;constructor(e){super();const t=Array.isArray(e)?e:[e]
|
|
327
|
+
;this.targets=t.map(e=>this.createTarget(e))}async start(){this.stop();const e=this.resolveWatchRoots()
|
|
328
|
+
;if(0!==e.length)for(const t of e){const e=new AbortController;this.abortControllers.push(e);const{signal:o}=e
|
|
329
|
+
;(async()=>{try{const e=(0,i.watch)(t.watchPath,{recursive:t.recursive,signal:o});for await(const o of e){
|
|
330
|
+
const{eventType:e,filename:r}=o;if(!r)continue;const s=a.default.resolve(t.watchPath,r)
|
|
331
|
+
;this.matchesTarget(s)&&("change"!==e?"rename"===e&&this.handleRenameEvent(r,t.watchPath):this.emitEvent({
|
|
332
|
+
event:"change",filePath:s}))}}catch(e){
|
|
333
|
+
"AbortError"!==e.name&&console.error(`[Watchman] Watch error at ${t.watchPath}:`,e)}})()
|
|
219
334
|
}else console.warn("[Watchman] No files or directories matched the configured watch targets.")}stop(){
|
|
220
|
-
for(const
|
|
221
|
-
this.bufferTimeout&&(clearTimeout(this.bufferTimeout),this.bufferTimeout=null),this.renameBuffer=[]}createTarget(
|
|
222
|
-
const
|
|
223
|
-
;return{original:
|
|
224
|
-
}resolveWatchRoots(){const
|
|
225
|
-
const
|
|
226
|
-
;(0,n.existsSync)(r)&&(
|
|
227
|
-
const
|
|
228
|
-
;return this.targets.some(
|
|
229
|
-
}emitEvent(
|
|
230
|
-
const
|
|
231
|
-
;this.recentEvents.set(
|
|
232
|
-
;return"number"==typeof s&&r-s<=80}handleRenameEvent(t
|
|
233
|
-
watcherRoot:
|
|
234
|
-
this.processRenameBuffer(),this.renameBuffer=[]},20)}processRenameBuffer(){const
|
|
235
|
-
fullPath:a.default.resolve(
|
|
236
|
-
const[
|
|
237
|
-
event:"rename",oldFilePath:
|
|
238
|
-
oldFilePath:
|
|
239
|
-
event:"create",filePath:
|
|
240
|
-
const e
|
|
241
|
-
return 0===
|
|
242
|
-
|
|
243
|
-
;
|
|
244
|
-
;
|
|
245
|
-
;t.
|
|
246
|
-
|
|
247
|
-
;
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
;
|
|
263
|
-
;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
;
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
;
|
|
304
|
-
|
|
305
|
-
;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
;const n=
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
;
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
this.
|
|
406
|
-
|
|
407
|
-
;
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
if("
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
(
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
const
|
|
431
|
-
;throw new Error(
|
|
432
|
-
|
|
433
|
-
;
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
;const n
|
|
443
|
-
;
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
})
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
e
|
|
492
|
-
["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(t=>{u.on(t,()=>{!1===d.killed&&null===d.exitCode&&d.kill(t)})
|
|
493
|
-
})}const m=this._exitCallback;d.on("close",t=>{
|
|
494
|
-
t=t??1,m?m(new r(t,"commander.executeSubCommandAsync","(close)")):u.exit(t)}),d.on("error",e=>{
|
|
495
|
-
if("ENOENT"===e.code)this._checkForMissingExecutable(n,o,t._name);else if("EACCES"===e.code)throw new Error(`'${n}' not executable`)
|
|
496
|
-
;if(m){const t=new r(1,"commander.executeSubCommandAsync","(error)");t.nestedError=e,m(t)}else u.exit(1)}),
|
|
497
|
-
this.runningCommand=d}_dispatchSubcommand(t,e,i){const r=this._findCommand(t);let s;return r||this.help({error:!0}),
|
|
498
|
-
r._prepareForParse(),s=this._chainOrCallSubCommandHook(s,r,"preSubcommand"),s=this._chainOrCall(s,()=>{
|
|
499
|
-
if(!r._executableHandler)return r._parseCommand(e,i);this._executeSubCommand(r,e.concat(i))}),s}_dispatchHelpCommand(t){
|
|
500
|
-
t||this.help();const e=this._findCommand(t);return e&&!e._executableHandler&&e.help(),
|
|
501
|
-
this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}
|
|
502
|
-
_checkNumberOfArguments(){this.registeredArguments.forEach((t,e)=>{
|
|
503
|
-
t.required&&null==this.args[e]&&this.missingArgument(t.name())
|
|
504
|
-
}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic||this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)
|
|
505
|
-
}_processArguments(){const t=(t,e,i)=>{let r=e;if(null!==e&&t.parseArg){
|
|
506
|
-
const s=`error: command-argument value '${e}' is invalid for argument '${t.name()}'.`;r=this._callParseArg(t,e,i,s)}
|
|
507
|
-
return r};this._checkNumberOfArguments();const e=[];this.registeredArguments.forEach((i,r)=>{let s=i.defaultValue
|
|
508
|
-
;i.variadic?r<this.args.length?(s=this.args.slice(r),
|
|
509
|
-
i.parseArg&&(s=s.reduce((e,r)=>t(i,r,e),i.defaultValue))):void 0===s&&(s=[]):r<this.args.length&&(s=this.args[r],
|
|
510
|
-
i.parseArg&&(s=t(i,s,i.defaultValue))),e[r]=s}),this.processedArgs=e}_chainOrCall(t,e){
|
|
511
|
-
return t?.then&&"function"==typeof t.then?t.then(()=>e()):e()}_chainOrCallHooks(t,e){let i=t;const r=[]
|
|
512
|
-
;return this._getCommandAndAncestors().reverse().filter(t=>void 0!==t._lifeCycleHooks[e]).forEach(t=>{
|
|
513
|
-
t._lifeCycleHooks[e].forEach(e=>{r.push({hookedCommand:t,callback:e})})}),"postAction"===e&&r.reverse(),r.forEach(t=>{
|
|
514
|
-
i=this._chainOrCall(i,()=>t.callback(t.hookedCommand,this))}),i}_chainOrCallSubCommandHook(t,e,i){let r=t
|
|
515
|
-
;return void 0!==this._lifeCycleHooks[i]&&this._lifeCycleHooks[i].forEach(t=>{r=this._chainOrCall(r,()=>t(this,e))}),r}
|
|
516
|
-
_parseCommand(t,e){const i=this.parseOptions(e);if(this._parseOptionsEnv(),this._parseOptionsImplied(),
|
|
517
|
-
t=t.concat(i.operands),
|
|
518
|
-
e=i.unknown,this.args=t.concat(e),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),e)
|
|
519
|
-
;if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1])
|
|
520
|
-
;if(this._defaultCommandName)return this._outputHelpIfRequested(e),
|
|
521
|
-
this._dispatchSubcommand(this._defaultCommandName,t,e)
|
|
522
|
-
;!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),
|
|
523
|
-
this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions()
|
|
524
|
-
;const r=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){
|
|
525
|
-
let i;return r(),this._processArguments(),i=this._chainOrCallHooks(i,"preAction"),
|
|
526
|
-
i=this._chainOrCall(i,()=>this._actionHandler(this.processedArgs)),this.parent&&(i=this._chainOrCall(i,()=>{
|
|
527
|
-
this.parent.emit(s,t,e)})),i=this._chainOrCallHooks(i,"postAction"),i}if(this.parent?.listenerCount(s))r(),
|
|
528
|
-
this._processArguments(),this.parent.emit(s,t,e);else if(t.length){
|
|
529
|
-
if(this._findCommand("*"))return this._dispatchSubcommand("*",t,e)
|
|
530
|
-
;this.listenerCount("command:*")?this.emit("command:*",t,e):this.commands.length?this.unknownCommand():(r(),
|
|
531
|
-
this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}
|
|
532
|
-
_findCommand(t){if(t)return this.commands.find(e=>e._name===t||e._aliases.includes(t))}_findOption(t){
|
|
533
|
-
return this.options.find(e=>e.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{
|
|
534
|
-
t.options.forEach(e=>{e.mandatory&&void 0===t.getOptionValue(e.attributeName())&&t.missingMandatoryOptionValue(e)})})}
|
|
535
|
-
_checkForConflictingLocalOptions(){const t=this.options.filter(t=>{const e=t.attributeName()
|
|
536
|
-
;return void 0!==this.getOptionValue(e)&&"default"!==this.getOptionValueSource(e)})
|
|
537
|
-
;t.filter(t=>t.conflictsWith.length>0).forEach(e=>{const i=t.find(t=>e.conflictsWith.includes(t.attributeName()))
|
|
538
|
-
;i&&this._conflictingOption(e,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{
|
|
539
|
-
t._checkForConflictingLocalOptions()})}parseOptions(t){const e=[],i=[];let r=e;function s(t){
|
|
540
|
-
return t.length>1&&"-"===t[0]}
|
|
541
|
-
const n=t=>!!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(t)&&!this._getCommandAndAncestors().some(t=>t.options.map(t=>t.short).some(t=>/^-\d$/.test(t)))
|
|
542
|
-
;let o=null,a=null,l=0;for(;l<t.length||a;){const h=a??t[l++];if(a=null,"--"===h){r===i&&r.push(h),r.push(...t.slice(l))
|
|
543
|
-
;break}if(!o||s(h)&&!n(h)){if(o=null,s(h)){const e=this._findOption(h);if(e){if(e.required){const i=t[l++]
|
|
544
|
-
;void 0===i&&this.optionMissingArgument(e),this.emit(`option:${e.name()}`,i)}else if(e.optional){let i=null
|
|
545
|
-
;l<t.length&&(!s(t[l])||n(t[l]))&&(i=t[l++]),this.emit(`option:${e.name()}`,i)}else this.emit(`option:${e.name()}`)
|
|
546
|
-
;o=e.variadic?e:null;continue}}if(h.length>2&&"-"===h[0]&&"-"!==h[1]){const t=this._findOption(`-${h[1]}`);if(t){
|
|
547
|
-
t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,h.slice(2)):(this.emit(`option:${t.name()}`),
|
|
548
|
-
a=`-${h.slice(2)}`);continue}}if(/^--[^=]+=/.test(h)){const t=h.indexOf("="),e=this._findOption(h.slice(0,t))
|
|
549
|
-
;if(e&&(e.required||e.optional)){this.emit(`option:${e.name()}`,h.slice(t+1));continue}}
|
|
550
|
-
if(r!==e||!s(h)||0===this.commands.length&&n(h)||(r=i),
|
|
551
|
-
(this._enablePositionalOptions||this._passThroughOptions)&&0===e.length&&0===i.length){if(this._findCommand(h)){
|
|
552
|
-
e.push(h),i.push(...t.slice(l));break}if(this._getHelpCommand()&&h===this._getHelpCommand().name()){
|
|
553
|
-
e.push(h,...t.slice(l));break}if(this._defaultCommandName){i.push(h,...t.slice(l));break}}if(this._passThroughOptions){
|
|
554
|
-
r.push(h,...t.slice(l));break}r.push(h)}else this.emit(`option:${o.name()}`,h)}return{operands:e,unknown:i}}opts(){
|
|
555
|
-
if(this._storeOptionsAsProperties){const t={},e=this.options.length;for(let i=0;i<e;i++){
|
|
556
|
-
const e=this.options[i].attributeName();t[e]=e===this._versionOptionName?this._version:this[e]}return t}
|
|
557
|
-
return this._optionValues}optsWithGlobals(){
|
|
558
|
-
return this._getCommandAndAncestors().reduce((t,e)=>Object.assign(t,e.opts()),{})}error(t,e){
|
|
559
|
-
this._outputConfiguration.outputError(`${t}\n`,this._outputConfiguration.writeErr),
|
|
560
|
-
"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),
|
|
561
|
-
this.outputHelp({error:!0}));const i=e||{},r=i.exitCode||1,s=i.code||"commander.error";this._exit(r,s,t)}
|
|
562
|
-
_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in u.env){const e=t.attributeName()
|
|
563
|
-
;(void 0===this.getOptionValue(e)||["default","config","env"].includes(this.getOptionValueSource(e)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,u.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))
|
|
564
|
-
}})}_parseOptionsImplied(){
|
|
565
|
-
const t=new f(this.options),e=t=>void 0!==this.getOptionValue(t)&&!["default","implied"].includes(this.getOptionValueSource(t))
|
|
566
|
-
;this.options.filter(i=>void 0!==i.implied&&e(i.attributeName())&&t.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(t=>{
|
|
567
|
-
Object.keys(t.implied).filter(t=>!e(t)).forEach(e=>{this.setOptionValueWithSource(e,t.implied[e],"implied")})})}
|
|
568
|
-
missingArgument(t){const e=`error: missing required argument '${t}'`;this.error(e,{code:"commander.missingArgument"})}
|
|
569
|
-
optionMissingArgument(t){const e=`error: option '${t.flags}' argument missing`;this.error(e,{
|
|
570
|
-
code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){
|
|
571
|
-
const e=`error: required option '${t.flags}' not specified`;this.error(e,{code:"commander.missingMandatoryOptionValue"})
|
|
572
|
-
}_conflictingOption(t,e){const i=t=>{
|
|
573
|
-
const e=t.attributeName(),i=this.getOptionValue(e),r=this.options.find(t=>t.negate&&e===t.attributeName()),s=this.options.find(t=>!t.negate&&e===t.attributeName())
|
|
574
|
-
;return r&&(void 0===r.presetArg&&!1===i||void 0!==r.presetArg&&i===r.presetArg)?r:s||t},r=t=>{
|
|
575
|
-
const e=i(t),r=e.attributeName()
|
|
576
|
-
;return"env"===this.getOptionValueSource(r)?`environment variable '${e.envVar}'`:`option '${e.flags}'`
|
|
577
|
-
},s=`error: ${r(t)} cannot be used with ${r(e)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(t){
|
|
578
|
-
if(this._allowUnknownOption)return;let e="";if(t.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{
|
|
579
|
-
const t=r.createHelp().visibleOptions(r).filter(t=>t.long).map(t=>t.long);i=i.concat(t),r=r.parent
|
|
580
|
-
}while(r&&!r._enablePositionalOptions);e=_(t,i)}const i=`error: unknown option '${t}'${e}`;this.error(i,{
|
|
581
|
-
code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return
|
|
582
|
-
;const e=this.registeredArguments.length,i=1===e?"":"s",r=t.length,s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${e} argument${i} but got ${r}: ${t.join(", ")}.`
|
|
583
|
-
;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){const t=this.args[0];let e=""
|
|
584
|
-
;if(this._showSuggestionAfterError){const i=[];this.createHelp().visibleCommands(this).forEach(t=>{i.push(t.name()),
|
|
585
|
-
t.alias()&&i.push(t.alias())}),e=_(t,i)}const i=`error: unknown command '${t}'${e}`;this.error(i,{
|
|
586
|
-
code:"commander.unknownCommand"})}version(t,e,i){if(void 0===t)return this._version;this._version=t,
|
|
587
|
-
e=e||"-V, --version",i=i||"output the version number";const r=this.createOption(e,i)
|
|
588
|
-
;return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on("option:"+r.name(),()=>{
|
|
589
|
-
this._outputConfiguration.writeOut(`${t}\n`),this._exit(0,"commander.version",t)}),this}description(t,e){
|
|
590
|
-
return void 0===t&&void 0===e?this._description:(this._description=t,e&&(this._argsDescription=e),this)}summary(t){
|
|
591
|
-
return void 0===t?this._summary:(this._summary=t,this)}alias(t){if(void 0===t)return this._aliases[0];let e=this
|
|
592
|
-
;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(e=this.commands[this.commands.length-1]),
|
|
593
|
-
t===e._name)throw new Error("Command alias can't be the same as its name");const i=this.parent?._findCommand(t);if(i){
|
|
594
|
-
const e=[i.name()].concat(i.aliases()).join("|")
|
|
595
|
-
;throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${e}'`)}
|
|
596
|
-
return e._aliases.push(t),this}aliases(t){return void 0===t?this._aliases:(t.forEach(t=>this.alias(t)),this)}usage(t){
|
|
597
|
-
if(void 0===t){if(this._usage)return this._usage;const t=this.registeredArguments.map(t=>o(t))
|
|
598
|
-
;return[].concat(this.options.length||null!==this._helpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")
|
|
599
|
-
}return this._usage=t,this}name(t){return void 0===t?this._name:(this._name=t,this)}helpGroup(t){
|
|
600
|
-
return void 0===t?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){
|
|
601
|
-
return void 0===t?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){
|
|
602
|
-
return void 0===t?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){
|
|
603
|
-
this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){
|
|
604
|
-
this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){
|
|
605
|
-
return this._name=h.basename(t,h.extname(t)),this}executableDir(t){
|
|
606
|
-
return void 0===t?this._executableDir:(this._executableDir=t,this)}helpInformation(t){
|
|
607
|
-
const e=this.createHelp(),i=this._getOutputContext(t);e.prepareContext({error:i.error,helpWidth:i.helpWidth,
|
|
608
|
-
outputHasColors:i.hasColors});const r=e.formatHelp(this,e);return i.hasColors?r:this._outputConfiguration.stripColor(r)}
|
|
609
|
-
_getOutputContext(t){const e=!!(t=t||{}).error;let i,r,s;e?(i=t=>this._outputConfiguration.writeErr(t),
|
|
610
|
-
r=this._outputConfiguration.getErrHasColors(),
|
|
611
|
-
s=this._outputConfiguration.getErrHelpWidth()):(i=t=>this._outputConfiguration.writeOut(t),
|
|
612
|
-
r=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth());return{error:e,
|
|
613
|
-
write:t=>(r||(t=this._outputConfiguration.stripColor(t)),i(t)),hasColors:r,helpWidth:s}}outputHelp(t){let e
|
|
614
|
-
;"function"==typeof t&&(e=t,t=void 0);const i=this._getOutputContext(t),r={error:i.error,write:i.write,command:this}
|
|
615
|
-
;this._getCommandAndAncestors().reverse().forEach(t=>t.emit("beforeAllHelp",r)),this.emit("beforeHelp",r)
|
|
616
|
-
;let s=this.helpInformation({error:i.error})
|
|
617
|
-
;if(e&&(s=e(s),"string"!=typeof s&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer")
|
|
618
|
-
;i.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",r),
|
|
619
|
-
this._getCommandAndAncestors().forEach(t=>t.emit("afterAllHelp",r))}helpOption(t,e){
|
|
620
|
-
return"boolean"==typeof t?(t?(null===this._helpOption&&(this._helpOption=void 0),
|
|
621
|
-
this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,
|
|
622
|
-
this):(this._helpOption=this.createOption(t??"-h, --help",e??"display help for command"),
|
|
623
|
-
(t||e)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){
|
|
624
|
-
return void 0===this._helpOption&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){
|
|
625
|
-
return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let e=Number(u.exitCode??0)
|
|
626
|
-
;0===e&&t&&"function"!=typeof t&&t.error&&(e=1),this._exit(e,"commander.help","(outputHelp)")}addHelpText(t,e){
|
|
627
|
-
const i=["beforeAll","before","after","afterAll"]
|
|
628
|
-
;if(!i.includes(t))throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${i.join("', '")}'`)
|
|
629
|
-
;const r=`${t}Help`;return this.on(r,t=>{let i;i="function"==typeof e?e({error:t.error,command:t.command}):e,
|
|
630
|
-
i&&t.write(`${i}\n`)}),this}_outputHelpIfRequested(t){const e=this._getHelpOption()
|
|
631
|
-
;e&&t.find(t=>e.is(t))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}}function b(t){
|
|
632
|
-
return t.map(t=>{if(!t.startsWith("--inspect"))return t;let e,i,r="127.0.0.1",s="9229"
|
|
633
|
-
;return null!==(i=t.match(/^(--inspect(-brk)?)$/))?e=i[1]:null!==(i=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(e=i[1],
|
|
634
|
-
/^\d+$/.test(i[3])?s=i[3]:r=i[3]):null!==(i=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(e=i[1],r=i[3],
|
|
635
|
-
s=i[4]),e&&"0"!==s?`${e}=${r}:${parseInt(s)+1}`:t})}function w(){
|
|
636
|
-
return!u.env.NO_COLOR&&"0"!==u.env.FORCE_COLOR&&"false"!==u.env.FORCE_COLOR&&(!(!u.env.FORCE_COLOR&&void 0===u.env.CLICOLOR_FORCE)||void 0)
|
|
637
|
-
}new v},920(t,e,i){"use strict";i.r(e),i.d(e,{default:()=>re,oraPromise:()=>se,spinners:()=>ct});var r=i(708),s=i(975)
|
|
638
|
-
;const n=(t=0)=>e=>`[${e+t}m`,o=(t=0)=>e=>`[${38+t};5;${e}m`,a=(t=0)=>(e,i,r)=>`[${38+t};2;${e};${i};${r}m`,l={
|
|
639
|
-
modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],
|
|
640
|
-
hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],
|
|
641
|
-
magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],
|
|
642
|
-
greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]
|
|
643
|
-
},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],
|
|
644
|
-
bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],
|
|
645
|
-
bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],
|
|
646
|
-
bgWhiteBright:[107,49]}};Object.keys(l.modifier),Object.keys(l.color),Object.keys(l.bgColor);const h=function(){
|
|
647
|
-
const t=new Map;for(const[e,i]of Object.entries(l)){for(const[e,r]of Object.entries(i))l[e]={open:`[${r[0]}m`,
|
|
648
|
-
close:`[${r[1]}m`},i[e]=l[e],t.set(r[0],r[1]);Object.defineProperty(l,e,{value:i,enumerable:!1})}
|
|
649
|
-
return Object.defineProperty(l,"codes",{value:t,enumerable:!1}),l.color.close="[39m",l.bgColor.close="[49m",
|
|
650
|
-
l.color.ansi=n(),l.color.ansi256=o(),l.color.ansi16m=a(),l.bgColor.ansi=n(10),l.bgColor.ansi256=o(10),
|
|
651
|
-
l.bgColor.ansi16m=a(10),Object.defineProperties(l,{rgbToAnsi256:{
|
|
652
|
-
value:(t,e,i)=>t===e&&e===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(e/255*5)+Math.round(i/255*5),
|
|
653
|
-
enumerable:!1},hexToRgb:{value(t){const e=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!e)return[0,0,0];let[i]=e
|
|
654
|
-
;3===i.length&&(i=[...i].map(t=>t+t).join(""));const r=Number.parseInt(i,16);return[r>>16&255,r>>8&255,255&r]},
|
|
655
|
-
enumerable:!1},hexToAnsi256:{value:t=>l.rgbToAnsi256(...l.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){
|
|
656
|
-
if(t<8)return 30+t;if(t<16)return t-8+90;let e,i,r;if(t>=232)e=(10*(t-232)+8)/255,i=e,r=e;else{const s=(t-=16)%36
|
|
657
|
-
;e=Math.floor(t/36)/5,i=Math.floor(s/6)/5,r=s%6/5}const s=2*Math.max(e,i,r);if(0===s)return 30
|
|
658
|
-
;let n=30+(Math.round(r)<<2|Math.round(i)<<1|Math.round(e));return 2===s&&(n+=60),n},enumerable:!1},rgbToAnsi:{
|
|
659
|
-
value:(t,e,i)=>l.ansi256ToAnsi(l.rgbToAnsi256(t,e,i)),enumerable:!1},hexToAnsi:{
|
|
660
|
-
value:t=>l.ansi256ToAnsi(l.hexToAnsi256(t)),enumerable:!1}}),l}(),c=h;var u=i(161);const d=require("node:tty")
|
|
661
|
-
;function m(t,e=(globalThis.Deno?globalThis.Deno.args:r.argv)){
|
|
662
|
-
const i=t.startsWith("-")?"":1===t.length?"-":"--",s=e.indexOf(i+t),n=e.indexOf("--");return-1!==s&&(-1===n||s<n)}
|
|
663
|
-
const{env:p}=r;let f;function g(t,{streamIsTTY:e,sniffFlags:i=!0}={}){const s=function(){
|
|
664
|
-
if("FORCE_COLOR"in p)return"true"===p.FORCE_COLOR?1:"false"===p.FORCE_COLOR?0:0===p.FORCE_COLOR.length?1:Math.min(Number.parseInt(p.FORCE_COLOR,10),3)
|
|
665
|
-
}();void 0!==s&&(f=s);const n=i?f:s;if(0===n)return 0;if(i){
|
|
666
|
-
if(m("color=16m")||m("color=full")||m("color=truecolor"))return 3;if(m("color=256"))return 2}
|
|
667
|
-
if("TF_BUILD"in p&&"AGENT_NAME"in p)return 1;if(t&&!e&&void 0===n)return 0;const o=n||0;if("dumb"===p.TERM)return o
|
|
668
|
-
;if("win32"===r.platform){const t=u.release().split(".")
|
|
669
|
-
;return Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}
|
|
670
|
-
if("CI"in p)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(t=>t in p)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(t=>t in p)||"codeship"===p.CI_NAME?1:o
|
|
671
|
-
;if("TEAMCITY_VERSION"in p)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(p.TEAMCITY_VERSION)?1:0
|
|
672
|
-
;if("truecolor"===p.COLORTERM)return 3;if("xterm-kitty"===p.TERM)return 3;if("xterm-ghostty"===p.TERM)return 3
|
|
673
|
-
;if("wezterm"===p.TERM)return 3;if("TERM_PROGRAM"in p){
|
|
674
|
-
const t=Number.parseInt((p.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(p.TERM_PROGRAM){case"iTerm.app":
|
|
675
|
-
return t>=3?3:2;case"Apple_Terminal":return 2}}
|
|
676
|
-
return/-256(color)?$/i.test(p.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(p.TERM)||"COLORTERM"in p?1:o
|
|
677
|
-
}function _(t,e={}){return function(t){return 0!==t&&{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}(g(t,{
|
|
678
|
-
streamIsTTY:t&&t.isTTY,...e}))}
|
|
679
|
-
m("no-color")||m("no-colors")||m("color=false")||m("color=never")?f=0:(m("color")||m("colors")||m("color=true")||m("color=always"))&&(f=1)
|
|
680
|
-
;const v={stdout:_({isTTY:d.isatty(1)}),stderr:_({isTTY:d.isatty(2)})};function b(t,e,i){let r=t.indexOf(e)
|
|
681
|
-
;if(-1===r)return t;const s=e.length;let n=0,o="";do{o+=t.slice(n,r)+e+i,n=r+s,r=t.indexOf(e,n)}while(-1!==r)
|
|
682
|
-
;return o+=t.slice(n),o}
|
|
683
|
-
const{stdout:w,stderr:y}=v,O=Symbol("GENERATOR"),x=Symbol("STYLER"),C=Symbol("IS_EMPTY"),T=["ansi","ansi","ansi256","ansi16m"],E=Object.create(null)
|
|
684
|
-
;const A=t=>{const e=(...t)=>t.join(" ");return((t,e={})=>{
|
|
685
|
-
if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3")
|
|
686
|
-
;const i=w?w.level:0;t.level=void 0===e.level?i:e.level})(e,t),Object.setPrototypeOf(e,S.prototype),e};function S(t){
|
|
687
|
-
return A(t)}Object.setPrototypeOf(S.prototype,Function.prototype);for(const[t,e]of Object.entries(c))E[t]={get(){
|
|
688
|
-
const i=M(this,R(e.open,e.close,this[x]),this[C]);return Object.defineProperty(this,t,{value:i}),i}};E.visible={get(){
|
|
689
|
-
const t=M(this,this[x],!0);return Object.defineProperty(this,"visible",{value:t}),t}}
|
|
690
|
-
;const P=(t,e,i,...r)=>"rgb"===t?"ansi16m"===e?c[i].ansi16m(...r):"ansi256"===e?c[i].ansi256(c.rgbToAnsi256(...r)):c[i].ansi(c.rgbToAnsi(...r)):"hex"===t?P("rgb",e,i,...c.hexToRgb(...r)):c[i][t](...r),$=["rgb","hex","ansi256"]
|
|
691
|
-
;for(const t of $){E[t]={get(){const{level:e}=this;return function(...i){
|
|
692
|
-
const r=R(P(t,T[e],"color",...i),c.color.close,this[x]);return M(this,r,this[C])}}}
|
|
693
|
-
;E["bg"+t[0].toUpperCase()+t.slice(1)]={get(){const{level:e}=this;return function(...i){
|
|
694
|
-
const r=R(P(t,T[e],"bgColor",...i),c.bgColor.close,this[x]);return M(this,r,this[C])}}}}
|
|
695
|
-
const k=Object.defineProperties(()=>{},{...E,level:{enumerable:!0,get(){return this[O].level},set(t){this[O].level=t}}
|
|
696
|
-
}),R=(t,e,i)=>{let r,s;return void 0===i?(r=t,s=e):(r=i.openAll+t,s=e+i.closeAll),{open:t,close:e,openAll:r,closeAll:s,
|
|
697
|
-
parent:i}},M=(t,e,i)=>{const r=(...t)=>j(r,1===t.length?""+t[0]:t.join(" "));return Object.setPrototypeOf(r,k),r[O]=t,
|
|
698
|
-
r[x]=e,r[C]=i,r},j=(t,e)=>{if(t.level<=0||!e)return t[C]?"":e;let i=t[x];if(void 0===i)return e
|
|
699
|
-
;const{openAll:r,closeAll:s}=i;if(e.includes(""))for(;void 0!==i;)e=b(e,i.close,i.open),i=i.parent
|
|
700
|
-
;const n=e.indexOf("\n");return-1!==n&&(e=function(t,e,i,r){let s=0,n="";do{const o="\r"===t[r-1]
|
|
701
|
-
;n+=t.slice(s,o?r-1:r)+e+(o?"\r\n":"\n")+i,s=r+1,r=t.indexOf("\n",s)}while(-1!==r);return n+=t.slice(s),n}(e,s,r,n)),
|
|
702
|
-
r+e+s};Object.defineProperties(S.prototype,E);const H=S(),I=(S({level:y?y.level:0}),H),D=(t,e,i,r)=>{
|
|
703
|
-
if("length"===i||"prototype"===i)return;if("arguments"===i||"caller"===i)return
|
|
704
|
-
;const s=Object.getOwnPropertyDescriptor(t,i),n=Object.getOwnPropertyDescriptor(e,i)
|
|
705
|
-
;!W(s,n)&&r||Object.defineProperty(t,i,n)},W=function(t,e){
|
|
706
|
-
return void 0===t||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)
|
|
707
|
-
},F=(t,e)=>`/* Wrapped ${t}*/\n${e}`,B=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),G=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name")
|
|
708
|
-
;function N(t,e,{ignoreNonConfigurable:i=!1}={}){const{name:r}=t;for(const r of Reflect.ownKeys(e))D(t,e,r,i)
|
|
709
|
-
;return((t,e)=>{const i=Object.getPrototypeOf(e);i!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,i)})(t,e),
|
|
710
|
-
((t,e,i)=>{const r=""===i?"":`with ${i.trim()}() `,s=F.bind(null,r,e.toString());Object.defineProperty(s,"name",G)
|
|
711
|
-
;const{writable:n,enumerable:o,configurable:a}=B;Object.defineProperty(t,"toString",{value:s,writable:n,enumerable:o,
|
|
712
|
-
configurable:a})})(t,e,r),t}const V=new WeakMap,L=(t,e={})=>{
|
|
713
|
-
if("function"!=typeof t)throw new TypeError("Expected a function");let i,r=0
|
|
714
|
-
;const s=t.displayName||t.name||"<anonymous>",n=function(...o){if(V.set(n,++r),1===r)i=t.apply(this,o),
|
|
715
|
-
t=void 0;else if(!0===e.throw)throw new Error(`Function \`${s}\` can only be called once`);return i};return N(n,t),
|
|
716
|
-
V.set(n,r),n};L.callCount=t=>{
|
|
717
|
-
if(!V.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`)
|
|
718
|
-
;return V.get(t)};const q=L,U=[]
|
|
719
|
-
;U.push("SIGHUP","SIGINT","SIGTERM"),"win32"!==process.platform&&U.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),
|
|
720
|
-
"linux"===process.platform&&U.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")
|
|
721
|
-
;const Y=t=>!!t&&"object"==typeof t&&"function"==typeof t.removeListener&&"function"==typeof t.emit&&"function"==typeof t.reallyExit&&"function"==typeof t.listeners&&"function"==typeof t.kill&&"number"==typeof t.pid&&"function"==typeof t.on,z=Symbol.for("signal-exit emitter"),J=globalThis,K=Object.defineProperty.bind(Object)
|
|
722
|
-
;class Q{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){
|
|
723
|
-
if(J[z])return J[z];K(J,z,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,e){this.listeners[t].push(e)}
|
|
724
|
-
removeListener(t,e){const i=this.listeners[t],r=i.indexOf(e);-1!==r&&(0===r&&1===i.length?i.length=0:i.splice(r,1))}
|
|
725
|
-
emit(t,e,i){if(this.emitted[t])return!1;this.emitted[t]=!0;let r=!1;for(const s of this.listeners[t])r=!0===s(e,i)||r
|
|
726
|
-
;return"exit"===t&&(r=this.emit("afterExit",e,i)||r),r}}class X{}
|
|
727
|
-
const Z=globalThis.process,{onExit:tt,load:et,unload:it}=(rt=Y(Z)?new class extends X{
|
|
728
|
-
#t="win32"===Z.platform?"SIGINT":"SIGHUP";#e=new Q;#i;#r;#s;#n={};#o=!1;constructor(t){super(),this.#i=t,this.#n={}
|
|
729
|
-
;for(const e of U)this.#n[e]=()=>{const i=this.#i.listeners(e);let{count:r}=this.#e;const s=t
|
|
730
|
-
;if("object"==typeof s.__signal_exit_emitter__&&"number"==typeof s.__signal_exit_emitter__.count&&(r+=s.__signal_exit_emitter__.count),
|
|
731
|
-
i.length===r){this.unload();const i=this.#e.emit("exit",null,e),r="SIGHUP"===e?this.#t:e;i||t.kill(t.pid,r)}}
|
|
732
|
-
;this.#s=t.reallyExit,this.#r=t.emit}onExit(t,e){if(!Y(this.#i))return()=>{};!1===this.#o&&this.load()
|
|
733
|
-
;const i=e?.alwaysLast?"afterExit":"exit";return this.#e.on(i,t),()=>{this.#e.removeListener(i,t),
|
|
734
|
-
0===this.#e.listeners.exit.length&&0===this.#e.listeners.afterExit.length&&this.unload()}}load(){if(!this.#o){
|
|
735
|
-
this.#o=!0,this.#e.count+=1;for(const t of U)try{const e=this.#n[t];e&&this.#i.on(t,e)}catch(t){}
|
|
736
|
-
this.#i.emit=(t,...e)=>this.#a(t,...e),this.#i.reallyExit=t=>this.#l(t)}}unload(){this.#o&&(this.#o=!1,U.forEach(t=>{
|
|
737
|
-
const e=this.#n[t];if(!e)throw new Error("Listener not defined for signal: "+t);try{this.#i.removeListener(t,e)
|
|
738
|
-
}catch(t){}}),this.#i.emit=this.#r,this.#i.reallyExit=this.#s,this.#e.count-=1)}#l(t){
|
|
739
|
-
return Y(this.#i)?(this.#i.exitCode=t||0,this.#e.emit("exit",this.#i.exitCode,null),
|
|
740
|
-
this.#s.call(this.#i,this.#i.exitCode)):0}#a(t,...e){const i=this.#r;if("exit"===t&&Y(this.#i)){
|
|
741
|
-
"number"==typeof e[0]&&(this.#i.exitCode=e[0]);const r=i.call(this.#i,t,...e)
|
|
742
|
-
;return this.#e.emit("exit",this.#i.exitCode,null),r}return i.call(this.#i,t,...e)}}(Z):new class extends X{onExit(){
|
|
743
|
-
return()=>{}}load(){}unload(){}},{onExit:(t,e)=>rt.onExit(t,e),load:()=>rt.load(),unload:()=>rt.unload()});var rt
|
|
744
|
-
;const st=r.stderr.isTTY?r.stderr:r.stdout.isTTY?r.stdout:void 0,nt=st?q(()=>{tt(()=>{st.write("[?25h")},{alwaysLast:!0
|
|
745
|
-
})}):()=>{};let ot=!1;const at={show:(t=r.stderr)=>{t.isTTY&&(ot=!1,t.write("[?25h"))},hide:(t=r.stderr)=>{
|
|
746
|
-
t.isTTY&&(nt(),ot=!0,t.write("[?25l"))},toggle:(t,e)=>{void 0!==t&&(ot=t),ot?at.show(e):at.hide(e)}
|
|
747
|
-
},lt=at,ht=JSON.parse('{"dots":{"interval":80,"frames":["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"]},"dots2":{"interval":80,"frames":["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"]},"dots3":{"interval":80,"frames":["⠋","⠙","⠚","⠞","⠖","⠦","⠴","⠲","⠳","⠓"]},"dots4":{"interval":80,"frames":["⠄","⠆","⠇","⠋","⠙","⠸","⠰","⠠","⠰","⠸","⠙","⠋","⠇","⠆"]},"dots5":{"interval":80,"frames":["⠋","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋"]},"dots6":{"interval":80,"frames":["⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠴","⠲","⠒","⠂","⠂","⠒","⠚","⠙","⠉","⠁"]},"dots7":{"interval":80,"frames":["⠈","⠉","⠋","⠓","⠒","⠐","⠐","⠒","⠖","⠦","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈"]},"dots8":{"interval":80,"frames":["⠁","⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈","⠈"]},"dots9":{"interval":80,"frames":["⢹","⢺","⢼","⣸","⣇","⡧","⡗","⡏"]},"dots10":{"interval":80,"frames":["⢄","⢂","⢁","⡁","⡈","⡐","⡠"]},"dots11":{"interval":100,"frames":["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"]},"dots12":{"interval":80,"frames":["⢀⠀","⡀⠀","⠄⠀","⢂⠀","⡂⠀","⠅⠀","⢃⠀","⡃⠀","⠍⠀","⢋⠀","⡋⠀","⠍⠁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⢈⠩","⡀⢙","⠄⡙","⢂⠩","⡂⢘","⠅⡘","⢃⠨","⡃⢐","⠍⡐","⢋⠠","⡋⢀","⠍⡁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⠈⠩","⠀⢙","⠀⡙","⠀⠩","⠀⢘","⠀⡘","⠀⠨","⠀⢐","⠀⡐","⠀⠠","⠀⢀","⠀⡀"]},"dots13":{"interval":80,"frames":["⣼","⣹","⢻","⠿","⡟","⣏","⣧","⣶"]},"dots14":{"interval":80,"frames":["⠉⠉","⠈⠙","⠀⠹","⠀⢸","⠀⣰","⢀⣠","⣀⣀","⣄⡀","⣆⠀","⡇⠀","⠏⠀","⠋⠁"]},"dots8Bit":{"interval":80,"frames":["⠀","⠁","⠂","⠃","⠄","⠅","⠆","⠇","⡀","⡁","⡂","⡃","⡄","⡅","⡆","⡇","⠈","⠉","⠊","⠋","⠌","⠍","⠎","⠏","⡈","⡉","⡊","⡋","⡌","⡍","⡎","⡏","⠐","⠑","⠒","⠓","⠔","⠕","⠖","⠗","⡐","⡑","⡒","⡓","⡔","⡕","⡖","⡗","⠘","⠙","⠚","⠛","⠜","⠝","⠞","⠟","⡘","⡙","⡚","⡛","⡜","⡝","⡞","⡟","⠠","⠡","⠢","⠣","⠤","⠥","⠦","⠧","⡠","⡡","⡢","⡣","⡤","⡥","⡦","⡧","⠨","⠩","⠪","⠫","⠬","⠭","⠮","⠯","⡨","⡩","⡪","⡫","⡬","⡭","⡮","⡯","⠰","⠱","⠲","⠳","⠴","⠵","⠶","⠷","⡰","⡱","⡲","⡳","⡴","⡵","⡶","⡷","⠸","⠹","⠺","⠻","⠼","⠽","⠾","⠿","⡸","⡹","⡺","⡻","⡼","⡽","⡾","⡿","⢀","⢁","⢂","⢃","⢄","⢅","⢆","⢇","⣀","⣁","⣂","⣃","⣄","⣅","⣆","⣇","⢈","⢉","⢊","⢋","⢌","⢍","⢎","⢏","⣈","⣉","⣊","⣋","⣌","⣍","⣎","⣏","⢐","⢑","⢒","⢓","⢔","⢕","⢖","⢗","⣐","⣑","⣒","⣓","⣔","⣕","⣖","⣗","⢘","⢙","⢚","⢛","⢜","⢝","⢞","⢟","⣘","⣙","⣚","⣛","⣜","⣝","⣞","⣟","⢠","⢡","⢢","⢣","⢤","⢥","⢦","⢧","⣠","⣡","⣢","⣣","⣤","⣥","⣦","⣧","⢨","⢩","⢪","⢫","⢬","⢭","⢮","⢯","⣨","⣩","⣪","⣫","⣬","⣭","⣮","⣯","⢰","⢱","⢲","⢳","⢴","⢵","⢶","⢷","⣰","⣱","⣲","⣳","⣴","⣵","⣶","⣷","⢸","⢹","⢺","⢻","⢼","⢽","⢾","⢿","⣸","⣹","⣺","⣻","⣼","⣽","⣾","⣿"]},"dotsCircle":{"interval":80,"frames":["⢎ ","⠎⠁","⠊⠑","⠈⠱"," ⡱","⢀⡰","⢄⡠","⢆⡀"]},"sand":{"interval":80,"frames":["⠁","⠂","⠄","⡀","⡈","⡐","⡠","⣀","⣁","⣂","⣄","⣌","⣔","⣤","⣥","⣦","⣮","⣶","⣷","⣿","⡿","⠿","⢟","⠟","⡛","⠛","⠫","⢋","⠋","⠍","⡉","⠉","⠑","⠡","⢁"]},"line":{"interval":130,"frames":["-","\\\\","|","/"]},"line2":{"interval":100,"frames":["⠂","-","–","—","–","-"]},"rollingLine":{"interval":80,"frames":["/ "," - "," \\\\ "," |"," |"," \\\\ "," - ","/ "]},"pipe":{"interval":100,"frames":["┤","┘","┴","└","├","┌","┬","┐"]},"simpleDots":{"interval":400,"frames":[". ",".. ","..."," "]},"simpleDotsScrolling":{"interval":200,"frames":[". ",".. ","..."," .."," ."," "]},"star":{"interval":70,"frames":["✶","✸","✹","✺","✹","✷"]},"star2":{"interval":80,"frames":["+","x","*"]},"flip":{"interval":70,"frames":["_","_","_","-","`","`","\'","´","-","_","_","_"]},"hamburger":{"interval":100,"frames":["☱","☲","☴"]},"growVertical":{"interval":120,"frames":["▁","▃","▄","▅","▆","▇","▆","▅","▄","▃"]},"growHorizontal":{"interval":120,"frames":["▏","▎","▍","▌","▋","▊","▉","▊","▋","▌","▍","▎"]},"balloon":{"interval":140,"frames":[" ",".","o","O","@","*"," "]},"balloon2":{"interval":120,"frames":[".","o","O","°","O","o","."]},"noise":{"interval":100,"frames":["▓","▒","░"]},"bounce":{"interval":120,"frames":["⠁","⠂","⠄","⠂"]},"boxBounce":{"interval":120,"frames":["▖","▘","▝","▗"]},"boxBounce2":{"interval":100,"frames":["▌","▀","▐","▄"]},"triangle":{"interval":50,"frames":["◢","◣","◤","◥"]},"binary":{"interval":80,"frames":["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},"arc":{"interval":100,"frames":["◜","◠","◝","◞","◡","◟"]},"circle":{"interval":120,"frames":["◡","⊙","◠"]},"squareCorners":{"interval":180,"frames":["◰","◳","◲","◱"]},"circleQuarters":{"interval":120,"frames":["◴","◷","◶","◵"]},"circleHalves":{"interval":50,"frames":["◐","◓","◑","◒"]},"squish":{"interval":100,"frames":["╫","╪"]},"toggle":{"interval":250,"frames":["⊶","⊷"]},"toggle2":{"interval":80,"frames":["▫","▪"]},"toggle3":{"interval":120,"frames":["□","■"]},"toggle4":{"interval":100,"frames":["■","□","▪","▫"]},"toggle5":{"interval":100,"frames":["▮","▯"]},"toggle6":{"interval":300,"frames":["ဝ","၀"]},"toggle7":{"interval":80,"frames":["⦾","⦿"]},"toggle8":{"interval":100,"frames":["◍","◌"]},"toggle9":{"interval":100,"frames":["◉","◎"]},"toggle10":{"interval":100,"frames":["㊂","㊀","㊁"]},"toggle11":{"interval":50,"frames":["⧇","⧆"]},"toggle12":{"interval":120,"frames":["☗","☖"]},"toggle13":{"interval":80,"frames":["=","*","-"]},"arrow":{"interval":100,"frames":["←","↖","↑","↗","→","↘","↓","↙"]},"arrow2":{"interval":80,"frames":["⬆️ ","↗️ ","➡️ ","↘️ ","⬇️ ","↙️ ","⬅️ ","↖️ "]},"arrow3":{"interval":120,"frames":["▹▹▹▹▹","▸▹▹▹▹","▹▸▹▹▹","▹▹▸▹▹","▹▹▹▸▹","▹▹▹▹▸"]},"bouncingBar":{"interval":80,"frames":["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},"bouncingBall":{"interval":80,"frames":["( ● )","( ● )","( ● )","( ● )","( ●)","( ● )","( ● )","( ● )","( ● )","(● )"]},"smiley":{"interval":200,"frames":["😄 ","😝 "]},"monkey":{"interval":300,"frames":["🙈 ","🙈 ","🙉 ","🙊 "]},"hearts":{"interval":100,"frames":["💛 ","💙 ","💜 ","💚 ","💗 "]},"clock":{"interval":100,"frames":["🕛 ","🕐 ","🕑 ","🕒 ","🕓 ","🕔 ","🕕 ","🕖 ","🕗 ","🕘 ","🕙 ","🕚 "]},"earth":{"interval":180,"frames":["🌍 ","🌎 ","🌏 "]},"material":{"interval":17,"frames":["█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","██████▁▁▁▁▁▁▁▁▁▁▁▁▁▁","███████▁▁▁▁▁▁▁▁▁▁▁▁▁","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","██████████▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","█████████████▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁██████████████▁▁▁▁","▁▁▁██████████████▁▁▁","▁▁▁▁█████████████▁▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁██████████████▁▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁██████████████▁","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁██████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁█████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁████████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁███████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁██████████","▁▁▁▁▁▁▁▁▁▁▁▁████████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁██████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","█▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","███▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","████▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","█████▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","██████▁▁▁▁▁▁▁▁▁▁▁▁▁█","████████▁▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","█████████▁▁▁▁▁▁▁▁▁▁▁","███████████▁▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","████████████▁▁▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","██████████████▁▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁██████████████▁▁▁▁▁","▁▁▁█████████████▁▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁████████████▁▁▁","▁▁▁▁▁▁███████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁█████████▁▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁█████████▁▁","▁▁▁▁▁▁▁▁▁▁█████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁████████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁███████▁","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁███████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁████","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁███","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁██","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁█","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁","▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"]},"moon":{"interval":80,"frames":["🌑 ","🌒 ","🌓 ","🌔 ","🌕 ","🌖 ","🌗 ","🌘 "]},"runner":{"interval":140,"frames":["🚶 ","🏃 "]},"pong":{"interval":80,"frames":["▐⠂ ▌","▐⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂▌","▐ ⠠▌","▐ ⡀▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐⠠ ▌"]},"shark":{"interval":120,"frames":["▐|\\\\____________▌","▐_|\\\\___________▌","▐__|\\\\__________▌","▐___|\\\\_________▌","▐____|\\\\________▌","▐_____|\\\\_______▌","▐______|\\\\______▌","▐_______|\\\\_____▌","▐________|\\\\____▌","▐_________|\\\\___▌","▐__________|\\\\__▌","▐___________|\\\\_▌","▐____________|\\\\▌","▐____________/|▌","▐___________/|_▌","▐__________/|__▌","▐_________/|___▌","▐________/|____▌","▐_______/|_____▌","▐______/|______▌","▐_____/|_______▌","▐____/|________▌","▐___/|_________▌","▐__/|__________▌","▐_/|___________▌","▐/|____________▌"]},"dqpb":{"interval":100,"frames":["d","q","p","b"]},"weather":{"interval":100,"frames":["☀️ ","☀️ ","☀️ ","🌤 ","⛅️ ","🌥 ","☁️ ","🌧 ","🌨 ","🌧 ","🌨 ","🌧 ","🌨 ","⛈ ","🌨 ","🌧 ","🌨 ","☁️ ","🌥 ","⛅️ ","🌤 ","☀️ ","☀️ "]},"christmas":{"interval":400,"frames":["🌲","🎄"]},"grenade":{"interval":80,"frames":["، ","′ "," ´ "," ‾ "," ⸌"," ⸊"," |"," ⁎"," ⁕"," ෴ "," ⁓"," "," "," "]},"point":{"interval":125,"frames":["∙∙∙","●∙∙","∙●∙","∙∙●","∙∙∙"]},"layer":{"interval":150,"frames":["-","=","≡"]},"betaWave":{"interval":80,"frames":["ρββββββ","βρβββββ","ββρββββ","βββρβββ","ββββρββ","βββββρβ","ββββββρ"]},"fingerDance":{"interval":160,"frames":["🤘 ","🤟 ","🖖 ","✋ ","🤚 ","👆 "]},"fistBump":{"interval":80,"frames":["🤜 🤛 ","🤜 🤛 ","🤜 🤛 "," 🤜 🤛 "," 🤜🤛 "," 🤜✨🤛 ","🤜 ✨ 🤛 "]},"soccerHeader":{"interval":80,"frames":[" 🧑⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 ","🧑 ⚽️ 🧑 "]},"mindblown":{"interval":160,"frames":["😐 ","😐 ","😮 ","😮 ","😦 ","😦 ","😧 ","😧 ","🤯 ","💥 ","✨ "," "," "," "]},"speaker":{"interval":160,"frames":["🔈 ","🔉 ","🔊 ","🔉 "]},"orangePulse":{"interval":100,"frames":["🔸 ","🔶 ","🟠 ","🟠 ","🔶 "]},"bluePulse":{"interval":100,"frames":["🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},"orangeBluePulse":{"interval":100,"frames":["🔸 ","🔶 ","🟠 ","🟠 ","🔶 ","🔹 ","🔷 ","🔵 ","🔵 ","🔷 "]},"timeTravel":{"interval":100,"frames":["🕛 ","🕚 ","🕙 ","🕘 ","🕗 ","🕖 ","🕕 ","🕔 ","🕓 ","🕒 ","🕑 ","🕐 "]},"aesthetic":{"interval":80,"frames":["▰▱▱▱▱▱▱","▰▰▱▱▱▱▱","▰▰▰▱▱▱▱","▰▰▰▰▱▱▱","▰▰▰▰▰▱▱","▰▰▰▰▰▰▱","▰▰▰▰▰▰▰","▰▱▱▱▱▱▱"]},"dwarfFortress":{"interval":80,"frames":[" ██████£££ ","☺██████£££ ","☺██████£££ ","☺▓█████£££ ","☺▓█████£££ ","☺▒█████£££ ","☺▒█████£££ ","☺░█████£££ ","☺░█████£££ ","☺ █████£££ "," ☺█████£££ "," ☺█████£££ "," ☺▓████£££ "," ☺▓████£££ "," ☺▒████£££ "," ☺▒████£££ "," ☺░████£££ "," ☺░████£££ "," ☺ ████£££ "," ☺████£££ "," ☺████£££ "," ☺▓███£££ "," ☺▓███£££ "," ☺▒███£££ "," ☺▒███£££ "," ☺░███£££ "," ☺░███£££ "," ☺ ███£££ "," ☺███£££ "," ☺███£££ "," ☺▓██£££ "," ☺▓██£££ "," ☺▒██£££ "," ☺▒██£££ "," ☺░██£££ "," ☺░██£££ "," ☺ ██£££ "," ☺██£££ "," ☺██£££ "," ☺▓█£££ "," ☺▓█£££ "," ☺▒█£££ "," ☺▒█£££ "," ☺░█£££ "," ☺░█£££ "," ☺ █£££ "," ☺█£££ "," ☺█£££ "," ☺▓£££ "," ☺▓£££ "," ☺▒£££ "," ☺▒£££ "," ☺░£££ "," ☺░£££ "," ☺ £££ "," ☺£££ "," ☺£££ "," ☺▓££ "," ☺▓££ "," ☺▒££ "," ☺▒££ "," ☺░££ "," ☺░££ "," ☺ ££ "," ☺££ "," ☺££ "," ☺▓£ "," ☺▓£ "," ☺▒£ "," ☺▒£ "," ☺░£ "," ☺░£ "," ☺ £ "," ☺£ "," ☺£ "," ☺▓ "," ☺▓ "," ☺▒ "," ☺▒ "," ☺░ "," ☺░ "," ☺ "," ☺ &"," ☺ ☼&"," ☺ ☼ &"," ☺☼ &"," ☺☼ & "," ‼ & "," ☺ & "," ‼ & "," ☺ & "," ‼ & "," ☺ & ","‼ & "," & "," & "," & ░ "," & ▒ "," & ▓ "," & £ "," & ░£ "," & ▒£ "," & ▓£ "," & ££ "," & ░££ "," & ▒££ ","& ▓££ ","& £££ "," ░£££ "," ▒£££ "," ▓£££ "," █£££ "," ░█£££ "," ▒█£££ "," ▓█£££ "," ██£££ "," ░██£££ "," ▒██£££ "," ▓██£££ "," ███£££ "," ░███£££ "," ▒███£££ "," ▓███£££ "," ████£££ "," ░████£££ "," ▒████£££ "," ▓████£££ "," █████£££ "," ░█████£££ "," ▒█████£££ "," ▓█████£££ "," ██████£££ "," ██████£££ "]},"fish":{"interval":80,"frames":["~~~~~~~~~~~~~~~~~~~~","> ~~~~~~~~~~~~~~~~~~","º> ~~~~~~~~~~~~~~~~~","(º> ~~~~~~~~~~~~~~~~","((º> ~~~~~~~~~~~~~~~","<((º> ~~~~~~~~~~~~~~","><((º> ~~~~~~~~~~~~~"," ><((º> ~~~~~~~~~~~~","~ ><((º> ~~~~~~~~~~~","~~ <>((º> ~~~~~~~~~~","~~~ ><((º> ~~~~~~~~~","~~~~ <>((º> ~~~~~~~~","~~~~~ ><((º> ~~~~~~~","~~~~~~ <>((º> ~~~~~~","~~~~~~~ ><((º> ~~~~~","~~~~~~~~ <>((º> ~~~~","~~~~~~~~~ ><((º> ~~~","~~~~~~~~~~ <>((º> ~~","~~~~~~~~~~~ ><((º> ~","~~~~~~~~~~~~ <>((º> ","~~~~~~~~~~~~~ ><((º>","~~~~~~~~~~~~~~ <>((º","~~~~~~~~~~~~~~~ ><((","~~~~~~~~~~~~~~~~ <>(","~~~~~~~~~~~~~~~~~ ><","~~~~~~~~~~~~~~~~~~ <","~~~~~~~~~~~~~~~~~~~~"]}}')
|
|
748
|
-
;const ct=ht;Object.keys(ht);const ut=d?.WriteStream?.prototype?.hasColors?.()??!1,dt=(t,e)=>{if(!ut)return t=>t
|
|
749
|
-
;const i=`[${t}m`,r=`[${e}m`;return t=>{const s=t+"";let n=s.indexOf(r);if(-1===n)return i+s+r;let o=i,a=0
|
|
750
|
-
;const l=(22===e?r:"")+i;for(;-1!==n;)o+=s.slice(a,n)+l,a=n+r.length,n=s.indexOf(r,a);return o+=s.slice(a)+r,o}
|
|
751
|
-
},mt=(dt(0,0),dt(1,22),dt(2,22),dt(3,23),dt(4,24),dt(53,55),dt(7,27),dt(8,28),dt(9,29),dt(30,39),
|
|
752
|
-
dt(31,39)),pt=dt(32,39),ft=dt(33,39),gt=dt(34,39);dt(35,39),dt(36,39),dt(37,39),dt(90,39),dt(40,49),dt(41,49),dt(42,49),
|
|
753
|
-
dt(43,49),dt(44,49),dt(45,49),dt(46,49),dt(47,49),dt(100,49),dt(91,39),dt(92,39),dt(93,39),dt(94,39),dt(95,39),
|
|
754
|
-
dt(96,39),dt(97,39),dt(101,49),dt(102,49),dt(103,49),dt(104,49),dt(105,49),dt(106,49),dt(107,49);function _t(){
|
|
755
|
-
const{env:t}=r,{TERM:e,TERM_PROGRAM:i}=t
|
|
756
|
-
;return"win32"!==r.platform?"linux"!==e:Boolean(t.WT_SESSION)||Boolean(t.TERMINUS_SUBLIME)||"{cmd::Cmder}"===t.ConEmuTask||"Terminus-Sublime"===i||"vscode"===i||"xterm-256color"===e||"alacritty"===e||"rxvt-unicode"===e||"rxvt-unicode-256color"===e||"JetBrains-JediTerm"===t.TERMINAL_EMULATOR
|
|
757
|
-
}const vt=_t(),bt=gt(vt?"ℹ":"i"),wt=pt(vt?"✔":"√"),yt=ft(vt?"⚠":"‼"),Ot=mt(vt?"✖":"×")
|
|
758
|
-
;const xt=function({onlyFirst:t=!1}={}){
|
|
759
|
-
return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",t?void 0:"g")
|
|
760
|
-
}()
|
|
761
|
-
;const Ct=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Tt=[12288,12288,65281,65376,65504,65510],Et=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],At=(t,e)=>{
|
|
762
|
-
let i=0,r=Math.floor(t.length/2)-1;for(;i<=r;){const s=Math.floor((i+r)/2),n=2*s;if(e<t[n])r=s-1;else{
|
|
763
|
-
if(!(e>t[n+1]))return!0;i=s+1}}return!1};const[St,Pt]=$t(Et);function $t(t){let e=t[0],i=t[1]
|
|
764
|
-
;for(let r=0;r<t.length;r+=2){const s=t[r],n=t[r+1];if(19968>=s&&19968<=n)return[s,n];n-s>i-e&&(e=s,i=n)}return[e,i]}
|
|
765
|
-
const kt=t=>!(t<161||t>1114109)&&At(Ct,t),Rt=t=>!(t<12288||t>65510)&&At(Tt,t),Mt=t=>t>=St&&t<=Pt||!(t<4352||t>262141)&&At(Et,t)
|
|
766
|
-
;function jt(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}
|
|
767
|
-
function Ht(t,{ambiguousAsWide:e=!1}={}){return jt(t),Rt(t)||Mt(t)||e&&kt(t)?2:1}
|
|
768
|
-
const It=new Intl.Segmenter,Dt=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Mark}|\p{Surrogate})+$/v,Wt=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,Ft=/^\p{RGI_Emoji}$/v,Bt=/^[\d#*]\u20E3$/,Gt=/\p{Extended_Pictographic}/gu
|
|
769
|
-
;function Nt(t){if(t.length>50)return!1;if(Bt.test(t))return!0;if(t.includes("")){const e=t.match(Gt)
|
|
770
|
-
;return null!==e&&e.length>=2}return!1}function Vt(t){return t.replace(Wt,"")}function Lt(t){return Dt.test(t)}
|
|
771
|
-
function qt(t){return t>=4352&&t<=4447||t>=43360&&t<=43388}function Ut(t){return t>=4448&&t<=4519||t>=55216&&t<=55238}
|
|
772
|
-
function Yt(t){return t>=4520&&t<=4607||t>=55243&&t<=55291}function zt(t){return qt(t)||Ut(t)||Yt(t)}function Jt(t,e){
|
|
773
|
-
const i=[];for(const e of t)Dt.test(e)||i.push(e.codePointAt(0));if(0===i.length)return;let r=0
|
|
774
|
-
;for(let t=0;t<i.length;t++){const s=i[t];if(!zt(s)){if(0===r)return;for(let s=t;s<i.length;s++)r+=Ht(i[s],e);return r}
|
|
775
|
-
qt(s)&&Ut(i[t+1])?(r+=2,t+=Yt(i[t+2])?2:1):r+=Ht(s,e)}return r}function Kt(t,e){let i=0,r=!0
|
|
776
|
-
;for(const s of t)r?r=!1:s>=""&&s<=""&&(i+=Ht(s.codePointAt(0),e));return i}function Qt(t,e={}){
|
|
777
|
-
if("string"!=typeof t||0===t.length)return 0;const{ambiguousIsNarrow:i=!0,countAnsiEscapeCodes:r=!1}=e;let s=t
|
|
778
|
-
;if(r||!s.includes("")&&!s.includes("")||(s=function(t){
|
|
779
|
-
if("string"!=typeof t)throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``)
|
|
780
|
-
;return t.includes("")||t.includes("")?t.replace(xt,""):t}(s)),0===s.length)return 0
|
|
781
|
-
;if(/^[\u0020-\u007E]*$/.test(s))return s.length;let n=0;const o={ambiguousAsWide:!i}
|
|
782
|
-
;for(const{segment:t}of It.segment(s)){if(Lt(t))continue;if(Ft.test(t)||Nt(t)){n+=2;continue}const e=Vt(t),i=Jt(e,o)
|
|
783
|
-
;if(void 0!==i){n+=i;continue}n+=Ht(e.codePointAt(0),o),n+=Kt(e,o)}return n}const Xt=new class{#h=0;#c;#u=!1;#d=!1
|
|
784
|
-
;#m=t=>{if(!t?.length)return;3===("string"==typeof t?t.codePointAt(0):t[0])&&r.kill(r.pid,"SIGINT")};start(){this.#h++,
|
|
785
|
-
1===this.#h&&this.#p()}stop(){0!==this.#h&&0===--this.#h&&this.#f()}#p(){const{stdin:t}=r
|
|
786
|
-
;"win32"!==r.platform&&t?.isTTY&&"function"==typeof t.setRawMode?(this.#c=t,this.#u=t.isPaused(),
|
|
787
|
-
this.#d=Boolean(t.isRaw),t.setRawMode(!0),t.prependListener("data",this.#m),this.#u&&t.resume()):this.#c=void 0}#f(){
|
|
788
|
-
if(!this.#c)return;const t=this.#c;t.off("data",this.#m),t.isTTY&&t.setRawMode?.(this.#d),this.#u&&t.pause(),
|
|
789
|
-
this.#c=void 0,this.#u=!1,this.#d=!1}
|
|
790
|
-
},Zt=Object.freeze(Xt),te=new Map,ee=new Set(["black","red","green","yellow","blue","magenta","cyan","white","gray"])
|
|
791
|
-
;class ie{#g=0;#_=-1;#v=0;#b;#w;#y;#O;#x=new Map;#C=!1;#T;#E;#A=!1;#S;#P(t){this.#C=!0;try{return t()}finally{this.#C=!1
|
|
792
|
-
}}#$(){this.isSpinning&&this.render()}#k(t,e){if(null==t)return"";if("string"==typeof t)return t
|
|
793
|
-
;if(Buffer.isBuffer(t)||ArrayBuffer.isView(t)){const i="string"==typeof e&&e&&"buffer"!==e?e:"utf8"
|
|
794
|
-
;return Buffer.from(t).toString(i)}return String(t)}#R(t){if(!t)return!1;const e=t.at(-1);return"\n"===e||"\r"===e}#M(){
|
|
795
|
-
this.#E||(this.#E=setTimeout(()=>{this.#E=void 0,this.isSpinning&&this.#$()},200),
|
|
796
|
-
"function"==typeof this.#E?.unref&&this.#E.unref())}#j(){this.#E&&(clearTimeout(this.#E),this.#E=void 0)}#H(t,e,i,r){
|
|
797
|
-
return this.#I(i," ")+t+("string"==typeof e?(t?" ":"")+e:"")+this.#D(r," ")}constructor(t){if("string"==typeof t&&(t={
|
|
798
|
-
text:t}),this.#b={color:"cyan",stream:r.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#b.color,
|
|
799
|
-
this.#y=this.#b.stream,"boolean"!=typeof this.#b.isEnabled&&(this.#b.isEnabled=function({stream:t=process.stdout}={}){
|
|
800
|
-
return Boolean(t&&t.isTTY&&"dumb"!==process.env.TERM&&!("CI"in process.env))}({stream:this.#y})),
|
|
801
|
-
"boolean"!=typeof this.#b.isSilent&&(this.#b.isSilent=!1),
|
|
802
|
-
void 0!==this.#b.interval&&!(Number.isInteger(this.#b.interval)&&this.#b.interval>0))throw new Error("The `interval` option must be a positive integer")
|
|
803
|
-
;const e=this.#b.interval;this.spinner=this.#b.spinner,this.#b.interval=e,this.text=this.#b.text,
|
|
804
|
-
this.prefixText=this.#b.prefixText,this.suffixText=this.#b.suffixText,this.indent=this.#b.indent}get indent(){
|
|
805
|
-
return this.#b.indent}set indent(t=0){
|
|
806
|
-
if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#b.indent=t
|
|
807
|
-
}get interval(){return this.#b.interval??this.#w.interval??100}get spinner(){return this.#w}set spinner(t){
|
|
808
|
-
if(this.#_=-1,this.#b.interval=void 0,"object"==typeof t){
|
|
809
|
-
if(!Array.isArray(t.frames)||0===t.frames.length||t.frames.some(t=>"string"!=typeof t))throw new Error("The given spinner must have a non-empty `frames` array of strings")
|
|
810
|
-
;if(void 0!==t.interval&&!(Number.isInteger(t.interval)&&t.interval>0))throw new Error("`spinner.interval` must be a positive integer if provided")
|
|
811
|
-
;this.#w=t}else if(_t())if(void 0===t)this.#w=ct.dots;else{
|
|
812
|
-
if("default"===t||!ct[t])throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)
|
|
813
|
-
;this.#w=ct[t]}else this.#w=ct.line}get text(){return this.#b.text}set text(t=""){this.#b.text=t}get prefixText(){
|
|
814
|
-
return this.#b.prefixText}set prefixText(t=""){this.#b.prefixText=t}get suffixText(){return this.#b.suffixText}
|
|
815
|
-
set suffixText(t=""){this.#b.suffixText=t}get isSpinning(){return void 0!==this.#O}#W(t,e,i=!1){
|
|
816
|
-
const r="function"==typeof t?t():t;return"string"==typeof r&&""!==r?i?e+r:r+e:""}#I(t=this.#b.prefixText,e=" "){
|
|
817
|
-
return this.#W(t,e,!1)}#D(t=this.#b.suffixText,e=" "){return this.#W(t,e,!0)}#F(t,e){let i=0;for(const r of(0,
|
|
818
|
-
s.stripVTControlCharacters)(t).split("\n"))i+=Math.max(1,Math.ceil(Qt(r)/e));return i}get color(){return this.#S}
|
|
819
|
-
set color(t){
|
|
820
|
-
if(void 0!==t&&!1!==t&&!ee.has(t))throw new Error("The `color` option must be a valid color or `false` to disable")
|
|
821
|
-
;this.#S=t}get isEnabled(){return this.#b.isEnabled&&!this.#b.isSilent}set isEnabled(t){
|
|
822
|
-
if("boolean"!=typeof t)throw new TypeError("The `isEnabled` option must be a boolean");this.#b.isEnabled=t}
|
|
823
|
-
get isSilent(){return this.#b.isSilent}set isSilent(t){
|
|
824
|
-
if("boolean"!=typeof t)throw new TypeError("The `isSilent` option must be a boolean");this.#b.isSilent=t}frame(){
|
|
825
|
-
const t=Date.now();(-1===this.#_||t-this.#v>=this.interval)&&(this.#_=(this.#_+1)%this.#w.frames.length,this.#v=t)
|
|
826
|
-
;const{frames:e}=this.#w;let i=e[this.#_];this.#S&&(i=I[this.#S](i))
|
|
827
|
-
;return this.#I(this.#b.prefixText," ")+i+("string"==typeof this.text?" "+this.text:"")+this.#D(this.#b.suffixText," ")}
|
|
828
|
-
clear(){return this.isEnabled&&this.#y.isTTY?(this.#P(()=>{this.#y.cursorTo(0)
|
|
829
|
-
;for(let t=0;t<this.#g;t++)t>0&&this.#y.moveCursor(0,-1),this.#y.clearLine(1)
|
|
830
|
-
;this.#b.indent&&this.#y.cursorTo(this.#b.indent)}),this.#g=0,this):this}#B(t){
|
|
831
|
-
if(!t||this.#x.has(t)||!t.isTTY||"function"!=typeof t.write)return
|
|
832
|
-
;te.has(t)&&console.warn("[ora] Multiple concurrent spinners detected. This may cause visual corruption. Use one spinner at a time.")
|
|
833
|
-
;const e=t.write;this.#x.set(t,e),te.set(t,this),t.write=(i,r,s)=>this.#G(t,e,i,r,s)}#N(){
|
|
834
|
-
if(!this.isEnabled||this.#x.size>0)return;const t=new Set([this.#y,r.stdout,r.stderr]);for(const e of t)this.#B(e)}#V(){
|
|
835
|
-
for(const[t,e]of this.#x)t.write=e,te.get(t)===this&&te.delete(t);this.#x.clear()}#G(t,e,i,r,s){
|
|
836
|
-
if("function"==typeof r&&(s=r,r=void 0),this.#C)return e.call(t,i,r,s);this.clear()
|
|
837
|
-
;const n=this.#k(i,r),o=this.#R(n),a=e.call(t,i,r,s);return o?this.#j():n.length>0&&this.#M(),
|
|
838
|
-
this.isSpinning&&!this.#E&&this.render(),a}render(){if(!this.isEnabled||this.#T||this.#E)return this
|
|
839
|
-
;const t=this.#y.isTTY;let e=!1;try{t&&(this.#P(()=>this.#y.write("[?2026h")),e=!0),this.clear();let i=this.frame()
|
|
840
|
-
;const r=this.#y.columns??80,s=this.#F(i,r),n=this.#y.rows;if(n&&n>1&&s>n){const t=i.split("\n"),e=n-1
|
|
841
|
-
;i=[...t.slice(0,e),"... (content truncated to fit terminal)"].join("\n")}
|
|
842
|
-
!1===this.#P(()=>this.#y.write(i))&&this.#y.isTTY&&(this.#T=()=>{this.#T=void 0,this.#$()},
|
|
843
|
-
this.#y.once("drain",this.#T)),this.#g=this.#F(i,r)}finally{e&&this.#P(()=>this.#y.write("[?2026l"))}return this}
|
|
844
|
-
start(t){if(void 0!==t&&(this.text=t),this.isSilent)return this;if(!this.isEnabled){
|
|
845
|
-
const t=this.text?"-":"",e=" ".repeat(this.#b.indent)+this.#H(t,this.text,this.#b.prefixText,this.#b.suffixText)
|
|
846
|
-
;return""!==e.trim()&&this.#P(()=>this.#y.write(e+"\n")),this}
|
|
847
|
-
return this.isSpinning||(this.#b.hideCursor&<.hide(this.#y),this.#b.discardStdin&&r.stdin.isTTY&&(Zt.start(),
|
|
848
|
-
this.#A=!0),this.#N(),this.render(),this.#O=setInterval(this.render.bind(this),this.interval)),this}stop(){
|
|
849
|
-
return clearInterval(this.#O),this.#O=void 0,this.#_=-1,this.#v=0,this.#j(),this.#V(),
|
|
850
|
-
this.#T&&(this.#y.removeListener("drain",this.#T),this.#T=void 0),this.isEnabled&&(this.clear(),
|
|
851
|
-
this.#b.hideCursor&<.show(this.#y)),this.#A&&(this.#A=!1,Zt.stop()),this}succeed(t){return this.stopAndPersist({
|
|
852
|
-
symbol:wt,text:t})}fail(t){return this.stopAndPersist({symbol:Ot,text:t})}warn(t){return this.stopAndPersist({symbol:yt,
|
|
853
|
-
text:t})}info(t){return this.stopAndPersist({symbol:bt,text:t})}stopAndPersist(t={}){if(this.isSilent)return this
|
|
854
|
-
;const e=t.symbol??" ",i=t.text??this.text,r=t.prefixText??this.#b.prefixText,s=t.suffixText??this.#b.suffixText,n=this.#H(e,i,r,s)+"\n"
|
|
855
|
-
;return this.stop(),this.#P(()=>this.#y.write(n)),this}}function re(t){return new ie(t)}async function se(t,e){
|
|
856
|
-
const i="function"==typeof t
|
|
857
|
-
;if(!i&&!("function"==typeof t?.then))throw new TypeError("Parameter `action` must be a Function or a Promise")
|
|
858
|
-
;const{successText:r,failText:s,successSymbol:n,failSymbol:o}="object"==typeof e&&null!==e?e:{},a=re(e).start();try{
|
|
859
|
-
const e=i?t(a):t,s=await e,o=void 0===r?void 0:"string"==typeof r?r:r(s)
|
|
860
|
-
;return void 0===n?a.succeed(o):a.stopAndPersist({symbol:n,text:o}),s}catch(t){
|
|
861
|
-
const e=void 0===s?void 0:"string"==typeof s?s:s(t);throw void 0===o?a.fail(e):a.stopAndPersist({symbol:o,text:e}),t}}},
|
|
862
|
-
330(t){"use strict";t.exports={version:"0.0.16"}}};const e={};function i(r){const s=e[r];if(void 0!==s)return s.exports
|
|
863
|
-
;const n=e[r]={exports:{}};return t[r].call(n.exports,n,n.exports,i),n.exports}i.d=(t,e)=>{
|
|
864
|
-
if(Array.isArray(e))for(var r=0;r<e.length;){var s=e[r++],n=e[r++];i.o(t,s)?0===n&&r++:0===n?Object.defineProperty(t,s,{
|
|
865
|
-
enumerable:!0,value:e[r++]}):Object.defineProperty(t,s,{enumerable:!0,get:n})
|
|
866
|
-
}else for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},
|
|
867
|
-
i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{
|
|
868
|
-
Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{
|
|
869
|
-
value:!0})};(()=>{"use strict";const t=i(757),e=i(943),r=i(330),s=i(855),n=i(84),o=i(700),a=i(185),l=new t.Command;try{
|
|
870
|
-
const t=process.cwd();l.name("mahameru").description(`${(0,e.bold)((0,e.cyan)("▲ Mahameru"))} ${(0,
|
|
871
|
-
e.dim)(`CLI v${r.version}`)}`).version(r.version,"-v, --version","Display help for command"),
|
|
872
|
-
l.command("dev").option("-p, --port <number>","Port to run the server on",a.parsePort).option("-h, --host <string>","Host to run the server on").action((0,
|
|
873
|
-
s.dev)({version:r.version})),l.command("build").description("Build Mahameru production application.").action((0,
|
|
874
|
-
n.build)({rootPath:t
|
|
875
|
-
})),l.command("start").description("Start Mahameru production server.").option("-p, --port <number>","Port to run the server on",a.parsePort).option("-h, --host <string>","Host to run the server on").action((0,
|
|
876
|
-
o.start)({rootPath:t,version:r.version})),l.parse(process.argv)}catch(t){console.error(t),process.exit(1)}})()})();
|
|
335
|
+
for(const e of this.abortControllers)e.abort();this.abortControllers=[],this.recentEvents.clear(),
|
|
336
|
+
this.bufferTimeout&&(clearTimeout(this.bufferTimeout),this.bufferTimeout=null),this.renameBuffer=[]}createTarget(e){
|
|
337
|
+
const t=this.normalizePath(e),o=a.default.resolve(e);if(l.test(t))return{original:e,normalized:t,absolute:o,kind:"glob"}
|
|
338
|
+
;return{original:e,normalized:t,absolute:o,kind:(0,n.existsSync)(o)&&(0,n.statSync)(o).isDirectory()?"directory":"file"}
|
|
339
|
+
}resolveWatchRoots(){const e=new Map;for(const t of this.targets){
|
|
340
|
+
const o="glob"===t.kind?this.getGlobBasePath(t.normalized):"directory"===t.kind?t.absolute:a.default.dirname(t.absolute),r=a.default.resolve(o),s="file"!==t.kind,i=`${r}::${s}`
|
|
341
|
+
;(0,n.existsSync)(r)&&(e.has(i)||e.set(i,{watchPath:r,recursive:s}))}return Array.from(e.values())}matchesTarget(e){
|
|
342
|
+
const t=this.normalizePath(a.default.resolve(e))
|
|
343
|
+
;return this.targets.some(e=>"directory"===e.kind?t===e.normalized||t.startsWith(`${e.normalized}/`):"file"===e.kind?t===e.normalized:a.default.matchesGlob(t,e.normalized))
|
|
344
|
+
}emitEvent(e){this.shouldDeduplicate(e)||(this.emit(e.event,e),this.emit("all",e))}shouldDeduplicate(e){
|
|
345
|
+
const t=this.normalizePath(a.default.resolve(e.filePath)),o=`${e.event}:${t}:${e.oldFilePath?this.normalizePath(a.default.resolve(e.oldFilePath)):""}`,r=Date.now(),s=this.recentEvents.get(o)
|
|
346
|
+
;this.recentEvents.set(o,r);for(const[e,t]of this.recentEvents)r-t>80&&this.recentEvents.delete(e)
|
|
347
|
+
;return"number"==typeof s&&r-s<=80}handleRenameEvent(e,t){this.renameBuffer.push({filename:e,timestamp:Date.now(),
|
|
348
|
+
watcherRoot:t}),this.bufferTimeout&&clearTimeout(this.bufferTimeout),this.bufferTimeout=setTimeout(()=>{
|
|
349
|
+
this.processRenameBuffer(),this.renameBuffer=[]},20)}processRenameBuffer(){const e=this.renameBuffer.map(e=>({...e,
|
|
350
|
+
fullPath:a.default.resolve(e.watcherRoot,e.filename)})).filter(e=>this.matchesTarget(e.fullPath));if(2===e.length){
|
|
351
|
+
const[t,o]=e,r=(0,n.existsSync)(t.fullPath),s=(0,n.existsSync)(o.fullPath);if(!r&&s)return void this.emitEvent({
|
|
352
|
+
event:"rename",oldFilePath:t.fullPath,filePath:o.fullPath});if(r&&!s)return void this.emitEvent({event:"rename",
|
|
353
|
+
oldFilePath:o.fullPath,filePath:t.fullPath})}for(const t of e)(0,n.existsSync)(t.fullPath)?this.emitEvent({
|
|
354
|
+
event:"create",filePath:t.fullPath}):this.emitEvent({event:"delete",filePath:t.fullPath})}getGlobBasePath(e){
|
|
355
|
+
const t=e.split("/"),o=[];for(const e of t){if(l.test(e))break;o.push(e)}
|
|
356
|
+
return 0===o.length?a.default.dirname(e):o.join("/")}normalizePath(e){return e.replace(/\\/g,"/")}}t.Watchman=c},
|
|
357
|
+
363(e,t,o){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
358
|
+
;Object.defineProperty(t,"__esModule",{value:!0}),t.startFork=void 0
|
|
359
|
+
;const s=r(o(278)),n=r(o(205)),i=o(813),a=o(209),l=r(o(720)),c=o(830),d=o(157),u="win32"===process.platform?"\\\\.\\pipe\\mahameru_pm_ipc":"/tmp/mahameru_pm.sock"
|
|
360
|
+
;t.startFork=({rootPath:e})=>async t=>{const o=(0,d.getWindowsElevatedWorkingDirectory)()??e,r=t.port,m=t.host;(0,
|
|
361
|
+
i.isMahameruProjectDir)(o)||(console.error(n.default.red(`\n${o} is not a Mahameru project directory.`)),
|
|
362
|
+
process.exit(1));const p=await(0,c.getProjectJson)(o),f=(0,l.default)("Checking available port...").start(),h=await(0,
|
|
363
|
+
a.freePortFinder)(r);f.text="Connecting to MahameruJS PM Daemon...";const g=s.default.createConnection({path:u},()=>{
|
|
364
|
+
g.write(JSON.stringify({command:"FORK_PROJECT",payload:{name:p.name,description:p.description,version:p.version,
|
|
365
|
+
projectRoot:o,port:h,host:m}}))});g.on("data",e=>{
|
|
366
|
+
const t=JSON.parse(e.toString()),{success:o,message:r,data:s,mpmUrl:i}=t
|
|
367
|
+
;o?(!function({name:e,version:t,mode:o,host:r,port:s,pid:i,mpmUrl:a}){
|
|
368
|
+
const l=[`${n.default.bold("App:")} ${n.default.cyan(e)}`,`${n.default.bold("Version:")} ${t}`,`${n.default.bold("Mode:")} ${n.default.cyan(o)}`,`${n.default.bold("PID:")} ${i}`,`${n.default.bold("Local:")} ${n.default.cyan(`http://${r}:${s}`)}`]
|
|
369
|
+
;a&&l.push(`${n.default.bold("PM URL:")} ${n.default.cyan(a)}`),console.log(n.default.green("\n Project Started")),
|
|
370
|
+
l.forEach(e=>console.log(` ${e}`)),
|
|
371
|
+
console.log(`\n${n.default.dim("Use `mahameru status` to inspect this managed project.")}\n`)}({name:p.name,
|
|
372
|
+
version:p.version,mode:"production",host:s.host,port:s.port,pid:s.pid,mpmUrl:i}),
|
|
373
|
+
f.succeed(n.default.green(`\n${r}`))):f.fail(n.default.red(`\n${r}`)),g.end(),process.exit(0)}),g.on("error",e=>{
|
|
374
|
+
"ENOENT"===e.code||"ECONNREFUSED"===e.code?f.fail(n.default.red(`\nMahameru PM Daemon is not running.\nCannot connect to Mahameru PM Daemon. Make sure you run ${n.default.bold("mahameru pm service install")} first.`)):"win32"===process.platform&&"EPERM"===e.code?function(e,t){
|
|
375
|
+
if(!(0,d.hasWindowsElevationRetry)()&&!(0,d.isWindowsProcessElevated)()){
|
|
376
|
+
e.warn(n.default.yellow("\nWindows blocked access to the Mahameru PM pipe. Requesting Administrator approval..."))
|
|
377
|
+
;const o=(0,d.relaunchCurrentProcessAsAdmin)(t)
|
|
378
|
+
;o.ok&&(console.log(n.default.cyan("An Administrator PowerShell window has been launched for the elevated retry.")),
|
|
379
|
+
console.log(n.default.dim(`The elevated retry will run from: ${t}`)),
|
|
380
|
+
console.log(n.default.dim("Keep that window open to see whether `mahameru start` succeeds or why it fails.")),
|
|
381
|
+
process.exit(0))
|
|
382
|
+
;const r="user-cancelled"===o.reason?"UAC request was cancelled.":"Unable to launch an elevated Mahameru process."
|
|
383
|
+
;e.fail(n.default.red(`\n${r}\nMahameru PM Daemon is likely running with Administrator privileges, so ${n.default.bold("mahameru start")} also needs admin approval to connect.`)),
|
|
384
|
+
o.errorText&&console.error(n.default.dim(o.errorText)),process.exit(1)}
|
|
385
|
+
e.fail(n.default.red(`\nAccess denied while connecting to Mahameru PM Daemon.\nThe daemon or Windows service is likely running elevated, and the elevated retry still could not access ${n.default.bold(u)}.`)),
|
|
386
|
+
console.log(n.default.dim("Check the visible Administrator PowerShell window for the detailed failure output.")),
|
|
387
|
+
process.exit(1)}(f,o):(f.fail(n.default.red(`\n${e.message}`)),console.error(e)),process.exit(1)})}},948(e,t,o){
|
|
388
|
+
var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
389
|
+
;Object.defineProperty(t,"__esModule",{value:!0}),t.startService=void 0
|
|
390
|
+
;const s=o(921),n=o(421),i=o(24),a=o(760),l=r(o(205));t.startService=e=>()=>{
|
|
391
|
+
const t="linux"===process.platform,o="win32"===process.platform,r=`/etc/systemd/system/${e}.service`;try{if(t){
|
|
392
|
+
if(process.getuid&&0!==process.getuid())throw new Error("This action requires root privileges. Please run with sudo.")
|
|
393
|
+
;if(!(0,
|
|
394
|
+
i.existsSync)(r))throw new Error(`Service "${e}" is not registered on this system. Please run startup command first.`)
|
|
395
|
+
;console.log(l.default.cyan(`🔍 Checking status for service: ${e}...`));let t=!1;try{"active"===(0,
|
|
396
|
+
n.execSync)(`systemctl is-active ${e}`,{stdio:["ignore","pipe","ignore"]}).toString().trim()&&(t=!0)}catch{t=!1}
|
|
397
|
+
t?console.log(l.default.yellow(`⚠️ Service "${e}" is already running.`)):(console.log(l.default.cyan(`🚀 Starting ${e}...`)),
|
|
398
|
+
(0,n.execSync)(`systemctl start ${e}`),console.log(l.default.green(`\n🚀 ${e} has been successfully started.`)),
|
|
399
|
+
console.log(`📝 To check service status, run: ${l.default.bold(`systemctl status ${e}`)}`))
|
|
400
|
+
}else o?function({serviceName:e}){try{console.log(`Attempting to start service: ${l.default.cyan(e)}...`);const t=(0,
|
|
401
|
+
a.join)(s.APPDATA_MAHAMERU_PATH,`${e}.exe`);if((0,i.existsSync)(t))return(0,n.execSync)(`"${t}" start`,{
|
|
402
|
+
cwd:s.APPDATA_MAHAMERU_PATH}),void console.log(l.default.green(`✔ Success: Service "${e}" has been started.`))
|
|
403
|
+
;console.log(l.default.yellow("WinSW binary not found. Falling back to sc.exe...")),(0,n.execSync)(`sc start "${e}"`),
|
|
404
|
+
console.log(l.default.green(`✔ Success: Service "${e}" has been started via sc.exe.`))}catch(e){
|
|
405
|
+
console.error(l.default.red(`❌ Error: Failed to start service: ${e.message}`)),
|
|
406
|
+
console.error("Make sure you are running CMD/PowerShell as an Administrator and the service is installed.")}}({
|
|
407
|
+
serviceName:e}):console.log(l.default.red("❌ Unsupported platform."))}catch(e){
|
|
408
|
+
console.error(l.default.red("❌ Failed to start service:"),e.message)}}},238(e,t,o){
|
|
409
|
+
var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
410
|
+
;Object.defineProperty(t,"__esModule",{value:!0}),t.projectStatus=void 0
|
|
411
|
+
;const s=r(o(30)),n=o(830),i=r(o(720)),a=r(o(205)),l=o(157),c="win32"===process.platform?"\\\\.\\pipe\\mahameru_pm_ipc":"/tmp/mahameru_pm.sock"
|
|
412
|
+
;t.projectStatus=(e,t)=>async({host:o,port:r})=>{try{
|
|
413
|
+
console.log(`${a.default.bold(a.default.cyan("▲ Mahameru"))} ${a.default.dim(`CLI v${t}`)}\n`);const o=(0,
|
|
414
|
+
l.getWindowsElevatedWorkingDirectory)()??e,r=await(0,
|
|
415
|
+
n.getProjectJson)(o),d=(0,i.default)("Checking available port...").start(),u=s.default.createConnection({path:c},()=>{
|
|
416
|
+
u.write(JSON.stringify({command:"STATUS",payload:{name:r.name}}))});u.on("data",e=>{
|
|
417
|
+
const{success:t,error:o,data:r}=JSON.parse(e.toString())
|
|
418
|
+
;t?(d.succeed(a.default.green("\nManaged project status loaded.")),function(e){
|
|
419
|
+
const t=`http://${e.host}:${e.port}`,o="running"===e.status?a.default.green:"stopped"===e.status?a.default.yellow:a.default.red,r=[`${a.default.bold("App:")} ${a.default.cyan(e.name)}`,`${a.default.bold("Version:")} ${e.version}`,`${a.default.bold("Mode:")} ${a.default.cyan(e.mode)}`,`${a.default.bold("Status:")} ${o(e.status)}`,`${a.default.bold("PID:")} ${"number"==typeof e.pid?e.pid:a.default.dim("-")}`,`${a.default.bold("Host:")} ${e.host}`,`${a.default.bold("Port:")} ${e.port}`,`${a.default.bold("Local:")} ${a.default.cyan(t)}`,`${a.default.bold("Root Path:")} ${e.rootPath}`]
|
|
420
|
+
;console.log(a.default.cyan("\n Project Status")),r.forEach(e=>console.log(` ${e}`)),
|
|
421
|
+
console.log(`\n${a.default.dim(`Created at: ${e.createdAt}`)}\n`)}(r)):d.fail(`${a.default.red("[Mahameru]")} ${o}`),
|
|
422
|
+
process.exit(0)}),u.on("error",e=>{"win32"===process.platform&&"EPERM"===e.code?function(e,t){if(!(0,
|
|
423
|
+
l.hasWindowsElevationRetry)()&&!(0,l.isWindowsProcessElevated)()){
|
|
424
|
+
e.warn(a.default.yellow("\nWindows blocked access to the Mahameru PM pipe. Requesting Administrator approval..."))
|
|
425
|
+
;const o=(0,l.relaunchCurrentProcessAsAdmin)(t)
|
|
426
|
+
;o.ok&&(console.log(a.default.cyan("An Administrator PowerShell window has been launched for the elevated retry.")),
|
|
427
|
+
console.log(a.default.dim(`The elevated retry will run from: ${t}`)),
|
|
428
|
+
console.log(a.default.dim("Keep that window open to see the managed project status or why it failed.")),process.exit(0))
|
|
429
|
+
;const r="user-cancelled"===o.reason?"UAC request was cancelled.":"Unable to launch an elevated Mahameru process."
|
|
430
|
+
;e.fail(a.default.red(`\n${r}\nMahameru PM Daemon is likely running with Administrator privileges, so ${a.default.bold("mahameru status")} also needs admin approval to connect.`)),
|
|
431
|
+
o.errorText&&console.error(a.default.dim(o.errorText)),process.exit(1)}
|
|
432
|
+
e.fail(a.default.red(`\nAccess denied while connecting to Mahameru PM Daemon.\nThe daemon or Windows service is likely running elevated, and the elevated retry still could not access ${a.default.bold(c)}.`)),
|
|
433
|
+
console.log(a.default.dim("Check the visible Administrator PowerShell window for the detailed failure output.")),
|
|
434
|
+
process.exit(1)
|
|
435
|
+
}(d,o):"ENOENT"===e.code||"ECONNREFUSED"===e.code?d.fail(a.default.red("\nMahameru PM Daemon is not running.")):(d.fail(a.default.red(`\n${e.message}`)),
|
|
436
|
+
console.error(e)),process.exit(1)})}catch(e){console.error(e),process.exit(1)}}},302(e,t,o){
|
|
437
|
+
var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
438
|
+
;Object.defineProperty(t,"__esModule",{value:!0}),t.status=void 0
|
|
439
|
+
;const s=o(921),n=o(337),i=o(421),a=o(24),l=o(760),c=r(o(205));function d(e,t){
|
|
440
|
+
console.log(`${c.default.bold(c.default.cyan("▲ Mahameru"))} ${c.default.dim(`Process Manager Status v${t}`)}`),
|
|
441
|
+
console.log("---------------+---------------------------------------------------");for(const[t,o]of Object.entries(e)){
|
|
442
|
+
const e=t.padEnd(14," ");console.log(` ${e} | ${o}`)}
|
|
443
|
+
console.log("---------------+---------------------------------------------------")}t.status=(e,t)=>()=>{
|
|
444
|
+
const o="linux"===process.platform,r="win32"===process.platform,u=`/etc/systemd/system/${e}.service`;let m="";try{m=(0,
|
|
445
|
+
n.getNodeModulesPath)()}catch(e){return void console.error(c.default.red(`❌ ${e.message}`))}const p=(0,
|
|
446
|
+
l.join)(m,"@mahameru","cli");try{if(o){const o={"Service Name":e,Installed:"No",State:"Stopped","Main Process":"N/A",
|
|
447
|
+
"Memory Usage":"N/A","CPU Usage":"N/A"};if(!(0,a.existsSync)(u))return o.Installed=c.default.red("Not Installed"),
|
|
448
|
+
o.State=c.default.red("N/A"),void d(o,t);o.Installed=c.default.green("Yes");try{const t=(0,
|
|
449
|
+
i.execSync)(`systemctl show ${e} --property=ActiveState`,{stdio:["ignore","pipe","ignore"]
|
|
450
|
+
}).toString().trim().split("=")[1],r=(0,i.execSync)(`systemctl show ${e} --property=SubState`,{
|
|
451
|
+
stdio:["ignore","pipe","ignore"]
|
|
452
|
+
}).toString().trim().split("=")[1],s=(0,i.execSync)(`systemctl show ${e} --property=MainPID`,{
|
|
453
|
+
stdio:["ignore","pipe","ignore"]}).toString().trim().split("=")[1];if("active"===t){
|
|
454
|
+
o.State=c.default.green(`${t} (${r})`),o["Main Process"]=s&&"0"!==s?s:"N/A";try{const t=(0,
|
|
455
|
+
i.execSync)(`systemctl show ${e} --property=MemoryCurrent`,{stdio:["ignore","pipe","ignore"]
|
|
456
|
+
}).toString().trim().split("=")[1];if(t&&"[not set]"!==t){const e=(parseInt(t,10)/1024/1024).toFixed(2)
|
|
457
|
+
;o["Memory Usage"]=`${e} MB`}}catch{}try{const e=(0,i.execSync)(`ps -p ${s} -o %cpu`,{stdio:["ignore","pipe","ignore"]
|
|
458
|
+
}).toString().trim().split("\n")[1];e&&(o["CPU Usage"]=`${e.trim()}%`)}catch{}
|
|
459
|
+
}else o.State="failed"===t?c.default.red(`${t} (${r})`):c.default.yellow(`${t} (${r})`)}catch(e){
|
|
460
|
+
o.State=c.default.red("Unknown (Error reading systemctl)")}d(o,t),function(e){try{const t=(0,
|
|
461
|
+
a.readFileSync)(e,"utf-8").match(/StandardError=append:(.+)/);if(t&&t[1]){const e=t[1].trim();if((0,a.existsSync)(e)){
|
|
462
|
+
console.log(c.default.bold(c.default.yellow(`\n📝 Last 3 lines from error log (${e}):`)));const t=(0,
|
|
463
|
+
a.readFileSync)(e,"utf-8").trim().split("\n").slice(-3)
|
|
464
|
+
;t.length>0&&""!==t[0]?t.forEach(e=>console.log(` ${c.default.dim(e)}`)):console.log(c.default.dim(" (Log file is empty)")),
|
|
465
|
+
console.log()}}}catch{}}(u)}else r?function({serviceName:e,mahameruInstalationPath:t,version:o}){
|
|
466
|
+
if("win32"===process.platform)try{const r=(0,l.join)(s.APPDATA_MAHAMERU_PATH,`${e}.exe`),n=(0,
|
|
467
|
+
l.join)(s.APPDATA_MAHAMERU_PATH,`${e}.xml`);let d=null,u=null;if((0,a.existsSync)(n))try{const e=(0,
|
|
468
|
+
a.readFileSync)(n,"utf8"),t=e.match(/--host\s+([^\s"<]+)/),o=e.match(/--port\s+([^\s"<]+)/);t&&(d=t[1]),o&&(u=o[1])
|
|
469
|
+
}catch(e){}const m=()=>{d&&console.log(`Host : ${c.default.cyan(d)}`),
|
|
470
|
+
u&&console.log(`Port : ${c.default.cyan(u)}`),
|
|
471
|
+
u&&d&&console.log(`URL : ${c.default.cyan(`http://${d}:${u}`)}`)};if((0,a.existsSync)(r))try{const e=(0,
|
|
472
|
+
i.execSync)(`"${r}" status`,{cwd:t}).toString().trim()
|
|
473
|
+
;return console.log(`\n${c.default.bold(c.default.cyan("▲ Mahameru"))} ${c.default.dim(`Process Manager Status v${o}`)}\n`),
|
|
474
|
+
void("NonExistent"===e?(console.log(`Installation status : ${c.default.red("Not Installed (NonExistent)")}`),
|
|
475
|
+
console.log(`Service Status : ${c.default.red("-")}`)):(console.log(`Installation status : ${c.default.green("Installed")}`),
|
|
476
|
+
"Started"===e?console.log(`Service Status : ${c.default.green("● Started (Running)")}`):"Stopped"===e?console.log(`Service Status : ${c.default.yellow("○ Stopped")}`):console.log(`Service Status : ${c.default.gray(e)}`),
|
|
477
|
+
m()))}catch(e){}try{const t=(0,i.execSync)(`sc query "${e}"`,{stdio:["pipe","pipe","ignore"]}).toString()
|
|
478
|
+
;console.log(`\n${c.default.bold(c.default.cyan("▲ Mahameru"))} ${c.default.dim(`Process Manager Status v${o}`)}\n`),
|
|
479
|
+
console.log(`Installation status : ${c.default.green("Installed")}`),
|
|
480
|
+
t.includes("RUNNING")?console.log(`Service Status : ${c.default.green("● Started (Running)")}`):t.includes("STOPPED")?console.log(`Service Status : ${c.default.yellow("○ Stopped")}`):console.log(`Service Status : ${c.default.gray("Unknown")}`),
|
|
481
|
+
m()}catch(e){
|
|
482
|
+
console.log(`\n${c.default.bold(c.default.cyan("▲ Mahameru"))} ${c.default.dim(`Process Manager Status v${o}`)}\n`),
|
|
483
|
+
console.log(`Installation status : ${c.default.red("Not Installed")}`),
|
|
484
|
+
console.log(`Service Status : ${c.default.red("-")}`)}}catch(e){
|
|
485
|
+
console.error(c.default.red(`❌ Error: ${e.message}`)),
|
|
486
|
+
console.error("Make sure you are running CMD/PowerShell as an Administrator.")}}({serviceName:e,
|
|
487
|
+
mahameruInstalationPath:p,version:t}):console.log(c.default.red("❌ Unsupported platform."))}catch(e){
|
|
488
|
+
console.error(c.default.red("❌ Failed to retrieve service status:"),e.message)}}},653(e,t,o){
|
|
489
|
+
var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
490
|
+
;Object.defineProperty(t,"__esModule",{value:!0}),t.stopFork=void 0
|
|
491
|
+
;const s=r(o(30)),n=o(830),i=r(o(720)),a=r(o(205)),l="win32"===process.platform?"\\\\.\\pipe\\mahameru_pm_ipc":"/tmp/mahameru_pm.sock"
|
|
492
|
+
;t.stopFork=(e,t)=>async({host:o,port:r})=>{try{
|
|
493
|
+
console.log(`${a.default.bold(a.default.cyan("▲ Mahameru"))} ${a.default.dim(`CLI v${t}`)}\n`);const o=await(0,
|
|
494
|
+
n.getProjectJson)(e),r=(0,i.default)("Checking available port...").start(),c=s.default.createConnection({path:l},()=>{
|
|
495
|
+
c.write(JSON.stringify({command:"STOP",payload:{name:o.name}}))});c.on("data",e=>{
|
|
496
|
+
const{success:t,message:o,data:s}=JSON.parse(e.toString())
|
|
497
|
+
;t?console.log(s):r.fail(`${a.default.red("[Mahameru]")} ${o}`),process.exit(0)})}catch(e){console.error(e),
|
|
498
|
+
process.exit(1)}}},402(e,t,o){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
499
|
+
;Object.defineProperty(t,"__esModule",{value:!0}),t.stopService=void 0
|
|
500
|
+
;const s=o(921),n=o(337),i=o(421),a=o(24),l=o(760),c=r(o(205));t.stopService=e=>()=>{
|
|
501
|
+
const t="linux"===process.platform,o="win32"===process.platform,r=`/etc/systemd/system/${e}.service`;let d="";try{d=(0,
|
|
502
|
+
n.getNodeModulesPath)()}catch(e){return void console.error(c.default.red(`❌ ${e.message}`))}const u=(0,
|
|
503
|
+
l.join)(d,"@mahameru","cli");try{if(t){
|
|
504
|
+
if(process.getuid&&0!==process.getuid())throw new Error("This action requires root privileges. Please run with sudo.")
|
|
505
|
+
;if(!(0,a.existsSync)(r))throw new Error(`Service "${e}" is not registered on this system.`)
|
|
506
|
+
;console.log(c.default.cyan(`🔍 Checking status for service: ${e}...`));let t=!1;try{"active"===(0,
|
|
507
|
+
i.execSync)(`systemctl is-active ${e}`,{stdio:["ignore","pipe","ignore"]}).toString().trim()&&(t=!0)}catch{t=!1}
|
|
508
|
+
t?(console.log(c.default.yellow(`🛑 Service is active. Stopping ${e}...`)),(0,i.execSync)(`systemctl stop ${e}`),
|
|
509
|
+
console.log(c.default.green(`\n🛑 ${e} has been successfully stopped.`))):console.log(c.default.yellow(`⚠️ Service "${e}" is already stopped.`))
|
|
510
|
+
}else o?function({serviceName:e,mahameruInstalationPath:t}){try{
|
|
511
|
+
console.log(`Attempting to stop service: ${c.default.cyan(e)}...`)
|
|
512
|
+
;const o=(0,l.join)(s.APPDATA_MAHAMERU_PATH,`${e}.exe`);if((0,a.existsSync)(o))return(0,i.execSync)(`"${o}" stop`,{cwd:t
|
|
513
|
+
}),void console.log(c.default.green(`✔ Success: Service "${e}" has been stopped.`))
|
|
514
|
+
;console.log(c.default.yellow("WinSW binary not found. Falling back to sc.exe...")),(0,i.execSync)(`sc stop "${e}"`),
|
|
515
|
+
console.log(c.default.green(`✔ Success: Service "${e}" has been stopped via sc.exe.`))}catch(e){
|
|
516
|
+
console.error(c.default.red(`❌ Error: Failed to stop service: ${e.message}`)),
|
|
517
|
+
console.error("Make sure you are running CMD/PowerShell as an Administrator.")}}({serviceName:e,
|
|
518
|
+
mahameruInstalationPath:u}):console.log(c.default.red("❌ Unsupported platform."))}catch(e){
|
|
519
|
+
console.error(c.default.red("❌ Failed to stop service:"),e.message)}}},544(e,t,o){
|
|
520
|
+
var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
521
|
+
;Object.defineProperty(t,"__esModule",{value:!0}),t.uninstall=void 0
|
|
522
|
+
;const s=o(921),n=o(421),i=o(24),a=o(760),l=r(o(205));t.uninstall=e=>()=>{
|
|
523
|
+
const t="linux"===process.platform,o="win32"===process.platform,r=`/etc/systemd/system/${e}.service`;try{if(t){
|
|
524
|
+
if(process.getuid&&0!==process.getuid())throw new Error("This action requires root privileges. Please run with sudo.")
|
|
525
|
+
;if(!(0,i.existsSync)(r))throw new Error(`Service "${e}" was not found or is not registered on this system.`)
|
|
526
|
+
;console.log(l.default.cyan(`🔍 Checking status for service: ${e}...`));let t=!1;try{"active"===(0,
|
|
527
|
+
n.execSync)(`systemctl is-active ${e}`,{stdio:["ignore","pipe","ignore"]}).toString().trim()&&(t=!0)}catch{t=!1}
|
|
528
|
+
t&&(console.log(l.default.yellow(`🛑 Service is running. Stopping ${e}...`)),(0,n.execSync)(`systemctl stop ${e}`)),
|
|
529
|
+
console.log(l.default.cyan("🔄 Disabling service..."));try{(0,n.execSync)(`systemctl disable ${e}`,{
|
|
530
|
+
stdio:["ignore","pipe","ignore"]})}catch{}console.log(l.default.cyan(`🗑️ Removing service file from ${r}...`)),(0,
|
|
531
|
+
n.execSync)(`rm ${r}`),(0,n.execSync)("systemctl daemon-reload"),(0,n.execSync)("systemctl reset-failed"),
|
|
532
|
+
console.log(l.default.green(`\n🚀 ${e} successfully uninstalled!`))}else if(o){
|
|
533
|
+
console.log("Deleting Windows Service...");const t=(0,a.join)(s.APPDATA_MAHAMERU_PATH,`${e}.exe`);if((0,
|
|
534
|
+
i.existsSync)(t)){try{(0,n.execSync)(`"${t}" stop`,{cwd:s.APPDATA_MAHAMERU_PATH})}catch(e){}(0,
|
|
535
|
+
n.execSync)(`"${t}" uninstall`,{cwd:s.APPDATA_MAHAMERU_PATH
|
|
536
|
+
}),console.log(`Sukses: Service "${e}" berhasil di-uninstall.`),
|
|
537
|
+
console.log(l.default.green("✔ Mahameru Process Manager successfully uninstalled."))}else{
|
|
538
|
+
console.log(l.default.yellow("Cannot found WinSW binary. Fallback to sc delete..."));try{(0,
|
|
539
|
+
n.execSync)(`sc stop "${e}"`)}catch(e){}
|
|
540
|
+
(0,n.execSync)(`sc delete "${e}"`),console.log(l.default.green(`✔ "${e}" successfully uninstalled.`))}
|
|
541
|
+
}else console.log(l.default.red("❌ Unsupported platform."))}catch(e){
|
|
542
|
+
console.error(l.default.red("❌ Uninstallation failed:"),e.message)}}},814(e,t,o){
|
|
543
|
+
var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}}
|
|
544
|
+
;Object.defineProperty(t,"__esModule",{value:!0})
|
|
545
|
+
;const s=o(858),n=r(o(205)),i=o(330),a=o(829),l=o(634),c=o(536),d=o(145),u=o(927),m=o(544),p=o(948),f=o(402),h=o(302),g=o(24),y=o(921),v=o(363),w=o(238),S=o(653),$=new s.Command
|
|
546
|
+
;try{if(!(0,g.existsSync)(y.APPDATA_PATH))throw new Error("AppData directory not found.");(0,
|
|
547
|
+
g.existsSync)(y.APPDATA_MAHAMERU_PATH)||(0,g.mkdirSync)(y.APPDATA_MAHAMERU_PATH,{recursive:!0})
|
|
548
|
+
;const e=process.cwd(),t="mahameru-process-manager"
|
|
549
|
+
;$.name("mahameru").description(`${n.default.bold(n.default.cyan("▲ MahameruJS"))} ${n.default.dim(`CLI v${i.version}`)}`).version(i.version,"-v, --version","Display help for command"),
|
|
550
|
+
$.command("dev").description("Start MahameruJS development server.").option("-p, --port <number>","Port to run the server on",c.parsePort).option("-H, --host <string>","Host to run the server on").action((0,
|
|
551
|
+
a.dev)({version:i.version})),$.command("build").description("Build MahameruJS production application.").action((0,
|
|
552
|
+
l.build)({rootPath:e
|
|
553
|
+
})),$.command("start").description("Start MahameruJS production server.").option("-p, --port <number>","Port to run the server on",c.parsePort,8e3).option("-H, --host <string>","Host to run the server on","127.0.0.1").action((0,
|
|
554
|
+
v.startFork)({rootPath:e})),$.command("stop").description("Stop MahameruJS production server.").action((0,
|
|
555
|
+
S.stopFork)(e,i.version)),$.command("status").description("View MahameruJS production server status.").action((0,
|
|
556
|
+
w.projectStatus)(e,i.version))
|
|
557
|
+
;const o=$.command("pm").description(`${n.default.bold(n.default.cyan("▲ MahameruJS"))} ${n.default.dim(`Process Manager v${i.version}`)}`)
|
|
558
|
+
;o.command("start").description("Start MahameruJS Process Manager.").option("-p, --port <number>","Port to run the server on",c.parsePort,8e3).option("-H, --host <string>","Host to run the server on","127.0.0.1").option("-d, --daemon","Run as a daemon",!1).action((0,
|
|
559
|
+
u.pm)(i.version)),
|
|
560
|
+
o.command("status").description("Start MahameruJS Process Manager.").option("-p, --port <number>","Port to run the server on",c.parsePort,8e3).option("-H, --host <string>","Host to run the server on","127.0.0.1").option("-d, --daemon","Run as a daemon",!1).action(()=>{
|
|
561
|
+
console.log(n.default.bold(n.default.cyan(`▲ MahameruJS Process Manager\n\n Not ${n.default.yellow("Not implemented yet.")}`)))
|
|
562
|
+
}),o.on("command:*",e=>{const t=e[0]
|
|
563
|
+
;["install","uninstall","start","stop"].includes(t)&&(console.log(n.default.yellow(`\n⚠ Did you mean 'mahameru pm service ${t}'?\n`)),
|
|
564
|
+
r.outputHelp(),process.exit(1))})
|
|
565
|
+
;const r=o.command("service").description(`${n.default.bold(n.default.cyan("▲ MahameruJS"))} ${n.default.dim(`Process Manager Service v${i.version}`)}`)
|
|
566
|
+
;r.command("install").description("Install MahameruJS Process Manager and register the server as a service. This will make MahameruJS Process Manager boot on system startup.").option("-p, --port <number>","Port to run the server on",c.parsePort,8080).option("-H, --host <string>","Host to run the server on","127.0.0.1").action((0,
|
|
567
|
+
d.install)(t,e)),
|
|
568
|
+
r.command("uninstall").description("Uninstall MahameruJS Process Manager as a service. This will remove the service from systemd and disable it.").action((0,
|
|
569
|
+
m.uninstall)(t)),r.command("start").description("Start MahameruJS Process Manager service.").action((0,
|
|
570
|
+
p.startService)(t)),r.command("stop").description("Stop MahameruJS Process Manager service.").action((0,
|
|
571
|
+
f.stopService)(t)),r.command("status").description("Get MahameruJS Process Manager status.").action((0,
|
|
572
|
+
h.status)(t,i.version)),$.parse(process.argv)}catch(e){console.error(e),process.exit(1)}},921(e,t,o){
|
|
573
|
+
t.APPDATA_MAHAMERU_PATH=t.APPDATA_PATH=void 0;const r=o(760);t.APPDATA_PATH=process.env.APPDATA,
|
|
574
|
+
t.APPDATA_MAHAMERU_PATH=(0,r.join)(t.APPDATA_PATH,"mahameru")},209(e,t,o){var r=this&&this.__importDefault||function(e){
|
|
575
|
+
return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),
|
|
576
|
+
t.freePortFinder=async function(e=3e3){let t=e;const o=e+999;for(;t<o;)try{return await n(t)}catch(e){t++}
|
|
577
|
+
throw new Error(`Port ${e} - 999 is not available`)};const s=r(o(30));function n(e){return new Promise((t,o)=>{
|
|
578
|
+
const r=s.default.createServer();r.once("error",e=>{e.code,o(e)}),r.once("listening",()=>{r.close(()=>t(e))}),
|
|
579
|
+
r.listen(e,"127.0.0.1")})}},830(e,t,o){t.getProjectJson=async function(e){try{return JSON.parse(await(0,r.readFile)((0,
|
|
580
|
+
s.join)(e,"package.json"),"utf-8"))}catch(e){throw new Error("package.json not found")}};const r=o(455),s=o(760)},
|
|
581
|
+
337(e,t,o){t.getNodeModulesPath=function(){try{return(0,r.execSync)("npm root -g",{stdio:["ignore","pipe","ignore"]
|
|
582
|
+
}).toString().trim()}catch(e){throw new Error("npm is not installed or not accessible on your system.")}};const r=o(421)
|
|
583
|
+
},813(e,t,o){t.isMahameruProjectDir=function(e){const t=(0,s.join)(e,"package.json"),o=(0,s.join)(e,"node_modules")
|
|
584
|
+
;if(!(0,r.existsSync)(t)&&(0,r.existsSync)(o))return!1;try{const e=(0,r.readFileSync)(t,"utf-8"),o=JSON.parse(e)
|
|
585
|
+
;return!(!o.dependencies||!o.dependencies.mahameru)}catch(e){return!1}};const r=o(24),s=o(760)},157(e,t,o){
|
|
586
|
+
t.hasWindowsElevationRetry=function(){return"1"===process.env[s]},t.getWindowsElevatedWorkingDirectory=function(){
|
|
587
|
+
return process.env[n]},t.isWindowsProcessElevated=function(){if("win32"!==process.platform)return!1;const e=(0,
|
|
588
|
+
r.spawnSync)("powershell.exe",["-NoProfile","-NonInteractive","-Command","([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)"],{
|
|
589
|
+
encoding:"utf8",windowsHide:!0});return 0===e.status&&"true"===e.stdout.trim().toLowerCase()},
|
|
590
|
+
t.relaunchCurrentProcessAsAdmin=function(e){if("win32"!==process.platform)return{ok:!1,reason:"unsupported-platform"}
|
|
591
|
+
;const t=process.argv[1];if(!t)return{ok:!1,reason:"missing-entrypoint"}
|
|
592
|
+
;const o=[t,...process.argv.slice(2)],a=`$env:${s}='1'`,l=`$env:${n}='${i(e)}'`,c=[a,l,`Set-Location -LiteralPath '${i(e)}'`,`& '${i(process.execPath)}' ${o.map(e=>`'${i(e)}'`).join(" ")}`,"",'Write-Host ""','Write-Host "Mahameru elevated session finished. Review any output above." -ForegroundColor Cyan','Write-Host "Press Enter to close this Administrator window." -ForegroundColor DarkGray',"Read-Host | Out-Null"].join("; "),d=["$argumentList = "+(m=["-NoProfile","-ExecutionPolicy","Bypass","-NoExit","-Command",c],
|
|
593
|
+
`@(${m.map(e=>`'${i(e)}'`).join(", ")})`),`Start-Process -FilePath 'powershell.exe' -Verb RunAs -WorkingDirectory '${i(e)}' -ArgumentList $argumentList`].join("; "),u=(0,
|
|
594
|
+
r.spawnSync)("powershell.exe",["-NoProfile","-NonInteractive","-Command",d],{encoding:"utf8",windowsHide:!0});var m
|
|
595
|
+
;if(0===u.status)return{ok:!0};const p=[u.stdout,u.stderr].filter(Boolean).join("\n").trim();return{ok:!1,
|
|
596
|
+
reason:/cancelled by the user|canceled by the user/i.test(p)?"user-cancelled":"spawn-failed",errorText:p}}
|
|
597
|
+
;const r=o(421),s="MAHAMERU_ELEVATED_RETRY",n="MAHAMERU_ELEVATED_CWD";function i(e){return e.replace(/'/g,"''")}},
|
|
598
|
+
858(e){e.exports=require("commander")},261(e){e.exports=require("events")},720(e){e.exports=require("ora")},205(e){
|
|
599
|
+
e.exports=require("picocolors")},471(e){e.exports=require("porterman/string-helper")},437(e){
|
|
600
|
+
e.exports=require("socket.io")},896(e){e.exports=require("fs")},943(e){e.exports=require("fs/promises")},339(e){
|
|
601
|
+
e.exports=require("module")},278(e){e.exports=require("net")},421(e){e.exports=require("node:child_process")},139(e){
|
|
602
|
+
e.exports=require("node:cluster")},24(e){e.exports=require("node:fs")},455(e){e.exports=require("node:fs/promises")},
|
|
603
|
+
67(e){e.exports=require("node:http")},995(e){e.exports=require("node:module")},30(e){e.exports=require("node:net")},
|
|
604
|
+
161(e){e.exports=require("node:os")},760(e){e.exports=require("node:path")},928(e){e.exports=require("path")},330(e){
|
|
605
|
+
e.exports={version:"0.0.17"}}};const t={};(function o(r){const s=t[r];if(void 0!==s)return s.exports;const n=t[r]={
|
|
606
|
+
exports:{}};return e[r].call(n.exports,n,n.exports,o),n.exports})(814)})();
|