@visulima/cerebro 3.0.0-alpha.30 → 3.0.0-alpha.31
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/CHANGELOG.md +13 -0
- package/dist/commands/completion-command.js +5 -5
- package/dist/commands/help-command.js +1 -1
- package/dist/commands/readme-command.js +17 -17
- package/dist/commands/version-command.js +1 -1
- package/dist/index.js +1 -1
- package/dist/logger/create-pail-logger.js +1 -1
- package/dist/packem_chunks/has-new-version.js +1 -1
- package/dist/packem_shared/Cerebro-ChUYLbTK.js +4 -0
- package/dist/packem_shared/VisulimaError-CVxSPzeQ.js +76 -0
- package/dist/packem_shared/cerebro-error-etNTKvnJ.js +1 -0
- package/dist/packem_shared/constants-CImsldtV-Ces7vzH9.js +1 -0
- package/dist/packem_shared/index-B5zrpT20.js +6 -0
- package/dist/packem_shared/isVisulimaError-jVZgumOU-C67qeq6-.js +1 -0
- package/dist/packem_shared/lazyNamed-DMUm8mZe.js +1 -0
- package/dist/packem_shared/renderError-DJiY-69l-s_7rEsoy.js +25 -0
- package/dist/packem_shared/runtime-process-hJz7FqPN.js +1 -0
- package/dist/plugins/error-handler-plugin.js +1 -1
- package/dist/plugins/runtime-version-check-plugin.js +1 -1
- package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -1
- package/dist/util/general/compile-cache.js +1 -1
- package/dist/util/general/heap-tuning.js +1 -1
- package/package.json +3 -3
- package/dist/packem_shared/Cerebro-BN_nIZ8z.js +0 -4
- package/dist/packem_shared/VisulimaError-WfDZ45Qv.js +0 -76
- package/dist/packem_shared/cerebro-error-BnJTixb2.js +0 -1
- package/dist/packem_shared/constants-DmzZF6_u-BmMwILI_.js +0 -1
- package/dist/packem_shared/index-CkkDAMKi.js +0 -6
- package/dist/packem_shared/isVisulimaError-jVZgumOU-C4fgdbWg.js +0 -1
- package/dist/packem_shared/lazyNamed-DOmefeJM.js +0 -1
- package/dist/packem_shared/renderError-DxgI44AK-DFDWFoCr.js +0 -24
- package/dist/packem_shared/runtime-process-DKHFvYkv.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## @visulima/cerebro [3.0.0-alpha.31](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.30...@visulima/cerebro@3.0.0-alpha.31) (2026-06-04)
|
|
2
|
+
|
|
3
|
+
### Performance Improvements
|
|
4
|
+
|
|
5
|
+
* **cerebro:** disable esbuild keepNames in prod build ([18e4db0](https://github.com/visulima/visulima/commit/18e4db065acd5d83f65e1f56e3923ebda7bb86b6))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Dependencies
|
|
9
|
+
|
|
10
|
+
* **@visulima/boxen:** upgraded to 3.0.0-alpha.13
|
|
11
|
+
* **@visulima/pail:** upgraded to 4.0.0-alpha.21
|
|
12
|
+
* **@visulima/string:** upgraded to 3.0.0-alpha.16
|
|
13
|
+
|
|
1
14
|
## @visulima/cerebro [3.0.0-alpha.30](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.29...@visulima/cerebro@3.0.0-alpha.30) (2026-06-04)
|
|
2
15
|
|
|
3
16
|
### Bug Fixes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
`))}}
|
|
3
|
-
`);e.info(
|
|
4
|
-
`)),
|
|
5
|
-
`))}}},
|
|
1
|
+
import f from"@bomb.sh/tab";import{t as b}from"../packem_shared/cerebro-error-etNTKvnJ.js";class h extends b{troubleshooting;constructor(o,t,i=[]){super(o,t,{troubleshooting:i}),this.name="CompletionError",this.troubleshooting=i,i.length>0&&(this.hint=i.join(`
|
|
2
|
+
`))}}const c=["bash","zsh","fish","powershell"],a=["node","bun","deno"],g=e=>"Deno"in e,S=e=>"Bun"in e,d=()=>g(globalThis)?"deno":S(globalThis)?"bun":"node",p=e=>{const o=e?.starshipShell??e?.shell;if(o){const s=o.toLowerCase();if(s.includes("zsh"))return"zsh";if(s.includes("bash"))return"bash";if(s.includes("fish"))return"fish"}const t=e?.psModulePath,i=e?.prompt;if(t||i?.includes("PS"))return"powershell";if(e?.comSpec?.toLowerCase().includes("cmd.exe"))return"bash"},m=f,w=(e,o)=>{for(const t of o)t.hidden||(t.name&&e.option(t.name,t.description??""),t.alias&&e.option(t.alias,t.description??""))},$=(e,o)=>{for(const[t,i]of o){if(i.name!==t||i.hidden)continue;const s=e.command(i.name,i.description??"");i.options&&w(s,i.options)}},y=e=>{if(!c.includes(e))throw new h(`Invalid shell type: ${e}`,"INVALID_SHELL",[`Valid shells are: ${c.join(", ")}`,"Shell will be auto-detected if not specified"])},L=e=>{if(e&&!a.includes(e))throw new h(`Invalid runtime: ${e}`,"INVALID_RUNTIME",[`Valid runtimes are: ${a.join(", ")}`,"Runtime will be auto-detected if not specified"])},C=(e,o)=>{e.error("Could not detect current shell");const t=[`Usage: ${o} completion --shell=<bash|zsh|fish|powershell> [--runtime=<node|bun|deno>]`,"","Examples:"," # Install completions for zsh:",` ${o} completion --shell=zsh > ~/.${o}-completion.zsh`,` echo 'source ~/.${o}-completion.zsh' >> ~/.zshrc`,""," # Install completions for bash with custom runtime:",` ${o} completion --shell=bash --runtime=bun > ~/.${o}-completion.bash`,` echo 'source ~/.${o}-completion.bash' >> ~/.bashrc`,""," # Install completions for fish:",` ${o} completion --shell=fish > ~/.config/fish/completions/${o}.fish`].join(`
|
|
3
|
+
`);e.info(t)},P={description:"Generate shell completion scripts",env:[{description:"Shell path (Unix-like systems). Used for shell detection.",name:"SHELL",type:String},{description:"Starship shell configuration. Takes precedence over SHELL for detection.",name:"STARSHIP_SHELL",type:String},{description:"PowerShell module path (Windows). Used for PowerShell detection.",name:"PSModulePath",type:String},{description:"Command prompt variable (Windows). Used for PowerShell detection.",name:"PROMPT",type:String},{description:"Command processor (Windows). Used for Windows Command Prompt detection.",name:"ComSpec",type:String}],execute:async({env:e,logger:o,options:t,runtime:i})=>{const s=i.getCliName(),l=t.shell??p(e);if(!l){C(o,s);return}try{y(l),L(t.runtime),$(m,i.getCommands());const n=`${t.runtime??d()} ${s}`;m.setup(s,n,l)}catch(n){if(n instanceof h){const r=[`Failed to generate completion script: ${n.message}`,`Error code: ${n.code}`];throw n.troubleshooting.length>0&&r.push("","Troubleshooting:",...n.troubleshooting.map(u=>` • ${u}`)),o.error(r.join(`
|
|
4
|
+
`)),n}else{const r=["Failed to generate completion script",`Error: ${n instanceof Error?n.message:String(n)}`,"","Troubleshooting:"," • Ensure @bomb.sh/tab is installed: pnpm add @bomb.sh/tab",` • Verify shell is supported: ${c.join(", ")}`,` • Verify runtime is supported: ${a.join(", ")}`," • Check that your CLI name is correct"];o.error(r.join(`
|
|
5
|
+
`))}}},name:"completion",options:[{defaultOption:!0,defaultValue:p(),description:"Shell type (bash, zsh, fish, powershell). Defaults to current shell if detected.",name:"shell",type:String,typeLabel:"{underline shell}"},{defaultValue:d(),description:"JavaScript runtime (node, bun, deno). Defaults to current runtime if detected.",name:"runtime",type:String,typeLabel:"{underline runtime}"}]};export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{inverse as p,cyan as u,green as h,yellow as g}from"@visulima/colorize";import{a as y,r as f}from"../packem_shared/index-B5zrpT20.js";const O=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}],b="__Other",v=s=>s.charAt(0).toUpperCase()+s.slice(1),w=(s,r,l,o)=>{s.debug("no command given, printing general help...");let m=[...new Set(l.values())].filter(n=>!n.hidden);o&&(m=m.filter(n=>n.group===o));const e=m.reduce((n,i)=>{const d=i.group??b;return n[d]??=[],n[d].push(i),n},{}),a=n=>n.map(i=>{let d="";typeof i.alias=="string"?d=i.alias:Array.isArray(i.alias)&&(d=i.alias.join(", ")),d!==""&&(d=` [${d}]`);let t=i.name;return i.commandPath&&i.commandPath.length>0&&(t=`${i.commandPath.join(" ")} ${i.name}`),[`${h(t)}${d}`,i.description??""]});(s.raw??s.log)(f([{content:`${u(r.getCliName())} ${h("<command>")} [positional arguments] ${g("[options]")}`,header:p.cyan(" Usage ")},...Object.keys(e).map(n=>{const i=o?` ${v(o)}`:"";return{content:a(e[n]),header:n===b||o?p.green(` Available${i} Commands `):` ${p.green(` ${v(n)} `)}`}}),l.has("help")?{header:p.yellow(" Command Options "),optionList:l.get("help").options?.filter(n=>!n.hidden)}:void 0,{header:p.yellow(" Global Options "),optionList:r.getGlobalOptions()},{content:O.filter(n=>!n.hidden).map(n=>[n.name,n.description??""]),header:p.magenta(" Environment Variables ")},{content:`Run "${u(r.getCliName())} ${h("help <command>")}" or "${u(r.getCliName())} ${h("<command>")} ${g("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},$=(s,r)=>{const l=[];for(const o of s.values()){if(o.hidden)continue;const m=o.commandPath??[];if(m.length!==r.length)continue;let e=!0;for(const[a,n]of r.entries())if(m[a]!==n){e=!1;break}e&&l.push(o)}return l},E=(s,r,l,o)=>{const m=l.join(" "),e=[{content:`${u(r.getCliName())} ${h(m)} ${h("<subcommand>")} [positional arguments] ${g("[options]")}`,header:p.cyan(" Usage ")},{content:o.map(a=>{const n=[...a.commandPath??[],a.name].join(" ");return[h(n),a.description??""]}),header:p.green(" Subcommands ")},{header:p.yellow(" Global Options "),optionList:r.getGlobalOptions()},{content:`Run "${u(r.getCliName())} ${h(`${m} <subcommand>`)} ${g("--help")}" for help with a specific subcommand.`,raw:!0}];(s.raw??s.log)(f(e))},N=(s,r,l,o,m)=>{let e=m??l.get(o);if(!e)for(const t of l.values()){const c=t.commandPath?[...t.commandPath,t.name]:[t.name];if(c.at(-1)===o||c.join(" ")===o){e=t;break}}if(!e){const t=o.split(" ").filter(Boolean),c=t.length>0?$(l,t):[];if(c.length>0){E(s,r,t,c);return}s.error(`Command "${o}" not found`);return}const a=[],n=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(a.push({content:`${u(r.getCliName())} ${h(n)}${e.argument?" [positional arguments]":""}${e.options?" [options]":""}`,header:p.cyan(" Usage ")}),e.description&&a.push({content:e.description,header:p.green(" Description ")}),e.argument&&a.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&a.push({header:p.yellow(" Command Options "),optionList:e.options.filter(t=>!t.hidden)}),a.push({header:p.yellow(" Global Options "),optionList:r.getGlobalOptions()}),Array.isArray(e.env)&&e.env.length>0){const t=e.env.filter(c=>!c.hidden);t.length>0&&a.push({content:t.map(c=>[c.name,c.description??""]),header:p.magenta(" Environment Variables ")})}if(e.alias!==void 0&&e.alias.length>0){let t=e.alias;typeof e.alias=="string"&&(t=[e.alias]),a.splice(1,0,{content:t,header:"Alias(es)"})}Array.isArray(e.examples)&&e.examples.length>0&&a.push({content:e.examples,header:"Examples"});const i=[...e.commandPath??[],e.name],d=$(l,i);d.length>0&&a.push({content:d.map(t=>{const c=[...t.commandPath??[],t.name].join(" ");return[h(c),t.description??""]}),header:p.green(" Subcommands ")}),(s.raw??s.log)(f(a))};class P{argument={description:"Command to show help for (subcommand path supported, e.g. `cli help docker build`)",name:"command",type:String};name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(r){this.commands=r}execute(r){const{argument:l,command:o,commandName:m,logger:e,options:a,runtime:n}=r,{footer:i,header:d}=n.getCommandSection();d&&(e.raw??e.log)(y(d));const t=m==="help"&&Array.isArray(l)&&l.length>0?l.join(" "):void 0;if(m==="help"&&t===void 0)w(e,n,this.commands,typeof a?.group=="string"?a.group:void 0);else{const c=t!==void 0||o===void 0||o.name==="help"?void 0:o;N(e,n,this.commands,t??m,c)}i&&(e.raw??e.log)(y(i))}}export{P as default};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
`)[0]??"",o=
|
|
1
|
+
import{createRequire as S}from"node:module";import q from"github-slugger";import{r as G}from"../packem_shared/index-B5zrpT20.js";import{g as P,a as V,b as T,c as U}from"../packem_shared/runtime-process-hJz7FqPN.js";const x=S(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[t,n]=u.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return u.getBuiltinModule(e)}return x(e)},{existsSync:w}=f("node:fs"),{readFile:O,mkdir:k,writeFile:N}=f("node:fs/promises"),{resolve:E,join:L,dirname:B}=f("node:path"),F=new q,v=e=>F.slug(e),I=e=>e.filter(Boolean),W=(e,t)=>{const n=new Set,o=[];for(const r of e){const s=t(r);n.has(s)||(n.add(s),o.push(r))}return o},M=(e,t)=>{const n=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(e.argument){const o=e.argument.name.toUpperCase(),r=e.argument.required?o:`[${o}]`;return`${t} ${n} ${r}`}return`${t} ${n}`},z=(e,t)=>{if(!Array.isArray(e.env)||e.env.length===0)return;const n=e.env.filter(o=>!o.hidden);n.length>0&&t.push({content:n.map(o=>[o.name,o.description??""]),header:" Environment Variables "})},H=(e,t)=>{const n=[],o=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" "),r=!!e.argument,s=!!e.options;if(n.push({content:`${t} ${o}${r?" [positional arguments]":""}${s?" [options]":""}`,header:" Usage "}),e.description&&n.push({content:e.description,header:" Description "}),e.argument&&n.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&n.push({header:" Command Options ",optionList:e.options.filter(a=>!a.hidden)}),z(e,n),e.alias!==void 0&&e.alias.length>0){const a=Array.isArray(e.alias)?e.alias:[e.alias];n.splice(1,0,{content:a,header:"Alias(es)"})}return Array.isArray(e.examples)&&e.examples.length>0&&n.push({content:e.examples,header:"Examples"}),G(n)},J=(e,t)=>{const n=e.description?.trim().split(`
|
|
2
|
+
`)[0]??"",o=M(e,t),r=H(e,t);return I([`## \`${o}\``,n,`\`\`\`
|
|
3
3
|
${r.trim()}
|
|
4
4
|
\`\`\``]).join(`
|
|
5
5
|
|
|
6
|
-
`)},
|
|
6
|
+
`)},K=(e,t,n,o)=>{const r=`(${["--version","-V"].join("|")})`,s=T(),a=U();return`\`\`\`sh-session
|
|
7
7
|
$ npm install -g ${t}
|
|
8
8
|
$ ${e} COMMAND
|
|
9
9
|
running command...
|
|
10
10
|
$ ${e} ${r}
|
|
11
|
-
${t}/${n??"unknown"} ${
|
|
11
|
+
${t}/${n??"unknown"} ${s}-${a} node-v${o}
|
|
12
12
|
$ ${e} --help [COMMAND]
|
|
13
13
|
USAGE
|
|
14
14
|
$ ${e} COMMAND
|
|
15
15
|
...
|
|
16
16
|
\`\`\`
|
|
17
|
-
`},
|
|
17
|
+
`},R=(e,t,n)=>{const o=e.map(s=>{const a=M(s,t);return`* [\`${a}\`](#${v(a)})`}),r=e.map(s=>J(s,t)).map(s=>`${s.trim()}
|
|
18
18
|
`);return[...o,"",...r].join(`
|
|
19
|
-
`).trim()},
|
|
19
|
+
`).trim()},j=async(e,t)=>{const n=B(e);w(n)||await k(n,{recursive:!0}),await N(e,t,"utf8")},Q=async(e,t,n,o)=>{const r=new Map;for(const a of e){const i=a.group??"__Other",d=r.get(i)??[];d.push(a),r.set(i,d)}const s=Array.from(r.entries(),([a,i])=>a==="__Other"?["Other",i]:[a,i]);return await Promise.all(s.map(async([a,i])=>{const d=a.replaceAll(":","/"),$=L(".",t,`${d}.md`),p=`\`${n} ${a}\``,c=`${[p,"=".repeat(p.length),"",`Commands in the ${a} group.`,"",R(i,n)].join(`
|
|
20
20
|
`).trim()}
|
|
21
|
-
`;o.dryRun||await
|
|
22
|
-
`,...
|
|
21
|
+
`;o.dryRun||await j(E(P(),$),c)})),`${[`# Command Topics
|
|
22
|
+
`,...s.map(([a])=>{const i=a.replaceAll(":","/");return`* [\`${n} ${a}\`](${t}/${i}.md)`})].join(`
|
|
23
23
|
`).trim()}
|
|
24
|
-
`},
|
|
24
|
+
`},y=e=>e.replaceAll(`\r
|
|
25
25
|
`,`
|
|
26
26
|
`).replaceAll("\r",`
|
|
27
|
-
`),
|
|
28
|
-
`).filter(t=>t.startsWith("# ")).map(t=>t.trim().slice(2)).map(t=>`* [${t}](#${
|
|
29
|
-
`),
|
|
27
|
+
`),X=e=>y(e).split(`
|
|
28
|
+
`).filter(t=>t.startsWith("# ")).map(t=>t.trim().slice(2)).map(t=>`* [${t}](#${v(t)})`).join(`
|
|
29
|
+
`),A=e=>e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),h=(e,t,n)=>{const o=y(e),r=`<!-- ${t} -->`,s=`<!-- ${t}stop -->`;if(o.includes(r)&&o.includes(s)){const a=A(r),i=A(s),d=new RegExp(String.raw`${a}(.|\n)*${i}`,"m");return o.replace(d,`${r}
|
|
30
30
|
${n}
|
|
31
|
-
${
|
|
31
|
+
${s}`)}return o.replace(r,`${r}
|
|
32
32
|
${n}
|
|
33
|
-
${
|
|
33
|
+
${s}`)},ne={description:"Generate README documentation for CLI commands",execute:async({logger:e,options:t,runtime:n})=>{const o=n.getCliName(),r=n.getPackageName()??o,s=n.getPackageVersion(),a=V().node??"unknown",i={aliases:t.aliases,dryRun:t.dryRun,multi:t.multi,outputDir:t.outputDir??"docs",readmePath:t.readmePath??"README.md",version:t.version??s??void 0},d=n.getCommands(),$=[...d.values()].filter(m=>!m.hidden).filter(m=>i.aliases?!0:m.name===d.get(m.name)?.name).toSorted((m,g)=>{const b=m.commandPath?[...m.commandPath,m.name].join(" "):m.name,C=g.commandPath?[...g.commandPath,g.name].join(" "):g.name;return b.localeCompare(C)}),p=W($,m=>m.commandPath?[...m.commandPath,m.name].join(" "):m.name);e.debug(`Processing ${String(p.length)} commands for README generation`);let c;const l=E(P(),i.readmePath??"README.md");if(w(l)){const m=await O(l,"utf8");c=y(m)}else e.warn(`README file not found at ${l}, creating template`),c=`# ${r}
|
|
34
34
|
|
|
35
35
|
<!-- usage -->
|
|
36
36
|
<!-- usagestop -->
|
|
@@ -40,6 +40,6 @@ ${i}`)},"replaceTag"),se={description:"Generate README documentation for CLI com
|
|
|
40
40
|
|
|
41
41
|
<!-- toc -->
|
|
42
42
|
<!-- tocstop -->
|
|
43
|
-
`;const
|
|
44
|
-
`,
|
|
45
|
-
${
|
|
43
|
+
`;const D=i.outputDir??"docs",_=i.version??s??"unknown";c=h(c,"usage",K(o,r,_,a)),c=h(c,"commands",i.multi?await Q(p,D,o,i):R(p,o)),c=h(c,"toc",X(c)),c=`${c.trimEnd()}
|
|
44
|
+
`,i.dryRun?(e.info("Dry run mode - README not written"),e.info(`Generated README content:
|
|
45
|
+
${c}`)):(await j(l,c),e.info(`README generated successfully at ${l}`))},name:"readme",options:[{description:"Include aliases in command list",name:"aliases",type:Boolean},{description:"Show what would be generated without writing files",name:"dry-run",type:Boolean},{description:"Generate multi-file documentation by command groups",name:"multi",type:Boolean},{description:"Maximum depth for nested topics when using multi-file mode",name:"nested-topics-depth",type:Number},{description:"Output directory for multi-file documentation",name:"output-dir",type:String,typeLabel:"{underline directory}"},{description:"Path to README file to generate",name:"readme-path",type:String,typeLabel:"{underline path}"},{description:"Repository prefix for code links",name:"repository-prefix",type:String,typeLabel:"{underline prefix}"},{description:"Version to use in generated documentation",name:"version",type:String,typeLabel:"{underline version}"}]};export{ne as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const r={alias:["v","V"],description:"Output the version number",execute:({logger:e,runtime:o})=>{const n=o.getPackageVersion();n===void 0?(e.warn("Unknown version"),e.debug("The version number was not provided by the cli constructor.")):e.info(n)},name:"version",options:[],usage:[]};export{r as default};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{Cli as e}from"./packem_shared/Cerebro-ChUYLbTK.js";import{VERBOSITY_DEBUG as B,VERBOSITY_NORMAL as O,VERBOSITY_QUIET as R,VERBOSITY_VERBOSE as V}from"./packem_shared/VERBOSITY_QUIET-XPultrIA.js";import{lazyNamed as I}from"./packem_shared/lazyNamed-DMUm8mZe.js";import{E as T}from"./packem_shared/isVisulimaError-jVZgumOU-C67qeq6-.js";const m=(r,o)=>new e(r,o);export{e as Cerebro,B as VERBOSITY_DEBUG,O as VERBOSITY_NORMAL,R as VERBOSITY_QUIET,V as VERBOSITY_VERBOSE,T as VisulimaError,m as createCerebro,I as lazyNamed};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import a from"@visulima/pail/processor/caller";import m from"@visulima/pail/processor/message-formatter";import{createPail as l}from"@visulima/pail/server";import{VERBOSITY_DEBUG as p,VERBOSITY_QUIET as E}from"../packem_shared/VERBOSITY_QUIET-XPultrIA.js";import{d as f}from"../packem_shared/runtime-process-hJz7FqPN.js";const T=o=>{const i={16:"informational",32:"informational",64:"trace",128:"debug",256:"debug"},t=[new m],r=f().CEREBRO_OUTPUT_LEVEL;(r===String(128)||r===String(p))&&t.push(new a);const n=(r&&i[r])??"informational",s={...o,logLevel:o?.logLevel??n,processors:o?.processors?[...t,...o.processors]:t},e=l(s);return r===String(E)&&e.disable(),e};export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var tn=Object.defineProperty;var R=(r,a)=>tn(r,"name",{value:a,configurable:!0});import{createRequire as nn}from"node:module";import{findCacheDirSync as un}from"@visulima/find-cache-dir";import{c as cn}from"../packem_shared/cerebro-error-BnJTixb2.js";const rn=nn(import.meta.url),L=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=R(r=>{if(typeof L<"u"&&L.versions&&L.versions.node){const[a,i]=L.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return L.getBuiltinModule(r)}return rn(r)},"__cjs_getBuiltinModule"),{existsSync:je,readFileSync:on,mkdirSync:sn,writeFileSync:an}=_e("node:fs"),{get:ln}=_e("node:https");var fn=Object.defineProperty,Oe=R((r,a)=>fn(r,"name",{value:a,configurable:!0}),"d$1");const be=Oe(r=>{const[a,i]=r.split("-");return{nums:a.split(".").map(l=>Number.parseInt(l,10)||0),pre:i}},"parse"),pn=Oe((r,a)=>{const i=be(r),l=be(a),h=Math.max(i.nums.length,l.nums.length);for(let v=0;v<h;v++){const y=i.nums[v]??0,w=l.nums[v]??0;if(y>w)return!0;if(y<w)return!1}if(i.pre===void 0&&l.pre!==void 0)return!0;if(i.pre!==void 0&&l.pre===void 0||i.pre===void 0&&l.pre===void 0)return!1;const m=i.pre.split("."),x=l.pre.split("."),d=Math.max(m.length,x.length);for(let v=0;v<d;v++){const y=m[v],w=x[v];if(y===void 0)return!1;if(w===void 0)return!0;if(y===w)continue;const A=Number.parseInt(y,10),T=Number.parseInt(w,10),Z=!Number.isNaN(A)&&String(A)===y,C=!Number.isNaN(T)&&String(T)===w;return Z&&C?A>T:Z?!1:C?!0:y>w}return!1},"semverGt");var dn=Object.defineProperty,gn=R((r,a)=>dn(r,"name",{value:a,configurable:!0}),"$e"),hn=Object.defineProperty,ee=gn((r,a)=>hn(r,"name",{value:a,configurable:!0}),"W"),mn=Object.defineProperty,c=ee((r,a)=>mn(r,"name",{value:a,configurable:!0}),"u$1");let ye=c(()=>{var r=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,h=Object.prototype.hasOwnProperty,m=c((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),x=c((e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of l(t))!h.call(e,o)&&o!==n&&a(e,o,{get:c(()=>t[o],"get"),enumerable:!(s=i(t,o))||s.enumerable});return e},"ae"),d=c(e=>x(a({},"__esModule",{value:!0}),e),"oe"),v={};m(v,{zeptomatch:c(()=>$e,"zeptomatch")});var y=c(e=>{const t=new Set,n=[e];for(let s=0;s<n.length;s++){const o=n[s];if(t.has(o))continue;t.add(o);const{children:u}=o;if(u?.length)for(let f=0,g=u.length;f<g;f++)n.push(u[f])}return Array.from(t)},"M"),w=c(e=>{let t="";const n=y(e);for(let s=0,o=n.length;s<o;s++){const u=n[s];if(!u.regex)continue;const f=u.regex.flags;if(t||(t=f),t!==f)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${f}"`)}return t},"se"),A=c((e,t,n)=>{const s=n.get(e);if(s!==void 0)return s;const o=e.partial??t;let u="";if(e.regex&&(u+=o?"(?:$|":"",u+=e.regex.source),e.children?.length){const f=Z(e.children.map(g=>A(g,t,n)).filter(Boolean));if(f?.length){const g=e.children.some(F=>!F.regex||!(F.partial??t)),b=f.length>1||o&&(!u.length||g);u+=b?o?"(?:$|":"(?:":"",u+=f.join("|"),u+=b?")":""}}return e.regex&&(u+=o?")":""),n.set(e,u),u},"O"),T=c((e,t)=>{const n=new Map,s=y(e);for(let o=s.length-1;o>=0;o--){const u=A(s[o],t,n);if(!(o>0))return u}return""},"ie"),Z=c(e=>Array.from(new Set(e)),"ue"),C=c((e,t,n)=>C.compile(e,n).test(t),"R");C.compile=(e,t)=>{const n=t?.partial??!1,s=T(e,n),o=w(e);return new RegExp(`^(?:${s})$`,o)};var Se=C,Ae=c((e,t)=>{const n=Se.compile(e,t),s=`${n.source.slice(0,-1)}[\\\\/]?$`,o=n.flags;return new RegExp(s,o)},"le"),Ce=Ae,Ie=c(e=>{const t=e.map(s=>s.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),Pe=Ie,ne=c(e=>Array.isArray(e),"j"),U=c(e=>typeof e=="function","_"),ze=c(e=>e.length===0,"he"),Te=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Ue=c(e=>typeof e=="number","de"),Be=c(e=>typeof e=="object"&&e!==null,"xe"),Fe=c(e=>e instanceof RegExp,"me"),De=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Le=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),re=c(e=>typeof e=="string","A"),E=c(e=>e===void 0,"f"),qe=c(e=>{const t=new Map;return n=>{const s=t.get(n);if(s!==void 0)return s;const o=e(n);return t.set(n,o),o}},"ye"),oe=c((e,t,n={})=>{const s={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},o=N(t)(s),u=Math.max(s.index,s.indexBacktrackMax);if(o&&s.index===e.length)return s.output;throw new Error(`Failed to parse at index ${u}`)},"I"),p=c((e,t)=>ne(e)?We(e,t):re(e)?se(e,t):Ze(e,t),"i"),We=c((e,t)=>{const n={};for(const s of e){if(s.length!==1)throw new Error(`Invalid character: "${s}"`);const o=s.charCodeAt(0);n[o]=!0}return s=>{const o=s.input;let u=s.index,f=u;for(;f<o.length&&o.charCodeAt(f)in n;)f+=1;if(f>u){if(!E(t)&&!s.options.silent){const g=o.slice(u,f),b=U(t)?t(g,o,`${u}`):t;E(b)||s.output.push(b)}s.index=f}return!0}},"we"),Ze=c((e,t)=>{if(Le(e))return se(e.source,t);{const n=e.source,s=e.flags.replace(/y|$/,"y"),o=new RegExp(n,s);return De(e)&&U(t)&&!Te(t)?Ve(o,t):He(o,t)}},"$e"),Ve=c((e,t)=>n=>{const s=n.index,o=n.input;e.lastIndex=s;const u=e.exec(o);if(u){const f=e.lastIndex;if(!n.options.silent){const g=t(...u,o,`${s}`);E(g)||n.output.push(g)}return n.index=f,!0}else return!1},"Ee"),He=c((e,t)=>n=>{const s=n.index,o=n.input;if(e.lastIndex=s,e.test(o)){const u=e.lastIndex;if(!E(t)&&!n.options.silent){const f=U(t)?t(o.slice(s,u),o,`${s}`):t;E(f)||n.output.push(f)}return n.index=u,!0}else return!1},"Ce"),se=c((e,t)=>n=>{const s=n.index,o=n.input;if(o.startsWith(e,s)){if(!E(t)&&!n.options.silent){const u=U(t)?t(e,o,`${s}`):t;E(u)||n.output.push(u)}return n.index+=e.length,!0}else return!1},"F"),H=c((e,t,n,s)=>{const o=N(e),u=t>1;return J(G(ie(f=>{let g=0;for(;g<n;){const b=f.index;if(!o(f)||(g+=1,f.index===b))break}return g>=t},u),s))},"k"),ae=c((e,t)=>H(e,0,1,t),"L"),V=c((e,t)=>H(e,0,1/0,t),"$"),Ge=c((e,t)=>H(e,1,1/0,t),"Re"),I=c((e,t)=>{const n=e.map(N);return J(G(ie(s=>{for(let o=0,u=n.length;o<u;o++)if(!n[o](s))return!1;return!0}),t))},"x"),j=c((e,t)=>{const n=e.map(N);return J(G(s=>{for(let o=0,u=n.length;o<u;o++)if(n[o](s))return!0;return!1},t))},"p"),ie=c((e,t=!0,n=!1)=>{const s=N(e);return t?o=>{const u=o.index,f=o.output.length,g=s(o);return!g&&!n&&(o.indexBacktrackMax=Math.max(o.indexBacktrackMax,o.index)),(!g||n)&&(o.index=u,o.output.length!==f&&(o.output.length=f)),g}:s},"q"),G=c((e,t)=>{const n=N(e);return t?s=>{if(s.options.silent)return n(s);const o=s.output.length;if(n(s)){const u=s.output.splice(o,1/0),f=t(u);return E(f)||s.output.push(f),!0}else return!1}:n},"B"),J=(()=>{let e=0;return t=>{const n=N(t),s=e+=1;return o=>{var u;if(o.options.memoization===!1)return n(o);const f=o.index,g=(u=o.cache)[s]||(u[s]={indexMax:-1,queue:[]}),b=g.queue;if(f<=g.indexMax){const D=g.store||(g.store=new Map);if(b.length){for(let z=0,Qt=b.length;z<Qt;z+=2){const Xt=b[z*2],en=b[z*2+1];D.set(Xt,en)}b.length=0}const O=D.get(f);if(O===!1)return!1;if(Ue(O))return o.index=O,!0;if(O)return o.index=O.index,O.output?.length&&o.output.push(...O.output),!0}const F=o.output.length,Kt=n(o);if(g.indexMax=Math.max(g.indexMax,f),Kt){const D=o.index,O=o.output.length;if(O>F){const z=o.output.slice(F,O);b.push(f,{index:D,output:z})}else b.push(f,D);return!0}else return b.push(f,!1),!1}}})(),ue=c(e=>{let t;return n=>(t||(t=N(e())),t(n))},"G"),N=qe(e=>{if(U(e))return ze(e)?ue(e):e;if(re(e)||Fe(e))return p(e);if(ne(e))return I(e);if(Be(e))return j(Object.values(e));throw new Error("Invalid rule")}),M=c(e=>e,"d"),Je=c(e=>typeof e=="string","ke"),Ye=c(e=>{const t=new WeakMap,n=new WeakMap;return(s,o)=>{const u=o?.partial?n:t,f=u.get(s);if(f!==void 0)return f;const g=e(s,o);return u.set(s,g),g}},"Be"),Ke=c(e=>{const t={},n={};return(s,o)=>{const u=o?.partial?n:t;return u[s]??(u[s]=e(s,o))}},"Pe"),Qe=p(/\\./,M),Xe=p(/./,M),et=p(/\*\*\*+/,"*"),tt=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),nt=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),rt=V(j([Qe,et,tt,nt,Xe])),ot=rt,st=c(e=>oe(e,ot,{memoization:!1}).join(""),"Ie"),at=st,ce="abcdefghijklmnopqrstuvwxyz",it=c(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ce[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),le=c(e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t=t*26+ce.indexOf(e[n])+1;return t},"V"),Y=c((e,t)=>{if(t<e)return Y(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),ut=c((e,t,n)=>Y(e,t).map(s=>String(s).padStart(n,"0")),"qe"),fe=c((e,t)=>Y(le(e),le(t)).map(it),"W"),$=c(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),B=c(e=>({children:e}),"y"),P=(()=>{const e=c((t,n,s)=>{if(s.has(t))return;s.add(t);const{children:o}=t;if(!o.length)o.push(n);else for(let u=0,f=o.length;u<f;u++)e(o[u],n,s)},"e");return t=>{if(!t.length)return B([]);for(let n=t.length-1;n>=1;n--){const s=new Set,o=t[n-1],u=t[n];e(o,u,s)}return t[0]}})(),k=c(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),ct=p(/\\./,$),lt=p(/[$.*+?^(){}[\]\|]/,e=>$(`\\${e}`)),ft=p(/[\\\/]/,k),pt=p(/[^$.*+?^(){}[\]\|\\\/]+/,$),dt=p(/^(?:!!)*!(.*)$/,(e,t)=>$(`(?!^${$e.compile(t).source}$).*?`)),gt=p(/^(!!)+/),ht=j([dt,gt]),mt=p(/\/(\*\*\/)+/,()=>B([P([k(),$(".+?"),k()]),k()])),xt=p(/^(\*\*\/)+/,()=>B([$("^"),P([$(".*?"),k()])])),vt=p(/\/(\*\*)$/,()=>B([P([k(),$(".*?")]),$("$")])),$t=p(/\*\*/,()=>$(".*?")),pe=j([mt,xt,vt,$t]),bt=p(/\*\/(?!\*\*\/|\*$)/,()=>P([$("[^\\\\/]*?"),k()])),yt=p(/\*/,()=>$("[^\\\\/]*")),de=j([bt,yt]),ge=p("?",()=>$("[^\\\\/]")),wt=p("[",M),_t=p("]",M),jt=p(/[!^]/,"^\\\\/"),Ot=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,M),Rt=p(/\\./,M),Et=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Nt=p(/[\\\/]/,"\\\\/"),kt=p(/[^$.*+?^(){}[\]\|\\\/]+/,M),Mt=j([Rt,Et,Nt,Ot,kt]),he=I([wt,ae(jt),V(Mt),_t],e=>$(e.join(""))),St=p("{","(?:"),At=p("}",")"),Ct=p(/(\d+)\.\.(\d+)/,(e,t,n)=>ut(+t,+n,Math.min(t.length,n.length)).join("|")),It=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>fe(t,n).join("|")),Pt=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>fe(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),zt=j([Ct,It,Pt]),me=I([St,zt,At],e=>$(e.join(""))),Tt=p("{"),Ut=p("}"),Bt=p(","),Ft=p(/\\./,$),Dt=p(/[$.*+?^(){[\]\|]/,e=>$(`\\${e}`)),Lt=p(/[\\\/]/,k),qt=p(/[^$.*+?^(){}[\]\|\\\/,]+/,$),Wt=ue(()=>ve),Zt=p("",()=>$("(?:)")),Vt=Ge(j([pe,de,ge,he,me,Wt,Ft,Dt,Lt,qt]),P),xe=j([Vt,Zt]),ve=I([Tt,ae(I([xe,V(I([Bt,xe]))])),Ut],B),Ht=V(j([ht,pe,de,ge,he,me,ve,ct,lt,ft,pt]),P),Gt=Ht,Jt=c(e=>oe(e,Gt,{memoization:!1})[0],"kr"),Yt=Jt,K=c((e,t,n)=>K.compile(e,n).test(t),"N");K.compile=(()=>{const e=Ke((n,s)=>Ce(Yt(at(n)),s)),t=Ye((n,s)=>Pe(n.map(o=>e(o,s))));return(n,s)=>Je(n)?e(n,s):t(n,s)})();var $e=K;return d(v)})();return r.default||r},"_lazyMatch"),Q;const xn=c((r,a)=>(Q||(Q=ye(),ye=null),Q(r,a)),"default");var vn=Object.defineProperty,$n=ee((r,a)=>vn(r,"name",{value:a,configurable:!0}),"t$1");const bn=/^[A-Z]:\//i,S=$n((r="")=>r&&r.replaceAll("\\","/").replace(bn,a=>a.toUpperCase()),"normalizeWindowsPath");var yn=Object.defineProperty,_=ee((r,a)=>yn(r,"name",{value:a,configurable:!0}),"r");const wn=/^[/\\]{2}/,_n=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Re=/^[A-Z]:$/i,we=/^\/([A-Z]:)?$/i,jn=/.(\.[^./]+)$/,On=/^[/\\]|^[a-z]:[/\\]/i,Rn=/\/$/,En=_(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),Ee=_((r,a)=>{let i="",l=0,h=-1,m=0,x;for(let d=0;d<=r.length;++d){if(d<r.length)x=r[d];else{if(x==="/")break;x="/"}if(x==="/"){if(!(h===d-1||m===1))if(m===2){if(i.length<2||l!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const v=i.lastIndexOf("/");v===-1?(i="",l=0):(i=i.slice(0,v),l=i.length-1-i.lastIndexOf("/")),h=d,m=0;continue}else if(i.length>0){i="",l=0,h=d,m=0;continue}}a&&(i+=i.length>0?"/..":"..",l=2)}else i.length>0?i+=`/${r.slice(h+1,d)}`:i=r.slice(h+1,d),l=d-h-1;h=d,m=0}else x==="."&&m!==-1?++m:m=-1}return i},"normalizeString"),W=_(r=>_n.test(r),"isAbsolute"),Ne=_(function(r){if(r.length===0)return".";r=S(r);const a=wn.exec(r),i=W(r),l=r.at(-1)==="/";return r=Ee(r,!i),r.length===0?i?"/":l?"./":".":(l&&(r+="/"),Re.test(r)&&(r+="/"),a?i?`//${r}`:`//./${r}`:i&&!W(r)?`/${r}`:r)},"normalize"),Nn=_((...r)=>{let a="";for(const i of r)if(i)if(a.length>0){const l=a.at(-1)==="/",h=i[0]==="/";l&&h?a+=i.slice(1):a+=l||h?i:`/${i}`}else a+=i;return Ne(a)},"join"),X=_(function(...r){r=r.map(l=>S(l));let a="",i=!1;for(let l=r.length-1;l>=-1&&!i;l--){const h=l>=0?r[l]:En();!h||h.length===0||(a=`${h}/${a}`,i=W(h))}return a=Ee(a,!i),i&&!W(a)?`/${a}`:a.length>0?a:"."},"resolve");_(function(r){return S(r)},"toNamespacedPath");const kn=_(function(r){return jn.exec(S(r))?.[1]??""},"extname");_(function(r,a){const i=X(r).replace(we,"$1").split("/"),l=X(a).replace(we,"$1").split("/");if(l[0][1]===":"&&i[0][1]===":"&&i[0]!==l[0])return l.join("/");const h=[...i];for(const m of h){if(l[0]!==m)break;i.shift(),l.shift()}return[...i.map(()=>".."),...l].join("/")},"relative");const ke=_(r=>{const a=S(r).replace(Rn,"").split("/").slice(0,-1);return a.length===1&&Re.test(a[0])&&(a[0]=`${a[0]}/`),a.join("/")||(W(r)?"/":".")},"dirname");_(function(r){const a=[r.root,r.dir,r.base??r.name+r.ext].filter(Boolean);return S(r.root?X(...a):a.join("/"))},"format");const Mn=_((r,a)=>{const i=S(r).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");_(function(r){const a=On.exec(r)?.[0]?.replaceAll("\\","/")??"",i=Mn(r),l=kn(i);return{base:i,dir:ke(r),ext:l,name:i.slice(0,i.length-l.length),root:a}},"parse");_((r,a)=>xn(a,Ne(r)),"matchesGlob");var Sn=Object.defineProperty,An=R((r,a)=>Sn(r,"name",{value:a,configurable:!0}),"e");let q=class extends cn{static{R(this,"p")}static{An(this,"UpdateNotifierError")}constructor(a,i="UPDATE_NOTIFIER_ERROR",l){super(a,i,l),this.name="UpdateNotifierError"}};var Cn=Object.defineProperty,te=R((r,a)=>Cn(r,"name",{value:a,configurable:!0}),"n");const In="last-update-check.json",Me=te(r=>{const a=un(r);if(a===void 0)throw new q("Could not find cache directory","CACHE_DIRECTORY_NOT_FOUND",{packageName:r});return Nn(a,In)},"getConfigFile"),Pn=te(r=>{const a=Me(r);try{if(!je(a))return;const{lastUpdateCheck:i}=JSON.parse(on(a,"utf8"));return i}catch{return}},"getLastUpdate"),zn=te(r=>{const a=Me(r),i=ke(a);je(i)||sn(i,{recursive:!0}),an(a,JSON.stringify({lastUpdateCheck:Date.now()}))},"saveLastUpdate");var Tn=Object.defineProperty,Un=R((r,a)=>Tn(r,"name",{value:a,configurable:!0}),"d");const Bn=Un(async(r,a,i)=>{const l=i.replace("__NAME__",r),h=512*1024;return await new Promise((m,x)=>{ln(l,d=>{if(d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)){x(new q(`Unexpected status code ${String(d.statusCode)}`,"VERSION_FETCH_ERROR",{distributionTag:a,packageName:r})),d.resume();return}let v="",y=!1;d.on("data",w=>{y||(v+=String(w),v.length>h&&(y=!0,x(new q("Response too large","VERSION_FETCH_ERROR",{distributionTag:a,packageName:r})),d.destroy()))}),d.on("end",()=>{if(!y)try{const w=JSON.parse(v)[a];if(!w){x(new q("Error getting version","VERSION_FETCH_ERROR",{distributionTag:a,packageName:r}));return}m(w)}catch{x(new q("Could not parse version response","VERSION_PARSE_ERROR",{distributionTag:a,packageName:r}))}})}).on("error",d=>{x(d)})})},"getDistributionVersion");var Fn=Object.defineProperty,Dn=R((r,a)=>Fn(r,"name",{value:a,configurable:!0}),"i");const Hn=Dn(async({alwaysRun:r,debug:a,distTag:i="latest",pkg:l,registryUrl:h="https://registry.npmjs.org/-/package/__NAME__/dist-tags",updateCheckInterval:m=1e3*60*60*24})=>{const x=Pn(l.name);if(r||!x||x<Date.now()-m){const d=await Bn(l.name,i,h);if(zn(l.name),pn(d,l.version))return d;a&&console.error(`Latest version (${d}) not newer than current version (${l.version})`)}else a&&console.error(`Too recent to check for a new update. simpleUpdateNotifier() interval set to ${String(m)}ms but only ${String(Date.now()-x)}ms since last check.`)},"hasNewVersion");export{Hn as default};
|
|
1
|
+
import{createRequire as Qt}from"node:module";import{findCacheDirSync as rn}from"@visulima/find-cache-dir";import{t as on}from"../packem_shared/cerebro-error-etNTKvnJ.js";const Xt=Qt(import.meta.url),q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,be=s=>{if(typeof q<"u"&&q.versions&&q.versions.node){const[a,i]=q.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return q.getBuiltinModule(s)}return Xt(s)},{existsSync:ye,readFileSync:en,mkdirSync:tn,writeFileSync:nn}=be("node:fs"),{get:sn}=be("node:https"),$e=s=>{const[a,i]=s.split("-");return{nums:a.split(".").map(l=>Number.parseInt(l,10)||0),pre:i}},an=(s,a)=>{const i=$e(s),l=$e(a),h=Math.max(i.nums.length,l.nums.length);for(let $=0;$<h;$++){const b=i.nums[$]??0,y=l.nums[$]??0;if(b>y)return!0;if(b<y)return!1}if(i.pre===void 0&&l.pre!==void 0)return!0;if(i.pre!==void 0&&l.pre===void 0||i.pre===void 0&&l.pre===void 0)return!1;const m=i.pre.split("."),x=l.pre.split("."),d=Math.max(m.length,x.length);for(let $=0;$<d;$++){const b=m[$],y=x[$];if(b===void 0)return!1;if(y===void 0)return!0;if(b===y)continue;const S=Number.parseInt(b,10),T=Number.parseInt(y,10),L=!Number.isNaN(S)&&String(S)===b,A=!Number.isNaN(T)&&String(T)===y;return L&&A?S>T:L?!1:A?!0:b>y}return!1};var un=Object.defineProperty,X=(s,a)=>un(s,"name",{value:a,configurable:!0}),cn=Object.defineProperty,c=X((s,a)=>cn(s,"name",{value:a,configurable:!0}),"u$1");let ve=c(()=>{var s=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,h=Object.prototype.hasOwnProperty,m=c((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),x=c((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of l(t))!h.call(e,r)&&r!==n&&a(e,r,{get:c(()=>t[r],"get"),enumerable:!(o=i(t,r))||o.enumerable});return e},"ae"),d=c(e=>x(a({},"__esModule",{value:!0}),e),"oe"),$={};m($,{zeptomatch:c(()=>xe,"zeptomatch")});var b=c(e=>{const t=new Set,n=[e];for(let o=0;o<n.length;o++){const r=n[o];if(t.has(r))continue;t.add(r);const{children:u}=r;if(u?.length)for(let f=0,g=u.length;f<g;f++)n.push(u[f])}return Array.from(t)},"M"),y=c(e=>{let t="";const n=b(e);for(let o=0,r=n.length;o<r;o++){const u=n[o];if(!u.regex)continue;const f=u.regex.flags;if(t||(t=f),t!==f)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${f}"`)}return t},"se"),S=c((e,t,n)=>{const o=n.get(e);if(o!==void 0)return o;const r=e.partial??t;let u="";if(e.regex&&(u+=r?"(?:$|":"",u+=e.regex.source),e.children?.length){const f=L(e.children.map(g=>S(g,t,n)).filter(Boolean));if(f?.length){const g=e.children.some(B=>!B.regex||!(B.partial??t)),w=f.length>1||r&&(!u.length||g);u+=w?r?"(?:$|":"(?:":"",u+=f.join("|"),u+=w?")":""}}return e.regex&&(u+=r?")":""),n.set(e,u),u},"O"),T=c((e,t)=>{const n=new Map,o=b(e);for(let r=o.length-1;r>=0;r--){const u=S(o[r],t,n);if(!(r>0))return u}return""},"ie"),L=c(e=>Array.from(new Set(e)),"ue"),A=c((e,t,n)=>A.compile(e,n).test(t),"R");A.compile=(e,t)=>{const n=t?.partial??!1,o=T(e,n),r=y(e);return new RegExp(`^(?:${o})$`,r)};var Oe=A,ke=c((e,t)=>{const n=Oe.compile(e,t),o=`${n.source.slice(0,-1)}[\\\\/]?$`,r=n.flags;return new RegExp(o,r)},"le"),Me=ke,Se=c(e=>{const t=e.map(o=>o.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),Ae=Se,ee=c(e=>Array.isArray(e),"j"),P=c(e=>typeof e=="function","_"),Ce=c(e=>e.length===0,"he"),Ie=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),ze=c(e=>typeof e=="number","de"),Te=c(e=>typeof e=="object"&&e!==null,"xe"),Pe=c(e=>e instanceof RegExp,"me"),Ue=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Be=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),te=c(e=>typeof e=="string","A"),j=c(e=>e===void 0,"f"),Fe=c(e=>{const t=new Map;return n=>{const o=t.get(n);if(o!==void 0)return o;const r=e(n);return t.set(n,r),r}},"ye"),ne=c((e,t,n={})=>{const o={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},r=N(t)(o),u=Math.max(o.index,o.indexBacktrackMax);if(r&&o.index===e.length)return o.output;throw new Error(`Failed to parse at index ${u}`)},"I"),p=c((e,t)=>ee(e)?qe(e,t):te(e)?re(e,t):De(e,t),"i"),qe=c((e,t)=>{const n={};for(const o of e){if(o.length!==1)throw new Error(`Invalid character: "${o}"`);const r=o.charCodeAt(0);n[r]=!0}return o=>{const r=o.input;let u=o.index,f=u;for(;f<r.length&&r.charCodeAt(f)in n;)f+=1;if(f>u){if(!j(t)&&!o.options.silent){const g=r.slice(u,f),w=P(t)?t(g,r,`${u}`):t;j(w)||o.output.push(w)}o.index=f}return!0}},"we"),De=c((e,t)=>{if(Be(e))return re(e.source,t);{const n=e.source,o=e.flags.replace(/y|$/,"y"),r=new RegExp(n,o);return Ue(e)&&P(t)&&!Ie(t)?Ze(r,t):Le(r,t)}},"$e"),Ze=c((e,t)=>n=>{const o=n.index,r=n.input;e.lastIndex=o;const u=e.exec(r);if(u){const f=e.lastIndex;if(!n.options.silent){const g=t(...u,r,`${o}`);j(g)||n.output.push(g)}return n.index=f,!0}else return!1},"Ee"),Le=c((e,t)=>n=>{const o=n.index,r=n.input;if(e.lastIndex=o,e.test(r)){const u=e.lastIndex;if(!j(t)&&!n.options.silent){const f=P(t)?t(r.slice(o,u),r,`${o}`):t;j(f)||n.output.push(f)}return n.index=u,!0}else return!1},"Ce"),re=c((e,t)=>n=>{const o=n.index,r=n.input;if(r.startsWith(e,o)){if(!j(t)&&!n.options.silent){const u=P(t)?t(e,r,`${o}`):t;j(u)||n.output.push(u)}return n.index+=e.length,!0}else return!1},"F"),V=c((e,t,n,o)=>{const r=N(e),u=t>1;return J(H(se(f=>{let g=0;for(;g<n;){const w=f.index;if(!r(f)||(g+=1,f.index===w))break}return g>=t},u),o))},"k"),oe=c((e,t)=>V(e,0,1,t),"L"),W=c((e,t)=>V(e,0,1/0,t),"$"),We=c((e,t)=>V(e,1,1/0,t),"Re"),C=c((e,t)=>{const n=e.map(N);return J(H(se(o=>{for(let r=0,u=n.length;r<u;r++)if(!n[r](o))return!1;return!0}),t))},"x"),R=c((e,t)=>{const n=e.map(N);return J(H(o=>{for(let r=0,u=n.length;r<u;r++)if(n[r](o))return!0;return!1},t))},"p"),se=c((e,t=!0,n=!1)=>{const o=N(e);return t?r=>{const u=r.index,f=r.output.length,g=o(r);return!g&&!n&&(r.indexBacktrackMax=Math.max(r.indexBacktrackMax,r.index)),(!g||n)&&(r.index=u,r.output.length!==f&&(r.output.length=f)),g}:o},"q"),H=c((e,t)=>{const n=N(e);return t?o=>{if(o.options.silent)return n(o);const r=o.output.length;if(n(o)){const u=o.output.splice(r,1/0),f=t(u);return j(f)||o.output.push(f),!0}else return!1}:n},"B"),J=(()=>{let e=0;return t=>{const n=N(t),o=e+=1;return r=>{var u;if(r.options.memoization===!1)return n(r);const f=r.index,g=(u=r.cache)[o]||(u[o]={indexMax:-1,queue:[]}),w=g.queue;if(f<=g.indexMax){const F=g.store||(g.store=new Map);if(w.length){for(let z=0,Gt=w.length;z<Gt;z+=2){const Yt=w[z*2],Kt=w[z*2+1];F.set(Yt,Kt)}w.length=0}const E=F.get(f);if(E===!1)return!1;if(ze(E))return r.index=E,!0;if(E)return r.index=E.index,E.output?.length&&r.output.push(...E.output),!0}const B=r.output.length,Jt=n(r);if(g.indexMax=Math.max(g.indexMax,f),Jt){const F=r.index,E=r.output.length;if(E>B){const z=r.output.slice(B,E);w.push(f,{index:F,output:z})}else w.push(f,F);return!0}else return w.push(f,!1),!1}}})(),ae=c(e=>{let t;return n=>(t||(t=N(e())),t(n))},"G"),N=Fe(e=>{if(P(e))return Ce(e)?ae(e):e;if(te(e)||Pe(e))return p(e);if(ee(e))return C(e);if(Te(e))return R(Object.values(e));throw new Error("Invalid rule")}),k=c(e=>e,"d"),Ve=c(e=>typeof e=="string","ke"),He=c(e=>{const t=new WeakMap,n=new WeakMap;return(o,r)=>{const u=r?.partial?n:t,f=u.get(o);if(f!==void 0)return f;const g=e(o,r);return u.set(o,g),g}},"Be"),Je=c(e=>{const t={},n={};return(o,r)=>{const u=r?.partial?n:t;return u[o]??(u[o]=e(o,r))}},"Pe"),Ge=p(/\\./,k),Ye=p(/./,k),Ke=p(/\*\*\*+/,"*"),Qe=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),Xe=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),et=W(R([Ge,Ke,Qe,Xe,Ye])),tt=et,nt=c(e=>ne(e,tt,{memoization:!1}).join(""),"Ie"),rt=nt,ie="abcdefghijklmnopqrstuvwxyz",ot=c(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ie[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),ue=c(e=>{let t=0;for(let n=0,o=e.length;n<o;n++)t=t*26+ie.indexOf(e[n])+1;return t},"V"),G=c((e,t)=>{if(t<e)return G(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),st=c((e,t,n)=>G(e,t).map(o=>String(o).padStart(n,"0")),"qe"),ce=c((e,t)=>G(ue(e),ue(t)).map(ot),"W"),v=c(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),U=c(e=>({children:e}),"y"),I=(()=>{const e=c((t,n,o)=>{if(o.has(t))return;o.add(t);const{children:r}=t;if(!r.length)r.push(n);else for(let u=0,f=r.length;u<f;u++)e(r[u],n,o)},"e");return t=>{if(!t.length)return U([]);for(let n=t.length-1;n>=1;n--){const o=new Set,r=t[n-1],u=t[n];e(r,u,o)}return t[0]}})(),O=c(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),at=p(/\\./,v),it=p(/[$.*+?^(){}[\]\|]/,e=>v(`\\${e}`)),ut=p(/[\\\/]/,O),ct=p(/[^$.*+?^(){}[\]\|\\\/]+/,v),lt=p(/^(?:!!)*!(.*)$/,(e,t)=>v(`(?!^${xe.compile(t).source}$).*?`)),ft=p(/^(!!)+/),pt=R([lt,ft]),dt=p(/\/(\*\*\/)+/,()=>U([I([O(),v(".+?"),O()]),O()])),gt=p(/^(\*\*\/)+/,()=>U([v("^"),I([v(".*?"),O()])])),ht=p(/\/(\*\*)$/,()=>U([I([O(),v(".*?")]),v("$")])),mt=p(/\*\*/,()=>v(".*?")),le=R([dt,gt,ht,mt]),xt=p(/\*\/(?!\*\*\/|\*$)/,()=>I([v("[^\\\\/]*?"),O()])),$t=p(/\*/,()=>v("[^\\\\/]*")),fe=R([xt,$t]),pe=p("?",()=>v("[^\\\\/]")),vt=p("[",k),wt=p("]",k),bt=p(/[!^]/,"^\\\\/"),yt=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,k),_t=p(/\\./,k),Rt=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Et=p(/[\\\/]/,"\\\\/"),jt=p(/[^$.*+?^(){}[\]\|\\\/]+/,k),Nt=R([_t,Rt,Et,yt,jt]),de=C([vt,oe(bt),W(Nt),wt],e=>v(e.join(""))),Ot=p("{","(?:"),kt=p("}",")"),Mt=p(/(\d+)\.\.(\d+)/,(e,t,n)=>st(+t,+n,Math.min(t.length,n.length)).join("|")),St=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>ce(t,n).join("|")),At=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>ce(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),Ct=R([Mt,St,At]),ge=C([Ot,Ct,kt],e=>v(e.join(""))),It=p("{"),zt=p("}"),Tt=p(","),Pt=p(/\\./,v),Ut=p(/[$.*+?^(){[\]\|]/,e=>v(`\\${e}`)),Bt=p(/[\\\/]/,O),Ft=p(/[^$.*+?^(){}[\]\|\\\/,]+/,v),qt=ae(()=>me),Dt=p("",()=>v("(?:)")),Zt=We(R([le,fe,pe,de,ge,qt,Pt,Ut,Bt,Ft]),I),he=R([Zt,Dt]),me=C([It,oe(C([he,W(C([Tt,he]))])),zt],U),Lt=W(R([pt,le,fe,pe,de,ge,me,at,it,ut,ct]),I),Wt=Lt,Vt=c(e=>ne(e,Wt,{memoization:!1})[0],"kr"),Ht=Vt,Y=c((e,t,n)=>Y.compile(e,n).test(t),"N");Y.compile=(()=>{const e=Je((n,o)=>Me(Ht(rt(n)),o)),t=He((n,o)=>Ae(n.map(r=>e(r,o))));return(n,o)=>Ve(n)?e(n,o):t(n,o)})();var xe=Y;return d($)})();return s.default||s},"_lazyMatch"),K;const ln=c((s,a)=>(K||(K=ve(),ve=null),K(s,a)),"default");var fn=Object.defineProperty,pn=X((s,a)=>fn(s,"name",{value:a,configurable:!0}),"t$1");const dn=/^[A-Z]:\//i,M=pn((s="")=>s&&s.replaceAll("\\","/").replace(dn,a=>a.toUpperCase()),"normalizeWindowsPath");var gn=Object.defineProperty,_=X((s,a)=>gn(s,"name",{value:a,configurable:!0}),"r");const hn=/^[/\\]{2}/,mn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,_e=/^[A-Z]:$/i,we=/^\/([A-Z]:)?$/i,xn=/.(\.[^./]+)$/,$n=/^[/\\]|^[a-z]:[/\\]/i,vn=/\/$/,wn=_(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),Re=_((s,a)=>{let i="",l=0,h=-1,m=0,x;for(let d=0;d<=s.length;++d){if(d<s.length)x=s[d];else{if(x==="/")break;x="/"}if(x==="/"){if(!(h===d-1||m===1))if(m===2){if(i.length<2||l!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const $=i.lastIndexOf("/");$===-1?(i="",l=0):(i=i.slice(0,$),l=i.length-1-i.lastIndexOf("/")),h=d,m=0;continue}else if(i.length>0){i="",l=0,h=d,m=0;continue}}a&&(i+=i.length>0?"/..":"..",l=2)}else i.length>0?i+=`/${s.slice(h+1,d)}`:i=s.slice(h+1,d),l=d-h-1;h=d,m=0}else x==="."&&m!==-1?++m:m=-1}return i},"normalizeString"),Z=_(s=>mn.test(s),"isAbsolute"),Ee=_(function(s){if(s.length===0)return".";s=M(s);const a=hn.exec(s),i=Z(s),l=s.at(-1)==="/";return s=Re(s,!i),s.length===0?i?"/":l?"./":".":(l&&(s+="/"),_e.test(s)&&(s+="/"),a?i?`//${s}`:`//./${s}`:i&&!Z(s)?`/${s}`:s)},"normalize"),bn=_((...s)=>{let a="";for(const i of s)if(i)if(a.length>0){const l=a.at(-1)==="/",h=i[0]==="/";l&&h?a+=i.slice(1):a+=l||h?i:`/${i}`}else a+=i;return Ee(a)},"join"),Q=_(function(...s){s=s.map(l=>M(l));let a="",i=!1;for(let l=s.length-1;l>=-1&&!i;l--){const h=l>=0?s[l]:wn();!h||h.length===0||(a=`${h}/${a}`,i=Z(h))}return a=Re(a,!i),i&&!Z(a)?`/${a}`:a.length>0?a:"."},"resolve");_(function(s){return M(s)},"toNamespacedPath");const yn=_(function(s){return xn.exec(M(s))?.[1]??""},"extname");_(function(s,a){const i=Q(s).replace(we,"$1").split("/"),l=Q(a).replace(we,"$1").split("/");if(l[0][1]===":"&&i[0][1]===":"&&i[0]!==l[0])return l.join("/");const h=[...i];for(const m of h){if(l[0]!==m)break;i.shift(),l.shift()}return[...i.map(()=>".."),...l].join("/")},"relative");const je=_(s=>{const a=M(s).replace(vn,"").split("/").slice(0,-1);return a.length===1&&_e.test(a[0])&&(a[0]=`${a[0]}/`),a.join("/")||(Z(s)?"/":".")},"dirname");_(function(s){const a=[s.root,s.dir,s.base??s.name+s.ext].filter(Boolean);return M(s.root?Q(...a):a.join("/"))},"format");const _n=_((s,a)=>{const i=M(s).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");_(function(s){const a=$n.exec(s)?.[0]?.replaceAll("\\","/")??"",i=_n(s),l=yn(i);return{base:i,dir:je(s),ext:l,name:i.slice(0,i.length-l.length),root:a}},"parse");_((s,a)=>ln(a,Ee(s)),"matchesGlob");let D=class extends on{constructor(a,i="UPDATE_NOTIFIER_ERROR",l){super(a,i,l),this.name="UpdateNotifierError"}};const Rn="last-update-check.json",Ne=s=>{const a=rn(s);if(a===void 0)throw new D("Could not find cache directory","CACHE_DIRECTORY_NOT_FOUND",{packageName:s});return bn(a,Rn)},En=s=>{const a=Ne(s);try{if(!ye(a))return;const{lastUpdateCheck:i}=JSON.parse(en(a,"utf8"));return i}catch{return}},jn=s=>{const a=Ne(s),i=je(a);ye(i)||tn(i,{recursive:!0}),nn(a,JSON.stringify({lastUpdateCheck:Date.now()}))},Nn=async(s,a,i)=>{const l=i.replace("__NAME__",s),h=512*1024;return await new Promise((m,x)=>{sn(l,d=>{if(d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)){x(new D(`Unexpected status code ${String(d.statusCode)}`,"VERSION_FETCH_ERROR",{distributionTag:a,packageName:s})),d.resume();return}let $="",b=!1;d.on("data",y=>{b||($+=String(y),$.length>h&&(b=!0,x(new D("Response too large","VERSION_FETCH_ERROR",{distributionTag:a,packageName:s})),d.destroy()))}),d.on("end",()=>{if(!b)try{const y=JSON.parse($)[a];if(!y){x(new D("Error getting version","VERSION_FETCH_ERROR",{distributionTag:a,packageName:s}));return}m(y)}catch{x(new D("Could not parse version response","VERSION_PARSE_ERROR",{distributionTag:a,packageName:s}))}})}).on("error",d=>{x(d)})})},An=async({alwaysRun:s,debug:a,distTag:i="latest",pkg:l,registryUrl:h="https://registry.npmjs.org/-/package/__NAME__/dist-tags",updateCheckInterval:m=1e3*60*60*24})=>{const x=En(l.name);if(s||!x||x<Date.now()-m){const d=await Nn(l.name,i,h);if(jn(l.name),an(d,l.version))return d;a&&console.error(`Latest version (${d}) not newer than current version (${l.version})`)}else a&&console.error(`Too recent to check for a new update. simpleUpdateNotifier() interval set to ${String(m)}ms but only ${String(Date.now()-x)}ms since last check.`)};export{An as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{createRequire as lt}from"node:module";import{VERBOSITY_DEBUG as q,POSITIONALS_KEY as te,VERBOSITY_QUIET as gt,VERBOSITY_VERBOSE as wt,VERBOSITY_NORMAL as ve}from"./VERBOSITY_QUIET-XPultrIA.js";import{t as A}from"./cerebro-error-etNTKvnJ.js";import{d as j,f as me,o as be,e as G,b as yt,c as vt,g as bt,h as $t,i as Ot}from"./runtime-process-hJz7FqPN.js";import{E as ie}from"./isVisulimaError-jVZgumOU-C67qeq6-.js";import{distance as At}from"fastest-levenshtein";import{Y as Ct,h as _t,k as ne,n as B,H as W,J as L,T as re,j as $e,_ as Oe,q as kt,C as Ae,A as xt,f as Ne,z as Ce,G as _e,L as It,b as Lt,K as Et,O as Pt,D as Ut,V as Mt,W as Dt,N as Tt,U as Vt,X as St,I as jt,Z as Bt,P as Rt,M as zt,v as Wt,Q as Ft}from"./constants-CImsldtV-Ces7vzH9.js";const ct=lt(import.meta.url),J=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ze=t=>{if(typeof J<"u"&&J.versions&&J.versions.node){const[e,n]=J.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return J.getBuiltinModule(t)}return ct(t)},{writeFile:ut,stat:ht,rm:pt,readFile:ye,readdir:ft,mkdir:dt,access:mt}=ze("node:fs/promises"),{createRequire:Nt}=ze("node:module"),X=[{alias:"v",description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];let T=class extends A{commandName;constructor(e,n=[]){const i=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(i,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}},We=class extends A{option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}},qt=class extends A{pluginName;constructor(e,n,i){super(`Plugin "${e}" error: ${n}`,"PLUGIN_ERROR",{originalError:i,pluginName:e}),this.name="PluginError",this.pluginName=e,i&&(this.cause=i)}},Gt=class{logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(e){this.logger=e}hasPlugins(){return this.plugins.size>0}register(e){if(this.initialized)throw new Error(`Cannot register plugin "${e.name}" after initialization`);if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);j().CEREBRO_OUTPUT_LEVEL===String(q)&&this.logger.debug(`registering plugin: ${e.name}`),this.plugins.set(e.name,e),this.cachedDependencyOrder=void 0}async init(e){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const n=this.getDependencyOrder();this.logger.debug(`initializing ${String(n.length)} plugin(s)...`);for(const i of n)if(typeof i.init=="function"){this.logger.debug(`initializing plugin: ${i.name}`);try{await i.init(e)}catch(s){const o=new qt(i.name,`Failed to initialize: ${s instanceof Error?s.message:String(s)}`,s instanceof Error?s:void 0);throw this.logger.error(o.message),o}}this.initialized=!0}async executeLifecycle(e,n,i){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const s=this.getDependencyOrder();for(const o of s){const c=o[e];if(typeof c=="function"){this.logger.debug(`executing ${e} hook for plugin: ${o.name}`);try{await(e==="afterCommand"?c(n,i):c(n))}catch(r){throw this.logger.error(`Error in ${e} hook for plugin "${o.name}":`,r),r}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const i=this.getDependencyOrder();for(const s of i)if(typeof s.onError=="function"){this.logger.debug(`executing error handler for plugin: ${s.name}`);try{await s.onError(e,n)}catch(o){this.logger.error(`Error in error handler for plugin "${s.name}":`,o)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,i=new Set,s=o=>{if(n.has(o))return;if(i.has(o))throw new Error(`Circular dependency detected involving plugin "${o}"`);const c=this.plugins.get(o);if(!c)throw new Error(`Plugin "${o}" not found`);if(i.add(o),c.dependencies)for(const r of c.dependencies)s(r);i.delete(o),n.add(o),e.push(c)};for(const o of this.plugins.keys())s(o);return this.cachedDependencyOrder=e,e}validateDependencies(){for(const e of this.plugins.values())if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin "${e.name}" depends on "${n}" which is not registered`)}}};const Z=t=>t.type?.name==="Boolean",Kt=t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},ke=t=>(Z(t)||(t.typeLabel=t.typeLabel??Kt(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),Ht=new RegExp(/^-([^\d-])$/),Yt=new RegExp(/^--(\S+)/),Jt=new RegExp(/^-([^\d-]{2,})$/),Qt=t=>Ht.test(t)||Yt.test(t)||Jt.test(t),Zt=(t,e)=>{const n=e[0]&&Qt(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const i=new Error(`Command not recognised: ${String(n)}`);throw i.command=n,i.name="INVALID_COMMAND",i}return{argv:e,command:n}};var Xt=Object.defineProperty,Fe=(t,e)=>Xt(t,"name",{value:e,configurable:!0}),en=Object.defineProperty,tn=Fe((t,e)=>en(t,"name",{value:e,configurable:!0}),"i");let nn=class qe extends ie{static{Fe(this,"t")}static{tn(this,"AlreadySetError")}optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,qe.prototype)}};var on=Object.defineProperty,Ge=(t,e)=>on(t,"name",{value:e,configurable:!0}),sn=Object.defineProperty,an=Ge((t,e)=>sn(t,"name",{value:e,configurable:!0}),"e");class oe extends ie{static{Ge(this,"o")}static{an(this,"UnknownOptionError")}optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,oe.prototype)}}var rn=Object.defineProperty,Ke=(t,e)=>rn(t,"name",{value:e,configurable:!0}),ln=Object.defineProperty,cn=Ke((t,e)=>ln(t,"name",{value:e,configurable:!0}),"o");let un=class He extends ie{static{Ke(this,"e")}static{cn(this,"UnknownValueError")}value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,He.prototype)}};var hn=Object.defineProperty,Ye=(t,e)=>hn(t,"name",{value:e,configurable:!0}),pn=Object.defineProperty,fn=Ye((t,e)=>pn(t,"name",{value:e,configurable:!0}),"i");let E=class Je extends ie{static{Ye(this,"e")}static{fn(this,"InvalidDefinitionsError")}constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,Je.prototype)}};var dn=Object.defineProperty,H=(t,e)=>dn(t,"name",{value:e,configurable:!0}),mn=Object.defineProperty,se=H((t,e)=>mn(t,"name",{value:e,configurable:!0}),"o");const xe=se(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),Ie=se(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),Le=se(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),gn=se((t,e)=>Array.isArray(t)?xe(e)?t.map(Boolean):Ie(e)?t.map(Number):Le(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:xe(e)?!!t:Ie(e)?Number(t):Le(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t)),"convertValue");var wn=Object.defineProperty,yn=H((t,e)=>wn(t,"name",{value:e,configurable:!0}),"e");const x=yn((t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},"debug");var vn=Object.defineProperty,z=H((t,e)=>vn(t,"name",{value:e,configurable:!0}),"x$2");const bn=/-([a-z])/g,$n=/^\d+$/,le=z(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),On=z(t=>t.codePointAt(0)===95,"isSpecialKey"),Ee=z((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),Pe=z(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),Ue=z((t,e,n,i=!1)=>{t[e]===void 0?t[e]=i?[n]:n:i&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},"createOrAppendArray"),An=z((t,e,n,i,s)=>{let o=e.get(t)??n.get(t);if(!o&&i){const c=t.toLowerCase();o=i.get(c)??s?.get(c)}return o},"getDefinition"),Nn=z((t,e,n,i)=>{const s=n.debug??!1;x(s,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),x(s,"Starting argument resolution","resolver"),x(s,"Tokens:","resolver",t),x(s,"Definitions:","resolver",e),x(s,"Processing tokens...","resolver");const o=new Map,c=new Map,r=n.caseInsensitive?new Map:void 0,g=n.caseInsensitive?new Map:void 0,a=n.camelCase?new Map:void 0,u=n.camelCase?new Map:void 0;for(const h of e)if(o.set(h.name,h),h.alias&&c.set(h.alias,h),n.caseInsensitive&&r&&(r.set(h.name.toLowerCase(),h),h.alias&&g&&g.set(h.alias.toLowerCase(),h)),n.camelCase&&a&&u){const m=h.name.replaceAll(bn,(w,$)=>$.toUpperCase());a.set(h.name,m),u.set(m,h.name)}const f={},l={},d=[],p=[],v=new Set;let b=!1;const y=e.find(h=>h.defaultOption),N=e.some(h=>h.group),C=e.some(h=>h.type===Number);for(let h=0;h<t.length;h++){const m=t[h];if(m.kind==="option-terminator"){f._unknown=i.slice(m.index),b=!0;break}if(m.kind==="option"&&m.name){let w=An(m.name,o,c,r,g);if(!w&&m.value===void 0&&C&&$n.test(m.name)){const _=e.find(U=>U.type===Number);_&&(w=_,m.value=m.name,m.name=_.name)}const $=w?w.name:m.name,O=w?.multiple,P=w?.lazyMultiple;if(l[$]!==void 0&&!O&&!P&&!n.partial)throw new nn($);if(!w&&n.partial){const _=m.rawName??`--${m.name}${m.value!==void 0&&m.inlineValue?`=${m.value}`:""}`;d.push({index:m.index,value:_});continue}if(!w&&n.stopAtFirstUnknown){f._unknown=i.slice(m.index);break}if(!w&&!n.partial)throw new oe(m.name);if(m.value===void 0){const _=t[h+1],U=_?.kind==="option"&&!("name"in _)&&_.value!==void 0,I=_&&w&&!(w.type&&le(w.type))&&(_.kind==="positional"||U),rt=w&&w.defaultOption&&!w.multiple&&!w.lazyMultiple;if(I&&(!w?.defaultOption||rt))if(O){let M=h+1;const ae=[];for(;M<t.length&&(t[M].kind==="positional"||t[M].kind==="option"&&!("name"in t[M])&&t[M].value!==void 0);)ae.push(t[M].value),v.add(t[M].index),M++;l[$]=l[$]===void 0?ae:Ee(l[$],ae),h=M-1}else P?(Ue(l,$,_.value,!0),v.add(_.index),h++):(l[$]=_.value,v.add(_.index),h++);else w?.type&&le(w.type)?Ue(l,$,!0,O):l[$]=O?[]:null}else{let{value:_}=m;if(w?.type&&le(w.type))switch(_){case"":{if(n.partial){l._unknown??=[];const I=`${m.rawName??`--${m.name}`}${m.value?`=${m.value}`:""}`;l._unknown.push(I),p.push({index:m.index,value:I}),_=!0}else throw new oe(m.name);break}case"false":{_=!1;break}case"true":{_=!0;break}default:_=!0}const U=[_];if(O){let I=h+1;for(;I<t.length&&t[I].kind==="positional";)U.push(t[I].value),v.add(t[I].index),I++;h=I-1}l[$]===void 0?l[$]=O||P?U:_:O||P?l[$]=Ee(l[$],U):l[$]=_}}else if(m.kind==="positional"&&n.stopAtFirstUnknown&&!v.has(m.index)&&!y){x(s,`Found unconsumed positional token at index ${String(m.index)}, stopping processing`,"resolver"),f._unknown=i.slice(m.index);break}}for(const[h,m]of Object.entries(l)){const w=o.get(h);w&&(w.multiple||w.lazyMultiple)&&!Array.isArray(m)&&(l[h]=[m])}let k=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!b){for(const h of t)if(h.kind==="option"&&!o.has(h.name??"")&&!c.has(h.name??"")&&(!n.caseInsensitive||!r?.has(h.name?.toLowerCase()??"")&&!g?.has(h.name?.toLowerCase()??""))){k=h.index;break}}if(y){const h=[],m=[];for(const w of t)w.kind==="positional"&&!v.has(w.index)&&w.index<k&&(h.push(w.value),m.push(w));if(h.length>0){const w=l[y.name],$=y.multiple??y.lazyMultiple;w===void 0?$?(m.forEach(O=>v.add(O.index)),l[y.name]=h):(v.add(m[0].index),l[y.name]=h[0]):$&&(m.forEach(O=>v.add(O.index)),l[y.name]=Array.isArray(w)?[...h,...w]:[...h,w])}}if(!n.partial){for(const h of t)if(h.kind==="positional"&&!v.has(h.index))throw new un(i[h.index])}if(n.partial&&!n.stopAtFirstUnknown){const h=[...d];if(l._unknown)for(const m of p)h.push({index:m.index,value:m.value});for(const m of t)m.kind==="positional"&&!v.has(m.index)&&h.push({index:m.index,value:i[m.index]});h.length>0&&(h.sort((m,w)=>m.index-w.index),f._unknown=h.map(m=>m.value))}if(n.stopAtFirstUnknown&&!b){const h=t.findIndex($=>$.kind==="option"&&!o.has($.name??"")&&!c.has($.name??"")&&(!n.caseInsensitive||!r?.has($.name?.toLowerCase()??"")&&!g?.has($.name?.toLowerCase()??""))),m=t.findIndex($=>$.kind==="positional"&&!v.has($.index));let w=-1;if(h!==-1&&m!==-1?w=Math.min(h,m):h!==-1?w=h:m!==-1&&(w=m),w>=0){const $=t[w].index;f._unknown=i.slice($)}}else d.length>0&&!n.partial&&(f._unknown=d.map(h=>h.value));for(const[h,m]of Object.entries(l)){const w=n.camelCase?a?.get(h)??h:h,$=o.get(h);f[w]=$?.type?gn(m,$.type):m===void 0?null:m}for(const h of e){const m=n.camelCase?a?.get(h.name)??h.name:h.name;!(m in f)&&h.defaultValue!==void 0&&(h.multiple??h.lazyMultiple?f[m]=Array.isArray(h.defaultValue)?[...h.defaultValue]:[h.defaultValue]:f[m]=h.defaultValue)}if(N){const h={},m={},w={};for(const O of e)if(O.group){const P=Array.isArray(O.group)?O.group:[O.group];for(const _ of P)Pe(_)||(h[_]??={})}for(const O of Object.keys(f))if(!On(O)){m[O]=f[O];let P=O;n.camelCase&&(P=u?.get(O)??O);const _=o.get(P);if(_?.group){const U=Array.isArray(_.group)?_.group:[_.group];for(const I of U)Pe(I)||h[I]&&(h[I][O]=f[O])}else w[O]=f[O]}const $={_all:m};for(const[O,P]of Object.entries(h))$[O]=P;Object.keys(w).length>0&&($._none=w),f._unknown&&($._unknown=f._unknown),Object.keys(f).forEach(O=>delete f[O]),Object.assign(f,$)}return x(s,"Final parsed result:","resolver",f),f},"resolveArgs");var Cn=Object.defineProperty,Y=H((t,e)=>Cn(t,"name",{value:e,configurable:!0}),"l");const K="-".codePointAt(0),R="=",_n=R.codePointAt(0),kn="--",xn="-",In="--",Qe=Y(t=>t.length>2&&t.startsWith(In),"hasLongOptionPrefix"),Ln=Y(t=>Qe(t)&&!t.includes(R,3),"isLongOption"),En=Y(t=>Qe(t)&&t.includes(R,3),"isLongOptionAndValue"),Pn=Y(t=>{if(t.length!==2||t.codePointAt(0)!==K||t.codePointAt(1)===K)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),Un=Y(t=>!(t.length<=2||t.codePointAt(0)!==K||t.codePointAt(1)===K),"isShortOptionGroup"),Mn=Y(t=>{const e=[],n=[...t];let i=-1,s=0;for(;n.length>0;){const o=n.shift();if(o===void 0)break;if(s>0?s--:i++,o===kn){e.push({index:i,kind:"option-terminator"});const c=n.map((r,g)=>({index:i+g+1,kind:"positional",value:r}));e.push(...c),i+=n.length;break}if(Pn(o)){const c=o.charAt(1);e.push({index:i,kind:"option",name:c,rawName:o});continue}if(Un(o)&&!o.includes(R)){const c=[];let r="",g=!1;for(let a=1;a<o.length;a++){const u=o.charAt(a);g?r+=u:u.codePointAt(0)===_n?g=!0:c.push(`${xn}${u}`)}if(g)if(c.length>0){const a=c.pop();c.push(`${a}=${r}`)}else c.push(r);n.unshift(...c),s=c.length;continue}if(Ln(o)){const c=o.slice(2);e.push({index:i,kind:"option",name:c,rawName:o});continue}if(En(o)){const c=o.indexOf(R),r=o.slice(2,c),g=o.slice(c+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:o,value:g});continue}if(o.length>2&&o.codePointAt(0)===K&&o.codePointAt(1)!==K&&o.includes(R)){const c=o.indexOf(R),r=o.charAt(1),g=o.slice(c+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:o,value:g});continue}e.push({index:i,kind:"positional",value:o})}return e},"parseArgsTokens");var Dn=Object.defineProperty,we=H((t,e)=>Dn(t,"name",{value:e,configurable:!0}),"d");const Tn=/\d/,Vn=we(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),Sn=we(t=>typeof t=="function","isValidCustomTypeFunction"),jn=we((t,e,n)=>{const i=n?.debug??!1;x(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const s=new Set,o=new Set,c=new Set,r=new Set;let g=0;for(const a of t){if(x(i,"Checking definition:","validation",a),!a.name)throw x(i,"Validation failed: name is required","validation"),new E("Invalid option definition: name is required");if(typeof a.name!="string")throw new E("Invalid option definition: name must be a string");if(a.name.trim()==="")throw new E("Invalid option definition: name cannot be empty");const u=e?a.name.toLowerCase():"";if(s.has(a.name)||e&&c.has(u))throw new E(`Invalid option definition: duplicate name '${a.name}'`);if(o.has(a.name)||e&&r.has(u))throw new E(`Invalid option definition: name '${a.name}' conflicts with an existing alias`);if(s.add(a.name),e&&c.add(u),a.alias!==void 0){if(typeof a.alias!="string")throw new E("Invalid option definition: alias must be a string");if(a.alias.length!==1)throw new E("Invalid option definition: alias must be a single character");if(Tn.test(a.alias))throw new E("Invalid option definition: alias cannot be numeric");if(a.alias==="-")throw new E('Invalid option definition: alias cannot be "-"');const f=e?a.alias.toLowerCase():"";if(o.has(a.alias)||e&&r.has(f))throw new E(`Invalid option definition: duplicate alias '${a.alias}'`);if(s.has(a.alias)||e&&c.has(f))throw new E(`Invalid option definition: alias '${a.alias}' conflicts with an existing option name`);o.add(a.alias),e&&r.add(f)}if(a.defaultOption&&(g++,a.type!==void 0&&Vn(a.type)))throw new E("Invalid option definition: defaultOption cannot be Boolean type");if(a.type!==void 0&&!(a.type===Boolean||a.type===Number||a.type===String||typeof a.type=="function"&&Sn(a.type)))throw new E("Invalid option definition: invalid type")}if(g>1)throw x(i,"Validation failed: multiple defaultOptions not allowed","validation"),new E("Invalid option definition: multiple defaultOptions not allowed");x(i,"Validation completed successfully","validation")},"validateDefinitions");var Bn=Object.defineProperty,Rn=H((t,e)=>Bn(t,"name",{value:e,configurable:!0}),"O");const zn=Rn((t,e={})=>{const n=e.debug??!1;x(n,"Starting command-line-args parsing","index"),x(n,"Options:","index",e);const i={...e};i.stopAtFirstUnknown&&(i.partial=!0);const s=Array.isArray(t)?t:[t];x(n,"Normalized definitions:","index",s),jn(s,i.caseInsensitive,n?i:void 0);let{argv:o}=i;if(!o&&(o=process.argv.slice(2),process.execArgv.length>0)){const a=new Set(process.execArgv);o=o.filter(u=>!a.has(u))}x(n,"Using argv:","index",o);let c=o;i.caseInsensitive&&(c=o.map(a=>{if(a.startsWith("--")){const u=a.indexOf("="),f=(u===-1?a.slice(2):a.slice(2,u)).toLowerCase();return u===-1?`--${f}`:`--${f}${a.slice(u)}`}if(a.startsWith("-")&&!a.startsWith("--")&&a.length>1){const u=a.slice(1).split("=",2),f=u[0],l=u[1];if(!f)return a;const d=f.toLowerCase();return l===void 0?`-${d}`:`-${d}=${l}`}return a}));const r=Mn(c.map(String));x(n,"Tokenized arguments:","index",r);const g=Nn(r,s,i,o);return x(n,"Command-line-args parsing completed","index"),g},"commandLineArgs");class Wn{result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let ce=class extends A{commandName;constructor(e,n,i){super(`Failed to load command "${e}": ${n}`,"COMMAND_LOADER_ERROR",{commandName:e,reason:n}),this.name="CommandLoaderError",this.commandName=e,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",i!==void 0&&(this.cause=i)}};const Fn=/^-{1,2}(\w+)(=(.+))?$/,Ze=(t,e,n,i)=>{const s=Fn.exec(t);if(s===null)return{};const o=s[1];if(!o)return{};const c=n&&i?n.get(o)??i.get(o):e.find(r=>r.name===o||r.alias===o);return c!==void 0?{argName:c.name,argValue:s[3],option:c}:{}},Me=(t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},qn=new Set(["0","1","false","true"]),Gn=(t,e,n,i)=>{if(e.length===0||t.length===0)return{};const s=(o,c)=>{const{argName:r,argValue:g,option:a}=Ze(c,e,n,i),{lastOption:u}=o;return a&&Z(a)&&g&&r?o.partial[r]=Me(g,a):o.lastName&&u&&Z(u)&&qn.has(c)&&(o.partial[o.lastName]=Me(c,u)),{lastName:r,lastOption:a,partial:o.partial}};return t.reduce(s,{partial:{}}).partial},Kn=new Set(["0","1","false","true"]),Hn=(t,e,n,i)=>{if(e.length===0||t.length===0)return t;const s=(o,c)=>{const{argValue:r,option:g}=Ze(c,e,n,i),{lastOption:a}=o;if(a&&Z(a)&&Kn.has(c)){const{args:u}=o;return{args:u.slice(0,-1)}}return g&&Z(g)&&r?{args:o.args}:{args:[...o.args,c],lastOption:g}};return t.reduce(s,{args:[]}).args},De=t=>{const e=new Map;for(const n of t){const i=e.get(n.name);i?e.set(n.name,{...i,...n}):e.set(n.name,n)}return[...e.values()]},Yn=t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},Jn=(t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return Yn(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},Qn=/_./g,Zn=/^[A-Z]/,Xn=t=>t.toLowerCase().replaceAll(Qn,e=>e[1]?.toUpperCase()??e).replace(Zn,e=>e.toLowerCase()),eo=t=>{if(!t||t.length===0)return{};const e={},n=j();for(const i of t){const s=n[i.name],o=Jn(i,s),c=o===void 0?i.defaultValue:o,r=Xn(i.name);e[r]=c}return e},to=t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const s=Array.isArray(i.alias)?i.alias:[i.alias];for(const o of s)n.set(o,i)}return{optionMapByAlias:n,optionMapByName:e}},Xe=async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new ce(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new ce(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new ce(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},no=(t,e,n,i)=>{const s=new Wn(t.name,t),{_all:o,_unknown:c,positionals:r}=e,g=Object.keys(n).length>0?{...o,...n}:o;te in g&&delete g[te],s.argument=r?.[te]??[],s.rawUnknown=[...c??[]];const a=Object.keys(i).length>0;return s.options=a?{...g,...i}:g,s.env=eo(t.env),s},oo=(t,e,n)=>{const i=t.options??[],s=i.length>0;let o=De(s?[...i,...n]:n);if(o.length>0){for(const a of o)if(a.multiple&&a.lazyMultiple)throw new Error(`Argument "${a.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(o=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:te,type:t.argument.type,typeLabel:t.argument.typeLabel},...o]);let c,r;if(s){const{optionMapByAlias:a,optionMapByName:u}=to(i);c=Hn(e,i,u,a),r=Gn(e,i,u,a)}else c=e,r={};const g=zn(o,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:o,booleanValues:r,parsedArgs:g}},F=async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await Xe(t))(e);let io=class extends A{commandName;missingOptions;constructor(e,n){super(`Command "${e}" is missing required options: ${n.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:e,missingOptions:n}),this.name="CommandValidationError",this.commandName=e,this.missingOptions=n,this.hint=`Provide the following required options: ${n.join(", ")}`}};const Te=(t,e,n=!1)=>{const i=[];for(const s of t)if(!(!n&&!s.required)&&e[s.name]===void 0){if(s.type?.name==="Boolean"){e[s.name]=!1;continue}i.push(s)}return i},so=(t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:At(t,e)<=t.length/3,S=(t,e)=>{const n=t.toLowerCase();return e.filter(i=>so(i.toLowerCase(),n))},ao=(t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const s=i.startsWith("--");let o=`Found unknown ${s?"option":"argument"} "${i}"`;if(s){const c=S(i.replace("--",""),(e.options??[]).map(r=>r.name));if(c.length>0){const[r,...g]=c.map(a=>`--${a}`);o+=g.length>0?`, did you mean ${r??""} or ${g.join(", ")}?`:`, did you mean ${r??""}?`}}n.push(o)}),n.length>0)throw new Error(n.join(`
|
|
2
|
+
`))},ro=(t,e,n)=>{const i=n.__requiredOptions__,s=i?Te(i,e,!0):Te(t,e,!1);if(s.length>0)throw new io(n.name,s.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&ao(e,n)},lo=(t,e,n)=>{const i=n.__conflictingOptions__??t.filter(s=>s.conflicts!==void 0);if(i.length>0){const s=i.find(o=>Array.isArray(o.conflicts)?o.conflicts.some(c=>e[c]!==void 0)&&e[o.name]!==void 0:e[o.conflicts]!==void 0&&e[o.name]!==void 0);if(s)throw new We(s.name,typeof s.conflicts=="string"?s.conflicts:s.conflicts?.[0]??"unknown")}},co=t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const s of t.options){if(s.name){const o=e.get(s.name)??[];o.push(s),e.set(s.name,o)}if(typeof s.alias=="string"&&s.alias.length>0){const o=n.get(s.alias)??[];o.push(s),n.set(s.alias,o)}else if(Array.isArray(s.alias)){for(const o of s.alias)if(o.length>0){const c=n.get(o)??[];c.push(s),n.set(o,c)}}}const i=[];for(const[s,o]of e)o.length>1&&i.push(`Duplicate option name "${s}" in command "${t.name}": ${JSON.stringify(o)}`);for(const[s,o]of n)o.length>1&&i.push(`Duplicate option alias "-${s}" used by options ${o.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
|
|
3
|
+
`))},uo=(t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let s=1;s<=e.length;s+=1){const o=e[s-1];if(o===void 0||o.startsWith("-"))break;n.push(o);const c=n.join(" ");t.has(c)&&(i={commandPath:[...n],depth:s})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},V=t=>t.join(" "),Ve=(t,e)=>e&&e.length>0?[...e,t]:[t];class ho{capacity;cache;constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const i=this.cache.keys().next().value;i!==void 0&&this.cache.delete(i)}this.cache.set(e,n)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}}const po=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),fo=Nt(import.meta.url),Q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,mo=t=>{if(typeof Q<"u"&&Q.versions&&Q.versions.node){const[e,n]=Q.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return Q.getBuiltinModule(t)}return fo(t)},{stripVTControlCharacters:go}=mo("node:util"),ue=new ho(1e3),wo=/[.*+?^${}()|[\]\\]/g,yo=t=>{const e=t.join("");if(ue.has(e)){const s=ue.get(e);return s.lastIndex=0,s}const n=t.map(s=>s.replaceAll(wo,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return ue.set(e,i),i},vo=t=>{const e=[];let n=0,i;for(B.lastIndex=0;(i=B.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=B.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},bo=/[ČŠŽĐ]/i,et=new Uint8Array(128),tt=new Uint8Array(128),nt=new Uint8Array(128);for(let t=0;t<128;t++)et[t]=t>=65&&t<=90?1:0,tt[t]=t>=97&&t<=122?1:0,nt[t]=t>=48&&t<=57?1:0;const he=t=>et[t],Se=t=>tt[t],pe=t=>nt[t],D=(t,e,n,i,s)=>{if(t.length===0)return[];let o=!1;const c=Object.values(e);for(const d of c)if(d(t[0])){o=!0;break}if(!o&&!n)return[t];const r=[...t],g=[];let a=r[0],u="other";const f=Object.entries(e);for(const d of f){const[p,v]=d;if(v(r[0])){u=p;break}}let l=n&&i?r[0]===r[0].toLocaleUpperCase(i):!1;for(let d=1;d<r.length;d++){const p=r[d];let v="other";for(const N of f){const[C,k]=N;if(k(p)){v=C;break}}const b=n&&i?p===p.toLocaleUpperCase(i):!1;let y=!1;s?y=s(u,v,l,b,p,d,r):(u!==v&&u!=="other"&&v!=="other"&&(y=!0),n&&v!=="other"&&!l&&b&&(y=!0)),y?(g.push(a),a=p):a+=p,u=v,n&&(l=b)}return a&&a.length>0&&g.push(a),g.length>0?g:[t]},$o=(t,e,n,i)=>{if(n.size===0)return e;for(const s of n)if(t.startsWith(s,e))return i.push(s),e+s.length;return e},ot=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],s=t.length;for(let o=1;o<s;o++){const c=$o(t,n,e,i);if(c!==n){n=c,o=n-1;continue}const r=t.codePointAt(o-1),g=t.codePointAt(o),a=r&&r<128&&he(r),u=g&&g<128&&he(g),f=r&&r<128&&Se(r),l=r&&r<128&&pe(r),d=g&&g<128&&pe(g);if(f&&u){i.push(t.slice(n,o)),n=o;continue}if(l&&!d||!l&&d){i.push(t.slice(n,o)),n=o;continue}if(d&&!l){let p=!1,v=!1;if(o+1<s){const b=t.codePointAt(o+1);p=b&&b<128&&he(b),v=b&&b<128&&pe(b)}if(!v&&p){i.push(t.slice(n,o),t.slice(o,o+1)),n=o+1;continue}}if(o+1<s){const p=t.codePointAt(o+1),v=p&&p<128&&Se(p);if(a&&u&&v){const b=t.slice(n,o+1);e.has(b)||(i.push(t.slice(n,o)),n=o)}}}return n<s&&i.push(t.slice(n)),i.filter(o=>o!=="")},it=(t,e,n)=>{if(t.length===0)return[];const i=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!i&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const a=[...t],u=a.length,f=[];let l=a[0],d=a[0]===a[0].toLocaleUpperCase(e),p=d,v=d?0:-1;for(let b=1;b<u;b++){const y=a[b],N=y===y.toLocaleUpperCase(e);if(N===d)l+=y;else if(N)l&&l.length>0&&(f.push(l),l=y),p=!0,v=b;else{if(p&&b-v>1){const C=a[b-1],k=l.slice(0,-1);k&&k.length>0&&f.push(k),l=C+y}else l+=y;p=!1,v=-1}d=N}return l&&l.length>0&&f.push(l),f}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!L.test(t))return[t];const a=[...t],u=a.length,f=[];let l=a[0];const d=a[0];let p;W.test(d)?p=1:L.test(d)?p=2:p=0;let v=d===d.toLocaleUpperCase(e);for(let y=1;y<u;y++){const N=a[y];let C;W.test(N)?C=1:L.test(N)?C=2:C=0;const k=N===N.toLocaleUpperCase(e);p!==C&&(p===1||p===2)&&(C===1||C===2)||C===p&&!v&&k?(f.push(l),l=N):l+=N,p=C,v=k}l&&l.length>0&&f.push(l);const b=[];for(let y=0;y<f.length;y++)y<f.length-1&&f[y].length===1&&L.test(f[y])&&W.test(f[y+1][0])?(b.push(f[y]+f[y+1]),y+=1):b.push(f[y]);return b}if(e.startsWith("el")){if(!re.test(t)&&!L.test(t))return[t];const a=[];$e.lastIndex=0;let u;for(;(u=$e.exec(t))!==null;)a.push(u[0]);a.length===0&&a.push(t);const f=[];if(a.length===1){const l=a[0];if(!l||!re.test(l[0])||l.length===1)return[l??t]}for(const l of a){if(!l)continue;if(!re.test(l[0])||l.length===1){f.push(l);continue}const d=l.length;let p=l[0],v=l[0]===l[0].toLocaleUpperCase(e);for(let b=1;b<d;b++){const y=l[b],N=y===y.toLocaleUpperCase(e);!v&&N?(f.push(p),p=y):p+=y,v=N}p&&f.push(p)}return f}if(e.startsWith("ja")||e.startsWith("ko")){const a=e.startsWith("ja"),u=a?{hiragana:l=>xt.test(l),kanji:l=>Ae.test(l),katakana:l=>kt.test(l),latin:l=>L.test(l)}:{hangul:l=>Ne.test(l),latin:l=>L.test(l)},f=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(a){const l=D(t,u,!1,e,(p,v)=>p==="hiragana"&&v==="katakana"||p==="katakana"&&v==="hiragana"||p==="hiragana"&&v==="latin"||p==="katakana"&&v==="latin"||p==="kanji"&&v==="latin"||p==="latin"&&(v==="hiragana"||v==="katakana"||v==="kanji")),d=[];for(const p of l){const v=p;v.length===1&&f.has(v)&&d.length>0?d[d.length-1]=d.at(-1)+v:d.push(v)}return d.length>0?d:[t]}return D(t,u,!1,e,(l,d)=>l==="hangul"&&d==="latin"||l==="latin"&&d==="hangul")}if(e.startsWith("sl")){const a=[...t],u=a.length,f=[];let l=a[0],d=a[0]===a[0].toLocaleUpperCase(e);for(let p=1;p<u;p++){const v=a[p],b=v===v.toLocaleUpperCase(e),y=bo.test(v),N=p<u-1&&a[p+1]===a[p+1].toLocaleUpperCase(e);!d&&b||y&&N?(f.push(l),l=v,y&&N&&(f.push(l),l="")):l+=v,d=b}return l&&l.length>0&&f.push(l),f}if(e.startsWith("zh"))return D(t,{han:a=>Ae.test(a),latin:a=>L.test(a)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const a=u=>Ce.test(u)||_e.test(u);return D(t,{latin:u=>L.test(u),rtl:u=>a(u)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const a=u=>It.test(u)||Lt.test(u)||Et.test(u)||Pt.test(u)||Ut.test(u)||Mt.test(u)||Dt.test(u)||Tt.test(u)||Vt.test(u)||St.test(u)||jt.test(u)||Bt.test(u)||Rt.test(u)||zt.test(u)||Wt.test(u)||Ft.test(u);return D(t,{indic:u=>a(u),latin:u=>L.test(u)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return D(t,{cyrillic:a=>W.test(a),latin:a=>L.test(a)},!0,e);if(["ar","fa","he"].includes(e))return D(t,{latin:a=>L.test(a),rtl:a=>Ce.test(a)||_e.test(a)},!1,e);if(e.startsWith("ko"))return D(t,{hangul:a=>Ne.test(a),latin:a=>L.test(a)},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!L.test(t))return[t];const a=[...t],u=a.length,f=[];let l=a[0],d=a[0]===a[0].toLocaleUpperCase(e);for(let p=1;p<u;p++){const v=a[p],b=v===v.toLocaleUpperCase(e);if(Oe.test(v)||Oe.test(a[p-1])){l+=v;continue}!d&&b?(f.push(l),l=v):l+=v,d=b}return l&&l.length>0&&f.push(l),f}const s=[...t],o=s.length,c=[];let r=s[0],g=s[0]===s[0].toLocaleUpperCase(e);for(const a of n)if(t.startsWith(a)){c.push(a),r=s[a.length],g=r===r.toLocaleUpperCase(e);break}for(let a=1;a<o;a++){const u=s[a],f=u===u.toLocaleUpperCase(e);let l=0;for(const d of n)if(t.startsWith(d,a)){c.push(r,d),l=d.length,r="";const p=d.at(-1);p&&(g=p===p.toLocaleUpperCase(e));break}if(l>0){a+=l-1;continue}!g&&f?(c.push(r),r=u):r+=u,g=f}return r&&c.push(r),c},Oo=(t,e,n)=>{const i=[],s=ne.test(t)?t.split(ne).filter(Boolean):[t];for(const o of s){const c=o;if(ne.test(c))i.push(c);else{B.lastIndex=0;const r=B.test(c)?vo(c).filter(Boolean):[c];for(const g of r)if(B.lastIndex=0,B.test(g))i.push(g);else if(e){const a=e.toLowerCase().split("-")[0];i.push(...it(g,a,n))}else i.push(...ot(g,n))}}return i},Ao=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:s=[],locale:o,normalize:c=!1,separators:r,stripAnsi:g=!1,stripEmoji:a=!1}=e,u=new Set([...s].toSorted((y,N)=>N.length-y.length));let f=t;g&&(f=go(f)),a&&(f=Ct(f));let l;Array.isArray(r)?l=yo(r):r instanceof RegExp?l=r:l=_t;const d=[];let p=f;const v=l.flags.includes("g")?l:new RegExp(l.source,`${l.flags}g`);for(;p.length>0;){const y=v.exec(p);if(!y){p===".."?d.push(".."):p==="."?d.push("."):p.length>0&&d.push(p);break}const N=y.index,C=y[0],k=C.length,h=p.slice(0,N),m=p.slice(N+k);if(C.startsWith("../"))d.push(".."),p=p.slice(N+3);else if(C.startsWith("./"))d.push("."),p=p.slice(N+2);else if(N===0&&C==="..")d.push(".."),p=p.slice(2);else if(N===0&&C===".")d.push("."),p=p.slice(1);else{h.length>0&&d.push(h);let w=0;for(;(w=C.indexOf("../",w))!==-1;)d.push(".."),w+=3;for(w=0;(w=C.indexOf("./",w))!==-1;)(w===0||C[w-1]!==".")&&d.push("."),w+=2;let $=m;for(;$.startsWith("../");)d.push(".."),$=$.slice(3);for(;$.startsWith("./");)d.push("."),$=$.slice(2);if($===".."){d.push("..");break}else if($==="."){d.push(".");break}else p=$}v.lastIndex=0}if(d.length===0){const y=f.split(l).filter(Boolean);d.push(...y)}let b=[];for(const y of d)n||i?b.push(...Oo(y,o,u)):o?b.push(...it(y,o,u)):b.push(...ot(y,u));return c&&(b=b.map(y=>u.has(y)?y:o&&y===y.toLocaleUpperCase(o)?y[0]+y.slice(1).toLocaleLowerCase(o):y.toUpperCase()===y&&!u.has(y)?y.slice(0,1)+y.slice(1).toLowerCase():y)),b},No=(t,e)=>typeof t!="string"||t===""?"":t[0].toUpperCase()+t.slice(1),Co=(t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let s="",o="";for(let c=0;c<n;c++){const r=t[c];if(ne.test(r)){s?(i.push(s+o+r),s="",o=""):(i.length>0&&i.push(e),s=r);continue}s?(o&&(o+=e),o+=r):(i.length>0&&i.push(e),i.push(r))}return i.join("")},st=(t,e)=>{if(typeof t!="string"||!t)return"";let n=!0;return Co(Ao(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>{const o=s,c=o.toLowerCase();return n?(n=!1,po(c)):No(c)}),"")},_o=t=>{t.options?.forEach(e=>{e.__camelCaseName__=st(e.name)})},ko=t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const i of t.options)e.add(i.name);const n=[];for(const i of t.options)if(i.name.startsWith("no-")){const s=i.name.replace(/^no-/,"");if(!e.has(s)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const o={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:s};n.push(o),e.add(s)}}n.length>0&&t.options.push(...n)},xo=(t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const o of e.options)if(o.name.startsWith("no-")){const c=st(o.name);i.set(c,o)}const s=Object.keys(n).filter(o=>i.has(o));if(s.length!==0)for(const o of s){const c=o.charAt(2);if(!c)continue;const r=c.toLowerCase()+o.slice(3),g=i.get(o);g&&(g.__negated__=!0),n[r]=!n[o],Reflect.deleteProperty(n,o)}},Io=(t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const s of e.options)s.__camelCaseName__&&s.__negated__===void 0&&s.implies!==void 0&&n.set(s.__camelCaseName__,s);if(n.size===0)return;const{options:i}=t;for(const s of Object.keys(i)){const o=n.get(s);if(o?.implies){const{implies:c}=o;for(const[r,g]of Object.entries(c))i[r]===void 0&&(i[r]=g)}}},Lo=()=>!!process.versions.electron,Eo=()=>Lo()&&!process.defaultApp,Po=()=>Eo()?0:1,Uo=t=>t.slice(Po()+1),Mo=" ",Do=(t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),To=t=>{if(typeof t=="string")return t.split(Mo);const e=me();return Do(t,e)?Uo(t):t},Vo=t=>{const e=o=>{t.error(`Uncaught exception: ${o.message||o}`),o.stack&&t.error(o.stack),G(1)},n=(o,c)=>{if(o instanceof Error)t.error(`Promise rejection: ${o.message||o}`),o.stack&&t.error(o.stack);else{let r;if(typeof o=="string")r=o;else try{r=JSON.stringify(o)}catch{r=String(o)}t.error(`Promise rejection: ${r}`)}G(1)},i=be("uncaughtException",e),s=be("unhandledRejection",n);return()=>{i(),s()}},je=100,So=/^[a-z][\w-]*$/i,ge=(t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new A(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},Be=(t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new A(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},fe=(t,e)=>{if(typeof t!="object"||t===null)throw new A(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},ee=t=>{const e=ge(t,"Command name");if(e.length>je)throw new A(`Command name is too long (maximum ${String(je)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new A(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!So.test(e))throw new A(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},jo=new Set([`
|
|
4
|
+
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),Bo=(t,e=!0)=>{if(typeof t!="string")throw new TypeError("Argument must be a string");if(t.length>1e4)throw new Error(`Argument is too long (maximum ${String(1e4)} characters)`);if(e){for(const n of t)if(jo.has(n))throw new Error(`Argument contains dangerous character: ${n}`)}return t.trim()},Re=(t,e=!0)=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");if(t.length>100)throw new Error(`Too many arguments (maximum ${String(100)})`);return t.map(n=>Bo(n,e))},Ro=/^-([^\d-])$/,zo=/^--(\S+)/,Wo=/^-([^\d-]{2,})$/,de=t=>Ro.test(t)||zo.test(t)||Wo.test(t),Fo={access:(t,e)=>mt(t,e),mkdir:(t,e)=>dt(t,e),readdir:t=>ft(t),readFile:(async(t,e)=>e===void 0?ye(t):ye(t,e)),rm:(t,e)=>pt(t,e),stat:t=>ht(t),writeFile:(t,e,n)=>ut(t,e,n)};class at{#t;#e;#c;#u;#p;#f;#v;#b;#$;#O;#A;#h;#n;#o;#i;#s;#a;#d=!1;#N;#C=!1;#m;#g;#w;#l=[];#L(){return this.#m===void 0&&(this.#m=[...this.#o.keys()]),this.#m}#_(){return this.#g===void 0&&(this.#g=[...this.#n.keys()]),this.#g}#r(){return this.#w===void 0&&(this.#w=[...this.#L(),...this.#_()]),this.#w}#k(){return this.#l.length===0?X:[...X,...this.#l]}#x(){this.#m=void 0,this.#g=void 0,this.#w=void 0}#y(){if(this.#c===void 0){const e=To(this.#e.argv);this.#c=Re(e,!1),this.#E()}return this.#c}#E(){if(!this.#c)return;const e=j();let n=!1;for(const i of this.#c){if(i==="--quiet"||i==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(gt),n=!0;break}if(i==="--verbose"||i==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(wt),n=!0;break}if(i==="--debug"){e.CEREBRO_OUTPUT_LEVEL=String(q),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(q):String(ve))}#P(){this.#C||(this.#N=Vo(this.#t),this.#C=!0)}#U(){return{arch:vt(),argv:this.#y(),cwd:this.#u,env:this.#O??j(),exit:this.#$??(e=>G(e??0)),platform:yt(),stdin:this.#A}}#I(e,n,i,s){this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:o,booleanValues:c,parsedArgs:r}=oo(e,n,this.#k()),g=Object.keys(c).length>0;let a=r;g&&(a={...r,_all:{...r._all,...c}}),ro(o,a,e);const u=no(e,r,c,i);u.runtime=this,u.argv=this.#y(),u.fs=this.#b??Fo,u.process=this.#U(),u.console=this.#t;const f=e.options&&e.options.length>0;if(f&&e.options){const l=e.options.filter(d=>d.name.startsWith("no-"));for(const d of l){const p=d.name.replace(/^no-/,""),v=`--${d.name}`,b=`--${p}`,y=n.includes(v),N=n.includes(b);if(y&&N)throw new We(p,d.name)}}return f&&(xo(u,e),Io(u,e)),lo(o,u.options,e),j().CEREBRO_OUTPUT_LEVEL===String(q)&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(u.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(u.argument,null,2))),{arguments_:o,booleanValues:c,commandArgs:a,parsedArgs:r,toolbox:u}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new A("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#p=e.trim();const i=n.argv??me(),s=n.cwd??bt();if(this.#e={...n,argv:i,cwd:s},this.#e.argv&&!Array.isArray(this.#e.argv))throw new A("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new A("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new A("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new A("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const o=j();if(o.CEREBRO_OUTPUT_LEVEL=String(ve),typeof this.#e.logger=="object"){const u=["debug","error","info","log","warn"],f=[],l=this.#e.logger;for(const d of u)typeof l[d]!="function"&&f.push(d);if(f.length>0)throw new A(`Logger object is missing required methods: ${f.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:f});this.#t=this.#e.logger}else this.#t={...console,debug:(...u)=>{o.CEREBRO_OUTPUT_LEVEL===String(q)&&console.debug(...u)}};this.#f=this.#e.packageVersion,this.#v=this.#e.packageName,this.#u=this.#e.cwd,this.#s="help",this.#a={};const c=n.fs;if(c!==void 0&&(typeof c!="object"||c===null))throw new A("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const r=n.exit;if(r!==void 0&&typeof r!="function")throw new A("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const g=n.env;if(g!==void 0&&(typeof g!="object"||g===null))throw new A("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const a=n.stdin;if(a!==void 0&&typeof a!="string")throw new A("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#b=n.fs,this.#$=n.exit,this.#O=n.env,this.#A=n.stdin??"",this.#n=new Map,this.#o=new Map,this.#i=new Map}setCommandSection(e){return this.#a=e,this}getCommandSection(){return this.#a.header||(this.#a.header=`${this.#p}${this.#f?` v${this.#f}`:""}`),this.#a}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){fe(e,"Command"),ee(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new A(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new A(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?ee(e.alias):Be(e.alias,"Command alias").forEach(a=>ee(a))),e.argument&&fe(e.argument,"Command argument"),e.options&&fe(e.options,"Command options"),e.commandPath&&(Be(e.commandPath,"Command commandPath"),e.commandPath.forEach(a=>{ee(a)}));const s=Ve(e.name,e.commandPath),o=V(s);if(this.#o.has(o))throw new A(`Command with path "${o}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const c=Array.isArray(e.commandPath)&&e.commandPath.length>0,r=this.#n.get(e.name),g=r!==void 0&&(r.commandPath===void 0||r.commandPath.length===0);if(!c&&g)throw new A(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const a of e.options)ke(a);if(co(e),ko(e),_o(e),e.options&&(e.__conflictingOptions__=e.options.filter(a=>a.conflicts!==void 0),e.__requiredOptions__=e.options.filter(a=>a.required===!0)),c&&r!==void 0)this.#n.set(o,e);else{if(!c&&r!==void 0&&!g){const a=Ve(r.name,r.commandPath);this.#n.set(V(a),r)}this.#n.set(e.name,e)}if(this.#o.set(o,s),this.#i.set(o,e),this.#x(),e.alias!==void 0){const a=typeof e.alias=="string"?[e.alias]:e.alias;for(const u of a){if(j().CEREBRO_OUTPUT_LEVEL===String(q)&&this.#t.debug("adding alias",u),this.#n.has(u))throw new A(`Command alias "${u}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:u,commandName:e.name});this.#n.set(u,e)}}return this}addGlobalOption(e){const n=e,i=new Set(X.map(o=>o.name)),s=new Set(X.map(o=>o.alias).filter(Boolean));if(i.has(n.name))throw new A(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&s.has(n.alias))throw new A(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(o=>o.name)).has(n.name))throw new A(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",ke(n),this.#l.push(n),this}getGlobalOptions(){return this.#k()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#h?this.#h:(this.#h=new Gt(this.#t),this.#h.register({description:"Attaches the logger to the toolbox",execute:e=>{e.logger=this.#t,e.console=e.logger},name:"logger"}),this.#h)}getCliName(){return this.#p}getPackageVersion(){return this.#f}getPackageName(){return this.#v}getCommands(){return this.#n}getCwd(){return this.#u}dispose(){this.#N?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...s}=e;if(!this.#n.has("help")){const{default:h}=await import("../commands/help-command.js");this.addCommand(new h(this.#n))}const o=this.#_(),c=this.#o;this.#P();const r=this.#y();let g,a=[...r];const u=$t(),f=Ot(),l=me();this.#t.debug(`process.execPath: ${u}`),this.#t.debug(`process.execArgv: ${f.join(" ")}`),this.#t.debug(`process.argv: ${l.join(" ")}`);const d=uo(c,[...r]);if(d.commandPath)g=d.commandPath,a=d.argv;else{if(r.length>1&&r[0]&&r[1]&&!de(r[0])&&!de(r[1])){const m=[];let w=0;for(;w<r.length;){const O=r[w];if(!O||de(O))break;m.push(O),w+=1}const $=V(m);if(m[0]&&!o.includes(m[0])){const O=this.#r(),P=S($,O);throw new T($,P)}}let h;try{h=Zt([null,...o],[...r])}catch(m){if(m instanceof Error&&m.name==="INVALID_COMMAND"&&"command"in m){const w=m.command,$=this.#r(),O=S(w,$);throw new T(w,O)}throw m}h.command&&(g=[h.command],a=h.argv)}if(!g)if(this.#s)g=[this.#s];else{const h=this.#r();throw new T("",h)}const p=V(g),v=this.#o.get(p);let b;if(v){if(b=this.#i.get(p),!b||V(v)!==p){const h=this.#r(),m=S(p,h);throw new T(p,m)}}else{const h=g.at(-1);if(b=h?this.#n.get(h):void 0,!b){const m=this.#r(),w=S(p,m);throw new T(p,w)}}if(typeof b.execute!="function"&&typeof b.loader!="function")return this.#t.error(`Command "${b.name}" has no function to execute.`),i?G(1):void 0;const y=a;let N,C;try{({commandArgs:N,toolbox:C}=this.#I(b,y,s,p))}catch(h){if(this.#t.error(h),i)return G(1);throw h}const k=this.getPluginManager();try{!this.#d&&k.hasPlugins()&&(await k.init({cli:this,cwd:this.#u,logger:this.#t}),this.#d=!0),await k.executeLifecycle("execute",C),await k.executeLifecycle("beforeCommand",C);let h;const m=N.global;if(m?.help){const w=this.#n.get("help");if(!w)throw new A("Help command not found","COMMAND_NOT_FOUND");h=await F(w,C)}else if(m?.version??m?.V){const w=this.#n.get("version");if(!w)throw new A("Version command not found","COMMAND_NOT_FOUND");h=await F(w,C)}else h=await F(b,C);return await k.executeLifecycle("afterCommand",C,h),i?G(0):void 0}catch(h){throw await k.executeErrorHandlers(h,C),h}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...s}=n;ge(e,"Command name");const o=e.split(" ").filter(Boolean),c=V(o),r=this.#o.get(c)?this.#i.get(c):this.#n.get(e);if(!r){const l=this.#r(),d=S(c||e,l);throw new T(e,d)}if(typeof r.execute!="function"&&typeof r.loader!="function")throw new A(`Command "${r.name}" has no function to execute`,"INVALID_COMMAND",{commandName:r.name});const g=[...Re(i,!1)];this.#t.debug(`running command '${e}' programmatically with args: ${g.join(", ")}`);const{commandArgs:a,toolbox:u}=this.#I(r,g,s,c||e),f=this.getPluginManager();try{!this.#d&&f.hasPlugins()&&(await f.init({cli:this,cwd:this.#u,logger:this.#t}),this.#d=!0),await f.executeLifecycle("execute",u),await f.executeLifecycle("beforeCommand",u);let l;const d=a.global;if(d?.help){const p=this.#n.get("help");if(!p)throw new A("Help command not found","COMMAND_NOT_FOUND");l=await F(p,u)}else if(d?.version??d?.V){const p=this.#n.get("version");if(!p)throw new A("Version command not found","COMMAND_NOT_FOUND");l=await F(p,u)}else l=await F(r,u);return await f.executeLifecycle("afterCommand",u,l),l}catch(l){throw await f.executeErrorHandlers(l,u),l}}clone(e){const n={...this.#e,...e},i=new at(this.#p,n);for(const[s,o]of this.#n)i.#n.set(s,o);for(const[s,o]of this.#o)i.#o.set(s,[...o]);for(const[s,o]of this.#i)i.#i.set(s,o);for(const s of this.#l)i.#l.push(s);return i.#s=this.#s,i.#a={...this.#a},i.#x(),i}async getAction(e){ge(e,"Command name");const n=e.split(" ").filter(Boolean),i=V(n),s=this.#o.get(i)?this.#i.get(i):this.#n.get(e);if(!s){const o=this.#r(),c=S(i||e,o);throw new T(e,c)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return Xe(s);throw new A(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}}export{at as Cli};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import{createRequire as M}from"node:module";import{O as ur,C as cr,V as lr,_ as fr}from"./renderError-DJiY-69l-s_7rEsoy.js";import{E as mr,u as dr}from"./isVisulimaError-jVZgumOU-C67qeq6-.js";const V=M(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[r,t]=b.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return b.getBuiltinModule(e)}return V(e)},{createRequire:U}=B("node:module");var q=Object.defineProperty,z=(e,r)=>q(e,"name",{value:r,configurable:!0}),K=Object.defineProperty,w=z((e,r)=>K(e,"name",{value:r,configurable:!0}),"l");const N=w((e,r)=>{let t=0,n=r.length-2;for(;t<n;){const o=t+(n-t>>1);if(e<r[o])n=o-1;else if(e>=r[o+1])t=o+1;else{t=o;break}}return t},"binarySearch"),Y=/\n|\r(?!\n)/,H=w(e=>e.split(Y).reduce((r,t)=>(r.push(r.at(-1)+t.length+1),r),[0]),"getLineStartIndexes"),He=w((e,r,t)=>{const n=t?.skipChecks??!1;if(!n&&(!Array.isArray(e)&&typeof e!="string"||(typeof e=="string"||Array.isArray(e))&&e.length===0))return{column:0,line:0};if(!n&&(typeof r!="number"||typeof e=="string"&&r>=e.length||Array.isArray(e)&&r+1>=e.at(-1)))return{column:0,line:0};if(typeof e=="string"){const a=H(e),i=N(r,a);return{column:r-a[i]+1,line:i+1}}const o=N(r,e);return{column:r-e[o]+1,line:o+1}},"indexToLineColumn");var X=Object.defineProperty,W=(e,r)=>X(e,"name",{value:r,configurable:!0}),G=Object.defineProperty,Q=W((e,r)=>G(e,"name",{value:r,configurable:!0}),"t");const Xe=Q(({applicationType:e,error:r,file:t})=>`You are a very skilled ${t.language??"unknown"} programmer.
|
|
2
|
+
|
|
3
|
+
${e?`You are working on a ${e} application.`:""}
|
|
4
|
+
|
|
5
|
+
Use the following context to find a possible fix for the exception message at the end. Limit your answer to 4 or 5 sentences. Also include a few links to documentation that might help.
|
|
6
|
+
|
|
7
|
+
Use this format in your answer, make sure links are json:
|
|
8
|
+
|
|
9
|
+
FIX
|
|
10
|
+
insert the possible fix here
|
|
11
|
+
ENDFIX
|
|
12
|
+
LINKS
|
|
13
|
+
{"title": "Title link 1", "url": "URL link 1"}
|
|
14
|
+
{"title": "Title link 2", "url": "URL link 2"}
|
|
15
|
+
ENDLINKS
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
Here comes the context and the exception message:
|
|
19
|
+
|
|
20
|
+
Line: ${String(t.line)}
|
|
21
|
+
|
|
22
|
+
File:
|
|
23
|
+
${t.file}
|
|
24
|
+
|
|
25
|
+
Snippet including line numbers:
|
|
26
|
+
${t.snippet??""}
|
|
27
|
+
|
|
28
|
+
Exception class:
|
|
29
|
+
${r.name}
|
|
30
|
+
|
|
31
|
+
Exception message:
|
|
32
|
+
${r.message}`,"aiPrompt");var Z=Object.defineProperty,ee=(e,r)=>Z(e,"name",{value:r,configurable:!0}),re=Object.defineProperty,I=ee((e,r)=>re(e,"name",{value:r,configurable:!0}),"o");const A=I((e,r,t)=>{const n=t.indexOf(e);if(n===-1)return"";const o=n+e.length,a=t.indexOf(r,o);return a===-1?"":t.slice(o,a).trim()},"between"),We=I(e=>{const r=A("FIX","ENDFIX",e);if(!r)return["No solution found.",'Provide this response to the Maintainer of <a href="https://github.com/visulima/visulima/issues/new?assignees=&labels=s%3A+pending+triage%2Cc%3A+bug&projects=&template=bug_report.yml" target="_blank" rel="noopener noreferrer" class="text-blue-500 hover:underline inline-flex items-center text-sm">@visulima/error</a>.',`"${e}"`].join("</br></br>");const t=A("LINKS","ENDLINKS",e),n=t?t.split(`
|
|
33
|
+
`).map(a=>a.trim()).filter(Boolean).map(a=>{try{return JSON.parse(a)}catch{return}}).filter(a=>a!==void 0):[],o=n.length>0?`
|
|
34
|
+
|
|
35
|
+
## Links
|
|
36
|
+
|
|
37
|
+
${n.map(a=>`- <a href="${a.url}" target="_blank" rel="noopener noreferrer">${a.title}</a>`).join(`
|
|
38
|
+
`)}`:"";return`${r.replaceAll(/"([^"]*)"(?:\s|\.)/g,"<code>$1</code> ")}${o}
|
|
39
|
+
|
|
40
|
+
--------------------
|
|
41
|
+
This solution was generated with the <a href="https://sdk.vercel.ai/" target="_blank" rel="noopener noreferrer">AI SDK</a> and may not be 100% accurate.`},"aiSolutionResponse");var te=Object.defineProperty,ne=(e,r)=>te(e,"name",{value:r,configurable:!0}),oe=Object.defineProperty,ae=ne((e,r)=>oe(e,"name",{value:r,configurable:!0}),"n");const Ge={handle:ae(e=>e.hint===void 0?Promise.resolve(void 0):typeof e.hint=="string"&&e.hint!==""?Promise.resolve({body:e.hint}):typeof e.hint=="object"&&typeof e.hint.body=="string"?Promise.resolve(e.hint):Array.isArray(e.hint)?Promise.resolve({body:e.hint.join(`
|
|
42
|
+
`)}):Promise.resolve(void 0),"handle"),name:"errorHint",priority:1};var ie=Object.defineProperty,se=(e,r)=>ie(e,"name",{value:r,configurable:!0}),ue=Object.defineProperty,s=se((e,r)=>ue(e,"name",{value:r,configurable:!0}),"t");const ce=s(e=>`\`\`\`
|
|
43
|
+
${e.trim()}
|
|
44
|
+
\`\`\``,"code"),v=s(e=>`\`\`\`bash
|
|
45
|
+
${e.trim()}
|
|
46
|
+
\`\`\``,"bash"),$=s(e=>`\`\`\`ts
|
|
47
|
+
${e.trim()}
|
|
48
|
+
\`\`\``,"ts"),le=s(e=>`\`\`\`js
|
|
49
|
+
${e.trim()}
|
|
50
|
+
\`\`\``,"js"),f=s((e,...r)=>{const t=e.toLowerCase();return r.some(n=>t.includes(n.toLowerCase()))},"has"),fe=[{name:"esm-cjs-interop",test:s(e=>{const{message:r}=e;if(f(r,"err_require_esm","cannot use import statement outside a module","must use import to load es module","require() of es module","does not provide an export named"))return{md:["Your project or a dependency may be mixing CommonJS and ES Modules.","","Try:","- Ensure package.json has the correct `type` (either `module` or `commonjs`).","- Use dynamic `import()` when requiring ESM from CJS.","- Prefer ESM-compatible entrypoints from dependencies.","- In Node, align `module` resolution with your bundler config.","","Check Node resolution:",v(`node -v
|
|
51
|
+
cat package.json | jq .type`),"","Example dynamic import in CJS:",le("(async () => { const mod = await import('some-esm'); mod.default(); })();")].join(`
|
|
52
|
+
`),title:"ESM/CJS interop"}},"test")},{name:"missing-default-export",test:s(e=>{const{message:r}=e;if(f(r,"default export not found","has no default export","does not provide an export named 'default'","is not exported from"))return{md:["Verify your import/export shapes.","","Default export example:",$(`export default function Component() {}
|
|
53
|
+
// import Component from './file'`),"","Named export example:",$(`export function Component() {}
|
|
54
|
+
// import { Component } from './file'`)].join(`
|
|
55
|
+
`),title:"Export mismatch (default vs named)"}},"test")},{name:"port-in-use",test:s(e=>{const{message:r}=e;if(f(r,"eaddrinuse","address already in use","listen eaddrinuse"))return{md:["Another process is using the port.","","Change the port or stop the other process.","","On macOS/Linux:",v(`lsof -i :3000
|
|
56
|
+
kill -9 <PID>`),"","On Windows (PowerShell):",v(`netstat -ano | findstr :3000
|
|
57
|
+
taskkill /PID <PID> /F`)].join(`
|
|
58
|
+
`),title:"Port already in use"}},"test")},{name:"file-not-found-or-case",test:s((e,r)=>{const{message:t}=e;if(f(t,"enoent","module not found","cannot find module"))return{md:["Check the import path and filename case (Linux/macOS are case-sensitive).","If using TS path aliases, verify `tsconfig.paths` and bundler aliases.","","Current file:",ce(`${r.file}:${String(r.line)}`)].join(`
|
|
59
|
+
`),title:"Missing file or path case mismatch"}},"test")},{name:"ts-path-mapping",test:s(e=>{const{message:r}=e;if(f(r,"ts2307","cannot find module")||r.includes("TS2307"))return{md:["If you use path aliases, align TS `paths` with Vite/Webpack resolve aliases.","Ensure file extensions are correct and included in resolver.","","tsconfig.json excerpt:",$(`{
|
|
60
|
+
"compilerOptions": {
|
|
61
|
+
"baseUrl": ".",
|
|
62
|
+
"paths": { "@/*": ["src/*"] }
|
|
63
|
+
}
|
|
64
|
+
}`)].join(`
|
|
65
|
+
`),title:"TypeScript path mapping / resolution"}},"test")},{name:"network-dns-enotfound",test:s(e=>{const{message:r}=e;if(f(r,"enotfound","getaddrinfo enotfound","dns","fetch failed","ecconnrefused","econnrefused"))return{md:["The host may be unreachable or misconfigured.","","Try:","- Verify the hostname and protocol (http/https).","- Check VPN/proxy and firewall.","- Confirm the service is running and listening on the expected port.","",v(`ping <host>
|
|
66
|
+
nslookup <host>
|
|
67
|
+
curl -v http://<host>:<port>`)].join(`
|
|
68
|
+
`),title:"Network/DNS connection issue"}},"test")},{name:"undefined-property",test:s(e=>{const{message:r}=e;if(f(r,"cannot read properties of undefined","reading '"))return{md:["A variable or function returned `undefined`.","","Mitigations:","- Add nullish checks before property access.","- Validate function return values and input props/state.","",$("const value = maybe?.prop; // or: if (maybe) { use(maybe.prop) }")].join(`
|
|
69
|
+
`),title:"Accessing property of undefined"}},"test")}],Qe={handle:s((e,r)=>{try{const t=fe.map(o=>({match:o.test(e,r),rule:o})).filter(o=>!!o.match);if(t.length===0)return Promise.resolve(void 0);const n=t.toSorted((o,a)=>(o.match.priority??0)-(a.match.priority??0)).map(o=>`#### ${o.match.title}
|
|
70
|
+
|
|
71
|
+
${o.match.md}`).join(`
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
`);return n===""?Promise.resolve(void 0):Promise.resolve({body:n,header:"### Potential fixes detected"})}catch{return Promise.resolve(void 0)}},"handle"),name:"ruleBasedHints",priority:0};var pe=Object.defineProperty,C=(e,r)=>pe(e,"name",{value:r,configurable:!0}),me=Object.defineProperty,de=C((e,r)=>me(e,"name",{value:r,configurable:!0}),"s");let p=class extends Error{static{C(this,"e")}static{de(this,"NonError")}constructor(r){super(r),this.name="NonError"}};var be=Object.defineProperty,ge=(e,r)=>be(e,"name",{value:r,configurable:!0}),ye=Object.defineProperty,he=ge((e,r)=>ye(e,"name",{value:r,configurable:!0}),"e");const er=he(()=>{if(!Error.captureStackTrace)return;const e=new Error;return Error.captureStackTrace(e),e.stack},"captureRawStackTrace");var ve=Object.defineProperty,$e=(e,r)=>ve(e,"name",{value:r,configurable:!0}),je=Object.defineProperty,O=$e((e,r)=>je(e,"name",{value:r,configurable:!0}),"n");const y=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&y.set("AggregateError",AggregateError);const rr=O((e,r)=>{let t;try{t=new e}catch(o){throw new Error(`The error constructor "${e.name}" is not compatible`,{cause:o})}const n=r??t.name;if(y.has(n))throw new Error(`The error constructor "${n}" is already known.`);y.set(n,e)},"addKnownErrorConstructor");O(()=>new Map(y),"getKnownErrorConstructors");const _=O(e=>y.get(e),"getErrorConstructor"),E=O(e=>e!==null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.message=="string"&&(_(e.name)!==void 0||e.name==="Error"),"isErrorLike");var Oe=Object.defineProperty,Ee=(e,r)=>Oe(e,"name",{value:r,configurable:!0}),Pe=Object.defineProperty,c=Ee((e,r)=>Pe(e,"name",{value:r,configurable:!0}),"s");const D=c(e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},"isPlainObject"),Se={maxDepth:Number.POSITIVE_INFINITY},J=c((e,r,t=0)=>E(e)?x(e,r,t):r.maxDepth!==void 0&&t>=r.maxDepth?new p(JSON.stringify(e)):new p(JSON.stringify(e)),"deserializePlainObject"),we=c((e,r,t,n,o)=>{const a=r.map(i=>h(i,n,o+1));return new e(a,t)},"reconstructAggregateError"),x=c((e,r,t)=>{if(r.maxDepth!==void 0&&t>=r.maxDepth)return new p(JSON.stringify(e));const{cause:n,errors:o,message:a,name:i,stack:u,...d}=e,k=_(i)??Error,l=i==="AggregateError"&&Array.isArray(o)?we(k,o,a,r,t):new k(a);return!l.name&&i&&(l.name=i),a!==void 0&&(l.message=a),u&&(l.stack=u),xe(l,d,n,i,r,t),n!==void 0&&(l.cause=h(n,r,t+1)),ke(l,e),l},"reconstructError"),h=c((e,r,t)=>{if(D(e)){if(E(e))return J(e,r,t);const n={};for(const[o,a]of Object.entries(e))n[o]=h(a,r,t+1);return n}return Array.isArray(e)?e.map(n=>h(n,r,t)):e},"deserializeValue"),xe=c((e,r,t,n,o,a)=>{const i=e;for(const[u,d]of Object.entries(r))if(!(u==="cause"&&t!==void 0)){if(u==="errors"&&n==="AggregateError")continue;i[u]=h(d,o,a+1)}},"restoreErrorProperties"),ke=c((e,r)=>{const t=new Set(["message","name","stack"]);for(const n of Object.keys(r))t.add(n);for(const n of t)if(n in e){const o=Object.getOwnPropertyDescriptor(e,n);o&&!o.enumerable&&Object.defineProperty(e,n,{...o,enumerable:!0})}},"makePropertiesEnumerable"),T=c(e=>new p(JSON.stringify(e)),"handlePrimitive"),Ne=c(e=>new p(JSON.stringify(e)),"handleArray"),Ae=c((e,r)=>E(e)?x(e,r,0):J(e,r),"handlePlainObject"),tr=c((e,r={})=>{const t={...Se,...r};return e instanceof Error?e:e===null?T(null):typeof e=="string"||typeof e=="number"||typeof e=="boolean"?T(e):Array.isArray(e)?Ne(e):E(e)?x(e,t,0):D(e)?Ae(e,t):new p(JSON.stringify(e))},"deserialize");var Te=Object.defineProperty,L=(e,r)=>Te(e,"name",{value:r,configurable:!0});const Ie=U(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ce=L(e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[r,t]=g.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return g.getBuiltinModule(e)}return Ie(e)},"__cjs_getBuiltinModule"),{inspect:_e}=Ce("node:util");var De=Object.defineProperty,Je=L((e,r)=>De(e,"name",{value:r,configurable:!0}),"s");const nr=Je(e=>{const r=new Set,t=[];let n=e;for(;n;){if(r.has(n)){console.error(`Circular reference detected in error causes: ${_e(e)}`);break}if(t.push(n),r.add(n),typeof n!="object"||!("cause"in n))break;n=n.cause}return t},"getErrorCauses");var Le=Object.defineProperty,Fe=(e,r)=>Le(e,"name",{value:r,configurable:!0}),Re=Object.defineProperty,F=Fe((e,r)=>Re(e,"name",{value:r,configurable:!0}),"s");const Me=F(e=>{const r=e.methodName&&e.methodName!=="<unknown>"?`${e.methodName} `:"",t=e.file??"<unknown>",n=String(e.line??0),o=String(e.column??0);return r.trim()?` at ${r}(${t}:${n}:${o})`:` at ${t}:${n}:${o}`},"formatStackFrameLine"),or=F((e,r)=>{const t=[];if(r?.header&&(r.header.name||r.header.message)){const n=r.header.name??"Error",o=r.header.message??"";t.push(`${n}${o?": ":""}${o}`)}for(const n of e)t.push(Me(n));return t.join(`
|
|
76
|
+
`)},"formatStacktrace");var Ve=Object.defineProperty,Be=(e,r)=>Ve(e,"name",{value:r,configurable:!0});const Ue=Object.create({},{cause:{enumerable:!1,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},errors:{enumerable:!1,value:void 0,writable:!0},message:{enumerable:!1,value:void 0,writable:!0},name:{enumerable:!1,value:void 0,writable:!0},stack:{enumerable:!1,value:void 0,writable:!0}});var qe=Object.defineProperty,m=Be((e,r)=>qe(e,"name",{value:r,configurable:!0}),"i");const ze=m(e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},"isPlainObject"),P=new WeakSet,R=m(e=>{const r=Object.getOwnPropertyNames(e);for(const t of r){const n=Object.getOwnPropertyDescriptor(e,t);n&&(n.enumerable||Object.defineProperty(e,t,{...n,enumerable:!0}),n.value&&typeof n.value=="object"&&!Array.isArray(n.value)&&(Object.getPrototypeOf(n.value)===Object.prototype||Object.getPrototypeOf(n.value)===null)&&R(n.value))}},"makePropertiesEnumerable"),Ke=m(e=>{P.add(e);const r=e.toJSON();return P.delete(e),Object.isExtensible(r)&&R(r),r},"toJSON"),S=m((e,r,t,n,o=new Set)=>{if(e&&e instanceof Uint8Array&&e.constructor.name==="Buffer")return"[object Buffer]";if(e!==null&&typeof e=="object"&&"pipe"in e&&typeof e.pipe=="function")return"[object Stream]";if(e instanceof Error)return r.has(e)?"[Circular]":(t+=1,j(e,n,r,t));if(n.useToJSON&&e!==null&&typeof e=="object"&&"toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();if(e instanceof Date)return e.toISOString();if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e=="bigint")return`${String(e)}n`;if(ze(e)){if(o.has(e))return"[Circular]";if(n.maxDepth!==void 0&&n.maxDepth!==Number.POSITIVE_INFINITY&&t+1>=n.maxDepth)return{};t+=1,o.add(e);const a={};for(const i in e)a[i]=S(e[i],r,t,n,o);return o.delete(e),a}try{return e}catch{return"[Not Available]"}},"serializeValue"),j=m((e,r,t,n)=>{if(t.add(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!P.has(e))return Ke(e);const o=Object.create(Ue);if(Object.defineProperty(o,"name",{configurable:!0,enumerable:!0,value:Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,writable:!0}),Object.defineProperty(o,"message",{configurable:!0,enumerable:!0,value:e.message,writable:!0}),Object.defineProperty(o,"stack",{configurable:!0,enumerable:!0,value:e.stack,writable:!0}),Array.isArray(e.errors)){const i=[];for(const u of e.errors){if(!(u instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(t.has(u))return Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),o;i.push(j(u,r,t,n))}Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:i,writable:!0})}const a=e.cause;if(a!=null)if(a instanceof Error)t.has(a)?Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:"[Circular]",writable:!0}):Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:j(a,r,t,n),writable:!0});else{const i=S(a,t,n,r);Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:i,writable:!0})}for(const i in e){if(i==="name"||i==="message"||i==="stack"||i==="cause"||i==="errors")continue;const u=e[i],d=S(u,t,n,r);Object.defineProperty(o,i,{configurable:!0,enumerable:!0,value:d,writable:!0})}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const i of r.exclude)try{delete o[i]}catch{}return o},"_serialize"),ar=m((e,r={})=>j(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},new Set,0),"serialize");export{ur as CODE_FRAME_POINTER,p as NonError,mr as VisulimaError,rr as addKnownErrorConstructor,Xe as aiPrompt,We as aiSolutionResponse,er as captureRawStackTrace,cr as codeFrame,tr as deserializeError,Ge as errorHintFinder,Me as formatStackFrameLine,or as formatStacktrace,nr as getErrorCauses,He as indexToLineColumn,E as isErrorLike,dr as isVisulimaError,lr as parseStacktrace,fr as renderError,Qe as ruleBasedFinder,ar as serializeError};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as r}from"./isVisulimaError-jVZgumOU-C67qeq6-.js";class n extends r{code;context;constructor(e,t,o){super({message:e,name:"CerebroError"}),this.code=t,this.context=o}}export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=String.raw,p=e`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,i=()=>new RegExp(e`\p{RI}{2}|(?)${p}(?:\u200D${p})*`,"gu");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const r=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,t=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,n=i(),a=/[-_./\s]+/g,E=/(\u001B\[[0-9;]*[a-z])/i,c=new RegExp("\\p{Script=Arabic}","u"),g=new RegExp("\\p{Script=Bengali}","u"),S=new RegExp("\\p{Script=Cyrillic}","u"),w=new RegExp("\\p{Script=Devanagari}","u"),R=new RegExp("\\p{Script=Ethiopic}","u"),x=new RegExp("\\p{Script=Greek}","u"),l=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),B=new RegExp("\\p{Script=Gujarati}","u"),F=new RegExp("\\p{Script=Gurmukhi}","u"),m=new RegExp("\\p{Script=Hangul}","u"),o=new RegExp("\\p{Script=Hebrew}","u"),y=new RegExp("\\p{Script=Hiragana}","u"),h=new RegExp("\\p{Script=Han}","u"),k=new RegExp("\\p{Script=Kannada}","u"),G=new RegExp("\\p{Script=Katakana}","u"),b=new RegExp("\\p{Script=Khmer}","u"),d=new RegExp("\\p{Script=Lao}","u"),H=new RegExp("\\p{Script=Latin}","u"),L=new RegExp("\\p{Script=Malayalam}","u"),M=new RegExp("\\p{Script=Myanmar}","u"),T=new RegExp("\\p{Script=Oriya}","u"),j=new RegExp("\\p{Script=Sinhala}","u"),K=new RegExp("\\p{Script=Tamil}","u"),O=new RegExp("\\p{Script=Telugu}","u"),f=new RegExp("\\p{Script=Thai}","u"),s=new RegExp("\\p{Script=Tibetan}","u"),z=/[\u02BB\u02BC\u0027]/u,A=u=>u.replace(n,"");export{y as A,h as C,k as D,c as G,S as H,d as I,H as J,B as K,w as L,R as M,L as N,F as O,M as P,T as Q,x as T,j as U,K as V,O as W,f as X,A as Y,s as Z,z as _,g as b,m as f,a as h,l as j,E as k,r as m,n,G as q,b as v,t as y,o as z};
|