@mahameru/cli 0.0.0
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/README.md +95 -0
- package/dist/index.js +281 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# MahameruJS CLI Utility
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/mahameru)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
`@mahameru/cli` is the command-line interface for running and building Mahameru-based applications. This package provides the core workflow for local development and project builds from the terminal.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Install it as a dependency in your Mahameru project:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @mahameru/cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
You can also run it through an npm script that points to the `mahameru` binary.
|
|
17
|
+
|
|
18
|
+
If you don't have any MahameruJS projects, you can create one by running:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm create mahameru
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
or
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx create-mahameru
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
and follow the prompts.
|
|
31
|
+
|
|
32
|
+
## Project Requirements
|
|
33
|
+
|
|
34
|
+
This CLI expects a `mahameru.config.ts` file in the project root. That file is loaded when running development mode.
|
|
35
|
+
|
|
36
|
+
Some commands also rely on these project dependencies:
|
|
37
|
+
|
|
38
|
+
- `tsx` to load the TypeScript config file for the `dev` command
|
|
39
|
+
- `typescript` for the compile step in the `build` command
|
|
40
|
+
- `tsc-alias` to rewrite path aliases after compilation
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
### Development
|
|
45
|
+
|
|
46
|
+
Run the Mahameru development server:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
mahameru dev
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Available options:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
mahameru dev --port 3000
|
|
56
|
+
mahameru dev -p 3000
|
|
57
|
+
mahameru dev --host localhost
|
|
58
|
+
mahameru dev -h localhost
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This command will:
|
|
62
|
+
|
|
63
|
+
- load `mahameru.config.ts`
|
|
64
|
+
- apply default config values when they are not provided
|
|
65
|
+
- run the Mahameru application from the current project
|
|
66
|
+
|
|
67
|
+
### Build
|
|
68
|
+
|
|
69
|
+
Build the project with TypeScript:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
mahameru build
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
This command will:
|
|
76
|
+
|
|
77
|
+
- run `tsc --project tsconfig.json`
|
|
78
|
+
- run `tsc-alias -p tsconfig.json`
|
|
79
|
+
|
|
80
|
+
### Start
|
|
81
|
+
|
|
82
|
+
The `mahameru start` command is not implemented yet, so it cannot be used for production runtime at the moment.
|
|
83
|
+
|
|
84
|
+
## Quick Workflow
|
|
85
|
+
|
|
86
|
+
This CLI is focused on the basic development workflow:
|
|
87
|
+
|
|
88
|
+
1. Use `mahameru dev` during local development.
|
|
89
|
+
2. Use `mahameru build` to produce the TypeScript build output.
|
|
90
|
+
3. Make sure `mahameru.config.ts` exists in the project root so `dev` can run correctly.
|
|
91
|
+
|
|
92
|
+
## Notes
|
|
93
|
+
|
|
94
|
+
- If `mahameru.config.ts` is missing, the CLI will stop and show an error.
|
|
95
|
+
- If `tsx`, `typescript`, or `tsc-alias` are not installed in the project, the related command will fail.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/*!
|
|
3
|
+
* ┌────────────────────────────────────────────┐
|
|
4
|
+
* │ │
|
|
5
|
+
* │ ▲ MahameruJS - CLI UTILITY │
|
|
6
|
+
* │ Version: 0.0.0 │
|
|
7
|
+
* │ Built: 2026 │
|
|
8
|
+
* │ │
|
|
9
|
+
* │ Copyright (c) Bintan <hello@bintvn.co> │
|
|
10
|
+
* │ Licensed under the ISC License. │
|
|
11
|
+
* │ │
|
|
12
|
+
* └────────────────────────────────────────────┘
|
|
13
|
+
*/
|
|
14
|
+
import{parseArgs as e,stripVTControlCharacters as t}from"node:util";import{spawn as r}from"node:child_process"
|
|
15
|
+
;import{join as i}from"node:path";import{existsSync as s}from"node:fs";import{default as n}from"node:process"
|
|
16
|
+
;import{default as o}from"node:os";import{default as a}from"node:tty";import{pathToFileURL as l}from"node:url";var c={
|
|
17
|
+
991(e){
|
|
18
|
+
let t=process||{},r=t.argv||[],i=t.env||{},s=!(i.NO_COLOR||r.includes("--no-color"))&&(!!i.FORCE_COLOR||r.includes("--color")||"win32"===t.platform||(t.stdout||{}).isTTY&&"dumb"!==i.TERM||!!i.CI),n=(e,t,r=e)=>i=>{
|
|
19
|
+
let s=""+i,n=s.indexOf(t,e.length);return~n?e+o(s,t,r,n)+t:e+s+t},o=(e,t,r,i)=>{let s="",n=0;do{s+=e.substring(n,i)+r,
|
|
20
|
+
n=i+t.length,i=e.indexOf(t,n)}while(~i);return s+e.substring(n)},a=(e=s)=>{let t=e?n:()=>String;return{
|
|
21
|
+
isColorSupported:e,reset:t("[0m","[0m"),bold:t("[1m","[22m","[22m[1m"),dim:t("[2m","[22m","[22m[2m"),
|
|
22
|
+
italic:t("[3m","[23m"),underline:t("[4m","[24m"),inverse:t("[7m","[27m"),hidden:t("[8m","[28m"),
|
|
23
|
+
strikethrough:t("[9m","[29m"),black:t("[30m","[39m"),red:t("[31m","[39m"),green:t("[32m","[39m"),
|
|
24
|
+
yellow:t("[33m","[39m"),blue:t("[34m","[39m"),magenta:t("[35m","[39m"),cyan:t("[36m","[39m"),
|
|
25
|
+
white:t("[37m","[39m"),gray:t("[90m","[39m"),bgBlack:t("[40m","[49m"),bgRed:t("[41m","[49m"),
|
|
26
|
+
bgGreen:t("[42m","[49m"),bgYellow:t("[43m","[49m"),bgBlue:t("[44m","[49m"),bgMagenta:t("[45m","[49m"),
|
|
27
|
+
bgCyan:t("[46m","[49m"),bgWhite:t("[47m","[49m"),blackBright:t("[90m","[39m"),redBright:t("[91m","[39m"),
|
|
28
|
+
greenBright:t("[92m","[39m"),yellowBright:t("[93m","[39m"),blueBright:t("[94m","[39m"),
|
|
29
|
+
magentaBright:t("[95m","[39m"),cyanBright:t("[96m","[39m"),whiteBright:t("[97m","[39m"),
|
|
30
|
+
bgBlackBright:t("[100m","[49m"),bgRedBright:t("[101m","[49m"),bgGreenBright:t("[102m","[49m"),
|
|
31
|
+
bgYellowBright:t("[103m","[49m"),bgBlueBright:t("[104m","[49m"),bgMagentaBright:t("[105m","[49m"),
|
|
32
|
+
bgCyanBright:t("[106m","[49m"),bgWhiteBright:t("[107m","[49m")}};e.exports=a(),e.exports.createColors=a}},h={}
|
|
33
|
+
;function u(e){var t=h[e];if(void 0!==t)return t.exports;var r=h[e]={exports:{}};return c[e](r,r.exports,u),r.exports}
|
|
34
|
+
u.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return u.d(t,{a:t}),t},u.d=(e,t)=>{
|
|
35
|
+
for(var r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},
|
|
36
|
+
u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const f={rE:"0.0.0"
|
|
37
|
+
},m=(e=0)=>t=>`[${t+e}m`,d=(e=0)=>t=>`[${38+e};5;${t}m`,p=(e=0)=>(t,r,i)=>`[${38+e};2;${t};${r};${i}m`,_={modifier:{
|
|
38
|
+
reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],
|
|
39
|
+
strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],
|
|
40
|
+
cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],
|
|
41
|
+
yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{
|
|
42
|
+
bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],
|
|
43
|
+
bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],
|
|
44
|
+
bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}}
|
|
45
|
+
;Object.keys(_.modifier),Object.keys(_.color),Object.keys(_.bgColor);const g=function(){const e=new Map
|
|
46
|
+
;for(const[t,r]of Object.entries(_)){for(const[t,i]of Object.entries(r))_[t]={open:`[${i[0]}m`,close:`[${i[1]}m`},
|
|
47
|
+
r[t]=_[t],e.set(i[0],i[1]);Object.defineProperty(_,t,{value:r,enumerable:!1})}return Object.defineProperty(_,"codes",{
|
|
48
|
+
value:e,enumerable:!1}),_.color.close="[39m",_.bgColor.close="[49m",_.color.ansi=m(),_.color.ansi256=d(),
|
|
49
|
+
_.color.ansi16m=p(),_.bgColor.ansi=m(10),_.bgColor.ansi256=d(10),_.bgColor.ansi16m=p(10),Object.defineProperties(_,{
|
|
50
|
+
rgbToAnsi256:{
|
|
51
|
+
value:(e,t,r)=>e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5),
|
|
52
|
+
enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t
|
|
53
|
+
;3===r.length&&(r=[...r].map(e=>e+e).join(""));const i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,255&i]},
|
|
54
|
+
enumerable:!1},hexToAnsi256:{value:e=>_.rgbToAnsi256(..._.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){
|
|
55
|
+
if(e<8)return 30+e;if(e<16)return e-8+90;let t,r,i;if(e>=232)t=(10*(e-232)+8)/255,r=t,i=t;else{const s=(e-=16)%36
|
|
56
|
+
;t=Math.floor(e/36)/5,r=Math.floor(s/6)/5,i=s%6/5}const s=2*Math.max(t,r,i);if(0===s)return 30
|
|
57
|
+
;let n=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(t));return 2===s&&(n+=60),n},enumerable:!1},rgbToAnsi:{
|
|
58
|
+
value:(e,t,r)=>_.ansi256ToAnsi(_.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{
|
|
59
|
+
value:e=>_.ansi256ToAnsi(_.hexToAnsi256(e)),enumerable:!1}}),_}(),b=g
|
|
60
|
+
;function v(e,t=(globalThis.Deno?globalThis.Deno.args:n.argv)){
|
|
61
|
+
const r=e.startsWith("-")?"":1===e.length?"-":"--",i=t.indexOf(r+e),s=t.indexOf("--");return-1!==i&&(-1===s||i<s)}
|
|
62
|
+
const{env:x}=n;let T;function y(e,{streamIsTTY:t,sniffFlags:r=!0}={}){const i=function(){
|
|
63
|
+
if("FORCE_COLOR"in x)return"true"===x.FORCE_COLOR?1:"false"===x.FORCE_COLOR?0:0===x.FORCE_COLOR.length?1:Math.min(Number.parseInt(x.FORCE_COLOR,10),3)
|
|
64
|
+
}();void 0!==i&&(T=i);const s=r?T:i;if(0===s)return 0;if(r){
|
|
65
|
+
if(v("color=16m")||v("color=full")||v("color=truecolor"))return 3;if(v("color=256"))return 2}
|
|
66
|
+
if("TF_BUILD"in x&&"AGENT_NAME"in x)return 1;if(e&&!t&&void 0===s)return 0;const a=s||0;if("dumb"===x.TERM)return a
|
|
67
|
+
;if("win32"===n.platform){const e=o.release().split(".")
|
|
68
|
+
;return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}
|
|
69
|
+
if("CI"in x)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(e=>e in x)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(e=>e in x)||"codeship"===x.CI_NAME?1:a
|
|
70
|
+
;if("TEAMCITY_VERSION"in x)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(x.TEAMCITY_VERSION)?1:0
|
|
71
|
+
;if("truecolor"===x.COLORTERM)return 3;if("xterm-kitty"===x.TERM)return 3;if("xterm-ghostty"===x.TERM)return 3
|
|
72
|
+
;if("wezterm"===x.TERM)return 3;if("TERM_PROGRAM"in x){
|
|
73
|
+
const e=Number.parseInt((x.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(x.TERM_PROGRAM){case"iTerm.app":
|
|
74
|
+
return e>=3?3:2;case"Apple_Terminal":return 2}}
|
|
75
|
+
return/-256(color)?$/i.test(x.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(x.TERM)||"COLORTERM"in x?1:a
|
|
76
|
+
}function w(e,t={}){return function(e){return 0!==e&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}(y(e,{
|
|
77
|
+
streamIsTTY:e&&e.isTTY,...t}))}
|
|
78
|
+
v("no-color")||v("no-colors")||v("color=false")||v("color=never")?T=0:(v("color")||v("colors")||v("color=true")||v("color=always"))&&(T=1)
|
|
79
|
+
;const E={stdout:w({isTTY:a.isatty(1)}),stderr:w({isTTY:a.isatty(2)})};function S(e,t,r){let i=e.indexOf(t)
|
|
80
|
+
;if(-1===i)return e;const s=t.length;let n=0,o="";do{o+=e.slice(n,i)+t+r,n=i+s,i=e.indexOf(t,n)}while(-1!==i)
|
|
81
|
+
;return o+=e.slice(n),o}
|
|
82
|
+
const{stdout:O,stderr:R}=E,I=Symbol("GENERATOR"),C=Symbol("STYLER"),P=Symbol("IS_EMPTY"),B=["ansi","ansi","ansi256","ansi16m"],M=Object.create(null)
|
|
83
|
+
;const A=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{
|
|
84
|
+
if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3")
|
|
85
|
+
;const r=O?O.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,j.prototype),t};function j(e){
|
|
86
|
+
return A(e)}Object.setPrototypeOf(j.prototype,Function.prototype);for(const[e,t]of Object.entries(b))M[e]={get(){
|
|
87
|
+
const r=N(this,W(t.open,t.close,this[C]),this[P]);return Object.defineProperty(this,e,{value:r}),r}};M.visible={get(){
|
|
88
|
+
const e=N(this,this[C],!0);return Object.defineProperty(this,"visible",{value:e}),e}}
|
|
89
|
+
;const k=(e,t,r,...i)=>"rgb"===e?"ansi16m"===t?b[r].ansi16m(...i):"ansi256"===t?b[r].ansi256(b.rgbToAnsi256(...i)):b[r].ansi(b.rgbToAnsi(...i)):"hex"===e?k("rgb",t,r,...b.hexToRgb(...i)):b[r][e](...i),L=["rgb","hex","ansi256"]
|
|
90
|
+
;for(const e of L){M[e]={get(){const{level:t}=this;return function(...r){
|
|
91
|
+
const i=W(k(e,B[t],"color",...r),b.color.close,this[C]);return N(this,i,this[P])}}}
|
|
92
|
+
;M["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){
|
|
93
|
+
const i=W(k(e,B[t],"bgColor",...r),b.bgColor.close,this[C]);return N(this,i,this[P])}}}}
|
|
94
|
+
const G=Object.defineProperties(()=>{},{...M,level:{enumerable:!0,get(){return this[I].level},set(e){this[I].level=e}}
|
|
95
|
+
}),W=(e,t,r)=>{let i,s;return void 0===r?(i=e,s=t):(i=r.openAll+e,s=t+r.closeAll),{open:e,close:t,openAll:i,closeAll:s,
|
|
96
|
+
parent:r}},N=(e,t,r)=>{const i=(...e)=>$(i,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(i,G),i[I]=e,
|
|
97
|
+
i[C]=t,i[P]=r,i},$=(e,t)=>{if(e.level<=0||!t)return e[P]?"":t;let r=e[C];if(void 0===r)return t
|
|
98
|
+
;const{openAll:i,closeAll:s}=r;if(t.includes(""))for(;void 0!==r;)t=S(t,r.close,r.open),r=r.parent
|
|
99
|
+
;const n=t.indexOf("\n");return-1!==n&&(t=function(e,t,r,i){let s=0,n="";do{const o="\r"===e[i-1]
|
|
100
|
+
;n+=e.slice(s,o?i-1:i)+t+(o?"\r\n":"\n")+r,s=i+1,i=e.indexOf("\n",s)}while(-1!==i);return n+=e.slice(s),n}(t,s,i,n)),
|
|
101
|
+
i+t+s};Object.defineProperties(j.prototype,M);const F=j(),Y=(j({level:R?R.level:0}),F),D=(e,t,r,i)=>{
|
|
102
|
+
if("length"===r||"prototype"===r)return;if("arguments"===r||"caller"===r)return
|
|
103
|
+
;const s=Object.getOwnPropertyDescriptor(e,r),n=Object.getOwnPropertyDescriptor(t,r)
|
|
104
|
+
;!H(s,n)&&i||Object.defineProperty(e,r,n)},H=function(e,t){
|
|
105
|
+
return void 0===e||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)
|
|
106
|
+
},U=(e,t)=>`/* Wrapped ${e}*/\n${t}`,V=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),q=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name")
|
|
107
|
+
;function z(e,t,{ignoreNonConfigurable:r=!1}={}){const{name:i}=e;for(const i of Reflect.ownKeys(t))D(e,t,i,r)
|
|
108
|
+
;return((e,t)=>{const r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)})(e,t),
|
|
109
|
+
((e,t,r)=>{const i=""===r?"":`with ${r.trim()}() `,s=U.bind(null,i,t.toString());Object.defineProperty(s,"name",q)
|
|
110
|
+
;const{writable:n,enumerable:o,configurable:a}=V;Object.defineProperty(e,"toString",{value:s,writable:n,enumerable:o,
|
|
111
|
+
configurable:a})})(e,t,i),e}const J=new WeakMap,K=(e,t={})=>{
|
|
112
|
+
if("function"!=typeof e)throw new TypeError("Expected a function");let r,i=0
|
|
113
|
+
;const s=e.displayName||e.name||"<anonymous>",n=function(...o){if(J.set(n,++i),1===i)r=e.apply(this,o),
|
|
114
|
+
e=void 0;else if(!0===t.throw)throw new Error(`Function \`${s}\` can only be called once`);return r};return z(n,e),
|
|
115
|
+
J.set(n,i),n};K.callCount=e=>{
|
|
116
|
+
if(!J.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`)
|
|
117
|
+
;return J.get(e)};const Q=K,X=[]
|
|
118
|
+
;X.push("SIGHUP","SIGINT","SIGTERM"),"win32"!==process.platform&&X.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT"),
|
|
119
|
+
"linux"===process.platform&&X.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")
|
|
120
|
+
;const Z=e=>!!e&&"object"==typeof e&&"function"==typeof e.removeListener&&"function"==typeof e.emit&&"function"==typeof e.reallyExit&&"function"==typeof e.listeners&&"function"==typeof e.kill&&"number"==typeof e.pid&&"function"==typeof e.on,ee=Symbol.for("signal-exit emitter"),te=globalThis,re=Object.defineProperty.bind(Object)
|
|
121
|
+
;class ie{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){
|
|
122
|
+
if(te[ee])return te[ee];re(te,ee,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){
|
|
123
|
+
this.listeners[e].push(t)}removeListener(e,t){const r=this.listeners[e],i=r.indexOf(t)
|
|
124
|
+
;-1!==i&&(0===i&&1===r.length?r.length=0:r.splice(i,1))}emit(e,t,r){if(this.emitted[e])return!1;this.emitted[e]=!0
|
|
125
|
+
;let i=!1;for(const s of this.listeners[e])i=!0===s(t,r)||i;return"exit"===e&&(i=this.emit("afterExit",t,r)||i),i}}
|
|
126
|
+
class se{}const ne=globalThis.process,{onExit:oe,load:ae,unload:le}=(ce=Z(ne)?new class extends se{
|
|
127
|
+
#e="win32"===ne.platform?"SIGINT":"SIGHUP";#t=new ie;#r;#i;#s;#n={};#o=!1;constructor(e){super(),this.#r=e,this.#n={}
|
|
128
|
+
;for(const t of X)this.#n[t]=()=>{const r=this.#r.listeners(t);let{count:i}=this.#t;const s=e
|
|
129
|
+
;if("object"==typeof s.__signal_exit_emitter__&&"number"==typeof s.__signal_exit_emitter__.count&&(i+=s.__signal_exit_emitter__.count),
|
|
130
|
+
r.length===i){this.unload();const r=this.#t.emit("exit",null,t),i="SIGHUP"===t?this.#e:t;r||e.kill(e.pid,i)}}
|
|
131
|
+
;this.#s=e.reallyExit,this.#i=e.emit}onExit(e,t){if(!Z(this.#r))return()=>{};!1===this.#o&&this.load()
|
|
132
|
+
;const r=t?.alwaysLast?"afterExit":"exit";return this.#t.on(r,e),()=>{this.#t.removeListener(r,e),
|
|
133
|
+
0===this.#t.listeners.exit.length&&0===this.#t.listeners.afterExit.length&&this.unload()}}load(){if(!this.#o){
|
|
134
|
+
this.#o=!0,this.#t.count+=1;for(const e of X)try{const t=this.#n[e];t&&this.#r.on(e,t)}catch(e){}
|
|
135
|
+
this.#r.emit=(e,...t)=>this.#a(e,...t),this.#r.reallyExit=e=>this.#l(e)}}unload(){this.#o&&(this.#o=!1,X.forEach(e=>{
|
|
136
|
+
const t=this.#n[e];if(!t)throw new Error("Listener not defined for signal: "+e);try{this.#r.removeListener(e,t)
|
|
137
|
+
}catch(e){}}),this.#r.emit=this.#i,this.#r.reallyExit=this.#s,this.#t.count-=1)}#l(e){
|
|
138
|
+
return Z(this.#r)?(this.#r.exitCode=e||0,this.#t.emit("exit",this.#r.exitCode,null),
|
|
139
|
+
this.#s.call(this.#r,this.#r.exitCode)):0}#a(e,...t){const r=this.#i;if("exit"===e&&Z(this.#r)){
|
|
140
|
+
"number"==typeof t[0]&&(this.#r.exitCode=t[0]);const i=r.call(this.#r,e,...t)
|
|
141
|
+
;return this.#t.emit("exit",this.#r.exitCode,null),i}return r.call(this.#r,e,...t)}}(ne):new class extends se{onExit(){
|
|
142
|
+
return()=>{}}load(){}unload(){}},{onExit:(e,t)=>ce.onExit(e,t),load:()=>ce.load(),unload:()=>ce.unload()});var ce
|
|
143
|
+
;const he=n.stderr.isTTY?n.stderr:n.stdout.isTTY?n.stdout:void 0,ue=he?Q(()=>{oe(()=>{he.write("[?25h")},{alwaysLast:!0
|
|
144
|
+
})}):()=>{};let fe=!1;const me={show:(e=n.stderr)=>{e.isTTY&&(fe=!1,e.write("[?25h"))},hide:(e=n.stderr)=>{
|
|
145
|
+
e.isTTY&&(ue(),fe=!0,e.write("[?25l"))},toggle:(e,t)=>{void 0!==e&&(fe=e),fe?me.show(t):me.hide(t)}
|
|
146
|
+
},de=me,pe=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":["~~~~~~~~~~~~~~~~~~~~","> ~~~~~~~~~~~~~~~~~~","º> ~~~~~~~~~~~~~~~~~","(º> ~~~~~~~~~~~~~~~~","((º> ~~~~~~~~~~~~~~~","<((º> ~~~~~~~~~~~~~~","><((º> ~~~~~~~~~~~~~"," ><((º> ~~~~~~~~~~~~","~ ><((º> ~~~~~~~~~~~","~~ <>((º> ~~~~~~~~~~","~~~ ><((º> ~~~~~~~~~","~~~~ <>((º> ~~~~~~~~","~~~~~ ><((º> ~~~~~~~","~~~~~~ <>((º> ~~~~~~","~~~~~~~ ><((º> ~~~~~","~~~~~~~~ <>((º> ~~~~","~~~~~~~~~ ><((º> ~~~","~~~~~~~~~~ <>((º> ~~","~~~~~~~~~~~ ><((º> ~","~~~~~~~~~~~~ <>((º> ","~~~~~~~~~~~~~ ><((º>","~~~~~~~~~~~~~~ <>((º","~~~~~~~~~~~~~~~ ><((","~~~~~~~~~~~~~~~~ <>(","~~~~~~~~~~~~~~~~~ ><","~~~~~~~~~~~~~~~~~~ <","~~~~~~~~~~~~~~~~~~~~"]}}')
|
|
147
|
+
;const _e=pe;Object.keys(pe);const ge=a?.WriteStream?.prototype?.hasColors?.()??!1,be=(e,t)=>{if(!ge)return e=>e
|
|
148
|
+
;const r=`[${e}m`,i=`[${t}m`;return e=>{const s=e+"";let n=s.indexOf(i);if(-1===n)return r+s+i;let o=r,a=0
|
|
149
|
+
;const l=(22===t?i:"")+r;for(;-1!==n;)o+=s.slice(a,n)+l,a=n+i.length,n=s.indexOf(i,a);return o+=s.slice(a)+i,o}
|
|
150
|
+
},ve=(be(0,0),be(1,22),be(2,22),be(3,23),be(4,24),be(53,55),be(7,27),be(8,28),be(9,29),be(30,39),
|
|
151
|
+
be(31,39)),xe=be(32,39),Te=be(33,39),ye=be(34,39);be(35,39),be(36,39),be(37,39),be(90,39),be(40,49),be(41,49),be(42,49),
|
|
152
|
+
be(43,49),be(44,49),be(45,49),be(46,49),be(47,49),be(100,49),be(91,39),be(92,39),be(93,39),be(94,39),be(95,39),
|
|
153
|
+
be(96,39),be(97,39),be(101,49),be(102,49),be(103,49),be(104,49),be(105,49),be(106,49),be(107,49);function we(){
|
|
154
|
+
const{env:e}=n,{TERM:t,TERM_PROGRAM:r}=e
|
|
155
|
+
;return"win32"!==n.platform?"linux"!==t:Boolean(e.WT_SESSION)||Boolean(e.TERMINUS_SUBLIME)||"{cmd::Cmder}"===e.ConEmuTask||"Terminus-Sublime"===r||"vscode"===r||"xterm-256color"===t||"alacritty"===t||"rxvt-unicode"===t||"rxvt-unicode-256color"===t||"JetBrains-JediTerm"===e.TERMINAL_EMULATOR
|
|
156
|
+
}const Ee=we(),Se=ye(Ee?"ℹ":"i"),Oe=xe(Ee?"✔":"√"),Re=Te(Ee?"⚠":"‼"),Ie=ve(Ee?"✖":"×")
|
|
157
|
+
;const Ce=function({onlyFirst:e=!1}={}){
|
|
158
|
+
return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",e?void 0:"g")
|
|
159
|
+
}()
|
|
160
|
+
;const Pe=[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],Be=[12288,12288,65281,65376,65504,65510],Me=[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],Ae=(e,t)=>{
|
|
161
|
+
let r=0,i=Math.floor(e.length/2)-1;for(;r<=i;){const s=Math.floor((r+i)/2),n=2*s;if(t<e[n])i=s-1;else{
|
|
162
|
+
if(!(t>e[n+1]))return!0;r=s+1}}return!1};const[je,ke]=Le(Me);function Le(e){let t=e[0],r=e[1]
|
|
163
|
+
;for(let i=0;i<e.length;i+=2){const s=e[i],n=e[i+1];if(19968>=s&&19968<=n)return[s,n];n-s>r-t&&(t=s,r=n)}return[t,r]}
|
|
164
|
+
const Ge=e=>!(e<161||e>1114109)&&Ae(Pe,e),We=e=>!(e<12288||e>65510)&&Ae(Be,e),Ne=e=>e>=je&&e<=ke||!(e<4352||e>262141)&&Ae(Me,e)
|
|
165
|
+
;function $e(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}
|
|
166
|
+
function Fe(e,{ambiguousAsWide:t=!1}={}){return $e(e),We(e)||Ne(e)||t&&Ge(e)?2:1}
|
|
167
|
+
const Ye=new Intl.Segmenter,De=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Mark}|\p{Surrogate})+$/v,He=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,Ue=/^\p{RGI_Emoji}$/v,Ve=/^[\d#*]\u20E3$/,qe=/\p{Extended_Pictographic}/gu
|
|
168
|
+
;function ze(e){if(e.length>50)return!1;if(Ve.test(e))return!0;if(e.includes("")){const t=e.match(qe)
|
|
169
|
+
;return null!==t&&t.length>=2}return!1}function Je(e){return e.replace(He,"")}function Ke(e){return De.test(e)}
|
|
170
|
+
function Qe(e){return e>=4352&&e<=4447||e>=43360&&e<=43388}function Xe(e){return e>=4448&&e<=4519||e>=55216&&e<=55238}
|
|
171
|
+
function Ze(e){return e>=4520&&e<=4607||e>=55243&&e<=55291}function et(e){return Qe(e)||Xe(e)||Ze(e)}function tt(e,t){
|
|
172
|
+
const r=[];for(const t of e)De.test(t)||r.push(t.codePointAt(0));if(0===r.length)return;let i=0
|
|
173
|
+
;for(let e=0;e<r.length;e++){const s=r[e];if(!et(s)){if(0===i)return;for(let s=e;s<r.length;s++)i+=Fe(r[s],t);return i}
|
|
174
|
+
Qe(s)&&Xe(r[e+1])?(i+=2,e+=Ze(r[e+2])?2:1):i+=Fe(s,t)}return i}function rt(e,t){let r=0,i=!0
|
|
175
|
+
;for(const s of e)i?i=!1:s>=""&&s<=""&&(r+=Fe(s.codePointAt(0),t));return r}function it(e,t={}){
|
|
176
|
+
if("string"!=typeof e||0===e.length)return 0;const{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:i=!1}=t;let s=e
|
|
177
|
+
;if(i||!s.includes("")&&!s.includes("")||(s=function(e){
|
|
178
|
+
if("string"!=typeof e)throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``)
|
|
179
|
+
;return e.includes("")||e.includes("")?e.replace(Ce,""):e}(s)),0===s.length)return 0
|
|
180
|
+
;if(/^[\u0020-\u007E]*$/.test(s))return s.length;let n=0;const o={ambiguousAsWide:!r}
|
|
181
|
+
;for(const{segment:e}of Ye.segment(s)){if(Ke(e))continue;if(Ue.test(e)||ze(e)){n+=2;continue}const t=Je(e),r=tt(t,o)
|
|
182
|
+
;if(void 0!==r){n+=r;continue}n+=Fe(t.codePointAt(0),o),n+=rt(t,o)}return n}const st=new class{#c=0;#h;#u=!1;#f=!1
|
|
183
|
+
;#m=e=>{if(!e?.length)return;3===("string"==typeof e?e.codePointAt(0):e[0])&&n.kill(n.pid,"SIGINT")};start(){this.#c++,
|
|
184
|
+
1===this.#c&&this.#d()}stop(){0!==this.#c&&0===--this.#c&&this.#p()}#d(){const{stdin:e}=n
|
|
185
|
+
;"win32"!==n.platform&&e?.isTTY&&"function"==typeof e.setRawMode?(this.#h=e,this.#u=e.isPaused(),
|
|
186
|
+
this.#f=Boolean(e.isRaw),e.setRawMode(!0),e.prependListener("data",this.#m),this.#u&&e.resume()):this.#h=void 0}#p(){
|
|
187
|
+
if(!this.#h)return;const e=this.#h;e.off("data",this.#m),e.isTTY&&e.setRawMode?.(this.#f),this.#u&&e.pause(),
|
|
188
|
+
this.#h=void 0,this.#u=!1,this.#f=!1}
|
|
189
|
+
},nt=Object.freeze(st),ot=new Map,at=new Set(["black","red","green","yellow","blue","magenta","cyan","white","gray"])
|
|
190
|
+
;class lt{#_=0;#g=-1;#b=0;#v;#x;#T;#y;#w=new Map;#E=!1;#S;#O;#R=!1;#I;#C(e){this.#E=!0;try{return e()}finally{this.#E=!1
|
|
191
|
+
}}#P(){this.isSpinning&&this.render()}#B(e,t){if(null==e)return"";if("string"==typeof e)return e
|
|
192
|
+
;if(Buffer.isBuffer(e)||ArrayBuffer.isView(e)){const r="string"==typeof t&&t&&"buffer"!==t?t:"utf8"
|
|
193
|
+
;return Buffer.from(e).toString(r)}return String(e)}#M(e){if(!e)return!1;const t=e.at(-1);return"\n"===t||"\r"===t}#A(){
|
|
194
|
+
this.#O||(this.#O=setTimeout(()=>{this.#O=void 0,this.isSpinning&&this.#P()},200),
|
|
195
|
+
"function"==typeof this.#O?.unref&&this.#O.unref())}#j(){this.#O&&(clearTimeout(this.#O),this.#O=void 0)}#k(e,t,r,i){
|
|
196
|
+
return this.#L(r," ")+e+("string"==typeof t?(e?" ":"")+t:"")+this.#G(i," ")}constructor(e){if("string"==typeof e&&(e={
|
|
197
|
+
text:e}),this.#v={color:"cyan",stream:n.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#v.color,
|
|
198
|
+
this.#T=this.#v.stream,"boolean"!=typeof this.#v.isEnabled&&(this.#v.isEnabled=function({stream:e=process.stdout}={}){
|
|
199
|
+
return Boolean(e&&e.isTTY&&"dumb"!==process.env.TERM&&!("CI"in process.env))}({stream:this.#T})),
|
|
200
|
+
"boolean"!=typeof this.#v.isSilent&&(this.#v.isSilent=!1),
|
|
201
|
+
void 0!==this.#v.interval&&!(Number.isInteger(this.#v.interval)&&this.#v.interval>0))throw new Error("The `interval` option must be a positive integer")
|
|
202
|
+
;const t=this.#v.interval;this.spinner=this.#v.spinner,this.#v.interval=t,this.text=this.#v.text,
|
|
203
|
+
this.prefixText=this.#v.prefixText,this.suffixText=this.#v.suffixText,this.indent=this.#v.indent}get indent(){
|
|
204
|
+
return this.#v.indent}set indent(e=0){
|
|
205
|
+
if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#v.indent=e
|
|
206
|
+
}get interval(){return this.#v.interval??this.#x.interval??100}get spinner(){return this.#x}set spinner(e){
|
|
207
|
+
if(this.#g=-1,this.#v.interval=void 0,"object"==typeof e){
|
|
208
|
+
if(!Array.isArray(e.frames)||0===e.frames.length||e.frames.some(e=>"string"!=typeof e))throw new Error("The given spinner must have a non-empty `frames` array of strings")
|
|
209
|
+
;if(void 0!==e.interval&&!(Number.isInteger(e.interval)&&e.interval>0))throw new Error("`spinner.interval` must be a positive integer if provided")
|
|
210
|
+
;this.#x=e}else if(we())if(void 0===e)this.#x=_e.dots;else{
|
|
211
|
+
if("default"===e||!_e[e])throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)
|
|
212
|
+
;this.#x=_e[e]}else this.#x=_e.line}get text(){return this.#v.text}set text(e=""){this.#v.text=e}get prefixText(){
|
|
213
|
+
return this.#v.prefixText}set prefixText(e=""){this.#v.prefixText=e}get suffixText(){return this.#v.suffixText}
|
|
214
|
+
set suffixText(e=""){this.#v.suffixText=e}get isSpinning(){return void 0!==this.#y}#W(e,t,r=!1){
|
|
215
|
+
const i="function"==typeof e?e():e;return"string"==typeof i&&""!==i?r?t+i:i+t:""}#L(e=this.#v.prefixText,t=" "){
|
|
216
|
+
return this.#W(e,t,!1)}#G(e=this.#v.suffixText,t=" "){return this.#W(e,t,!0)}#N(e,r){let i=0
|
|
217
|
+
;for(const s of t(e).split("\n"))i+=Math.max(1,Math.ceil(it(s)/r));return i}get color(){return this.#I}set color(e){
|
|
218
|
+
if(void 0!==e&&!1!==e&&!at.has(e))throw new Error("The `color` option must be a valid color or `false` to disable")
|
|
219
|
+
;this.#I=e}get isEnabled(){return this.#v.isEnabled&&!this.#v.isSilent}set isEnabled(e){
|
|
220
|
+
if("boolean"!=typeof e)throw new TypeError("The `isEnabled` option must be a boolean");this.#v.isEnabled=e}
|
|
221
|
+
get isSilent(){return this.#v.isSilent}set isSilent(e){
|
|
222
|
+
if("boolean"!=typeof e)throw new TypeError("The `isSilent` option must be a boolean");this.#v.isSilent=e}frame(){
|
|
223
|
+
const e=Date.now();(-1===this.#g||e-this.#b>=this.interval)&&(this.#g=(this.#g+1)%this.#x.frames.length,this.#b=e)
|
|
224
|
+
;const{frames:t}=this.#x;let r=t[this.#g];this.#I&&(r=Y[this.#I](r))
|
|
225
|
+
;return this.#L(this.#v.prefixText," ")+r+("string"==typeof this.text?" "+this.text:"")+this.#G(this.#v.suffixText," ")}
|
|
226
|
+
clear(){return this.isEnabled&&this.#T.isTTY?(this.#C(()=>{this.#T.cursorTo(0)
|
|
227
|
+
;for(let e=0;e<this.#_;e++)e>0&&this.#T.moveCursor(0,-1),this.#T.clearLine(1)
|
|
228
|
+
;this.#v.indent&&this.#T.cursorTo(this.#v.indent)}),this.#_=0,this):this}#$(e){
|
|
229
|
+
if(!e||this.#w.has(e)||!e.isTTY||"function"!=typeof e.write)return
|
|
230
|
+
;ot.has(e)&&console.warn("[ora] Multiple concurrent spinners detected. This may cause visual corruption. Use one spinner at a time.")
|
|
231
|
+
;const t=e.write;this.#w.set(e,t),ot.set(e,this),e.write=(r,i,s)=>this.#F(e,t,r,i,s)}#Y(){
|
|
232
|
+
if(!this.isEnabled||this.#w.size>0)return;const e=new Set([this.#T,n.stdout,n.stderr]);for(const t of e)this.#$(t)}#D(){
|
|
233
|
+
for(const[e,t]of this.#w)e.write=t,ot.get(e)===this&&ot.delete(e);this.#w.clear()}#F(e,t,r,i,s){
|
|
234
|
+
if("function"==typeof i&&(s=i,i=void 0),this.#E)return t.call(e,r,i,s);this.clear()
|
|
235
|
+
;const n=this.#B(r,i),o=this.#M(n),a=t.call(e,r,i,s);return o?this.#j():n.length>0&&this.#A(),
|
|
236
|
+
this.isSpinning&&!this.#O&&this.render(),a}render(){if(!this.isEnabled||this.#S||this.#O)return this
|
|
237
|
+
;const e=this.#T.isTTY;let t=!1;try{e&&(this.#C(()=>this.#T.write("[?2026h")),t=!0),this.clear();let r=this.frame()
|
|
238
|
+
;const i=this.#T.columns??80,s=this.#N(r,i),n=this.#T.rows;if(n&&n>1&&s>n){const e=r.split("\n"),t=n-1
|
|
239
|
+
;r=[...e.slice(0,t),"... (content truncated to fit terminal)"].join("\n")}
|
|
240
|
+
!1===this.#C(()=>this.#T.write(r))&&this.#T.isTTY&&(this.#S=()=>{this.#S=void 0,this.#P()},
|
|
241
|
+
this.#T.once("drain",this.#S)),this.#_=this.#N(r,i)}finally{t&&this.#C(()=>this.#T.write("[?2026l"))}return this}
|
|
242
|
+
start(e){if(void 0!==e&&(this.text=e),this.isSilent)return this;if(!this.isEnabled){
|
|
243
|
+
const e=this.text?"-":"",t=" ".repeat(this.#v.indent)+this.#k(e,this.text,this.#v.prefixText,this.#v.suffixText)
|
|
244
|
+
;return""!==t.trim()&&this.#C(()=>this.#T.write(t+"\n")),this}
|
|
245
|
+
return this.isSpinning||(this.#v.hideCursor&&de.hide(this.#T),this.#v.discardStdin&&n.stdin.isTTY&&(nt.start(),
|
|
246
|
+
this.#R=!0),this.#Y(),this.render(),this.#y=setInterval(this.render.bind(this),this.interval)),this}stop(){
|
|
247
|
+
return clearInterval(this.#y),this.#y=void 0,this.#g=-1,this.#b=0,this.#j(),this.#D(),
|
|
248
|
+
this.#S&&(this.#T.removeListener("drain",this.#S),this.#S=void 0),this.isEnabled&&(this.clear(),
|
|
249
|
+
this.#v.hideCursor&&de.show(this.#T)),this.#R&&(this.#R=!1,nt.stop()),this}succeed(e){return this.stopAndPersist({
|
|
250
|
+
symbol:Oe,text:e})}fail(e){return this.stopAndPersist({symbol:Ie,text:e})}warn(e){return this.stopAndPersist({symbol:Re,
|
|
251
|
+
text:e})}info(e){return this.stopAndPersist({symbol:Se,text:e})}stopAndPersist(e={}){if(this.isSilent)return this
|
|
252
|
+
;const t=e.symbol??" ",r=e.text??this.text,i=e.prefixText??this.#v.prefixText,s=e.suffixText??this.#v.suffixText,n=this.#k(t,r,i,s)+"\n"
|
|
253
|
+
;return this.stop(),this.#C(()=>this.#T.write(n)),this}}function ct(e){return new lt(e)}var ht=u(991),ut=u.n(ht)
|
|
254
|
+
;function ft(e,t,i){return new Promise((s,n)=>{const o=r(process.execPath,[e,...t],{stdio:"inherit",cwd:i})
|
|
255
|
+
;o.on("close",e=>s(e??1)),o.on("error",n)})}(async()=>{const{rE:t}=f;console.clear(),
|
|
256
|
+
console.log(`${ut().bold(ut().cyan("▲ Mahameru"))} ${ut().dim(`CLI v${t}`)}\n`);const r={port:{type:"string",short:"p"},
|
|
257
|
+
host:{type:"string",short:"h"}};try{const{values:t,positionals:n}=e({options:r,allowPositionals:!0
|
|
258
|
+
}),o=n[0],a=process.cwd();switch(o){case"dev":{const e="mahameru.config.ts",r=i(a,e)
|
|
259
|
+
;s(r)||(console.error(ut().red(`❌ Error: Config file '${e}' is not found.`)),
|
|
260
|
+
console.error(ut().yellow("Please create project by running: npm create mahameru")),process.exit(1))
|
|
261
|
+
;const n=i(a,"node_modules","tsx","dist","cli.mjs")
|
|
262
|
+
;s(n)||(console.error(ut().red("❌ Error: Runner 'tsx' is not installed.")),
|
|
263
|
+
console.error(ut().yellow("Please install it by running: npm install -D tsx")),process.exit(1))
|
|
264
|
+
;const o=await import("tsx/esm/api"),c=l(r).href
|
|
265
|
+
;let h=(await o.tsImport(c,"file:///F:/Projects/@mahameru/cli/src/index.ts")).default;h={...h,dev:void 0!==h.dev&&h.dev,
|
|
266
|
+
port:void 0!==t.port?parseInt(t.port):void 0!==h.port?h.port:3e3,
|
|
267
|
+
host:void 0!==t.host?t.host:void 0!==h.host?h.host:"localhost",trailingSlash:void 0===h.trailingSlash||h.trailingSlash,
|
|
268
|
+
allowedOrigins:void 0!==h.allowedOrigins?h.allowedOrigins:[],
|
|
269
|
+
disableHttpSignatureResponse:void 0!==h.disableHttpSignatureResponse&&h.disableHttpSignatureResponse}
|
|
270
|
+
;const u=`\n import mahameru from "mahameru";\n\n mahameru(${JSON.stringify(h)}).then(app => \n app.initialize().then(() => {\n console.log("\\x1b[32m Mahameru Server Ready! 🚀\\x1b[0m");\n console.log(" \\x1b[1mMode:\\x1b[22m \\x1b[36m${h.dev?"Development":"Production"}\\x1b[0m");\n console.log(" \\x1b[1mLokal:\\x1b[22m \\x1b[36mhttp://${h.host}:${h.port}\\x1b[0m");\n console.log(" \\x1b[1mHost:\\x1b[22m ${h.host}");\n console.log(" \\x1b[1mPort:\\x1b[22m ${h.port}\\n");\n console.log("\\x1b[90mPress Ctrl+C to stop server\\x1b[0m\\n");\n }).catch(console.error)\n ).catch(console.error)\n `
|
|
271
|
+
;await ft(n,["-e",u],a);break}case"build":{
|
|
272
|
+
const e=ct(ut().cyan("Building your project...")).start(),t=i(a,"node_modules","typescript","bin","tsc"),r=i(a,"node_modules","tsc-alias","dist","index.js")
|
|
273
|
+
;s(t)||(e.fail(ut().red("Build failed!")),
|
|
274
|
+
console.error(ut().red("\n❌ Error: TypeScript compiler (tsc) is not installed.\n")),process.exit(1));try{
|
|
275
|
+
const i=await ft(t,["--project","tsconfig.json"],a);0!==i&&(console.error(ut().red("\n❌ Build failed!\n")),
|
|
276
|
+
process.exit(i)),s(r)||(console.error(ut().red("\n❌ tsc-alias not installed.\n")),process.exit(1))
|
|
277
|
+
;const n=await ft(r,["-p","tsconfig.json"],a);0!==n&&(console.error(ut().red("\n❌ tsc-alias failed.\n")),
|
|
278
|
+
process.exit(n)),e.succeed(ut().green("Build success."))}catch(t){e.fail(ut().red("Terjadi kesalahan internal.")),
|
|
279
|
+
console.error(t),process.exit(1)}break}case"start":console.log(ut().green("Not implemented yet."));break;default:
|
|
280
|
+
console.error(ut().red('❌ To get started, run "npm run dev" or "npm start".')),process.exit(1)}}catch(e){
|
|
281
|
+
console.error(e),process.exit(1)}})();
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mahameru/cli",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"bin": {
|
|
6
|
+
"mahameru": "./dist/index.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"typecheck": "tsc --noEmit --project tsconfig.json",
|
|
10
|
+
"clean": "rimraf dist",
|
|
11
|
+
"build": "npm run clean && webpack"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"mahameruJS",
|
|
15
|
+
"mahameru",
|
|
16
|
+
"cli",
|
|
17
|
+
"framework",
|
|
18
|
+
"nodejs",
|
|
19
|
+
"typescript",
|
|
20
|
+
"web-server",
|
|
21
|
+
"build-tool",
|
|
22
|
+
"developer-tools"
|
|
23
|
+
],
|
|
24
|
+
"author": "Bintan <hello@bintvn.co>",
|
|
25
|
+
"license": "ISC",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^26.0.0",
|
|
32
|
+
"@types/webpack-node-externals": "^3.0.4",
|
|
33
|
+
"boxen": "^8.0.1",
|
|
34
|
+
"ora": "^9.4.1",
|
|
35
|
+
"picocolors": "^1.1.1",
|
|
36
|
+
"rimraf": "^6.1.3",
|
|
37
|
+
"strip-ansi": "^7.2.0",
|
|
38
|
+
"ts-loader": "^9.6.1",
|
|
39
|
+
"tsc-alias": "^1.8.17",
|
|
40
|
+
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
|
41
|
+
"tsx": "^4.22.4",
|
|
42
|
+
"typescript": "^6.0.3",
|
|
43
|
+
"webpack": "^5.107.2",
|
|
44
|
+
"webpack-cli": "^7.0.3",
|
|
45
|
+
"webpack-node-externals": "^3.0.0"
|
|
46
|
+
}
|
|
47
|
+
}
|