@stacksjs/dtsx 0.9.19 → 0.9.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +5 -5
- package/dist/{chunk-fg4cjy7w.js → chunk-0cfb4831.js} +1 -1
- package/dist/{chunk-w71syh0b.js → chunk-0d5r9n78.js} +1 -1
- package/dist/{chunk-s30jnjb4.js → chunk-1hy2eypj.js} +1 -1
- package/dist/chunk-380wx22t.js +2 -0
- package/dist/{chunk-1z1w3s0k.js → chunk-4mtbtmee.js} +11 -11
- package/dist/{chunk-m68323h2.js → chunk-4zdjnqrz.js} +1 -1
- package/dist/chunk-7hy98p24.js +62 -0
- package/dist/{chunk-gg6xh82k.js → chunk-9asxz2at.js} +1 -1
- package/dist/{chunk-2qyt67jt.js → chunk-a0gah6hn.js} +1 -1
- package/dist/{chunk-nwvqfthk.js → chunk-aaba58v4.js} +1 -1
- package/dist/chunk-af12rv0y.js +80 -0
- package/dist/{chunk-kwmhsx3n.js → chunk-bymtns9a.js} +1 -1
- package/dist/chunk-cdv5r51q.js +156 -0
- package/dist/{chunk-fmhrt2ca.js → chunk-dymmh9x0.js} +1 -1
- package/dist/chunk-eqfegkc1.js +2 -0
- package/dist/{chunk-69rnp3hs.js → chunk-ft0nf9jb.js} +1 -1
- package/dist/{chunk-9ycwkhxh.js → chunk-fvgc14nk.js} +1 -1
- package/dist/chunk-m94gn6yx.js +2 -0
- package/dist/chunk-nmmv0nrk.js +2 -0
- package/dist/{chunk-x4jgc4bx.js → chunk-nqwz71ak.js} +1 -1
- package/dist/{chunk-fbradttj.js → chunk-rd7n0yj1.js} +1 -1
- package/dist/chunk-sp1xrnfe.js +2 -0
- package/dist/{chunk-7pwy4m0c.js → chunk-vx4a5crm.js} +1 -1
- package/dist/chunk-wr3swrge.js +2 -0
- package/dist/{chunk-dv8haj2p.js → chunk-ww6wqbda.js} +1 -1
- package/dist/{chunk-ezrgnecm.js → chunk-wzbwr7a3.js} +1 -1
- package/dist/chunk-xw9wfq8f.js +17 -0
- package/dist/{chunk-jjwwkrfk.js → chunk-y2pe3jq3.js} +1 -1
- package/dist/{chunk-mr4jjsps.js → chunk-yzhdn85p.js} +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/plugins/bun.js +1 -1
- package/dist/src/plugins/esbuild.js +1 -1
- package/dist/src/plugins/index.js +1 -1
- package/dist/src/plugins/tsup.js +1 -1
- package/dist/src/plugins/vite.js +1 -1
- package/dist/src/plugins/webpack.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2n9mmg2c.js +0 -2
- package/dist/chunk-4jw8qvts.js +0 -16
- package/dist/chunk-7g7axw9t.js +0 -2
- package/dist/chunk-7zsd1qqw.js +0 -80
- package/dist/chunk-9qe2wx58.js +0 -2
- package/dist/chunk-a3txc27m.js +0 -33
- package/dist/chunk-q0k7xs9f.js +0 -2
- package/dist/chunk-sbmecr6t.js +0 -2
- package/dist/chunk-trm0gptj.js +0 -134
- package/dist/chunk-w1k33gyv.js +0 -2
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ec as a}from"./chunk-ft0nf9jb.js";import{hc as CY}from"./chunk-2n1bbm2c.js";import{lc as UJ}from"./chunk-y2pe3jq3.js";import{Cc as iJ}from"./chunk-vx4a5crm.js";import{Uc as f}from"./chunk-7hy98p24.js";import{Wc as _,Yc as e}from"./chunk-gssantc8.js";import{bd as xY,dd as TY}from"./chunk-mcdb3q06.js";var{Glob:oJ}=globalThis.Bun;import{mkdir as t}from"fs/promises";import{availableParallelism as fY}from"os";import{dirname as m,relative as D,resolve as x}from"path";import{existsSync as GJ,mkdirSync as JY,readFileSync as YY,writeFileSync as ZY}from"fs";import{dirname as $Y,relative as XY,resolve as GY}from"path";async function OJ(J,Y,Z){let $=new Map,X=[],G=new Set,Q=0,H=0,U=0,W=[];for(let z of J){let B=Y.get(z);if(!B)continue;W.push({file:z,decls:a(B,z,Z.keepComments)})}for(let{file:z,decls:B}of W){Q+=B.length;for(let k of B)if(k.kind==="import"){H++;let R=k.source||"";if(R.startsWith("."))continue;if(!$.has(R))$.set(R,{source:R,specifiers:new Map,isTypeOnly:k.isTypeOnly||!1,isSideEffect:k.isSideEffect||!1});let L=$.get(R);if(k.specifiers)for(let F of k.specifiers){let S=F.alias||F.name;if(!L.specifiers.has(S))L.specifiers.set(S,{name:F.name,alias:F.alias,isType:F.isType||!1})}if(!k.isTypeOnly)L.isTypeOnly=!1}else if(k.isExported||k.kind==="export"){if(U++,k.kind==="export"&&k.source&&(k.source.startsWith(".")||k.source.startsWith("/")))continue;if(k.name&&G.has(k.name))continue;if(k.name)G.add(k.name);X.push({declaration:k,file:z})}}let V=[];V.push("/**"),V.push(" * Bundled TypeScript declarations"),V.push(` * Generated from ${J.length} source files`),V.push(" */"),V.push("");let T=Z.importOrder||["bun"],N=Array.from($.values()),q=Array(N.length);for(let z=0;z<N.length;z++){let B=N[z].source,k=T.length;for(let R=0;R<T.length;R++)if(B.startsWith(T[R])){k=R;break}q[z]=k}let O=N.map((z,B)=>B);O.sort((z,B)=>{let k=q[z],R=q[B];if(k!==R)return k-R;return N[z].source.localeCompare(N[B].source)});let j=O.map((z)=>N[z]);for(let z of j)if(z.isSideEffect)V.push(`import '${z.source}';`);else if(z.specifiers.size>0){let k=Array.from(z.specifiers.values()).map((L)=>{let F=L.isType?"type ":"";return L.alias?`${F}${L.name} as ${L.alias}`:`${F}${L.name}`}),R=z.isTypeOnly?"type ":"";V.push(`import ${R}{ ${k.join(", ")} } from '${z.source}';`)}if(j.length>0)V.push("");let K=new Map;for(let{declaration:z,file:B}of X){if(!K.has(B))K.set(B,[]);K.get(B).push(z)}for(let[z,B]of K){let k=XY(Z.cwd,z);V.push(`// From: ${k}`);for(let R of B){if(Z.keepComments&&R.leadingComments)for(let L of R.leadingComments)V.push(L);V.push(RJ(R))}V.push("")}let A=V.join(`
|
|
3
|
+
`);return{content:A,files:J,declarationCount:Q,importCount:H,exportCount:U,size:Buffer.byteLength(A,"utf8"),warnings:[]}}function RJ(J){if(J.text){let Z=J.text.trim();if(J.isExported&&!Z.startsWith("export"))Z=`export ${Z}`;if(!Z.endsWith(";")&&!Z.endsWith("}"))Z+=";";return Z}let Y=[];if(J.isExported)Y.push("export");if(J.isDefault)Y.push("default");switch(J.kind){case"function":if(Y.push("declare function"),Y.push(J.name),J.generics)Y.push(J.generics);if(Y.push(`(${QY(J.parameters)})`),J.returnType)Y.push(`: ${J.returnType}`);break;case"variable":if(Y.push("declare const"),Y.push(J.name),J.typeAnnotation)Y.push(`: ${J.typeAnnotation}`);break;case"interface":if(Y.push("interface"),Y.push(J.name),J.generics)Y.push(J.generics);if(J.extends)Y.push(`extends ${J.extends}`);if(Y.push("{"),J.members)for(let Z of J.members)Y.push(` ${Z.name}${Z.typeAnnotation?`: ${Z.typeAnnotation}`:""};`);Y.push("}");break;case"type":if(Y.push("type"),Y.push(J.name),J.generics)Y.push(J.generics);Y.push("="),Y.push(J.typeAnnotation||"unknown");break;case"class":if(Y.push("declare class"),Y.push(J.name),J.generics)Y.push(J.generics);if(J.extends)Y.push(`extends ${J.extends}`);if(J.implements&&J.implements.length>0)Y.push(`implements ${J.implements.join(", ")}`);if(Y.push("{"),J.members)for(let Z of J.members)Y.push(` ${RJ(Z)}`);Y.push("}");break;case"enum":if(Y.push("declare enum"),Y.push(J.name),Y.push("{"),J.members){let Z=J.members.map(($)=>$.value!==void 0?`${$.name} = ${$.value}`:$.name);Y.push(` ${Z.join(`,
|
|
4
|
+
`)}`)}Y.push("}");break;default:return J.text||""}return Y.join(" ")}function QY(J){if(!J||J.length===0)return"";return J.map((Y)=>{let Z="";if(Y.rest)Z+="...";if(Z+=Y.name,Y.optional)Z+="?";if(Y.type)Z+=`: ${Y.type}`;if(Y.defaultValue)Z+=` = ${Y.defaultValue}`;return Z}).join(", ")}async function LJ(J,Y={}){let Z=[],$=new Map,X=[],G=[],Q=new Set,H=0,U=0,W=0;for(let q of J){if(!GJ(q)){Z.push(`File not found: ${q}`);continue}let O=YY(q,"utf-8");G.push(q);let j=O.split(`
|
|
5
|
+
`),K=[],A=0,z=!1;for(let B of j){let k=B.trim();if(!k&&!z)continue;if(k.startsWith("import ")){U++;let L=k.match(/import\s+(type\s+)?(?:\{([^}]+)\}|(\w+)|\*\s+as\s+(\w+))\s+from\s+['"]([^'"]+)['"]/);if(L){let[,F,S,M,w,v]=L;if(Y.externals?.some((C)=>v.startsWith(C))){X.push(k);continue}if(v.startsWith("."))continue;if(!$.has(v))$.set(v,{source:v,specifiers:new Map,isTypeOnly:!!F,isSideEffect:!1});let c=$.get(v);if(S){let C=S.split(",").map((YJ)=>YJ.trim());for(let YJ of C){let[ZJ,$J]=YJ.split(/\s+as\s+/).map((eJ)=>eJ.trim()),NJ=ZJ.startsWith("type "),XJ=NJ?ZJ.replace("type ",""):ZJ;c.specifiers.set($J||XJ,{name:XJ,alias:$J!==XJ?$J:void 0,isType:NJ})}}if(!F)c.isTypeOnly=!1}continue}if(/^(export\s+)?(declare\s+)?(interface|type|class|function|const|let|var|enum|namespace|module)\s/.test(k)){if(z=!0,K=[B],A=(B.match(/\{/g)||[]).length-(B.match(/\}/g)||[]).length,A===0&&(k.endsWith(";")||!k.includes("{"))){let L=l(k);if(!Q.has(L)||!Y.mergeDuplicates){if(Q.add(L),X.push(B),H++,k.startsWith("export"))W++}z=!1,K=[]}}else if(z){if(K.push(B),A+=(B.match(/\{/g)||[]).length-(B.match(/\}/g)||[]).length,A<=0){let L=K.join(`
|
|
6
|
+
`),F=l(K[0]);if(!Q.has(F)||!Y.mergeDuplicates){if(Q.add(F),X.push(L),H++,K[0].trim().startsWith("export"))W++}z=!1,K=[]}}else if(k.startsWith("export ")&&!k.includes("declare"))X.push(B),W++}}let V=[];if(Y.banner)V.push(Y.banner),V.push("");if(Y.includeReferences&&Y.references){for(let q of Y.references)V.push(`/// <reference types="${q}" />`);V.push("")}let T=Array.from($.values()).sort((q,O)=>q.source.localeCompare(O.source));for(let q of T)if(q.specifiers.size>0){let j=Array.from(q.specifiers.values()).map((A)=>{let z=A.isType?"type ":"";return A.alias?`${z}${A.name} as ${A.alias}`:`${z}${A.name}`}),K=q.isTypeOnly?"type ":"";V.push(`import ${K}{ ${j.join(", ")} } from '${q.source}';`)}if(T.length>0)V.push("");if(Y.ambient&&Y.moduleName){V.push(`declare module '${Y.moduleName}' {`);for(let q of X){let O=q.split(`
|
|
7
|
+
`).map((j)=>` ${j.replace(/^(\s*)(export\s+)?declare\s+/,"$1$2")}`).join(`
|
|
8
|
+
`);V.push(O)}V.push("}")}else{if(Y.sortDeclarations)X.sort((q,O)=>{let j=l(q),K=l(O);return j.localeCompare(K)});for(let q of X)V.push(q)}if(Y.footer)V.push(""),V.push(Y.footer);let N=V.join(`
|
|
9
|
+
`);return{content:N,files:G,declarationCount:H,importCount:U,exportCount:W,size:Buffer.byteLength(N,"utf-8"),warnings:Z}}function l(J){let Y=J.match(/(interface|type|class|function|const|let|var|enum|namespace|module)\s+(\w+)/);return Y?`${Y[1]}:${Y[2]}`:J.trim()}async function UY(J,Y,Z={}){let $=await LJ(J,Z),X=$Y(Y);if(!GJ(X))JY(X,{recursive:!0});return ZY(Y,$.content),$}function rY(J={}){return{bundle:(Y)=>LJ(Y,J),bundleAndWrite:(Y,Z)=>UY(Y,Z,{...J,output:Z})}}async function tY(J,Y=process.cwd()){let Z=Array.isArray(J)?J:[J],$=[];for(let X of Z){if(X.includes("*"))continue;let G=GY(Y,X);if(GJ(G))$.push(G)}return $}import{existsSync as n,mkdirSync as zY,readFileSync as zJ,rmSync as VY,statSync as MJ,writeFileSync as FJ}from"fs";import{join as SJ,relative as s,resolve as jY}from"path";var QJ=1,VJ=".dtsx-cache",WY="manifest.json";class jJ{cacheDir;manifestPath;manifest=null;configHash;constructor(J){this.cacheDir=jY(J.cwd,VJ),this.manifestPath=SJ(this.cacheDir,WY),this.configHash=this.hashConfig(J)}hashConfig(J){let Y={keepComments:J.keepComments,importOrder:J.importOrder,outputStructure:J.outputStructure};return String(UJ(JSON.stringify(Y)))}hashString(J){return String(UJ(J))}load(){try{if(!n(this.manifestPath))return!1;let J=zJ(this.manifestPath,"utf-8"),Y=JSON.parse(J);if(Y.version!==QJ)return!1;if(Y.configHash!==this.configHash)return!1;return this.manifest=Y,!0}catch{return!1}}save(){if(!this.manifest)this.manifest={version:QJ,configHash:this.configHash,entries:{},createdAt:Date.now(),updatedAt:Date.now()};if(this.manifest.updatedAt=Date.now(),!n(this.cacheDir))zY(this.cacheDir,{recursive:!0});FJ(this.manifestPath,JSON.stringify(this.manifest,null,2))}needsRegeneration(J,Y){return this.getCachedIfValid(J,Y)===null}getCached(J,Y){return this.getCachedIfValid(J,Y)}getCachedIfValid(J,Y){if(!this.manifest)return null;let Z=s(Y,J),$=this.manifest.entries[Z];if(!$)return null;try{let G=MJ(J).mtimeMs;if(G>$.sourceMtime){let Q=zJ(J,"utf-8");if(this.hashString(Q)!==$.sourceHash)return null;$.sourceMtime=G}return $.dtsContent}catch{return null}}update(J,Y,Z,$){if(!this.manifest)this.manifest={version:QJ,configHash:this.configHash,entries:{},createdAt:Date.now(),updatedAt:Date.now()};let X=s($,J),G;try{G=MJ(J).mtimeMs}catch{G=Date.now()}this.manifest.entries[X]={sourcePath:X,sourceHash:this.hashString(Y),sourceMtime:G,dtsContent:Z,dtsHash:this.hashString(Z),generatedAt:Date.now(),configHash:this.configHash}}remove(J,Y){if(!this.manifest)return;let Z=s(Y,J);delete this.manifest.entries[Z]}clear(){this.manifest=null;try{if(n(this.manifestPath))VY(this.cacheDir,{recursive:!0,force:!0})}catch{}}getStats(){if(!this.manifest)return{entries:0,size:0};let J=Object.keys(this.manifest.entries).length,Y=0;for(let Z of Object.values(this.manifest.entries))Y+=Z.dtsContent.length;return{entries:J,size:Y}}prune(J,Y){if(!this.manifest)return 0;let Z=0,$=new Set(Array.from(J).map((X)=>s(Y,X)));for(let X of Object.keys(this.manifest.entries))if(!$.has(X))delete this.manifest.entries[X],Z++;return Z}}function wJ(J){let Y=SJ(J,".gitignore");try{let Z="";if(n(Y))Z=zJ(Y,"utf-8");if(!Z.includes(VJ)){let $=`${Z.trimEnd()}
|
|
10
|
+
|
|
11
|
+
# dtsx cache
|
|
12
|
+
${VJ}/
|
|
13
|
+
`;FJ(Y,$)}}catch{}}import{spawn as HY}from"child_process";import{readFile as WJ,stat as DJ,writeFile as KY}from"fs/promises";var I=typeof globalThis.Bun<"u",QZ=!I&&typeof process<"u"&&!!process.versions?.node,UZ=I?"bun":"node";class vJ{name;_size=-1;constructor(J){this.name=J}async exists(){try{return await DJ(this.name),!0}catch{return!1}}async text(){return WJ(this.name,"utf-8")}async arrayBuffer(){let J=await WJ(this.name);return J.buffer.slice(J.byteOffset,J.byteOffset+J.byteLength)}get size(){if(this._size===-1)return-1;return this._size}}class IJ{pid;stdout;stderr;stdin;exited;process;constructor(J){this.process=J,this.pid=J.pid??0,this.stdout=J.stdout,this.stderr=J.stderr,this.stdin=J.stdin,this.exited=new Promise((Y)=>{J.on("exit",(Z)=>{Y(Z??0)}),J.on("error",()=>{Y(1)})})}kill(J){this.process.kill(J)}ref(){this.process.ref()}unref(){this.process.unref()}}function EJ(J){if(I)return globalThis.Bun.file(J);return new vJ(J)}async function HJ(J,Y){if(I)return globalThis.Bun.write(J,Y);let Z=typeof Y==="string"?Y:Y instanceof ArrayBuffer?Buffer.from(Y):Y;return await KY(J,Z),typeof Y==="string"?Buffer.byteLength(Y):Y.byteLength}function yJ(J,Y={}){if(I)return globalThis.Bun.spawn(J,Y);let Z=Array.isArray(J)?J:[J],[$,...X]=Z,G={cwd:Y.cwd,env:Y.env,stdio:[Y.stdin??"pipe",Y.stdout??"pipe",Y.stderr??"pipe"]},Q=HY($,X,G);return new IJ(Q)}async function y(J){if(I)return globalThis.Bun.file(J).text();return WJ(J,"utf-8")}async function zZ(J){if(I)return globalThis.Bun.file(J).exists();try{return await DJ(J),!0}catch{return!1}}async function VZ(J,Y){await HJ(J,Y)}function jZ(){if(I)return{name:"bun",version:globalThis.Bun.version,isBun:!0,isNode:!1};return{name:"node",version:process.versions.node,isBun:!1,isNode:!0}}var g={PARSE_ERROR:"PARSE_ERROR",SYNTAX_ERROR:"SYNTAX_ERROR",FILE_NOT_FOUND:"FILE_NOT_FOUND",FILE_READ_ERROR:"FILE_READ_ERROR",FILE_WRITE_ERROR:"FILE_WRITE_ERROR",TYPE_INFERENCE_ERROR:"TYPE_INFERENCE_ERROR",UNRESOLVED_TYPE:"UNRESOLVED_TYPE",EXTRACTION_ERROR:"EXTRACTION_ERROR",PROCESSING_ERROR:"PROCESSING_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",INVALID_DECLARATION:"INVALID_DECLARATION",CONFIG_ERROR:"CONFIG_ERROR",INVALID_ENTRYPOINT:"INVALID_ENTRYPOINT",CIRCULAR_DEPENDENCY:"CIRCULAR_DEPENDENCY",TIMEOUT_ERROR:"TIMEOUT_ERROR",NOT_SUPPORTED:"NOT_SUPPORTED",UNKNOWN_ERROR:"UNKNOWN_ERROR"};class E extends Error{code;context;constructor(J,Y="UNKNOWN_ERROR",Z){super(J);if(this.name="DtsxError",this.code=Y,this.context=Z,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toString(){let J=`${this.name} [${this.code}]: ${this.message}`;if(this.context)J+=`
|
|
14
|
+
Context: ${JSON.stringify(this.context,null,2)}`;return J}toJSON(){return{name:this.name,code:this.code,message:this.message,context:this.context,stack:this.stack}}}class bJ extends E{filePath;line;column;constructor(J,Y,Z){super(J,"PARSE_ERROR",{filePath:Y,line:Z?.line,column:Z?.column});if(this.name="ParseError",this.filePath=Y,this.line=Z?.line,this.column=Z?.column,Z?.cause)this.cause=Z.cause}get locationString(){if(this.line!==void 0&&this.column!==void 0)return`${this.filePath}:${this.line}:${this.column}`;return this.line!==void 0?`${this.filePath}:${this.line}`:this.filePath}}class _Y extends E{filePath;declarationKind;constructor(J,Y,Z,$){super(J,"EXTRACTION_ERROR",{filePath:Y,declarationKind:Z});if(this.name="ExtractionError",this.filePath=Y,this.declarationKind=Z,$)this.cause=$}}class qY extends E{declarationName;constructor(J,Y,Z){super(J,"PROCESSING_ERROR",{declarationName:Y});if(this.name="ProcessingError",this.declarationName=Y,Z)this.cause=Z}}class xJ extends E{filePath;operation;constructor(J,Y,Z,$){super(J,Z==="read"?"FILE_READ_ERROR":"FILE_WRITE_ERROR",{filePath:Y,operation:Z});if(this.name="FileError",this.filePath=Y,this.operation=Z,$)this.cause=$}}class CJ extends E{configPath;invalidKey;constructor(J,Y){super(J,"CONFIG_ERROR",{configPath:Y?.configPath,invalidKey:Y?.invalidKey});if(this.name="ConfigError",this.configPath=Y?.configPath,this.invalidKey=Y?.invalidKey,Y?.cause)this.cause=Y.cause}}class BY extends E{cycle;constructor(J){super(`Circular dependency detected: ${J.join(" -> ")}`,"CIRCULAR_DEPENDENCY",{cycle:J});this.name="CircularDependencyError",this.cycle=J}}function HZ(J){return J instanceof E}function KZ(J){return J instanceof bJ}function _Z(J){return J instanceof xJ}function qZ(J){return J instanceof CJ}function BZ(J,Y="UNKNOWN_ERROR",Z){if(J instanceof E)return J;let $=Z||(J instanceof Error?J.message:String(J)),X=new E($,Y);if(J instanceof Error)X.cause=J;return X}function TZ(J,Y){let Z=1,$=1,X=0;for(let G of J){if(X>=Y)break;if(G===`
|
|
15
|
+
`)Z++,$=1;else $++;X++}return{line:Z,column:$,offset:Y}}function AZ(J,Y,Z,$){let X=J.split(`
|
|
16
|
+
`),G=Y.line-1,Q=[];if($)Q.push(`${$}:${Y.line}:${Y.column}`);else Q.push(`Line ${Y.line}, Column ${Y.column}`);Q.push(`Error: ${Z}`),Q.push("");let H=Math.max(0,G-1),U=Math.min(X.length-1,G+1);for(let W=H;W<=U;W++){let V=(W+1).toString().padStart(4," "),T=W===G?">":" ";if(Q.push(`${T} ${V} | ${X[W]}`),W===G){let N=" ".repeat(8+Y.column-1);Q.push(`${N}^`)}}return Q.join(`
|
|
17
|
+
`)}function KJ(J,Y,Z){let $={file:Y,message:"Unknown error",code:g.UNKNOWN_ERROR};if(J instanceof Error){$.message=J.message,$.stack=J.stack;let X=J.message.match(/\((\d+),(\d+)\)/);if(X)$.location={line:Number.parseInt(X[1],10),column:Number.parseInt(X[2],10)};if(J.message.includes("Cannot find")||J.message.includes("not found"))$.code=g.FILE_NOT_FOUND,$.suggestion="Check that the file path is correct and the file exists.";else if(J.message.includes("syntax")||J.message.includes("Unexpected token"))$.code=g.SYNTAX_ERROR,$.suggestion="Check for syntax errors in your TypeScript code.";else if(J.message.includes("type")&&J.message.includes("cannot"))$.code=g.TYPE_INFERENCE_ERROR,$.suggestion="Add explicit type annotations to help with type inference.";else if(J.message.includes("parse")||J.message.includes("Parse"))$.code=g.PARSE_ERROR,$.suggestion="The file contains invalid TypeScript syntax."}else if(typeof J==="string")$.message=J;return $}function PJ(J,Y){let Z=[],$=J.file;if(J.location)$+=`:${J.location.line}:${J.location.column}`;if(J.code)$+=` [${J.code}]`;if(Z.push($),Z.push(` Error: ${J.message}`),Y&&J.location){Z.push("");let X=Y.split(`
|
|
18
|
+
`),G=J.location.line-1;if(G>=0&&G<X.length){let Q=Math.max(0,G-1),H=Math.min(X.length-1,G+1);for(let U=Q;U<=H;U++){let W=(U+1).toString().padStart(4," "),V=U===G?">":" ";if(Z.push(` ${V} ${W} | ${X[U]}`),U===G&&J.location.column>0){let T=" ".repeat(10+J.location.column-1);Z.push(` ${T}^`)}}}}if(J.suggestion)Z.push(""),Z.push(` Suggestion: ${J.suggestion}`);return Z.join(`
|
|
19
|
+
`)}function kZ(J){if(J.length===0)return"No errors";let Y=new Map;for(let $ of J){let X=$.code||"UNKNOWN";Y.set(X,(Y.get(X)||0)+1)}let Z=[`${J.length} error(s) found:`];for(let[$,X]of Y.entries())Z.push(` - ${$}: ${X}`);return Z.join(`
|
|
20
|
+
`)}var i=null,b=null;async function AY(){if(i!==null)return i;try{return b=await import("prettier"),i=!0,!0}catch{return i=!1,!1}}async function kY(J,Y){if(!b)return null;try{if(Y&&b.resolveConfig){let Z=await b.resolveConfig(Y);if(Z)return Z}if(J&&b.resolveConfig){let Z=await b.resolveConfig(J);if(Z)return Z}return null}catch{return null}}async function NY(J,Y){if(!b)throw Error("Prettier is not available");let Z={...Y,parser:Y.parser||"typescript"};return b.format(J,Z)}function OY(J,Y={}){let{indentSize:Z=2,useTabs:$=!1,maxLineWidth:X=100,trailingNewline:G=!0,normalizeWhitespace:Q=!0,sortImports:H=!0,groupImports:U=!0}=Y,W=J,V=$?"\t":" ".repeat(Z);if(W.indexOf(`\r
|
|
21
|
+
`)!==-1)W=W.replace(/\r\n/g,`
|
|
22
|
+
`);if(Q){if(/[ \t]\n/.test(W)||/[ \t]$/.test(W))W=W.replace(/[ \t]+$/gm,"");if(W.indexOf(`
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
`)!==-1)W=W.replace(/\n{3,}/g,`
|
|
26
|
+
|
|
27
|
+
`);W=RY(W,V)}if(H||U)W=LY(W,{sort:H,group:U});if(X>0)W=FY(W,X,V);if(G&&!W.endsWith(`
|
|
28
|
+
`))W+=`
|
|
29
|
+
`;return W}function RY(J,Y){let Z=J.split(`
|
|
30
|
+
`),$=[];for(let X of Z){let G=X.match(/^(\s*)(.*)$/);if(!G){$.push(X);continue}let[,Q,H]=G;if(!H){$.push("");continue}let U=Q.replace(/\t/g," ").length,W=Math.floor(U/2);$.push(Y.repeat(W)+H)}return $.join(`
|
|
31
|
+
`)}function LY(J,Y){let Z=J.split(`
|
|
32
|
+
`),$=[],X=[],G=!1,Q=0;for(let U=0;U<Z.length;U++){let W=Z[U],V=W.match(/^(import\s+(?:type\s+)?.*from\s+['"])([^'"]+)(['"].*)$/);if(V){G=!0,Q=U;let T=V[1];$.push({line:W,source:V[2],isType:T.startsWith("import type ")||T.startsWith("import type\t")})}else if(G&&W.trim()==="")continue;else{if(G)G=!1;X.push(W)}}if($.length===0)return J;if(Y.sort)$.sort((U,W)=>{if(U.isType!==W.isType)return U.isType?1:-1;return MY(U.source,W.source)});let H;if(Y.group){let U=[],W=[],V=[],T=[],N=[];for(let q=0;q<$.length;q++){let O=$[q],j=O.source;if(j.charCodeAt(0)===46)N.push(O);else if(j.startsWith("node:"))U.push(O);else if(j.charCodeAt(0)===64)T.push(O);else if(j.includes("/"))V.push(O);else W.push(O)}H=[...U.map((q)=>q.line),...U.length>0&&W.length>0?[""]:[],...W.map((q)=>q.line),...(U.length>0||W.length>0)&&V.length>0?[""]:[],...V.map((q)=>q.line),...T.length>0&&(U.length>0||W.length>0||V.length>0)?[""]:[],...T.map((q)=>q.line),...N.length>0?[""]:[],...N.map((q)=>q.line)]}else H=$.map((U)=>U.line);return[...H,"",...X].join(`
|
|
33
|
+
`)}function MY(J,Y){let Z=J.startsWith("node:"),$=Y.startsWith("node:");if(Z!==$)return Z?-1:1;let X=J.startsWith("."),G=Y.startsWith(".");if(X!==G)return X?1:-1;return J.localeCompare(Y)}function FY(J,Y,Z){let $=J.split(`
|
|
34
|
+
`),X=[];for(let G of $){if(G.length<=Y){X.push(G);continue}if(G.trimStart().startsWith("import ")){X.push(G);continue}let Q=G.match(/^(\s*)/)?.[1]||"",H=Q+Z;if(G.includes("{")&&G.includes("}")){let U=SY(G,Y,Q,H);X.push(...U);continue}if(G.includes(" | ")){let U=wY(G,Y,Q,H);X.push(...U);continue}X.push(G)}return X.join(`
|
|
35
|
+
`)}function SY(J,Y,Z,$){let X=J.match(/^(\s*)(.*?)(\{)(.+)(\}.*)$/);if(!X)return[J];let[,,G,Q,H,U]=X,W=H.split(/;\s*|,\s*/).filter((T)=>T.trim());if(W.length<=1)return[J];return[`${Z}${G}${Q}`,...W.map((T)=>`${$}${T.trim()};`),`${Z}${U.trim()}`]}function wY(J,Y,Z,$){let X=J.match(/^(\s*)(.*?=\s*)(.+)$/);if(!X)return[J];let[,,G,Q]=X,H=Q.split(/\s*\|\s*/).filter((W)=>W.trim());if(H.length<=2)return[J];return[`${Z}${G}`,...H.map((W,V)=>`${$}${V>0?"| ":" "}${W.trim()}`)]}async function d(J,Y={},Z){let $=[];if(Y.usePrettier!==!1){if(await AY())try{let H={...await kY(Y.prettierConfigPath,Z),...Y.prettierOptions,parser:"typescript"};return{content:await NY(J,H),usedPrettier:!0}}catch(Q){$.push(`Prettier formatting failed: ${Q}. Using built-in formatter.`)}else if(Y.usePrettier===!0)$.push("Prettier requested but not available. Using built-in formatter.")}return{content:OY(J,Y.builtIn),usedPrettier:!1,warnings:$.length>0?$:void 0}}async function DY(J,Y={}){let Z=new Map;for(let[$,X]of J){let G=await d(X,Y,$);Z.set($,G)}return Z}function OZ(J={}){return{format:(Y,Z)=>d(Y,J,Z),formatMany:(Y)=>DY(Y,J)}}async function RZ(J){return(await d(J,{usePrettier:!0,builtIn:{indentSize:2,normalizeWhitespace:!0,sortImports:!0,trailingNewline:!0}})).content}import{existsSync as vY,statSync as IY}from"fs";import{dirname as EY,isAbsolute as qJ,resolve as yY}from"path";var hJ=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".d.ts"];function _J(J){try{return IY(J).isFile()}catch{return!1}}function o(J,Y){if(!(J.startsWith("./")||J.startsWith("../")||J==="."||J==="..")&&!qJ(J))return{resolved:null,isRelative:!1};let $=EY(Y),X=qJ(J)?J:yY($,J);if(_J(X))return{resolved:X,isRelative:!0};for(let G of hJ){let Q=X+G;if(_J(Q))return{resolved:Q,isRelative:!0}}if(vY(X))for(let G of hJ){let Q=`${X}/index${G}`;if(_J(Q))return{resolved:Q,isRelative:!0}}return{resolved:null,isRelative:!0}}function bY(J){let Y=J.length,Z="",$=0;while($<Y){let X=J.charCodeAt($);if(X===34||X===39||X===96){let G=X;Z+=J[$++];while($<Y){let Q=J.charCodeAt($);if(Z+=J[$++],Q===92&&$<Y){Z+=J[$++];continue}if(Q===G)break}continue}if(X===47&&$+1<Y){let G=J.charCodeAt($+1);if(G===47){$+=2;while($<Y&&J.charCodeAt($)!==10)$++;continue}if(G===42){$+=2;while($+1<Y&&!(J.charCodeAt($)===42&&J.charCodeAt($+1)===47))$++;$+=2;continue}}Z+=J[$++]}return Z}var mJ=/(?:^|[\n;{}])\s*export\s+(type\s+)?(?:\*(?:\s+as\s+\w+)?|\{[^}]*\})\s+from\s+(['"])([^'"]+)\2/g,gJ=/(?:^|[\n;{}])\s*import\s+(type\s+)?(?:[^'";\n]+\s+from\s+)?(['"])([^'"]+)\2/g;function BJ(J,Y={}){let Z=[],$=bY(J);mJ.lastIndex=0;let X;while((X=mJ.exec($))!==null){let G=!!X[1],Q=X[3],H=X[0],U;if(H.includes("* as "))U="export-star-as";else if(H.includes("*"))U="export-star";else U="export-named";Z.push({specifier:Q,kind:U,isTypeOnly:G})}if(Y.includeImports){gJ.lastIndex=0;while((X=gJ.exec($))!==null)Z.push({specifier:X[3],kind:"import",isTypeOnly:!!X[1]})}return Z}async function TJ(J,Y={}){let Z=new Set,$=new Map,X=[],G=[];for(let Q of J)if(!Z.has(Q))Z.add(Q),G.push(Q);while(G.length>0){let Q=G.shift(),H;try{H=await y(Q)}catch{continue}let U=BJ(H,Y);$.set(Q,U);for(let W of U){if(!(W.specifier.startsWith(".")||qJ(W.specifier)))continue;let V=o(W.specifier,Q);if(V.resolved){if(!Z.has(V.resolved))Z.add(V.resolved),G.push(V.resolved)}else X.push({from:Q,specifier:W.specifier,isTypeOnly:W.isTypeOnly})}}return{reachable:Z,reExports:$,unresolved:X}}class r{plugins=[];config=null;register(J){if(this.plugins.some((Y)=>Y.name===J.name))throw Error(`Plugin "${J.name}" is already registered`);this.plugins.push(J)}unregister(J){let Y=this.plugins.findIndex((Z)=>Z.name===J);if(Y>=0)return this.plugins.splice(Y,1),!0;return!1}getPlugins(){return this.plugins}createLogger(J){return{debug:(Y)=>console.debug(`[${J}] ${Y}`),info:(Y)=>console.info(`[${J}] ${Y}`),warn:(Y)=>console.warn(`[${J}] ${Y}`),error:(Y)=>console.error(`[${J}] ${Y}`)}}async runOnStart(J){let Y=J;for(let Z of this.plugins)if(Z.onStart){let $=await Z.onStart(Y);if($)Y=$}return this.config=Y,Y}async runOnBeforeFile(J,Y){let Z=Y;for(let $ of this.plugins)if($.onBeforeFile){let X={filePath:J,sourceCode:Y,content:Z,config:this.config,log:this.createLogger($.name)},G=await $.onBeforeFile(X);if(typeof G==="string")Z=G}return Z}async runOnDeclarations(J,Y,Z){let $=Z;for(let X of this.plugins)if(X.onDeclarations){let G={filePath:J,sourceCode:Y,declarations:$,config:this.config,log:this.createLogger(X.name)},Q=await X.onDeclarations(G);if(Q)$=Q}return $}async runOnAfterFile(J,Y,Z){let $=Z;for(let X of this.plugins)if(X.onAfterFile){let G={filePath:J,sourceCode:Y,content:$,config:this.config,log:this.createLogger(X.name)},Q=await X.onAfterFile(G);if(typeof Q==="string")$=Q}return $}async runOnEnd(J){for(let Y of this.plugins)if(Y.onEnd)await Y.onEnd(J)}async runOnError(J,Y,Z){for(let $ of this.plugins)if($.onError){let X={filePath:Y,sourceCode:Z,config:this.config,log:this.createLogger($.name)};await $.onError(J,X)}}}var DZ=new r;function AJ(J){return J}var vZ=AJ({name:"strip-internal",version:"1.0.0",description:"Removes declarations marked with @internal",onDeclarations:(J)=>{return J.declarations.filter((Y)=>{if(Y.leadingComments){if(Y.leadingComments.some(($)=>$.includes("@internal")))return J.log.debug(`Stripping internal declaration: ${Y.name}`),!1}return!0})}});function IZ(J){return AJ({name:"banner",version:"1.0.0",description:"Adds a banner comment to generated files",onAfterFile:(Y)=>{return`/**
|
|
36
|
+
* ${J.split(`
|
|
37
|
+
`).join(`
|
|
38
|
+
* `)}
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
`+Y.content}})}function EZ(J){return AJ({name:"filter",version:"1.0.0",description:"Filters declarations by name",onDeclarations:(Y)=>{return Y.declarations.filter((Z)=>{if(Z.kind==="import")return!0;return J(Z.name)})}})}var P=xY(CY(),1);import{readdir as PY}from"fs/promises";import{dirname as hY,extname as mY,isAbsolute as gY,join as uJ,resolve as dJ}from"path";import pJ from"process";import{pathToFileURL as kJ}from"url";function gZ(J,Y){throw Error(Y||`Unexpected value: ${J}`)}async function h(J,Y){let Z=Y.replace(/\r\n/g,`
|
|
42
|
+
`);if(!Z.endsWith(`
|
|
43
|
+
`))Z+=`
|
|
44
|
+
`;await HJ(J,Z)}async function dY(J){let Y=J??f.root,Z=await PY(Y,{withFileTypes:!0});return(await Promise.all(Z.map((X)=>{let G=uJ(Y,X.name);return X.isDirectory()?dY(G):G}))).flat(1/0).filter((X)=>typeof X==="string"&&mY(X)===".ts")}async function cJ(J){try{let Y=J?.cwd||pJ.cwd(),Z=J?.tsconfigPath||uJ(Y,"tsconfig.json"),X=await import(kJ(Z).href);if(X.compilerOptions?.isolatedDeclarations===!0)return!0;if(X.extends){let G=fJ(Z,X.extends),Q=G.endsWith(".json")?G:`${G}.json`,U=await import(kJ(Q).href);if(U.compilerOptions?.isolatedDeclarations===!0)return!0;if(U.extends){let W=fJ(Q,U.extends),V=W.endsWith(".json")?W:`${W}.json`;if((await import(kJ(V).href)).compilerOptions?.isolatedDeclarations===!0)return!0}}return!1}catch{return!1}}function lJ(J,Y){let Z={isValid:!0,errors:[]},$=P.default.createSourceFile(Y,J,P.default.ScriptTarget.Latest,!0,P.default.ScriptKind.TS),X={getSourceFile:(H)=>{if(H===Y)return $;return},getDefaultLibFileName:()=>"lib.d.ts",writeFile:()=>{},getCurrentDirectory:()=>"",getCanonicalFileName:(H)=>H,useCaseSensitiveFileNames:()=>!0,getNewLine:()=>`
|
|
45
|
+
`,fileExists:(H)=>H===Y,readFile:()=>{return}},Q=[...P.default.createProgram({rootNames:[Y],options:{noEmit:!0,declaration:!0,skipLibCheck:!0,noLib:!0},host:X}).getSyntacticDiagnostics($)];for(let H of Q){let U=P.default.flattenDiagnosticMessageText(H.messageText,`
|
|
46
|
+
`),W=`TS${H.code}`,V;switch(H.code){case 1005:V="Add a semicolon at the end of the statement.";break;case 1109:V="Check for missing or malformed expressions.";break;case 1128:V="Ensure proper declaration syntax is used.";break;case 2304:V="Import or declare the missing type/value.";break;case 2307:V="Check that the module exists and is installed.";break;case 2322:V="Check type compatibility between the values.";break;case 2339:V="Add the missing property to the type definition.";break;case 2345:V="Check the argument types match the expected parameters.";break}if(H.file&&H.start!==void 0){let{line:T,character:N}=H.file.getLineAndCharacterOfPosition(H.start);Z.errors.push({line:T+1,column:N+1,message:U,code:W,suggestion:V})}else Z.errors.push({line:0,column:0,message:U,code:W,suggestion:V})}return Z.isValid=Z.errors.length===0,Z}function aJ(J,Y,Z){if(J===Y)return"";let $=J.split(`
|
|
47
|
+
`),X=Y.split(`
|
|
48
|
+
`),G=new Map,Q=new Map;for(let V=0;V<$.length;V++)G.set($[V],(G.get($[V])??0)+1);for(let V=0;V<X.length;V++)Q.set(X[V],(Q.get(X[V])??0)+1);let H=[],U=[];for(let[V,T]of G){let N=T-(Q.get(V)??0);for(let q=0;q<N;q++)H.push(V)}for(let[V,T]of Q){let N=T-(G.get(V)??0);for(let q=0;q<N;q++)U.push(V)}if(H.length===0&&U.length===0)return"";let W=[`--- ${Z}`,`+++ ${Z}`];for(let V=0;V<H.length;V++)W.push(`- ${H[V]}`);for(let V=0;V<U.length;V++)W.push(`+ ${U[V]}`);return W.join(`
|
|
49
|
+
`)}function fJ(J,Y){if(gY(Y))return Y;if(Y.startsWith("."))return dJ(hY(J),Y);return dJ(pJ.cwd(),"node_modules",Y)}function sJ(J,Y,Z,$){let X=J.split(`
|
|
50
|
+
`),G=[];function Q(T){let q="",O=T<0?-T<<1|1:T<<1;do{let j=O&31;if(O>>>=5,O>0)j|=32;q+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[j]}while(O>0);return q}let H=0,U=0,W=0,V=$.split(`
|
|
51
|
+
`).length;for(let T=0;T<X.length;T++){if(X[T].trim()===""){G.push("");continue}H=0;let q=Math.min(T,V-1),O=[],j=0-H,K=0,A=q-U,z=0-W;O.push(Q(j)+Q(K)+Q(A)+Q(z)),H=0,U=q,W=0,G.push(O.join(","))}return{version:3,file:Y,sourceRoot:"",sources:[Z],sourcesContent:[$],mappings:G.join(";")}}function nJ(J,Y){return`${J}
|
|
52
|
+
//# sourceMappingURL=${Y}
|
|
53
|
+
`}async function uY(J){let Y=Date.now(),Z={...f,...J};if(Z.logLevel)e(Z.logLevel);else if(Z.verbose)e("debug");let $=new r;if(Z.plugins&&Z.plugins.length>0){for(let j of Z.plugins)$.register(j),_.debug(`Registered plugin: ${j.name}`);Z=await $.runOnStart(Z)}if(Z.isolatedDeclarations===void 0)Z.isolatedDeclarations=await cJ(Z);let X=null;if(Z.incremental){if(X=new jJ(Z),Z.clearCache)_.debug("Clearing build cache..."),X.clear();else if(X.load()){let K=X.getStats();_.debug(`Loaded build cache with ${K.entries} entries`)}else _.debug("No existing build cache found, starting fresh");wJ(Z.cwd)}let G={filesProcessed:0,filesGenerated:0,filesFailed:0,filesValidated:0,validationErrors:0,declarationsFound:0,importsProcessed:0,exportsProcessed:0,durationMs:0,errors:[]},Q=0;_.debug("Starting DTS generation..."),_.debug("Config:",Z);let H=await lY(Z),U=H.slice(),W=null;if(Z.autoIncludeReExports!==!1&&U.length>0){W=await TJ(U,{includeImports:!0});let j=x(Z.cwd,Z.root),K=Z.exclude||[],A=[];for(let z of W.reachable){if(U.includes(z))continue;if(z.endsWith(".d.ts"))continue;if(z.includes("node_modules"))continue;if(JJ(z,K,j))continue;A.push(z)}if(A.length>0)U=[...U,...A],_.debug(`Auto-included ${A.length} file(s) reached via relative re-exports`)}if(X){let j=X.prune(new Set(U),Z.cwd);if(j>0)_.debug(`Pruned ${j} deleted files from cache`)}if(_.debug(`Found ${U.length} TypeScript files`),Z.progress&&U.length>0){let j=Z.parallel?"parallel":"sequential";_.info(`Processing ${U.length} files (${j})...`)}let V=async(j,K)=>{let A;try{let z=p(j,Z);if(X){let S=X.getCachedIfValid(j,Z.cwd);if(S)return await t(m(z),{recursive:!0}),await h(z,S),_.debug(`[cached] ${D(Z.cwd,z)}`),{success:!0,file:j,declarationCount:0,importCount:0,exportCount:0,cached:!0,validationErrorCount:0}}A=K??await y(j);let{content:B,declarationCount:k,importCount:R,exportCount:L}=await tJ(j,A,Z,$),F=0;if(Z.dryRun)_.info(`[dry-run] Would generate: ${z}`),_.debug("--- Content preview ---"),_.debug(B.slice(0,500)+(B.length>500?`
|
|
54
|
+
...`:"")),_.debug("--- End preview ---");else{if(Z.diff)try{let M=await y(z),w=aJ(M,B,D(Z.cwd,z));if(w)_.info(`
|
|
55
|
+
${w}`);else _.debug(`[no changes] ${z}`)}catch{_.info(`[new file] ${D(Z.cwd,z)}`)}await t(m(z),{recursive:!0});let S=B;if(Z.declarationMap&&A){let M=z.split("/").pop()||"output.d.ts",w=D(m(z),j),v=`${M}.map`,c=sJ(B,M,w,A),C=`${z}.map`;await h(C,JSON.stringify(c)),S=nJ(B,v),_.debug(` Generated source map: ${D(Z.cwd,C)}`)}if(Z.prettier||Z.indentStyle||Z.indentSize){let M=await d(S,{usePrettier:Z.prettier,builtIn:{indentSize:Z.indentSize||2,useTabs:Z.indentStyle==="tabs",normalizeWhitespace:!0,sortImports:!0,trailingNewline:!0}},z);if(S=M.content,M.warnings?.length)for(let w of M.warnings)_.warn(`[format] ${w}`)}if(await h(z,S),X&&A)X.update(j,A,S,Z.cwd);if(Z.validate){let M=lJ(B,z);if(!M.isValid){F=M.errors.length,_.warn(`[validation] ${D(Z.cwd,z)} has ${M.errors.length} error(s):`);for(let w of M.errors){let v=` Line ${w.line}:${w.column}`;if(w.code)v+=` [${w.code}]`;if(v+=` - ${w.message}`,_.warn(v),w.suggestion)_.warn(` Suggestion: ${w.suggestion}`)}}else _.debug(`[validation] ${z} - OK`)}_.debug(`Generated: ${z}`)}return{success:!0,file:j,declarationCount:k,importCount:R,exportCount:L,validationErrorCount:F}}catch(z){let B=KJ(z,j,A);if(Z.plugins&&Z.plugins.length>0)await $.runOnError(z instanceof Error?z:Error(String(z)),j,A||"");return{success:!1,file:j,declarationCount:0,importCount:0,exportCount:0,dtsError:B,validationErrorCount:0}}},T=Z.parallel||Z.parallel!==!1&&U.length>=10,N=Z.concurrency||(fY?.()??8),q=new Map;if(T&&U.length>1){let j=U.map(async(K)=>{try{let A=await y(K);return{file:K,source:A}}catch{return{file:K,source:null}}});for(let K of await Promise.all(j))if(K.source!==null)q.set(K.file,K.source)}let O=(j)=>{if(G.filesProcessed++,j.success){if(j.cached)Q++;else G.filesGenerated++,G.declarationsFound+=j.declarationCount,G.importsProcessed+=j.importCount,G.exportsProcessed+=j.exportCount;if(Z.validate){if(G.filesValidated++,j.validationErrorCount)G.validationErrors+=j.validationErrorCount}}else if(G.filesFailed++,j.dtsError){G.errors.push(j.dtsError);let K=PJ(j.dtsError);if(Z.continueOnError)_.warn(K);else throw _.error(K),Error(j.dtsError.message)}};if(T)for(let j=0;j<U.length;j+=N){let K=U.slice(j,j+N),A=await Promise.all(K.map((z)=>V(z,q.get(z))));for(let z of A)O(z);if(Z.progress){let z=Math.round(G.filesProcessed/U.length*100);_.info(`[${G.filesProcessed}/${U.length}] ${z}%`)}}else for(let j of U){let K=await V(j);if(O(K),Z.progress){let A=Math.round(G.filesProcessed/U.length*100),z=K.cached?"[cached]":"";_.info(`[${G.filesProcessed}/${U.length}] ${A}% - ${D(Z.cwd,j)} ${z}`)}}if(X)X.save(),_.debug("Saved build cache");if(!Z.bundle){let j=[];if(W)for(let K of W.unresolved)j.push({from:K.from,specifier:K.specifier,reason:"missing"});if(Z.autoIncludeReExports===!1&&U.length>0){let K=new Set(U);for(let A of U){let z;try{z=await y(A)}catch{continue}for(let B of BJ(z)){if(!B.specifier.startsWith("."))continue;let k=o(B.specifier,A);if(!k.resolved)j.push({from:A,specifier:B.specifier,reason:"missing"});else if(!K.has(k.resolved))j.push({from:A,specifier:B.specifier,reason:"not-emitted"})}}}if(j.length>0){let K=[];K.push(`Found ${j.length} re-export(s) pointing at siblings that won't be in the output:`);for(let z of j){let B=D(Z.cwd,z.from);if(z.reason==="missing")K.push(` ${B} \u2192 '${z.specifier}' (path not found on disk)`);else K.push(` ${B} \u2192 '${z.specifier}' (resolved but not in entrypoints; set autoIncludeReExports: true or add to entrypoints)`)}let A=K.join(`
|
|
56
|
+
`);if(Z.failOnUnresolvedReExport)throw Error(A);_.warn(A),_.warn('Generated .d.ts files reference modules that were not emitted \u2014 consumers will see "has no exported member" errors.')}}if(Z.bundle&&(G.filesGenerated>0||Q>0)&&H.length>0)try{_.debug("Bundling declarations...");let j=new Map,K=async(z)=>{let B=j.get(z);if(B!==void 0)return B;return B=await y(z),j.set(z,B),B};for(let z of U)await K(z);let A=H.length===1&&!!Z.bundleOutput;for(let z of H){let B=await TJ([z],{includeImports:!0}),k=new Set;for(let M of B.reachable){if(M.endsWith(".d.ts"))continue;if(M.includes("node_modules"))continue;k.add(M)}let R=U.filter((M)=>k.has(M));if(!R.includes(z))R.push(z);let L=new Map;for(let M of R){let w=j.get(M)??await K(M);L.set(M,w)}let F=await OJ(R,L,Z),S=A?x(Z.cwd,Z.outdir,Z.bundleOutput):p(z,Z);if(await t(m(S),{recursive:!0}),await h(S,F.content),_.info(`Bundled ${F.files.length} files to: ${D(Z.cwd,S)}`),A)break}}catch(j){let K=j instanceof Error?j.message:String(j);_.error(`Bundle failed: ${K}`)}if(G.durationMs=Date.now()-Y,Z.stats)if(Z.outputFormat==="json")console.log(JSON.stringify(G,null,2));else{if(_.info(`
|
|
57
|
+
--- Generation Statistics ---`),_.info(`Files processed: ${G.filesProcessed}`),_.info(`Files generated: ${G.filesGenerated}`),Q>0)_.info(`Files cached: ${Q}`);if(G.filesFailed>0)_.info(`Files failed: ${G.filesFailed}`);if(_.info(`Declarations found: ${G.declarationsFound}`),_.info(`Imports processed: ${G.importsProcessed}`),_.info(`Exports processed: ${G.exportsProcessed}`),G.filesValidated>0){if(_.info(`Files validated: ${G.filesValidated}`),G.validationErrors>0)_.info(`Validation errors: ${G.validationErrors}`)}if(_.info(`Duration: ${G.durationMs}ms`),G.errors.length>0){_.info(`
|
|
58
|
+
Errors:`);for(let j of G.errors){let K=` - ${j.file}`;if(j.location)K+=`:${j.location.line}:${j.location.column}`;if(j.code)K+=` [${j.code}]`;if(K+=`: ${j.message}`,_.info(K),j.suggestion)_.info(` Suggestion: ${j.suggestion}`)}}_.info(`-----------------------------
|
|
59
|
+
`)}if(Z.plugins&&Z.plugins.length>0)await $.runOnEnd(G);return _.debug("DTS generation complete!"),G}var pY=50,u=new Map;function cY(J){let Y=u.get(J);if(!Y){if(Y=new oJ(J),u.set(J,Y),u.size>pY){let Z=u.keys().next().value;if(Z!==void 0)u.delete(Z)}}return Y}function JJ(J,Y,Z){if(!Y||Y.length===0)return!1;let $=D(Z,J);for(let X of Y){let G=cY(X);if(G.match($)||G.match(J))return!0}return!1}async function lY(J){let Y=[],Z=x(J.cwd,J.root),$=J.exclude||[];for(let X of J.entrypoints)if(X.startsWith("/")&&X.endsWith(".ts")){if(!X.endsWith(".d.ts")&&!X.includes("node_modules")){if(!JJ(X,$,Z))Y.push(X)}}else{let G=new oJ(X);for await(let Q of G.scan({cwd:Z,absolute:!0,onlyFiles:!0}))if(!Q.endsWith(".d.ts")&&!Q.includes("node_modules")){if(!JJ(Q,$,Z))Y.push(Q)}}return[...new Set(Y)]}function p(J,Y){let Z=x(Y.cwd,Y.root),X=D(Z,J).replace(/\.(m?tsx?|cts)$/,(G)=>{if(G===".mts")return".d.mts";if(G===".cts")return".d.cts";return".d.ts"});if(Y.outputStructure==="mirror")return x(Y.cwd,Y.outdir,X);else{let G=X.split("/").pop();return x(Y.cwd,Y.outdir,G)}}function aY(J,Y){let Z=D(m(J),Y).replace(/\\/g,"/");if(Z=Z.replace(/\.d\.mts$/,"").replace(/\.d\.cts$/,"").replace(/\.d\.ts$/,""),!Z.startsWith("."))Z=`./${Z}`;return Z}function sY(J,Y,Z){let $=p(Y,Z),X=(G)=>{let Q=o(G,Y);if(!Q.isRelative||!Q.resolved)return G;return aY($,p(Q.resolved,Z))};return J.replace(/\b(from\s*)(['"])(\.{1,2}\/[^'"]+)\2/g,(G,Q,H,U)=>{return`${Q}${H}${X(U)}${H}`}).replace(/\b(import\s*)(['"])(\.{1,2}\/[^'"]+)\2/g,(G,Q,H,U)=>{return`${Q}${H}${X(U)}${H}`}).replace(/\b(import\s*\(\s*)(['"])(\.{1,2}\/[^'"]+)\2/g,(G,Q,H,U)=>{return`${Q}${H}${X(U)}${H}`})}async function G0(J,Y){return(await rJ(J,Y)).content}async function rJ(J,Y,Z){let $=await y(J);return tJ(J,$,Y,Z)}async function tJ(J,Y,Z,$){let X=Y;if($)X=await $.runOnBeforeFile(J,Y);let G=a(X,J,Z.keepComments,Z.isolatedDeclarations??!1);if($)G=await $.runOnDeclarations(J,X,G);let Q=0,H=0;for(let V=0;V<G.length;V++){let T=G[V];if(T.kind==="import")Q++;if(T.kind==="export"||T.isExported)H++}let W=iJ(G,{filePath:J,sourceCode:X,declarations:G},Z.keepComments,Z.importOrder);if(W=sY(W,J,Z),$)W=await $.runOnAfterFile(J,X,W);return{content:W,declarationCount:G.length,importCount:Q,exportCount:H}}async function Q0(J){let Y={...f,...J};if(Y.logLevel)e(Y.logLevel);let Z=x(Y.cwd,Y.root),$=150,X=5,G=1e4,Q={pendingChanges:new Set,debounceTimer:null,isProcessing:!1,errorCount:0,lastErrorTime:0};_.info(`Watching for changes in ${Z}...`),_.info(`Press Ctrl+C to stop
|
|
60
|
+
`);try{await uY(Y),_.info(`[watch] Initial generation complete
|
|
61
|
+
`)}catch(T){let N=T instanceof Error?T.message:String(T);_.error(`[watch] Initial generation failed: ${N}`),_.info(`[watch] Continuing to watch for changes...
|
|
62
|
+
`)}async function H(){if(Q.isProcessing||Q.pendingChanges.size===0)return;let T=Date.now();if(Q.errorCount>=X){if(T-Q.lastErrorTime<G){_.warn(`[watch] Too many errors, pausing for ${Math.ceil((G-(T-Q.lastErrorTime))/1000)}s...`);return}Q.errorCount=0}Q.isProcessing=!0;let N=Array.from(Q.pendingChanges);Q.pendingChanges.clear();let q=new Date().toLocaleTimeString();if(N.length===1)_.info(`
|
|
63
|
+
[${q}] File changed: ${N[0]}`);else _.info(`
|
|
64
|
+
[${q}] ${N.length} files changed`);let O=0,j=0;for(let K of N){let A=x(Z,K);try{let z=Y.exclude||[];if(JJ(A,z,Z)){_.debug(` Skipping excluded file: ${K}`);continue}if(!await EJ(A).exists()){_.debug(` Skipping deleted file: ${K}`);continue}let k=p(A,Y),{content:R}=await rJ(A,Y);await t(m(k),{recursive:!0}),await h(k,R),_.info(` \u2713 ${D(Y.cwd,k)}`),O++}catch(z){j++,Q.errorCount++,Q.lastErrorTime=Date.now();let B=KJ(z,A);if(_.error(` \u2717 ${K}: ${B.message}`),B.suggestion)_.error(` Suggestion: ${B.suggestion}`)}}if(N.length>1)_.info(` Done: ${O} generated, ${j} failed`);if(j===0)Q.errorCount=0;if(Q.isProcessing=!1,Q.pendingChanges.size>0)Q.debounceTimer=setTimeout(H,$)}function U(T){if(Q.pendingChanges.add(T),Q.debounceTimer)clearTimeout(Q.debounceTimer);Q.debounceTimer=setTimeout(H,$)}let V=yJ([I?"bun":"node","-e",`
|
|
65
|
+
const fs = require('fs');
|
|
66
|
+
|
|
67
|
+
const rootPath = '${Z}';
|
|
68
|
+
|
|
69
|
+
fs.watch(rootPath, { recursive: true }, (eventType, filename) => {
|
|
70
|
+
if (filename && filename.endsWith('.ts') && !filename.endsWith('.d.ts')) {
|
|
71
|
+
console.log(\`CHANGED:\${filename}\`);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Keep process alive
|
|
76
|
+
setInterval(() => {}, 1000);
|
|
77
|
+
`],{stdout:"pipe",stderr:"inherit"});if(I){let T=V.stdout.getReader(),N=new TextDecoder,q="";while(!0){let{done:O,value:j}=await T.read();if(O)break;q+=N.decode(j,{stream:!0});let K=q.split(`
|
|
78
|
+
`);q=K.pop()||"";for(let A of K)if(A.startsWith("CHANGED:")){let z=A.slice(8);U(z)}}}else{let T=V.stdout,N="";T.on("data",(q)=>{N+=q.toString();let O=N.split(`
|
|
79
|
+
`);N=O.pop()||"";for(let j of O)if(j.startsWith("CHANGED:")){let K=j.slice(8);U(K)}}),await V.exited}}
|
|
80
|
+
export{OJ as ua,LJ as va,UY as wa,rY as xa,tY as ya,jJ as za,wJ as Aa,I as Ba,QZ as Ca,UZ as Da,EJ as Ea,HJ as Fa,yJ as Ga,y as Ha,zZ as Ia,VZ as Ja,jZ as Ka,g as La,E as Ma,bJ as Na,_Y as Oa,qY as Pa,xJ as Qa,CJ as Ra,BY as Sa,HZ as Ta,KZ as Ua,_Z as Va,qZ as Wa,BZ as Xa,TZ as Ya,AZ as Za,KJ as _a,PJ as $a,kZ as ab,d as bb,DY as cb,OZ as db,RZ as eb,r as fb,DZ as gb,AJ as hb,vZ as ib,IZ as jb,EZ as kb,gZ as lb,h as mb,dY as nb,cJ as ob,lJ as pb,aJ as qb,sJ as rb,nJ as sb,uY as tb,G0 as ub,Q0 as vb};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{lc as F,mc as L}from"./chunk-
|
|
2
|
+
import{lc as F,mc as L}from"./chunk-y2pe3jq3.js";import{oc as I}from"./chunk-4mtbtmee.js";import{Cc as g}from"./chunk-vx4a5crm.js";var R=100,w=0,z=new Map;function U(B,G="stdin.ts",J=!0,W=["bun"],P=!1){let N=F(B),Y=`${G}:${J?1:0}:${P?1:0}`,Q=z.get(Y);if(Q&&Q.contentHash===N)return Q.lastAccess=++w,Q.result;let j=L(B,G,J,P),v=g(j,{filePath:G,sourceCode:B,declarations:j},J,W);if(z.set(Y,{result:v,contentHash:N,lastAccess:++w}),z.size>R){let M=Math.max(1,Math.ceil(z.size*0.1)),V=[];for(let[q,$]of z)V.push([q,$.lastAccess]);V.sort((q,$)=>q[1]-$[1]);for(let q=0;q<M&&q<V.length;q++)z.delete(V[q][0])}return v}function b(){z.clear()}function H(B,G="stdin.ts",J=!0,W=["bun"],P=!1){let N=I(B,G,J,P);return g(N,{filePath:G,sourceCode:B,declarations:N},J,W)}
|
|
3
3
|
export{U as ic,b as jc,H as kc};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./chunk-mcdb3q06.js";import{existsSync as EZ}from"fs";import HJ from"fs/promises";import CJ from"os";import KJ from"path";import p from"process";import{EventEmitter as IZ}from"events";import m from"process";import kJ from"process";import MJ from"process";import qJ from"process";import vJ from"process";import o from"process";import SJ from"tty";import zZ,{stdin as j0,stdout as G0}from"process";import*as c from"readline";import{ReadStream as yJ,WriteStream as H0}from"tty";import gJ,{stdin as P0,stdout as N0}from"process";import w0 from"readline";import A0 from"process";import S0 from"process";import{WriteStream as y0}from"tty";import f0 from"process";import xJ from"process";import d0 from"process";import{stripVTControlCharacters as WJ}from"util";import{existsSync as c0,lstatSync as dJ,readdirSync as p0}from"fs";import{dirname as uJ,join as i0}from"path";import n0 from"process";import b from"process";import e from"process";import{stripVTControlCharacters as DJ}from"util";import r0 from"process";import{Buffer as iJ}from"buffer";import y from"fs/promises";import a0 from"os";import XJ from"path";import w from"process";import{Readable as s0,Writable as t0}from"stream";class nJ{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let J=CJ.homedir(),Z=KJ.join(J,".config","clapp");this.configPath=KJ.join(Z,"telemetry.json")}async isEnabled(){if(p.env.DO_NOT_TRACK==="1"||p.env.DO_NOT_TRACK==="true")return!1;if(p.env.NO_TELEMETRY==="1"||p.env.NO_TELEMETRY==="true")return!1;return(await this.loadConfig()).enabled}async enable(){let J=await this.loadConfig();if(J.enabled=!0,!J.userId)J.userId=this.generateUserId();await this.saveConfig(J)}async disable(){let J=await this.loadConfig();J.enabled=!1,await this.saveConfig(J)}async track(J,Z){if(!await this.isEnabled())return;let Q={event:J,...Z,timestamp:Date.now(),platform:CJ.platform(),nodeVersion:p.version};if(this.events.push(Q),this.events.length>=10)await this.send()}async trackCommand(J,Z){await this.track("command",{command:J,duration:Z})}async trackError(J,Z){await this.track("error",{error:J,command:Z})}async send(){if(!await this.isEnabled()||this.events.length===0)return!0;try{this.events=[],this.retryCount=0;let Z=await this.loadConfig();return Z.lastSent=Date.now(),await this.saveConfig(Z),!0}catch{if(this.retryCount<this.maxRetries){this.retryCount++;let Z=this.retryDelayMs*2**(this.retryCount-1);return await this.sleep(Z),this.send()}return this.events=[],this.retryCount=0,!1}}async flush(){if(this.events.length===0)return!0;return this.send()}sleep(J){return new Promise((Z)=>setTimeout(Z,J))}async status(){let J=await this.loadConfig();return{enabled:J.enabled,doNotTrack:p.env.DO_NOT_TRACK==="1"||p.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:J.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(EZ(this.configPath)){let J=await HJ.readFile(this.configPath,"utf-8");return this.config=JSON.parse(J),this.config}}catch{}return this.config={enabled:!1},this.config}async saveConfig(J){this.config=J;try{let Z=KJ.dirname(this.configPath);await HJ.mkdir(Z,{recursive:!0}),await HJ.writeFile(this.configPath,JSON.stringify(J,null,2),"utf-8")}catch{}}generateUserId(){let J=Math.random().toString(36).substring(2,15),Z=Date.now().toString(36);return`${J}-${Z}`}}var Y$=new nJ;function AZ(J,Z={}){let $={_:[]},Q=Z.alias||{},Y=new Set(Z.boolean||[]),q={};for(let F of Object.keys(Q))for(let X of Q[F])q[X]=F;for(let F of Y)if(Q[F])for(let X of Q[F])Y.add(X);function U(F,X){let j=q[F]||F;if($[j]=X,Q[j])for(let G of Q[j])$[G]=X;if(q[F]&&Q[q[F]])for(let G of Q[q[F]])$[G]=X;$[F]=X}for(let F=0;F<J.length;F++){let X=J[F];if(X==="--"){$._.push(...J.slice(F+1));break}if(X.startsWith("--")){let j=X.indexOf("=");if(j!==-1){let G=X.slice(2,j),V=X.slice(j+1);U(G,V)}else{let G=X.slice(2);if(G.startsWith("no-")){let W=G.slice(3);U(W,!1);continue}let V=q[G]||G;if(Y.has(V)||Y.has(G))U(G,!0);else{let W=J[F+1];if(W!==void 0&&!W.startsWith("-"))U(G,W),F++;else U(G,!0)}}}else if(X.startsWith("-")&&X.length>1){let j=X.slice(1);for(let G=0;G<j.length;G++){let V=j[G],W=q[V]||V;if(G===j.length-1&&!Y.has(W)&&!Y.has(V)){let K=J[F+1];if(K!==void 0&&!K.startsWith("-"))U(V,K),F++;else U(V,!0)}else U(V,!0)}}else $._.push(X)}return $}function LJ(J){return J.replace(/[<[].+/,"").trim()}function RZ(J){let Z=/<([^>]+)>/g,$=/\[([^\]]+)\]/g,Q=[],Y=(F)=>{let X=!1,j=F[1];if(j.startsWith("..."))j=j.slice(3),X=!0;return{required:F[0].startsWith("<"),value:j,variadic:X}},q;while(q=Z.exec(J))Q.push(Y(q));let U;while(U=$.exec(J))Q.push(Y(U));return Q}function xZ(J){let Z={alias:{},boolean:[]};for(let[$,Q]of J.entries()){if(Q.names.length>1)Z.alias[Q.names[0]]=Q.names.slice(1);if(Q.isBoolean)if(Q.negated){if(!J.some((q,U)=>{return U!==$&&q.names.some((F)=>Q.names.includes(F))&&typeof q.required==="boolean"}))Z.boolean.push(Q.names[0])}else Z.boolean.push(Q.names[0])}return Z}function hJ(J){return J.reduce((Z,$)=>Z.length>=$.length?Z:$,"")}function VJ(J,Z){return J.length>=Z?J:`${J}${" ".repeat(Z-J.length)}`}function CZ(J){return J.replace(/([a-z])-([a-z])/g,(Z,$,Q)=>{return $+Q.toUpperCase()})}function kZ(J,Z,$){let Q=0,Y=Z.length,q=J,U;for(;Q<Y;++Q)U=q[Z[Q]],q=q[Z[Q]]=Q===Y-1?$:U!=null?U:!!~Z[Q+1].indexOf(".")||!(+Z[Q+1]>-1)?{}:[]}function hZ(J,Z){for(let $ of Object.keys(Z)){let Q=Z[$];if(Q.shouldTransform){if(J[$]=Array.prototype.concat.call([],J[$]),typeof Q.transformFunction==="function")J[$]=J[$].map(Q.transformFunction)}}}function bZ(J){let Z=/([^\\/]+)$/.exec(J);return Z?Z[1]:""}function lJ(J){return J.split(".").map((Z,$)=>{return $===0?CZ(Z):Z}).join(".")}class YJ extends Error{exitCode=2;isUsageError=!0;constructor(J){super(J);if(this.name=this.constructor.name,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error(J).stack}format(J=!1){if(J&&this.stack)return`${this.message}
|
|
3
|
+
|
|
4
|
+
Stack trace:
|
|
5
|
+
${this.stack}`;return this.message}}function vZ(){let{env:J}=kJ,{TERM:Z,TERM_PROGRAM:$}=J;if(kJ.platform!=="win32")return Z!=="linux";return Boolean(J.WT_SESSION)||Boolean(J.TERMINUS_SUBLIME)||J.ConEmuTask==="{cmd::Cmder}"||$==="Terminus-Sublime"||$==="vscode"||Z==="xterm-256color"||Z==="alacritty"||Z==="rxvt-unicode"||Z==="rxvt-unicode-256color"||J.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var UJ="\x1B",T=`${UJ}[`,F$="\x07",C={to(J,Z){if(!Z)return`${T}${J+1}G`;return`${T}${Z+1};${J+1}H`},move(J,Z){let $="";if(J<0)$+=`${T}${-J}D`;else if(J>0)$+=`${T}${J}C`;if(Z<0)$+=`${T}${-Z}A`;else if(Z>0)$+=`${T}${Z}B`;return $},up:(J=1)=>`${T}${J}A`,down:(J=1)=>`${T}${J}B`,forward:(J=1)=>`${T}${J}C`,backward:(J=1)=>`${T}${J}D`,nextLine:(J=1)=>`${T}E`.repeat(J),prevLine:(J=1)=>`${T}F`.repeat(J),left:`${T}G`,hide:`${T}?25l`,show:`${T}?25h`,save:`${UJ}7`,restore:`${UJ}8`},j$={up:(J=1)=>`${T}S`.repeat(J),down:(J=1)=>`${T}T`.repeat(J)},JJ={screen:`${T}2J`,up:(J=1)=>`${T}1J`.repeat(J),down:(J=1)=>`${T}J`.repeat(J),line:`${T}2K`,lineEnd:`${T}K`,lineStart:`${T}1K`,lines(J){let Z="";for(let $=0;$<J;$++)Z+=this.line+($<J-1?C.up():"");if(J)Z+=C.left;return Z}},G$={screen:`${UJ}c`};function SZ(J,Z){let $=[];for(let Q=0;Q<=Z.length;Q++)$[Q]=[Q];for(let Q=0;Q<=J.length;Q++)$[0][Q]=Q;for(let Q=1;Q<=Z.length;Q++)for(let Y=1;Y<=J.length;Y++)if(Z.charAt(Q-1)===J.charAt(Y-1))$[Q][Y]=$[Q-1][Y-1];else $[Q][Y]=Math.min($[Q-1][Y-1]+1,$[Q][Y-1]+1,$[Q-1][Y]+1);return $[Z.length][J.length]}function rJ(J,Z,$=2,Q=3){return Z.map((Y)=>({cmd:Y,distance:SZ(J,Y)})).filter(({distance:Y})=>Y<=$).sort((Y,q)=>Y.distance-q.distance).slice(0,Q).map(({cmd:Y})=>Y)}class aJ{rawName;description;name;names;isBoolean;required;config;negated;constructor(J,Z,$){if(this.rawName=J,this.description=Z,this.config=Object.assign({},$),J=J.replace(/\.\*/g,""),this.negated=!1,this.names=LJ(J).split(",").map((Q)=>{let Y=Q.trim().replace(/^-{1,2}/,"");if(Y.startsWith("no-"))this.negated=!0,Y=Y.replace(/^no-/,"");return lJ(Y)}).sort((Q,Y)=>Q.length>Y.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if(J.includes("<"))this.required=!0;else if(J.includes("["))this.required=!1;else this.isBoolean=!0}}var K$=MJ.argv,yZ=`${MJ.platform}-${MJ.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,bJ=qJ.argv,gZ=`${qJ.platform}-${qJ.arch} node-${qJ.version}`;class BJ{rawName;description;config;cli;options;aliasNames;name;namespace;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;beforeHooks;afterHooks;middleware;constructor(J,Z,$,Q){this.rawName=J,this.description=Z,this.config=$,this.cli=Q,this.options=[],this.aliasNames=[],this.name=LJ(J);let Y=LJ(J),q=Y.indexOf(":");if(q>0)this.namespace=Y.substring(0,q),this.name=Y.substring(q+1);if(this.args=RZ(J),this.examples=[],this.beforeHooks=[],this.afterHooks=[],this.middleware=[],!$)this.config={}}usage(J){return this.usageText=J,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(J,Z="-v, --version"){return this.versionNumber=J,this.option(Z,"Display version number"),this}example(J){return this.examples.push(J),this}option(J,Z,$){let Q=new aJ(J,Z,$);return this.options.push(Q),this}alias(J){return this.aliasNames.push(J),this}action(J){return this.commandAction=J,this}before(J){return this.beforeHooks.push(J),this}after(J){return this.afterHooks.push(J),this}use(J){return this.middleware.push(J),this}isMatched(J){return this.name===J||this.aliasNames.includes(J)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof EJ}hasOption(J){return J=J.split(".")[0],!!this.options.find((Z)=>{return Z.names.includes(J)})}outputHelp(){let{name:J,commands:Z}=this.cli,{versionNumber:$,options:Q,helpCallback:Y}=this.cli.globalCommand,q=[{body:`${J}${$?`/${$}`:""}`}];if(q.push({title:"Usage",body:` $ ${J} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&Z.length>0){let X=hJ(Z.map((K)=>K.rawName)),j=new Map,G=[];for(let K of Z)if(K.namespace){if(!j.has(K.namespace))j.set(K.namespace,[]);j.get(K.namespace).push(K)}else G.push(K);let V="";if(G.length>0)V+=G.map((K)=>{return` ${VJ(K.rawName,X.length)} ${K.description}`}).join(`
|
|
6
|
+
`);let W=Array.from(j.keys()).sort();for(let K of W){let L=j.get(K);if(V.length>0)V+=`
|
|
7
|
+
|
|
8
|
+
`;V+=` ${K}:
|
|
9
|
+
`,V+=L.map((P)=>{return` ${VJ(P.rawName,X.length-2)} ${P.description}`}).join(`
|
|
10
|
+
`)}q.push({title:"Commands",body:V}),q.push({title:"For more info, run any command with the `--help` flag",body:Z.map((K)=>` $ ${J}${K.name===""?"":` ${K.name}`} --help`).join(`
|
|
11
|
+
`)})}let F=this.isGlobalCommand?Q:[...this.options,...Q||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand)F=F.filter((X)=>X.name!=="version");if(F.length>0){let X=hJ(F.map((j)=>j.rawName));q.push({title:"Options",body:F.map((j)=>{return` ${VJ(j.rawName,X.length)} ${j.description} ${j.config.default===void 0?"":`(default: ${j.config.default})`}`}).join(`
|
|
12
|
+
`)})}if(this.examples.length>0)q.push({title:"Examples",body:this.examples.map((X)=>{if(typeof X==="function")return X(J);return X}).join(`
|
|
13
|
+
`)});if(Y)q=Y(q)||q;console.log(q.map((X)=>{return X.title?`${X.title}:
|
|
14
|
+
${X.body}`:X.body}).join(`
|
|
15
|
+
|
|
16
|
+
`))}outputVersion(){let{name:J}=this.cli,{versionNumber:Z}=this.cli.globalCommand;if(Z)console.log(`${J}/${Z} ${typeof Bun<"u"?yZ:gZ}`)}checkRequiredArgs(){let J=this.args.filter((Z)=>Z.required).length;if(this.cli.args.length<J){let $=this.args.filter((Y)=>Y.required).slice(this.cli.args.length),Q=$.map((Y)=>`<${Y.value}>`).join(" ");throw new YJ(`Missing required argument${$.length>1?"s":""}: ${Q}
|
|
17
|
+
|
|
18
|
+
Run \`${this.cli.name} ${this.rawName} --help\` for usage information.`)}}checkUnknownOptions(){let{options:J,globalCommand:Z}=this.cli;if(!this.config.allowUnknownOptions){for(let $ of Object.keys(J))if($!=="--"&&!this.hasOption($)&&!Z.hasOption($)){let Y=[...Z.options,...this.options].flatMap((X)=>X.names),q=$.length>1?`--${$}`:`-${$}`,U=rJ($,Y),F=`Unknown option \`${q}\``;if(U.length>0)F+=`
|
|
19
|
+
|
|
20
|
+
Did you mean one of these?`,U.forEach((X)=>{let j=X.length>1?`--${X}`:`-${X}`;F+=`
|
|
21
|
+
\u2022 ${j}`});throw F+=`
|
|
22
|
+
|
|
23
|
+
Run \`${this.cli.name} ${this.rawName} --help\` to see available options.`,new YJ(F)}}}checkOptionValue(){let{options:J,globalCommand:Z}=this.cli,$=[...Z.options,...this.options];for(let Q of $){let Y=J[Q.name.split(".")[0]];if(Q.required){let q=$.some((U)=>U.negated&&U.names.includes(Q.name));if(Y===!0||Y===!1&&!q)throw new YJ(`Option \`${Q.rawName}\` requires a value.
|
|
24
|
+
|
|
25
|
+
Example: ${this.cli.name} ${this.rawName} ${Q.rawName} <value>`)}}}}class EJ extends BJ{constructor(J){super("@@global@@","",{},J)}}var _Z=BJ,d={red:["\x1B[31m","\x1B[39m"],green:["\x1B[32m","\x1B[39m"],blue:["\x1B[34m","\x1B[39m"],yellow:["\x1B[33m","\x1B[39m"],cyan:["\x1B[36m","\x1B[39m"],magenta:["\x1B[35m","\x1B[39m"],white:["\x1B[37m","\x1B[39m"],gray:["\x1B[90m","\x1B[39m"],bgRed:["\x1B[41m","\x1B[49m"],bgGreen:["\x1B[42m","\x1B[49m"],bgBlue:["\x1B[44m","\x1B[49m"],bgYellow:["\x1B[43m","\x1B[49m"],bgCyan:["\x1B[46m","\x1B[49m"],bgMagenta:["\x1B[45m","\x1B[49m"],bold:["\x1B[1m","\x1B[22m"],italic:["\x1B[3m","\x1B[23m"],underline:["\x1B[4m","\x1B[24m"],dim:["\x1B[2m","\x1B[22m"],inverse:["\x1B[7m","\x1B[27m"],hidden:["\x1B[8m","\x1B[28m"],strikethrough:["\x1B[9m","\x1B[29m"]},PJ={default:{primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"},dracula:{primary:"magenta",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"blue",muted:"gray"},nord:{primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"cyan",muted:"gray"},solarized:{primary:"cyan",secondary:"blue",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"},monokai:{primary:"magenta",secondary:"blue",success:"green",warning:"yellow",error:"red",info:"cyan",muted:"gray"}},a={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function fZ(){return!0}function mZ(){let J={};J.supportsColor=fZ();function Z(Q,Y=[]){let q=Q===""?[]:[...Y,Q],U=function(X){if(!J.supportsColor)return X;let j="",G="";for(let V of q)if(V in a&&a[V]in d){let W=a[V];j+=d[W][0],G=d[W][1]+G}else if(V in d)j+=d[V][0],G=d[V][1]+G;return j+X+G},F=[...Object.keys(d),...Object.keys(a)];for(let X of F)if(!(X in U))Object.defineProperty(U,X,{get(){return Z(X,q)}});return U}let $=[...Object.keys(d),...Object.keys(a)];for(let Q of $)if(!(Q in J))Object.defineProperty(J,Q,{get(){return Z(Q)}});return J}var i=mZ();function dZ(J){for(let Z in J)if(J[Z]!==void 0)a[Z]=J[Z]}function W$(J){if(J in PJ)dZ(PJ[J])}function D$(){return Object.keys(PJ)}function L$(J){if(J.colors!==void 0)i.supportsColor=J.colors}function M$(J,Z){let $=Z?.title?` ${Z.title} `:"",Q=Z?.padding||0,Y=" ".repeat(Q),q=J.split(`
|
|
26
|
+
`),F=Math.max(...q.map((j)=>j.length))+Q*2,X=F;console.log(`\u250C${$?"\u2500".repeat(Math.floor((X-$.length)/2))+$+"\u2500".repeat(Math.ceil((X-$.length)/2)):"\u2500".repeat(X)}\u2510`),console.log(`\u2502${" ".repeat(X)}\u2502`);for(let j of q){let G=F-j.length-Q;console.log(`\u2502${Y}${j}${" ".repeat(G)}\u2502`)}console.log(`\u2502${" ".repeat(X)}\u2502`),console.log(`\u2514${"\u2500".repeat(X)}\u2518`)}function P$(J){let Z=J?.title?` ${J.title} `:"",Q=J.content.split(`
|
|
27
|
+
`),q=Math.max(...Q.map((U)=>U.length))+2;console.log(`\u2554${Z?"\u2550".repeat(Math.floor((q-Z.length)/2))+Z+"\u2550".repeat(Math.ceil((q-Z.length)/2)):"\u2550".repeat(q)}\u2557`),console.log(`\u2551${" ".repeat(q)}\u2551`);for(let U of Q){let F=q-U.length-1;console.log(`\u2551 ${U}${" ".repeat(F)}\u2551`)}console.log(`\u2551${" ".repeat(q)}\u2551`),console.log(`\u255A${"\u2550".repeat(q)}\u255D`)}function N$(J,Z){if(!J||J.length===0)return;let $=Array.from({length:J[0].length},()=>0);for(let Y of J)for(let q=0;q<Y.length;q++)$[q]=Math.max($[q],String(Y[q]).length);if(Z?.border)console.log(`\u250C${$.map((Y)=>"\u2500".repeat(Y+2)).join("\u252C")}\u2510`);if(Z?.header&&J.length>0)if(console.log((Z.border?"\u2502 ":"")+J[0].map((Y,q)=>`${Y}${" ".repeat($[q]-String(Y).length)}`).join(" \u2502 ")+(Z.border?" \u2502":"")),Z.border)console.log(`\u251C${$.map((Y)=>"\u2500".repeat(Y+2)).join("\u253C")}\u2524`);else console.log(`${$.map((Y)=>"\u2500".repeat(Y)).join("\u2500\u253C\u2500")}`);let Q=Z?.header?1:0;for(let Y=Q;Y<J.length;Y++)console.log((Z?.border?"\u2502 ":"")+J[Y].map((q,U)=>`${q}${" ".repeat($[U]-String(q).length)}`).join(" \u2502 ")+(Z?.border?" \u2502":""));if(Z?.border)console.log(`\u2514${$.map((Y)=>"\u2500".repeat(Y+2)).join("\u2534")}\u2518`)}class sJ extends IZ{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;enableDidYouMean=!0;signalHandlersSet=!1;isVerbose=!1;isQuiet=!1;isDebug=!1;isNoInteraction=!1;environment;isDryRun=!1;isForce=!1;useEmoji=!0;theme;isNoCache=!1;constructor(J=""){super();this.name=J,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new EJ(this),this.globalCommand.usage("<command> [options]")}handleSignals(J){if(this.signalHandlersSet)return this;let Z=async($)=>{if(console.log(`
|
|
28
|
+
|
|
29
|
+
Received ${$}, cleaning up...`),J)try{await J()}catch(Q){console.error("Error during cleanup:",Q)}m.exit(0)};return m.on("SIGINT",()=>Z("SIGINT")),m.on("SIGTERM",()=>Z("SIGTERM")),this.signalHandlersSet=!0,this}didYouMean(J=!0){return this.enableDidYouMean=J,this}verbose(){return this.globalCommand.option("-v, --verbose","Enable verbose output"),this}quiet(){return this.globalCommand.option("-q, --quiet","Suppress non-essential output"),this}debug(){return this.globalCommand.option("--debug","Enable debug mode with detailed error information"),this}noInteraction(){return this.globalCommand.option("-n, --no-interaction","Do not ask any interactive questions (for CI/CD)"),this}env(){return this.globalCommand.option("--env <environment>","Target environment (e.g., production, staging, local)"),this}dryRun(){return this.globalCommand.option("--dry-run","Preview actions without executing them"),this}force(){return this.globalCommand.option("-f, --force","Skip confirmation prompts"),this}emoji(){return this.globalCommand.option("--no-emoji","Disable emoji in output"),this}themes(){return this.globalCommand.option("--theme <theme>","Color theme (default, dracula, nord, solarized, monokai)"),this}cache(){return this.globalCommand.option("--no-cache","Disable caching"),this}usage(J){return this.globalCommand.usage(J),this}command(J,Z,$){if(!$)$={};let Q=new _Z(J,Z||"",$,this);return Q.globalCommand=this.globalCommand,this.commands.push(Q),Q}option(J,Z,$){return this.globalCommand.option(J,Z,$),this}help(J){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=J,this.showHelpOnExit=!0,this}version(J,Z="-v, --version"){return this.globalCommand.version(J,Z),this.showVersionOnExit=!0,this}example(J){return this.globalCommand.example(J),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:J,options:Z},$,Q){if(this.args=J,this.options=Z,$)this.matchedCommand=$;if(Q)this.matchedCommandName=Q;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}showCommandNotFound(J){if(console.log(i.red(`
|
|
30
|
+
\u2717 Command "${J}" not found.
|
|
31
|
+
`)),this.enableDidYouMean){let Z=[];for(let Q of this.commands){if(Q.name)Z.push(Q.name);if(Q.aliasNames)Z.push(...Q.aliasNames)}let $=rJ(J,Z);if($.length>0)console.log(i.yellow("Did you mean one of these?")),$.forEach((Q)=>console.log(` ${i.dim("\u2022")} ${this.name} ${Q}`)),console.log("")}console.log(i.dim("Run"),`${this.name} --help`,i.dim("to see all available commands")),m.exit(1)}async parse(J=bJ,Z={}){let{run:$=!0,exitOnError:Q=!1}=Z;if(Q)try{return await this.parse(J,{run:$})}catch(X){throw this.handleUsageError(X),X}if(this.rawArgs=J,!this.name)this.name=J[1]?bZ(J[1]):"cli";let Y=!0,q=J.slice(2),U=q[0];if(U&&!U.startsWith("-")){for(let X of this.commands)if(X.isMatched(U)){let j=this.mri(q,X);Y=!1;let G={...j,args:j.args.slice(1)};this.setParsedInfo(G,X,U),this.emit(`command:${U}`,X);break}}if(Y){for(let X of this.commands)if(X.name===""){Y=!1;let j=this.mri(q,X);this.setParsedInfo(j,X),this.emit("command:!",X);break}}if(Y){let X=this.mri(J.slice(2));this.setParsedInfo(X)}if(this.options.verbose)this.isVerbose=!0;if(this.options.quiet)this.isQuiet=!0;if(this.options.debug)this.isDebug=!0;if(this.options.noInteraction)this.isNoInteraction=!0;if(this.options.env)this.environment=String(this.options.env);if(this.options.dryRun)this.isDryRun=!0;if(this.options.force)this.isForce=!0;if(this.options.noEmoji!==void 0)this.useEmoji=!this.options.noEmoji;if(this.options.theme)this.theme=String(this.options.theme);if(this.options.noCache!==void 0)this.isNoCache=Boolean(this.options.noCache);if(this.options.help&&this.showHelpOnExit)this.outputHelp(),$=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),$=!1,this.unsetMatchedCommand();let F={args:this.args,options:this.options};if($)await this.runMatchedCommand();if(!this.matchedCommand&&this.args[0]){if(this.emit("command:*"),!(this.listenerCount("command:*")>0))this.showCommandNotFound(this.args[0])}return F}mri(J,Z){let $=[...this.globalCommand.options,...Z?Z.options:[]],Q=xZ($),Y=[],q=J.indexOf("--");if(q>-1)Y=J.slice(q+1),J=J.slice(0,q);let U=AZ(J,Q),F={_:U._};for(let W of Object.keys(U))if(W!=="_")F[lJ(W)]=U[W];let X=F._,j={"--":Y},G=Z&&Z.config.ignoreOptionDefaultValue?Z.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,V=Object.create(null);for(let W of $){if(!G&&W.config.default!==void 0)for(let K of W.names)j[K]=W.config.default;if(Array.isArray(W.config.type)){if(V[W.name]===void 0)V[W.name]={shouldTransform:!0,transformFunction:W.config.type[0]}}}for(let W of Object.keys(F))if(W!=="_"){let K=W.split(".");kZ(j,K,F[W]),hZ(j,V)}return{args:X,options:j}}async run(J=bJ){return this.parse(J,{run:!0,exitOnError:!0})}handleUsageError(J){if(!(!!J&&typeof J==="object"&&J.name==="ClappError"&&J.isUsageError!==!1))return;let Q=J,Y=Q.message??"command-line error",q=this.name?`${this.name}: `:"",U=/--help/.test(Y)?"":`
|
|
32
|
+
Run \`${this.name??"cli"} --help\` for usage.`;m.stderr.write(`${q}${Y}${U}
|
|
33
|
+
`),m.exit(Q.exitCode??2)}async runMatchedCommand(){let{args:J,options:Z,matchedCommand:$}=this;if(!$||!$.commandAction)return;$.checkUnknownOptions(),$.checkOptionValue(),$.checkRequiredArgs();let Q=[];$.args.forEach((F,X)=>{if(F.variadic)Q.push(J.slice(X));else Q.push(J[X])}),Q.push(Z);let Y={command:$,args:Q,options:Z};for(let F of $.beforeHooks)await F(Y);let q,U=async()=>{let F=$.commandAction.apply(this,Q);if(F instanceof Promise)q=await F;else q=F;return q};if($.middleware.length>0){let F=0,X=async()=>{if(F<$.middleware.length){let j=$.middleware[F++];await j({...Y,next:X})}else await U()};await X()}else await U();for(let F of $.afterHooks)await F(Y);return q}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return m.removeAllListeners("SIGINT"),m.removeAllListeners("SIGTERM"),this.signalHandlersSet=!1,this}destroy(){this.removeSignalHandlers(),this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.matchedCommand=void 0,this.matchedCommandName=void 0,this.removeAllListeners()}}var tJ=(J="")=>new sJ(J);class oJ{cache;enabled;cleanupInterval=null;hits=0;misses=0;constructor(){this.cache=new Map,this.enabled=!0,this.startCleanupInterval()}startCleanupInterval(){if(this.cleanupInterval)return;this.cleanupInterval=setInterval(()=>{this.cleanup()},30000),this.cleanupInterval.unref()}stopCleanup(){if(this.cleanupInterval)clearInterval(this.cleanupInterval),this.cleanupInterval=null}isEnabled(){return this.enabled}get(J){if(!this.enabled){this.misses++;return}let Z=this.cache.get(J);if(!Z){this.misses++;return}if(Date.now()-Z.timestamp>Z.ttl){this.cache.delete(J),this.misses++;return}return this.hits++,Z.value}set(J,Z,$=5000){if(!this.enabled)return;this.cache.set(J,{value:Z,timestamp:Date.now(),ttl:$})}has(J){if(!this.enabled)return!1;let Z=this.cache.get(J);if(!Z)return!1;if(Date.now()-Z.timestamp>Z.ttl)return this.cache.delete(J),!1;return!0}delete(J){this.cache.delete(J)}clear(){this.cache.clear()}disable(){this.enabled=!1,this.clear()}enable(){this.enabled=!0}stats(){return{size:this.cache.size,enabled:this.enabled,hits:this.hits,misses:this.misses}}resetStats(){this.hits=0,this.misses=0}keys(){return Array.from(this.cache.keys())}cleanup(){let J=Date.now();for(let[Z,$]of this.cache.entries())if(J-$.timestamp>$.ttl)this.cache.delete(Z)}destroy(){this.stopCleanup(),this.clear(),this.resetStats()}}var w$=new oJ;function T$(J,Z){J.on(`${Z}:*`,()=>{let $=J.args??[];vJ.stderr.write(`Unknown ${Z} subcommand: ${[...$].join(" ")}
|
|
34
|
+
Run \`${J.name??"cli"} ${Z} --help\` to see available subcommands.
|
|
35
|
+
`),vJ.exit(64)})}function uZ(){if("FORCE_COLOR"in o.env)return o.env.FORCE_COLOR!=="0";if("NO_COLOR"in o.env||o.env.TERM==="dumb")return!1;if(o.platform==="win32")return!0;return SJ.isatty(1)&&SJ.isatty(2)}var eJ=uZ();function B(J,Z){if(!eJ)return($)=>$;return($)=>J+$+Z}var cZ=B("\x1B[0m","\x1B[0m"),pZ=B("\x1B[31m","\x1B[39m"),JZ=B("\x1B[32m","\x1B[39m"),iZ=B("\x1B[33m","\x1B[39m"),nZ=B("\x1B[34m","\x1B[39m"),lZ=B("\x1B[35m","\x1B[39m"),rZ=B("\x1B[36m","\x1B[39m"),aZ=B("\x1B[37m","\x1B[39m"),ZZ=B("\x1B[90m","\x1B[39m"),$Z=B("\x1B[1m","\x1B[22m"),sZ=B("\x1B[3m","\x1B[23m"),tZ=B("\x1B[4m","\x1B[24m"),QZ=B("\x1B[2m","\x1B[22m"),oZ=B("\x1B[7m","\x1B[27m"),eZ=B("\x1B[8m","\x1B[28m"),J0=B("\x1B[9m","\x1B[29m"),Z0=B("\x1B[41m","\x1B[49m"),$0=B("\x1B[42m","\x1B[49m"),Q0=B("\x1B[43m","\x1B[49m"),z0=B("\x1B[44m","\x1B[49m"),Y0=B("\x1B[45m","\x1B[49m"),q0=B("\x1B[46m","\x1B[49m"),X0=B("\x1B[47m","\x1B[49m"),U0=eJ,F0={reset:cZ,red:pZ,green:JZ,yellow:iZ,blue:nZ,magenta:lZ,cyan:rZ,white:aZ,gray:ZZ,bold:$Z,italic:sZ,underline:tZ,dim:QZ,inverse:oZ,hidden:eZ,strikethrough:J0,bgRed:Z0,bgGreen:$0,bgYellow:Q0,bgBlue:z0,bgMagenta:Y0,bgCyan:q0,bgWhite:X0,isColorSupported:U0},z=F0,K0=["up","down","left","right","space","enter","cancel"],v={actions:new Set(K0),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};function R$(J){if(J.aliases!==void 0){let Z=J.aliases;for(let $ in Z){if(!Object.hasOwn(Z,$))continue;let Q=Z[$];if(!v.actions.has(Q))continue;if(!v.aliases.has($))v.aliases.set($,Q)}}if(J.messages!==void 0){let Z=J.messages;if(Z.cancel!==void 0)v.messages.cancel=Z.cancel;if(Z.error!==void 0)v.messages.error=Z.error}}function IJ(J,Z){if(typeof J==="string")return v.aliases.get(J)===Z;for(let $ of J){if($===void 0)continue;if(IJ($,Z))return!0}return!1}function V0(J,Z){if(J===Z)return[];let $=J.split(`
|
|
36
|
+
`),Q=Z.split(`
|
|
37
|
+
`),Y=[];for(let q=0;q<Math.max($.length,Q.length);q++)if($[q]!==Q[q])Y.push(q);return Y}var W0=zZ.platform.startsWith("win"),NJ=Symbol("clapp:cancel");function D0(J){return J===NJ}function zJ(J,Z){let $=J;if($.isTTY)$.setRawMode(Z)}function L0(J){let{input:Z=j0,output:$=G0,overwrite:Q=!0,hideCursor:Y=!0}=J||{},q=c.createInterface({input:Z,output:$,prompt:"",tabSize:1});if(c.emitKeypressEvents(Z,q),Z instanceof yJ&&Z.isTTY)Z.setRawMode(!0);let U=(F,{name:X,sequence:j})=>{let G=String(F);if(IJ([G,X,j],"cancel")){if(Y)$.write(C.show);zZ.exit(0);return}if(!Q)return;c.moveCursor($,X==="return"?0:-1,X==="return"?-1:0,()=>{c.clearLine($,1,()=>{Z.once("keypress",U)})})};if(Y)$.write(C.hide);return Z.once("keypress",U),()=>{if(Z.off("keypress",U),Y)$.write(C.show);if(Z instanceof yJ&&Z.isTTY&&!W0)Z.setRawMode(!1);q.terminal=!1,q.close()}}function M0(J){if(J instanceof H0&&J.columns)return J.columns;return 80}function O0(J){return J.replace(/\x1b\[[0-9;]*m/g,"")}function T0(J){return O0(J).length}function _J(J,Z,$){if(!Z||Z<1)return J;let Q=$?.hard??!1,Y=$?.trim??!0,q=J.split(`
|
|
38
|
+
`),U=[];for(let F of q){if(T0(F)<=Z){U.push(Y?F.trimEnd():F);continue}if(Q){let X="",j=0,G=0;while(G<F.length){let V=F.slice(G).match(/^\x1b\[[0-9;]*m/);if(V){X+=V[0],G+=V[0].length;continue}if(j>=Z)U.push(Y?X.trimEnd():X),X="",j=0;X+=F[G],j++,G++}if(X)U.push(Y?X.trimEnd():X)}else U.push(Y?F.trimEnd():F)}return U.join(`
|
|
39
|
+
`)}class _{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;_manualLine="";state="initial";error="";value;userInput="";constructor(J,Z=!0){let{input:$=P0,output:Q=N0,render:Y,signal:q,...U}=J;this.opts=U,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=Z,this._abortSignal=q,this.input=$,this.output=Q}unsubscribe(){this._subscribers.clear()}setSubscriber(J,Z){let $=this._subscribers.get(J)??[];$.push(Z),this._subscribers.set(J,$)}on(J,Z){return this.setSubscriber(J,{cb:Z}),this}once(J,Z){return this.setSubscriber(J,{cb:Z,once:!0}),this}emit(J,...Z){let $=this._subscribers.get(J)??[],Q=[];for(let Y of $)if(Y.cb(...Z),Y.once)Q.push(()=>$.splice($.indexOf(Y),1));for(let Y of Q)Y();return this}prompt(){return new Promise((J)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),J(NJ);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}if(this.rl=w0.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0)this._setUserInput(this.opts.initialUserInput,!0);this.input.on("keypress",this.onKeypress),zJ(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(C.show),this.output.off("resize",this.render),zJ(this.input,!1),J(this.value)}),this.once("cancel",()=>{this.output.write(C.show),this.output.off("resize",this.render),zJ(this.input,!1),J(NJ)})})}_isActionKey(J,Z){return J==="\t"}_setValue(J){this.value=J,this.emit("value",this.value)}_setUserInput(J,Z){if(this.userInput=J??"",this.emit("userInput",this.userInput),Z&&this._track&&this.rl)this.rl.write(this.userInput),this._cursor=this.rl.cursor}onKeypress(J,Z){if(this._track&&Z.name!=="return"){if(Z.name&&this._isActionKey(J,Z))this.rl?.write(null,{ctrl:!0,name:"h"});this._cursor=this.rl?.cursor??0;let $=Z.name==="tab"||Z.name==="escape"||Z.name==="backspace"||Z.name==="delete"||Z.name==="enter"||Z.name==="return"||Z.name&&["up","down","left","right"].includes(Z.name);if(J&&!$&&J.length===1&&J>=" ")this._manualLine+=J;else if(Z.name==="backspace"&&this._manualLine.length>0)this._manualLine=this._manualLine.slice(0,-1);let Q=this._manualLine.length>=(this.rl?.line?.length||0)?this._manualLine:this.rl?.line;this._setUserInput(Q)}if(this.state==="error")this.state="active",this.error="";if(Z?.name){if(!this._track&&v.aliases.has(Z.name))this.emit("cursor",v.aliases.get(Z.name));if(v.actions.has(Z.name))this.emit("cursor",Z.name)}if(J&&(J.toLowerCase()==="y"||J.toLowerCase()==="n"))this.emit("confirm",J.toLowerCase()==="y");if(this.emit("key",J?.toLowerCase(),Z),Z?.name==="return"){if(this.opts.validate){let $=this.opts.validate(this.value);if($)this.error=$ instanceof Error?$.message:$,this.state="error"}if(this.state!=="error")this.state="submit"}if(IJ([J,Z?.name,Z?.sequence],"cancel"))this.state="cancel";if(this.state==="submit"||this.state==="cancel")this.emit("finalize");if(this.render(),this.state==="submit"||this.state==="cancel")this.close()}close(){if(this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
40
|
+
`),zJ(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.state==="cancel")setTimeout(()=>{this.unsubscribe()},10);else this.unsubscribe()}restoreCursor(){let J=_J(this._prevFrame,gJ.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
41
|
+
`).length-1;this.output.write(C.move(-999,J*-1))}render(){let J=_J(this._render(this)??"",gJ.stdout.columns,{hard:!0,trim:!1});if(J===this._prevFrame)return;if(this.state==="initial")this.output.write(C.hide);else{let Z=V0(this._prevFrame,J);if(this.restoreCursor(),Z&&Z?.length===1){let $=Z[0];this.output.write(C.move(0,$)),this.output.write(JJ.lines(1));let Q=J.split(`
|
|
42
|
+
`);this.output.write(Q[$]),this._prevFrame=J,this.output.write(C.move(0,Q.length-$-1));return}if(Z&&Z?.length>1){let $=Z[0];this.output.write(C.move(0,$)),this.output.write(JJ.down());let Y=J.split(`
|
|
43
|
+
`).slice($);this.output.write(Y.join(`
|
|
44
|
+
`)),this._prevFrame=J;return}this.output.write(JJ.down())}if(this.output.write(J),this.state==="initial")this.state="active";this._prevFrame=J}}function B0(J,Z){if(J===void 0)return 0;if(Z.length===0)return 0;let Q=Z.findIndex((Y)=>Y.value===J);return Q!==-1?Q:0}function E0(J,Z){return(Z.label??String(Z.value)).toLowerCase().includes(J.toLowerCase())}function I0(J,Z){if(!Z)return;if(J)return Z;return Z[0]}class AJ extends _{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#J=0;#$="";#Q;#Z;get cursor(){return this.#J}get userInputWithCursor(){if(!this.userInput)return z.inverse(z.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let J=this.userInput.slice(0,this._cursor),[Z,...$]=this.userInput.slice(this._cursor);return`${J}${z.inverse(Z)}${$.join("")}`}get options(){if(typeof this.#Z==="function")return this.#Z();return this.#Z}constructor(J){super(J);this.#Z=J.options;let Z=this.options;this.filteredOptions=[...Z],this.multiple=J.multiple===!0,this.#Q=J.filter??E0;let $;if(J.initialValue&&Array.isArray(J.initialValue))if(this.multiple)$=J.initialValue;else $=J.initialValue.slice(0,1);else if(!this.multiple&&this.options.length>0)$=[this.options[0].value];if($)for(let Q of $){let Y=Z.findIndex((q)=>q.value===Q);if(Y!==-1)this.toggleSelected(Q),this.#J=Y}this.focusedValue=this.options[this.#J]?.value,this.on("key",(Q,Y)=>this.#z(Q,Y)),this.on("userInput",(Q)=>this.#Y(Q))}_isActionKey(J,Z){return J==="\t"||this.multiple&&this.isNavigating&&Z.name==="space"&&J!==void 0&&J!==""}#z(J,Z){let $=Z.name==="up",Q=Z.name==="down",Y=Z.name==="return";if($||Q){if(this.#J=Math.max(0,Math.min(this.#J+($?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#J]?.value,!this.multiple)this.selectedValues=[this.focusedValue];this.isNavigating=!0}else if(Y)this.value=I0(this.multiple,this.selectedValues);else if(this.multiple)if(this.focusedValue!==void 0&&(Z.name==="tab"||this.isNavigating&&Z.name==="space"))this.toggleSelected(this.focusedValue);else this.isNavigating=!1;else{if(this.focusedValue)this.selectedValues=[this.focusedValue];this.isNavigating=!1}}deselectAll(){this.selectedValues=[]}toggleSelected(J){if(this.filteredOptions.length===0)return;if(this.multiple)if(this.selectedValues.includes(J))this.selectedValues=this.selectedValues.filter((Z)=>Z!==J);else this.selectedValues=[...this.selectedValues,J];else this.selectedValues=[J]}#Y(J){if(J!==this.#$){this.#$=J;let Z=this.options;if(J)this.filteredOptions=Z.filter(($)=>this.#Q(J,$));else this.filteredOptions=[...Z];if(this.#J=B0(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#J]?.value,!this.multiple)if(this.focusedValue!==void 0)this.toggleSelected(this.focusedValue);else this.deselectAll()}}}class YZ extends _{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(J){super(J,!1);this.value=!!J.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",(Z)=>{this.output.write(C.move(0,-1)),this.value=Z,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class qZ extends _{options;cursor=0;#J;getGroupItems(J){return this.options.filter((Z)=>Z.group===J)}isGroupSelected(J){let Z=this.getGroupItems(J),$=this.value;if($===void 0)return!1;return Z.every((Q)=>$.includes(Q.value))}toggleValue(){let J=this.options[this.cursor];if(this.value===void 0)this.value=[];if(J.group===!0){let Z=J.value,$=this.getGroupItems(Z);if(this.isGroupSelected(Z))this.value=this.value.filter((Q)=>$.findIndex((Y)=>Y.value===Q)===-1);else this.value=[...this.value,...$.map((Q)=>Q.value)];this.value=Array.from(new Set(this.value))}else{let Z=this.value.includes(J.value);this.value=Z?this.value.filter(($)=>$!==J.value):[...this.value,J.value]}}constructor(J){super(J,!1);let{options:Z}=J;this.#J=J.selectableGroups!==!1,this.options=Object.entries(Z).flatMap(([$,Q])=>[{value:$,group:!0,label:$},...Q.map((Y)=>({...Y,group:$}))]),this.value=[...J.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:$})=>$===J.cursorAt),this.#J?0:1),this.on("cursor",($)=>{switch($){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let Q=this.options[this.cursor]?.group===!0;if(!this.#J&&Q)this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let Q=this.options[this.cursor]?.group===!0;if(!this.#J&&Q)this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}case"space":this.toggleValue();break}})}}class XZ extends _{options;cursor=0;get _value(){return this.options[this.cursor].value}toggleAll(){let J=this.value!==void 0&&this.value.length===this.options.length;this.value=J?[]:this.options.map((Z)=>Z.value)}toggleValue(){if(this.value===void 0)this.value=[];let J=this.value.includes(this._value);this.value=J?this.value.filter((Z)=>Z!==this._value):[...this.value,this._value]}constructor(J){super(J,!1);this.options=J.options,this.value=[...J.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Z})=>Z===J.cursorAt),0),this.on("key",(Z)=>{if(Z==="a")this.toggleAll()}),this.on("cursor",(Z)=>{switch(Z){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}}class UZ extends _{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;let J=this.userInput;if(this.cursor>=J.length)return`${this.masked}${z.inverse(z.hidden("_"))}`;let Z=this.masked,$=Z.slice(0,this.cursor),Q=Z.slice(this.cursor);return`${$}${z.inverse(Q[0])}${Q.slice(1)}`}constructor({mask:J,...Z}){super(Z);this._mask=J??"\u2022",this.on("userInput",($)=>{this._setValue($)})}}class FZ extends _{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(J){super(J,!1);if(this.options=J.options,this.cursor=this.options.findIndex(({value:Z})=>Z===J.initialValue),this.cursor===-1)this.cursor=0;this.changeValue(),this.on("cursor",(Z)=>{switch(Z){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}}class jZ extends _{options;cursor=0;constructor(J){super(J,!1);this.options=J.options;let Z=this.options.map(({value:[$]})=>$?.toLowerCase());this.cursor=Math.max(Z.indexOf(J.initialValue),0),this.on("key",($)=>{if(!$||!Z.includes($))return;let Q=this.options.find(({value:[Y]})=>Y?.toLowerCase()===$);if(Q)this.value=Q.value,this.state="submit",this.emit("submit")})}}class GZ extends _{placeholder;get userInputWithCursor(){if(this.state==="submit")return this.userInput;let J=this.userInput;if(this.cursor>=J.length)return`${this.userInput}\u2588`;let Z=J.slice(0,this.cursor),[$,...Q]=J.slice(this.cursor);return`${Z}${z.inverse($)}${Q.join("")}`}get cursor(){return this._cursor}constructor(J){super({...J,initialUserInput:J.initialUserInput??J.initialValue});this.placeholder=J.placeholder,this.on("key",(Z)=>{if(Z==="\t"&&this.placeholder){if(!this.userInput||this.userInput==="\t")this._setValue(this.placeholder),this._setUserInput(this.placeholder,!0)}}),this.on("userInput",(Z)=>{this._setValue(Z)}),this.on("finalize",()=>{if(!this.userInput&&this.placeholder)this.value=this.placeholder;if(!this.value)this.value=J.defaultValue;if(this.value===void 0)this.value=""})}}var wJ=vZ(),HZ=()=>A0.env.CI==="true";function R0(J){return J.isTTY===!0}var O=(J,Z)=>wJ?J:Z,x0=O("\u25C6","*"),KZ=O("\u25A0","x"),VZ=O("\u25B2","x"),t=O("\u25C7","o"),C0=O("\u250C","T"),H=O("\u2502","|"),x=O("\u2514","\u2014"),FJ=O("\u25CF",">"),jJ=O("\u25CB"," "),OJ=O("\u25FB","[\u2022]"),s=O("\u25FC","[+]"),RJ=O("\u25FB","[ ]"),k0=O("\u25AA","\u2022"),fJ=O("\u2500","-"),h0=O("\u256E","+"),b0=O("\u251C","+"),v0=O("\u256F","+"),WZ=O("\u25CF","\u2022"),DZ=O("\u25C6","*"),LZ=O("\u25B2","!"),MZ=O("\u25A0","x");function f(J){switch(J){case"initial":case"active":return z.cyan(x0);case"cancel":return z.red(KZ);case"error":return z.yellow(VZ);case"submit":return z.green(t)}}function n(J){return J.replace(/_([^_]+)_/g,(Z,$)=>i.italic($))}function ZJ(J){let{cursor:Z,options:$,style:Q}=J,Y=J.output??S0.stdout,q=Y instanceof y0&&Y.rows!==void 0?Y.rows:10,U=z.dim("..."),F=J.maxItems??Number.POSITIVE_INFINITY,X=Math.max(q-4,0),j=Math.min(X,Math.max(F,5)),G=0;if(Z>=G+j-3)G=Math.max(Math.min(Z-j+3,$.length-j),0);else if(Z<G+2)G=Math.max(Z-2,0);let V=j<$.length&&G>0,W=j<$.length&&G+j<$.length;return $.slice(G,G+j).map((K,L,P)=>{let D=L===0&&V,M=L===P.length-1&&W;return D||M?U:Q(K,L+G===Z)})}function mJ(J){return J.label??String(J.value??"")}function PZ(J,Z){if(!J)return!0;let $=(Z.label??String(Z.value??"")).toLowerCase(),Q=(Z.hint??"").toLowerCase(),Y=String(Z.value).toLowerCase(),q=J.toLowerCase();return $.includes(q)||Q.includes(q)||Y.includes(q)}function g0(J,Z){let $=[];for(let Q of Z)if(J.includes(Q.value))$.push(Q);return $}function _0(J){return new AJ({options:J.options,initialValue:J.initialValue?[J.initialValue]:void 0,initialUserInput:J.initialUserInput,filter:($,Q)=>{return PZ($,Q)},signal:J.signal,input:J.input,output:J.output,validate:J.validate,render(){let $=`${z.gray(H)}
|
|
45
|
+
${f(this.state)} ${J.message}
|
|
46
|
+
`,Q=this.userInput,Y=String(this.value??""),q=this.options,U=J.placeholder,F=Y===""&&U!==void 0;switch(this.state){case"submit":{let X=g0(this.selectedValues,q),j=X.length>0?` ${z.dim(X.map(mJ).join(", "))}`:"";return`${$}${z.gray(H)}${j}`}case"cancel":{let X=Q?` ${z.strikethrough(z.dim(Q))}`:"";return`${$}${z.gray(H)}${X}`}default:{let X="";if(this.isNavigating||F){let L=F?U:Q;X=L!==""?` ${z.dim(L)}`:""}else X=` ${this.userInputWithCursor}`;let j=this.filteredOptions.length!==q.length?z.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"",G=this.filteredOptions.length===0?[]:ZJ({cursor:this.cursor,options:this.filteredOptions,style:(L,P)=>{let D=mJ(L),M=L.hint&&L.value===this.focusedValue?z.dim(` (${L.hint})`):"";return P?`${z.green(FJ)} ${D}${M}`:`${z.dim(jJ)} ${z.dim(D)}${M}`},maxItems:J.maxItems,output:J.output}),V=[`${z.dim("\u2191/\u2193")} to select`,`${z.dim("Enter:")} confirm`,`${z.dim("Type:")} to search`],W=this.filteredOptions.length===0&&Q?[`${z.cyan(H)} ${z.yellow("No matches found")}`]:[],K=this.state==="error"?[`${z.yellow(H)} ${z.yellow(this.error)}`]:[];return[`${$}${z.cyan(H)}`,`${z.cyan(H)} ${z.dim("Search:")}${X}${j}`,...W,...K,...G.map((L)=>`${z.cyan(H)} ${L}`),`${z.cyan(H)} ${z.dim(V.join(" \u2022 "))}`,`${z.cyan(x)}`].join(`
|
|
47
|
+
`)}}}}).prompt()}function v$(J){let Z=(Q,Y,q,U)=>{let F=q.includes(Q.value),X=Q.label??String(Q.value??""),j=Q.hint&&U!==void 0&&Q.value===U?z.dim(` (${Q.hint})`):"",G=F?z.green(s):z.dim(RJ);if(Y)return`${G} ${X}${j}`;return`${G} ${z.dim(X)}`},$=new AJ({options:J.options,multiple:!0,filter:(Q,Y)=>{return PZ(Q,Y)},validate:()=>{if(J.required&&$.selectedValues.length===0)return"Please select at least one item";return},initialValue:J.initialValues,signal:J.signal,input:J.input,output:J.output,render(){let Q=`${z.gray(H)}
|
|
48
|
+
${f(this.state)} ${J.message}
|
|
49
|
+
`,Y=this.userInput,q=J.placeholder,U=Y===""&&q!==void 0,F=this.isNavigating||U?z.dim(U?q:Y):this.userInputWithCursor,X=this.options,j=this.filteredOptions.length!==X.length?z.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${Q}${z.gray(H)} ${z.dim(`${this.selectedValues.length} items selected`)}`;case"cancel":return`${Q}${z.gray(H)} ${z.strikethrough(z.dim(Y))}`;default:{let G=[`${z.dim("\u2191/\u2193")} to navigate`,`${z.dim("Space:")} select`,`${z.dim("Enter:")} confirm`,`${z.dim("Type:")} to search`],V=this.filteredOptions.length===0&&Y?[`${z.cyan(H)} ${z.yellow("No matches found")}`]:[],W=this.state==="error"?[`${z.cyan(H)} ${z.yellow(this.error)}`]:[],K=ZJ({cursor:this.cursor,options:this.filteredOptions,style:(L,P)=>Z(L,P,this.selectedValues,this.focusedValue),maxItems:J.maxItems,output:J.output});return[Q,`${z.cyan(H)} ${z.dim("Search:")} ${F}${j}`,...V,...W,...K.map((L)=>`${z.cyan(H)} ${L}`),`${z.cyan(H)} ${z.dim(G.join(" \u2022 "))}`,`${z.cyan(x)}`].join(`
|
|
50
|
+
`)}}}});return $.prompt()}function S$(J){let Z=J.active??"Yes",$=J.inactive??"No",Q=n(J.message);return new YZ({active:Z,inactive:$,signal:J.signal,input:J.input,output:J.output,initialValue:J.initialValue??!0,render(){let Y=`${z.gray(H)}
|
|
51
|
+
${f(this.state)} ${Q}
|
|
52
|
+
`,q=this.value?Z:$;switch(this.state){case"submit":return`${Y}${z.gray(H)} ${z.dim(q)}`;case"cancel":return`${Y}${z.gray(H)} ${z.strikethrough(z.dim(q))}
|
|
53
|
+
${z.gray(H)}`;default:return`${Y}${z.cyan(H)} ${this.value?`${z.green(FJ)} ${Z}`:`${z.dim(jJ)} ${z.dim(Z)}`} ${z.dim("/")} ${!this.value?`${z.green(FJ)} ${$}`:`${z.dim(jJ)} ${z.dim($)}`}
|
|
54
|
+
${z.cyan(x)}
|
|
55
|
+
`}}}).prompt()}async function y$(J,Z){let $={},Q=Object.keys(J);for(let Y of Q){let q=J[Y],U=await q({results:$})?.catch((F)=>{throw F});if(typeof Z?.onCancel==="function"&&D0(U)){$[Y]="canceled",Z.onCancel({results:$});continue}$[Y]=U}return $}function g$(J){let{selectableGroups:Z=!0,groupSpacing:$=0}=J,Q=(q,U,F=[])=>{let X=q.label??String(q.value),j=typeof q.group==="string",G=j&&(F[F.indexOf(q)+1]??{group:!0}),V=j&&G.group===!0,W=j?Z?`${V?x:H} `:" ":"",K="";if($>0&&!j){let P=`
|
|
56
|
+
${z.cyan(H)}`;K=`${P.repeat($-1)}${P} `}if(U==="active")return`${K}${z.dim(W)}${z.cyan(OJ)} ${X}${q.hint?` ${z.dim(`(${q.hint})`)}`:""}`;if(U==="group-active")return`${K}${W}${z.cyan(OJ)} ${z.dim(X)}`;if(U==="group-active-selected")return`${K}${W}${z.green(s)} ${z.dim(X)}`;if(U==="selected"){let P=j||Z?z.green(s):"";return`${K}${z.dim(W)}${P} ${z.dim(X)}${q.hint?` ${z.dim(`(${q.hint})`)}`:""}`}if(U==="cancelled")return`${z.strikethrough(z.dim(X))}`;if(U==="active-selected")return`${K}${z.dim(W)}${z.green(s)} ${X}${q.hint?` ${z.dim(`(${q.hint})`)}`:""}`;if(U==="submitted")return`${z.dim(X)}`;let L=j||Z?z.dim(RJ):"";return`${K}${z.dim(W)}${L} ${z.dim(X)}`},Y=J.required??!0;return new qZ({options:J.options,signal:J.signal,input:J.input,output:J.output,initialValues:J.initialValues,required:Y,cursorAt:J.cursorAt,selectableGroups:Z,validate(q){if(Y&&(q===void 0||q.length===0))return`Please select at least one option.
|
|
57
|
+
${z.reset(z.dim(`Press ${z.gray(z.bgWhite(z.inverse(" space ")))} to select, ${z.gray(z.bgWhite(z.inverse(" enter ")))} to submit`))}`},render(){let q=`${z.gray(H)}
|
|
58
|
+
${f(this.state)} ${J.message}
|
|
59
|
+
`,U=this.value??[];switch(this.state){case"submit":{let F=this.options.filter(({value:j})=>U.includes(j)).map((j)=>Q(j,"submitted")),X=F.length===0?"":` ${F.join(z.dim(", "))}`;return`${q}${z.gray(H)}${X}`}case"cancel":{let F=this.options.filter(({value:X})=>U.includes(X)).map((X)=>Q(X,"cancelled")).join(z.dim(", "));return`${q}${z.gray(H)} ${F.trim()?`${F}
|
|
60
|
+
${z.gray(H)}`:""}`}case"error":{let F=this.error.split(`
|
|
61
|
+
`).map((X,j)=>j===0?`${z.yellow(x)} ${z.yellow(X)}`:` ${X}`).join(`
|
|
62
|
+
`);return`${q}${z.yellow(H)} ${this.options.map((X,j,G)=>{let V=U.includes(X.value)||X.group===!0&&this.isGroupSelected(`${X.value}`),W=j===this.cursor;if(!W&&typeof X.group==="string"&&this.options[this.cursor].value===X.group)return Q(X,V?"group-active-selected":"group-active",G);if(W&&V)return Q(X,"active-selected",G);if(V)return Q(X,"selected",G);return Q(X,W?"active":"inactive",G)}).join(`
|
|
63
|
+
${z.yellow(H)} `)}
|
|
64
|
+
${F}
|
|
65
|
+
`}default:{let F=this.options.map((j,G,V)=>{let W=U.includes(j.value)||j.group===!0&&this.isGroupSelected(`${j.value}`),K=G===this.cursor,L=!K&&typeof j.group==="string"&&this.options[this.cursor].value===j.group,P="";if(L)P=Q(j,W?"group-active-selected":"group-active",V);else if(K&&W)P=Q(j,"active-selected",V);else if(W)P=Q(j,"selected",V);else P=Q(j,K?"active":"inactive",V);return`${G!==0&&!P.startsWith(`
|
|
66
|
+
`)?" ":""}${P}`}).join(`
|
|
67
|
+
${z.cyan(H)}`),X=F.startsWith(`
|
|
68
|
+
`)?"":" ";return`${q}${z.cyan(H)}${X}${F}
|
|
69
|
+
${z.cyan(x)}
|
|
70
|
+
`}}}}).prompt()}function m0(J){if(Array.isArray(J))return J.map((Z)=>n(Z));return n(J)}var k={message:(J=[],{symbol:Z=z.gray(H),secondarySymbol:$=z.gray(H),output:Q=f0.stdout,spacing:Y=1}={})=>{let q=[];for(let X=0;X<Y;X++)q.push(`${$}`);let U=m0(J),F=Array.isArray(U)?U:U.split(`
|
|
71
|
+
`);if(F.length>0){let[X,...j]=F;if(X.length>0)q.push(`${Z} ${X}`);else q.push(Z);for(let G of j)if(G.length>0)q.push(`${$} ${G}`);else q.push($)}Q.write(`${q.join(`
|
|
72
|
+
`)}
|
|
73
|
+
`)},info:(J,Z)=>{k.message(J,{...Z,symbol:z.blue(WZ)})},success:(J,Z)=>{k.message(J,{...Z,symbol:z.green(DZ)})},step:(J,Z)=>{k.message(J,{...Z,symbol:z.green(t)})},warn:(J,Z)=>{k.message(J,{...Z,symbol:z.yellow(LZ)})},warning:(J,Z)=>{k.warn(J,Z)},error:(J,Z)=>{k.message(J,{...Z,symbol:z.red(MZ)})},custom:(J,Z,$,Q)=>{let Y=typeof $==="string"?(q)=>z[$]?.(q)||q:$;k.message(Z,{...Q,symbol:Y(J),secondarySymbol:Y(J)})}};function m$(J="",Z){(Z?.output??xJ.stdout).write(`${z.gray(x)} ${z.red(J)}
|
|
74
|
+
|
|
75
|
+
`)}function d$(J="",Z){(Z?.output??xJ.stdout).write(`${z.gray(C0)} ${J}
|
|
76
|
+
`)}function u$(J="",Z){(Z?.output??xJ.stdout).write(`${z.gray(H)}
|
|
77
|
+
${z.gray(x)} ${J}
|
|
78
|
+
|
|
79
|
+
`)}function c$(J){let Z=(Q,Y)=>{let q=Q.label??String(Q.value);if(Y==="active")return`${z.cyan(OJ)} ${q}${Q.hint?` ${z.dim(`(${Q.hint})`)}`:""}`;if(Y==="selected")return`${z.green(s)} ${z.dim(q)}${Q.hint?` ${z.dim(`(${Q.hint})`)}`:""}`;if(Y==="cancelled")return`${z.strikethrough(z.dim(q))}`;if(Y==="active-selected")return`${z.green(s)} ${q}${Q.hint?` ${z.dim(`(${Q.hint})`)}`:""}`;if(Y==="submitted")return`${z.dim(q)}`;return`${z.dim(RJ)} ${z.dim(q)}`},$=J.required??!0;return new XZ({options:J.options,input:J.input,output:J.output,initialValues:J.initialValues,required:$,cursorAt:J.cursorAt,validate(Q){if($&&(Q===void 0||Q.length===0))return`Please select at least one option.
|
|
80
|
+
${z.reset(z.dim(`Press ${z.gray(z.bgWhite(z.inverse(" space ")))} to select, ${z.gray(z.bgWhite(z.inverse(" enter ")))} to submit`))}`},render(){let Q=`${z.gray(H)}
|
|
81
|
+
${f(this.state)} ${J.message}
|
|
82
|
+
`,Y=this.value??[],q=(U,F)=>{let X=Y.includes(U.value);if(F&&X)return Z(U,"active-selected");if(X)return Z(U,"selected");return Z(U,F?"active":"inactive")};switch(this.state){case"submit":return`${Q}${z.gray(H)} ${this.options.filter(({value:U})=>Y.includes(U)).map((U)=>Z(U,"submitted")).join(z.dim(", "))||z.dim("none")}`;case"cancel":{let U=this.options.filter(({value:F})=>Y.includes(F)).map((F)=>Z(F,"cancelled")).join(z.dim(", "));return`${Q}${z.gray(H)}${U.trim()?` ${U}
|
|
83
|
+
${z.gray(H)}`:""}`}case"error":{let U=this.error.split(`
|
|
84
|
+
`).map((F,X)=>X===0?`${z.yellow(x)} ${z.yellow(F)}`:` ${F}`).join(`
|
|
85
|
+
`);return`${Q+z.yellow(H)} ${ZJ({output:J.output,options:this.options,cursor:this.cursor,maxItems:J.maxItems,style:q}).join(`
|
|
86
|
+
${z.yellow(H)} `)}
|
|
87
|
+
${U}
|
|
88
|
+
`}default:return`${Q}${z.cyan(H)} ${ZJ({output:J.output,options:this.options,cursor:this.cursor,maxItems:J.maxItems,style:q}).join(`
|
|
89
|
+
${z.cyan(H)} `)}
|
|
90
|
+
${z.cyan(x)}
|
|
91
|
+
`}}}).prompt()}var u0=(J)=>z.dim(J);function n$(J="",Z="",$){let Q=$?.format??u0,Y=n(J),q=n(Z),U=["",...Y.split(`
|
|
92
|
+
`).map(Q),""],F=WJ(q).length,X=$?.output??d0.stdout,j=Math.max(U.reduce((V,W)=>{let K=WJ(W);return K.length>V?K.length:V},0),F)+2,G=U.map((V)=>`${z.gray(H)} ${V}${" ".repeat(j-WJ(V).length)}${z.gray(H)}`).join(`
|
|
93
|
+
`);X.write(`${z.gray(H)}
|
|
94
|
+
${z.green(t)} ${z.reset(q)} ${z.gray(fJ.repeat(Math.max(j-F-1,1))+h0)}
|
|
95
|
+
${G}
|
|
96
|
+
${z.gray(b0+fJ.repeat(j+2)+v0)}
|
|
97
|
+
`)}function l$(J){return new UZ({validate:J.validate,mask:J.mask??k0,signal:J.signal,input:J.input,output:J.output,render(){let Z=`${z.gray(H)}
|
|
98
|
+
${f(this.state)} ${J.message}
|
|
99
|
+
`,$=this.userInputWithCursor,Q=this.masked;switch(this.state){case"error":{let Y=Q?` ${Q}`:"";return`${Z.trim()}
|
|
100
|
+
${z.yellow(H)}${Y}
|
|
101
|
+
${z.yellow(x)} ${z.yellow(this.error)}
|
|
102
|
+
`}case"submit":{let Y=Q?` ${z.dim(Q)}`:"";return`${Z}${z.gray(H)}${Y}`}case"cancel":{let Y=Q?` ${z.strikethrough(z.dim(Q))}`:"";return`${Z}${z.gray(H)}${Y}${Q?`
|
|
103
|
+
${z.gray(H)}`:""}`}default:return`${Z}${z.cyan(H)} ${$}
|
|
104
|
+
${z.cyan(x)}
|
|
105
|
+
`}}}).prompt()}function t$(J){let Z=J.validate;return _0({...J,initialUserInput:J.initialValue??J.root??n0.cwd(),maxItems:5,validate($){if(Array.isArray($))return;if(!$)return"Please select a path";if(Z)return Z($);return},options(){let $=this.userInput;if($==="")return[];try{let Q;if(!c0($))Q=uJ($);else if(dJ($).isDirectory())Q=$;else Q=uJ($);return p0(Q).map((q)=>{let U=i0(Q,q),F=dJ(U);return{name:q,path:U,isDirectory:F.isDirectory()}}).filter(({path:q,isDirectory:U})=>q.startsWith($)&&(J.directory||!U)).map((q)=>({value:q.path}))}catch(Q){return console.error("Error reading directory:",Q),[]}}})}function NZ({indicator:J="dots",onCancel:Z,output:$=b.stdout,cancelMessage:Q,errorMessage:Y,frames:q=wJ?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:U=wJ?80:120,signal:F}={}){let X=HZ(),j,G,V=!1,W=!1,K="",L,P=performance.now();function D(){if(L===void 0)return;if(X)$.write(`
|
|
106
|
+
`);let R=L.split(`
|
|
107
|
+
`);$.write(C.move(-999,R.length-1)),$.write(JJ.down(R.length))}function M(R){return R.replace(/\.+$/,"")}function E(R){let h=(performance.now()-R)/1000,S=Math.floor(h/60),l=Math.floor(h%60);return S>0?`[${S}m ${l}s]`:`[${l}s]`}function N(R="",h=0){V=!1,clearInterval(G),D();let S=h===0?z.green(t):h===1?z.red(KZ):z.red(VZ);if(K=R??K,J==="timer")$.write(`${S} ${K} ${E(P)}
|
|
108
|
+
`);else $.write(`${S} ${K}
|
|
109
|
+
`);QJ(),j()}function I(R){let h=R>1?Y??v.messages.error:Q??v.messages.cancel;if(W=R===1,V){if(N(h,R),W&&typeof Z==="function")Z()}}function A(){I(2)}function g(){I(1)}function $J(){b.on("uncaughtExceptionMonitor",A),b.on("unhandledRejection",A),b.on("SIGINT",g),b.on("SIGTERM",g),b.on("exit",I)}function QJ(){if(b.removeListener("uncaughtExceptionMonitor",A),b.removeListener("unhandledRejection",A),b.removeListener("SIGINT",g),b.removeListener("SIGTERM",g),b.removeListener("exit",I),F)F.removeEventListener("abort",g)}function OZ(R=""){V=!0,j=L0({output:$}),K=M(R),P=performance.now(),$.write(`${z.gray(H)}
|
|
110
|
+
`);let h=0,S=0;$J(),G=setInterval(()=>{if(X&&K===L)return;D(),L=K;let l=z.magenta(q[h]);if(X)$.write(`${l} ${K}...`);else if(J==="timer")$.write(`${l} ${K} ${E(P)}`);else{let BZ=".".repeat(Math.floor(S)).slice(0,3);$.write(`${l} ${K}${BZ}`)}h=h+1<q.length?h+1:0,S=S<4?S+0.125:0},U)}function TZ(R=""){K=M(R??K)}return{start:OZ,stop:N,message:TZ,get isCancelled(){return W}}}var cJ={light:O("\u2500","-"),heavy:O("\u2501","="),block:O("\u2588","#")};function e$(J={}){let{style:Z="heavy",max:$=100,size:Q=40,...Y}=J,q=NZ(Y),U=0,F="",X=Math.max(1,$),j=Math.max(1,Q),G=(L)=>{switch(L){case"initial":case"active":return z.magenta;case"error":case"cancel":return z.red;case"submit":return z.green;default:return z.magenta}},V=(L,P)=>{let D=Math.floor(U/X*j);return`${G(L)(cJ[Z].repeat(D))}${z.dim(cJ[Z].repeat(j-D))} ${P}`},W=(L="")=>{return F=L,q.start(V("initial",L))},K=(L=1,P)=>{U=Math.min(X,L+U),q.message(V("active",P??F)),F=P??F};return{start:W,stop:q.stop,advance:K,isCancelled:q.isCancelled,message:(L)=>K(0,L)}}function JQ(J){let Z=n(J.message),$=(Q,Y)=>{let q=Q.label??String(Q.value);switch(Y){case"selected":return`${z.dim(q)}`;case"active":return`${z.green(FJ)} ${q}${Q.hint?` ${z.dim(`(${Q.hint})`)}`:""}`;case"cancelled":return`${z.strikethrough(z.dim(q))}`;default:return`${z.dim(jJ)} ${z.dim(q)}`}};return new FZ({options:J.options,signal:J.signal,input:J.input,output:J.output,initialValue:J.initialValue,render(){let Q=`${z.gray(H)}
|
|
111
|
+
${f(this.state)} ${Z}
|
|
112
|
+
`;switch(this.state){case"submit":return`${Q}${z.gray(H)} ${$(this.options[this.cursor],"selected")}`;case"cancel":return`${Q}${z.gray(H)} ${$(this.options[this.cursor],"cancelled")}
|
|
113
|
+
${z.gray(H)}`;default:return`${Q}${z.cyan(H)} ${ZJ({output:J.output,cursor:this.cursor,options:this.options,maxItems:J.maxItems,style:(Y,q)=>$(Y,q?"active":"inactive")}).join(`
|
|
114
|
+
${z.cyan(H)} `)}
|
|
115
|
+
${z.cyan(x)}
|
|
116
|
+
`}}}).prompt()}function ZQ(J){let Z=($,Q="inactive")=>{let Y=$.label??String($.value);if(Q==="selected")return`${z.dim(Y)}`;if(Q==="cancelled")return`${z.strikethrough(z.dim(Y))}`;if(Q==="active")return`${z.bgCyan(z.gray(` ${$.value} `))} ${Y} ${$.hint?z.dim(`(${$.hint})`):""}`;return`${z.gray(z.bgWhite(z.inverse(` ${$.value} `)))} ${Y} ${$.hint?z.dim(`(${$.hint})`):""}`};return new jZ({options:J.options,signal:J.signal,input:J.input,output:J.output,initialValue:J.initialValue,render(){let $=`${z.gray(H)}
|
|
117
|
+
${f(this.state)} ${J.message}
|
|
118
|
+
`;switch(this.state){case"submit":return`${$}${z.gray(H)} ${Z(this.options.find((Q)=>Q.value===this.value)??J.options[0],"selected")}`;case"cancel":return`${$}${z.gray(H)} ${Z(this.options[0],"cancelled")}
|
|
119
|
+
${z.gray(H)}`;default:return`${$}${z.cyan(H)} ${this.options.map((Q,Y)=>Z(Q,Y===this.cursor?"active":"inactive")).join(`
|
|
120
|
+
${z.cyan(H)} `)}
|
|
121
|
+
${z.cyan(x)}
|
|
122
|
+
`}}}).prompt()}function l0(){return`${z.gray(H)} `}var pJ=l0(),r={message:async(J,{symbol:Z=z.gray(H)}={})=>{e.stdout.write(`${z.gray(H)}
|
|
123
|
+
${Z} `);let $=3;for await(let Q of J){if(Q=Q.replace(/\n/g,`
|
|
124
|
+
${pJ}`),Q.includes(`
|
|
125
|
+
`))$=3+DJ(Q.slice(Q.lastIndexOf(`
|
|
126
|
+
`))).length;let Y=DJ(Q).length;if($+Y<e.stdout.columns)$+=Y,e.stdout.write(Q);else e.stdout.write(`
|
|
127
|
+
${pJ}${Q.trimStart()}`),$=3+DJ(Q.trimStart()).length}e.stdout.write(`
|
|
128
|
+
`)},info:(J)=>{return r.message(J,{symbol:z.blue(WZ)})},success:(J)=>{return r.message(J,{symbol:z.green(DZ)})},step:(J)=>{return r.message(J,{symbol:z.green(t)})},warn:(J)=>{return r.message(J,{symbol:z.yellow(LZ)})},warning:(J)=>{return r.warn(J)},error:(J)=>{return r.message(J,{symbol:z.red(MZ)})}};async function zQ(J,Z){for(let $ of J){if($.enabled===!1)continue;let Q=NZ(Z);Q.start($.title);let Y=await $.task(Q.message);Q.stop(Y||$.title)}}function qQ(J){let Z=J.output??r0.stdout,$=M0(Z),Q=ZZ(H),Y=J.spacing??1,q=3,U=J.retainLog===!0,F=!HZ()&&R0(Z);Z.write(`${Q}
|
|
129
|
+
`),Z.write(`${JZ(t)} ${J.title}
|
|
130
|
+
`);for(let D=0;D<Y;D++)Z.write(`${Q}
|
|
131
|
+
`);let X=[{value:"",full:""}],j=!1,G=(D)=>{if(X.length===0)return;let M=0;if(D)M+=Y+2;for(let E of X){let{value:N,result:I}=E,A=I?.message??N;if(A.length===0)continue;if(I===void 0&&E.header!==void 0&&E.header!=="")A+=`
|
|
132
|
+
${E.header}`;let g=A.split(`
|
|
133
|
+
`).reduce(($J,QJ)=>{if(QJ==="")return $J+1;return $J+Math.ceil((QJ.length+3)/$)},0);M+=g}if(M>0)M+=1,Z.write(JJ.lines(M))},V=(D,M,E)=>{let N=E?`${D.full}
|
|
134
|
+
${D.value}`:D.value;if(D.header!==void 0&&D.header!=="")k.message(D.header.split(`
|
|
135
|
+
`).map($Z),{output:Z,secondarySymbol:Q,symbol:Q,spacing:0});k.message(N.split(`
|
|
136
|
+
`).map(QZ),{output:Z,secondarySymbol:Q,symbol:Q,spacing:M??Y})},W=()=>{for(let D of X){let{header:M,value:E,full:N}=D;if((M===void 0||M.length===0)&&E.length===0)continue;V(D,void 0,U===!0&&N.length>0)}},K=()=>{for(let D of X)if(D.result)if(D.result.status==="error")k.error(D.result.message,{output:Z,secondarySymbol:Q,spacing:0});else k.success(D.result.message,{output:Z,secondarySymbol:Q,spacing:0});else if(D.value!=="")V(D,0)},L=(D,M,E)=>{if(G(!1),(E?.raw!==!0||!j)&&D.value!=="")D.value+=`
|
|
137
|
+
`;if(D.value+=M,j=E?.raw===!0,J.limit!==void 0){let N=D.value.split(`
|
|
138
|
+
`),I=N.length-J.limit;if(I>0){let A=N.splice(0,I);if(U)D.full+=(D.full===""?"":`
|
|
139
|
+
`)+A.join(`
|
|
140
|
+
`)}D.value=N.join(`
|
|
141
|
+
`)}if(F)K()},P=(D,M)=>{if(G(!1),D.result=M,F)K()};return{message(D,M){L(X[0],D,M)},group(D){let M={header:D,value:"",full:""};return X.push(M),{message(E,N){L(M,E,N)},error(E){P(M,{status:"error",message:E})},success(E){P(M,{status:"success",message:E})}}},error(D,M){if(G(!0),k.error(D,{output:Z,secondarySymbol:Q,spacing:1}),M?.showLog!==!1)W();X.splice(1,X.length-1),X[0].value="",X[0].full=""},success(D,M){if(G(!0),k.success(D,{output:Z,secondarySymbol:Q,spacing:1}),M?.showLog===!0)W();X.splice(1,X.length-1),X[0].value="",X[0].full=""}}}function XQ(J){let Z=n(J.message);return new GZ({validate:J.validate,placeholder:J.placeholder,defaultValue:J.defaultValue,initialValue:J.initialValue,output:J.output,signal:J.signal,input:J.input,render(){let $=`${z.gray(H)}
|
|
142
|
+
${f(this.state)} ${Z}
|
|
143
|
+
`,Q=J.placeholder?z.inverse(J.placeholder[0])+z.dim(J.placeholder.slice(1)):z.inverse(z.hidden("_")),Y=!this.userInput?Q:this.userInputWithCursor,q=this.value??"";switch(this.state){case"error":{let U=this.error?` ${z.yellow(this.error)}`:"";return`${$.trim()}
|
|
144
|
+
${z.yellow(H)} ${Y}
|
|
145
|
+
${z.yellow(x)}${U}
|
|
146
|
+
`}case"submit":{let F=(this.userInput||q!==J.placeholder)&&q?` ${z.dim(q)}`:"";return`${$}${z.gray(H)}${F}`}case"cancel":{let U=q?` ${z.strikethrough(z.dim(q))}`:"";return`${$}${z.gray(H)}${U}${q.trim()?`
|
|
147
|
+
${z.gray(H)}`:""}`}default:return`${$}${z.cyan(H)} ${Y}
|
|
148
|
+
${z.cyan(x)}
|
|
149
|
+
`}}}).prompt()}class TJ extends t0{buffer=[];_write(J,Z,$){this.buffer.push(J.toString()),$()}}class wZ extends s0{_buffer=[];_read(){if(this._buffer===null){this.push(null);return}for(let J of this._buffer)this.push(J);this._buffer=[]}pushValue(J){this._buffer?.push(J)}close(){this._buffer=null}}function VQ(J={}){return tJ(J.name||"")}function o0(){let J=new TJ,Z=new TJ,$=new wZ,Q=w.exit,Y=w.stdout,q=w.stderr,U=w.stdin,F=console.log;return w.exit=(X)=>{throw Error(`Process exit with code: ${X||0}`)},Object.defineProperty(w,"stdout",{value:J,writable:!0}),Object.defineProperty(w,"stderr",{value:Z,writable:!0}),Object.defineProperty(w,"stdin",{value:$,writable:!0}),{stdout:J,stderr:Z,stdin:$,originalExit:Q,originalStdout:Y,originalStderr:q,originalStdin:U,originalConsoleLog:F}}function e0(J){w.exit=J.originalExit,Object.defineProperty(w,"stdout",{value:J.originalStdout,writable:!0}),Object.defineProperty(w,"stderr",{value:J.originalStderr,writable:!0}),Object.defineProperty(w,"stdin",{value:J.originalStdin,writable:!0}),console.log=J.originalConsoleLog}async function WQ(J,Z,$={}){let Q=Date.now(),{inputs:Y=[],env:q={},cwd:U=w.cwd(),timeout:F=5000}=$,X=o0(),{stdin:j,stdout:G,stderr:V}=X,W=Z.includes("--help")||Z.includes("-h"),K=[];if(w.stdout.write=function(N){let I=N.toString();return K.push(I),G.write(I),!0},console.log=function(...N){let I=N.map((A)=>String(A)).join(" ");K.push(`${I}
|
|
150
|
+
`),G.write(`${I}
|
|
151
|
+
`);return},Y.length>0)for(let N of Y)j.pushValue(`${N}
|
|
152
|
+
`);let L={...w.env},P=w.cwd();if(Object.entries(q).forEach(([N,I])=>{w.env[N]=I}),U!==P)w.chdir(U);let D,M=0;try{let N=new Promise((A,g)=>{setTimeout(()=>g(Error("Command execution timed out")),F)}),I=Promise.resolve().then(async()=>{try{if(J.showHelpOnExit=!1,J.showVersionOnExit=!1,await J.parse(["node","cli",...Z],{run:!1}),W)J.outputHelp();return D=await J.runMatchedCommand(),D}catch(A){throw M=1,V.write(`${A}
|
|
153
|
+
`),A}});await Promise.race([I,N])}catch(N){if(N.message==="Command execution timed out")throw N}finally{if(w.env=L,U!==P)w.chdir(P);e0(X)}let E=Date.now()-Q;if(W)M=0;return{stdout:K.join(""),stderr:V.buffer.join(""),exitCode:M,duration:E,outputs:[...K],result:D}}var u=null;function DQ(J){u=J}function LQ(J){if(!u)return;if(J in u)return u[J];for(let[Z,$]of Object.entries(u))if(Z.startsWith("/")&&Z.endsWith("/i")){let Q=Z.slice(1,-2);if(new RegExp(Q,"i").test(J))return $}else if(Z.startsWith("/")&&Z.endsWith("/")){let Q=Z.slice(1,-1);if(new RegExp(Q).test(J))return $}if("*"in u)return u["*"];return}function MQ(){u=null}var GJ=null;function PQ(){let J=[],Z=[],$=w.stdout.write,Q=w.stderr.write;w.stdout.write=function(q){return J.push(q.toString()),!0},w.stderr.write=function(q){return Z.push(q.toString()),!0};let Y={stdout:J,stderr:Z,stop:()=>{return w.stdout.write=$,w.stderr.write=Q,GJ=null,{stdout:J.join(""),stderr:Z.join("")}}};return GJ=Y,Y}function NQ(){if(!GJ)throw Error("No output capture in progress. Call captureOutput() first.");return GJ.stdout.join("")}async function wQ(J){let Z=await y.mkdtemp(XJ.join(a0.tmpdir(),"clapp-test-")),$=async(Q,Y)=>{for(let[q,U]of Object.entries(Y)){let F=XJ.join(Q,q);if(typeof U==="object"&&!iJ.isBuffer(U))if(q.endsWith("/"))await y.mkdir(F,{recursive:!0}),await $(F,U);else await y.mkdir(F,{recursive:!0}),await $(F,U);else{let X=XJ.dirname(F);if(await y.mkdir(X,{recursive:!0}),iJ.isBuffer(U))await y.writeFile(F,U);else if(typeof U==="string")await y.writeFile(F,U,"utf8");else await y.writeFile(F,JSON.stringify(U),"utf8")}}};return await $(Z,J),Z}async function OQ(J){let Z=async($)=>{let Q=await y.readdir($,{withFileTypes:!0});for(let Y of Q){let q=XJ.join($,Y.name);if(Y.isDirectory())await Z(q);else await y.unlink(q)}await y.rmdir($)};await Z(J)}var TQ={outputToContain(J,Z){if(!J.stdout.includes(Z))throw Error(`Expected output to contain "${Z}", but got:
|
|
154
|
+
${J.stdout}`)},outputToMatch(J,Z){if(!Z.test(J.stdout))throw Error(`Expected output to match ${Z}, but got:
|
|
155
|
+
${J.stdout}`)},exitCode(J,Z){if(J.exitCode!==Z)throw Error(`Expected exit code ${Z}, but got ${J.exitCode}`)},completedWithin(J,Z){if(J.duration>Z)throw Error(`Expected command to complete within ${Z}ms, but took ${J.duration}ms`)},outputNotToContain(J,Z){if(J.stdout.includes(Z))throw Error(`Expected output not to contain "${Z}", but it did`)},stderrToContain(J,Z){if(!J.stderr.includes(Z))throw Error(`Expected stderr to contain "${Z}", but got:
|
|
156
|
+
${J.stderr}`)}},BQ=tJ;export{R$ as updateSettings,O as unicodeOr,wJ as unicode,PJ as themes,XQ as text,Y$ as telemetry,e0 as teardownTest,zQ as tasks,qQ as taskLog,N$ as table,f as symbol,i as style,r as stream,NZ as spinner,o0 as setupTest,v as settings,dZ as setTheme,zJ as setRawMode,kZ as setDotProp,hZ as setByType,L$ as setAccessibility,ZQ as selectKey,JQ as select,j$ as scroll,MQ as resetMockPrompts,LJ as removeBrackets,e$ as progress,n as processMarkdown,t$ as path,l$ as password,P$ as panel,VJ as padRight,u$ as outro,T$ as onUnknownSubcommand,n$ as note,c$ as multiselect,DQ as mockPrompt,k as log,ZJ as limitOptions,SZ as levenshteinDistance,vZ as isUnicodeSupported,R0 as isTTY,D0 as isCancel,HZ as isCI,IJ as isActionKey,d$ as intro,g$ as groupMultiselect,y$ as group,xZ as getMriOptions,LQ as getMockResponse,NQ as getLastOutput,bZ as getFileName,M0 as getColumns,D$ as getAvailableThemes,rJ as findSimilarCommands,hJ as findLongest,RZ as findAllBrackets,TQ as expect,WQ as execCommand,JJ as erase,V0 as diffLines,BQ as default,C as cursor,wQ as createTestFS,VQ as createTestCLI,S$ as confirm,d as codes,w$ as cliCache,tJ as cli,G$ as clear,OQ as cleanupTestFS,PQ as captureOutput,m$ as cancel,lJ as camelcaseOptionName,CZ as camelcase,M$ as box,L0 as block,F$ as beep,v$ as autocompleteMultiselect,_0 as autocomplete,W$ as applyTheme,LZ as S_WARN,DZ as S_SUCCESS,t as S_STEP_SUBMIT,VZ as S_STEP_ERROR,KZ as S_STEP_CANCEL,x0 as S_STEP_ACTIVE,jJ as S_RADIO_INACTIVE,FJ as S_RADIO_ACTIVE,k0 as S_PASSWORD_MASK,WZ as S_INFO,MZ as S_ERROR,h0 as S_CORNER_TOP_RIGHT,v0 as S_CORNER_BOTTOM_RIGHT,b0 as S_CONNECT_LEFT,s as S_CHECKBOX_SELECTED,RJ as S_CHECKBOX_INACTIVE,OJ as S_CHECKBOX_ACTIVE,C0 as S_BAR_START,fJ as S_BAR_H,x as S_BAR_END,H as S_BAR,EJ as GlobalCommand,UJ as ESC,BJ as Command,YJ as ClappError,T as CSI,sJ as CLI,NJ as CANCEL_SYMBOL};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ac as u,Bc as v,Cc as w,pc as j,qc as k,rc as l,sc as m,tc as n,uc as o,vc as p,wc as q,xc as r,yc as s,zc as t}from"./chunk-
|
|
2
|
+
import{Ac as u,Bc as v,Cc as w,pc as j,qc as k,rc as l,sc as m,tc as n,uc as o,vc as p,wc as q,xc as r,yc as s,zc as t}from"./chunk-vx4a5crm.js";import{Fc as a,Gc as b,Hc as c,Ic as d,Jc as e,Kc as f,Lc as g,Mc as h,Nc as i}from"./chunk-xw9wfq8f.js";import"./chunk-mcdb3q06.js";export{l as processVariableDeclaration,n as processTypeDeclaration,s as processModuleDeclaration,m as processInterfaceDeclaration,q as processImportDeclaration,k as processFunctionDeclaration,r as processExportDeclaration,p as processEnumDeclaration,w as processDeclarations,o as processClassDeclaration,u as parseImportStatement,d as parseArrayElements,h as isGenericType,e as inferObjectType,b as inferNarrowTypeInUnion,a as inferNarrowType,g as inferFunctionType,c as inferArrayType,j as formatComments,f as findMatchingBracket,i as extractSatisfiesType,v as extractAllImportedItems,t as clearProcessorCaches};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ic as a,jc as b,kc as c}from"./chunk-bymtns9a.js";import"./chunk-y2pe3jq3.js";import"./chunk-4mtbtmee.js";import"./chunk-vx4a5crm.js";import"./chunk-xw9wfq8f.js";import"./chunk-mcdb3q06.js";export{c as processSourceDirect,a as processSource,b as clearResultCache};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{hc as E}from"./chunk-2n1bbm2c.js";import{lc as c,mc as Bq,nc as Oq}from"./chunk-
|
|
2
|
+
import{hc as E}from"./chunk-2n1bbm2c.js";import{lc as c,mc as Bq,nc as Oq}from"./chunk-y2pe3jq3.js";import{Fc as Rq}from"./chunk-xw9wfq8f.js";import{bd as N}from"./chunk-mcdb3q06.js";var L=N(E(),1);var A=N(E(),1);var v=new Map,T=new Map,Lq=100;function _q(){while(v.size>Lq){let q=v.keys().next().value;if(q===void 0)break;v.delete(q)}}function wq(){v.clear()}function Iq(){return v.size}var Yq={asyncThreshold:1e5,chunkSize:50000,yieldInterval:0};function l(q){return new Promise(($)=>{if(q===0)if(typeof setImmediate<"u")setImmediate($);else setTimeout($,0);else setTimeout($,q)})}async function vq(q,$,Q){if($.length<Q.asyncThreshold)return A.createSourceFile(q,$,A.ScriptTarget.Latest,!0,A.ScriptKind.TS);await l(Q.yieldInterval);let W=A.createSourceFile(q,$,A.ScriptTarget.Latest,!1,A.ScriptKind.TS);return await l(Q.yieldInterval),W}async function h(q,$,Q={}){let W={...Yq,...Q},X=c($),Z=q,U=Date.now(),V=v.get(Z);if(V&&V.contentHash===X)return V.lastAccess=U,v.delete(Z),v.set(Z,V),V.sourceFile;let j=T.get(Z);if(j)return j;let w=(async()=>{try{let H=await vq(q,$,W);return v.set(Z,{sourceFile:H,contentHash:X,lastAccess:U}),_q(),H}finally{T.delete(Z)}})();return T.set(Z,w),w}async function Aq(q,$={}){let Q=$.concurrency??4,W=new Map,X=[];for(let Z=0;Z<q.length;Z+=Q){let U=q.slice(Z,Z+Q),V=await Promise.allSettled(U.map(async({filePath:j,sourceCode:w})=>{let H=await h(j,w,$);return{filePath:j,sourceFile:H}}));for(let j=0;j<V.length;j++){let w=V[j];if(w.status==="fulfilled")W.set(w.value.filePath,w.value.sourceFile);else X.push({filePath:U[j].filePath,error:w.reason})}if(Z+Q<q.length)await l(0)}if(X.length>0)console.warn(`[dtsx] ${X.length} file(s) failed to parse:`,X.map((Z)=>Z.filePath));return W}function kq(q,$={}){let Q=$.asyncThreshold??Yq.asyncThreshold;return q.length>=Q}function Kq(){return T.size}var R=N(E(),1);var Y=N(E(),1);var O=N(E(),1);function M(q,$,Q){return $.slice(Q?q.getStart(Q):q.getStart(),q.getEnd())}var Hq=/\/\*[\s\S]*?\*\//g;function I(q,$){let Q=[],W=q.getFullStart(),X=q.getStart($);if(W===X)return Q;let Z=$.text.substring(W,X);if(Z.indexOf("/*")!==-1){Hq.lastIndex=0;let U;while((U=Hq.exec(Z))!==null)Q.push(U[0])}if(Z.indexOf("//")!==-1){let U=Z.split(`
|
|
3
3
|
`),V=[];for(let j=U.length-1;j>=0;j--){let w=U[j].trim();if(w.startsWith("//"))V.unshift(w);else if(w==="")continue;else break}if(V.length>0)Q.push(V.join(`
|
|
4
4
|
`))}return Q}function k(q,$){if(O.isObjectBindingPattern(q.name)){let Q=q.name.elements.map((W)=>{if(O.isBindingElement(W)&&O.isIdentifier(W.name))return W.name.getText($);return""}).filter(Boolean);if(Q.length>3)return`{
|
|
5
5
|
${Q.join(`,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ec as F}from"./chunk-
|
|
2
|
+
import{ec as F}from"./chunk-ft0nf9jb.js";import{Cc as N}from"./chunk-vx4a5crm.js";import{existsSync as H,readFileSync as P,unwatchFile as T}from"fs";var k;((J)=>{J[J.Error=1]="Error";J[J.Warning=2]="Warning";J[J.Information=3]="Information";J[J.Hint=4]="Hint"})(k||={});var L;((O)=>{O[O.File=1]="File";O[O.Module=2]="Module";O[O.Namespace=3]="Namespace";O[O.Package=4]="Package";O[O.Class=5]="Class";O[O.Method=6]="Method";O[O.Property=7]="Property";O[O.Field=8]="Field";O[O.Constructor=9]="Constructor";O[O.Enum=10]="Enum";O[O.Interface=11]="Interface";O[O.Function=12]="Function";O[O.Variable=13]="Variable";O[O.Constant=14]="Constant";O[O.String=15]="String";O[O.Number=16]="Number";O[O.Boolean=17]="Boolean";O[O.Array=18]="Array";O[O.Object=19]="Object";O[O.Key=20]="Key";O[O.Null=21]="Null";O[O.EnumMember=22]="EnumMember";O[O.Struct=23]="Struct";O[O.Event=24]="Event";O[O.Operator=25]="Operator";O[O.TypeParameter=26]="TypeParameter"})(L||={});var M;((Q)=>{Q[Q.Text=1]="Text";Q[Q.Method=2]="Method";Q[Q.Function=3]="Function";Q[Q.Constructor=4]="Constructor";Q[Q.Field=5]="Field";Q[Q.Variable=6]="Variable";Q[Q.Class=7]="Class";Q[Q.Interface=8]="Interface";Q[Q.Module=9]="Module";Q[Q.Property=10]="Property";Q[Q.Unit=11]="Unit";Q[Q.Value=12]="Value";Q[Q.Enum=13]="Enum";Q[Q.Keyword=14]="Keyword";Q[Q.Snippet=15]="Snippet";Q[Q.Color=16]="Color";Q[Q.File=17]="File";Q[Q.Reference=18]="Reference";Q[Q.Folder=19]="Folder";Q[Q.EnumMember=20]="EnumMember";Q[Q.Constant=21]="Constant";Q[Q.Struct=22]="Struct";Q[Q.Event=23]="Event";Q[Q.Operator=24]="Operator";Q[Q.TypeParameter=25]="TypeParameter"})(M||={});var v;((A)=>{A[A.Text=1]="Text";A[A.Read=2]="Read";A[A.Write=3]="Write"})(v||={});class E{documents=new Map;rootUri=null;config={};messageId=0;watchers=new Map;initialize(j){return this.rootUri=j.rootUri,{capabilities:{textDocumentSync:1,hoverProvider:!0,completionProvider:{triggerCharacters:[".",":","<",'"',"'","/"],resolveProvider:!0},definitionProvider:!0,referencesProvider:!0,renameProvider:{prepareProvider:!0},documentSymbolProvider:!0,workspaceSymbolProvider:!0,codeActionProvider:{codeActionKinds:["quickfix","refactor","source"]},signatureHelpProvider:{triggerCharacters:["(",","],retriggerCharacters:[","]},documentHighlightProvider:!0,documentFormattingProvider:!0,diagnosticProvider:{interFileDependencies:!0,workspaceDiagnostics:!0}}}}didOpen(j){let{uri:z,text:G,version:A}=j.textDocument;this.updateDocument(z,G,A)}didChange(j){let{uri:z,version:G}=j.textDocument,A=j.contentChanges[0]?.text||"";this.updateDocument(z,A,G)}didClose(j){let z=j.textDocument.uri;if(this.documents.delete(z),this.watchers.get(z))T(this.uriToPath(z)),this.watchers.delete(z)}updateDocument(j,z,G){let A=this.uriToPath(j),J=F(z,A,!0);this.documents.set(j,{content:z,version:G,declarations:J})}getDiagnostics(j){let z=this.documents.get(j);if(!z)return[];let G=[];for(let A of z.declarations){if(A.isExported&&A.kind==="variable"&&!A.typeAnnotation)G.push({range:this.getDeclarationRange(A,z.content),severity:2,code:"missing-type",source:"dtsx",message:`Exported variable '${A.name}' should have an explicit type annotation for better declaration generation`});if(A.typeAnnotation==="any"||A.returnType==="any")G.push({range:this.getDeclarationRange(A,z.content),severity:3,code:"any-type",source:"dtsx",message:"Consider using a more specific type instead of 'any'"});if(A.kind==="function"&&A.isExported&&!A.returnType)G.push({range:this.getDeclarationRange(A,z.content),severity:3,code:"missing-return-type",source:"dtsx",message:`Function '${A.name}' should have an explicit return type for better declaration generation`})}return G}hover(j){let z=this.documents.get(j.textDocument.uri);if(!z)return null;let{line:G,character:A}=j.position,R=z.content.split(`
|
|
3
3
|
`)[G]||"",U=R.slice(0,A).match(/[\w$]+$/),V=R.slice(A).match(/^[\w$]+/);if(!U&&!V)return null;let X=(U?.[0]||"")+(V?.[0]||""),Y=z.declarations.find((W)=>W.name===X);if(!Y)return null;let B=`\`\`\`typescript
|
|
4
4
|
${this.buildSignature(Y)}
|
|
5
5
|
\`\`\``;if(Y.leadingComments&&Y.leadingComments.length>0){let q=Y.leadingComments.join(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{a,b,c}from"./chunk-0cfb4831.js";import"./chunk-ft0nf9jb.js";import"./chunk-2n1bbm2c.js";import"./chunk-y2pe3jq3.js";import"./chunk-4mtbtmee.js";import"./chunk-xw9wfq8f.js";import"./chunk-mcdb3q06.js";export{b as optimizeFile,a as optimizeDeclarations,c as minifyDts};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{s as a,t as b,u as c,v as d,w as e,x as f,y as g}from"./chunk-
|
|
2
|
+
import{s as a,t as b,u as c,v as d,w as e,x as f,y as g}from"./chunk-fvgc14nk.js";import"./chunk-ft0nf9jb.js";import"./chunk-2n1bbm2c.js";import"./chunk-y2pe3jq3.js";import"./chunk-4mtbtmee.js";import"./chunk-vx4a5crm.js";import"./chunk-xw9wfq8f.js";import"./chunk-mcdb3q06.js";export{f as startLSPServer,g as createFileWatcher,b as SymbolKind,a as LspDiagnosticSeverity,e as DtsxLanguageServer,d as DocumentHighlightKind,c as CompletionItemKind};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$b as G,Ab as e,Bb as g,Cb as h,Db as i,Eb as j,Fb as k,Gb as l,Hb as m,Ib as n,Jb as o,Kb as p,Lb as q,Mb as r,Nb as s,Ob as t,Pb as u,Qb as v,Rb as w,Sb as x,Tb as y,Ub as z,Vb as A,Wb as B,Xb as C,Yb as D,Zb as E,_b as F,ac as H,bc as I,cc as J,dc as K,ec as L,fc as M,gc as N,wb as a,xb as b,yb as c,zb as d}from"./chunk-
|
|
2
|
+
import{$b as G,Ab as e,Bb as g,Cb as h,Db as i,Eb as j,Fb as k,Gb as l,Hb as m,Ib as n,Jb as o,Kb as p,Lb as q,Mb as r,Nb as s,Ob as t,Pb as u,Qb as v,Rb as w,Sb as x,Tb as y,Ub as z,Vb as A,Wb as B,Xb as C,Yb as D,Zb as E,_b as F,ac as H,bc as I,cc as J,dc as K,ec as L,fc as M,gc as N,wb as a,xb as b,yb as c,zb as d}from"./chunk-ft0nf9jb.js";import"./chunk-2n1bbm2c.js";import"./chunk-y2pe3jq3.js";import"./chunk-4mtbtmee.js";import{Oc as f}from"./chunk-xw9wfq8f.js";import"./chunk-mcdb3q06.js";export{d as shouldUseAsyncParsing,m as shouldIncludeNonExportedInterface,l as shouldIncludeNonExportedFunction,n as isBuiltInType,j as hasExportModifier,k as hasAsyncModifier,a as getSourceFileCacheSize,b as getSourceFileAsync,e as getPendingParseCount,i as getParameterName,g as getNodeText,s as getInterfaceBody,I as findReferencedTypes,C as extractVariableStatement,o as extractTypesFromModuleText,E as extractTypeAliasDeclaration,f as extractTripleSlashDirectives,J as extractReferencedTypeDeclarations,H as extractModuleDeclaration,h as extractJSDocComments,D as extractInterfaceDeclaration,y as extractImportDeclaration,B as extractFunctionDeclaration,z as extractExportDeclaration,A as extractExportAssignment,G as extractEnumDeclaration,M as extractDeclarationsAsync,L as extractDeclarations,F as extractClassDeclaration,K as clearSourceFileCache,q as buildVariableDeclaration,t as buildTypeDeclaration,w as buildModuleDeclaration,x as buildModuleBody,r as buildInterfaceDeclaration,p as buildFunctionSignature,u as buildClassDeclaration,v as buildClassBody,c as batchParseSourceFiles,N as batchExtractDeclarations};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{tb as c,ub as d,vb as e}from"./chunk-af12rv0y.js";import"./chunk-ft0nf9jb.js";import"./chunk-2n1bbm2c.js";import{ic as a,jc as b}from"./chunk-bymtns9a.js";import"./chunk-y2pe3jq3.js";import"./chunk-4mtbtmee.js";import"./chunk-vx4a5crm.js";import"./chunk-xw9wfq8f.js";import"./chunk-7hy98p24.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{e as watch,a as processSource,d as processFile,c as generate,b as clearResultCache};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Dc as Uz,Ec as Yz,Fc as T,Mc as u,Nc as p,Oc as Gz}from"./chunk-
|
|
2
|
+
import{Dc as Uz,Ec as Yz,Fc as T,Mc as u,Nc as p,Oc as Gz}from"./chunk-xw9wfq8f.js";function k(z,$=!0){if(!$||!z||z.length===0)return"";if(z.length===1){let U=z[0];if(U.length>0&&U.charCodeAt(0)>32&&U.charCodeAt(U.length-1)>32)return`${U}
|
|
3
3
|
`;return`${U.trim()}
|
|
4
4
|
`}let K="";for(let U=0;U<z.length;U++){if(U>0)K+=`
|
|
5
5
|
`;K+=z[U].trim()}return`${K}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{l as a,m as b,n as c,o as d,p as e,q as f,r as g}from"./chunk-ww6wqbda.js";import"./chunk-af12rv0y.js";import"./chunk-ft0nf9jb.js";import"./chunk-2n1bbm2c.js";import"./chunk-bymtns9a.js";import"./chunk-y2pe3jq3.js";import"./chunk-4mtbtmee.js";import"./chunk-vx4a5crm.js";import"./chunk-xw9wfq8f.js";import"./chunk-7hy98p24.js";import"./chunk-gssantc8.js";import"./chunk-mcdb3q06.js";export{b as sortProjectsByDependencies,f as resolveWorkspacePatterns,c as generateWorkspace,d as generateMonorepo,g as generateFromPackageWorkspaces,a as discoverWorkspaceProjects,e as discoverWorkspaceFromPackageJson};
|