@visulima/vis 1.0.0-alpha.37 → 1.0.0-alpha.38
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 +6 -0
- package/LICENSE.md +1 -503
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +7 -0
- package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -0
- package/dist/packem_chunks/bin.js +302 -515
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog-detector.js +1 -0
- package/dist/packem_chunks/detect.js +3 -0
- package/dist/packem_chunks/detect2.js +8 -0
- package/dist/packem_chunks/discord.js +4 -0
- package/dist/packem_chunks/dynamic-import.js +1 -0
- package/dist/packem_chunks/extra-files.js +3 -0
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/git.js +3 -0
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +2 -7
- package/dist/packem_chunks/handler31.js +2 -33
- package/dist/packem_chunks/handler32.js +2 -3
- package/dist/packem_chunks/handler33.js +3 -8
- package/dist/packem_chunks/handler34.js +6 -4
- package/dist/packem_chunks/handler35.js +1 -1
- package/dist/packem_chunks/handler36.js +42 -5
- package/dist/packem_chunks/handler37.js +8 -11
- package/dist/packem_chunks/handler38.js +9 -3
- package/dist/packem_chunks/handler39.js +74 -21
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +5 -61
- package/dist/packem_chunks/handler41.js +4 -3
- package/dist/packem_chunks/handler42.js +3 -6
- package/dist/packem_chunks/handler43.js +2 -24
- package/dist/packem_chunks/handler44.js +1 -25
- package/dist/packem_chunks/handler45.js +1 -153
- package/dist/packem_chunks/handler46.js +1 -10
- package/dist/packem_chunks/handler47.js +3 -24
- package/dist/packem_chunks/handler48.js +1 -322
- package/dist/packem_chunks/handler49.js +7 -708
- package/dist/packem_chunks/handler5.js +6 -6
- package/dist/packem_chunks/handler50.js +33 -48
- package/dist/packem_chunks/handler51.js +3 -27
- package/dist/packem_chunks/handler52.js +8 -3
- package/dist/packem_chunks/handler53.js +4 -200
- package/dist/packem_chunks/handler54.js +1 -38
- package/dist/packem_chunks/handler55.js +12 -0
- package/dist/packem_chunks/handler56.js +7 -0
- package/dist/packem_chunks/handler57.js +5 -0
- package/dist/packem_chunks/handler58.js +11 -0
- package/dist/packem_chunks/handler59.js +3 -0
- package/dist/packem_chunks/handler60.js +22 -0
- package/dist/packem_chunks/handler61.js +61 -0
- package/dist/packem_chunks/handler62.js +3 -0
- package/dist/packem_chunks/handler63.js +6 -0
- package/dist/packem_chunks/handler64.js +708 -0
- package/dist/packem_chunks/handler65.js +24 -0
- package/dist/packem_chunks/handler66.js +25 -0
- package/dist/packem_chunks/handler67.js +153 -0
- package/dist/packem_chunks/handler68.js +10 -0
- package/dist/packem_chunks/handler69.js +24 -0
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +322 -0
- package/dist/packem_chunks/handler71.js +48 -0
- package/dist/packem_chunks/handler72.js +27 -0
- package/dist/packem_chunks/handler73.js +3 -0
- package/dist/packem_chunks/handler74.js +190 -0
- package/dist/packem_chunks/handler75.js +38 -0
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index.js +1 -7
- package/dist/packem_chunks/index2.js +7 -0
- package/dist/packem_chunks/interface.js +2 -0
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.js +39 -0
- package/dist/packem_chunks/pre-mode.js +2 -0
- package/dist/packem_chunks/print-config.js +2 -0
- package/dist/packem_chunks/prompts.js +7 -0
- package/dist/packem_chunks/publish-guards.js +1 -0
- package/dist/packem_chunks/registry.js +48 -0
- package/dist/packem_chunks/resolveFormatter.js +9 -0
- package/dist/packem_chunks/security.js +1 -0
- package/dist/packem_chunks/shell-runner.js +1 -0
- package/dist/packem_chunks/slack.js +2 -0
- package/dist/packem_chunks/snapshot.js +2 -0
- package/dist/packem_chunks/stage-publisher.js +1 -0
- package/dist/packem_chunks/staged-registry.js +2 -0
- package/dist/packem_chunks/state.js +3 -0
- package/dist/packem_chunks/success-walk.js +8 -0
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +2 -2
- package/dist/packem_chunks/version-resolver.js +2 -0
- package/dist/packem_chunks/webhook.js +1 -0
- package/dist/packem_chunks/workflow-templates.js +167 -0
- package/dist/packem_chunks/workspace.js +2 -0
- package/dist/packem_shared/AfterAllProjectsVersioned-CAKI2nWf.js +1 -0
- package/dist/packem_shared/ReleaseClient-YHzBIxYS.js +1 -0
- package/dist/packem_shared/VisReleaseError-DMGRBTNO.js +1 -0
- package/dist/packem_shared/{ai-analysis-DT3bU-_M.js → ai-analysis-K-DKU3ZA.js} +1 -1
- package/dist/packem_shared/{ai-fix-BkNqd5nP.js → ai-fix-BPrYoCk8.js} +1 -1
- package/dist/packem_shared/api.d-BPftyU9r.d.ts +27 -0
- package/dist/packem_shared/createAdapter-bU4DIP3F.js +1 -0
- package/dist/packem_shared/createVersionActions-BK43SNDH.js +1 -0
- package/dist/packem_shared/{cyclonedx-86-DbHtf.js → cyclonedx-kYozDyxp.js} +3 -3
- package/dist/packem_shared/defineFormatter-D5dCp6Kv.js +1 -0
- package/dist/packem_shared/dependency-scan-anTuZB1t.js +1 -0
- package/dist/packem_shared/{docker-tNrDU3oK.js → docker-BMLrNtWm.js} +1 -1
- package/dist/packem_shared/{failure-log-Dwqt6_Ga.js → failure-log-CEWP3bP0.js} +1 -1
- package/dist/packem_shared/index-BJbpNthk.js +1 -0
- package/dist/packem_shared/index-CgcF6_wo.js +1 -0
- package/dist/packem_shared/{index-dQ37x8_P.js → index-D1_fbGbj.js} +1 -1
- package/dist/packem_shared/interface.d-B7VK2rcH.d.ts +148 -0
- package/dist/packem_shared/interface.d-Cezzifoh.d.ts +106 -0
- package/dist/packem_shared/{missing-package-json-41VUWFBY.js → missing-package-json-BfWUxTGv.js} +1 -1
- package/dist/packem_shared/{native-config-sync-BKAZ0NIs.js → native-config-sync-BEkJW7g3.js} +8 -8
- package/dist/packem_shared/pm-runner-OGResYrA.js +1 -0
- package/dist/packem_shared/provenance-_CJjMKwu.js +1 -0
- package/dist/packem_shared/public-api-WqUCiyIe.js +131 -0
- package/dist/packem_shared/{registry-keys-Bf2zzlcZ.js → registry-keys-BfFto6vI.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-jH0RKyMJ.js → resolve-explicit-CMDl55Nz.js} +2 -2
- package/dist/packem_shared/s1ngularity-Dhr3bPk0.js +1 -0
- package/dist/packem_shared/{scan-progress-JBbd9QeT.js → scan-progress-DG7_JmTV.js} +1 -1
- package/dist/packem_shared/{signatures-D1H6h6GH.js → signatures-C730vkyK.js} +2 -2
- package/dist/packem_shared/slug-DoueYuLo.js +1 -0
- package/dist/packem_shared/spinner-CV3WVJLv.js +1 -0
- package/dist/packem_shared/sticky-comment-D6_7-w8T.js +1 -0
- package/dist/packem_shared/{tabs-BqUepRaD.js → tabs-BuTy5gPV.js} +1 -1
- package/dist/packem_shared/{typosquats-C8qg1neE.js → typosquats-DN78xx1x.js} +1 -1
- package/dist/packem_shared/use-measured-height-_eVGWtWt.js +1 -0
- package/dist/packem_shared/verify-6WCmFmy8.js +1 -0
- package/dist/packem_shared/{vis-update-app-CTwRkNgj.js → vis-update-app-k3fDxech.js} +1 -1
- package/dist/release/core/changelog/index.d.ts +5 -0
- package/dist/release/core/changelog/index.js +1 -0
- package/dist/release/core/package-managers/index.d.ts +6 -0
- package/dist/release/core/package-managers/index.js +1 -0
- package/dist/release/core/version-actions/index.d.ts +14 -0
- package/dist/release/core/version-actions/index.js +1 -0
- package/dist/release/index.d.ts +196 -0
- package/dist/release/index.js +1 -0
- package/dist/release/plugin-sdk.d.ts +127 -0
- package/dist/release/plugin-sdk.js +1 -0
- package/dist/release/presets.d.ts +225 -0
- package/dist/release/presets.js +1 -0
- package/dist/release/types.d.ts +1377 -0
- package/dist/release/types.js +1 -0
- package/index.d.ts +201 -201
- package/index.js +578 -752
- package/package.json +52 -10
- package/schemas/vis-config.schema.json +1394 -6
- package/schemas/vis-release-config.schema.json +1390 -0
- package/dist/packem_shared/dependency-scan-BDTH898x.js +0 -1
- package/dist/packem_shared/index-CB4p298r.js +0 -1
- package/dist/packem_shared/index-DMefdF51.js +0 -1
- package/dist/packem_shared/pm-runner-pVihAfxV.js +0 -1
- package/dist/packem_shared/provenance-DMuEftgc.js +0 -1
- package/dist/packem_shared/s1ngularity-BkfgC6NO.js +0 -1
- package/dist/packem_shared/spinner-BXSl864p.js +0 -1
- package/dist/packem_shared/use-measured-height-BBJ9intr.js +0 -1
- package/dist/packem_shared/verify-Du7xZ2BJ.js +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ChangeFile, PlannedRelease } from "../release/types.js";
|
|
2
|
+
type ChangelogTarget = "changelog" | "github-release";
|
|
3
|
+
interface ChangelogContext {
|
|
4
|
+
/** All change files contributing to this release (may be empty for pure dep bumps). */
|
|
5
|
+
changeFiles: ChangeFile[];
|
|
6
|
+
/** ISO date string `YYYY-MM-DD`. */
|
|
7
|
+
date: string;
|
|
8
|
+
/** The release entry being rendered. */
|
|
9
|
+
release: PlannedRelease;
|
|
10
|
+
/** Where the rendered output is going — formatters may strip the version heading for `github-release`. */
|
|
11
|
+
target: ChangelogTarget;
|
|
12
|
+
}
|
|
13
|
+
/** Function signature for changelog formatters. */
|
|
14
|
+
type ChangelogFormatter = (context: ChangelogContext) => string | Promise<string>;
|
|
15
|
+
/** Factory shape — formatters can be exported as `defineFormatter` calls or default-exported functions. */
|
|
16
|
+
type ChangelogFormatterModule = {
|
|
17
|
+
default?: ChangelogFormatter;
|
|
18
|
+
} | ChangelogFormatter;
|
|
19
|
+
/** Recognised inline-metadata keys in change-file bodies. */
|
|
20
|
+
interface ChangeFileMeta {
|
|
21
|
+
author?: string;
|
|
22
|
+
commit?: string;
|
|
23
|
+
pr?: number;
|
|
24
|
+
}
|
|
25
|
+
/** Helper for custom formatters that wrap the default behaviour. */
|
|
26
|
+
declare const defineFormatter: (formatter: ChangelogFormatter) => ChangelogFormatter;
|
|
27
|
+
export { ChangelogFormatter as C, ChangeFileMeta as a, ChangelogContext as b, ChangelogFormatterModule as c, ChangelogTarget as d, defineFormatter as e };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as r,d as t}from"../packem_chunks/detect.js";export{r as createAdapter,t as detectPackageManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as r}from"../packem_chunks/registry.js";export{r as createVersionActions};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as ie}from"node:module";import{m as E,v as ue}from"./index-BDmTbWX1.js";import{r as le}from"./docker-
|
|
1
|
+
import{createRequire as ie}from"node:module";import{m as E,v as ue}from"./index-BDmTbWX1.js";import{r as le}from"./docker-BMLrNtWm.js";import{a as oe}from"../packem_chunks/config.js";import{e as fe}from"./license-t5KnNX6v.js";import{D as de}from"../packem_chunks/bin.js";import"./public-api-WqUCiyIe.js";import{p as he}from"./index-CgcF6_wo.js";const ae=ie(import.meta.url),P=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,se=e=>{if(typeof P<"u"&&P.versions&&P.versions.node){const[n,t]=P.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return P.getBuiltinModule(e)}return ae(e)},{randomUUID:pe}=se("node:crypto"),{readdirSync:me}=se("node:fs"),X=e=>e.replaceAll(/[^\w.~-]/g,n=>`%${(n.codePointAt(0)??0).toString(16).toUpperCase().padStart(2,"0")}`),C=(e,n)=>{const t=e.toLowerCase();if(t.startsWith("@")){const s=t.indexOf("/");if(s>0){const r=t.slice(0,s),p=t.slice(s+1);return`pkg:npm/${X(r)}/${X(p)}@${X(n)}`}}return`pkg:npm/${X(t)}@${X(n)}`},m={ARRAY:"array",BOOLEAN:"boolean",DATE:"date",FUNCTION:"function",JSTOXML_OBJECT:"jstoxml-object",NULL:"null",NUMBER:"number",OBJECT:"object",STRING:"string"},_e=[m.STRING,m.NUMBER,m.BOOLEAN],ge='<?xml version="1.0" encoding="UTF-8"?>',ee=["_selfCloseTag","_attrs"],ye=(e="",n=0)=>e.repeat(n),Y=e=>Array.isArray(e)&&m.ARRAY||typeof e===m.OBJECT&&e!==null&&e._name&&m.JSTOXML_OBJECT||e instanceof Date&&m.DATE||e===null&&m.NULL||typeof e,re=e=>e.startsWith("<![CDATA["),ce=(e="",n={},t)=>{let s=e;if(typeof e===m.STRING){if(re(e))return e;const r=new RegExp(`(${Object.keys(n).join("|")})(?!(\\w|#)*;)`,"g");s=String(e).replace(r,(p,h)=>n[h]||"")}return typeof t=="function"?t(s):s},be=(e={},n,t,s)=>(Array.isArray(e)?e:Object.entries(e).map(([r,p])=>({[r]:p}))).reduce((r,p)=>{const h=Object.keys(p)[0],_=p[h];if(typeof t===m.FUNCTION&&t(h,_))return r;const y=n?ce(_,n):_,$=!s&&y===!0?"":`="${y}"`;return r.push(`${h}${$}`),r},[]),$e=(e={},n,t,s)=>{const r=be(e,n,t,s);return r.length===0?"":` ${r.join(" ")}`},Oe=(e={})=>Object.keys(e).map(n=>({_name:n,_content:e[n]})),ve=e=>_e.includes(Y(e)),je=e=>!e.match("<"),ke=({header:e,isOutputStart:n})=>e&&n?typeof e===m.BOOLEAN?ge:e:"",ne={"<":"<",">":">","&":"&",'"':"""},U=(e={},n={})=>{const{depth:t=0,indent:s,_isFirstItem:r,_isOutputStart:p=!0,header:h,attributeReplacements:_={},attributeFilter:y,attributeExplicitTrue:$=!1,contentReplacements:F={},contentMap:M,selfCloseTags:B=!0}=n,J=typeof _=="boolean"&&!_?{}:{...ne,..._},G=typeof F=="boolean"&&!F?{}:{...ne,...F},D=typeof s=="string",k=ye(s,t),W=Y(e),L=ke({header:h,isOutputStart:p}),N=p&&!L&&r&&t===0,R=D&&!N?`
|
|
2
2
|
`:"";let b="";switch(W){case m.JSTOXML_OBJECT:{const{_name:f,_content:u}=e;if(u===null&&typeof M!="function"){b=`${R}${k}${f}`;break}if(Array.isArray(u)&&u.every(ve))return u.map(j=>U({_name:f,_content:j},{...n,depth:t,_isOutputStart:!1})).join("");if(ee.includes(f))break;const g=U(u,{...n,depth:t+1,_isOutputStart:N}),w=Y(g),O=je(g),v=re(g),x=`${R}${k}`;if(f==="_comment"){b+=`${x}<!-- ${u} -->`;break}const H=w==="undefined"||g==="",c=B,o=e._selfCloseTag,a=typeof o===m.BOOLEAN?H&&o:H&&c,i=a?"/":"",l=$e(e._attrs,J,y,$),d=`<${f}${l}${i}>`,T=D&&!O&&!v?`
|
|
3
|
-
${k}`:"",S=a?"":`${g}${T}</${f}>`;b+=`${x}${d}${S}`;break}case m.OBJECT:{const f=Object.keys(e);b=f.map((u,g)=>{const w={...n,_isFirstItem:g===0,_isLastItem:g+1===f.length,_isOutputStart:N},O={_name:u};if(Y(e[u])===m.OBJECT&&(ee.forEach(v=>{const x=e[u][v];typeof x<"u"&&(O[v]=x,delete e[u][v])}),typeof e[u]._content<"u"&&Object.keys(e[u]).length>1)){const v=Object.assign({},e[u]);delete v._content,O._content=[...Oe(v),e[u]._content]}return typeof O._content>"u"&&(O._content=e[u]),U(O,w)},n).join("");break}case m.FUNCTION:{const f=e(n);b=U(f,n);break}case m.ARRAY:{b=e.map((f,u)=>{const g={...n,_isFirstItem:u===0,_isLastItem:u+1===e.length,_isOutputStart:N};return U(f,g)}).join("");break}default:{b=ce(e,G,M);break}}return`${L}${b}`},Q=e=>{try{return oe(e)}catch{return}},Te=e=>{if(e.length===0||e.includes("..")||e.startsWith(".")||e.includes("\0")||e.includes("\\"))return!1;if(e.startsWith("@")){const n=e.indexOf("/");return n>1&&!e.includes("/",n+1)}return!e.includes("/")},Se=e=>e.length>0&&!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&!e.includes("\0"),Ae=(e,n,t)=>{const s=`${n.replaceAll("/","+")}@${t}`,r=E(e,"node_modules",".pnpm"),p=Q(E(r,s,"node_modules",n,"package.json"));if(p)return p;let h;try{h=me(r)}catch{return}const _=`${s}_`;for(const y of h){if(!y.startsWith(_))continue;const $=Q(E(r,y,"node_modules",n,"package.json"));if($)return $}},we=(e,n,t)=>{const s=Q(E(e,"node_modules",n,"package.json"));return s?.version===t?s:void 0},xe=(e,n,t)=>{if(!(!Te(n)||!Se(t)))return Ae(e,n,t)??we(e,n,t)},De={sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"},Ne={sha256:64,sha384:96,sha512:128},Re=e=>{const n={name:e.name,version:e.version},{integrity:t}=e;return t&&t.hex.length===Ne[t.algorithm]&&(n.hash={alg:De[t.algorithm],content:t.hex}),e.dependencies&&(n.dependencies=e.dependencies),e.peerDependencies&&(n.peerDependencies=e.peerDependencies),e.optionalDependencies&&(n.optionalDependencies=e.optionalDependencies),n},Ce=[{file:"pnpm-lock.yaml",type:"pnpm"},{file:"npm-shrinkwrap.json",type:"npm"},{file:"package-lock.json",type:"npm"},{file:"yarn.lock",type:"yarn"},{file:"bun.lock",type:"bun"}],Ee=e=>{for(const{file:n,type:t}of Ce){let s;try{s=ue(E(e,n))}catch{continue}const r=new Map;for(const p of de(s,t))r.set(`${p.name}@${p.version}`,Re(p));return{packages:r,type:t}}},Me=e=>{const n=e.indexOf(":");return n<=0?e:e.slice(0,n)==="npm"?e.slice(n+1):e},V=(e,n,t)=>{const s=t.get(e);if(!s||s.size===0)return;if(s.has(n))return n;const r=Me(n);if(r!==n&&s.has(r))return r;const p=[...s];return he.maxSatisfying(p,r,{includePrerelease:!0})||p[0]},Be="1.7",Le="CycloneDX",Ie="http://cyclonedx.org/schema/bom-1.7.schema.json",Ue="@visulima/vis",te=e=>{try{return oe(e)}catch{return}},Fe=e=>{if(e){if(typeof e=="string")return e;if(typeof e=="object"&&e.name)return e.email?`${e.name} <${e.email}>`:e.name}},Je=e=>{if(e)return typeof e=="string"?e:e.url},qe=e=>{if(e)return typeof e=="string"?e:e.url},Pe=e=>{const n=[];e.homepage&&n.push({type:"website",url:e.homepage});const t=Je(e.repository);t&&n.push({type:"vcs",url:t});const s=qe(e.bugs);return s&&n.push({type:"issue-tracker",url:s}),n.length>0?n:void 0},Xe=e=>e==="application"||e==="service"||e==="tool"?"application":"library",K=(e,n)=>{if(!n)return;n.description&&(e.description=n.description);const t=Fe(n.author);t&&(e.author=t);const s=fe(n);s&&(e.licenses=s);const r=Pe(n);r&&(e.externalReferences=r)},
|
|
4
|
-
`},Ge=e=>{const n=[];return e.timestamp&&n.push({timestamp:e.timestamp}),e.lifecycles&&e.lifecycles.length>0&&n.push({_content:e.lifecycles.map(t=>{const s=[];return t.phase&&s.push({phase:t.phase}),t.name&&s.push({name:t.name}),t.description&&s.push({description:t.description}),{_content:s,_name:"lifecycle"}}),_name:"lifecycles"}),e.tools?.components&&n.push({_content:[{_content:e.tools.components.map(t=>Z(t)),_name:"components"}],_name:"tools"}),e.component&&n.push(Z(e.component)),{_content:n,_name:"metadata"}},Z=e=>{const n={type:e.type};e["bom-ref"]&&(n["bom-ref"]=e["bom-ref"]);const t=[];e.group&&t.push({group:e.group}),t.push({name:e.name}),e.version&&t.push({version:e.version}),e.description&&t.push({description:e.description}),e.author&&t.push({author:e.author}),e.hashes&&e.hashes.length>0&&t.push({_content:e.hashes.map(r=>({_attrs:{alg:r.alg},_content:r.content,_name:"hash"})),_name:"hashes"});const s=We(e.licenses);return s&&t.push(s),e.purl&&t.push({purl:e.purl}),e.scope&&t.push({scope:e.scope}),e.externalReferences&&e.externalReferences.length>0&&t.push({_content:e.externalReferences.map(r=>({_attrs:{type:r.type},_content:[{url:r.url}],_name:"reference"})),_name:"externalReferences"}),{_attrs:n,_content:t,_name:"component"}},We=e=>{if(!e||e.length===0)return;const n=[];for(const t of e){if("expression"in t){n.push({expression:t.expression});continue}const s=[];"id"in t.license&&t.license.id?s.push({id:t.license.id}):"name"in t.license&&t.license.name&&s.push({name:t.license.name}),n.push({_content:s,_name:"license"})}return{_content:n,_name:"licenses"}},He=e=>e.dependsOn&&e.dependsOn.length>0?{_attrs:{ref:e.ref},_content:e.dependsOn.map(n=>({_attrs:{ref:n},_name:"dependency"})),_name:"dependency"}:{_attrs:{ref:e.ref},_name:"dependency"};export{
|
|
3
|
+
${k}`:"",S=a?"":`${g}${T}</${f}>`;b+=`${x}${d}${S}`;break}case m.OBJECT:{const f=Object.keys(e);b=f.map((u,g)=>{const w={...n,_isFirstItem:g===0,_isLastItem:g+1===f.length,_isOutputStart:N},O={_name:u};if(Y(e[u])===m.OBJECT&&(ee.forEach(v=>{const x=e[u][v];typeof x<"u"&&(O[v]=x,delete e[u][v])}),typeof e[u]._content<"u"&&Object.keys(e[u]).length>1)){const v=Object.assign({},e[u]);delete v._content,O._content=[...Oe(v),e[u]._content]}return typeof O._content>"u"&&(O._content=e[u]),U(O,w)},n).join("");break}case m.FUNCTION:{const f=e(n);b=U(f,n);break}case m.ARRAY:{b=e.map((f,u)=>{const g={...n,_isFirstItem:u===0,_isLastItem:u+1===e.length,_isOutputStart:N};return U(f,g)}).join("");break}default:{b=ce(e,G,M);break}}return`${L}${b}`},Q=e=>{try{return oe(e)}catch{return}},Te=e=>{if(e.length===0||e.includes("..")||e.startsWith(".")||e.includes("\0")||e.includes("\\"))return!1;if(e.startsWith("@")){const n=e.indexOf("/");return n>1&&!e.includes("/",n+1)}return!e.includes("/")},Se=e=>e.length>0&&!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&!e.includes("\0"),Ae=(e,n,t)=>{const s=`${n.replaceAll("/","+")}@${t}`,r=E(e,"node_modules",".pnpm"),p=Q(E(r,s,"node_modules",n,"package.json"));if(p)return p;let h;try{h=me(r)}catch{return}const _=`${s}_`;for(const y of h){if(!y.startsWith(_))continue;const $=Q(E(r,y,"node_modules",n,"package.json"));if($)return $}},we=(e,n,t)=>{const s=Q(E(e,"node_modules",n,"package.json"));return s?.version===t?s:void 0},xe=(e,n,t)=>{if(!(!Te(n)||!Se(t)))return Ae(e,n,t)??we(e,n,t)},De={sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"},Ne={sha256:64,sha384:96,sha512:128},Re=e=>{const n={name:e.name,version:e.version},{integrity:t}=e;return t&&t.hex.length===Ne[t.algorithm]&&(n.hash={alg:De[t.algorithm],content:t.hex}),e.dependencies&&(n.dependencies=e.dependencies),e.peerDependencies&&(n.peerDependencies=e.peerDependencies),e.optionalDependencies&&(n.optionalDependencies=e.optionalDependencies),n},Ce=[{file:"pnpm-lock.yaml",type:"pnpm"},{file:"npm-shrinkwrap.json",type:"npm"},{file:"package-lock.json",type:"npm"},{file:"yarn.lock",type:"yarn"},{file:"bun.lock",type:"bun"}],Ee=e=>{for(const{file:n,type:t}of Ce){let s;try{s=ue(E(e,n))}catch{continue}const r=new Map;for(const p of de(s,t))r.set(`${p.name}@${p.version}`,Re(p));return{packages:r,type:t}}},Me=e=>{const n=e.indexOf(":");return n<=0?e:e.slice(0,n)==="npm"?e.slice(n+1):e},V=(e,n,t)=>{const s=t.get(e);if(!s||s.size===0)return;if(s.has(n))return n;const r=Me(n);if(r!==n&&s.has(r))return r;const p=[...s];return he.maxSatisfying(p,r,{includePrerelease:!0})||p[0]},Be="1.7",Le="CycloneDX",Ie="http://cyclonedx.org/schema/bom-1.7.schema.json",Ue="@visulima/vis",te=e=>{try{return oe(e)}catch{return}},Fe=e=>{if(e){if(typeof e=="string")return e;if(typeof e=="object"&&e.name)return e.email?`${e.name} <${e.email}>`:e.name}},Je=e=>{if(e)return typeof e=="string"?e:e.url},qe=e=>{if(e)return typeof e=="string"?e:e.url},Pe=e=>{const n=[];e.homepage&&n.push({type:"website",url:e.homepage});const t=Je(e.repository);t&&n.push({type:"vcs",url:t});const s=qe(e.bugs);return s&&n.push({type:"issue-tracker",url:s}),n.length>0?n:void 0},Xe=e=>e==="application"||e==="service"||e==="tool"?"application":"library",K=(e,n)=>{if(!n)return;n.description&&(e.description=n.description);const t=Fe(n.author);t&&(e.author=t);const s=fe(n);s&&(e.licenses=s);const r=Pe(n);r&&(e.externalReferences=r)},tn=e=>{const{focus:n,generatorVersion:t,includeDev:s=!1,now:r=new Date,projectGraph:p,serialNumber:h,workspace:_,workspaceRoot:y}=e,$=n&&n.length>0?[...le(n,p)].sort():Object.keys(_.projects).sort(),F=new Set($),M=new Map;for(const c of $){const o=_.projects[c];o&&M.set(c,te(E(y,o.root,"package.json")))}const B=[],J=new Map;for(const c of $){const o=_.projects[c];if(!o)continue;const a=M.get(c),i=a?.version??"0.0.0",l=C(c,i);J.set(c,l);const d={"bom-ref":l,name:c,purl:l,type:Xe(o.projectType),version:i};K(d,a),B.push(d)}const G=Ee(y),D=new Map,k=new Map;if(G)for(const c of G.packages.values()){D.set(`${c.name}@${c.version}`,c);let o=k.get(c.name);o||(o=new Set,k.set(c.name,o)),o.add(c.version)}const W=[],L=[],N=new Map;for(const c of $){const o=M.get(c);if(!o)continue;const a=[o.dependencies,o.peerDependencies];s&&a.push(o.devDependencies);const i=new Set,l=(d,T)=>{if(T)for(const[S,j]of Object.entries(T)){if(F.has(S)){const I=J.get(S);I&&i.add(I);continue}const A=V(S,j,k);A&&(i.add(C(S,A)),d.push(`${S}@${A}`))}};for(const d of a)l(W,d);l(L,o.optionalDependencies),N.set(c,i)}const R=new Map,b=new Map,f=(c,o)=>{const a=[...c];for(;a.length>0;){const i=a.pop(),l=R.get(i);if(l==="required"||l==="optional"&&o==="optional")continue;R.set(i,o);const d=D.get(i);if(!d)continue;const T=b.get(i)??new Set,S=[d.dependencies,d.peerDependencies];for(const j of S)if(j)for(const[A,I]of Object.entries(j))for(const q of I){const z=V(A,q,k);z&&(T.add(C(A,z)),a.push(`${A}@${z}`))}if(d.optionalDependencies)for(const[j,A]of Object.entries(d.optionalDependencies))for(const I of A){const q=V(j,I,k);q&&(T.add(C(j,q)),L.push(`${j}@${q}`))}T.size>0&&b.set(i,T)}};f(W,"required"),f(L,"optional");const u=[],g=[...R.keys()].sort();for(const c of g){const o=D.get(c);if(!o)continue;const a=C(o.name,o.version),i={"bom-ref":a,name:o.name,purl:a,scope:R.get(c)??"required",type:"library",version:o.version};o.hash&&(i.hashes=[o.hash]),K(i,xe(y,o.name,o.version)),u.push(i)}const w=[];for(const[c,o]of N){const a=J.get(c);if(!a)continue;const i=[...o].sort();w.push(i.length>0?{dependsOn:i,ref:a}:{ref:a})}for(const c of g){const o=D.get(c);if(!o)continue;const a=C(o.name,o.version),i=b.get(c),l=i?[...i].sort():[];w.push(l.length>0?{dependsOn:l,ref:a}:{ref:a})}w.sort((c,o)=>c.ref.localeCompare(o.ref));const O=te(E(y,"package.json")),v=(()=>{if(n?.length===1){const l=B.find(d=>d.name===n[0]);if(l)return{"bom-ref":l["bom-ref"],name:l.name,purl:l.purl,type:l.type,version:l.version}}const c=O?.name??"workspace",o=O?.version??"0.0.0",a=C(c,o),i={"bom-ref":a,name:c,purl:a,type:"application",version:o};return K(i,O),i})(),x=v["bom-ref"],H=x?B.filter(c=>c["bom-ref"]!==x):B;return{$schema:Ie,bomFormat:Le,components:[...H,...u],dependencies:w,metadata:{component:v,lifecycles:[{phase:"build"}],timestamp:r.toISOString(),tools:{components:[{name:Ue,type:"application",...t?{version:t}:{}}]}},serialNumber:h??`urn:uuid:${pe()}`,specVersion:Be,version:1}},sn=e=>{const n={version:e.version??1,xmlns:"http://cyclonedx.org/schema/bom/1.7"};e.serialNumber&&(n.serialNumber=e.serialNumber);const t=[];return e.metadata&&t.push(Ge(e.metadata)),e.components&&e.components.length>0&&t.push({_content:e.components.map(s=>Z(s)),_name:"components"}),e.dependencies&&e.dependencies.length>0&&t.push({_content:e.dependencies.map(s=>He(s)),_name:"dependencies"}),`${U({_attrs:n,_content:t,_name:"bom"},{header:!0,indent:" ",selfCloseTags:!0})}
|
|
4
|
+
`},Ge=e=>{const n=[];return e.timestamp&&n.push({timestamp:e.timestamp}),e.lifecycles&&e.lifecycles.length>0&&n.push({_content:e.lifecycles.map(t=>{const s=[];return t.phase&&s.push({phase:t.phase}),t.name&&s.push({name:t.name}),t.description&&s.push({description:t.description}),{_content:s,_name:"lifecycle"}}),_name:"lifecycles"}),e.tools?.components&&n.push({_content:[{_content:e.tools.components.map(t=>Z(t)),_name:"components"}],_name:"tools"}),e.component&&n.push(Z(e.component)),{_content:n,_name:"metadata"}},Z=e=>{const n={type:e.type};e["bom-ref"]&&(n["bom-ref"]=e["bom-ref"]);const t=[];e.group&&t.push({group:e.group}),t.push({name:e.name}),e.version&&t.push({version:e.version}),e.description&&t.push({description:e.description}),e.author&&t.push({author:e.author}),e.hashes&&e.hashes.length>0&&t.push({_content:e.hashes.map(r=>({_attrs:{alg:r.alg},_content:r.content,_name:"hash"})),_name:"hashes"});const s=We(e.licenses);return s&&t.push(s),e.purl&&t.push({purl:e.purl}),e.scope&&t.push({scope:e.scope}),e.externalReferences&&e.externalReferences.length>0&&t.push({_content:e.externalReferences.map(r=>({_attrs:{type:r.type},_content:[{url:r.url}],_name:"reference"})),_name:"externalReferences"}),{_attrs:n,_content:t,_name:"component"}},We=e=>{if(!e||e.length===0)return;const n=[];for(const t of e){if("expression"in t){n.push({expression:t.expression});continue}const s=[];"id"in t.license&&t.license.id?s.push({id:t.license.id}):"name"in t.license&&t.license.name&&s.push({name:t.license.name}),n.push({_content:s,_name:"license"})}return{_content:n,_name:"licenses"}},He=e=>e.dependsOn&&e.dependsOn.length>0?{_attrs:{ref:e.ref},_content:e.dependsOn.map(n=>({_attrs:{ref:n},_name:"dependency"})),_name:"dependency"}:{_attrs:{ref:e.ref},_name:"dependency"};export{tn as b,sn as s,C as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=e=>e;export{t as defineFormatter};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{v as u,m as l,f as g}from"./index-BDmTbWX1.js";import{D as d,e as D,W as v}from"../packem_chunks/bin.js";import"./public-api-WqUCiyIe.js";const w={bun:{file:"bun.lock",type:"bun"},npm:{aliases:["npm-shrinkwrap.json"],file:"package-lock.json",type:"npm"},pnpm:{file:"pnpm-lock.yaml",type:"pnpm"},yarn:{file:"yarn.lock",type:"yarn"}},j=o=>{const t=w[o];return t?[...t.aliases??[],t.file].map(e=>({file:e,type:t.type})):[]},m=(o,t)=>{const e=j(t);if(e.length!==0)return e.find(r=>g(l(o,r.file)))??e[e.length-1]},k=o=>{try{return JSON.parse(u(o))}catch{return}},y=o=>{const t=[],e=k(l(o,"package.json"));e&&t.push(e);const r=D(o);let c;if(r?c=r:e?.workspaces&&(Array.isArray(e.workspaces)?c=e.workspaces:e.workspaces.packages&&(c=e.workspaces.packages)),!c)return t;const a=v(o,c);for(const s of a){const n=k(l(o,s,"package.json"));n&&t.push(n)}return t},b=(o,t)=>{const e=new Set,r=[],c=new Map;for(const s of t){const n=c.get(s.name);n?n.push(s):c.set(s.name,[s])}const a=s=>{if(s)for(const n of Object.keys(s))e.has(n)||(e.add(n),r.push(n))};for(const s of y(o))a(s.dependencies),a(s.peerDependencies),a(s.optionalDependencies);for(;r.length>0;){const s=r.shift(),n=c.get(s);if(n){for(const i of n)for(const p of[i.dependencies,i.peerDependencies,i.optionalDependencies])if(p)for(const f of Object.keys(p))e.has(f)||(e.add(f),r.push(f))}}return e},$=(o,t,e={})=>{const r=m(o,t);if(!r)return[];let c;try{c=u(l(o,r.file))}catch{return[]}const a=d(c,r.type);if(a.length===0)return[];const s=e.includeDev??!0?void 0:b(o,a),n=new Set,i=[];for(const p of a){if(s&&!s.has(p.name))continue;const f=`${p.name}@${p.version}`;n.has(f)||(n.add(f),i.push({isDev:!1,name:p.name,version:p.version}))}return i},A=(o,t)=>{const e=m(o,t);if(!e)return[];let r;try{r=u(l(o,e.file))}catch{return[]}const c=d(r,e.type);if(c.length===0)return[];const a=new Map;for(const n of c)a.has(n.name)||a.set(n.name,new Set),a.get(n.name).add(n.version);const s=[];for(const[n,i]of a)i.size<=1||s.push({name:n,versions:[...i]});return s.sort((n,i)=>n.name.localeCompare(i.name))},E=(o,t)=>{const e=m(o,t);if(!e)return;let r;try{r=u(l(o,e.file))}catch{return}const c=d(r,e.type);if(c.length===0)return;const a=[],s=new Set;for(const n of y(o))for(const i of[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies])if(i)for(const[p,f]of Object.entries(i)){const h=`${p}@${f}`;s.has(h)||(s.add(h),a.push({name:p,version:f}))}return{entries:c,roots:a}};export{w as L,E as a,A as f,$ as l,m as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as Qo}from"node:module";import{m as Ie,f as ia,y as oa,H as jn,T as fi,a as aa}from"./index-BDmTbWX1.js";import{
|
|
1
|
+
import{createRequire as Qo}from"node:module";import{m as Ie,f as ia,y as oa,H as jn,T as fi,a as aa}from"./index-BDmTbWX1.js";import{h as sa,L as ua}from"./public-api-WqUCiyIe.js";import{a as ro}from"../packem_chunks/config.js";const ea=Qo(import.meta.url),zt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ta=l=>{if(typeof zt<"u"&&zt.versions&&zt.versions.node){const[d,A]=zt.versions.node.split(".").map(Number);if(d>22||d===22&&A>=3||d===20&&A>=16)return zt.getBuiltinModule(l)}return ea(l)},{rmSync:_n,existsSync:eo,readFileSync:li,cpSync:to,lstatSync:ra,readdirSync:na}=ta("node:fs");class et extends Error{constructor(d){super(d),this.name="LockfilePruneError"}}const no=l=>{let d=l.startsWith("/")?l.slice(1):l;const A=d.indexOf("(");return A!==-1&&(d=d.slice(0,A)),d},ca=(l,d)=>{if(!(d.startsWith("link:")||d.startsWith("file:")||d.startsWith("workspace:")))return`${l}@${d}`},la=l=>{const d=[];for(const A of[l.dependencies,l.devDependencies,l.optionalDependencies])if(A)for(const[o,h]of Object.entries(A))h?.version&&d.push({name:o,version:h.version});return d},pi=l=>{const d=[];for(const A of[l.dependencies,l.optionalDependencies])if(A)for(const[o,h]of Object.entries(A))typeof h=="string"&&d.push({name:o,version:h});return d},hi=l=>{const d=new Map;if(!l)return d;for(const A of Object.keys(l)){const o=no(A),h=d.get(o);h?h.push(A):d.set(o,[A])}return d},io=l=>{const d=l.displayName??"pnpm-lock.yaml",A=typeof l.lockfileContent=="string"?l.lockfileContent:l.lockfileContent.toString("utf8");let o;try{o=sa(A)}catch(Z){throw new et(`${d}: parse failed — ${Z.message}`)}const h=Z=>Z.packages?Object.keys(Z.packages).length:0;let e;for(const Z of o){const[te]=Z.errors;if(te)throw new et(`${d}: parse failed — ${te.message}`);const q=Z.toJS();if(!q||typeof q!="object")continue;const ue=q;(e===void 0||h(ue)>h(e))&&(e=ue)}if(e===void 0)throw new et(`${d}: top-level value is not an object`);const g=e.importers??{},C=hi(e.packages),m=hi(e.snapshots),S=new Set(["."]);for(const Z of l.closure)S.add(Z.relativeRoot===""?".":Z.relativeRoot);const E={};for(const[Z,te]of Object.entries(g))S.has(Z)&&(E[Z]=te);const Y=new Set,y=new Set,b=[];for(const Z of Object.values(E))for(const te of la(Z))b.push(te);for(;b.length>0;){const{name:Z,version:te}=b.shift(),q=ca(Z,te);if(!q)continue;const ue=no(q),Ce=m.get(ue)??m.get(q)??[];for(const Ae of Ce){if(y.has(Ae))continue;y.add(Ae);const Ee=e.snapshots?.[Ae];if(Ee)for(const Oe of pi(Ee))b.push(Oe)}const ge=C.get(ue)??C.get(q)??[];for(const Ae of ge){if(Y.has(Ae))continue;Y.add(Ae);const Ee=e.packages?.[Ae];if(Ee&&!e.snapshots)for(const Oe of pi(Ee))b.push(Oe)}}const v={lockfileVersion:e.lockfileVersion};for(const Z of["settings","overrides","patchedDependencies","catalogs"])e[Z]!==void 0&&(v[Z]=e[Z]);if(v.importers=E,e.packages){const Z={};for(const te of Object.keys(e.packages))Y.has(te)&&(Z[te]=e.packages[te]);v.packages=Z}if(e.snapshots){const Z={};for(const te of Object.keys(e.snapshots))y.has(te)&&(Z[te]=e.snapshots[te]);v.snapshots=Z}const M=Object.keys(e.packages??{}).length,re=Object.keys(v.packages??{}).length,ae=M-re,x=Object.keys(g).length-Object.keys(E).length;return{content:ua(v,{lineWidth:0}),message:`${d}: kept ${re}/${M} packages and ${Object.keys(E).length} importers (dropped ${ae} packages, ${x} importers)`,status:"pruned"}},fa=l=>io({...l,displayName:l.displayName??"aube-lock.yaml"}),pa=l=>{let d="",A=!1,o=!1,h=!1;for(let e=0;e<l.length;e+=1){const g=l[e],C=l[e+1];if(o){g===`
|
|
2
2
|
`&&(o=!1,d+=g);continue}if(h){g==="*"&&C==="/"&&(h=!1,e+=1);continue}if(A){if(g==="\\"){d+=g,C!==void 0&&(d+=C,e+=1);continue}g==='"'&&(A=!1),d+=g;continue}if(g==='"'){A=!0,d+=g;continue}if(g==="/"&&C==="/"){o=!0,e+=1;continue}if(g==="/"&&C==="*"){h=!0,e+=1;continue}d+=g}return d},ha=l=>{const d=[];for(const A of[l.dependencies,l.devDependencies,l.optionalDependencies,l.peerDependencies])if(A)for(const[o,h]of Object.entries(A))typeof h=="string"&&d.push({name:o,spec:h});return d},da=l=>{for(const d of l)if(typeof d=="object"&&!Array.isArray(d))return d},ga=l=>{if(!l)return[];const d=[];for(const A of["dependencies","optionalDependencies","peerDependencies"]){const o=l[A];o!==null&&typeof o=="object"&&!Array.isArray(o)&&d.push(...Object.keys(o))}return d},ma=l=>{if(Buffer.isBuffer(l.lockfileContent))return{message:"bun.lockb is binary; run `bun install --save-text-lockfile` to regenerate as bun.lock, then rerun `vis docker scaffold`.",status:"skipped"};const d=pa(l.lockfileContent);let A;try{A=JSON.parse(d)}catch(M){throw new et(`bun.lock: parse failed — ${M.message}`)}if(!A||typeof A!="object")throw new et("bun.lock: top-level value is not an object");const o=A.workspaces??{},h=A.packages??{},e=new Set([""]);for(const M of l.closure)e.add(M.relativeRoot===""?"":M.relativeRoot);const g={},C=[];for(const[M,re]of Object.entries(o))e.has(M)&&(g[M]=re,C.push(...ha(re)));const m=new Set;for(const{name:M}of C)m.add(M);const S=[...m];for(;S.length>0;){const M=S.shift();for(const re of Object.keys(h)){if(re.split("/")[0]!==M&&re!==M)continue;const ae=da(h[re]);for(const x of ga(ae))m.has(x)||(m.add(x),S.push(x))}}const E={};for(const[M,re]of Object.entries(h)){const ae=M.split("/")[0];(m.has(ae)||m.has(M))&&(E[M]=re)}const Y={...A,packages:E,workspaces:g},y=Object.keys(h).length,b=Object.keys(E).length,v=y-b;return{content:`${JSON.stringify(Y,null,2)}
|
|
3
3
|
`,message:`bun.lock: kept ${b}/${y} packages (dropped ${v})`,status:"pruned"}},Vr="node_modules/",ya=(l,d,A)=>{let o=d;for(;;){const h=o===""?`${Vr}${A}`:`${o}/${Vr}${A}`;if(l[h]!==void 0)return h;if(o==="")return;const e=o.lastIndexOf(`/${Vr.slice(0,-1)}/`);o=e===-1?"":o.slice(0,e)}},va=l=>{const d=[];for(const A of[l.dependencies,l.devDependencies,l.optionalDependencies,l.peerDependencies])if(A)for(const o of Object.keys(A))d.push(o);return d},Aa=l=>{const d=l.displayName??"package-lock.json",A=typeof l.lockfileContent=="string"?l.lockfileContent:l.lockfileContent.toString("utf8");let o;try{o=JSON.parse(A)}catch(v){throw new et(`${d}: parse failed — ${v.message}`)}if(!o||typeof o!="object")throw new et(`${d}: top-level value is not an object`);const h=o.packages??{},e=new Set([""]);for(const v of l.closure)v.relativeRoot!==""&&e.add(v.relativeRoot);const g=new Set,C=[];for(const v of Object.keys(h))e.has(v)&&(g.add(v),C.push(v));for(const[v,M]of Object.entries(h))M.link===!0&&typeof M.resolved=="string"&&e.has(M.resolved)&&g.add(v);for(;C.length>0;){const v=C.shift(),M=h[v];if(M)for(const re of va(M)){const ae=ya(h,v,re);if(!ae||g.has(ae))continue;g.add(ae);const x=h[ae];x.link===!0&&typeof x.resolved=="string"&&h[x.resolved]!==void 0&&!g.has(x.resolved)?(g.add(x.resolved),C.push(x.resolved)):C.push(ae)}}const m={};for(const v of Object.keys(h))g.has(v)&&(m[v]=h[v]);const S=m[""];S&&Array.isArray(S.workspaces)&&(S.workspaces=S.workspaces.filter(v=>{if(typeof v!="string")return!1;const M=v.replace(/\/?\*+$/,"").replace(/\/$/,"");if(M===""||M==="*")return!0;for(const re of e)if(re===v||re===M||re.startsWith(`${M}/`))return!0;return!1}));const E={...o,packages:m};delete E.dependencies;const Y=Object.keys(h).length,y=Object.keys(m).length,b=Y-y;return{content:`${JSON.stringify(E,null,2)}
|
|
4
4
|
`,message:`${d}: kept ${y}/${Y} entries (dropped ${b})`,status:"pruned"}};var Kr={},xe={},Zr,di;function ba(){if(di)return Zr;di=1;function l(o,h){function e(){this.constructor=o}e.prototype=h.prototype,o.prototype=new e}function d(o,h,e,g){this.message=o,this.expected=h,this.found=e,this.location=g,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,d)}l(d,Error),d.buildMessage=function(o,h){var e={literal:function(y){return'"'+C(y.text)+'"'},class:function(y){var b="",v;for(v=0;v<y.parts.length;v++)b+=y.parts[v]instanceof Array?m(y.parts[v][0])+"-"+m(y.parts[v][1]):m(y.parts[v]);return"["+(y.inverted?"^":"")+b+"]"},any:function(y){return"any character"},end:function(y){return"end of input"},other:function(y){return y.description}};function g(y){return y.charCodeAt(0).toString(16).toUpperCase()}function C(y){return y.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(b){return"\\x0"+g(b)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(b){return"\\x"+g(b)})}function m(y){return y.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(b){return"\\x0"+g(b)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(b){return"\\x"+g(b)})}function S(y){return e[y.type](y)}function E(y){var b=new Array(y.length),v,M;for(v=0;v<y.length;v++)b[v]=S(y[v]);if(b.sort(),b.length>0){for(v=1,M=1;v<b.length;v++)b[v-1]!==b[v]&&(b[M]=b[v],M++);b.length=M}switch(b.length){case 1:return b[0];case 2:return b[0]+" or "+b[1];default:return b.slice(0,-1).join(", ")+", or "+b[b.length-1]}}function Y(y){return y?'"'+C(y)+'"':"end of input"}return"Expected "+E(o)+" but "+Y(h)+" found."};function A(o,h){h=h!==void 0?h:{};var e={},g={Start:Jn},C=Jn,m=function(t){return t||[]},S=function(t,i,a){return[{command:t,type:i}].concat(a||[])},E=function(t,i){return[{command:t,type:i||";"}]},Y=function(t){return t},y=";",b=ce(";",!1),v="&",M=ce("&",!1),re=function(t,i){return i?{chain:t,then:i}:{chain:t}},ae=function(t,i){return{type:t,line:i}},x="&&",Z=ce("&&",!1),te="||",q=ce("||",!1),ue=function(t,i){return i?{...t,then:i}:t},Ce=function(t,i){return{type:t,chain:i}},ge="|&",Ae=ce("|&",!1),Ee="|",Oe=ce("|",!1),Fe="=",Ue=ce("=",!1),ye=function(t,i){return{name:t,args:[i]}},Me=function(t){return{name:t,args:[]}},Ze="(",$e=ce("(",!1),ee=")",Ne=ce(")",!1),De=function(t,i){return{type:"subshell",subshell:t,args:i}},Re="{",qe=ce("{",!1),we="}",W=ce("}",!1),U=function(t,i){return{type:"group",group:t,args:i}},ie=function(t,i){return{type:"command",args:i,envs:t}},ve=function(t){return{type:"envs",envs:t}},Je=function(t){return t},ze=function(t){return t},Pe=/^[0-9]/,Ye=We([["0","9"]],!1,!1),tt=function(t,i,a){return{type:"redirection",subtype:i,fd:t!==null?parseInt(t):null,args:[a]}},rt=">>",Ct=ce(">>",!1),st=">&",ut=ce(">&",!1),wt=">",He=ce(">",!1),ht="<<<",Xe=ce("<<<",!1),Ve="<&",dt=ce("<&",!1),St="<",gt=ce("<",!1),r=function(t){return{type:"argument",segments:[].concat(...t)}},$=function(t){return t},j="$'",K=ce("$'",!1),P="'",u=ce("'",!1),w=function(t){return[{type:"text",text:t}]},O='""',R=ce('""',!1),N=function(){return{type:"text",text:""}},H='"',T=ce('"',!1),z=function(t){return t},G=function(t){return{type:"arithmetic",arithmetic:t,quoted:!0}},ne=function(t){return{type:"shell",shell:t,quoted:!0}},de=function(t){return{type:"variable",...t,quoted:!0}},le=function(t){return{type:"text",text:t}},_e=function(t){return{type:"arithmetic",arithmetic:t,quoted:!1}},kr=function(t){return{type:"shell",shell:t,quoted:!1}},Er=function(t){return{type:"variable",...t,quoted:!1}},nr=function(t){return{type:"glob",pattern:t}},Tt=/^[^']/,Lt=We(["'"],!0,!1),mt=function(t){return t.join("")},ir=/^[^$"]/,or=We(["$",'"'],!0,!1),Ht=`\\
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as m}from"node:module";import{m as _}from"./index-BDmTbWX1.js";import{
|
|
1
|
+
import{createRequire as m}from"node:module";import{m as _}from"./index-BDmTbWX1.js";import{a as F}from"../packem_chunks/bin.js";const p=m(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=r=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,e]=o.versions.node.split(".").map(Number);if(t>22||t===22&&e>=3||t===20&&e>=16)return o.getBuiltinModule(r)}return p(r)},{mkdirSync:f,writeFileSync:h,readdirSync:g}=c("node:fs"),{readFile:y}=c("node:fs/promises"),n=r=>F(r),a=(r,t)=>_(n(r),`${encodeURIComponent(t)}.json`);class S{#t;#e;constructor(t,e){this.#t=t,this.#e=e}printTaskTerminalOutput(t,e,s){if(e!=="failure")return;const i=n(this.#t);try{f(i,{recursive:!0})}catch{return}const u=t.overrides.command,d=t.projectRoot,l={command:u,cwd:d,exitCode:void 0,hash:t.hash,runId:this.#e,status:e,taskId:t.id,terminalOutput:s,timestamp:new Date().toISOString()};try{h(a(this.#t,t.id),`${JSON.stringify(l,void 0,2)}
|
|
2
2
|
`,"utf8")}catch{}}}const I=async(r,t)=>{const e=a(r,t);try{const s=await y(e,"utf8");return JSON.parse(s)}catch{return}},O=r=>{const t=n(r);let e;try{e=g(t)}catch{return[]}const s=[];for(const i of e)if(i.endsWith(".json"))try{s.push(decodeURIComponent(i.slice(0,-5)))}catch{}return s};export{S as F,I as a,O as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as h,g as k,D as $,f as S}from"./provenance-_CJjMKwu.js";import{Z as d,D as N}from"../packem_chunks/bin.js";import{W as R}from"./build-scripts-CCCi8U66.js";import{n as v}from"./license-t5KnNX6v.js";import{A as L,B as D,v as A}from"./index-BDmTbWX1.js";import"./public-api-WqUCiyIe.js";import{L as w}from"./dependency-scan-anTuZB1t.js";const m={CRITICAL:0,HIGH:1,LOW:3,MODERATE:2,UNKNOWN:4},se=(t,e)=>{const n=m[(t.vulnerability.severity??"UNKNOWN").toUpperCase()]??4,s=m[(e.vulnerability.severity??"UNKNOWN").toUpperCase()]??4;return n-s||t.packageName.localeCompare(e.packageName)||t.packageVersion.localeCompare(e.packageVersion)},P=(t,e)=>{const n=m[e.toUpperCase()]??2;return(m[t.toUpperCase()]??4)<=n},b=["firstSeen","installScripts","license","malware","publisherChange","score","unexpectedDeps","vulnerability"],g=6e4,W=(t,e,n)=>{for(const s of n)if(s===t||s===`${t}@${e}`||s.endsWith("*")&&t.startsWith(s.slice(0,-1)))return!0;return!1},x=async(t,e)=>{const n=e.security?.policies?.firstSeen;if(n?.minutes===void 0||n.minutes<=0)return[];const{minutes:s}=n,a=n.exclude??[],r=e.security?.acceptedRisks,c=s*g,i=Date.now();return(await h(t.packages,$,async o=>{if(W(o.name,o.version,a))return;const l=await k(o.name,{workspaceRoot:t.workspaceRoot});if(l===void 0)return;const p=l.time?.[o.version];if(p===void 0)return;const u=Date.parse(p);if(Number.isNaN(u))return;const f=i-u;if(f>=c)return;const y=Math.max(0,Math.floor(f/g));return{acceptedRisk:d(o.name,o.version,r,"firstSeen"),data:{ageMinutes:y,minimumMinutes:s,publishedAt:p},packageName:o.name,policy:"firstSeen",reason:`${o.name}@${o.version} was published ${String(y)} min ago — below the ${String(s)} min firstSeen cooldown.`,severity:"block",version:o.version}})).filter(o=>o!==void 0)},O=(t,e)=>{const n=e.security?.policies?.installScripts;if(!n)return[];const s=n.allow??{},a=n.strict===!0;if(!a&&Object.keys(s).length===0)return[];const r=R(t.workspaceRoot,s,{pinVersions:e.security?.pinVersions===!0});if(r.unapproved.length===0)return[];const c=e.security?.acceptedRisks,i=a?"block":"warn";return r.unapproved.map(o=>({acceptedRisk:d(o.name,o.version??"*",c,"installScripts"),data:{hooks:o.hooks},packageName:o.name,policy:"installScripts",reason:`${o.name}${o.version?`@${o.version}`:""} declares unapproved build script(s): ${o.hooks.join(", ")}`,severity:i,version:o.version??"*"}))},U=new Set(["AND","OR"]),E=t=>{const e=t.replaceAll("("," ").replaceAll(")"," ").split(/\s+/).map(a=>a.trim()).filter(a=>a.length>0),n=[];let s=!1;for(const a of e){const r=a.toUpperCase();if(s){s=!1;continue}if(r==="WITH"){s=!0;continue}if(U.has(r))continue;const c=a.endsWith("+"),i=c?a.slice(0,-1):a,o=v(i)??i;n.push(o),c&&n.push(`${o}-or-later`)}return n},F=t=>{if(typeof t.license=="string"){const e=t.license.trim();return e.length>0?e:void 0}if(t.license&&typeof t.license=="object"&&typeof t.license.type=="string"){const e=t.license.type.trim();if(e.length>0)return e}if(Array.isArray(t.licenses)&&t.licenses.length>0){const e=t.licenses.map(n=>n&&typeof n.type=="string"?n.type.trim():"").filter(n=>n.length>0);if(e.length>0)return e.length===1?e[0]:`(${e.join(" OR ")})`}},I=(t,e)=>{if(e.length===0)return;const n=new Set(e.map(s=>v(s)??s).map(s=>s.toLowerCase()));for(const s of t)if(n.has(s.toLowerCase()))return s},M=(t,e)=>{if(e.length===0)return;const n=new Set(e.map(s=>v(s)??s).map(s=>s.toLowerCase()));for(const s of t)if(!n.has(s.toLowerCase()))return s},V=(t,e)=>{const n=e.security?.policies?.license;if(!n)return[];const s=n.allow??[],a=n.deny??[];if(s.length===0&&a.length===0)return[];const r=e.security?.acceptedRisks,c=[];for(const i of t.packages){const o=t.manifestData?.get(`${i.name}@${i.version}`),l=o?F(o):void 0;if(!l){s.length>0&&c.push({acceptedRisk:d(i.name,i.version,r,"license"),data:{declaredLicense:null},packageName:i.name,policy:"license",reason:`${i.name}@${i.version} declares no license; allow-list mode requires one of: ${s.join(", ")}`,severity:"block",version:i.version});continue}const p=E(l),u=I(p,a);if(u){c.push({acceptedRisk:d(i.name,i.version,r,"license"),data:{declaredLicense:l,deniedLicense:u},packageName:i.name,policy:"license",reason:`${i.name}@${i.version} uses denied license '${u}' (declared: ${l})`,severity:"block",version:i.version});continue}const f=M(p,s);f&&c.push({acceptedRisk:d(i.name,i.version,r,"license"),data:{allowList:s,declaredLicense:l,unallowedLicense:f},packageName:i.name,policy:"license",reason:`${i.name}@${i.version} uses license '${f}' which is not on the allow-list (declared: ${l})`,severity:"block",version:i.version})}return c},j=6e4,_=(t,e,n)=>{for(const s of n)if(s===t||s===`${t}@${e}`||s.endsWith("*")&&t.startsWith(s.slice(0,-1)))return!0;return!1},H=async(t,e)=>{const n=e.security?.policies?.publisherChange;if(n?.mode!=="no-downgrade")return[];const s=n.exclude??[],a=typeof n.ignoreAfter=="number"?n.ignoreAfter*j:void 0,r=e.security?.acceptedRisks,c=Date.now();return(await h(t.packages,$,async i=>{if(_(i.name,i.version,s))return;const o=await k(i.name,{workspaceRoot:t.workspaceRoot});if(o===void 0)return;if(a!==void 0){const p=o.time?.[i.version],u=p===void 0?Number.NaN:Date.parse(p);if(!Number.isNaN(u)&&c-u>a)return}if(o.versions[i.version]?.dist?.attestations?.provenance!==void 0)return;const l=S(o,i.version);if(l!==void 0)return{acceptedRisk:d(i.name,i.version,r,"publisherChange"),data:{priorVersionWithProvenance:l},packageName:i.name,policy:"publisherChange",reason:`${i.name}@${i.version} dropped the provenance attestation that ${i.name}@${l} carried — publisher trust downgrade.`,severity:"block",version:i.version}})).filter(i=>i!==void 0)},T=t=>{for(const e of Object.values(w))for(const n of[e.file,...e.aliases??[]])if(t===n||t.endsWith(`/${n}`)||t.endsWith(`.${n}`))return e.type},K=(t,e,n)=>{const s=L(e)?e:D(t,e);let a;try{a=A(s)}catch{return}const r=T(s)??w[n]?.type;if(!r)return;const c=N(a,r);if(c.length===0)return;const i=new Set;for(const o of c)i.add(`${o.name}@${o.version}`);return i},z=(t,e)=>{for(const n of e)if(n===t||n.endsWith("*")&&t.startsWith(n.slice(0,-1)))return!0;return!1},Y=(t,e)=>{const n=e.security?.policies?.unexpectedDeps;if(!n)return[];const s=n.allow??[],a=n.baselineLockfile;if(s.length===0&&!a)return[];const r=a?K(t.workspaceRoot,a,t.packageManager):void 0,c=e.security?.acceptedRisks,i=[];for(const o of t.packages){const l=s.length===0||z(o.name,s),p=r?r.has(`${o.name}@${o.version}`):!0;if(l&&p)continue;const u=[],f={};l||(u.push(`not on allow-list (${s.length} entr${s.length===1?"y":"ies"})`),f.allowList=s),!p&&r&&(u.push(`not present in baseline lockfile (${a})`),f.baselineLockfile=a),i.push({acceptedRisk:d(o.name,o.version,c,"unexpectedDeps"),data:f,packageName:o.name,policy:"unexpectedDeps",reason:`${o.name}@${o.version} is unexpected: ${u.join("; ")}`,severity:"block",version:o.version})}return i},q=(t,e)=>{if(!t.osvFindings||t.osvFindings.size===0)return[];const n=e.security?.policies?.vulnerability?.failOn,s=e.security?.acceptedRisks,a=[];for(const r of t.packages){const c=t.osvFindings.get(r.name);if(!(!c||c.length===0))for(const i of c){const o=n?P(i.severity,n)?"block":"warn":"info";a.push({acceptedRisk:d(r.name,r.version,s,"vulnerability"),data:{advisoryId:i.id,aliases:i.aliases??[],cvssScore:i.cvssScore,fixedVersions:i.fixedVersions,severity:i.severity,summary:i.summary},packageName:r.name,policy:"vulnerability",reason:`${i.severity} ${i.id} affects ${r.name}@${r.version}: ${i.summary}`,severity:o,version:r.version})}}return a},C=[{evaluate:q,isConfigured:t=>t.security?.policies?.vulnerability!==void 0,name:"vulnerability",offlineSupported:!0,surfaces:["audit","doctor"]},{evaluate:V,isConfigured:t=>{const e=t.security?.policies?.license;return!!(e&&(e.allow&&e.allow.length>0||e.deny&&e.deny.length>0))},name:"license",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:O,isConfigured:t=>{const e=t.security?.policies?.installScripts;return!!(e&&(e.allow&&Object.keys(e.allow).length>0||e.strict===!0))},name:"installScripts",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:Y,isConfigured:t=>{const e=t.security?.policies?.unexpectedDeps;return!!(e&&(e.allow&&e.allow.length>0||typeof e.baselineLockfile=="string"))},name:"unexpectedDeps",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:x,isConfigured:t=>{const e=t.security?.policies?.firstSeen?.minutes;return typeof e=="number"&&e>0},name:"firstSeen",offlineSupported:!1,surfaces:["audit","doctor","install"]},{evaluate:H,isConfigured:t=>t.security?.policies?.publisherChange?.mode==="no-downgrade",name:"publisherChange",offlineSupported:!1,surfaces:["audit","doctor","install"]}],B=(t,e,n)=>C.filter(s=>s.surfaces.includes(t)?n!==void 0?n.has(s.name):s.isConfigured(e):!1),ie=async(t,e,n)=>{const s=B(e,n.visConfig,n.enabledPolicies),a=[];for(const r of s){if(t.offline&&!r.offlineSupported){a.push({packageName:"*",policy:r.name,reason:`policy.${r.name} skipped: requires network (--offline)`,severity:"info",version:"*"});continue}try{const c=await r.evaluate(t,n.visConfig);a.push(...c)}catch(c){const i=c instanceof Error?c.message:String(c);a.push({packageName:"*",policy:r.name,reason:`policy.${r.name} failed: ${i}`,severity:"info",version:"*"})}}return a},G=(()=>{const t=new Map;for(const e of b)t.set(e.toLowerCase(),e);return t})(),oe=()=>C.map(t=>t.name),re=(t,e)=>{if(t===void 0)return;const n=t.trim().toLowerCase();if(n===""||n==="none")return new Set;if(n==="all")return new Set(b);const s=new Set;for(const a of t.split(",").map(r=>r.trim()).filter(r=>r.length>0)){const r=a.replace(/^_+/,"").replaceAll(/_+([a-z])/g,(i,o)=>o.toUpperCase()),c=G.get(r.toLowerCase());c===void 0?e?.(a):s.add(c)}return s};export{se as c,ie as e,oe as g,re as p,P as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as Zr}from"./_commonjsHelpers-B5Y90VFO.js";var k={exports:{}},se,er;function x(){return er||(er=1,se={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}),se}var ie,rr;function H(){return rr||(rr=1,ie=process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...l)=>console.error("SEMVER",...l):()=>{}),ie}var tr;function B(){return tr||(tr=1,(function(a,l){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:t,MAX_LENGTH:s}=x(),E=H();l=a.exports={};const o=l.re=[],p=l.safeRe=[],r=l.src=[],R=l.safeSrc=[],e=l.t={};let i=0;const u="[a-zA-Z0-9-]",m=[["\\s",1],["\\d",s],[u,t]],g=S=>{for(const[q,M]of m)S=S.split(`${q}*`).join(`${q}{0,${M}}`).split(`${q}+`).join(`${q}{1,${M}}`);return S},h=(S,q,M)=>{const y=g(q),D=i++;E(S,D,q),e[S]=D,r[D]=q,R[D]=y,o[D]=new RegExp(q,M?"g":void 0),p[D]=new RegExp(y,M?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${u}*`),h("MAINVERSION",`(${r[e.NUMERICIDENTIFIER]})\\.(${r[e.NUMERICIDENTIFIER]})\\.(${r[e.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${r[e.NUMERICIDENTIFIERLOOSE]})\\.(${r[e.NUMERICIDENTIFIERLOOSE]})\\.(${r[e.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${r[e.NONNUMERICIDENTIFIER]}|${r[e.NUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${r[e.NONNUMERICIDENTIFIER]}|${r[e.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASE",`(?:-(${r[e.PRERELEASEIDENTIFIER]}(?:\\.${r[e.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${r[e.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${r[e.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${u}+`),h("BUILD",`(?:\\+(${r[e.BUILDIDENTIFIER]}(?:\\.${r[e.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${r[e.MAINVERSION]}${r[e.PRERELEASE]}?${r[e.BUILD]}?`),h("FULL",`^${r[e.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${r[e.MAINVERSIONLOOSE]}${r[e.PRERELEASELOOSE]}?${r[e.BUILD]}?`),h("LOOSE",`^${r[e.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${r[e.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${r[e.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${r[e.XRANGEIDENTIFIER]})(?:\\.(${r[e.XRANGEIDENTIFIER]})(?:\\.(${r[e.XRANGEIDENTIFIER]})(?:${r[e.PRERELEASE]})?${r[e.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${r[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${r[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${r[e.XRANGEIDENTIFIERLOOSE]})(?:${r[e.PRERELEASELOOSE]})?${r[e.BUILD]}?)?)?`),h("XRANGE",`^${r[e.GTLT]}\\s*${r[e.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${r[e.GTLT]}\\s*${r[e.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h("COERCE",`${r[e.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",r[e.COERCEPLAIN]+`(?:${r[e.PRERELEASE]})?(?:${r[e.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",r[e.COERCE],!0),h("COERCERTLFULL",r[e.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${r[e.LONETILDE]}\\s+`,!0),l.tildeTrimReplace="$1~",h("TILDE",`^${r[e.LONETILDE]}${r[e.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${r[e.LONETILDE]}${r[e.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${r[e.LONECARET]}\\s+`,!0),l.caretTrimReplace="$1^",h("CARET",`^${r[e.LONECARET]}${r[e.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${r[e.LONECARET]}${r[e.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${r[e.GTLT]}\\s*(${r[e.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${r[e.GTLT]}\\s*(${r[e.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${r[e.GTLT]}\\s*(${r[e.LOOSEPLAIN]}|${r[e.XRANGEPLAIN]})`,!0),l.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${r[e.XRANGEPLAIN]})\\s+-\\s+(${r[e.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${r[e.XRANGEPLAINLOOSE]})\\s+-\\s+(${r[e.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(k,k.exports)),k.exports}var ne,sr;function We(){if(sr)return ne;sr=1;const a=Object.freeze({loose:!0}),l=Object.freeze({});return ne=t=>t?typeof t!="object"?a:t:l,ne}var ae,ir;function Hr(){if(ir)return ae;ir=1;const a=/^[0-9]+$/,l=(t,s)=>{if(typeof t=="number"&&typeof s=="number")return t===s?0:t<s?-1:1;const E=a.test(t),o=a.test(s);return E&&o&&(t=+t,s=+s),t===s?0:E&&!o?-1:o&&!E?1:t<s?-1:1};return ae={compareIdentifiers:l,rcompareIdentifiers:(t,s)=>l(s,t)},ae}var oe,nr;function G(){if(nr)return oe;nr=1;const a=H(),{MAX_LENGTH:l,MAX_SAFE_INTEGER:n}=x(),{safeRe:t,t:s}=B(),E=We(),{compareIdentifiers:o}=Hr(),p=(R,e)=>{const i=e.split(".");if(i.length>R.length)return!1;for(let u=0;u<i.length;u++)if(o(R[u],i[u])!==0)return!1;return!0};class r{constructor(e,i){if(i=E(i),e instanceof r){if(e.loose===!!i.loose&&e.includePrerelease===!!i.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>l)throw new TypeError(`version is longer than ${l} characters`);a("SemVer",e,i),this.options=i,this.loose=!!i.loose,this.includePrerelease=!!i.includePrerelease;const u=e.trim().match(i.loose?t[s.LOOSE]:t[s.FULL]);if(!u)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+u[1],this.minor=+u[2],this.patch=+u[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");u[4]?this.prerelease=u[4].split(".").map(m=>{if(/^[0-9]+$/.test(m)){const g=+m;if(g>=0&&g<n)return g}return m}):this.prerelease=[],this.build=u[5]?u[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(a("SemVer.compare",this.version,this.options,e),!(e instanceof r)){if(typeof e=="string"&&e===this.version)return 0;e=new r(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof r||(e=new r(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof r||(e=new r(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let i=0;do{const u=this.prerelease[i],m=e.prerelease[i];if(a("prerelease compare",i,u,m),u===void 0&&m===void 0)return 0;if(m===void 0)return 1;if(u===void 0)return-1;if(u!==m)return o(u,m)}while(++i)}compareBuild(e){e instanceof r||(e=new r(e,this.options));let i=0;do{const u=this.build[i],m=e.build[i];if(a("build compare",i,u,m),u===void 0&&m===void 0)return 0;if(m===void 0)return 1;if(u===void 0)return-1;if(u!==m)return o(u,m)}while(++i)}inc(e,i,u){if(e.startsWith("pre")){if(!i&&u===!1)throw new Error("invalid increment argument: identifier is empty");if(i){const m=`-${i}`.match(this.options.loose?t[s.PRERELEASELOOSE]:t[s.PRERELEASE]);if(!m||m[1]!==i)throw new Error(`invalid identifier: ${i}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",i,u);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",i,u);break;case"prepatch":this.prerelease.length=0,this.inc("patch",i,u),this.inc("pre",i,u);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",i,u),this.inc("pre",i,u);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const m=Number(u)?1:0;if(this.prerelease.length===0)this.prerelease=[m];else{let g=this.prerelease.length;for(;--g>=0;)typeof this.prerelease[g]=="number"&&(this.prerelease[g]++,g=-2);if(g===-1){if(i===this.prerelease.join(".")&&u===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(m)}}if(i){let g=[i,m];if(u===!1&&(g=[i]),p(this.prerelease,i)){const h=this.prerelease[i.split(".").length];isNaN(h)&&(this.prerelease=g)}else this.prerelease=g}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return oe=r,oe}var ue,ar;function j(){if(ar)return ue;ar=1;const a=G();return ue=(n,t,s=!1)=>{if(n instanceof a)return n;try{return new a(n,t)}catch(E){if(!s)return null;throw E}},ue}var le,or;function Jr(){if(or)return le;or=1;const a=j();return le=(n,t)=>{const s=a(n,t);return s?s.version:null},le}var ce,ur;function Kr(){if(ur)return ce;ur=1;const a=j();return ce=(n,t)=>{const s=a(n.trim().replace(/^[=v]+/,""),t);return s?s.version:null},ce}var pe,lr;function Qr(){if(lr)return pe;lr=1;const a=G();return pe=(n,t,s,E,o)=>{typeof s=="string"&&(o=E,E=s,s=void 0);try{return new a(n instanceof a?n.version:n,s).inc(t,E,o).version}catch{return null}},pe}var he,cr;function et(){if(cr)return he;cr=1;const a=j();return he=(n,t)=>{const s=a(n,null,!0),E=a(t,null,!0),o=s.compare(E);if(o===0)return null;const p=o>0,r=p?s:E,R=p?E:s,e=!!r.prerelease.length;if(R.prerelease.length&&!e){if(!R.patch&&!R.minor)return"major";if(R.compareMain(r)===0)return R.minor&&!R.patch?"minor":"patch"}const i=e?"pre":"";return s.major!==E.major?i+"major":s.minor!==E.minor?i+"minor":s.patch!==E.patch?i+"patch":"prerelease"},he}var Ee,pr;function rt(){if(pr)return Ee;pr=1;const a=G();return Ee=(n,t)=>new a(n,t).major,Ee}var fe,hr;function tt(){if(hr)return fe;hr=1;const a=G();return fe=(n,t)=>new a(n,t).minor,fe}var me,Er;function st(){if(Er)return me;Er=1;const a=G();return me=(n,t)=>new a(n,t).patch,me}var Re,fr;function it(){if(fr)return Re;fr=1;const a=j();return Re=(n,t)=>{const s=a(n,t);return s&&s.prerelease.length?s.prerelease:null},Re}var ve,mr;function F(){if(mr)return ve;mr=1;const a=G();return ve=(n,t,s)=>new a(n,s).compare(new a(t,s)),ve}var de,Rr;function nt(){if(Rr)return de;Rr=1;const a=F();return de=(n,t,s)=>a(t,n,s),de}var $e,vr;function at(){if(vr)return $e;vr=1;const a=F();return $e=(n,t)=>a(n,t,!0),$e}var Ie,dr;function ze(){if(dr)return Ie;dr=1;const a=G();return Ie=(n,t,s)=>{const E=new a(n,s),o=new a(t,s);return E.compare(o)||E.compareBuild(o)},Ie}var Le,$r;function ot(){if($r)return Le;$r=1;const a=ze();return Le=(n,t)=>n.sort((s,E)=>a(s,E,t)),Le}var ge,Ir;function ut(){if(Ir)return ge;Ir=1;const a=ze();return ge=(n,t)=>n.sort((s,E)=>a(E,s,t)),ge}var Ne,Lr;function Y(){if(Lr)return Ne;Lr=1;const a=F();return Ne=(n,t,s)=>a(n,t,s)>0,Ne}var Se,gr;function Ze(){if(gr)return Se;gr=1;const a=F();return Se=(n,t,s)=>a(n,t,s)<0,Se}var Oe,Nr;function Yr(){if(Nr)return Oe;Nr=1;const a=F();return Oe=(n,t,s)=>a(n,t,s)===0,Oe}var Ae,Sr;function Wr(){if(Sr)return Ae;Sr=1;const a=F();return Ae=(n,t,s)=>a(n,t,s)!==0,Ae}var Te,Or;function Je(){if(Or)return Te;Or=1;const a=F();return Te=(n,t,s)=>a(n,t,s)>=0,Te}var qe,Ar;function Ke(){if(Ar)return qe;Ar=1;const a=F();return qe=(n,t,s)=>a(n,t,s)<=0,qe}var we,Tr;function zr(){if(Tr)return we;Tr=1;const a=Yr(),l=Wr(),n=Y(),t=Je(),s=Ze(),E=Ke();return we=(p,r,R,e)=>{switch(r){case"===":return typeof p=="object"&&(p=p.version),typeof R=="object"&&(R=R.version),p===R;case"!==":return typeof p=="object"&&(p=p.version),typeof R=="object"&&(R=R.version),p!==R;case"":case"=":case"==":return a(p,R,e);case"!=":return l(p,R,e);case">":return n(p,R,e);case">=":return t(p,R,e);case"<":return s(p,R,e);case"<=":return E(p,R,e);default:throw new TypeError(`Invalid operator: ${r}`)}},we}var Ce,qr;function lt(){if(qr)return Ce;qr=1;const a=G(),l=j(),{safeRe:n,t}=B();return Ce=(E,o)=>{if(E instanceof a)return E;if(typeof E=="number"&&(E=String(E)),typeof E!="string")return null;o=o||{};let p=null;if(!o.rtl)p=E.match(o.includePrerelease?n[t.COERCEFULL]:n[t.COERCE]);else{const m=o.includePrerelease?n[t.COERCERTLFULL]:n[t.COERCERTL];let g;for(;(g=m.exec(E))&&(!p||p.index+p[0].length!==E.length);)(!p||g.index+g[0].length!==p.index+p[0].length)&&(p=g),m.lastIndex=g.index+g[1].length+g[2].length;m.lastIndex=-1}if(p===null)return null;const r=p[2],R=p[3]||"0",e=p[4]||"0",i=o.includePrerelease&&p[5]?`-${p[5]}`:"",u=o.includePrerelease&&p[6]?`+${p[6]}`:"";return l(`${r}.${R}.${e}${i}${u}`,o)},Ce}var Pe,wr;function ct(){if(wr)return Pe;wr=1;const a=j(),l=x(),n=G(),t=(p,r,R)=>{if(!l.RELEASE_TYPES.includes(r))return null;const e=s(p,R);return e&&E(e,r)},s=(p,r)=>{const R=p instanceof n?p.version:p;return a(R,r)},E=(p,r)=>{if(o(r))return p.version;switch(p.prerelease=[],r){case"major":p.minor=0,p.patch=0;break;case"minor":p.patch=0;break}return p.format()},o=p=>p.startsWith("pre");return Pe=t,Pe}var _e,Cr;function pt(){if(Cr)return _e;Cr=1;class a{constructor(){this.max=1e3,this.map=new Map}get(n){const t=this.map.get(n);if(t!==void 0)return this.map.delete(n),this.map.set(n,t),t}delete(n){return this.map.delete(n)}set(n,t){if(!this.delete(n)&&t!==void 0){if(this.map.size>=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(n,t)}return this}}return _e=a,_e}var Me,Pr;function b(){if(Pr)return Me;Pr=1;const a=/\s+/g;class l{constructor(c,d){if(d=s(d),c instanceof l)return c.loose===!!d.loose&&c.includePrerelease===!!d.includePrerelease?c:new l(c.raw,d);if(c instanceof E)return this.raw=c.value,this.set=[[c]],this.formatted=void 0,this;if(this.options=d,this.loose=!!d.loose,this.includePrerelease=!!d.includePrerelease,this.raw=c.trim().replace(a," "),this.set=this.raw.split("||").map($=>this.parseRange($.trim())).filter($=>$.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const $=this.set[0];if(this.set=this.set.filter(I=>!q(I[0])),this.set.length===0)this.set=[$];else if(this.set.length>1){for(const I of this.set)if(I.length===1&&M(I[0])){this.set=[I];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let c=0;c<this.set.length;c++){c>0&&(this.formatted+="||");const d=this.set[c];for(let $=0;$<d.length;$++)$>0&&(this.formatted+=" "),this.formatted+=d[$].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(c){c=c.replace(S,"");const d=((this.options.includePrerelease&&g)|(this.options.loose&&h))+":"+c,$=t.get(d);if($)return $;const I=this.options.loose,v=I?r[e.HYPHENRANGELOOSE]:r[e.HYPHENRANGE];c=c.replace(v,re(this.options.includePrerelease)),o("hyphen replace",c),c=c.replace(r[e.COMPARATORTRIM],i),o("comparator trim",c),c=c.replace(r[e.TILDETRIM],u),o("tilde trim",c),c=c.replace(r[e.CARETTRIM],m),o("caret trim",c);let L=c.split(" ").map(P=>D(P,this.options)).join(" ").split(/\s+/).map(P=>ee(P,this.options));I&&(L=L.filter(P=>(o("loose invalid filter",P,this.options),!!P.match(r[e.COMPARATORLOOSE])))),o("range list",L);const T=new Map,O=L.map(P=>new E(P,this.options));for(const P of O){if(q(P))return[P];T.set(P.value,P)}T.size>1&&T.has("")&&T.delete("");const C=[...T.values()];return t.set(d,C),C}intersects(c,d){if(!(c instanceof l))throw new TypeError("a Range is required");return this.set.some($=>y($,d)&&c.set.some(I=>y(I,d)&&$.every(v=>I.every(L=>v.intersects(L,d)))))}test(c){if(!c)return!1;if(typeof c=="string")try{c=new p(c,this.options)}catch{return!1}for(let d=0;d<this.set.length;d++)if(te(this.set[d],c,this.options))return!0;return!1}}Me=l;const n=pt(),t=new n,s=We(),E=W(),o=H(),p=G(),{safeRe:r,src:R,t:e,comparatorTrimReplace:i,tildeTrimReplace:u,caretTrimReplace:m}=B(),{FLAG_INCLUDE_PRERELEASE:g,FLAG_LOOSE:h}=x(),S=new RegExp(R[e.BUILD],"g"),q=f=>f.value==="<0.0.0-0",M=f=>f.value==="",y=(f,c)=>{let d=!0;const $=f.slice();let I=$.pop();for(;d&&$.length;)d=$.every(v=>I.intersects(v,c)),I=$.pop();return d},D=(f,c)=>(f=f.replace(r[e.BUILD],""),o("comp",f,c),f=X(f,c),o("caret",f),f=_(f,c),o("tildes",f),f=J(f,c),o("xrange",f),f=Q(f,c),o("stars",f),f),A=f=>!f||f.toLowerCase()==="x"||f==="*",w=(f,c,d)=>A(f)&&!A(c)||A(c)&&d&&!A(d),_=(f,c)=>f.trim().split(/\s+/).map(d=>N(d,c)).join(" "),N=(f,c)=>{const d=c.loose?r[e.TILDELOOSE]:r[e.TILDE];return f.replace(d,($,I,v,L,T)=>{o("tilde",f,$,I,v,L,T);let O;return A(I)?O="":A(v)?O=`>=${I}.0.0 <${+I+1}.0.0-0`:A(L)?O=`>=${I}.${v}.0 <${I}.${+v+1}.0-0`:T?(o("replaceTilde pr",T),O=`>=${I}.${v}.${L}-${T} <${I}.${+v+1}.0-0`):O=`>=${I}.${v}.${L} <${I}.${+v+1}.0-0`,o("tilde return",O),O})},X=(f,c)=>f.trim().split(/\s+/).map(d=>Z(d,c)).join(" "),Z=(f,c)=>{o("caret",f,c);const d=c.loose?r[e.CARETLOOSE]:r[e.CARET],$=c.includePrerelease?"-0":"";return f.replace(d,(I,v,L,T,O)=>{o("caret",f,I,v,L,T,O);let C;return A(v)?C="":A(L)?C=`>=${v}.0.0${$} <${+v+1}.0.0-0`:A(T)?v==="0"?C=`>=${v}.${L}.0${$} <${v}.${+L+1}.0-0`:C=`>=${v}.${L}.0${$} <${+v+1}.0.0-0`:O?(o("replaceCaret pr",O),v==="0"?L==="0"?C=`>=${v}.${L}.${T}-${O} <${v}.${L}.${+T+1}-0`:C=`>=${v}.${L}.${T}-${O} <${v}.${+L+1}.0-0`:C=`>=${v}.${L}.${T}-${O} <${+v+1}.0.0-0`):(o("no pr"),v==="0"?L==="0"?C=`>=${v}.${L}.${T} <${v}.${L}.${+T+1}-0`:C=`>=${v}.${L}.${T} <${v}.${+L+1}.0-0`:C=`>=${v}.${L}.${T} <${+v+1}.0.0-0`),o("caret return",C),C})},J=(f,c)=>(o("replaceXRanges",f,c),f.split(/\s+/).map(d=>K(d,c)).join(" ")),K=(f,c)=>{f=f.trim();const d=c.loose?r[e.XRANGELOOSE]:r[e.XRANGE];return f.replace(d,($,I,v,L,T,O)=>{if(o("xRange",f,$,I,v,L,T,O),w(v,L,T))return f;const C=A(v),P=C||A(L),U=P||A(T),V=U;return I==="="&&V&&(I=""),O=c.includePrerelease?"-0":"",C?I===">"||I==="<"?$="<0.0.0-0":$="*":I&&V?(P&&(L=0),T=0,I===">"?(I=">=",P?(v=+v+1,L=0,T=0):(L=+L+1,T=0)):I==="<="&&(I="<",P?v=+v+1:L=+L+1),I==="<"&&(O="-0"),$=`${I+v}.${L}.${T}${O}`):P?$=`>=${v}.0.0${O} <${+v+1}.0.0-0`:U&&($=`>=${v}.${L}.0${O} <${v}.${+L+1}.0-0`),o("xRange return",$),$})},Q=(f,c)=>(o("replaceStars",f,c),f.trim().replace(r[e.STAR],"")),ee=(f,c)=>(o("replaceGTE0",f,c),f.trim().replace(r[c.includePrerelease?e.GTE0PRE:e.GTE0],"")),re=f=>(c,d,$,I,v,L,T,O,C,P,U,V)=>(A($)?d="":A(I)?d=`>=${$}.0.0${f?"-0":""}`:A(v)?d=`>=${$}.${I}.0${f?"-0":""}`:L?d=`>=${d}`:d=`>=${d}${f?"-0":""}`,A(C)?O="":A(P)?O=`<${+C+1}.0.0-0`:A(U)?O=`<${C}.${+P+1}.0-0`:V?O=`<=${C}.${P}.${U}-${V}`:f?O=`<${C}.${P}.${+U+1}-0`:O=`<=${O}`,`${d} ${O}`.trim()),te=(f,c,d)=>{for(let $=0;$<f.length;$++)if(!f[$].test(c))return!1;if(c.prerelease.length&&!d.includePrerelease){for(let $=0;$<f.length;$++)if(o(f[$].semver),f[$].semver!==E.ANY&&f[$].semver.prerelease.length>0){const I=f[$].semver;if(I.major===c.major&&I.minor===c.minor&&I.patch===c.patch)return!0}return!1}return!0};return Me}var De,_r;function W(){if(_r)return De;_r=1;const a=Symbol("SemVer ANY");class l{static get ANY(){return a}constructor(e,i){if(i=n(i),e instanceof l){if(e.loose===!!i.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),o("comparator",e,i),this.options=i,this.loose=!!i.loose,this.parse(e),this.semver===a?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(e){const i=this.options.loose?t[s.COMPARATORLOOSE]:t[s.COMPARATOR],u=e.match(i);if(!u)throw new TypeError(`Invalid comparator: ${e}`);this.operator=u[1]!==void 0?u[1]:"",this.operator==="="&&(this.operator=""),u[2]?this.semver=new p(u[2],this.options.loose):this.semver=a}toString(){return this.value}test(e){if(o("Comparator.test",e,this.options.loose),this.semver===a||e===a)return!0;if(typeof e=="string")try{e=new p(e,this.options)}catch{return!1}return E(e,this.operator,this.semver,this.options)}intersects(e,i){if(!(e instanceof l))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new r(e.value,i).test(this.value):e.operator===""?e.value===""?!0:new r(this.value,i).test(e.semver):(i=n(i),i.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!i.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||E(this.semver,"<",e.semver,i)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||E(this.semver,">",e.semver,i)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}De=l;const n=We(),{safeRe:t,t:s}=B(),E=zr(),o=H(),p=G(),r=b();return De}var Ge,Mr;function z(){if(Mr)return Ge;Mr=1;const a=b();return Ge=(n,t,s)=>{try{t=new a(t,s)}catch{return!1}return t.test(n)},Ge}var ye,Dr;function ht(){if(Dr)return ye;Dr=1;const a=b();return ye=(n,t)=>new a(n,t).set.map(s=>s.map(E=>E.value).join(" ").trim().split(" ")),ye}var Fe,Gr;function Et(){if(Gr)return Fe;Gr=1;const a=G(),l=b();return Fe=(t,s,E)=>{let o=null,p=null,r=null;try{r=new l(s,E)}catch{return null}return t.forEach(R=>{r.test(R)&&(!o||p.compare(R)===-1)&&(o=R,p=new a(o,E))}),o},Fe}var be,yr;function ft(){if(yr)return be;yr=1;const a=G(),l=b();return be=(t,s,E)=>{let o=null,p=null,r=null;try{r=new l(s,E)}catch{return null}return t.forEach(R=>{r.test(R)&&(!o||p.compare(R)===1)&&(o=R,p=new a(o,E))}),o},be}var je,Fr;function mt(){if(Fr)return je;Fr=1;const a=G(),l=b(),n=Y();return je=(s,E)=>{s=new l(s,E);let o=new a("0.0.0");if(s.test(o)||(o=new a("0.0.0-0"),s.test(o)))return o;o=null;for(let p=0;p<s.set.length;++p){const r=s.set[p];let R=null;r.forEach(e=>{const i=new a(e.semver.version);switch(e.operator){case">":i.prerelease.length===0?i.patch++:i.prerelease.push(0),i.raw=i.format();case"":case">=":(!R||n(i,R))&&(R=i);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),R&&(!o||n(o,R))&&(o=R)}return o&&s.test(o)?o:null},je}var Ue,br;function Rt(){if(br)return Ue;br=1;const a=b();return Ue=(n,t)=>{try{return new a(n,t).range||"*"}catch{return null}},Ue}var Xe,jr;function Qe(){if(jr)return Xe;jr=1;const a=G(),l=W(),{ANY:n}=l,t=b(),s=z(),E=Y(),o=Ze(),p=Ke(),r=Je();return Xe=(e,i,u,m)=>{e=new a(e,m),i=new t(i,m);let g,h,S,q,M;switch(u){case">":g=E,h=p,S=o,q=">",M=">=";break;case"<":g=o,h=r,S=E,q="<",M="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(e,i,m))return!1;for(let y=0;y<i.set.length;++y){const D=i.set[y];let A=null,w=null;if(D.forEach(_=>{_.semver===n&&(_=new l(">=0.0.0")),A=A||_,w=w||_,g(_.semver,A.semver,m)?A=_:S(_.semver,w.semver,m)&&(w=_)}),A.operator===q||A.operator===M||(!w.operator||w.operator===q)&&h(e,w.semver)||w.operator===M&&S(e,w.semver))return!1}return!0},Xe}var Ve,Ur;function vt(){if(Ur)return Ve;Ur=1;const a=Qe();return Ve=(n,t,s)=>a(n,t,">",s),Ve}var xe,Xr;function dt(){if(Xr)return xe;Xr=1;const a=Qe();return xe=(n,t,s)=>a(n,t,"<",s),xe}var Be,Vr;function $t(){if(Vr)return Be;Vr=1;const a=b();return Be=(n,t,s)=>(n=new a(n,s),t=new a(t,s),n.intersects(t,s)),Be}var ke,xr;function It(){if(xr)return ke;xr=1;const a=z(),l=F();return ke=(n,t,s)=>{const E=[];let o=null,p=null;const r=n.sort((u,m)=>l(u,m,s));for(const u of r)a(u,t,s)?(p=u,o||(o=u)):(p&&E.push([o,p]),p=null,o=null);o&&E.push([o,null]);const R=[];for(const[u,m]of E)u===m?R.push(u):!m&&u===r[0]?R.push("*"):m?u===r[0]?R.push(`<=${m}`):R.push(`${u} - ${m}`):R.push(`>=${u}`);const e=R.join(" || "),i=typeof t.raw=="string"?t.raw:String(t);return e.length<i.length?e:t},ke}var He,Br;function Lt(){if(Br)return He;Br=1;const a=b(),l=W(),{ANY:n}=l,t=z(),s=F(),E=(i,u,m={})=>{if(i===u)return!0;i=new a(i,m),u=new a(u,m);let g=!1;e:for(const h of i.set){for(const S of u.set){const q=r(h,S,m);if(g=g||q!==null,q)continue e}if(g)return!1}return!0},o=[new l(">=0.0.0-0")],p=[new l(">=0.0.0")],r=(i,u,m)=>{if(i===u)return!0;if(i.length===1&&i[0].semver===n){if(u.length===1&&u[0].semver===n)return!0;m.includePrerelease?i=o:i=p}if(u.length===1&&u[0].semver===n){if(m.includePrerelease)return!0;u=p}const g=new Set;let h,S;for(const N of i)N.operator===">"||N.operator===">="?h=R(h,N,m):N.operator==="<"||N.operator==="<="?S=e(S,N,m):g.add(N.semver);if(g.size>1)return null;let q;if(h&&S&&(q=s(h.semver,S.semver,m),q>0||q===0&&(h.operator!==">="||S.operator!=="<=")))return null;for(const N of g){if(h&&!t(N,String(h),m)||S&&!t(N,String(S),m))return null;for(const X of u)if(!t(N,String(X),m))return!1;return!0}let M,y,D,A,w=S&&!m.includePrerelease&&S.semver.prerelease.length?S.semver:!1,_=h&&!m.includePrerelease&&h.semver.prerelease.length?h.semver:!1;w&&w.prerelease.length===1&&S.operator==="<"&&w.prerelease[0]===0&&(w=!1);for(const N of u){if(A=A||N.operator===">"||N.operator===">=",D=D||N.operator==="<"||N.operator==="<=",h){if(_&&N.semver.prerelease&&N.semver.prerelease.length&&N.semver.major===_.major&&N.semver.minor===_.minor&&N.semver.patch===_.patch&&(_=!1),N.operator===">"||N.operator===">="){if(M=R(h,N,m),M===N&&M!==h)return!1}else if(h.operator===">="&&!N.test(h.semver))return!1}if(S){if(w&&N.semver.prerelease&&N.semver.prerelease.length&&N.semver.major===w.major&&N.semver.minor===w.minor&&N.semver.patch===w.patch&&(w=!1),N.operator==="<"||N.operator==="<="){if(y=e(S,N,m),y===N&&y!==S)return!1}else if(S.operator==="<="&&!N.test(S.semver))return!1}if(!N.operator&&(S||h)&&q!==0)return!1}return!(h&&D&&!S&&q!==0||S&&A&&!h&&q!==0||_||w)},R=(i,u,m)=>{if(!i)return u;const g=s(i.semver,u.semver,m);return g>0?i:g<0||u.operator===">"&&i.operator===">="?u:i},e=(i,u,m)=>{if(!i)return u;const g=s(i.semver,u.semver,m);return g<0?i:g>0||u.operator==="<"&&i.operator==="<="?u:i};return He=E,He}var Ye,kr;function gt(){if(kr)return Ye;kr=1;const a=B(),l=x(),n=G(),t=Hr(),s=j(),E=Jr(),o=Kr(),p=Qr(),r=et(),R=rt(),e=tt(),i=st(),u=it(),m=F(),g=nt(),h=at(),S=ze(),q=ot(),M=ut(),y=Y(),D=Ze(),A=Yr(),w=Wr(),_=Je(),N=Ke(),X=zr(),Z=lt(),J=ct(),K=W(),Q=b(),ee=z(),re=ht(),te=Et(),f=ft(),c=mt(),d=Rt(),$=Qe(),I=vt(),v=dt(),L=$t(),T=It(),O=Lt();return Ye={parse:s,valid:E,clean:o,inc:p,diff:r,major:R,minor:e,patch:i,prerelease:u,compare:m,rcompare:g,compareLoose:h,compareBuild:S,sort:q,rsort:M,gt:y,lt:D,eq:A,neq:w,gte:_,lte:N,cmp:X,coerce:Z,truncate:J,Comparator:K,Range:Q,satisfies:ee,toComparators:re,maxSatisfying:te,minSatisfying:f,minVersion:c,validRange:d,outside:$,gtr:I,ltr:v,intersects:L,simplifyRange:T,subset:O,SemVer:n,re:a.re,src:a.src,tokens:a.t,SEMVER_SPEC_VERSION:l.SEMVER_SPEC_VERSION,RELEASE_TYPES:l.RELEASE_TYPES,compareIdentifiers:t.compareIdentifiers,rcompareIdentifiers:t.rcompareIdentifiers},Ye}var Nt=gt();const Ot=Zr(Nt);export{Ot as p,Nt as s};
|
|
@@ -27,4 +27,4 @@ ${s}`},jn=(t,e)=>(t.length>0?`
|
|
|
27
27
|
`)},Vn=(t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return Nt(t,e,0)};class oe extends Error{loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:o,message:s,name:i,stack:c,title:a}){super(s,{cause:e}),this.title=a,this.name=i,this.stack=c??this.stack,this.loc=o,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}}class k extends oe{code;context;constructor(e,n,o){super({message:e,name:"CerebroError"}),this.code=n,this.context=o}}const z=t=>"Deno"in t,W=t=>"Bun"in t,ye=()=>{if(z(globalThis)){const t=globalThis.Deno,e=t.execPath();let n=e;try{const{importMeta:o}=globalThis;o?.url&&(n=o.url)}catch{}return[e,n,...t.args]}return W(globalThis)?globalThis.Bun.process.argv:process.argv},Bn=()=>z(globalThis)?globalThis.Deno.cwd():W(globalThis)?globalThis.Bun.process.cwd():process.cwd(),he=()=>{if(z(globalThis)){const t=globalThis.Deno;return new Proxy(t.env.toObject(),{get:(e,n)=>typeof n=="string"?t.env.get(n):e[n],has:(e,n)=>typeof n=="string"?t.env.has(n):n in e,set:(e,n,o)=>typeof n=="string"?(o===void 0||t.env.set(n,o),!0):!1})}return W(globalThis)?globalThis.Bun.process.env:process.env},At=()=>z(globalThis)?[]:W(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,kt=()=>z(globalThis)?globalThis.Deno.execPath():W(globalThis)?globalThis.Bun.process.execPath:process.execPath,Rn=()=>{if(z(globalThis)){const t=globalThis.Deno.build?.os??"unknown";return t==="windows"?"win32":t}return W(globalThis)?globalThis.Bun.platform??"unknown":process.platform},zn=()=>{if(z(globalThis)){const t=globalThis.Deno.build?.arch??"unknown";return t==="x86_64"?"x64":t==="aarch64"?"arm64":t}return W(globalThis)?globalThis.Bun.process.arch:process.arch},R=(t=0)=>{if(z(globalThis))throw globalThis.Deno.exit(t),new Error("Deno exit failed");if(W(globalThis))throw globalThis.Bun.process.exit(t),new Error("Bun exit failed");process.exit(t)},je=(t,e)=>{if(z(globalThis))return()=>{};if(W(globalThis)){try{const o=globalThis.Bun;if(o.process?.on)return o.process.on(t,e),()=>{o.process?.removeListener&&o.process.removeListener(t,e)}}catch{}return()=>{}}const n=process;return n.on(t,e),()=>{n.removeListener(t,e)}},B=new Uint32Array(65536),Wn=(t,e)=>{const n=t.length,o=e.length,s=1<<n-1;let i=-1,c=0,a=n,u=n;for(;u--;)B[t.charCodeAt(u)]|=1<<u;for(u=0;u<o;u++){let r=B[e.charCodeAt(u)];const l=r|c;r|=(r&i)+i^i,c|=~(r|i),i&=r,c&s&&a++,i&s&&a--,c=c<<1|1,i=i<<1|~(l|c),c&=l}for(u=n;u--;)B[t.charCodeAt(u)]=0;return a},Fn=(t,e)=>{const n=e.length,o=t.length,s=[],i=[],c=Math.ceil(n/32),a=Math.ceil(o/32);for(let p=0;p<c;p++)i[p]=-1,s[p]=0;let u=0;for(;u<a-1;u++){let p=0,g=-1;const $=u*32,w=Math.min(32,o)+$;for(let y=$;y<w;y++)B[t.charCodeAt(y)]|=1<<y;for(let y=0;y<n;y++){const b=B[e.charCodeAt(y)],N=i[y/32|0]>>>y&1,E=s[y/32|0]>>>y&1,I=b|p,O=((b|E)&g)+g^g|b|E;let m=p|~(O|g),v=g&O;m>>>31^N&&(i[y/32|0]^=1<<y),v>>>31^E&&(s[y/32|0]^=1<<y),m=m<<1|N,v=v<<1|E,g=v|~(I|m),p=m&I}for(let y=$;y<w;y++)B[t.charCodeAt(y)]=0}let r=0,l=-1;const d=u*32,h=Math.min(32,o-d)+d;for(let p=d;p<h;p++)B[t.charCodeAt(p)]|=1<<p;let f=o;for(let p=0;p<n;p++){const g=B[e.charCodeAt(p)],$=i[p/32|0]>>>p&1,w=s[p/32|0]>>>p&1,y=g|r,b=((g|w)&l)+l^l|g|w;let N=r|~(b|l),E=l&b;f+=N>>>o-1&1,f-=E>>>o-1&1,N>>>31^$&&(i[p/32|0]^=1<<p),E>>>31^w&&(s[p/32|0]^=1<<p),N=N<<1|$,E=E<<1|w,l=E|~(y|N),r=N&y}for(let p=d;p<h;p++)B[t.charCodeAt(p)]=0;return f},qn=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return e.length===0?t.length:t.length<=32?Wn(t,e):Fn(t,e)},Gn=ve(import.meta.url),ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Hn=t=>{if(typeof ae<"u"&&ae.versions&&ae.versions.node){const[e,n]=ae.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ae.getBuiltinModule(t)}return Gn(t)},{createRequire:Jn}=Hn("node:module"),Et=String.raw,Ve=Et`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Kn=()=>new RegExp(Et`\p{RI}{2}|(?)${Ve}(?:\u200D${Ve})*`,"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 gs=/^[ \t]*(?:\r\n|\r|\n)/,ws=/(?:\r\n|\r|\n)[ \t]*$/,ys=/^(?:[\r\n]|$)/,vs=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,$s=/^[ \t]*[\r\n][ \t\r\n]*$/,bs=/\r\n|\n|\r/g,xs=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,Ns=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,G=Kn(),Yn=/[-_./\s]+/g,we=/(\u001B\[[0-9;]*[a-z])/i,Be=new RegExp("\\p{Script=Arabic}","u"),Qn=new RegExp("\\p{Script=Bengali}","u"),X=new RegExp("\\p{Script=Cyrillic}","u"),Zn=new RegExp("\\p{Script=Devanagari}","u"),Xn=new RegExp("\\p{Script=Ethiopic}","u"),xe=new RegExp("\\p{Script=Greek}","u"),Re=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),eo=new RegExp("\\p{Script=Gujarati}","u"),to=new RegExp("\\p{Script=Gurmukhi}","u"),ze=new RegExp("\\p{Script=Hangul}","u"),We=new RegExp("\\p{Script=Hebrew}","u"),no=new RegExp("\\p{Script=Hiragana}","u"),Fe=new RegExp("\\p{Script=Han}","u"),oo=new RegExp("\\p{Script=Kannada}","u"),io=new RegExp("\\p{Script=Katakana}","u"),so=new RegExp("\\p{Script=Khmer}","u"),ro=new RegExp("\\p{Script=Lao}","u"),M=new RegExp("\\p{Script=Latin}","u"),ao=new RegExp("\\p{Script=Malayalam}","u"),lo=new RegExp("\\p{Script=Myanmar}","u"),co=new RegExp("\\p{Script=Oriya}","u"),uo=new RegExp("\\p{Script=Sinhala}","u"),ho=new RegExp("\\p{Script=Tamil}","u"),po=new RegExp("\\p{Script=Telugu}","u"),fo=new RegExp("\\p{Script=Thai}","u"),mo=new RegExp("\\p{Script=Tibetan}","u"),qe=/[\u02BB\u02BC\u0027]/u,go=t=>t.replace(G,"");let wo=class{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 o=this.cache.keys().next().value;o!==void 0&&this.cache.delete(o)}this.cache.set(e,n)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}};const yo=Jn(import.meta.url),le=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,vo=t=>{if(typeof le<"u"&&le.versions&&le.versions.node){const[e,n]=le.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return le.getBuiltinModule(t)}return yo(t)},{stripVTControlCharacters:$o}=vo("node:util"),Ne=new wo(1e3),bo=/[.*+?^${}()|[\]\\]/g,xo=t=>{const e=t.join("");if(Ne.has(e)){const s=Ne.get(e);return s.lastIndex=0,s}const n=t.map(s=>s.replaceAll(bo,String.raw`\$&`)).join("|"),o=new RegExp(n,"g");return Ne.set(e,o),o},No=t=>{const e=[];let n=0,o;for(G.lastIndex=0;(o=G.exec(t))!==null;)o.index>n&&e.push(t.slice(n,o.index)),e.push(o[0]),n=G.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},Ao=/[ČŠŽĐ]/i,Ct=new Uint8Array(128),Ot=new Uint8Array(128),_t=new Uint8Array(128);for(let t=0;t<128;t++)Ct[t]=t>=65&&t<=90?1:0,Ot[t]=t>=97&&t<=122?1:0,_t[t]=t>=48&&t<=57?1:0;const Ae=t=>Ct[t],Ge=t=>Ot[t],ke=t=>_t[t],F=(t,e,n,o,s)=>{if(t.length===0)return[];let i=!1;const c=Object.values(e);for(const f of c)if(f(t[0])){i=!0;break}if(!i&&!n)return[t];const a=[...t],u=[];let r=a[0],l="other";const d=Object.entries(e);for(const f of d){const[p,g]=f;if(g(a[0])){l=p;break}}let h=n&&o?a[0]===a[0].toLocaleUpperCase(o):!1;for(let f=1;f<a.length;f++){const p=a[f];let g="other";for(const y of d){const[b,N]=y;if(N(p)){g=b;break}}const $=n&&o?p===p.toLocaleUpperCase(o):!1;let w=!1;s?w=s(l,g,h,$,p,f,a):(l!==g&&l!=="other"&&g!=="other"&&(w=!0),n&&g!=="other"&&!h&&$&&(w=!0)),w?(u.push(r),r=p):r+=p,l=g,n&&(h=$)}return r&&r.length>0&&u.push(r),u.length>0?u:[t]},ko=(t,e,n,o)=>{if(n.size===0)return e;for(const s of n)if(t.startsWith(s,e))return o.push(s),e+s.length;return e},It=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const o=[],s=t.length;for(let i=1;i<s;i++){const c=ko(t,n,e,o);if(c!==n){n=c,i=n-1;continue}const a=t.codePointAt(i-1),u=t.codePointAt(i),r=a&&a<128&&Ae(a),l=u&&u<128&&Ae(u),d=a&&a<128&&Ge(a),h=a&&a<128&&ke(a),f=u&&u<128&&ke(u);if(d&&l){o.push(t.slice(n,i)),n=i;continue}if(h&&!f||!h&&f){o.push(t.slice(n,i)),n=i;continue}if(f&&!h){let p=!1,g=!1;if(i+1<s){const $=t.codePointAt(i+1);p=$&&$<128&&Ae($),g=$&&$<128&&ke($)}if(!g&&p){o.push(t.slice(n,i),t.slice(i,i+1)),n=i+1;continue}}if(i+1<s){const p=t.codePointAt(i+1),g=p&&p<128&&Ge(p);if(r&&l&&g){const $=t.slice(n,i+1);e.has($)||(o.push(t.slice(n,i)),n=i)}}}return n<s&&o.push(t.slice(n)),o.filter(i=>i!=="")},Lt=(t,e,n)=>{if(t.length===0)return[];const o=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!o&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e),p=f,g=f?0:-1;for(let $=1;$<l;$++){const w=r[$],y=w===w.toLocaleUpperCase(e);if(y===f)h+=w;else if(y)h&&h.length>0&&(d.push(h),h=w),p=!0,g=$;else{if(p&&$-g>1){const b=r[$-1],N=h.slice(0,-1);N&&N.length>0&&d.push(N),h=b+w}else h+=w;p=!1,g=-1}f=y}return h&&h.length>0&&d.push(h),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!X.test(t)&&!M.test(t))return[t];const r=[...t],l=r.length,d=[];let h=r[0];const f=r[0];let p;X.test(f)?p=1:M.test(f)?p=2:p=0;let g=f===f.toLocaleUpperCase(e);for(let w=1;w<l;w++){const y=r[w];let b;X.test(y)?b=1:M.test(y)?b=2:b=0;const N=y===y.toLocaleUpperCase(e);p!==b&&(p===1||p===2)&&(b===1||b===2)||b===p&&!g&&N?(d.push(h),h=y):h+=y,p=b,g=N}h&&h.length>0&&d.push(h);const $=[];for(let w=0;w<d.length;w++)w<d.length-1&&d[w].length===1&&M.test(d[w])&&X.test(d[w+1][0])?($.push(d[w]+d[w+1]),w+=1):$.push(d[w]);return $}if(e.startsWith("el")){if(!xe.test(t)&&!M.test(t))return[t];const r=[];Re.lastIndex=0;let l;for(;(l=Re.exec(t))!==null;)r.push(l[0]);r.length===0&&r.push(t);const d=[];if(r.length===1){const h=r[0];if(!h||!xe.test(h[0])||h.length===1)return[h??t]}for(const h of r){if(!h)continue;if(!xe.test(h[0])||h.length===1){d.push(h);continue}const f=h.length;let p=h[0],g=h[0]===h[0].toLocaleUpperCase(e);for(let $=1;$<f;$++){const w=h[$],y=w===w.toLocaleUpperCase(e);!g&&y?(d.push(p),p=w):p+=w,g=y}p&&d.push(p)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const r=e.startsWith("ja"),l=r?{hiragana:h=>no.test(h),kanji:h=>Fe.test(h),katakana:h=>io.test(h),latin:h=>M.test(h)}:{hangul:h=>ze.test(h),latin:h=>M.test(h)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(r){const h=F(t,l,!1,e,(p,g)=>p==="hiragana"&&g==="katakana"||p==="katakana"&&g==="hiragana"||p==="hiragana"&&g==="latin"||p==="katakana"&&g==="latin"||p==="kanji"&&g==="latin"||p==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),f=[];for(const p of h){const g=p;g.length===1&&d.has(g)&&f.length>0?f[f.length-1]=f.at(-1)+g:f.push(g)}return f.length>0?f:[t]}return F(t,l,!1,e,(h,f)=>h==="hangul"&&f==="latin"||h==="latin"&&f==="hangul")}if(e.startsWith("sl")){const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let p=1;p<l;p++){const g=r[p],$=g===g.toLocaleUpperCase(e),w=Ao.test(g),y=p<l-1&&r[p+1]===r[p+1].toLocaleUpperCase(e);!f&&$||w&&y?(d.push(h),h=g,w&&y&&(d.push(h),h="")):h+=g,f=$}return h&&h.length>0&&d.push(h),d}if(e.startsWith("zh"))return F(t,{han:r=>Fe.test(r),latin:r=>M.test(r)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const r=l=>We.test(l)||Be.test(l);return F(t,{latin:l=>M.test(l),rtl:l=>r(l)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const r=l=>Zn.test(l)||Qn.test(l)||eo.test(l)||to.test(l)||oo.test(l)||ho.test(l)||po.test(l)||ao.test(l)||uo.test(l)||fo.test(l)||ro.test(l)||mo.test(l)||lo.test(l)||Xn.test(l)||so.test(l)||co.test(l);return F(t,{indic:l=>r(l),latin:l=>M.test(l)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return F(t,{cyrillic:r=>X.test(r),latin:r=>M.test(r)},!0,e);if(["ar","fa","he"].includes(e))return F(t,{latin:r=>M.test(r),rtl:r=>We.test(r)||Be.test(r)},!1,e);if(e.startsWith("ko"))return F(t,{hangul:r=>ze.test(r),latin:r=>M.test(r)},!1,e);if(e.startsWith("uz")){if(!X.test(t)&&!M.test(t))return[t];const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let p=1;p<l;p++){const g=r[p],$=g===g.toLocaleUpperCase(e);if(qe.test(g)||qe.test(r[p-1])){h+=g;continue}!f&&$?(d.push(h),h=g):h+=g,f=$}return h&&h.length>0&&d.push(h),d}const s=[...t],i=s.length,c=[];let a=s[0],u=s[0]===s[0].toLocaleUpperCase(e);for(const r of n)if(t.startsWith(r)){c.push(r),a=s[r.length],u=a===a.toLocaleUpperCase(e);break}for(let r=1;r<i;r++){const l=s[r],d=l===l.toLocaleUpperCase(e);let h=0;for(const f of n)if(t.startsWith(f,r)){c.push(a,f),h=f.length,a="";const p=f.at(-1);p&&(u=p===p.toLocaleUpperCase(e));break}if(h>0){r+=h-1;continue}!u&&d?(c.push(a),a=l):a+=l,u=d}return a&&c.push(a),c},Eo=(t,e,n)=>{const o=[],s=we.test(t)?t.split(we).filter(Boolean):[t];for(const i of s){const c=i;if(we.test(c))o.push(c);else{G.lastIndex=0;const a=G.test(c)?No(c).filter(Boolean):[c];for(const u of a)if(G.lastIndex=0,G.test(u))o.push(u);else if(e){const r=e.toLowerCase().split("-")[0];o.push(...Lt(u,r,n))}else o.push(...It(u,n))}}return o},Co=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:o=!1,knownAcronyms:s=[],locale:i,normalize:c=!1,separators:a,stripAnsi:u=!1,stripEmoji:r=!1}=e,l=new Set([...s].toSorted((w,y)=>y.length-w.length));let d=t;u&&(d=$o(d)),r&&(d=go(d));let h;Array.isArray(a)?h=xo(a):a instanceof RegExp?h=a:h=Yn;const f=[];let p=d;const g=h.flags.includes("g")?h:new RegExp(h.source,`${h.flags}g`);for(;p.length>0;){const w=g.exec(p);if(!w){p===".."?f.push(".."):p==="."?f.push("."):p.length>0&&f.push(p);break}const y=w.index,b=w[0],N=b.length,E=p.slice(0,y),I=p.slice(y+N);if(b.startsWith("../"))f.push(".."),p=p.slice(y+3);else if(b.startsWith("./"))f.push("."),p=p.slice(y+2);else if(y===0&&b==="..")f.push(".."),p=p.slice(2);else if(y===0&&b===".")f.push("."),p=p.slice(1);else{E.length>0&&f.push(E);let O=0;for(;(O=b.indexOf("../",O))!==-1;)f.push(".."),O+=3;for(O=0;(O=b.indexOf("./",O))!==-1;)(O===0||b[O-1]!==".")&&f.push("."),O+=2;let m=I;for(;m.startsWith("../");)f.push(".."),m=m.slice(3);for(;m.startsWith("./");)f.push("."),m=m.slice(2);if(m===".."){f.push("..");break}else if(m==="."){f.push(".");break}else p=m}g.lastIndex=0}if(f.length===0){const w=d.split(h).filter(Boolean);f.push(...w)}let $=[];for(const w of f)n||o?$.push(...Eo(w,i,l)):i?$.push(...Lt(w,i,l)):$.push(...It(w,l));return c&&($=$.map(w=>l.has(w)?w:i&&w===w.toLocaleUpperCase(i)?w[0]+w.slice(1).toLocaleLowerCase(i):w.toUpperCase()===w&&!l.has(w)?w.slice(0,1)+w.slice(1).toLowerCase():w)),$},Oo=ve(import.meta.url),ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_o=t=>{if(typeof ce<"u"&&ce.versions&&ce.versions.node){const[e,n]=ce.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ce.getBuiltinModule(t)}return Oo(t)},{writeFile:Io,stat:Lo,rm:So,readFile:He,readdir:To,mkdir:Mo,access:Po}=_o("node:fs/promises"),de=[{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 H=class extends k{commandName;constructor(t,e=[]){const n=`Command "${t}" not found${e.length>0?`. Did you mean: ${e.join(", ")}?`:""}`;super(n,"COMMAND_NOT_FOUND",{commandName:t,suggestions:e}),this.name="CommandNotFoundError",this.commandName=t,e.length>0&&(this.hint=`Try one of these commands: ${e.join(", ")}`)}},St=class extends k{option1;option2;constructor(t,e){super(`Options "${t}" and "${e}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:t,option2:e}),this.name="ConflictingOptionsError",this.option1=t,this.option2=e,this.hint=`Remove either --${t} or --${e}`}},Do=class extends k{unknownOptions;constructor(t,e){const n=t.join(", "),o=`Found unknown ${t.length===1?"option":"options"}: ${n}`;super(o,"UNKNOWN_OPTION",{suggestions:e,unknownOptions:t}),this.name="UnknownOptionError",this.unknownOptions=t,e&&e.length>0&&(this.hint=`Did you mean: ${e.join(", ")}?`)}},Uo=class extends k{pluginName;constructor(t,e,n){super(`Plugin "${t}" error: ${e}`,"PLUGIN_ERROR",{originalError:n,pluginName:t}),this.name="PluginError",this.pluginName=t,n&&(this.cause=n)}},jo=class{logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(t){this.logger=t}hasPlugins(){return this.plugins.size>0}register(t){if(this.initialized)throw new Error(`Cannot register plugin "${t.name}" after initialization`);if(this.plugins.has(t.name))throw new Error(`Plugin "${t.name}" is already registered`);he().CEREBRO_OUTPUT_LEVEL===String(V)&&this.logger.debug(`registering plugin: ${t.name}`),this.plugins.set(t.name,t),this.cachedDependencyOrder=void 0}async init(t){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 e=this.getDependencyOrder();this.logger.debug(`initializing ${String(e.length)} plugin(s)...`);for(const n of e)if(typeof n.init=="function"){this.logger.debug(`initializing plugin: ${n.name}`);try{await n.init(t)}catch(o){const s=new Uo(n.name,`Failed to initialize: ${o instanceof Error?o.message:String(o)}`,o instanceof Error?o:void 0);throw this.logger.error(s.message),s}}this.initialized=!0}async executeLifecycle(t,e,n){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const o=this.getDependencyOrder();for(const s of o){const i=s[t];if(typeof i=="function"){this.logger.debug(`executing ${t} hook for plugin: ${s.name}`);try{await(t==="afterCommand"?i(e,n):i(e))}catch(c){throw this.logger.error(`Error in ${t} hook for plugin "${s.name}":`,c),c}}}}async executeErrorHandlers(t,e){if(!this.initialized||this.plugins.size===0)return;const n=this.getDependencyOrder();for(const o of n)if(typeof o.onError=="function"){this.logger.debug(`executing error handler for plugin: ${o.name}`);try{await o.onError(t,e)}catch(s){this.logger.error(`Error in error handler for plugin "${o.name}":`,s)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const t=[],e=new Set,n=new Set,o=s=>{if(e.has(s))return;if(n.has(s))throw new Error(`Circular dependency detected involving plugin "${s}"`);const i=this.plugins.get(s);if(!i)throw new Error(`Plugin "${s}" not found`);if(n.add(s),i.dependencies)for(const c of i.dependencies)o(c);n.delete(s),e.add(s),t.push(i)};for(const s of this.plugins.keys())o(s);return this.cachedDependencyOrder=t,t}validateDependencies(){for(const t of this.plugins.values())if(t.dependencies){for(const e of t.dependencies)if(!this.plugins.has(e))throw new Error(`Plugin "${t.name}" depends on "${e}" which is not registered`)}}};const pe=t=>t.type?.name==="Boolean",Vo=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},Je=t=>(pe(t)||(t.typeLabel=t.typeLabel??Vo(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),Bo=new RegExp(/^-([^\d-])$/),Ro=new RegExp(/^--(\S+)/),zo=new RegExp(/^-([^\d-]{2,})$/),Wo=t=>Bo.test(t)||Ro.test(t)||zo.test(t),Fo=(t,e)=>{const n=e[0]&&Wo(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const o=new Error(`Command not recognised: ${String(n)}`);throw o.command=n,o.name="INVALID_COMMAND",o}return{argv:e,command:n}};class Te extends oe{optionName;value;constructor(e,n,o){super({hint:`Pass a valid ${o} value for '${e}'.`,message:`Invalid ${o} value '${n}' for option '${e}'`,name:"INVALID_VALUE",title:"Invalid Value"}),this.optionName=e,this.value=n,Object.setPrototypeOf(this,Te.prototype)}}let qo=class Tt extends oe{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,Tt.prototype)}},Ke=class Mt extends oe{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,Mt.prototype)}},Go=class Pt extends oe{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,Pt.prototype)}};class S extends oe{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,S.prototype)}}const Ye=(t,e,n)=>{const o=Number(t);if(e&&Number.isNaN(o)&&String(t).trim().toLowerCase()!=="nan")throw new Te(n??"",String(t),"Number");return o},Qe=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",Ze=t=>t===Number||typeof t=="function"&&t.name==="Number",Xe=t=>t===String||typeof t=="function"&&t.name==="String",Ho=(t,e,n={})=>{const{optionName:o,strictTypes:s}=n;return Array.isArray(t)?Qe(e)?t.map(Boolean):Ze(e)?t.map(i=>Ye(i,s,o)):Xe(e)?t.map(String):t.map(i=>e(String(i))):t===null?null:Qe(e)?!!t:Ze(e)?Ye(t,s,o):Xe(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t))},_=(t,e,n,...o)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...o)},Jo=/-([a-z])/g,Ko=/^\d+$/,fe=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",Yo=t=>t.codePointAt(0)===95,et=(t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],tt=t=>t==="__proto__"||t==="constructor"||t==="prototype",nt=(t,e,n,o=!1)=>{t[e]===void 0?t[e]=o?[n]:n:o&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},ot=(t,e,n,o,s)=>{let i=e.get(t)??n.get(t);if(!i&&o){const c=t.toLowerCase();i=o.get(c)??s?.get(c)}return i},Qo=(t,e,n,o)=>{const s=n.debug??!1;_(s,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),_(s,"Starting argument resolution","resolver"),_(s,"Tokens:","resolver",t),_(s,"Definitions:","resolver",e),_(s,"Processing tokens...","resolver");const i=new Map,c=new Map,a=n.caseInsensitive?new Map:void 0,u=n.caseInsensitive?new Map:void 0,r=n.camelCase?new Map:void 0,l=n.camelCase?new Map:void 0;for(const m of e)if(i.set(m.name,m),m.alias&&c.set(m.alias,m),n.caseInsensitive&&a&&(a.set(m.name.toLowerCase(),m),m.alias&&u&&u.set(m.alias.toLowerCase(),m)),n.camelCase&&r&&l){const v=m.name.replaceAll(Jo,(x,L)=>L.toUpperCase());r.set(m.name,v),l.set(v,m.name)}const d=Object.create(null),h=Object.create(null),f=[],p=[],g=new Set;let $=!1;const w=e.find(m=>m.defaultOption),y=e.some(m=>m.group),b=e.find(m=>m.type===Number);for(let m=0;m<t.length;m++){const v=t[m];if(v.kind==="option-terminator"){d._unknown=o.slice(v.index),$=!0;break}if(v.kind==="option"&&v.name){let x=ot(v.name,i,c,a,u);!x&&v.value===void 0&&b&&Ko.test(v.name)&&(x=b,v.value=v.name,v.name=b.name);let L=!1;if(!x&&n.negation&&v.value===void 0&&v.name.startsWith("no-")){const C=v.name.slice(3),P=ot(C,i,c,a,u);P?.type&&fe(P.type)&&(x=P,L=!0)}const A=x?x.name:v.name,T=x?.multiple,D=x?.lazyMultiple;if(Object.hasOwn(h,A)&&h[A]!==void 0&&!T&&!D&&!n.partial)throw new qo(A);if(!x&&n.partial){const C=v.rawName??`--${v.name}${v.value!==void 0&&v.inlineValue?`=${v.value}`:""}`;f.push({index:v.index,value:C});continue}if(!x&&n.stopAtFirstUnknown){d._unknown=o.slice(v.index);break}if(!x&&!n.partial)throw new Ke(v.name);if(v.value===void 0){const C=t[m+1],P=C?.kind==="option"&&!("name"in C)&&C.value!==void 0,U=C&&x&&!(x.type&&fe(x.type))&&(C.kind==="positional"||P),Rt=x&&x.defaultOption&&!x.multiple&&!x.lazyMultiple;if(U&&(!x?.defaultOption||Rt))if(T){let j=m+1;const $e=[];for(;j<t.length&&(t[j].kind==="positional"||t[j].kind==="option"&&!("name"in t[j])&&t[j].value!==void 0);)$e.push(t[j].value),g.add(t[j].index),j++;h[A]=h[A]===void 0?$e:et(h[A],$e),m=j-1}else D?(nt(h,A,C.value,!0),g.add(C.index),m++):(h[A]=C.value,g.add(C.index),m++);else x?.type&&fe(x.type)?nt(h,A,!L,T):h[A]=T?[]:null}else{let{value:C}=v;if(x?.type&&fe(x.type))switch(C){case"":{if(n.partial){h._unknown??=[];const U=`${v.rawName??`--${v.name}`}${v.value?`=${v.value}`:""}`;h._unknown.push(U),p.push({index:v.index,value:U}),C=!0}else throw new Ke(v.name);break}case"false":{C=!1;break}case"true":{C=!0;break}default:C=!0}const P=[C];if(T){let U=m+1;for(;U<t.length&&t[U].kind==="positional";)P.push(t[U].value),g.add(t[U].index),U++;m=U-1}h[A]===void 0?h[A]=T||D?P:C:T||D?h[A]=et(h[A],P):h[A]=C}}else if(v.kind==="positional"&&n.stopAtFirstUnknown&&!g.has(v.index)&&!w){_(s,`Found unconsumed positional token at index ${String(v.index)}, stopping processing`,"resolver"),d._unknown=o.slice(v.index);break}}for(const[m,v]of Object.entries(h)){const x=i.get(m);x&&(x.multiple||x.lazyMultiple)&&!Array.isArray(v)&&(h[m]=[v])}const N=m=>m.kind==="option"&&!i.has(m.name??"")&&!c.has(m.name??"")&&(!n.caseInsensitive||!a?.has(m.name?.toLowerCase()??"")&&!u?.has(m.name?.toLowerCase()??""));let E=-1,I=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!$&&(E=t.findIndex(m=>N(m)),E!==-1&&(I=t[E].index)),w){const m=[],v=[];for(const x of t)x.kind==="positional"&&!g.has(x.index)&&x.index<I&&(m.push(x.value),v.push(x));if(m.length>0){const x=h[w.name],L=w.multiple??w.lazyMultiple;x===void 0?L?(v.forEach(A=>g.add(A.index)),h[w.name]=m):(g.add(v[0].index),h[w.name]=m[0]):L&&(v.forEach(A=>g.add(A.index)),h[w.name]=Array.isArray(x)?[...m,...x]:[...m,x])}}if(!n.partial){for(const m of t)if(m.kind==="positional"&&!g.has(m.index))throw new Go(o[m.index])}if(n.partial&&!n.stopAtFirstUnknown){const m=[...f];if(h._unknown)for(const v of p)m.push({index:v.index,value:v.value});for(const v of t)v.kind==="positional"&&!g.has(v.index)&&m.push({index:v.index,value:o[v.index]});m.length>0&&(m.sort((v,x)=>v.index-x.index),d._unknown=m.map(v=>v.value))}if(n.stopAtFirstUnknown&&!$){const m=t.findIndex(x=>x.kind==="positional"&&!g.has(x.index));let v=-1;if(E!==-1&&m!==-1?v=Math.min(E,m):E!==-1?v=E:m!==-1&&(v=m),v>=0){const x=t[v].index;d._unknown=o.slice(x)}}else f.length>0&&!n.partial&&(d._unknown=f.map(m=>m.value));for(const[m,v]of Object.entries(h)){const x=n.camelCase?r?.get(m)??m:m,L=i.get(m);L?.type?d[x]=Ho(v,L.type,{optionName:L.name,strictTypes:n.strictTypes}):d[x]=v===void 0?null:v}for(const m of e){const v=n.camelCase?r?.get(m.name)??m.name:m.name;!(v in d)&&m.defaultValue!==void 0&&(m.multiple??m.lazyMultiple?d[v]=Array.isArray(m.defaultValue)?[...m.defaultValue]:[m.defaultValue]:d[v]=m.defaultValue)}if(y){const m={},v={},x={};for(const A of e)if(A.group){const T=Array.isArray(A.group)?A.group:[A.group];for(const D of T)tt(D)||(m[D]??={})}for(const A of Object.keys(d))if(!Yo(A)){v[A]=d[A];let T=A;n.camelCase&&(T=l?.get(A)??A);const D=i.get(T);if(D?.group){const C=Array.isArray(D.group)?D.group:[D.group];for(const P of C)tt(P)||m[P]&&(m[P][A]=d[A])}else x[A]=d[A]}const L={_all:v};for(const[A,T]of Object.entries(m))L[A]=T;Object.keys(x).length>0&&(L._none=x),d._unknown&&(L._unknown=d._unknown),Object.keys(d).forEach(A=>delete d[A]),Object.assign(d,L)}const O=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));return _(s,"Final parsed result:","resolver",O),O},ne="-".codePointAt(0),K="=",Zo=K.codePointAt(0),Xo="--",ei="-",ti="--",Dt=t=>t.length>2&&t.startsWith(ti),ni=t=>Dt(t)&&!t.includes(K,3),oi=t=>Dt(t)&&t.includes(K,3),ii=t=>{if(t.length!==2||t.codePointAt(0)!==ne||t.codePointAt(1)===ne)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},si=t=>!(t.length<=2||t.codePointAt(0)!==ne||t.codePointAt(1)===ne),ri=t=>{const e=[];let n=0,o=[],s=0,i=-1,c=0;for(;s<o.length||n<t.length;){let a;if(s<o.length?(a=o[s],s++):(a=t[n],n++),c>0?c--:i++,a===Xo){e.push({index:i,kind:"option-terminator"});const u=[...o.slice(s),...t.slice(n)],r=u.map((l,d)=>({index:i+d+1,kind:"positional",value:l}));e.push(...r),i+=u.length;break}if(ii(a)){const u=a.charAt(1);e.push({index:i,kind:"option",name:u,rawName:a});continue}if(si(a)&&!a.includes(K)){const u=[];let r="",l=!1;for(let d=1;d<a.length;d++){const h=a.charAt(d);l?r+=h:h.codePointAt(0)===Zo?l=!0:u.push(`${ei}${h}`)}if(l)if(u.length>0){const d=u.pop();u.push(`${d}=${r}`)}else u.push(r);o=s<o.length?[...u,...o.slice(s)]:u,s=0,c=u.length;continue}if(ni(a)){const u=a.slice(2);e.push({index:i,kind:"option",name:u,rawName:a});continue}if(oi(a)){const u=a.indexOf(K),r=a.slice(2,u),l=a.slice(u+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:a,value:l});continue}if(a.length>2&&a.codePointAt(0)===ne&&a.codePointAt(1)!==ne&&a.includes(K)){const u=a.indexOf(K),r=a.charAt(1),l=a.slice(u+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:a,value:l});continue}e.push({index:i,kind:"positional",value:a})}return e},ai=/\d/,li=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",ci=t=>typeof t=="function",ui=(t,e,n)=>{const o=n?.debug??!1;_(o,"Validating definitions:","validation",t,"caseInsensitive:",e);const s=new Set,i=new Set,c=new Set,a=new Set;let u=0;for(const r of t){if(_(o,"Checking definition:","validation",r),!r.name)throw _(o,"Validation failed: name is required","validation"),new S("Invalid option definition: name is required");if(typeof r.name!="string")throw new S("Invalid option definition: name must be a string");if(r.name.trim()==="")throw new S("Invalid option definition: name cannot be empty");const l=e?r.name.toLowerCase():"";if(s.has(r.name)||e&&c.has(l))throw new S(`Invalid option definition: duplicate name '${r.name}'`);if(i.has(r.name)||e&&a.has(l))throw new S(`Invalid option definition: name '${r.name}' conflicts with an existing alias`);if(s.add(r.name),e&&c.add(l),r.alias!==void 0){if(typeof r.alias!="string")throw new S("Invalid option definition: alias must be a string");if(r.alias.length!==1)throw new S("Invalid option definition: alias must be a single character");if(ai.test(r.alias))throw new S("Invalid option definition: alias cannot be numeric");if(r.alias==="-")throw new S('Invalid option definition: alias cannot be "-"');const d=e?r.alias.toLowerCase():"";if(i.has(r.alias)||e&&a.has(d))throw new S(`Invalid option definition: duplicate alias '${r.alias}'`);if(s.has(r.alias)||e&&c.has(d))throw new S(`Invalid option definition: alias '${r.alias}' conflicts with an existing option name`);i.add(r.alias),e&&a.add(d)}if(r.defaultOption&&(u++,r.type!==void 0&&li(r.type)))throw new S("Invalid option definition: defaultOption cannot be Boolean type");if(r.type!==void 0&&!(r.type===Boolean||r.type===Number||r.type===String||typeof r.type=="function"&&ci(r.type)))throw new S("Invalid option definition: invalid type")}if(u>1)throw _(o,"Validation failed: multiple defaultOptions not allowed","validation"),new S("Invalid option definition: multiple defaultOptions not allowed");_(o,"Validation completed successfully","validation")};function hi(t,e={}){const n=e.debug??!1;_(n,"Starting command-line-args parsing","index"),_(n,"Options:","index",e);const o={...e};o.stopAtFirstUnknown&&(o.partial=!0);const s=Array.isArray(t)?t:[t];_(n,"Normalized definitions:","index",s),ui(s,o.caseInsensitive,n?o:void 0);let{argv:i}=o;if(!i&&(i=process.argv.slice(2),process.execArgv.length>0)){const r=new Set(process.execArgv);i=i.filter(l=>!r.has(l))}_(n,"Using argv:","index",i);let c=i;o.caseInsensitive&&(c=i.map(r=>{if(r.startsWith("--")){const l=r.indexOf("="),d=(l===-1?r.slice(2):r.slice(2,l)).toLowerCase();return l===-1?`--${d}`:`--${d}${r.slice(l)}`}if(r.startsWith("-")&&!r.startsWith("--")&&r.length>1){const l=r.slice(1).split("=",2),d=l[0],h=l[1];if(!d)return r;const f=d.toLowerCase();return h===void 0?`-${f}`:`-${f}=${h}`}return r}));const a=ri(c.map(String));_(n,"Tokenized arguments:","index",a);const u=Qo(a,s,o,i);return _(n,"Command-line-args parsing completed","index"),u}class pi{result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let Ee=class extends k{commandName;constructor(t,e,n){super(`Failed to load command "${t}": ${e}`,"COMMAND_LOADER_ERROR",{commandName:t,reason:e}),this.name="CommandLoaderError",this.commandName=t,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",n!==void 0&&(this.cause=n)}};const di=/^-{1,2}(\w+)(=(.+))?$/,Ut=(t,e,n,o)=>{const s=di.exec(t);if(s===null)return{};const i=s[1];if(!i)return{};const c=n&&o?n.get(i)??o.get(i):e.find(a=>a.name===i||a.alias===i);return c!==void 0?{argName:c.name,argValue:s[3],option:c}:{}},it=(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)},fi=new Set(["0","1","false","true"]),mi=(t,e,n,o)=>{if(e.length===0||t.length===0)return{};const s=(i,c)=>{const{argName:a,argValue:u,option:r}=Ut(c,e,n,o),{lastOption:l}=i;return r&&pe(r)&&u&&a?i.partial[a]=it(u,r):i.lastName&&l&&pe(l)&&fi.has(c)&&(i.partial[i.lastName]=it(c,l)),{lastName:a,lastOption:r,partial:i.partial}};return t.reduce(s,{partial:{}}).partial},gi=new Set(["0","1","false","true"]),wi=(t,e,n,o)=>{if(e.length===0||t.length===0)return t;const s=(i,c)=>{const{argValue:a,option:u}=Ut(c,e,n,o),{lastOption:r}=i;if(r&&pe(r)&&gi.has(c)){const{args:l}=i;return{args:l.slice(0,-1)}}return u&&pe(u)&&a?{args:i.args}:{args:[...i.args,c],lastOption:u}};return t.reduce(s,{args:[]}).args},yi=t=>{const e=new Map;for(const n of t){const o=e.get(n.name);o?e.set(n.name,{...o,...n}):e.set(n.name,n)}return[...e.values()]},vi=t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},$i=(t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return vi(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)}},bi=/_./g,xi=/^[A-Z]/,Ni=t=>t.toLowerCase().replaceAll(bi,e=>e[1]?.toUpperCase()??e).replace(xi,e=>e.toLowerCase()),Ai=t=>{if(!t||t.length===0)return{};const e={},n=he();for(const o of t){const s=n[o.name],i=$i(o,s),c=i===void 0?o.defaultValue:i,a=Ni(o.name);e[a]=c}return e},ki=t=>{const e=new Map,n=new Map;for(const o of t)if(e.set(o.name,o),o.alias){const s=Array.isArray(o.alias)?o.alias:[o.alias];for(const i of s)n.set(i,o)}return{optionMapByAlias:n,optionMapByName:e}},jt=async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new Ee(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(o){throw new Ee(t.name,o instanceof Error?o.message:String(o),o)}const n=e.default;if(typeof n!="function")throw new Ee(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},Ei=(t,e,n,o)=>{const s=new pi(t.name,t),{_all:i,_unknown:c,positionals:a}=e,u=Object.keys(n).length>0?{...i,...n}:i;ge in u&&delete u[ge],s.argument=a?.[ge]??[],s.rawUnknown=[...c??[]];const r=Object.keys(o).length>0;return s.options=r?{...u,...o}:u,s.env=Ai(t.env),s},Ci=(t,e,n)=>{const o=t.options??[],s=o.length>0;let i=yi(s?[...o,...n]:n);if(i.length>0){for(const r of i)if(r.multiple&&r.lazyMultiple)throw new Error(`Argument "${r.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(i=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:ge,type:t.argument.type,typeLabel:t.argument.typeLabel},...i]);let c,a;if(s){const{optionMapByAlias:r,optionMapByName:l}=ki(o);c=wi(e,o,l,r),a=mi(e,o,l,r)}else c=e,a={};const u=hi(i,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:i,booleanValues:a,parsedArgs:u}},ee=async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await jt(t))(e);let Oi=class extends k{commandName;missingOptions;constructor(t,e){super(`Command "${t}" is missing required options: ${e.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:t,missingOptions:e}),this.name="CommandValidationError",this.commandName=t,this.missingOptions=e,this.hint=`Provide the following required options: ${e.join(", ")}`}},_i=class extends k{choices;option;value;constructor(t,e,n){super(`Invalid value "${e}" for option "${t}". Allowed values: ${n.join(", ")}`,"INVALID_CHOICE",{choices:n,option:t,value:e}),this.name="InvalidChoiceError",this.option=t,this.value=e,this.choices=n,this.hint=`Use one of: ${n.map(o=>`--${t} ${o}`).join(", ")}`}};const st=(t,e,n=!1)=>{const o=[];for(const s of t)if(!(!n&&!s.required)&&e[s.name]===void 0){if(s.type?.name==="Boolean"){e[s.name]=!1;continue}o.push(s)}return o},Ii=(t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:qn(t,e)<=t.length/3,q=(t,e)=>{const n=t.toLowerCase();return e.filter(o=>Ii(o.toLowerCase(),n))},Li=(t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(o=>{const s=o.startsWith("--");let i=`Found unknown ${s?"option":"argument"} "${o}"`;if(s){const c=q(o.replace("--",""),(e.options??[]).map(a=>a.name));if(c.length>0){const[a,...u]=c.map(r=>`--${r}`);i+=u.length>0?`, did you mean ${a??""} or ${u.join(", ")}?`:`, did you mean ${a??""}?`}}n.push(i)}),n.length>0)throw new Error(n.join(`
|
|
28
28
|
`))},Si=(t,e,n)=>{const o=n.__requiredOptions__,s=o?st(o,e,!0):st(t,e,!1);if(s.length>0)throw new Oi(n.name,s.map(i=>i.name));e._unknown&&e._unknown.length>0&&!n.argument&&Li(e,n)},Ti=(t,e,n)=>{const o=n.__conflictingOptions__??t.filter(s=>s.conflicts!==void 0);if(o.length>0){const s=o.find(i=>Array.isArray(i.conflicts)?i.conflicts.some(c=>e[c]!==void 0)&&e[i.name]!==void 0:e[i.conflicts]!==void 0&&e[i.name]!==void 0);if(s)throw new St(s.name,typeof s.conflicts=="string"?s.conflicts:s.conflicts?.[0]??"unknown")}},Mi=(t,e)=>{const n=e.options;if(n)for(const o of n){if(!o.choices||o.choices.length===0)continue;const s=t[o.name];if(s==null)continue;const i=Array.isArray(s)?s:[s];for(const c of i){const a=String(c);if(!o.choices.includes(a))throw new _i(o.name,a,o.choices)}}},Pi=t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const s of t.options){if(s.name){const i=e.get(s.name)??[];i.push(s),e.set(s.name,i)}if(typeof s.alias=="string"&&s.alias.length>0){const i=n.get(s.alias)??[];i.push(s),n.set(s.alias,i)}else if(Array.isArray(s.alias)){for(const i of s.alias)if(i.length>0){const c=n.get(i)??[];c.push(s),n.set(i,c)}}}const o=[];for(const[s,i]of e)i.length>1&&o.push(`Duplicate option name "${s}" in command "${t.name}": ${JSON.stringify(i)}`);for(const[s,i]of n)i.length>1&&o.push(`Duplicate option alias "-${s}" used by options ${i.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(o.length>0)throw new Error(o.join(`
|
|
29
29
|
`))},Di=(t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let o;for(let s=1;s<=e.length;s+=1){const i=e[s-1];if(i===void 0||i.startsWith("-"))break;n.push(i);const c=n.join(" ");t.has(c)&&(o={commandPath:[...n],depth:s})}return o?{argv:e.slice(o.depth),commandPath:o.commandPath}:{argv:e,commandPath:void 0}},J=t=>t.join(" "),rt=(t,e)=>e&&e.length>0?[...e,t]:[t],Ui=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),ji=(t,e)=>typeof t!="string"||t===""?"":t[0].toUpperCase()+t.slice(1),Vi=(t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const o=[];let s="",i="";for(let c=0;c<n;c++){const a=t[c];if(we.test(a)){s?(o.push(s+i+a),s="",i=""):(o.length>0&&o.push(e),s=a);continue}s?(i&&(i+=e),i+=a):(o.length>0&&o.push(e),o.push(a))}return o.join("")},Vt=(t,e)=>{if(typeof t!="string"||!t)return"";let n=!0;return Vi(Co(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(o=>{const s=o,i=s.toLowerCase();return n?(n=!1,Ui(i)):ji(i)}),"")},Bi=/^no-/,Ri=t=>{t.options?.forEach(e=>{e.__camelCaseName__=Vt(e.name)})},zi=t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const o of t.options)e.add(o.name);const n=[];for(const o of t.options)if(o.name.startsWith("no-")){const s=o.name.replace(Bi,"");if(!e.has(s)){if(o.type!==Boolean)throw new Error(`Cannot add negated option "${o.name}" to command "${t.name}" because it is not a boolean.`);const i={...o,defaultValue:o.defaultValue===void 0?!0:!o.defaultValue,name:s};n.push(i),e.add(s)}}n.length>0&&t.options.push(...n)},Wi=(t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,o=new Map;for(const i of e.options)if(i.name.startsWith("no-")){const c=Vt(i.name);o.set(c,i)}const s=Object.keys(n).filter(i=>o.has(i));if(s.length!==0)for(const i of s){const c=i.charAt(2);if(!c)continue;const a=c.toLowerCase()+i.slice(3),u=o.get(i);u&&(u.__negated__=!0),n[a]=!n[i],Reflect.deleteProperty(n,i)}},Fi=(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:o}=t;for(const s of Object.keys(o)){const i=n.get(s);if(i?.implies){const{implies:c}=i;for(const[a,u]of Object.entries(c))o[a]===void 0&&(o[a]=u)}}},qi=()=>!!process.versions.electron,Gi=()=>qi()&&!process.defaultApp,Hi=()=>Gi()?0:1,Ji=t=>t.slice(Hi()+1),Ki=" ",Yi=(t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,o)=>n===e[o]),Qi=t=>{if(typeof t=="string")return t.split(Ki);const e=ye();return Yi(t,e)?Ji(t):t},Zi=t=>{const e=i=>{t.error(`Uncaught exception: ${i.message||i}`),i.stack&&t.error(i.stack),R(1)},n=(i,c)=>{if(i instanceof Error)t.error(`Promise rejection: ${i.message||i}`),i.stack&&t.error(i.stack);else{let a;if(typeof i=="string")a=i;else try{a=JSON.stringify(i)}catch{a=String(i)}t.error(`Promise rejection: ${a}`)}R(1)},o=je("uncaughtException",e),s=je("unhandledRejection",n);return()=>{o(),s()}},at=100,Xi=/^[a-z][\w-]*$/i,Ie=(t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new k(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},lt=(t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new k(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},Ce=(t,e)=>{if(typeof t!="object"||t===null)throw new k(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},me=t=>{const e=Ie(t,"Command name");if(e.length>at)throw new k(`Command name is too long (maximum ${String(at)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new k(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!Xi.test(e))throw new k(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},es=new Set([`
|
|
30
|
-
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),ts=(t,e={})=>{if(typeof t!="string")throw new TypeError("Argument must be a string");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,o=n.maxArgumentLength??1e6;if(Number.isFinite(o)&&o>0&&t.length>o)throw new Error(`Argument is too long (maximum ${String(o)} characters)`);if(n.checkDangerousChars){for(const s of t)if(es.has(s))throw new Error(`Argument contains dangerous character: ${s}`)}return n.trim?t.trim():t},ct=(t,e={})=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,o=n.maxArguments??1e5;if(Number.isFinite(o)&&o>0&&t.length>o)throw new Error(`Too many arguments (maximum ${String(o)})`);return t.map(s=>ts(s,n))},ns=/^-([^\d-])$/,os=/^--(\S+)/,is=/^-([^\d-]{2,})$/,Oe=t=>ns.test(t)||os.test(t)||is.test(t),ss={access:(t,e)=>Po(t,e),mkdir:(t,e)=>Mo(t,e),readdir:t=>To(t),readFile:(async(t,e)=>e===void 0?He(t):He(t,e)),rm:(t,e)=>So(t,e),stat:t=>Lo(t),writeFile:(t,e,n)=>Io(t,e,n)},rs=(t,e,n)=>{const o=e.indexOf("--"),s=o===-1?new Set:new Set(e.slice(o+1)),i=n.filter(u=>u.startsWith("--")&&u!=="--"&&!s.has(u));if(i.length===0)return;const c=(t.options??[]).map(u=>u.name),a=i.flatMap(u=>q(u.slice(2),c).map(r=>`--${r}`));throw new Do(i,a)};class Me{#t;#e;#u;#h;#f;#m;#A;#k;#E;#$;#C;#b;#O;#_=be;#p;#n;#o;#i;#s;#r;#g=!1;#I;#L=!1;#w;#y;#v;#l=[];#D(){return this.#w===void 0&&(this.#w=[...this.#o.keys()]),this.#w}#S(){return this.#y===void 0&&(this.#y=[...this.#n.keys()]),this.#y}#a(){return this.#v===void 0&&(this.#v=[...this.#D(),...this.#S()]),this.#v}#T(){return this.#l.length===0?de:[...de,...this.#l]}#M(){this.#w=void 0,this.#y=void 0,this.#v=void 0}#x(){if(this.#u===void 0){const e=Qi(this.#e.argv);this.#u=ct(e,{maxArguments:this.#b}),this.#U()}return this.#u}#N(){return this.#$??he()}#d(e){this.#_=e,this.#N().CEREBRO_OUTPUT_LEVEL=String(e)}#c(){const e=this.#N().CEREBRO_OUTPUT_LEVEL,n=e===void 0?Number.NaN:Number(e);return Number.isNaN(n)?this.#_:n}#U(){if(!this.#u)return;let e=!1;for(const n of this.#u){if(n==="--quiet"||n==="-q"){this.#d(qt),e=!0;break}if(n==="--verbose"||n==="-v"){this.#d(Gt),e=!0;break}if(n==="--debug"){this.#d(V),e=!0;break}}e||this.#d(Object.hasOwn(this.#N(),"DEBUG")?V:be)}#j(){this.#L||(this.#I=Zi(this.#t),this.#L=!0)}#V(){return{arch:zn(),argv:this.#x(),cwd:this.#h,env:this.#$??he(),exit:this.#E??(e=>R(e??0)),platform:Rn(),stdin:this.#C}}#P(e,n,o,s){this.#c()===V&&this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:i,booleanValues:c,parsedArgs:a}=Ci(e,n,this.#T()),u=Object.keys(c).length>0;let r=a;u&&(r={...a,_all:{...a._all,...c}}),Si(i,r,e);const l=Ei(e,a,c,o);l.runtime=this,l.argv=this.#x(),l.fs=this.#k??ss,l.process=this.#V(),l.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const h=e.options.filter(f=>f.name.startsWith("no-"));for(const f of h){const p=f.name.slice(3),g=`--${f.name}`,$=`--${p}`,w=n.includes(g),y=n.includes($);if(w&&y)throw new St(p,f.name)}}return d&&(Wi(l,e),Fi(l,e)),Ti(i,l.options,e),Mi(l.options,e),this.#O&&rs(e,n,l.rawUnknown),this.#c()===V&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(l.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(l.argument,null,2))),{arguments_:i,booleanValues:c,commandArgs:r,parsedArgs:a,toolbox:l}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new k("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#f=e.trim();const o=n.argv??ye(),s=n.cwd??Bn();if(this.#e={...n,argv:o,cwd:s},this.#e.argv&&!Array.isArray(this.#e.argv))throw new k("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 k("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new k("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new k("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});if(typeof this.#e.logger=="object"){const r=["debug","error","info","log","warn"],l=[],d=this.#e.logger;for(const h of r)typeof d[h]!="function"&&l.push(h);if(l.length>0)throw new k(`Logger object is missing required methods: ${l.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:l});this.#t=this.#e.logger}else this.#t={...console,debug:(...r)=>{this.#c()===V&&console.debug(...r)}};this.#m=this.#e.packageVersion,this.#A=this.#e.packageName,this.#h=this.#e.cwd,this.#s="help",this.#r={};const i=n.fs;if(i!==void 0&&(typeof i!="object"||i===null))throw new k("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const c=n.exit;if(c!==void 0&&typeof c!="function")throw new k("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const a=n.env;if(a!==void 0&&(typeof a!="object"||a===null))throw new k("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const u=n.stdin;if(u!==void 0&&typeof u!="string")throw new k("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#k=n.fs,this.#E=n.exit,this.#$=n.env,this.#C=n.stdin??"",this.#b=n.maxArguments,this.#O=n.strictOptions??!1,this.#d(be),this.#n=new Map,this.#o=new Map,this.#i=new Map}setCommandSection(e){return this.#r=e,this}getCommandSection(){return this.#r.header||(this.#r.header=`${this.#f}${this.#m?` v${this.#m}`:""}`),this.#r}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){Ce(e,"Command"),me(e.name);const n=typeof e.execute=="function",o=typeof e.loader=="function";if(n&&o)throw new k(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!o)throw new k(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?me(e.alias):lt(e.alias,"Command alias").forEach(r=>me(r))),e.argument&&Ce(e.argument,"Command argument"),e.options&&Ce(e.options,"Command options"),e.commandPath&&(lt(e.commandPath,"Command commandPath"),e.commandPath.forEach(r=>{me(r)}));const s=rt(e.name,e.commandPath),i=J(s);if(this.#o.has(i))throw new k(`Command with path "${i}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const c=Array.isArray(e.commandPath)&&e.commandPath.length>0,a=this.#n.get(e.name),u=a!==void 0&&(a.commandPath===void 0||a.commandPath.length===0);if(!c&&u)throw new k(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const r of e.options)Je(r);if(Pi(e),zi(e),Ri(e),e.options&&(e.__conflictingOptions__=e.options.filter(r=>r.conflicts!==void 0),e.__requiredOptions__=e.options.filter(r=>r.required===!0)),c&&a!==void 0)this.#n.set(i,e);else{if(!c&&a!==void 0&&!u){const r=rt(a.name,a.commandPath);this.#n.set(J(r),a)}this.#n.set(e.name,e)}if(this.#o.set(i,s),this.#i.set(i,e),this.#M(),e.alias!==void 0){const r=typeof e.alias=="string"?[e.alias]:e.alias;for(const l of r){if(this.#c()===V&&this.#t.debug("adding alias",l),this.#n.has(l))throw new k(`Command alias "${l}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:l,commandName:e.name});this.#n.set(l,e)}}return this}addGlobalOption(e){const n=e,o=new Set(de.map(i=>i.name)),s=new Set(de.map(i=>i.alias).filter(Boolean));if(o.has(n.name))throw new k(`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 k(`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(i=>i.name)).has(n.name))throw new k(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",Je(n),this.#l.push(n),this}getGlobalOptions(){return this.#T()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#p?this.#p:(this.#p=new jo(this.#t),this.#p.register({description:"Attaches the logger to the toolbox",execute:e=>{e.logger=this.#t,e.console=e.logger},name:"logger"}),this.#p)}getCliName(){return this.#f}getPackageVersion(){return this.#m}getPackageName(){return this.#A}getCommands(){return this.#n}getCwd(){return this.#h}dispose(){this.#I?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:o=!0,...s}=e;if(!this.#n.has("help")){const{default:y}=await import("../packem_chunks/help-command.js");this.addCommand(new y(this.#n))}const i=this.#S(),c=this.#o;this.#j();const a=this.#x();let u,r=[...a];this.#c()===V&&(this.#t.debug(`process.execPath: ${kt()}`),this.#t.debug(`process.execArgv: ${At().join(" ")}`),this.#t.debug(`process.argv: ${ye().join(" ")}`));const l=Di(c,[...a]);if(l.commandPath)u=l.commandPath,r=l.argv;else{if(a.length>1&&a[0]&&a[1]&&!Oe(a[0])&&!Oe(a[1])){const b=[];let N=0;for(;N<a.length;){const I=a[N];if(!I||Oe(I))break;b.push(I),N+=1}const E=J(b);if(b[0]&&!i.includes(b[0])){const I=this.#a(),O=q(E,I);throw new H(E,O)}}let y;try{y=Fo([null,...i],[...a])}catch(b){if(b instanceof Error&&b.name==="INVALID_COMMAND"&&"command"in b){const N=b.command,E=this.#a(),I=q(N,E);throw new H(N,I)}throw b}y.command&&(u=[y.command],r=y.argv)}if(!u)if(this.#s)u=[this.#s];else{const y=this.#a();throw new H("",y)}const d=J(u),h=this.#o.get(d);let f;if(h){if(f=this.#i.get(d),!f||J(h)!==d){const y=this.#a(),b=q(d,y);throw new H(d,b)}}else{const y=u.at(-1);if(f=y?this.#n.get(y):void 0,!f){const b=this.#a(),N=q(d,b);throw new H(d,N)}}if(typeof f.execute!="function"&&typeof f.loader!="function")return this.#t.error(`Command "${f.name}" has no function to execute.`),o?R(1):void 0;const p=r;let g,$;try{({commandArgs:g,toolbox:$}=this.#P(f,p,s,d))}catch(y){if(this.#t.error(y),o)return R(1);throw y}const w=this.getPluginManager();try{!this.#g&&w.hasPlugins()&&(await w.init({cli:this,cwd:this.#h,logger:this.#t}),this.#g=!0),await w.executeLifecycle("execute",$),await w.executeLifecycle("beforeCommand",$);let y;const b=g.global;if(b?.help){const N=this.#n.get("help");if(!N)throw new k("Help command not found","COMMAND_NOT_FOUND");y=await ee(N,$)}else if(b?.version??b?.V){const N=this.#n.get("version");if(!N)throw new k("Version command not found","COMMAND_NOT_FOUND");y=await ee(N,$)}else y=await ee(f,$);return await w.executeLifecycle("afterCommand",$,y),o?R(0):void 0}catch(y){throw await w.executeErrorHandlers(y,$),y}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:o=[],...s}=n;Ie(e,"Command name");const i=e.split(" ").filter(Boolean),c=J(i),a=this.#o.get(c)?this.#i.get(c):this.#n.get(e);if(!a){const h=this.#a(),f=q(c||e,h);throw new H(e,f)}if(typeof a.execute!="function"&&typeof a.loader!="function")throw new k(`Command "${a.name}" has no function to execute`,"INVALID_COMMAND",{commandName:a.name});const u=[...ct(o,{maxArguments:this.#b})];this.#c()===V&&this.#t.debug(`running command '${e}' programmatically with args: ${u.join(", ")}`);const{commandArgs:r,toolbox:l}=this.#P(a,u,s,c||e),d=this.getPluginManager();try{!this.#g&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#h,logger:this.#t}),this.#g=!0),await d.executeLifecycle("execute",l),await d.executeLifecycle("beforeCommand",l);let h;const f=r.global;if(f?.help){const p=this.#n.get("help");if(!p)throw new k("Help command not found","COMMAND_NOT_FOUND");h=await ee(p,l)}else if(f?.version??f?.V){const p=this.#n.get("version");if(!p)throw new k("Version command not found","COMMAND_NOT_FOUND");h=await ee(p,l)}else h=await ee(a,l);return await d.executeLifecycle("afterCommand",l,h),h}catch(h){throw await d.executeErrorHandlers(h,l),h}}clone(e){const n={...this.#e,...e},o=new Me(this.#f,n);for(const[s,i]of this.#n)o.#n.set(s,i);for(const[s,i]of this.#o)o.#o.set(s,[...i]);for(const[s,i]of this.#i)o.#i.set(s,i);for(const s of this.#l)o.#l.push(s);return o.#s=this.#s,o.#r={...this.#r},o.#M(),o}async getAction(e){Ie(e,"Command name");const n=e.split(" ").filter(Boolean),o=J(n),s=this.#o.get(o)?this.#i.get(o):this.#n.get(e);if(!s){const i=this.#a(),c=q(o||e,i);throw new H(e,c)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return jt(s);throw new k(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}}const ks=(t,e)=>new Me(t,e),Es=()=>{try{const t=require("node:module");if(typeof t.enableCompileCache=="function"){t.enableCompileCache();return}}catch{}try{require("v8-compile-cache")}catch{}},as=ve(import.meta.url),ue=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Bt=t=>{if(typeof ue<"u"&&ue.versions&&ue.versions.node){const[e,n]=ue.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ue.getBuiltinModule(t)}return as(t)},{execFileSync:ls}=Bt("node:child_process"),{totalmem:cs}=Bt("node:os"),us=/--max-old-space-size=(\d+)/,hs=/--max-semi-space-size=(\d+)/,ps=t=>Math.floor(cs()/1024/1024*t),ds=t=>t<=512?4:t<=1024?8:t<=2048?16:t<=4096?32:t<=8192?64:Math.floor(Math.log2(t))*8,ut=(t,e)=>{for(const n of e){const o=t.exec(n);if(o)return Number.parseInt(o[1],10)}},Cs=t=>{const n=[...At()],o=[...ye()],s=ut(us,n),i=ut(hs,n);if(s!==void 0&&i!==void 0)return;const c=s??ps(.75),a=i??ds(c),u=[];if(s===void 0&&u.push(`--max-old-space-size=${String(c)}`),i===void 0&&u.push(`--max-semi-space-size=${String(a)}`),u.length!==0)try{ls(kt(),[...u,...n,...o.slice(1)],{env:he(),stdio:"inherit"}),R(0)}catch(r){const l=r.status;R(typeof l=="number"?l:1)}},Os=(t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:(e,n)=>{const{logger:o,runtime:s}=n,{detailed:i=!1,exitOnError:c=!0,formatter:a,logErrors:u=!0,renderOptions:r={}}=t;if(u)if(a)o.error(a(e));else if(i){const l=s.getCwd(),d=Vn(e,{cwd:l,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...r});o.error(d)}else o.error(e);c&&R(1)},version:"1.0.0"});var fs="1.0.0-alpha.36";const _s={version:fs},Is={argument:{description:"Package to execute (optionally with @version)",name:"package",type:String},description:"Execute a remote package without permanent installation",examples:[["vis dlx create-vite my-app","Scaffold a new project"],["vis dlx typescript@5.5.4 tsc --version","Run specific version"],["vis dlx -p cowsay -p lolcatjs -c 'echo hi | cowsay | lolcatjs'","Multiple packages with shell"],["vis install && vis dlx --offline typescript tsc --version","Hardened: pre-install + offline (no registry fetch on dlx)"]],group:"Run & Execute",loader:()=>import("../packem_chunks/handler9.js"),name:"dlx",options:[{alias:"p",description:"Additional packages to install (repeatable)",multiple:!0,name:"package",type:String},{alias:"c",defaultValue:!1,description:"Execute within shell environment",name:"shell-mode",type:Boolean},{alias:"s",defaultValue:!1,description:"Suppress output except command results",name:"silent",type:Boolean},{defaultValue:!1,description:"Resolve from local store only — fail rather than fetch from the registry. Pair with `vis install` for hardened npx-style workflows.",name:"offline",type:Boolean}]};export{G as L,Cs as P,ks as V,Es as a,gs as b,_s as c,bs as d,Is as e,k as f,Os as h,$s as i,ys as n,xs as o,Ns as p,vs as r,ws as s,he as t};
|
|
30
|
+
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),ts=(t,e={})=>{if(typeof t!="string")throw new TypeError("Argument must be a string");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,o=n.maxArgumentLength??1e6;if(Number.isFinite(o)&&o>0&&t.length>o)throw new Error(`Argument is too long (maximum ${String(o)} characters)`);if(n.checkDangerousChars){for(const s of t)if(es.has(s))throw new Error(`Argument contains dangerous character: ${s}`)}return n.trim?t.trim():t},ct=(t,e={})=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,o=n.maxArguments??1e5;if(Number.isFinite(o)&&o>0&&t.length>o)throw new Error(`Too many arguments (maximum ${String(o)})`);return t.map(s=>ts(s,n))},ns=/^-([^\d-])$/,os=/^--(\S+)/,is=/^-([^\d-]{2,})$/,Oe=t=>ns.test(t)||os.test(t)||is.test(t),ss={access:(t,e)=>Po(t,e),mkdir:(t,e)=>Mo(t,e),readdir:t=>To(t),readFile:(async(t,e)=>e===void 0?He(t):He(t,e)),rm:(t,e)=>So(t,e),stat:t=>Lo(t),writeFile:(t,e,n)=>Io(t,e,n)},rs=(t,e,n)=>{const o=e.indexOf("--"),s=o===-1?new Set:new Set(e.slice(o+1)),i=n.filter(u=>u.startsWith("--")&&u!=="--"&&!s.has(u));if(i.length===0)return;const c=(t.options??[]).map(u=>u.name),a=i.flatMap(u=>q(u.slice(2),c).map(r=>`--${r}`));throw new Do(i,a)};class Me{#t;#e;#u;#h;#f;#m;#A;#k;#E;#$;#C;#b;#O;#_=be;#p;#n;#o;#i;#s;#r;#g=!1;#I;#L=!1;#w;#y;#v;#l=[];#D(){return this.#w===void 0&&(this.#w=[...this.#o.keys()]),this.#w}#S(){return this.#y===void 0&&(this.#y=[...this.#n.keys()]),this.#y}#a(){return this.#v===void 0&&(this.#v=[...this.#D(),...this.#S()]),this.#v}#T(){return this.#l.length===0?de:[...de,...this.#l]}#M(){this.#w=void 0,this.#y=void 0,this.#v=void 0}#x(){if(this.#u===void 0){const e=Qi(this.#e.argv);this.#u=ct(e,{maxArguments:this.#b}),this.#U()}return this.#u}#N(){return this.#$??he()}#d(e){this.#_=e,this.#N().CEREBRO_OUTPUT_LEVEL=String(e)}#c(){const e=this.#N().CEREBRO_OUTPUT_LEVEL,n=e===void 0?Number.NaN:Number(e);return Number.isNaN(n)?this.#_:n}#U(){if(!this.#u)return;let e=!1;for(const n of this.#u){if(n==="--quiet"||n==="-q"){this.#d(qt),e=!0;break}if(n==="--verbose"||n==="-v"){this.#d(Gt),e=!0;break}if(n==="--debug"){this.#d(V),e=!0;break}}e||this.#d(Object.hasOwn(this.#N(),"DEBUG")?V:be)}#j(){this.#L||(this.#I=Zi(this.#t),this.#L=!0)}#V(){return{arch:zn(),argv:this.#x(),cwd:this.#h,env:this.#$??he(),exit:this.#E??(e=>R(e??0)),platform:Rn(),stdin:this.#C}}#P(e,n,o,s){this.#c()===V&&this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:i,booleanValues:c,parsedArgs:a}=Ci(e,n,this.#T()),u=Object.keys(c).length>0;let r=a;u&&(r={...a,_all:{...a._all,...c}}),Si(i,r,e);const l=Ei(e,a,c,o);l.runtime=this,l.argv=this.#x(),l.fs=this.#k??ss,l.process=this.#V(),l.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const h=e.options.filter(f=>f.name.startsWith("no-"));for(const f of h){const p=f.name.slice(3),g=`--${f.name}`,$=`--${p}`,w=n.includes(g),y=n.includes($);if(w&&y)throw new St(p,f.name)}}return d&&(Wi(l,e),Fi(l,e)),Ti(i,l.options,e),Mi(l.options,e),this.#O&&rs(e,n,l.rawUnknown),this.#c()===V&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(l.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(l.argument,null,2))),{arguments_:i,booleanValues:c,commandArgs:r,parsedArgs:a,toolbox:l}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new k("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#f=e.trim();const o=n.argv??ye(),s=n.cwd??Bn();if(this.#e={...n,argv:o,cwd:s},this.#e.argv&&!Array.isArray(this.#e.argv))throw new k("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 k("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new k("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new k("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});if(typeof this.#e.logger=="object"){const r=["debug","error","info","log","warn"],l=[],d=this.#e.logger;for(const h of r)typeof d[h]!="function"&&l.push(h);if(l.length>0)throw new k(`Logger object is missing required methods: ${l.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:l});this.#t=this.#e.logger}else this.#t={...console,debug:(...r)=>{this.#c()===V&&console.debug(...r)}};this.#m=this.#e.packageVersion,this.#A=this.#e.packageName,this.#h=this.#e.cwd,this.#s="help",this.#r={};const i=n.fs;if(i!==void 0&&(typeof i!="object"||i===null))throw new k("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const c=n.exit;if(c!==void 0&&typeof c!="function")throw new k("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const a=n.env;if(a!==void 0&&(typeof a!="object"||a===null))throw new k("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const u=n.stdin;if(u!==void 0&&typeof u!="string")throw new k("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#k=n.fs,this.#E=n.exit,this.#$=n.env,this.#C=n.stdin??"",this.#b=n.maxArguments,this.#O=n.strictOptions??!1,this.#d(be),this.#n=new Map,this.#o=new Map,this.#i=new Map}setCommandSection(e){return this.#r=e,this}getCommandSection(){return this.#r.header||(this.#r.header=`${this.#f}${this.#m?` v${this.#m}`:""}`),this.#r}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){Ce(e,"Command"),me(e.name);const n=typeof e.execute=="function",o=typeof e.loader=="function";if(n&&o)throw new k(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!o)throw new k(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?me(e.alias):lt(e.alias,"Command alias").forEach(r=>me(r))),e.argument&&Ce(e.argument,"Command argument"),e.options&&Ce(e.options,"Command options"),e.commandPath&&(lt(e.commandPath,"Command commandPath"),e.commandPath.forEach(r=>{me(r)}));const s=rt(e.name,e.commandPath),i=J(s);if(this.#o.has(i))throw new k(`Command with path "${i}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const c=Array.isArray(e.commandPath)&&e.commandPath.length>0,a=this.#n.get(e.name),u=a!==void 0&&(a.commandPath===void 0||a.commandPath.length===0);if(!c&&u)throw new k(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const r of e.options)Je(r);if(Pi(e),zi(e),Ri(e),e.options&&(e.__conflictingOptions__=e.options.filter(r=>r.conflicts!==void 0),e.__requiredOptions__=e.options.filter(r=>r.required===!0)),c&&a!==void 0)this.#n.set(i,e);else{if(!c&&a!==void 0&&!u){const r=rt(a.name,a.commandPath);this.#n.set(J(r),a)}this.#n.set(e.name,e)}if(this.#o.set(i,s),this.#i.set(i,e),this.#M(),e.alias!==void 0){const r=typeof e.alias=="string"?[e.alias]:e.alias;for(const l of r){if(this.#c()===V&&this.#t.debug("adding alias",l),this.#n.has(l))throw new k(`Command alias "${l}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:l,commandName:e.name});this.#n.set(l,e)}}return this}addGlobalOption(e){const n=e,o=new Set(de.map(i=>i.name)),s=new Set(de.map(i=>i.alias).filter(Boolean));if(o.has(n.name))throw new k(`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 k(`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(i=>i.name)).has(n.name))throw new k(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",Je(n),this.#l.push(n),this}getGlobalOptions(){return this.#T()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#p?this.#p:(this.#p=new jo(this.#t),this.#p.register({description:"Attaches the logger to the toolbox",execute:e=>{e.logger=this.#t,e.console=e.logger},name:"logger"}),this.#p)}getCliName(){return this.#f}getPackageVersion(){return this.#m}getPackageName(){return this.#A}getCommands(){return this.#n}getCwd(){return this.#h}dispose(){this.#I?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:o=!0,...s}=e;if(!this.#n.has("help")){const{default:y}=await import("../packem_chunks/help-command.js");this.addCommand(new y(this.#n))}const i=this.#S(),c=this.#o;this.#j();const a=this.#x();let u,r=[...a];this.#c()===V&&(this.#t.debug(`process.execPath: ${kt()}`),this.#t.debug(`process.execArgv: ${At().join(" ")}`),this.#t.debug(`process.argv: ${ye().join(" ")}`));const l=Di(c,[...a]);if(l.commandPath)u=l.commandPath,r=l.argv;else{if(a.length>1&&a[0]&&a[1]&&!Oe(a[0])&&!Oe(a[1])){const b=[];let N=0;for(;N<a.length;){const I=a[N];if(!I||Oe(I))break;b.push(I),N+=1}const E=J(b);if(b[0]&&!i.includes(b[0])){const I=this.#a(),O=q(E,I);throw new H(E,O)}}let y;try{y=Fo([null,...i],[...a])}catch(b){if(b instanceof Error&&b.name==="INVALID_COMMAND"&&"command"in b){const N=b.command,E=this.#a(),I=q(N,E);throw new H(N,I)}throw b}y.command&&(u=[y.command],r=y.argv)}if(!u)if(this.#s)u=[this.#s];else{const y=this.#a();throw new H("",y)}const d=J(u),h=this.#o.get(d);let f;if(h){if(f=this.#i.get(d),!f||J(h)!==d){const y=this.#a(),b=q(d,y);throw new H(d,b)}}else{const y=u.at(-1);if(f=y?this.#n.get(y):void 0,!f){const b=this.#a(),N=q(d,b);throw new H(d,N)}}if(typeof f.execute!="function"&&typeof f.loader!="function")return this.#t.error(`Command "${f.name}" has no function to execute.`),o?R(1):void 0;const p=r;let g,$;try{({commandArgs:g,toolbox:$}=this.#P(f,p,s,d))}catch(y){if(this.#t.error(y),o)return R(1);throw y}const w=this.getPluginManager();try{!this.#g&&w.hasPlugins()&&(await w.init({cli:this,cwd:this.#h,logger:this.#t}),this.#g=!0),await w.executeLifecycle("execute",$),await w.executeLifecycle("beforeCommand",$);let y;const b=g.global;if(b?.help){const N=this.#n.get("help");if(!N)throw new k("Help command not found","COMMAND_NOT_FOUND");y=await ee(N,$)}else if(b?.version??b?.V){const N=this.#n.get("version");if(!N)throw new k("Version command not found","COMMAND_NOT_FOUND");y=await ee(N,$)}else y=await ee(f,$);return await w.executeLifecycle("afterCommand",$,y),o?R(0):void 0}catch(y){throw await w.executeErrorHandlers(y,$),y}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:o=[],...s}=n;Ie(e,"Command name");const i=e.split(" ").filter(Boolean),c=J(i),a=this.#o.get(c)?this.#i.get(c):this.#n.get(e);if(!a){const h=this.#a(),f=q(c||e,h);throw new H(e,f)}if(typeof a.execute!="function"&&typeof a.loader!="function")throw new k(`Command "${a.name}" has no function to execute`,"INVALID_COMMAND",{commandName:a.name});const u=[...ct(o,{maxArguments:this.#b})];this.#c()===V&&this.#t.debug(`running command '${e}' programmatically with args: ${u.join(", ")}`);const{commandArgs:r,toolbox:l}=this.#P(a,u,s,c||e),d=this.getPluginManager();try{!this.#g&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#h,logger:this.#t}),this.#g=!0),await d.executeLifecycle("execute",l),await d.executeLifecycle("beforeCommand",l);let h;const f=r.global;if(f?.help){const p=this.#n.get("help");if(!p)throw new k("Help command not found","COMMAND_NOT_FOUND");h=await ee(p,l)}else if(f?.version??f?.V){const p=this.#n.get("version");if(!p)throw new k("Version command not found","COMMAND_NOT_FOUND");h=await ee(p,l)}else h=await ee(a,l);return await d.executeLifecycle("afterCommand",l,h),h}catch(h){throw await d.executeErrorHandlers(h,l),h}}clone(e){const n={...this.#e,...e},o=new Me(this.#f,n);for(const[s,i]of this.#n)o.#n.set(s,i);for(const[s,i]of this.#o)o.#o.set(s,[...i]);for(const[s,i]of this.#i)o.#i.set(s,i);for(const s of this.#l)o.#l.push(s);return o.#s=this.#s,o.#r={...this.#r},o.#M(),o}async getAction(e){Ie(e,"Command name");const n=e.split(" ").filter(Boolean),o=J(n),s=this.#o.get(o)?this.#i.get(o):this.#n.get(e);if(!s){const i=this.#a(),c=q(o||e,i);throw new H(e,c)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return jt(s);throw new k(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}}const ks=(t,e)=>new Me(t,e),Es=()=>{try{const t=require("node:module");if(typeof t.enableCompileCache=="function"){t.enableCompileCache();return}}catch{}try{require("v8-compile-cache")}catch{}},as=ve(import.meta.url),ue=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Bt=t=>{if(typeof ue<"u"&&ue.versions&&ue.versions.node){const[e,n]=ue.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ue.getBuiltinModule(t)}return as(t)},{execFileSync:ls}=Bt("node:child_process"),{totalmem:cs}=Bt("node:os"),us=/--max-old-space-size=(\d+)/,hs=/--max-semi-space-size=(\d+)/,ps=t=>Math.floor(cs()/1024/1024*t),ds=t=>t<=512?4:t<=1024?8:t<=2048?16:t<=4096?32:t<=8192?64:Math.floor(Math.log2(t))*8,ut=(t,e)=>{for(const n of e){const o=t.exec(n);if(o)return Number.parseInt(o[1],10)}},Cs=t=>{const n=[...At()],o=[...ye()],s=ut(us,n),i=ut(hs,n);if(s!==void 0&&i!==void 0)return;const c=s??ps(.75),a=i??ds(c),u=[];if(s===void 0&&u.push(`--max-old-space-size=${String(c)}`),i===void 0&&u.push(`--max-semi-space-size=${String(a)}`),u.length!==0)try{ls(kt(),[...u,...n,...o.slice(1)],{env:he(),stdio:"inherit"}),R(0)}catch(r){const l=r.status;R(typeof l=="number"?l:1)}},Os=(t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:(e,n)=>{const{logger:o,runtime:s}=n,{detailed:i=!1,exitOnError:c=!0,formatter:a,logErrors:u=!0,renderOptions:r={}}=t;if(u)if(a)o.error(a(e));else if(i){const l=s.getCwd(),d=Vn(e,{cwd:l,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...r});o.error(d)}else o.error(e);c&&R(1)},version:"1.0.0"});var fs="1.0.0-alpha.37";const _s={version:fs},Is={argument:{description:"Package to execute (optionally with @version)",name:"package",type:String},description:"Execute a remote package without permanent installation",examples:[["vis dlx create-vite my-app","Scaffold a new project"],["vis dlx typescript@5.5.4 tsc --version","Run specific version"],["vis dlx -p cowsay -p lolcatjs -c 'echo hi | cowsay | lolcatjs'","Multiple packages with shell"],["vis install && vis dlx --offline typescript tsc --version","Hardened: pre-install + offline (no registry fetch on dlx)"]],group:"Run & Execute",loader:()=>import("../packem_chunks/handler9.js"),name:"dlx",options:[{alias:"p",description:"Additional packages to install (repeatable)",multiple:!0,name:"package",type:String},{alias:"c",defaultValue:!1,description:"Execute within shell environment",name:"shell-mode",type:Boolean},{alias:"s",defaultValue:!1,description:"Suppress output except command results",name:"silent",type:Boolean},{defaultValue:!1,description:"Resolve from local store only — fail rather than fetch from the registry. Pair with `vis install` for hardened npx-style workflows.",name:"offline",type:Boolean}]};export{G as L,Cs as P,ks as V,Es as a,gs as b,_s as c,bs as d,Is as e,k as f,Os as h,$s as i,ys as n,xs as o,Ns as p,vs as r,ws as s,he as t};
|