@stacksjs/dtsx 0.9.10 → 0.9.12

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.
Files changed (44) hide show
  1. package/dist/bin/cli.js +5 -5
  2. package/dist/branded-types.d.ts +0 -18
  3. package/dist/chunk-0fhq2wva.js +17 -0
  4. package/dist/chunk-1e5c83wa.js +2 -0
  5. package/dist/{chunk-c18vx9sq.js → chunk-1vc477cq.js} +1 -1
  6. package/dist/{chunk-bn29kee5.js → chunk-20kdv9bh.js} +1 -1
  7. package/dist/{chunk-9mjc7ddv.js → chunk-2w3g3g00.js} +1 -1
  8. package/dist/{chunk-09zp67d8.js → chunk-5fveksya.js} +1 -1
  9. package/dist/chunk-7p1sfeeg.js +2 -0
  10. package/dist/{chunk-e3j9tecw.js → chunk-7vj8vtzh.js} +1 -1
  11. package/dist/{chunk-3mxzfgcv.js → chunk-8dx98fd5.js} +1 -1
  12. package/dist/{chunk-6ppqaypd.js → chunk-8j312sjx.js} +1 -1
  13. package/dist/{chunk-q75q4w1s.js → chunk-91gpfz27.js} +1 -1
  14. package/dist/{chunk-j22v8wfe.js → chunk-97pgeywh.js} +1 -1
  15. package/dist/chunk-bzsvvb81.js +2 -0
  16. package/dist/{chunk-h12gdfk9.js → chunk-d9my0n30.js} +1 -1
  17. package/dist/{chunk-fw6wcdfd.js → chunk-efkpkyz9.js} +1 -1
  18. package/dist/{chunk-4ev1n7r7.js → chunk-fjjs2r77.js} +1 -1
  19. package/dist/{chunk-74j5mydx.js → chunk-gpxdn99a.js} +1 -1
  20. package/dist/{chunk-jvz9t6pq.js → chunk-j40mkvfg.js} +1 -1
  21. package/dist/{chunk-fbqcsr60.js → chunk-jddkdjap.js} +1 -1
  22. package/dist/{chunk-2f046tgr.js → chunk-kge8a5vc.js} +1 -1
  23. package/dist/chunk-kpp6ajgg.js +2 -0
  24. package/dist/chunk-me2ae6f0.js +23 -0
  25. package/dist/{chunk-ffqpf34b.js → chunk-p09jmjq8.js} +1 -1
  26. package/dist/{chunk-1mm3t0nr.js → chunk-qn0xktfx.js} +1 -1
  27. package/dist/{chunk-9a3jfxnc.js → chunk-xe1z54pq.js} +1 -1
  28. package/dist/{chunk-rrkq4k1n.js → chunk-zsznaama.js} +1 -1
  29. package/dist/incremental.d.ts +1 -1
  30. package/dist/src/index.js +1 -1
  31. package/dist/src/plugins/bun.js +1 -1
  32. package/dist/src/plugins/esbuild.js +1 -1
  33. package/dist/src/plugins/index.js +1 -1
  34. package/dist/src/plugins/tsup.js +1 -1
  35. package/dist/src/plugins/vite.js +1 -1
  36. package/dist/src/plugins/webpack.js +1 -1
  37. package/dist/type-mappings.d.ts +0 -24
  38. package/package.json +1 -1
  39. package/dist/chunk-0kmfaaz6.js +0 -2
  40. package/dist/chunk-axb2kjeq.js +0 -2
  41. package/dist/chunk-dk2vv0np.js +0 -15
  42. package/dist/chunk-k5h5ppp5.js +0 -2
  43. package/dist/chunk-pyxbb193.js +0 -2
  44. package/dist/chunk-rnt0wkrk.js +0 -23
package/dist/bin/cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // @bun
2
- import{cd as Y}from"../chunk-rw6j20e2.js";import V from"process";var f=V.argv[2];if(f==="stdin"||f==="emit"||f==="--project"){if(f==="stdin"){let{processSource:q}=await import("../chunk-0kmfaaz6.js"),Q=[];for await(let N of V.stdin)Q.push(N);let K=Buffer.concat(Q).toString("utf-8");if(K.trim())V.stdout.write(q(K,"stdin.ts")),V.stdout.write(`
3
- `)}else if(f==="--project"){let{readdirSync:q,readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv.slice(3),z="",B="",G=!1;for(let X=0;X<$.length;X++)if($[X]==="--outdir"&&$[X+1])B=$[X+1],X++;else if($[X]==="--isolated-declarations")G=!0;else if(!z)z=$[X];N(B,{recursive:!0});let j=q(z).filter((X)=>X.endsWith(".ts")&&!X.endsWith(".d.ts")),Z=j.length,E=Array(Z),M=Array(Z);for(let X=0;X<Z;X++)E[X]=`${z}/${j[X]}`,M[X]=`${B}/${j[X].slice(0,-3)}.d.ts`;let T=["bun"],R=A&&Z>=64,I=!1,_=null;if(R){let X=null;try{let{createWorkerPool:F,calculateOptimalBatchSize:D}=await import("../chunk-r1m3q3dj.js"),{cpus:C}=await import("os"),w=Math.max(1,C().length-1),U=Math.min(64,Math.max(8,D(Z,w)*2)),L=Z>=256,a=!0,l=Z>=256;if(!L&&Z>=256){_=Array(Z);for(let x=0;x<Z;x++)_[x]=J.file(E[x]).text()}let O=Math.ceil(Z/U),u=Math.min(O,Math.max(2,w*2));X=F({maxWorkers:w,initialWorkers:w,recycleAfter:Math.max(100,O+1)}),await X.init();let d=X,i=0,r=Date.now(),t=async()=>{for(;;){let x=i++;if(x>=O)return;let S=x*U;if(S>=Z)return;let g=Math.min(Z,S+U)-S,m;if(l){let P=Array(g),y=Array(g),b;if(L)for(let W=0;W<g;W++){let v=S+W;P[W]=E[v],y[W]=M[v]}else{let W=Array(g);for(let v=0;v<g;v++){let c=S+v;P[v]=E[c],y[v]=M[c],W[v]=_?_[c]:J.file(E[c]).text()}b=await Promise.all(W)}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:P[0]||"",filePaths:P,sources:b,outPaths:y,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}else{let P=Array(g);if(L)for(let y=0;y<g;y++){let b=S+y;P[y]={filePath:E[b],outPath:M[b]}}else{let y=Array(g);for(let W=0;W<g;W++){let v=S+W;y[W]=_?_[v]:J.file(E[v]).text()}let b=await Promise.all(y);for(let W=0;W<g;W++){let v=S+W;P[W]={filePath:E[v],sourceCode:b[W],outPath:M[v]}}}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:E[S]||"",files:P,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}if(!m.success)throw Error(m.error||`Worker batch failed for ${E[S]}`);if(m.batchResults?.length){let P=m.batchResults[0];throw Error(P?.error||m.error||`Worker failed for ${E[S]}`)}}},n=[];for(let x=0;x<u;x++)n.push(t());await Promise.all(n),I=!0}catch{I=!1}finally{if(X)await X.shutdown()}}if(!I){let{scanDeclarations:X}=await import("../chunk-axb2kjeq.js"),{processDeclarations:F}=await import("../chunk-6ppqaypd.js"),D=Array(Z);if(A){let U=_?await Promise.all(_):await Promise.all(E.map((L)=>J.file(L).text()));for(let L=0;L<Z;L++)D[L]=U[L]}else for(let U=0;U<Z;U++)D[U]=Q(E[U],"utf-8");let C=Array(Z),w={filePath:"",sourceCode:"",declarations:[]};for(let U=0;U<Z;U++){let L=X(D[U],j[U],!0,G);w.filePath=j[U],w.sourceCode=D[U],w.declarations=L,C[U]=F(L,w,!0,T)}if(A){let U=Array(Z);for(let L=0;L<Z;L++)U[L]=J.write(M[L],C[L]);await Promise.all(U)}else for(let U=0;U<Z;U++)K(M[U],C[U])}}else{let{processSource:q}=await import("../chunk-0kmfaaz6.js"),{readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv[3],z=A?await J.file($).text():Q($,"utf-8"),B=V.argv[4];if(B){let{dirname:G}=await import("path");N(G(B),{recursive:!0});let j=`${q(z,$)}
2
+ import{cd as Y}from"../chunk-rw6j20e2.js";import V from"process";var f=V.argv[2];if(f==="stdin"||f==="emit"||f==="--project"){if(f==="stdin"){let{processSource:q}=await import("../chunk-7p1sfeeg.js"),Q=[];for await(let N of V.stdin)Q.push(N);let K=Buffer.concat(Q).toString("utf-8");if(K.trim())V.stdout.write(q(K,"stdin.ts")),V.stdout.write(`
3
+ `)}else if(f==="--project"){let{readdirSync:q,readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv.slice(3),z="",B="",G=!1;for(let X=0;X<$.length;X++)if($[X]==="--outdir"&&$[X+1])B=$[X+1],X++;else if($[X]==="--isolated-declarations")G=!0;else if(!z)z=$[X];N(B,{recursive:!0});let j=q(z).filter((X)=>X.endsWith(".ts")&&!X.endsWith(".d.ts")),Z=j.length,E=Array(Z),M=Array(Z);for(let X=0;X<Z;X++)E[X]=`${z}/${j[X]}`,M[X]=`${B}/${j[X].slice(0,-3)}.d.ts`;let T=["bun"],R=A&&Z>=64,I=!1,_=null;if(R){let X=null;try{let{createWorkerPool:F,calculateOptimalBatchSize:D}=await import("../chunk-r1m3q3dj.js"),{cpus:C}=await import("os"),w=Math.max(1,C().length-1),U=Math.min(64,Math.max(8,D(Z,w)*2)),L=Z>=256,a=!0,l=Z>=256;if(!L&&Z>=256){_=Array(Z);for(let x=0;x<Z;x++)_[x]=J.file(E[x]).text()}let O=Math.ceil(Z/U),u=Math.min(O,Math.max(2,w*2));X=F({maxWorkers:w,initialWorkers:w,recycleAfter:Math.max(100,O+1)}),await X.init();let d=X,i=0,r=Date.now(),t=async()=>{for(;;){let x=i++;if(x>=O)return;let S=x*U;if(S>=Z)return;let g=Math.min(Z,S+U)-S,m;if(l){let P=Array(g),y=Array(g),b;if(L)for(let W=0;W<g;W++){let v=S+W;P[W]=E[v],y[W]=M[v]}else{let W=Array(g);for(let v=0;v<g;v++){let c=S+v;P[v]=E[c],y[v]=M[c],W[v]=_?_[c]:J.file(E[c]).text()}b=await Promise.all(W)}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:P[0]||"",filePaths:P,sources:b,outPaths:y,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}else{let P=Array(g);if(L)for(let y=0;y<g;y++){let b=S+y;P[y]={filePath:E[b],outPath:M[b]}}else{let y=Array(g);for(let W=0;W<g;W++){let v=S+W;y[W]=_?_[v]:J.file(E[v]).text()}let b=await Promise.all(y);for(let W=0;W<g;W++){let v=S+W;P[W]={filePath:E[v],sourceCode:b[W],outPath:M[v]}}}m=await d.submit({id:`batch-${r}-${x}`,type:"process-batch",filePath:E[S]||"",files:P,writeOutput:!0,config:{keepComments:!0,importOrder:T,isolatedDeclarations:G}})}if(!m.success)throw Error(m.error||`Worker batch failed for ${E[S]}`);if(m.batchResults?.length){let P=m.batchResults[0];throw Error(P?.error||m.error||`Worker failed for ${E[S]}`)}}},n=[];for(let x=0;x<u;x++)n.push(t());await Promise.all(n),I=!0}catch{I=!1}finally{if(X)await X.shutdown()}}if(!I){let{scanDeclarations:X}=await import("../chunk-bzsvvb81.js"),{processDeclarations:F}=await import("../chunk-8j312sjx.js"),D=Array(Z);if(A){let U=_?await Promise.all(_):await Promise.all(E.map((L)=>J.file(L).text()));for(let L=0;L<Z;L++)D[L]=U[L]}else for(let U=0;U<Z;U++)D[U]=Q(E[U],"utf-8");let C=Array(Z),w={filePath:"",sourceCode:"",declarations:[]};for(let U=0;U<Z;U++){let L=X(D[U],j[U],!0,G);w.filePath=j[U],w.sourceCode=D[U],w.declarations=L,C[U]=F(L,w,!0,T)}if(A){let U=Array(Z);for(let L=0;L<Z;L++)U[L]=J.write(M[L],C[L]);await Promise.all(U)}else for(let U=0;U<Z;U++)K(M[U],C[U])}}else{let{processSource:q}=await import("../chunk-7p1sfeeg.js"),{readFileSync:Q,writeFileSync:K,mkdirSync:N}=await import("fs"),A=typeof globalThis.Bun<"u",J=A?globalThis.Bun:null,$=V.argv[3],z=A?await J.file($).text():Q($,"utf-8"),B=V.argv[4];if(B){let{dirname:G}=await import("path");N(G(B),{recursive:!0});let j=`${q(z,$)}
4
4
  `;if(A)await J.write(B,j);else K(B,j)}else V.stdout.write(q(z,$)),V.stdout.write(`
5
- `)}V.exit(0)}var{resolve:h}=await import("path"),{CLI:s}=await import("../chunk-v96rjx7x.js"),{version:e}=await import("../chunk-h12gdfk9.js"),{getConfig:o}=await import("../chunk-6s7n1gt0.js"),{generate:qq,processSource:Hq,watch:Kq}=await import("../chunk-pyxbb193.js"),k=new s("dtsx"),H={cwd:V.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!1,tsconfigPath:"tsconfig.json",verbose:!1,importOrder:["bun"],dryRun:!1,stats:!1,continueOnError:!1,logLevel:"info",exclude:[],outputFormat:"text",progress:!1,diff:!1,validate:!1,parallel:!1,concurrency:4};k.command("generate","Generate TypeScript declaration files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--clean","Clean output directory before generation",{default:H.clean}).option("--tsconfig <path>","Path to tsconfig.json",{default:H.tsconfigPath}).option("--verbose","Enable verbose logging",{default:H.verbose}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:H.importOrder?.join(","),type:[String]}).option("--dry-run","Show what would be generated without writing files",{default:H.dryRun}).option("--stats","Show statistics after generation",{default:H.stats}).option("--continue-on-error","Continue processing other files if one fails",{default:H.continueOnError}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--output-format <format>","Output format: text or json",{default:H.outputFormat}).option("--progress","Show progress during generation",{default:H.progress}).option("--diff","Show diff of changes compared to existing files",{default:H.diff}).option("--validate","Validate generated .d.ts files against TypeScript",{default:H.validate}).option("--parallel","Process files in parallel",{default:H.parallel}).option("--concurrency <number>","Number of concurrent workers (with --parallel)",{default:H.concurrency}).option("--declaration-map","Generate declaration map files (.d.ts.map)",{default:!1}).option("--bundle","Bundle all declarations into a single output file",{default:!1}).option("--bundle-output <file>","Output filename when bundling (relative to outdir)",{default:"index.d.ts"}).option("--config <path>","Path to config file (dtsx.config.ts)",{default:""}).option("--incremental","Enable incremental builds (only regenerate changed files)",{default:!1}).option("--clear-cache","Clear the incremental build cache before generating",{default:!1}).option("--indent-style <style>","Indentation style: spaces or tabs",{default:"spaces"}).option("--indent-size <size>","Number of spaces for indentation",{default:2}).option("--prettier","Use Prettier for output formatting if available",{default:!1}).example("dtsx generate").example("dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types").example('dtsx generate --import-order "node:,bun,@myorg/"').example("dtsx generate --dry-run --stats").example('dtsx generate --exclude "**/*.test.ts,**/__tests__/**"').example("dtsx generate --stats --output-format json").example("dtsx generate --bundle --bundle-output types.d.ts").action(async(q)=>{try{let Q=h(q.cwd||H.cwd),K=await o(Q),N={entrypoints:q.entrypoints?q.entrypoints:K.entrypoints||H.entrypoints,cwd:Q,root:h(q.root||K.root||H.root),outdir:h(q.outdir||K.outdir||H.outdir),tsconfigPath:h(q.tsconfigPath||K.tsconfigPath||H.tsconfigPath),keepComments:q.keepComments??K.keepComments??H.keepComments,clean:q.clean??K.clean??H.clean,verbose:q.verbose??K.verbose??H.verbose,importOrder:q.importOrder||K.importOrder||H.importOrder,dryRun:q.dryRun??K.dryRun??H.dryRun,stats:q.stats??K.stats??H.stats,continueOnError:q.continueOnError??K.continueOnError??H.continueOnError,logLevel:q.logLevel??K.logLevel??H.logLevel,exclude:q.exclude?q.exclude.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean)):K.exclude||H.exclude,outputFormat:q.outputFormat??K.outputFormat??H.outputFormat,progress:q.progress??K.progress??H.progress,diff:q.diff??K.diff??H.diff,validate:q.validate??K.validate??H.validate,parallel:q.parallel??K.parallel??H.parallel,concurrency:Number(q.concurrency)||K.concurrency||H.concurrency,declarationMap:q.declarationMap??K.declarationMap??!1,bundle:q.bundle??K.bundle??!1,bundleOutput:q.bundleOutput??K.bundleOutput??"index.d.ts",incremental:q.incremental??K.incremental??!1,clearCache:q.clearCache??!1,indentStyle:q.indentStyle??K.indentStyle??"spaces",indentSize:Number(q.indentSize)||K.indentSize||2,prettier:q.prettier??K.prettier??!1,plugins:K.plugins},A=await qq(N);if(A.filesFailed>0&&A.filesGenerated===0)V.exit(1);else if(A.filesFailed>0)V.exit(2)}catch(Q){console.error("Error generating .d.ts files:",Q),V.exit(1)}});k.command("watch","Watch for changes and regenerate .d.ts files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).example("dtsx watch").example("dtsx watch --root src --outdir dist/types").action(async(q)=>{try{let Q={entrypoints:q.entrypoints?q.entrypoints:H.entrypoints,cwd:h(q.cwd||H.cwd),root:h(q.root||H.root),outdir:h(q.outdir||H.outdir),keepComments:q.keepComments??H.keepComments,exclude:q.exclude?q.exclude.flatMap((K)=>K.split(",").map((N)=>N.trim()).filter(Boolean)):H.exclude,logLevel:q.logLevel??H.logLevel};await Kq(Q)}catch(Q){console.error("Error in watch mode:",Q),V.exit(1)}});k.command("stdin","Process TypeScript from stdin and output .d.ts to stdout").option("--keep-comments","Keep comments in generated .d.ts files",{default:!0}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:"bun",type:[String]}).example(`echo "export const foo: string = 'bar'" | dtsx stdin`).example("cat src/index.ts | dtsx stdin").action(async(q)=>{try{let Q=[];for await(let J of V.stdin)Q.push(J);let K=Buffer.concat(Q).toString("utf-8");if(!K.trim())console.error("Error: No input received from stdin"),V.exit(1);let N=["bun"];if(q.importOrder){if(Array.isArray(q.importOrder))N=q.importOrder.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean));else if(typeof q.importOrder==="string")N=q.importOrder.split(",").map((J)=>J.trim()).filter(Boolean)}let A=Hq(K,"stdin.ts",q.keepComments??!0,N);console.log(A)}catch(Q){console.error("Error processing stdin:",Q),V.exit(1)}});k.command("optimize","Optimize declaration files").option("--files <patterns>","Glob patterns for .d.ts files to optimize",{default:"**/*.d.ts",type:[String]}).option("--outdir <path>","Output directory (defaults to in-place)",{default:""}).option("--remove-unused-imports","Remove unused type imports",{default:!0}).option("--deduplicate","Remove duplicate declarations",{default:!0}).option("--merge-interfaces","Merge interface declarations with same name",{default:!0}).option("--inline-types","Inline simple type aliases",{default:!1}).option("--remove-empty","Remove empty interfaces",{default:!0}).option("--sort","Sort declarations alphabetically",{default:!1}).option("--sort-imports","Sort imports",{default:!0}).option("--minify","Minify output (remove whitespace)",{default:!1}).option("--remove-comments","Remove comments",{default:!1}).example('dtsx optimize --files "dist/**/*.d.ts"').example("dtsx optimize --minify --remove-comments").action(async(q)=>{try{let{optimizeFile:Q}=await import("../chunk-k5h5ppp5.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N,join:A,relative:J,dirname:$,basename:z}=await import("path"),{mkdirSync:B,copyFileSync:G,existsSync:j}=await import("fs"),Z=V.cwd(),E=q.files||["**/*.d.ts"],M=[];for(let _ of E){let X=new K(_);for await(let F of X.scan({cwd:Z,absolute:!0,onlyFiles:!0}))if(F.endsWith(".d.ts")&&!F.includes("node_modules"))M.push(F)}if(M.length===0)console.error("No .d.ts files found"),V.exit(1);console.log(`Optimizing ${M.length} declaration files...`);let T=0,R=0;for(let _ of M){let X=_;if(q.outdir){let C=J(Z,_);X=A(N(q.outdir),C);let w=$(X);if(!j(w))B(w,{recursive:!0});G(_,X)}let F=await Q(X,{removeUnusedImports:q.removeUnusedImports??!0,deduplicateDeclarations:q.deduplicate??!0,mergeInterfaces:q.mergeInterfaces??!0,inlineSimpleTypes:q.inlineTypes??!1,removeEmptyInterfaces:q.removeEmpty??!0,sortDeclarations:q.sort??!1,sortImports:q.sortImports??!0,minify:q.minify??!1,removeComments:q.removeComments??!1});R+=F.originalSize,T+=F.savings;let D=J(Z,X);console.log(` ${D}: ${F.originalSize}B -> ${F.optimizedSize}B (-${F.savingsPercent}%)`)}let I=R>0?Math.round(T/R*100):0;console.log(`
6
- Total: ${R}B -> ${R-T}B (-${I}%)`)}catch(Q){console.error("Error optimizing files:",Q),V.exit(1)}});k.command("docs","Generate API documentation from source files").option("--root <path>","Root directory to scan for source files",{default:"./src"}).option("--outdir <path>","Output directory for documentation",{default:"./docs"}).option("--format <format>","Output format: markdown or html",{default:"markdown"}).option("--title <title>","Documentation title",{default:"API Documentation"}).option("--include-private","Include private members (prefixed with _)",{default:!1}).option("--include-internal","Include internal members (@internal)",{default:!1}).option("--group-by-category","Group entries by @category tag",{default:!1}).option("--source-url <url>","Base URL for source links").example("dtsx docs").example("dtsx docs --format html --outdir ./api-docs").example('dtsx docs --group-by-category --title "My API"').action(async(q)=>{try{let{generateDocs:Q}=await import("../chunk-jvz9t6pq.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N}=await import("path"),A=N(q.root||"./src"),J=new K("**/*.ts"),$=[];for await(let z of J.scan({cwd:A,absolute:!0,onlyFiles:!0}))if(!z.endsWith(".d.ts")&&!z.includes("node_modules"))$.push(z);if($.length===0)console.error("No TypeScript files found"),V.exit(1);console.log(`Found ${$.length} source files`),await Q($,{format:q.format||"markdown",outdir:N(q.outdir||"./docs"),title:q.title||"API Documentation",includePrivate:q.includePrivate??!1,includeInternal:q.includeInternal??!1,groupByCategory:q.groupByCategory??!1,includeSourceLinks:!!q.sourceUrl,sourceBaseUrl:q.sourceUrl})}catch(Q){console.error("Error generating documentation:",Q),V.exit(1)}});k.command("workspace","Generate declarations for all projects in a monorepo/workspace").option("--cwd <path>","Workspace root directory",{default:V.cwd()}).option("--parallel","Process projects in parallel",{default:!1}).option("--continue-on-error","Continue if a project fails",{default:!0}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:"info"}).example("dtsx workspace").example("dtsx workspace --cwd /path/to/monorepo").action(async(q)=>{try{let{generateMonorepo:Q,generateFromPackageWorkspaces:K}=await import("../chunk-rrkq4k1n.js"),{existsSync:N}=await import("fs"),{join:A,resolve:J}=await import("path"),$=J(q.cwd||V.cwd()),z=A($,"tsconfig.json"),B;if(N(z))B=await Q($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});else B=await K($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});if(!B.success)V.exit(1)}catch(Q){console.error("Error generating workspace declarations:",Q),V.exit(1)}});k.command("lsp","Start the Language Server Protocol server for IDE integration").example("dtsx lsp").action(async()=>{let{startLSPServer:q}=await import("../chunk-c18vx9sq.js");q()});k.command("check","Type check TypeScript files or validate generated declarations").option("--files <patterns>","Glob patterns for files to check",{default:"**/*.ts",type:[String]}).option("--declarations-only","Only check .d.ts files",{default:!1}).option("--tsconfig <path>","Path to tsconfig.json",{default:"tsconfig.json"}).option("--strict","Enable strict type checking",{default:!1}).option("--skip-lib-check","Skip checking library definitions",{default:!0}).option("--warnings-as-errors","Treat warnings as errors",{default:!1}).option("--max-errors <number>","Maximum errors before stopping",{default:0}).option("--isolated-declarations","Check if code follows isolated declarations best practices (recommended)",{default:!1}).option("--format <format>","Output format: text or json",{default:"text"}).example("dtsx check").example('dtsx check --files "src/**/*.ts" --strict').example('dtsx check --declarations-only --files "dist/**/*.d.ts"').example("dtsx check --isolated-declarations").action(async(q)=>{try{let{typeCheck:Q,checkIsolatedDeclarations:K,formatTypeCheckResults:N}=await import("../chunk-7cpp6v8f.js"),{Glob:A}=awaitPromise.resolve(globalThis.Bun),{resolve:J,relative:$}=await import("path"),z=V.cwd(),B=q.files||["**/*.ts"],G=[];for(let Z of B){let E=new A(Z);for await(let M of E.scan({cwd:z,absolute:!0,onlyFiles:!0}))if(!M.includes("node_modules"))if(q.declarationsOnly){if(M.endsWith(".d.ts"))G.push(M)}else G.push(M)}if(G.length===0)console.error("No files found to check"),V.exit(1);if(q.isolatedDeclarations){console.log(`Checking ${G.length} files for isolated declarations best practices...`);let Z=await K(G,q.tsconfig?J(q.tsconfig):void 0),E=0,M=[];for(let[T,R]of Z){let I=$(z,T);if(!R.compatible)if(E+=R.issues.length,q.format==="json")M.push({file:I,compatible:!1,issues:R.issues});else{console.log(`
5
+ `)}V.exit(0)}var{resolve:h}=await import("path"),{CLI:s}=await import("../chunk-v96rjx7x.js"),{version:e}=await import("../chunk-d9my0n30.js"),{getConfig:o}=await import("../chunk-6s7n1gt0.js"),{generate:qq,processSource:Hq,watch:Kq}=await import("../chunk-kpp6ajgg.js"),k=new s("dtsx"),H={cwd:V.cwd(),root:"./src",entrypoints:["**/*.ts"],outdir:"./dist",keepComments:!0,clean:!1,tsconfigPath:"tsconfig.json",verbose:!1,importOrder:["bun"],dryRun:!1,stats:!1,continueOnError:!1,logLevel:"info",exclude:[],outputFormat:"text",progress:!1,diff:!1,validate:!1,parallel:!1,concurrency:4};k.command("generate","Generate TypeScript declaration files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--clean","Clean output directory before generation",{default:H.clean}).option("--tsconfig <path>","Path to tsconfig.json",{default:H.tsconfigPath}).option("--verbose","Enable verbose logging",{default:H.verbose}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:H.importOrder?.join(","),type:[String]}).option("--dry-run","Show what would be generated without writing files",{default:H.dryRun}).option("--stats","Show statistics after generation",{default:H.stats}).option("--continue-on-error","Continue processing other files if one fails",{default:H.continueOnError}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--output-format <format>","Output format: text or json",{default:H.outputFormat}).option("--progress","Show progress during generation",{default:H.progress}).option("--diff","Show diff of changes compared to existing files",{default:H.diff}).option("--validate","Validate generated .d.ts files against TypeScript",{default:H.validate}).option("--parallel","Process files in parallel",{default:H.parallel}).option("--concurrency <number>","Number of concurrent workers (with --parallel)",{default:H.concurrency}).option("--declaration-map","Generate declaration map files (.d.ts.map)",{default:!1}).option("--bundle","Bundle all declarations into a single output file",{default:!1}).option("--bundle-output <file>","Output filename when bundling (relative to outdir)",{default:"index.d.ts"}).option("--config <path>","Path to config file (dtsx.config.ts)",{default:""}).option("--incremental","Enable incremental builds (only regenerate changed files)",{default:!1}).option("--clear-cache","Clear the incremental build cache before generating",{default:!1}).option("--indent-style <style>","Indentation style: spaces or tabs",{default:"spaces"}).option("--indent-size <size>","Number of spaces for indentation",{default:2}).option("--prettier","Use Prettier for output formatting if available",{default:!1}).example("dtsx generate").example("dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types").example('dtsx generate --import-order "node:,bun,@myorg/"').example("dtsx generate --dry-run --stats").example('dtsx generate --exclude "**/*.test.ts,**/__tests__/**"').example("dtsx generate --stats --output-format json").example("dtsx generate --bundle --bundle-output types.d.ts").action(async(q)=>{try{let Q=h(q.cwd||H.cwd),K=await o(Q),N={entrypoints:q.entrypoints?q.entrypoints:K.entrypoints||H.entrypoints,cwd:Q,root:h(q.root||K.root||H.root),outdir:h(q.outdir||K.outdir||H.outdir),tsconfigPath:h(q.tsconfigPath||K.tsconfigPath||H.tsconfigPath),keepComments:q.keepComments??K.keepComments??H.keepComments,clean:q.clean??K.clean??H.clean,verbose:q.verbose??K.verbose??H.verbose,importOrder:q.importOrder||K.importOrder||H.importOrder,dryRun:q.dryRun??K.dryRun??H.dryRun,stats:q.stats??K.stats??H.stats,continueOnError:q.continueOnError??K.continueOnError??H.continueOnError,logLevel:q.logLevel??K.logLevel??H.logLevel,exclude:q.exclude?q.exclude.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean)):K.exclude||H.exclude,outputFormat:q.outputFormat??K.outputFormat??H.outputFormat,progress:q.progress??K.progress??H.progress,diff:q.diff??K.diff??H.diff,validate:q.validate??K.validate??H.validate,parallel:q.parallel??K.parallel??H.parallel,concurrency:Number(q.concurrency)||K.concurrency||H.concurrency,declarationMap:q.declarationMap??K.declarationMap??!1,bundle:q.bundle??K.bundle??!1,bundleOutput:q.bundleOutput??K.bundleOutput??"index.d.ts",incremental:q.incremental??K.incremental??!1,clearCache:q.clearCache??!1,indentStyle:q.indentStyle??K.indentStyle??"spaces",indentSize:Number(q.indentSize)||K.indentSize||2,prettier:q.prettier??K.prettier??!1,plugins:K.plugins},A=await qq(N);if(A.filesFailed>0&&A.filesGenerated===0)V.exit(1);else if(A.filesFailed>0)V.exit(2)}catch(Q){console.error("Error generating .d.ts files:",Q),V.exit(1)}});k.command("watch","Watch for changes and regenerate .d.ts files").option("--cwd <path>","Current working directory",{default:H.cwd}).option("--root <path>","Root directory of the project",{default:H.root}).option("--entrypoints <files>","Entry point files (comma-separated)",{default:H.entrypoints?.join(","),type:[String]}).option("--outdir <path>","Output directory for generated .d.ts files",{default:H.outdir}).option("--keep-comments","Keep comments in generated .d.ts files",{default:H.keepComments}).option("--exclude <patterns>","Glob patterns to exclude (comma-separated)",{default:H.exclude?.join(","),type:[String]}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:H.logLevel}).example("dtsx watch").example("dtsx watch --root src --outdir dist/types").action(async(q)=>{try{let Q={entrypoints:q.entrypoints?q.entrypoints:H.entrypoints,cwd:h(q.cwd||H.cwd),root:h(q.root||H.root),outdir:h(q.outdir||H.outdir),keepComments:q.keepComments??H.keepComments,exclude:q.exclude?q.exclude.flatMap((K)=>K.split(",").map((N)=>N.trim()).filter(Boolean)):H.exclude,logLevel:q.logLevel??H.logLevel};await Kq(Q)}catch(Q){console.error("Error in watch mode:",Q),V.exit(1)}});k.command("stdin","Process TypeScript from stdin and output .d.ts to stdout").option("--keep-comments","Keep comments in generated .d.ts files",{default:!0}).option("--import-order <patterns>","Import order priority patterns (comma-separated)",{default:"bun",type:[String]}).example(`echo "export const foo: string = 'bar'" | dtsx stdin`).example("cat src/index.ts | dtsx stdin").action(async(q)=>{try{let Q=[];for await(let J of V.stdin)Q.push(J);let K=Buffer.concat(Q).toString("utf-8");if(!K.trim())console.error("Error: No input received from stdin"),V.exit(1);let N=["bun"];if(q.importOrder){if(Array.isArray(q.importOrder))N=q.importOrder.flatMap((J)=>J.split(",").map(($)=>$.trim()).filter(Boolean));else if(typeof q.importOrder==="string")N=q.importOrder.split(",").map((J)=>J.trim()).filter(Boolean)}let A=Hq(K,"stdin.ts",q.keepComments??!0,N);console.log(A)}catch(Q){console.error("Error processing stdin:",Q),V.exit(1)}});k.command("optimize","Optimize declaration files").option("--files <patterns>","Glob patterns for .d.ts files to optimize",{default:"**/*.d.ts",type:[String]}).option("--outdir <path>","Output directory (defaults to in-place)",{default:""}).option("--remove-unused-imports","Remove unused type imports",{default:!0}).option("--deduplicate","Remove duplicate declarations",{default:!0}).option("--merge-interfaces","Merge interface declarations with same name",{default:!0}).option("--inline-types","Inline simple type aliases",{default:!1}).option("--remove-empty","Remove empty interfaces",{default:!0}).option("--sort","Sort declarations alphabetically",{default:!1}).option("--sort-imports","Sort imports",{default:!0}).option("--minify","Minify output (remove whitespace)",{default:!1}).option("--remove-comments","Remove comments",{default:!1}).example('dtsx optimize --files "dist/**/*.d.ts"').example("dtsx optimize --minify --remove-comments").action(async(q)=>{try{let{optimizeFile:Q}=await import("../chunk-1e5c83wa.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N,join:A,relative:J,dirname:$,basename:z}=await import("path"),{mkdirSync:B,copyFileSync:G,existsSync:j}=await import("fs"),Z=V.cwd(),E=q.files||["**/*.d.ts"],M=[];for(let _ of E){let X=new K(_);for await(let F of X.scan({cwd:Z,absolute:!0,onlyFiles:!0}))if(F.endsWith(".d.ts")&&!F.includes("node_modules"))M.push(F)}if(M.length===0)console.error("No .d.ts files found"),V.exit(1);console.log(`Optimizing ${M.length} declaration files...`);let T=0,R=0;for(let _ of M){let X=_;if(q.outdir){let C=J(Z,_);X=A(N(q.outdir),C);let w=$(X);if(!j(w))B(w,{recursive:!0});G(_,X)}let F=await Q(X,{removeUnusedImports:q.removeUnusedImports??!0,deduplicateDeclarations:q.deduplicate??!0,mergeInterfaces:q.mergeInterfaces??!0,inlineSimpleTypes:q.inlineTypes??!1,removeEmptyInterfaces:q.removeEmpty??!0,sortDeclarations:q.sort??!1,sortImports:q.sortImports??!0,minify:q.minify??!1,removeComments:q.removeComments??!1});R+=F.originalSize,T+=F.savings;let D=J(Z,X);console.log(` ${D}: ${F.originalSize}B -> ${F.optimizedSize}B (-${F.savingsPercent}%)`)}let I=R>0?Math.round(T/R*100):0;console.log(`
6
+ Total: ${R}B -> ${R-T}B (-${I}%)`)}catch(Q){console.error("Error optimizing files:",Q),V.exit(1)}});k.command("docs","Generate API documentation from source files").option("--root <path>","Root directory to scan for source files",{default:"./src"}).option("--outdir <path>","Output directory for documentation",{default:"./docs"}).option("--format <format>","Output format: markdown or html",{default:"markdown"}).option("--title <title>","Documentation title",{default:"API Documentation"}).option("--include-private","Include private members (prefixed with _)",{default:!1}).option("--include-internal","Include internal members (@internal)",{default:!1}).option("--group-by-category","Group entries by @category tag",{default:!1}).option("--source-url <url>","Base URL for source links").example("dtsx docs").example("dtsx docs --format html --outdir ./api-docs").example('dtsx docs --group-by-category --title "My API"').action(async(q)=>{try{let{generateDocs:Q}=await import("../chunk-j40mkvfg.js"),{Glob:K}=awaitPromise.resolve(globalThis.Bun),{resolve:N}=await import("path"),A=N(q.root||"./src"),J=new K("**/*.ts"),$=[];for await(let z of J.scan({cwd:A,absolute:!0,onlyFiles:!0}))if(!z.endsWith(".d.ts")&&!z.includes("node_modules"))$.push(z);if($.length===0)console.error("No TypeScript files found"),V.exit(1);console.log(`Found ${$.length} source files`),await Q($,{format:q.format||"markdown",outdir:N(q.outdir||"./docs"),title:q.title||"API Documentation",includePrivate:q.includePrivate??!1,includeInternal:q.includeInternal??!1,groupByCategory:q.groupByCategory??!1,includeSourceLinks:!!q.sourceUrl,sourceBaseUrl:q.sourceUrl})}catch(Q){console.error("Error generating documentation:",Q),V.exit(1)}});k.command("workspace","Generate declarations for all projects in a monorepo/workspace").option("--cwd <path>","Workspace root directory",{default:V.cwd()}).option("--parallel","Process projects in parallel",{default:!1}).option("--continue-on-error","Continue if a project fails",{default:!0}).option("--log-level <level>","Log level (debug, info, warn, error, silent)",{default:"info"}).example("dtsx workspace").example("dtsx workspace --cwd /path/to/monorepo").action(async(q)=>{try{let{generateMonorepo:Q,generateFromPackageWorkspaces:K}=await import("../chunk-zsznaama.js"),{existsSync:N}=await import("fs"),{join:A,resolve:J}=await import("path"),$=J(q.cwd||V.cwd()),z=A($,"tsconfig.json"),B;if(N(z))B=await Q($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});else B=await K($,{logLevel:q.logLevel||"info",continueOnError:q.continueOnError??!0});if(!B.success)V.exit(1)}catch(Q){console.error("Error generating workspace declarations:",Q),V.exit(1)}});k.command("lsp","Start the Language Server Protocol server for IDE integration").example("dtsx lsp").action(async()=>{let{startLSPServer:q}=await import("../chunk-1vc477cq.js");q()});k.command("check","Type check TypeScript files or validate generated declarations").option("--files <patterns>","Glob patterns for files to check",{default:"**/*.ts",type:[String]}).option("--declarations-only","Only check .d.ts files",{default:!1}).option("--tsconfig <path>","Path to tsconfig.json",{default:"tsconfig.json"}).option("--strict","Enable strict type checking",{default:!1}).option("--skip-lib-check","Skip checking library definitions",{default:!0}).option("--warnings-as-errors","Treat warnings as errors",{default:!1}).option("--max-errors <number>","Maximum errors before stopping",{default:0}).option("--isolated-declarations","Check if code follows isolated declarations best practices (recommended)",{default:!1}).option("--format <format>","Output format: text or json",{default:"text"}).example("dtsx check").example('dtsx check --files "src/**/*.ts" --strict').example('dtsx check --declarations-only --files "dist/**/*.d.ts"').example("dtsx check --isolated-declarations").action(async(q)=>{try{let{typeCheck:Q,checkIsolatedDeclarations:K,formatTypeCheckResults:N}=await import("../chunk-7cpp6v8f.js"),{Glob:A}=awaitPromise.resolve(globalThis.Bun),{resolve:J,relative:$}=await import("path"),z=V.cwd(),B=q.files||["**/*.ts"],G=[];for(let Z of B){let E=new A(Z);for await(let M of E.scan({cwd:z,absolute:!0,onlyFiles:!0}))if(!M.includes("node_modules"))if(q.declarationsOnly){if(M.endsWith(".d.ts"))G.push(M)}else G.push(M)}if(G.length===0)console.error("No files found to check"),V.exit(1);if(q.isolatedDeclarations){console.log(`Checking ${G.length} files for isolated declarations best practices...`);let Z=await K(G,q.tsconfig?J(q.tsconfig):void 0),E=0,M=[];for(let[T,R]of Z){let I=$(z,T);if(!R.compatible)if(E+=R.issues.length,q.format==="json")M.push({file:I,compatible:!1,issues:R.issues});else{console.log(`
7
7
  \u2717 ${I}`);for(let _ of R.issues)if(console.log(` ${_.line}:${_.column} - ${_.message}`),_.missingAnnotation)console.log(` Missing: ${_.missingAnnotation} type annotation`)}else if(q.format==="json")M.push({file:I,compatible:!0,issues:[]})}if(q.format==="json")console.log(JSON.stringify(M,null,2));else if(E>0)console.log(`
8
8
  ${G.length} files checked, ${E} recommendations found`),console.log("Tip: Adding explicit type annotations improves .d.ts accuracy");else console.log(`
9
- ${G.length} files checked, all follow isolated declarations best practices`);V.exit(E>0?1:0)}console.log(`Type checking ${G.length} files...`);let j=await Q(G,{tsconfigPath:q.tsconfig?J(q.tsconfig):void 0,strict:q.strict??!1,declarationsOnly:q.declarationsOnly??!1,skipLibCheck:q.skipLibCheck??!0,warningsAsErrors:q.warningsAsErrors??!1,maxErrors:q.maxErrors||void 0});if(q.format==="json")console.log(JSON.stringify(j,null,2));else console.log(N(j));V.exit(j.success?0:1)}catch(Q){console.error("Error during type checking:",Q),V.exit(1)}});k.command("convert","Convert TypeScript types to different schema formats").option("--files <patterns>","Glob patterns for TypeScript files",{default:"**/*.ts",type:[String]}).option("--format <format>","Output format: json-schema, zod, valibot, io-ts, yup, arktype",{default:"json-schema"}).option("--outdir <path>","Output directory for converted files",{default:"./schemas"}).option("--include-descriptions","Include JSDoc descriptions in output",{default:!0}).option("--all-optional","Make all properties optional",{default:!1}).option("--use-infer","Include inferred types (for Zod, Valibot, etc.)",{default:!0}).option("--json-schema-draft <version>","JSON Schema draft version: 2020-12, 2019-09, draft-07",{default:"2020-12"}).example("dtsx convert --format zod").example('dtsx convert --format json-schema --files "src/types/**/*.ts"').example("dtsx convert --format valibot --outdir ./validation").action(async(q)=>{try{let Q=await import("../chunk-3g2v2ns2.js"),{extractDeclarations:K}=await import("../chunk-2f046tgr.js"),{Glob:N}=awaitPromise.resolve(globalThis.Bun),{resolve:A,relative:J,join:$,dirname:z,basename:B}=await import("path"),{mkdirSync:G,existsSync:j,readFileSync:Z,writeFileSync:E}=await import("fs"),M=V.cwd(),T=q.files||["**/*.ts"],R=q.format||"json-schema",I=A(q.outdir||"./schemas"),_=[];for(let D of T){let C=new N(D);for await(let w of C.scan({cwd:M,absolute:!0,onlyFiles:!0}))if(!w.endsWith(".d.ts")&&!w.includes("node_modules"))_.push(w)}if(_.length===0)console.error("No TypeScript files found"),V.exit(1);if(console.log(`Converting ${_.length} files to ${R} format...`),!j(I))G(I,{recursive:!0});let X=0,F=0;for(let D of _){let C=Z(D,"utf-8"),U=K(C,D).filter((d)=>d.kind==="interface"||d.kind==="type");if(U.length===0)continue;let L=Q.convertToFormat(U,{format:R,includeDescriptions:q.includeDescriptions??!0,allOptional:q.allOptional??!1,useInfer:q.useInfer??!0,jsonSchemaDraft:q.jsonSchemaDraft||"2020-12"}),a=J(M,D),l=B(D,".ts"),p=Q.getFormatExtension(R),O=$(I,z(a),`${l}${p}`),u=z(O);if(!j(u))G(u,{recursive:!0});E(O,L),X+=U.length,F++,console.log(` ${J(M,O)} (${U.length} types)`)}console.log(`
9
+ ${G.length} files checked, all follow isolated declarations best practices`);V.exit(E>0?1:0)}console.log(`Type checking ${G.length} files...`);let j=await Q(G,{tsconfigPath:q.tsconfig?J(q.tsconfig):void 0,strict:q.strict??!1,declarationsOnly:q.declarationsOnly??!1,skipLibCheck:q.skipLibCheck??!0,warningsAsErrors:q.warningsAsErrors??!1,maxErrors:q.maxErrors||void 0});if(q.format==="json")console.log(JSON.stringify(j,null,2));else console.log(N(j));V.exit(j.success?0:1)}catch(Q){console.error("Error during type checking:",Q),V.exit(1)}});k.command("convert","Convert TypeScript types to different schema formats").option("--files <patterns>","Glob patterns for TypeScript files",{default:"**/*.ts",type:[String]}).option("--format <format>","Output format: json-schema, zod, valibot, io-ts, yup, arktype",{default:"json-schema"}).option("--outdir <path>","Output directory for converted files",{default:"./schemas"}).option("--include-descriptions","Include JSDoc descriptions in output",{default:!0}).option("--all-optional","Make all properties optional",{default:!1}).option("--use-infer","Include inferred types (for Zod, Valibot, etc.)",{default:!0}).option("--json-schema-draft <version>","JSON Schema draft version: 2020-12, 2019-09, draft-07",{default:"2020-12"}).example("dtsx convert --format zod").example('dtsx convert --format json-schema --files "src/types/**/*.ts"').example("dtsx convert --format valibot --outdir ./validation").action(async(q)=>{try{let Q=await import("../chunk-3g2v2ns2.js"),{extractDeclarations:K}=await import("../chunk-kge8a5vc.js"),{Glob:N}=awaitPromise.resolve(globalThis.Bun),{resolve:A,relative:J,join:$,dirname:z,basename:B}=await import("path"),{mkdirSync:G,existsSync:j,readFileSync:Z,writeFileSync:E}=await import("fs"),M=V.cwd(),T=q.files||["**/*.ts"],R=q.format||"json-schema",I=A(q.outdir||"./schemas"),_=[];for(let D of T){let C=new N(D);for await(let w of C.scan({cwd:M,absolute:!0,onlyFiles:!0}))if(!w.endsWith(".d.ts")&&!w.includes("node_modules"))_.push(w)}if(_.length===0)console.error("No TypeScript files found"),V.exit(1);if(console.log(`Converting ${_.length} files to ${R} format...`),!j(I))G(I,{recursive:!0});let X=0,F=0;for(let D of _){let C=Z(D,"utf-8"),U=K(C,D).filter((d)=>d.kind==="interface"||d.kind==="type");if(U.length===0)continue;let L=Q.convertToFormat(U,{format:R,includeDescriptions:q.includeDescriptions??!0,allOptional:q.allOptional??!1,useInfer:q.useInfer??!0,jsonSchemaDraft:q.jsonSchemaDraft||"2020-12"}),a=J(M,D),l=B(D,".ts"),p=Q.getFormatExtension(R),O=$(I,z(a),`${l}${p}`),u=z(O);if(!j(u))G(u,{recursive:!0});E(O,L),X+=U.length,F++,console.log(` ${J(M,O)} (${U.length} types)`)}console.log(`
10
10
  Converted ${X} declarations from ${F} files`)}catch(Q){console.error("Error converting files:",Q),V.exit(1)}});k.command("circular","Detect circular dependencies in TypeScript files").option("--files <patterns>","Glob patterns for files to check",{default:"**/*.ts",type:[String]}).option("--root <path>","Root directory for resolution",{default:"."}).option("--ignore <patterns>","Glob patterns to ignore (comma-separated)",{default:"",type:[String]}).option("--types-only","Only report type-level cycles",{default:!1}).option("--max-depth <number>","Maximum depth for cycle detection",{default:100}).option("--include-node-modules","Include node_modules in analysis",{default:!1}).option("--format <format>","Output format: text, json, dot",{default:"text"}).option("--summary","Show graph summary statistics",{default:!1}).example("dtsx circular").example('dtsx circular --files "src/**/*.ts"').example('dtsx circular --ignore "**/*.test.ts,**/__tests__/**"').example("dtsx circular --format dot > deps.dot").example("dtsx circular --summary").action(async(q)=>{try{let{analyzeCircularDependencies:Q,formatCircularAnalysis:K,getGraphSummary:N,exportGraphAsDot:A,exportGraphAsJson:J}=await import("../chunk-3j7r0fxz.js"),{Glob:$}=awaitPromise.resolve(globalThis.Bun),{resolve:z,relative:B}=await import("path"),G=V.cwd(),j=z(q.root||"."),Z=q.files||["**/*.ts"],E=[];for(let T of Z){let R=new $(T);for await(let I of R.scan({cwd:j,absolute:!0,onlyFiles:!0}))if(!I.endsWith(".d.ts")){if(!q.includeNodeModules&&I.includes("node_modules"))continue;E.push(I)}}if(E.length===0)console.error("No TypeScript files found"),V.exit(1);console.log(`Analyzing ${E.length} files for circular dependencies...`);let M=await Q(E,{rootDir:j,ignore:q.ignore?.filter(Boolean),typesOnly:q.typesOnly??!1,maxDepth:q.maxDepth??100,includeNodeModules:q.includeNodeModules??!1});if(q.format==="json")console.log(J(M.graph,j));else if(q.format==="dot")console.log(A(M.graph,j));else if(console.log(K(M,j)),q.summary){let T=N(M.graph);if(console.log(`
11
11
  --- Dependency Graph Summary ---`),console.log(`Total files: ${T.totalFiles}`),console.log(`Total dependencies: ${T.totalDependencies}`),console.log(`Average dependencies per file: ${T.avgDependencies.toFixed(2)}`),T.maxDependencies.count>0)console.log(`Most dependencies: ${B(j,T.maxDependencies.file)} (${T.maxDependencies.count})`);if(T.mostDepended.count>0)console.log(`Most depended on: ${B(j,T.mostDepended.file)} (${T.mostDepended.count} dependents)`);if(T.isolatedFiles.length>0)console.log(`Isolated files (no dependencies): ${T.isolatedFiles.length}`)}V.exit(M.hasCircular?1:0)}catch(Q){console.error("Error analyzing dependencies:",Q),V.exit(1)}});k.command("version","Show the version of dtsx").action(()=>{console.log(e)});k.version(e);k.help();k.parse();
@@ -56,29 +56,11 @@ export declare function unwrap<T>(branded: Brand<T, string>): T;
56
56
  * @defaultValue
57
57
  * ```ts
58
58
  * {
59
- * /**
60
- * * Join path segments, returning appropriate branded type
61
- * */
62
59
  * join: (base: DirectoryPath, ...segments: string[]) => unknown,
63
- * /**
64
- * * Get directory name from a file path
65
- * */
66
60
  * dirname: (path: FilePath) => unknown,
67
- * /**
68
- * * Get base name from a file path
69
- * */
70
61
  * basename: (path: FilePath) => unknown,
71
- * /**
72
- * * Resolve path to absolute
73
- * */
74
62
  * resolve: (...segments: string[]) => unknown,
75
- * /**
76
- * * Check if path is absolute
77
- * */
78
63
  * isAbsolute: (path: string) => unknown,
79
- * /**
80
- * * Get relative path from one path to another
81
- * */
82
64
  * relative: (from: DirectoryPath, to: FilePath) => unknown
83
65
  * }
84
66
  * ```
@@ -0,0 +1,17 @@
1
+ // @bun
2
+ var k=!1,M=null;function p(J){let Y="",X=0;while(X<J.length)if(J.charCodeAt(X)===47&&X+1<J.length&&J.charCodeAt(X+1)===42){X+=2;while(X<J.length-1){if(J.charCodeAt(X)===42&&J.charCodeAt(X+1)===47){X+=2;break}X++}}else Y+=J.charAt(X),X++;return Y.trim()}function t(){k=!0,M=null}function e(){k=!1;let J=M;return M=null,J}function g(J){let Y=J.length;if(Y===0)return!1;let X=0;if(J.charCodeAt(X)===45)X++;if(X>=Y)return!1;let $=X;while(X<Y&&J.charCodeAt(X)>=48&&J.charCodeAt(X)<=57)X++;if(X===$)return!1;if(X<Y&&J.charCodeAt(X)===46){X++;let z=X;while(X<Y&&J.charCodeAt(X)>=48&&J.charCodeAt(X)<=57)X++;if(X===z)return!1}return X===Y}function l(J){for(let Y=0,X=J.length-1;Y<X;Y++){let $=J.charCodeAt(Y);if($<48||$>57)return!1}return!0}function E(J,Y){let X=0,$=0;while(($=J.indexOf(Y,$))!==-1)X++,$+=Y.length;return X}function P(J){let Y=J.length,X=!1;for(let Z=1;Z<Y;Z++)if(J.charCodeAt(Z)<=32&&J.charCodeAt(Z-1)<=32){X=!0;break}if(!X)for(let Z=0;Z<Y;Z++){let H=J.charCodeAt(Z);if(H===10||H===13||H===9){X=!0;break}}if(!X)return J;let $=[],z=-1,B=!1;for(let Z=0;Z<Y;Z++)if(J.charCodeAt(Z)<=32){if(!B){if(z>=0)$.push(J.substring(z,Z));$.push(" "),B=!0,z=-1}}else{if(B||z<0)z=Z;B=!1}if(z>=0)$.push(J.substring(z));return $.join("")}function V(J,Y=!1,X=!1,$=0){if(!J||typeof J!=="string")return"unknown";if($>=20)return"unknown";let z=J.trim();if(z.startsWith("BigInt("))return"bigint";if(z.startsWith("Symbol.for("))return"symbol";if(z.includes(".raw`")||z.includes("String.raw`"))return"string";if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'")||z.startsWith("`")&&z.endsWith("`")){if(!z.includes("${")){if(!Y)return"string";return z}if(Y)return z;return"string"}if(g(z)){if(!Y)return"number";return z}if(z==="true"||z==="false"){if(!Y)return"boolean";return z}if(z==="null")return"null";if(z==="undefined")return"undefined";if(z.startsWith("[")&&z.endsWith("]"))return D(z,Y,$+1);if(z.startsWith("{")&&z.endsWith("}"))return i(z,Y,$+1);if(z.startsWith("new "))return d(z);if(z.includes("=>")||z.startsWith("function")||z.startsWith("async"))return u(z,X,$,Y);if(z.endsWith("as const")){let B=z.slice(0,-8).trim();if(B.startsWith("[")&&B.endsWith("]")){let Z=B.slice(1,-1).trim();if(!Z)return"readonly []";return`readonly [${U(Z).map((j)=>V(j.trim(),!0,!1,$+1)).join(", ")}]`}return V(B,!0,X,$+1)}if(z.startsWith("`")&&z.endsWith("`"))return c(z,Y);if(z.startsWith("Promise."))return y(z,Y,$);if(z.startsWith("await "))return"unknown";if(z.charCodeAt(z.length-1)===110&&z.length>1&&l(z)){if(Y)return z;return"bigint"}if(z.startsWith("Symbol(")||z==="Symbol.for")return"symbol";return"unknown"}function m(J,Y=!1,X=0){return V(J,Y,!0,X)}function c(J,Y){if(J.includes(".raw`")||J.includes("String.raw`"))return"string";if(!Y)return"string";if(!J.includes("${"))return J;return"string"}function d(J){let Y=4;while(Y<J.length&&J.charCodeAt(Y)<=32)Y++;let X=Y,$=J.charCodeAt(Y);if($<65||$>90)return"unknown";while(Y<J.length&&T(J.charCodeAt(Y)))Y++;if(Y===X)return"unknown";let z=J.slice(X,Y);{let B=J.slice(Y);if(B.startsWith("<")){let Z=0,H=-1;for(let Q=0;Q<B.length;Q++)if(B[Q]==="<")Z++;else if(B[Q]===">"){if(Z--,Z===0){H=Q;break}}if(H!==-1){let Q=B.slice(0,H+1);return`${z}${Q}`}}switch(z){case"Date":return"Date";case"Map":return"Map<any, any>";case"Set":return"Set<any>";case"WeakMap":return"WeakMap<any, any>";case"WeakSet":return"WeakSet<any>";case"RegExp":return"RegExp";case"Error":return"Error";case"Array":return"any[]";case"Object":return"object";case"Function":return"Function";case"Promise":return"Promise<any>";default:return z}}return"unknown"}function y(J,Y,X=0){if(J.startsWith("Promise.resolve(")){let z=J.indexOf(")",16);if(z!==-1){let B=J.slice(16,z).trim();if(B)return`Promise<${V(B,Y,!1,X+1)}>`}return"Promise<unknown>"}if(J.startsWith("Promise.reject("))return"Promise<never>";if(J.startsWith("Promise.all(")){let $=J.indexOf("[",12),z=J.lastIndexOf("]");if($!==-1&&z>$){let B=J.slice($+1,z).trim();return`Promise<[${U(B).map((Q)=>{let j=Q.trim();if(j.startsWith("Promise.resolve(")){let O=y(j,Y,X+1),G=O.indexOf("<"),K=O.lastIndexOf(">");return G!==-1&&K>G?O.slice(G+1,K):"unknown"}return V(j,Y,!1,X+1)}).join(", ")}]>`}return"Promise<unknown[]>"}return"Promise<unknown>"}function D(J,Y,X=0){let $=J.slice(1,-1).trim();if(!$)return"never[]";if(X>=20)return"unknown[]";let z=U($),B=!1;for(let G=0;G<z.length;G++){let K=z[G],F=K.length;while(F>0&&K.charCodeAt(F-1)<=32)F--;if(F>=8&&K.slice(F-8,F)==="as const"){B=!0;break}}if(B)return`readonly [
3
+ ${z.map((K)=>{let F=K.trim();if(F.endsWith("as const")){let L=F.slice(0,-8).trim();if(L.startsWith("[")&&L.endsWith("]")){let W=L.slice(1,-1).trim();return`readonly [${U(W).map((A)=>V(A.trim(),!0,!1,X+1)).join(", ")}]`}return V(L,!0,!1,X+1)}if(F.startsWith("[")&&F.endsWith("]"))return D(F,!0,X+1);return V(F,!0,!1,X+1)}).join(` |
4
+ `)}
5
+ ]`;let Z=k&&!Y,H=[],Q=[];for(let G of z){let K=G.trim(),F=M;if(M=null,K.startsWith("[")&&K.endsWith("]"))H.push(D(K,Y,X+1));else H.push(m(K,Y,X+1));if(Z)Q.push(M);M=F}if(Z)if(_(J))M=P(J);else{let G=[];for(let K=0;K<z.length;K++){let F=z[K].trim();if(F.endsWith("as const"))continue;if(w(F)||F==="null"||F==="undefined")G.push(F);else if(F.startsWith("[")&&_(F))G.push(P(F));else if(F.startsWith("{")){if(Q[K])G.push(Q[K])}else{let L=V(F,!1,!1,0);if(L!=="unknown")G.push(L)}}if(G.length>0)M=`[${G.join(", ")}]`}if(Y)return`readonly [${H.join(", ")}]`;let j=[],O=!0;for(let G of H){let K=!1;for(let F of j)if(G===F){K=!0;break}if(!K)j.push(G);if(O){if(!(g(G)||G==="true"||G==="false"||G.charCodeAt(0)===34&&G.charCodeAt(G.length-1)===34||G.charCodeAt(0)===39&&G.charCodeAt(G.length-1)===39))O=!1}}if(O&&H.length<=10)return`readonly [${H.join(", ")}]`;if(j.length===1)return`${j[0]}[]`;return`(${j.join(" | ")})[]`}function U(J){let Y=[],X=0,$=0,z=!1,B=0;for(let H=0;H<J.length;H++){let Q=J.charCodeAt(H);if(!z&&(Q===34||Q===39||Q===96))z=!0,B=Q;else if(z&&Q===B&&(H===0||J.charCodeAt(H-1)!==92))z=!1;if(!z){if(Q===91||Q===123||Q===40)$++;else if(Q===93||Q===125||Q===41)$--;else if(Q===44&&$===0){let j=J.substring(X,H).trim();if(j)Y.push(j);X=H+1;continue}}}let Z=J.substring(X).trim();if(Z)Y.push(Z);return Y}function w(J){if(g(J))return!0;if(J==="true"||J==="false")return!0;if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return!0;return!1}function s(J){return J==="number"||J==="string"||J==="boolean"}function _(J){let Y=!1,X=0,$=J.length;for(let z=0;z<$;z++){let B=J.charCodeAt(z);if(Y){if(B===92){z++;continue}if(B===X)Y=!1;continue}if(B===34||B===39||B===96){Y=!0,X=B;continue}if(B===61&&z+1<$&&J.charCodeAt(z+1)===62)return!1;if(B>=97&&B<=122){let Z=z;while(z<$&&(J.charCodeAt(z)>=97&&J.charCodeAt(z)<=122||J.charCodeAt(z)>=65&&J.charCodeAt(z)<=90||J.charCodeAt(z)>=48&&J.charCodeAt(z)<=57||J.charCodeAt(z)===95||J.charCodeAt(z)===36))z++;let H=J.slice(Z,z);if(H==="new"||H==="async"||H==="await"||H==="function"||H==="yield"||H==="console"||H==="process")return!1;let Q=z;while(Q<$&&J.charCodeAt(Q)<=32)Q++;if(Q<$&&J.charCodeAt(Q)===40)return!1;z--}}return!0}function i(J,Y,X=0){let $=J.slice(1,-1).trim();if(!$)return"{}";if(X>=20)return"Record<string, unknown>";let z=a($),B=[],Z=k&&!Y,H=[];for(let[Q,j]of z){let O=M;M=null;let G=V(j,Y,!1,X+1),K=M;if(M=O,G.includes("=>")||G.includes("function")||G.includes("async"))G=I(G);let F=j.trim();if(!Y&&s(G)&&w(F))B.push(`/** @defaultValue ${F} */
6
+ ${Q}: ${G}`);else B.push(`${Q}: ${G}`);if(Z){let L=p(Q);if(F.endsWith("as const"));else if(w(F))H.push(`${L}: ${F}`);else if(F.startsWith("[")&&_(F))H.push(`${L}: ${P(F)}`);else if(F.startsWith("{")){if(K)H.push(`${L}: ${K}`)}else if(!F.startsWith("[")&&(F.includes("=>")||F.startsWith("function")||F.startsWith("async"))){let W=u(F,!1,0,!0);H.push(`${L}: ${W}`)}}}if(Z&&H.length>0){let Q=X>0?(X-1)/2:0,j=`{ ${H.join(", ")} }`;if(j.length<=80)M=j;else{let O=" ".repeat((Q+1)*2),G=" ".repeat(Q*2);M=`{
7
+ ${O}${H.join(`,
8
+ ${O}`)}
9
+ ${G}}`}}return`{
10
+ ${B.join(`;
11
+ `)}
12
+ }`}function I(J){let X=J.split(`
13
+ `).map((O)=>h(O)).join(`
14
+ `),$=X.indexOf("async");if($!==-1){let O=$>0?X.charCodeAt($-1):32,G=$+5<X.length?X.charCodeAt($+5):32;if(!T(O)&&!T(G))X=(X.slice(0,$)+X.slice($+5)).trim()}let z=X.indexOf("(");if(z!==-1){let O=x(X,z,"(",")");if(O!==-1){let G=X.slice(z,O+1),K=b(G);X=X.slice(0,z)+K+X.slice(O+1)}}let B=X.length,Z="",H=[],Q=!1,j=!1;for(let O=0;O<B;O++){let G=X.charCodeAt(O);if(G===123||G===40)H.push(G);else if(G===125||G===41)H.pop();if(G<=32){if(Q=!0,G===10||G===13)j=!0;continue}if(Q&&Z.length>0){let F=(H.length>0?H[H.length-1]:0)===123;if(j&&F){let L=Z.charCodeAt(Z.length-1),W=L===59||L===44||L===123||G===125,q=Z.length>=2&&Z.charCodeAt(Z.length-1)===47&&Z.charCodeAt(Z.length-2)===42;if(!W&&!q)Z+="; ";else Z+=" "}else Z+=" "}Q=!1,j=!1,Z+=X[O]}return Z.trim()}function T(J){return J>=97&&J<=122||J>=65&&J<=90||J>=48&&J<=57||J===95||J===36}function b(J){let Y=J.trim(),X,$=!1;if(Y.startsWith("(")&&Y.endsWith(")"))X=Y.slice(1,-1),$=!0;else X=Y;let z=X.trim();if(!z)return $?"()":"";let B=!1;{let L=0;for(let W=0;W<z.length;W++){let q=z.charCodeAt(W);if(q===40||q===60||q===91||q===123)L++;else if(q===41||q===62||q===93||q===125)L--;else if(L===0&&q===61){let N=W>0?z.charCodeAt(W-1):0,A=W+1<z.length?z.charCodeAt(W+1):0;if(N!==61&&N!==33&&N!==60&&N!==62&&A!==61&&A!==62){B=!0;break}}}}if(!B)return Y;let Z=[],H=[],Q=0,j=0,O=!1,G=0;for(let L=0;L<=z.length;L++){if(L===z.length){Z.push(z.slice(Q));break}let W=z.charCodeAt(L);if(O){if(W===92){L++;continue}if(W===G)O=!1;continue}if(W===39||W===34||W===96){O=!0,G=W;continue}if(W===40||W===60||W===91||W===123)j++;else if(W===41||W===62||W===93||W===125)j--;else if(W===44&&j===0){Z.push(z.slice(Q,L));let q=",",N=L+1;while(N<z.length&&z.charCodeAt(N)<=32)q+=z[N],N++;H.push(q),Q=N}}let K=[];for(let L of Z){let W=L.trim();if(!W){K.push(L);continue}if(W.startsWith("//"))continue;let q=h(W),N=L.slice(0,L.length-L.trimStart().length);K.push(N+n(q))}let F=K[0]||"";for(let L=1;L<K.length;L++)F+=(H[L-1]||", ")+K[L];return $?`(${F})`:F}function h(J){let Y=!1,X=0;for(let $=0;$<J.length-1;$++){let z=J.charCodeAt($);if(Y){if(z===92){$++;continue}if(z===X)Y=!1;continue}if(z===39||z===34||z===96){Y=!0,X=z;continue}if(z===47&&J.charCodeAt($+1)===47)return J.slice(0,$).trimEnd()}return J}function n(J){if(J.startsWith("..."))return J;let Y=-1,X=-1,$=0,z=!1,B=0;for(let H=0;H<J.length;H++){let Q=J.charCodeAt(H);if(z){if(Q===92){H++;continue}if(Q===B)z=!1;continue}if(Q===39||Q===34||Q===96){z=!0,B=Q;continue}if(Q===40||Q===60||Q===91||Q===123)$++;else if(Q===41||Q===62||Q===93||Q===125)$--;else if($===0){if(Q===58&&Y===-1)Y=H;else if(Q===61&&X===-1&&(H===0||J.charCodeAt(H-1)!==61)&&(H+1>=J.length||J.charCodeAt(H+1)!==61&&J.charCodeAt(H+1)!==62))X=H}}let Z=X!==-1;if(Y!==-1&&(X===-1||Y<X)){let H=J.slice(0,Y).trim(),Q=X!==-1?J.slice(Y+1,X).trim():J.slice(Y+1).trim(),j=Z&&!H.endsWith("?")?"?":"";return`${H}${j}: ${Q}`}else if(X!==-1){let H=J.slice(0,X).trim(),Q=!H.endsWith("?")?"?":"",j=J.slice(X+1).trim(),O="unknown";if(j==="true"||j==="false")O="boolean";else if(/^-?\d+(\.\d+)?$/.test(j))O="number";else if(j.startsWith("'")&&j.endsWith("'")||j.startsWith('"')&&j.endsWith('"'))O="string";else if(j.startsWith("["))O="unknown[]";else if(j.startsWith("{"))O="Record<string, unknown>";return`${H}${Q}: ${O}`}return J}function a(J){let Y=[],X="",$="",z=0,B=!1,Z="",H=!0,Q=!1,j=0;for(let O=0;O<J.length;O++){let G=J[O],K=O>0?J[O-1]:"",F=O<J.length-1?J[O+1]:"";if(!B&&!Q&&G==="/"&&F==="/"){O+=2;while(O<J.length&&J[O]!==`
15
+ `)O++;continue}if(!B&&!Q&&G==="/"&&F==="*"){Q=!0,j=1,X+="/*",O++;continue}else if(Q&&G==="*"&&F==="/"){if(j--,X+="*/",O++,j===0)Q=!1;continue}else if(Q&&G==="/"&&F==="*"){j++,X+="/*",O++;continue}if(!B&&(G==='"'||G==="'"||G==="`"))B=!0,Z=G,X+=G;else if(B&&G===Z&&K!=="\\")B=!1,X+=G;else if(!B&&!Q)if(G==="("&&z===0&&H){if($=X.trim(),$.startsWith("async "))$=$.slice(6).trim();X=G,H=!1,z=1}else if(G==="{"||G==="["||G==="(")z++,X+=G;else if(G==="}"||G==="]"||G===")")z--,X+=G;else if(G===":"&&z===0&&H)$=X.trim(),X="",H=!1;else if(G===","&&z===0){if($&&X.trim()){let L=X.trim();if(L.startsWith("("))L=C($,L);else if(L.includes("=>")||L.includes("function")||L.includes("async"))L=I(L);Y.push([$,L])}X="",$="",H=!0}else X+=G;else X+=G}if($&&X.trim()){let O=X.trim();if(O.startsWith("("))O=C($,O);else if(O.includes("=>")||O.includes("function")||O.includes("async"))O=I(O);Y.push([$,O])}return Y}function C(J,Y){let X=Y,$=0;while($<X.length&&X.charCodeAt($)<=32)$++;if(X.startsWith("async",$)&&$+5<X.length&&X.charCodeAt($+5)<=32)X=X.slice($+5).trimStart();let z="";if(X.charCodeAt(0)===60){let G=0,K=-1;for(let F=0;F<X.length;F++)if(X.charCodeAt(F)===60)G++;else if(X.charCodeAt(F)===62){if(G--,G===0){K=F;break}}if(K!==-1)z=X.slice(0,K+1),X=X.slice(K+1).trimStart()}let B=X.indexOf("("),Z=x(X,B,"(",")");if(B===-1||Z===-1)return"() => unknown";let H=X.slice(B,Z+1),Q="unknown",j=X.slice(Z+1).trimStart();if(j.charCodeAt(0)===58){let G=j.indexOf("{");if(G!==-1)Q=j.slice(1,G).trim();else Q=j.slice(1).trim()}let O=b(H);return`${z}${O} => ${Q}`}function x(J,Y,X,$){let z=0;for(let B=Y;B<J.length;B++)if(J[B]===X)z++;else if(J[B]===$){if(z--,z===0)return B}return-1}function r(J){let Y=0,X=0,$=!1,z="";for(let B=0;B<J.length-1;B++){let Z=J[B],H=J[B+1],Q=B>0?J[B-1]:"";if(!$&&(Z==='"'||Z==="'"||Z==="`"))$=!0,z=Z;else if($&&Z===z&&Q!=="\\")$=!1;if(!$){if(Z==="(")Y++;else if(Z===")")Y--;else if(Z==="[")X++;else if(Z==="]")X--;if(Z==="="&&H===">"&&Y===0&&X===0)return B}}return-1}function u(J,Y=!1,X=0,$=!0){let z=J.trim();if(z.length>200&&E(z,"=>")>2&&E(z,"<")>5&&!z.startsWith("function"))return Y?"((...args: any[]) => any)":"(...args: any[]) => any";if(z.startsWith("async ")&&z.includes("=>")){let Z=z.slice(5).trim(),H=Z.indexOf("=>"),Q=Z.substring(0,H).trim(),j=Z.substring(H+2).trim();if(Q=b(Q),Q==="()"||Q==="")Q="()";else if(!Q.startsWith("("))Q=`(${Q})`;let O="unknown";if(j.startsWith("{"))O="unknown";else O=V(j,$,!1,X+1);let G=`${Q} => Promise<${O}>`;return Y?`(${G})`:G}if(z.includes("=>")){let Z="",H=z;if(z.startsWith("<")){let W=x(z,0,"<",">");if(W!==-1)Z=z.substring(0,W+1),H=z.substring(W+1).trim()}let Q=r(H);if(Q===-1)return Y?"(() => unknown)":"() => unknown";let j=H.substring(0,Q).trim(),O=H.substring(Q+2).trim(),G="",K=j.lastIndexOf("):");if(K!==-1){let W=j.substring(K+2).trim();if(W&&!W.includes("=>")&&!W.includes("="))G=W,j=j.substring(0,K+1)}if(j=b(j),j==="()"||j==="")j="()";else if(!j.startsWith("("))j=`(${j})`;let F="unknown";if(G)F=G;else if(O.startsWith("{"))F="unknown";else if(O.includes("=>")){let W=O.trimStart(),q=W.indexOf("("),N=q!==-1?W.indexOf(")",q):-1,A=N!==-1?W.indexOf("=>",N):-1;if(q===0&&N!==-1&&A!==-1){let R=W.substring(q+1,N).trim();if(Z.includes("T")&&R.includes("T"))F=`(${R}) => T`;else F=`(${R}) => any`}else F="any"}else if(Y)F="unknown";else F=V(O,$,!1,X+1);let L=`${Z}${j} => ${F}`;return Y?`(${L})`:L}if(z.startsWith("function")){let Z=8,H=z.length;while(Z<H&&z.charCodeAt(Z)<=32)Z++;let Q=!1;if(Z<H&&z.charCodeAt(Z)===42){Q=!0,Z++;while(Z<H&&z.charCodeAt(Z)<=32)Z++}let j="";if(Z<H&&z.charCodeAt(Z)===60){let K=Z,F=1;Z++;while(Z<H&&F>0){let L=z.charCodeAt(Z);if(L===60)F++;else if(L===62)F--;Z++}j=z.substring(K,Z);while(Z<H&&z.charCodeAt(Z)<=32)Z++}let O=z.indexOf("(",Z);if(O!==-1){let K=1,F=O+1;while(F<H&&K>0){let N=z.charCodeAt(F);if(N===40)K++;else if(N===41)K--;F++}let L=z.substring(O+1,F-1).trim(),W=L?`(${L})`:"()";if(Q){let N=z.substring(F).trim(),A=N.indexOf("Generator<");if(A!==-1){let S=A+10,f=N.indexOf(">",S);if(f!==-1){let o=N.substring(S,f),v=`${j}${W} => Generator<${o}>`;return Y?`(${v})`:v}}let R=`${j}${W} => Generator<any, any, any>`;return Y?`(${R})`:R}let q=`${j}${W} => unknown`;return Y?`(${q})`:q}let G="(...args: any[]) => unknown";return Y?`(${G})`:G}if(z.includes("=>")&&z.includes("(")&&z.includes(")")){if(z.length>100||E(z,"=>")>2){let Z="";if(z.charCodeAt(0)===60){let G=z.indexOf(">");if(G!==-1)Z=z.substring(0,G+1)}let H=z.indexOf("("),Q=H!==-1?z.indexOf(")",H):-1,j=H!==-1&&Q!==-1?z.substring(H,Q+1):"(...args: any[])",O=`${Z}${j} => any`;return Y?`(${O})`:O}return Y?`(${z})`:z}let B="() => unknown";return Y?`(${B})`:B}function zz(J){let Y=J.trim();if(Y==="any"||Y==="object"||Y==="unknown")return!0;if(Y.startsWith("Record<")&&Y.endsWith(">"))return!0;if(Y.startsWith("Array<")&&Y.endsWith(">"))return!0;if(/^\{\s*\[[^\]]*\]:\s*(any|string|number|unknown)\s*\}$/.test(Y))return!0;return!1}function Jz(J){let Y=J.lastIndexOf(" satisfies ");if(Y===-1)return null;let X=J.slice(Y+11).trim();if(X.endsWith(";"))X=X.slice(0,-1).trim();return X||null}function Yz(J){let Y=[],X=0;for(let $=0;$<=J.length;$++)if($===J.length||J[$]===`
16
+ `){let z=X,B=$;while(z<B&&(J[z]===" "||J[z]==="\t"||J[z]==="\r"))z++;while(B>z&&(J[B-1]===" "||J[B-1]==="\t"||J[B-1]==="\r"))B--;let Z=J.slice(z,B);if(X=$+1,Z.startsWith("///")){if(Z.match(/^\/\/\/\s*<reference\s+(path|types|lib|no-default-lib)\s*=\s*["'][^"']+["']\s*\/>/))Y.push(Z);else if(Z.match(/^\/\/\/\s*<amd-module\s+name\s*=\s*["'][^"']+["']\s*\/>/))Y.push(Z);else if(Z.match(/^\/\/\/\s*<amd-dependency\s+path\s*=\s*["'][^"']+["']/))Y.push(Z)}else if(Z===""||Z.startsWith("//"))continue;else break}return Y}
17
+ export{t as Cc,e as Dc,V as Ec,m as Fc,D as Gc,U as Hc,i as Ic,x as Jc,u as Kc,zz as Lc,Jz as Mc,Yz as Nc};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{a,b,c}from"./chunk-efkpkyz9.js";import"./chunk-2w3g3g00.js";import"./chunk-p1d09y82.js";import"./chunk-gpxdn99a.js";import"./chunk-me2ae6f0.js";import"./chunk-0fhq2wva.js";import"./chunk-rw6j20e2.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-fbqcsr60.js";import"./chunk-9mjc7ddv.js";import"./chunk-p1d09y82.js";import"./chunk-74j5mydx.js";import"./chunk-rnt0wkrk.js";import"./chunk-j22v8wfe.js";import"./chunk-dk2vv0np.js";import"./chunk-rw6j20e2.js";export{f as startLSPServer,g as createFileWatcher,b as SymbolKind,a as LspDiagnosticSeverity,e as DtsxLanguageServer,d as DocumentHighlightKind,c as CompletionItemKind};
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-jddkdjap.js";import"./chunk-2w3g3g00.js";import"./chunk-p1d09y82.js";import"./chunk-gpxdn99a.js";import"./chunk-me2ae6f0.js";import"./chunk-97pgeywh.js";import"./chunk-0fhq2wva.js";import"./chunk-rw6j20e2.js";export{f as startLSPServer,g as createFileWatcher,b as SymbolKind,a as LspDiagnosticSeverity,e as DtsxLanguageServer,d as DocumentHighlightKind,c as CompletionItemKind};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ec as K}from"./chunk-9mjc7ddv.js";import{Vc as _}from"./chunk-57agx6g8.js";import{existsSync as j,mkdirSync as w,readFileSync as b,writeFileSync as V}from"fs";import{basename as H,join as R}from"path";function N(q){let z={description:"",params:[],examples:[],tags:{},see:[],throws:[]};if(!q||q.length===0)return z;for(let A of q){let G=A.replace(/^\/\*\*/,"").replace(/\*\/$/,"").split(`
2
+ import{ec as K}from"./chunk-2w3g3g00.js";import{Vc as _}from"./chunk-57agx6g8.js";import{existsSync as j,mkdirSync as w,readFileSync as b,writeFileSync as V}from"fs";import{basename as H,join as R}from"path";function N(q){let z={description:"",params:[],examples:[],tags:{},see:[],throws:[]};if(!q||q.length===0)return z;for(let A of q){let G=A.replace(/^\/\*\*/,"").replace(/\*\/$/,"").split(`
3
3
  `).map((X)=>X.replace(/^\s*\*\s?/,"")).join(`
4
4
  `).trim(),Q=G.search(/@\w+/);if(Q===-1){z.description=G;continue}else if(Q>0)z.description=G.slice(0,Q).trim(),G=G.slice(Q);let U=/@(\w+)(?:\s+\{([^}]+)\})?\s*([^\n@]*(?:\n(?!@)[^\n@]*)*)/g,W;while((W=U.exec(G))!==null){let[,X,Y,Z]=W,$=Z.trim();switch(X){case"param":{let v=$.match(/^(\[)?(\w+)\]?\s*(?:-\s*)?(.*)/);if(v)z.params.push({name:v[2],type:Y,description:v[3].trim(),optional:!!v[1]});break}case"returns":case"return":z.returns={type:Y,description:$};break;case"example":z.examples.push($);break;case"deprecated":z.deprecated=$||"Deprecated";break;case"since":z.since=$;break;case"see":z.see.push($);break;case"throws":case"throw":z.throws.push({type:Y,description:$});break;case"category":z.category=$;break;default:if(!z.tags[X])z.tags[X]=[];z.tags[X].push($)}}}return z}function M(q,z){let A=N(q.leadingComments),G="";switch(q.kind){case"function":G=h(q);break;case"variable":G=T(q);break;case"interface":G=F(q);break;case"type":G=S(q);break;case"class":G=k(q);break;case"enum":G=x(q);break;default:G=q.text||q.name}let Q={name:q.name,kind:q.kind,signature:G,jsdoc:A,isExported:q.isExported,isDefault:q.isDefault,sourceFile:z};if(q.members&&q.members.length>0)Q.members=q.members.map((U)=>M(U,z));return Q}function h(q){let z=[];if(q.isExported)z.push("export");if(q.isDefault)z.push("default");if(z.push("function"),z.push(q.name),q.generics)z.push(q.generics);if(q.parameters){let A=q.parameters.map((G)=>{let Q="";if(G.rest)Q+="...";if(Q+=G.name,G.optional)Q+="?";if(G.type)Q+=`: ${G.type}`;return Q}).join(", ");z.push(`(${A})`)}else z.push("()");if(q.returnType)z.push(`: ${q.returnType}`);return z.join(" ").replace(/\s+/g," ")}function T(q){let z=[];if(q.isExported)z.push("export");if(z.push("const"),z.push(q.name),q.typeAnnotation)z.push(`: ${q.typeAnnotation}`);return z.join(" ")}function F(q){let z=[];if(q.isExported)z.push("export");if(z.push("interface"),z.push(q.name),q.generics)z.push(q.generics);if(q.extends)z.push(`extends ${q.extends}`);return z.join(" ")}function S(q){let z=[];if(q.isExported)z.push("export");if(z.push("type"),z.push(q.name),q.generics)z.push(q.generics);if(z.push("="),q.typeAnnotation)z.push(q.typeAnnotation);return z.join(" ")}function k(q){let z=[];if(q.isExported)z.push("export");if(q.isDefault)z.push("default");if(z.push("class"),z.push(q.name),q.generics)z.push(q.generics);if(q.extends)z.push(`extends ${q.extends}`);if(q.implements&&q.implements.length>0)z.push(`implements ${q.implements.join(", ")}`);return z.join(" ")}function x(q){let z=[];if(q.isExported)z.push("export");return z.push("enum"),z.push(q.name),z.join(" ")}async function P(q,z={}){let A=[],G=new Map;for(let Q of q){if(!j(Q)){_.warn(`File not found: ${Q}`);continue}let U=b(Q,"utf-8"),W=K(U,Q,!0);for(let X of W){if(X.kind==="import")continue;if(!z.includePrivate&&X.name.startsWith("_"))continue;if(!z.includeInternal&&X.leadingComments?.some((Z)=>Z.includes("@internal")))continue;let Y=M(X,Q);if(A.push(Y),z.groupByCategory&&Y.jsdoc.category){let Z=Y.jsdoc.category;if(!G.has(Z))G.set(Z,[]);G.get(Z).push(Y)}}}return{title:z.title||"API Documentation",description:z.description,entries:A,categories:G,generatedAt:new Date}}function B(q,z={}){let A=[];if(A.push(`# ${q.title}`),A.push(""),q.description)A.push(q.description),A.push("");if(A.push(`> Generated on ${q.generatedAt.toISOString()}`),A.push(""),A.push("## Table of Contents"),A.push(""),z.groupByCategory&&q.categories.size>0)for(let G of q.categories.keys())A.push(`- [${G}](#${E(G)})`);else{let G=I(q.entries);for(let[Q,U]of G)if(U.length>0)A.push(`- [${O(Q)}](#${E(O(Q))})`)}if(A.push(""),z.groupByCategory&&q.categories.size>0)for(let[G,Q]of q.categories){A.push(`## ${G}`),A.push("");for(let U of Q)A.push(...L(U,z))}else{let G=I(q.entries);for(let[Q,U]of G)if(U.length>0){A.push(`## ${O(Q)}`),A.push("");for(let W of U)A.push(...L(W,z))}}return A.join(`
5
5
  `)}function L(q,z){let A=[];if(A.push(`### ${q.name}`),A.push(""),q.jsdoc.deprecated)A.push(`> **Deprecated:** ${q.jsdoc.deprecated}`),A.push("");if(A.push("```typescript"),A.push(q.signature),A.push("```"),A.push(""),q.jsdoc.description)A.push(q.jsdoc.description),A.push("");if(q.jsdoc.params.length>0){A.push("**Parameters:**"),A.push(""),A.push("| Name | Type | Description |"),A.push("|------|------|-------------|");for(let G of q.jsdoc.params){let Q=G.optional?" (optional)":"",U=G.type||"any";A.push(`| \`${G.name}\`${Q} | \`${U}\` | ${G.description} |`)}A.push("")}if(q.jsdoc.returns){A.push("**Returns:**"),A.push("");let G=q.jsdoc.returns.type?`\`${q.jsdoc.returns.type}\``:"";A.push(`${G} ${q.jsdoc.returns.description}`),A.push("")}if(q.jsdoc.throws.length>0){A.push("**Throws:**"),A.push("");for(let G of q.jsdoc.throws){let Q=G.type?`\`${G.type}\``:"";A.push(`- ${Q} ${G.description}`)}A.push("")}if(q.jsdoc.examples.length>0){A.push("**Examples:**"),A.push("");for(let G of q.jsdoc.examples)A.push("```typescript"),A.push(G),A.push("```"),A.push("")}if(q.jsdoc.see.length>0){A.push("**See also:**"),A.push("");for(let G of q.jsdoc.see)A.push(`- ${G}`);A.push("")}if(q.jsdoc.since)A.push(`*Since: ${q.jsdoc.since}*`),A.push("");if(z.includeSourceLinks&&q.sourceFile){let G=q.sourceFile;if(z.sourceBaseUrl)A.push(`[Source](${z.sourceBaseUrl}/${G})`);else A.push(`*Source: ${G}*`);A.push("")}if(q.members&&q.members.length>0){A.push("**Members:**"),A.push("");for(let G of q.members)if(A.push(`#### ${G.name}`),A.push(""),A.push("```typescript"),A.push(G.signature),A.push("```"),A.push(""),G.jsdoc.description)A.push(G.jsdoc.description),A.push("")}return A.push("---"),A.push(""),A}function C(q,z={}){let A=B(q,z);return`<!DOCTYPE html>
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{hc as D}from"./chunk-p1d09y82.js";import{kc as p,lc as Jq,mc as Oq}from"./chunk-74j5mydx.js";import{Ec as wq}from"./chunk-dk2vv0np.js";import{ad as E}from"./chunk-rw6j20e2.js";var z=E(D(),1);var I=E(D(),1);var A=new Map,S=new Map,Gq=100;function _q(){if(A.size<=Gq)return;let q=null,$=1/0;for(let[W,Q]of A)if(Q.lastAccess<$)$=Q.lastAccess,q=W;if(q)A.delete(q)}function jq(){A.clear()}function Bq(){return A.size}var Uq={asyncThreshold:1e5,chunkSize:50000,yieldInterval:0};function u(q){return new Promise(($)=>{if(q===0)if(typeof setImmediate<"u")setImmediate($);else setTimeout($,0);else setTimeout($,q)})}async function zq(q,$,W){if($.length<W.asyncThreshold)return I.createSourceFile(q,$,I.ScriptTarget.Latest,!0,I.ScriptKind.TS);await u(W.yieldInterval);let Q=I.createSourceFile(q,$,I.ScriptTarget.Latest,!1,I.ScriptKind.TS);return await u(W.yieldInterval),Q}async function g(q,$,W={}){let Q={...Uq,...W},V=p($),j=q,U=Date.now(),X=A.get(j);if(X&&X.contentHash===V)return X.lastAccess=U,X.sourceFile;let Z=S.get(j);if(Z)return Z;let w=(async()=>{try{let H=await zq(q,$,Q);return A.set(j,{sourceFile:H,contentHash:V,lastAccess:U}),_q(),H}finally{S.delete(j)}})();return S.set(j,w),w}async function Lq(q,$={}){let W=$.concurrency??4,Q=new Map,V=[];for(let j=0;j<q.length;j+=W){let U=q.slice(j,j+W),X=await Promise.allSettled(U.map(async({filePath:Z,sourceCode:w})=>{let H=await g(Z,w,$);return{filePath:Z,sourceFile:H}}));for(let Z of X)if(Z.status==="fulfilled")Q.set(Z.value.filePath,Z.value.sourceFile);else V.push({filePath:U[X.indexOf(Z)].filePath,error:Z.reason});if(j+W<q.length)await u(0)}if(V.length>0)console.warn(`[dtsx] ${V.length} file(s) failed to parse:`,V.map((j)=>j.filePath));return Q}function Iq(q,$={}){let W=$.asyncThreshold??Uq.asyncThreshold;return q.length>=W}function vq(){return S.size}var R=E(D(),1);var Y=E(D(),1);var B=E(D(),1);function M(q,$,W){return $.slice(W?q.getStart(W):q.getStart(),q.getEnd())}function L(q,$){let W=[],Q=q.getFullStart(),V=q.getStart($);if(Q!==V){let j=$.text.substring(Q,V),U=j.match(/\/\*\*[\s\S]*?\*\//g);if(U)W.push(...U);let X=j.match(/\/\*(?!\*)[\s\S]*?\*\//g);if(X)W.push(...X);let Z=j.split(`
2
+ import{hc as D}from"./chunk-p1d09y82.js";import{kc as p,lc as Jq,mc as Oq}from"./chunk-gpxdn99a.js";import{Ec as wq}from"./chunk-0fhq2wva.js";import{ad as E}from"./chunk-rw6j20e2.js";var z=E(D(),1);var I=E(D(),1);var A=new Map,S=new Map,Gq=100;function _q(){if(A.size<=Gq)return;let q=null,$=1/0;for(let[W,Q]of A)if(Q.lastAccess<$)$=Q.lastAccess,q=W;if(q)A.delete(q)}function jq(){A.clear()}function Bq(){return A.size}var Uq={asyncThreshold:1e5,chunkSize:50000,yieldInterval:0};function u(q){return new Promise(($)=>{if(q===0)if(typeof setImmediate<"u")setImmediate($);else setTimeout($,0);else setTimeout($,q)})}async function zq(q,$,W){if($.length<W.asyncThreshold)return I.createSourceFile(q,$,I.ScriptTarget.Latest,!0,I.ScriptKind.TS);await u(W.yieldInterval);let Q=I.createSourceFile(q,$,I.ScriptTarget.Latest,!1,I.ScriptKind.TS);return await u(W.yieldInterval),Q}async function g(q,$,W={}){let Q={...Uq,...W},V=p($),j=q,U=Date.now(),X=A.get(j);if(X&&X.contentHash===V)return X.lastAccess=U,X.sourceFile;let Z=S.get(j);if(Z)return Z;let w=(async()=>{try{let H=await zq(q,$,Q);return A.set(j,{sourceFile:H,contentHash:V,lastAccess:U}),_q(),H}finally{S.delete(j)}})();return S.set(j,w),w}async function Lq(q,$={}){let W=$.concurrency??4,Q=new Map,V=[];for(let j=0;j<q.length;j+=W){let U=q.slice(j,j+W),X=await Promise.allSettled(U.map(async({filePath:Z,sourceCode:w})=>{let H=await g(Z,w,$);return{filePath:Z,sourceFile:H}}));for(let Z of X)if(Z.status==="fulfilled")Q.set(Z.value.filePath,Z.value.sourceFile);else V.push({filePath:U[X.indexOf(Z)].filePath,error:Z.reason});if(j+W<q.length)await u(0)}if(V.length>0)console.warn(`[dtsx] ${V.length} file(s) failed to parse:`,V.map((j)=>j.filePath));return Q}function Iq(q,$={}){let W=$.asyncThreshold??Uq.asyncThreshold;return q.length>=W}function vq(){return S.size}var R=E(D(),1);var Y=E(D(),1);var B=E(D(),1);function M(q,$,W){return $.slice(W?q.getStart(W):q.getStart(),q.getEnd())}function L(q,$){let W=[],Q=q.getFullStart(),V=q.getStart($);if(Q!==V){let j=$.text.substring(Q,V),U=j.match(/\/\*\*[\s\S]*?\*\//g);if(U)W.push(...U);let X=j.match(/\/\*(?!\*)[\s\S]*?\*\//g);if(X)W.push(...X);let Z=j.split(`
3
3
  `),w=[];for(let H=Z.length-1;H>=0;H--){let O=Z[H].trim();if(O.startsWith("//"))w.unshift(O);else if(O==="")continue;else break}if(w.length>0)W.push(w.join(`
4
4
  `))}return W}function P(q,$){if(B.isObjectBindingPattern(q.name)){let W=q.name.elements.map((Q)=>{if(B.isBindingElement(Q)&&B.isIdentifier(Q.name))return Q.name.getText($);return""}).filter(Boolean);if(W.length>3)return`{
5
5
  ${W.join(`,
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{tb as y}from"./chunk-3mxzfgcv.js";import{Vc as H,Xc as F}from"./chunk-57agx6g8.js";import{cd as R}from"./chunk-rw6j20e2.js";import{existsSync as V,readFileSync as G}from"fs";import{dirname as M,join as X,resolve as x}from"path";async function S(E){let A=[],z=new Set;async function q(I,L){let w=x(I);if(z.has(w))return;if(z.add(w),!V(w)){H.warn(`tsconfig not found: ${w}`);return}try{let O=G(w,"utf-8").replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,""),K=JSON.parse(O),U=M(w),Y=B(U,L),W=[];if(K.references)for(let D of K.references){let $=x(U,D.path),J=V(X($,"tsconfig.json"))?X($,"tsconfig.json"):$;await q(J,Y);let b=B(M(J),Y);W.push(b)}let Z="./src";if(K.compilerOptions?.rootDir)Z=K.compilerOptions.rootDir;else if(K.include&&K.include.length>0){if(K.include[0].startsWith("src/"))Z="./src"}let _="./dist";if(K.compilerOptions?.outDir)_=K.compilerOptions.outDir;else if(K.compilerOptions?.declarationDir)_=K.compilerOptions.declarationDir;A.push({name:Y,root:U,tsconfigPath:w,references:W,config:{root:Z,outdir:_}})}catch(Q){let O=Q instanceof Error?Q.message:String(Q);H.warn(`Failed to parse ${w}: ${O}`)}}return await q(E),A}function B(E,A){let z=X(E,"package.json");if(V(z))try{let I=G(z,"utf-8"),L=JSON.parse(I);if(L.name)return L.name}catch{}let q=E.split("/").pop()||"unknown";return A?`${A}/${q}`:q}function N(E){let A=new Map(E.map((w)=>[w.name,w])),z=[],q=new Set,I=new Set;function L(w){if(q.has(w))return;if(I.has(w)){H.warn(`Circular dependency detected involving: ${w}`);return}I.add(w);let Q=A.get(w);if(Q){for(let O of Q.references)L(O);z.push(Q)}I.delete(w),q.add(w)}for(let w of E)L(w.name);return z}async function T(E){let A=Date.now(),z=N(E.projects);H.info(`Generating declarations for ${z.length} projects...`);let q=[],I=!0;for(let O of z){H.info(`
2
+ import{tb as y}from"./chunk-8dx98fd5.js";import{Vc as H,Xc as F}from"./chunk-57agx6g8.js";import{cd as R}from"./chunk-rw6j20e2.js";import{existsSync as V,readFileSync as G}from"fs";import{dirname as M,join as X,resolve as x}from"path";async function S(E){let A=[],z=new Set;async function q(I,L){let w=x(I);if(z.has(w))return;if(z.add(w),!V(w)){H.warn(`tsconfig not found: ${w}`);return}try{let O=G(w,"utf-8").replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,""),K=JSON.parse(O),U=M(w),Y=B(U,L),W=[];if(K.references)for(let D of K.references){let $=x(U,D.path),J=V(X($,"tsconfig.json"))?X($,"tsconfig.json"):$;await q(J,Y);let b=B(M(J),Y);W.push(b)}let Z="./src";if(K.compilerOptions?.rootDir)Z=K.compilerOptions.rootDir;else if(K.include&&K.include.length>0){if(K.include[0].startsWith("src/"))Z="./src"}let _="./dist";if(K.compilerOptions?.outDir)_=K.compilerOptions.outDir;else if(K.compilerOptions?.declarationDir)_=K.compilerOptions.declarationDir;A.push({name:Y,root:U,tsconfigPath:w,references:W,config:{root:Z,outdir:_}})}catch(Q){let O=Q instanceof Error?Q.message:String(Q);H.warn(`Failed to parse ${w}: ${O}`)}}return await q(E),A}function B(E,A){let z=X(E,"package.json");if(V(z))try{let I=G(z,"utf-8"),L=JSON.parse(I);if(L.name)return L.name}catch{}let q=E.split("/").pop()||"unknown";return A?`${A}/${q}`:q}function N(E){let A=new Map(E.map((w)=>[w.name,w])),z=[],q=new Set,I=new Set;function L(w){if(q.has(w))return;if(I.has(w)){H.warn(`Circular dependency detected involving: ${w}`);return}I.add(w);let Q=A.get(w);if(Q){for(let O of Q.references)L(O);z.push(Q)}I.delete(w),q.add(w)}for(let w of E)L(w.name);return z}async function T(E){let A=Date.now(),z=N(E.projects);H.info(`Generating declarations for ${z.length} projects...`);let q=[],I=!0;for(let O of z){H.info(`
3
3
  [${O.name}] Generating...`);try{let K={...E.sharedConfig,...O.config,cwd:O.root,tsconfigPath:O.tsconfigPath},U=await y(K),Y=U.filesFailed===0;if(!Y)I=!1;q.push({name:O.name,stats:U,success:Y}),H.info(`[${O.name}] Generated ${U.filesGenerated} files`)}catch(K){I=!1;let U=K instanceof Error?K.message:String(K);q.push({name:O.name,stats:{filesProcessed:0,filesGenerated:0,filesFailed:0,filesValidated:0,validationErrors:0,declarationsFound:0,importsProcessed:0,exportsProcessed:0,durationMs:0,errors:[]},success:!1,error:U}),H.error(`[${O.name}] Failed: ${U}`)}}let L=Date.now()-A,w=q.filter((O)=>O.success).length,Q=q.length-w;if(H.info(`
4
4
  --- Workspace Generation Summary ---`),H.info(`Projects processed: ${q.length}`),H.info(`Successful: ${w}`),Q>0)H.info(`Failed: ${Q}`);return H.info(`Total duration: ${L}ms`),H.info(`------------------------------------
5
5
  `),{success:I,projects:q,durationMs:L}}async function f(E,A){if(A?.logLevel)F(A.logLevel);let z=X(E,"tsconfig.json");if(!V(z))throw Error(`Root tsconfig.json not found at: ${z}`);H.info("Discovering workspace projects...");let q=await S(z);if(q.length===0)return H.warn("No projects found in workspace"),{success:!0,projects:[],durationMs:0};return H.info(`Found ${q.length} projects`),T({root:E,projects:q,sharedConfig:A})}async function v(E){let A=X(E,"package.json");if(!V(A))return[];try{let z=G(A,"utf-8"),q=JSON.parse(z),I=[];if(Array.isArray(q.workspaces))I=q.workspaces;else if(q.workspaces?.packages)I=q.workspaces.packages;return I}catch{return[]}}async function C(E,A){let{Glob:z}=awaitPromise.resolve(globalThis.Bun),q=[];for(let I of A){let L=new z(I);for await(let w of L.scan({cwd:E,absolute:!0,onlyFiles:!1})){let Q=X(w,"package.json");if(V(Q))q.push(w)}}return q}async function l(E,A){if(A?.logLevel)F(A.logLevel);let z=await v(E);if(z.length===0)return H.warn("No workspace patterns found in package.json"),{success:!0,projects:[],durationMs:0};H.info(`Found workspace patterns: ${z.join(", ")}`);let q=await C(E,z);if(q.length===0)return H.warn("No projects found matching workspace patterns"),{success:!0,projects:[],durationMs:0};H.info(`Found ${q.length} workspace packages`);let I=q.map((L)=>{let w=X(L,"tsconfig.json");return{name:B(L),root:L,tsconfigPath:V(w)?w:"",references:[]}});return T({root:E,projects:I,sharedConfig:A})}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ic as a,jc as b}from"./chunk-qn0xktfx.js";import"./chunk-gpxdn99a.js";import"./chunk-me2ae6f0.js";import"./chunk-97pgeywh.js";import"./chunk-0fhq2wva.js";import"./chunk-rw6j20e2.js";export{b as processSourceDirect,a as processSource};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as I}from"./chunk-3mxzfgcv.js";class H{options;generateOptions;constructor(j={}){let{onCompile:F=!1,afterEmit:w=!0,onWatchRun:q=!1,onGenerated:z,onError:B,...J}=j;this.options={onCompile:F,afterEmit:w,onWatchRun:q,onGenerated:z,onError:B},this.generateOptions=J}apply(j){if(!this.generateOptions.outdir&&j.options.output?.path)this.generateOptions.outdir=j.options.output.path;if(!this.generateOptions.cwd&&j.options.context)this.generateOptions.cwd=j.options.context;if(!this.generateOptions.entrypoints&&j.options.entry){let w=j.options.entry;if(typeof w==="string")this.generateOptions.entrypoints=[w];else if(Array.isArray(w))this.generateOptions.entrypoints=w;else if(typeof w==="object"&&w!==null){let q=[];for(let z of Object.values(w))if(typeof z==="string")q.push(z);else if(Array.isArray(z))q.push(...z.filter((B)=>typeof B==="string"));else if(typeof z==="object"&&z!==null&&"import"in z){let B=z.import;if(typeof B==="string")q.push(B);else if(Array.isArray(B))q.push(...B)}if(q.length>0)this.generateOptions.entrypoints=q}}if(this.options.onCompile)j.hooks.compile.tap("DtsxWebpackPlugin",()=>{this.runGenerate()});if(this.options.afterEmit)j.hooks.afterEmit.tapAsync("DtsxWebpackPlugin",async(w,q)=>{await this.runGenerate(),q()});if(this.options.onWatchRun)j.hooks.watchRun.tapAsync("DtsxWebpackPlugin",async(w,q)=>{await this.runGenerate(),q()})}async runGenerate(){try{let j=await I(this.generateOptions);this.options.onGenerated?.(j)}catch(j){let F=j instanceof Error?j:Error(String(j));if(this.options.onError?.(F),!this.options.onError)console.error("[dtsx] Generation failed:",F.message)}}}function K(j={}){return new H(j)}var M=K,Q=H;
2
+ import{tb as I}from"./chunk-8dx98fd5.js";class H{options;generateOptions;constructor(j={}){let{onCompile:F=!1,afterEmit:w=!0,onWatchRun:q=!1,onGenerated:z,onError:B,...J}=j;this.options={onCompile:F,afterEmit:w,onWatchRun:q,onGenerated:z,onError:B},this.generateOptions=J}apply(j){if(!this.generateOptions.outdir&&j.options.output?.path)this.generateOptions.outdir=j.options.output.path;if(!this.generateOptions.cwd&&j.options.context)this.generateOptions.cwd=j.options.context;if(!this.generateOptions.entrypoints&&j.options.entry){let w=j.options.entry;if(typeof w==="string")this.generateOptions.entrypoints=[w];else if(Array.isArray(w))this.generateOptions.entrypoints=w;else if(typeof w==="object"&&w!==null){let q=[];for(let z of Object.values(w))if(typeof z==="string")q.push(z);else if(Array.isArray(z))q.push(...z.filter((B)=>typeof B==="string"));else if(typeof z==="object"&&z!==null&&"import"in z){let B=z.import;if(typeof B==="string")q.push(B);else if(Array.isArray(B))q.push(...B)}if(q.length>0)this.generateOptions.entrypoints=q}}if(this.options.onCompile)j.hooks.compile.tap("DtsxWebpackPlugin",()=>{this.runGenerate()});if(this.options.afterEmit)j.hooks.afterEmit.tapAsync("DtsxWebpackPlugin",async(w,q)=>{await this.runGenerate(),q()});if(this.options.onWatchRun)j.hooks.watchRun.tapAsync("DtsxWebpackPlugin",async(w,q)=>{await this.runGenerate(),q()})}async runGenerate(){try{let j=await I(this.generateOptions);this.options.onGenerated?.(j)}catch(j){let F=j instanceof Error?j:Error(String(j));if(this.options.onError?.(F),!this.options.onError)console.error("[dtsx] Generation failed:",F.message)}}}function K(j={}){return new H(j)}var M=K,Q=H;
3
3
  export{H as qa,K as ra,M as sa,Q as ta};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ec as u}from"./chunk-9mjc7ddv.js";import{hc as TY}from"./chunk-p1d09y82.js";import{kc as XJ}from"./chunk-74j5mydx.js";import{Bc as gJ}from"./chunk-j22v8wfe.js";import{Tc as m}from"./chunk-f18nyrrb.js";import{Vc as W,Xc as n}from"./chunk-57agx6g8.js";import{ad as kY,cd as BJ}from"./chunk-rw6j20e2.js";var{Glob:pJ}=globalThis.Bun;import{mkdir as i}from"fs/promises";import{availableParallelism as FY}from"os";import{dirname as g,relative as S,resolve as y}from"path";import{existsSync as YJ,mkdirSync as sJ,readFileSync as aJ,writeFileSync as iJ}from"fs";import{dirname as nJ,relative as oJ,resolve as rJ}from"path";async function KJ(J,Y,$){let X=new Map,Z=[],Q=new Set,U=0,z=0,H=0;for(let q of J){let G=Y.get(q);if(!G)continue;let O=u(G,q,$.keepComments);U+=O.length;for(let V of O)if(V.kind==="import"){z++;let K=V.source||"";if(K.startsWith("."))continue;if(!X.has(K))X.set(K,{source:K,specifiers:new Map,isTypeOnly:V.isTypeOnly||!1,isSideEffect:V.isSideEffect||!1});let B=X.get(K);if(V.specifiers)for(let k of V.specifiers){let T=k.alias||k.name;if(!B.specifiers.has(T))B.specifiers.set(T,{name:k.name,alias:k.alias,isType:k.isType||!1})}if(!V.isTypeOnly)B.isTypeOnly=!1}else if(V.isExported||V.kind==="export"){if(H++,V.name&&Q.has(V.name))continue;if(V.name)Q.add(V.name);Z.push({declaration:V,file:q})}}let j=[];j.push("/**"),j.push(" * Bundled TypeScript declarations"),j.push(` * Generated from ${J.length} source files`),j.push(" */"),j.push("");let _=Array.from(X.values()).sort((q,G)=>{let O=$.importOrder||["bun"],V=O.findIndex((B)=>q.source.startsWith(B)),K=O.findIndex((B)=>G.source.startsWith(B));if(V!==-1&&K!==-1)return V-K;if(V!==-1)return-1;if(K!==-1)return 1;return q.source.localeCompare(G.source)});for(let q of _)if(q.isSideEffect)j.push(`import '${q.source}';`);else if(q.specifiers.size>0){let O=Array.from(q.specifiers.values()).map((K)=>{let B=K.isType?"type ":"";return K.alias?`${B}${K.name} as ${K.alias}`:`${B}${K.name}`}),V=q.isTypeOnly?"type ":"";j.push(`import ${V}{ ${O.join(", ")} } from '${q.source}';`)}if(_.length>0)j.push("");let A=new Map;for(let{declaration:q,file:G}of Z){if(!A.has(G))A.set(G,[]);A.get(G).push(q)}for(let[q,G]of A){let O=oJ($.cwd,q);j.push(`// From: ${O}`);for(let V of G){if($.keepComments&&V.leadingComments)for(let K of V.leadingComments)j.push(K);j.push(OJ(V))}j.push("")}let R=j.join(`
2
+ import{ec as u}from"./chunk-2w3g3g00.js";import{hc as TY}from"./chunk-p1d09y82.js";import{kc as XJ}from"./chunk-gpxdn99a.js";import{Bc as gJ}from"./chunk-97pgeywh.js";import{Tc as m}from"./chunk-f18nyrrb.js";import{Vc as W,Xc as n}from"./chunk-57agx6g8.js";import{ad as kY,cd as BJ}from"./chunk-rw6j20e2.js";var{Glob:pJ}=globalThis.Bun;import{mkdir as i}from"fs/promises";import{availableParallelism as FY}from"os";import{dirname as g,relative as S,resolve as y}from"path";import{existsSync as YJ,mkdirSync as sJ,readFileSync as aJ,writeFileSync as iJ}from"fs";import{dirname as nJ,relative as oJ,resolve as rJ}from"path";async function KJ(J,Y,$){let X=new Map,Z=[],Q=new Set,U=0,z=0,H=0;for(let q of J){let G=Y.get(q);if(!G)continue;let O=u(G,q,$.keepComments);U+=O.length;for(let V of O)if(V.kind==="import"){z++;let K=V.source||"";if(K.startsWith("."))continue;if(!X.has(K))X.set(K,{source:K,specifiers:new Map,isTypeOnly:V.isTypeOnly||!1,isSideEffect:V.isSideEffect||!1});let B=X.get(K);if(V.specifiers)for(let k of V.specifiers){let T=k.alias||k.name;if(!B.specifiers.has(T))B.specifiers.set(T,{name:k.name,alias:k.alias,isType:k.isType||!1})}if(!V.isTypeOnly)B.isTypeOnly=!1}else if(V.isExported||V.kind==="export"){if(H++,V.name&&Q.has(V.name))continue;if(V.name)Q.add(V.name);Z.push({declaration:V,file:q})}}let j=[];j.push("/**"),j.push(" * Bundled TypeScript declarations"),j.push(` * Generated from ${J.length} source files`),j.push(" */"),j.push("");let _=Array.from(X.values()).sort((q,G)=>{let O=$.importOrder||["bun"],V=O.findIndex((B)=>q.source.startsWith(B)),K=O.findIndex((B)=>G.source.startsWith(B));if(V!==-1&&K!==-1)return V-K;if(V!==-1)return-1;if(K!==-1)return 1;return q.source.localeCompare(G.source)});for(let q of _)if(q.isSideEffect)j.push(`import '${q.source}';`);else if(q.specifiers.size>0){let O=Array.from(q.specifiers.values()).map((K)=>{let B=K.isType?"type ":"";return K.alias?`${B}${K.name} as ${K.alias}`:`${B}${K.name}`}),V=q.isTypeOnly?"type ":"";j.push(`import ${V}{ ${O.join(", ")} } from '${q.source}';`)}if(_.length>0)j.push("");let A=new Map;for(let{declaration:q,file:G}of Z){if(!A.has(G))A.set(G,[]);A.get(G).push(q)}for(let[q,G]of A){let O=oJ($.cwd,q);j.push(`// From: ${O}`);for(let V of G){if($.keepComments&&V.leadingComments)for(let K of V.leadingComments)j.push(K);j.push(OJ(V))}j.push("")}let R=j.join(`
3
3
  `);return{content:R,files:J,declarationCount:U,importCount:z,exportCount:H,size:Buffer.byteLength(R,"utf8"),warnings:[]}}function OJ(J){if(J.text){let $=J.text.trim();if(J.isExported&&!$.startsWith("export"))$=`export ${$}`;if(!$.endsWith(";")&&!$.endsWith("}"))$+=";";return $}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(`(${tJ(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 $ of J.members)Y.push(` ${$.name}${$.typeAnnotation?`: ${$.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 $ of J.members)Y.push(` ${OJ($)}`);Y.push("}");break;case"enum":if(Y.push("declare enum"),Y.push(J.name),Y.push("{"),J.members){let $=J.members.map((X)=>X.value!==void 0?`${X.name} = ${X.value}`:X.name);Y.push(` ${$.join(`,
4
4
  `)}`)}Y.push("}");break;default:return J.text||""}return Y.join(" ")}function tJ(J){if(!J||J.length===0)return"";return J.map((Y)=>{let $="";if(Y.rest)$+="...";if($+=Y.name,Y.optional)$+="?";if(Y.type)$+=`: ${Y.type}`;if(Y.defaultValue)$+=` = ${Y.defaultValue}`;return $}).join(", ")}async function AJ(J,Y={}){let $=[],X=new Map,Z=[],Q=[],U=new Set,z=0,H=0,j=0;for(let q of J){if(!YJ(q)){$.push(`File not found: ${q}`);continue}let G=aJ(q,"utf-8");Q.push(q);let O=G.split(`
5
5
  `),V=[],K=0,B=!1;for(let k of O){let T=k.trim();if(!T&&!B)continue;if(T.startsWith("import ")){H++;let M=T.match(/import\s+(type\s+)?(?:\{([^}]+)\}|(\w+)|\*\s+as\s+(\w+))\s+from\s+['"]([^'"]+)['"]/);if(M){let[,N,L,D,GJ,F]=M;if(Y.externals?.some((o)=>F.startsWith(o))){Z.push(T);continue}if(F.startsWith("."))continue;if(!X.has(F))X.set(F,{source:F,specifiers:new Map,isTypeOnly:!!N,isSideEffect:!1});let HJ=X.get(F);if(L){let o=L.split(",").map((r)=>r.trim());for(let r of o){let[t,e]=r.split(/\s+as\s+/).map((lJ)=>lJ.trim()),WJ=t.startsWith("type "),JJ=WJ?t.replace("type ",""):t;HJ.specifiers.set(e||JJ,{name:JJ,alias:e!==JJ?e:void 0,isType:WJ})}}if(!N)HJ.isTypeOnly=!1}continue}if(/^(export\s+)?(declare\s+)?(interface|type|class|function|const|let|var|enum|namespace|module)\s/.test(T)){if(B=!0,V=[k],K=(k.match(/\{/g)||[]).length-(k.match(/\}/g)||[]).length,K===0&&(T.endsWith(";")||!T.includes("{"))){let M=p(T);if(!U.has(M)||!Y.mergeDuplicates){if(U.add(M),Z.push(k),z++,T.startsWith("export"))j++}B=!1,V=[]}}else if(B){if(V.push(k),K+=(k.match(/\{/g)||[]).length-(k.match(/\}/g)||[]).length,K<=0){let M=V.join(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ac as v,Bc as w,oc as j,pc as k,qc as l,rc as m,sc as n,tc as o,uc as p,vc as q,wc as r,xc as s,yc as t,zc as u}from"./chunk-j22v8wfe.js";import{Ec as a,Fc as b,Gc as c,Hc as d,Ic as e,Jc as f,Kc as g,Lc as h,Mc as i}from"./chunk-dk2vv0np.js";import"./chunk-rw6j20e2.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};
2
+ import{Ac as v,Bc as w,oc as j,pc as k,qc as l,rc as m,sc as n,tc as o,uc as p,vc as q,wc as r,xc as s,yc as t,zc as u}from"./chunk-97pgeywh.js";import{Ec as a,Fc as b,Gc as c,Hc as d,Ic as e,Jc as f,Kc as g,Lc as h,Mc as i}from"./chunk-0fhq2wva.js";import"./chunk-rw6j20e2.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};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as I}from"./chunk-3mxzfgcv.js";function z(J={}){let{onBuildStart:K=!1,onBuildEnd:L=!0,onGenerated:M,onError:C,...N}=J,w,q,F=async()=>{let j={...N};if(!j.outdir&&w)j.outdir=w;if(!j.entrypoints&&q)j.entrypoints=q;try{let k=await I(j);M?.(k)}catch(k){let H=k instanceof Error?k:Error(String(k));if(C?.(H),!C)console.error("[dtsx] Generation failed:",H.message)}};return{name:"dtsx",esbuildOptions(j){if(j.outdir&&typeof j.outdir==="string")w=j.outdir;if(j.entryPoints){if(Array.isArray(j.entryPoints))q=j.entryPoints;else if(typeof j.entryPoints==="object")q=Object.values(j.entryPoints)}},async buildStart(){if(K)await F()},async buildEnd(j){if(L)await F()}}}var R=z,T=z,V=z;
2
+ import{tb as I}from"./chunk-8dx98fd5.js";function z(J={}){let{onBuildStart:K=!1,onBuildEnd:L=!0,onGenerated:M,onError:C,...N}=J,w,q,F=async()=>{let j={...N};if(!j.outdir&&w)j.outdir=w;if(!j.entrypoints&&q)j.entrypoints=q;try{let k=await I(j);M?.(k)}catch(k){let H=k instanceof Error?k:Error(String(k));if(C?.(H),!C)console.error("[dtsx] Generation failed:",H.message)}};return{name:"dtsx",esbuildOptions(j){if(j.outdir&&typeof j.outdir==="string")w=j.outdir;if(j.entryPoints){if(Array.isArray(j.entryPoints))q=j.entryPoints;else if(typeof j.entryPoints==="object")q=Object.values(j.entryPoints)}},async buildStart(){if(K)await F()},async buildEnd(j){if(L)await F()}}}var R=z,T=z,V=z;
3
3
  export{z as ma,R as na,T as oa,V as pa};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Cc as Kz,Dc as Uz,Ec as P,Lc as u,Mc as p,Nc as jz}from"./chunk-dk2vv0np.js";function _(z,X=!0){if(!X||!z||z.length===0)return"";if(z.length===1)return z[0].trim()+`
2
+ import{Cc as Kz,Dc as Uz,Ec as P,Lc as u,Mc as p,Nc as jz}from"./chunk-0fhq2wva.js";function _(z,X=!0){if(!X||!z||z.length===0)return"";if(z.length===1)return z[0].trim()+`
3
3
  `;let K="";for(let Z=0;Z<z.length;Z++){if(Z>0)K+=`
4
4
  `;K+=z[Z].trim()}return`${K}
5
5
  `}function Jz(z){if(z.includes(`
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{nc as a}from"./chunk-me2ae6f0.js";import"./chunk-rw6j20e2.js";export{a as scanDeclarations};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import"./chunk-rw6j20e2.js";var e="@stacksjs/dtsx",i="module",n="0.9.10",r=!0,c="A modern, fast .d.ts generation tool, powered by Bun.",o="Chris Breuer <chris@stacksjs.org>",u="MIT",d="https://github.com/stacksjs/dtsx#readme",p={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},a={url:"https://github.com/stacksjs/dtsx/issues"},b=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],g={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},l="./dist/index.js",m="./dist/index.d.ts",k={dtsx:"./dist/cli.js"},x=["dist"],h={benchmark:"bun benchmark/index.ts",build:"bun --filter './packages/dtsx' build",test:"bun test",lint:"bunx --bun pickier run . --mode lint --config .config/pickier.ts","lint:fix":"bunx --bun pickier run . --mode lint --fix --config .config/pickier.ts",changelog:"bunx logsmith --verbose","changelog:generate":"bunx logsmith --output CHANGELOG.md",release:"bun --bun run changelog:generate && bunx --bun bumpx prompt --recursive",typecheck:"bunx tsc --noEmit","dev:docs":"bun --bun vitepress dev docs","build:docs":"bun --bun vitepress build docs","preview:docs":"bun --bun vitepress preview docs"},v={"@stacksjs/bumpx":"^0.2.4","@stacksjs/bunpress":"^0.1.1","@stacksjs/clapp":"^0.2.0",pickier:"^0.1.18","@stacksjs/gitlint":"^0.1.5","@stacksjs/logsmith":"^0.2.1","@types/bun":"^1.3.9","@typescript/native-preview":"^7.0.0-dev.20260216.1","buddy-bot":"^0.9.16","bun-git-hooks":"^0.3.1","bun-plugin-dtsx":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.112.0",typescript:"^5.9.3"},j=["packages/*"],y={name:e,type:i,version:n,private:r,description:c,author:o,license:u,homepage:d,repository:p,bugs:a,keywords:b,exports:g,module:l,types:m,bin:k,files:x,scripts:h,devDependencies:v,workspaces:j};export{j as workspaces,n as version,m as types,i as type,h as scripts,p as repository,r as private,e as name,l as module,u as license,b as keywords,d as homepage,x as files,g as exports,v as devDependencies,c as description,y as default,a as bugs,k as bin,o as author};
2
+ import"./chunk-rw6j20e2.js";var e="@stacksjs/dtsx",i="module",n="0.9.12",r=!0,c="A modern, fast .d.ts generation tool, powered by Bun.",o="Chris Breuer <chris@stacksjs.org>",u="MIT",d="https://github.com/stacksjs/dtsx#readme",p={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},a={url:"https://github.com/stacksjs/dtsx/issues"},b=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],g={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},l="./dist/index.js",m="./dist/index.d.ts",k={dtsx:"./dist/cli.js"},x=["dist"],h={benchmark:"bun benchmark/index.ts",build:"bun --filter './packages/dtsx' build",test:"bun test",lint:"bunx --bun pickier run . --mode lint --config .config/pickier.ts","lint:fix":"bunx --bun pickier run . --mode lint --fix --config .config/pickier.ts",changelog:"bunx logsmith --verbose","changelog:generate":"bunx logsmith --output CHANGELOG.md",release:"bun --bun run changelog:generate && bunx --bun bumpx prompt --recursive",typecheck:"bunx tsc --noEmit","dev:docs":"bun --bun vitepress dev docs","build:docs":"bun --bun vitepress build docs","preview:docs":"bun --bun vitepress preview docs"},v={"@stacksjs/bumpx":"^0.2.4","@stacksjs/bunpress":"^0.1.1","@stacksjs/clapp":"^0.2.0",pickier:"^0.1.18","@stacksjs/gitlint":"^0.1.5","@stacksjs/logsmith":"^0.2.1","@types/bun":"^1.3.9","@typescript/native-preview":"^7.0.0-dev.20260216.1","buddy-bot":"^0.9.16","bun-git-hooks":"^0.3.1","bun-plugin-dtsx":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.112.0",typescript:"^5.9.3"},j=["packages/*"],y={name:e,type:i,version:n,private:r,description:c,author:o,license:u,homepage:d,repository:p,bugs:a,keywords:b,exports:g,module:l,types:m,bin:k,files:x,scripts:h,devDependencies:v,workspaces:j};export{j as workspaces,n as version,m as types,i as type,h as scripts,p as repository,r as private,e as name,l as module,u as license,b as keywords,d as homepage,x as files,g as exports,v as devDependencies,c as description,y as default,a as bugs,k as bin,o as author};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{ec as $}from"./chunk-9mjc7ddv.js";import{existsSync as U,readFileSync as O,writeFileSync as q}from"fs";function _(G){let j=[],H=/\b([A-Z][a-zA-Z0-9]*)\b/g,L;while((L=H.exec(G))!==null){let J=L[1];if(!N(J))j.push(J)}return[...new Set(j)]}function N(G){return new Set(["Array","Object","String","Number","Boolean","Symbol","BigInt","Function","Promise","Map","Set","WeakMap","WeakSet","Date","RegExp","Error","TypeError","RangeError","SyntaxError","Partial","Required","Readonly","Pick","Omit","Record","Exclude","Extract","NonNullable","ReturnType","Parameters","ConstructorParameters","InstanceType","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize","Awaited","NoInfer","Generator","AsyncGenerator","IterableIterator","AsyncIterableIterator","PropertyKey","Iterable","AsyncIterable","ArrayLike","PromiseLike","ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Uint8Array","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]).has(G)}function C(G){if(G.kind!=="type")return!1;let j=G.typeAnnotation||"";if(G.generics)return!1;if(j.includes("{")||j.includes("(")||j.includes("<"))return!1;return/^[\w\s|&]+$/.test(j)}function E(G){if(G.kind!=="interface")return!1;if(!G.members||G.members.length===0){if(!G.extends)return!0}return!1}function F(G,j){let H={...G,members:[...G.members||[],...j.members||[]],leadingComments:[...G.leadingComments||[],...j.leadingComments||[]]};if(G.extends&&j.extends){let L=G.extends.split(",").map((K)=>K.trim()),J=j.extends.split(",").map((K)=>K.trim());H.extends=[...new Set([...L,...J])].join(", ")}else H.extends=G.extends||j.extends;return H}function D(G){let j=["import","interface","type","class","enum","function","variable","export"];return[...G].sort((H,L)=>{let J=j.indexOf(H.kind)-j.indexOf(L.kind);if(J!==0)return J;return H.name.localeCompare(L.name)})}function R(G){let j=G.filter((J)=>J.kind==="import"),H=G.filter((J)=>J.kind!=="import");return[...[...j].sort((J,K)=>{let M=J.source||"",Q=K.source||"",V=M.startsWith("node:")||M==="bun",W=Q.startsWith("node:")||Q==="bun";if(V&&!W)return-1;if(!V&&W)return 1;let Y=!M.startsWith("."),X=!Q.startsWith(".");if(Y&&!X)return-1;if(!Y&&X)return 1;return M.localeCompare(Q)}),...H]}function k(G){let j=new Set;for(let J of G){if(J.kind==="import")continue;let K=J.text||"",M=J.typeAnnotation||"",Q=J.returnType||"",V=J.extends||"",W=J.implements?.join(" ")||"",Y=`${K} ${M} ${Q} ${V} ${W}`;for(let X of _(Y))j.add(X);if(J.members)for(let X of J.members){let Z=`${X.typeAnnotation||""} ${X.returnType||""}`;for(let w of _(Z))j.add(w)}if(J.parameters){for(let X of J.parameters)if(X.type)for(let Z of _(X.type))j.add(Z)}}let H=0;return{declarations:G.map((J)=>{if(J.kind!=="import"||!J.specifiers)return J;let K=J.specifiers.filter((M)=>{let Q=M.alias||M.name;return j.has(Q)});if(K.length===0){if(!J.isSideEffect)return H++,null}if(K.length<(J.specifiers?.length||0))return H+=(J.specifiers?.length||0)-K.length,{...J,specifiers:K};return J}).filter((J)=>J!==null),removed:H}}function A(G){let j=new Map,H=0;for(let L of G){if(L.kind==="import"){let K=`import:${L.source}`;if(j.has(K)){let M=j.get(K),Q=[...M.specifiers||[],...L.specifiers||[]],V=Array.from(new Map(Q.map((W)=>[W.alias||W.name,W])).values());j.set(K,{...M,specifiers:V}),H++}else j.set(K,L);continue}let J=`${L.kind}:${L.name}`;if(j.has(J))H++;else j.set(J,L)}return{declarations:Array.from(j.values()),removed:H}}function z(G){let j=new Map,H=[];for(let K of G)if(K.kind==="interface"){let M=K.name;if(!j.has(M))j.set(M,[]);j.get(M).push(K)}else H.push(K);let L=0,J=[];for(let[K,M]of j)if(M.length>1){let Q=M[0];for(let V=1;V<M.length;V++)Q=F(Q,M[V]),L++;J.push(Q)}else J.push(M[0]);return{declarations:[...H,...J],merged:L}}function P(G){let j=new Map,H=new Set;for(let K of G)if(C(K))j.set(K.name,K.typeAnnotation||""),H.add(K.name);if(j.size===0)return{declarations:G,inlined:0};function L(K){let M=K;for(let[Q,V]of j){let W=new RegExp(`\\b${Q}\\b`,"g");M=M.replace(W,V)}return M}return{declarations:G.filter((K)=>K.kind!=="type"||!H.has(K.name)).map((K)=>{if(K.typeAnnotation)K={...K,typeAnnotation:L(K.typeAnnotation)};if(K.returnType)K={...K,returnType:L(K.returnType)};if(K.extends)K={...K,extends:L(K.extends)};return K}),inlined:j.size}}function v(G){let j=G.length,H=G.filter((L)=>!E(L));return{declarations:H,removed:j-H.length}}function B(G,j={}){let H=[...G],L={originalSize:0,optimizedSize:0,savings:0,savingsPercent:0,removedImports:0,removedDeclarations:0,mergedInterfaces:0,inlinedTypes:0};if(j.removeUnusedImports){let{declarations:J,removed:K}=k(H);H=J,L.removedImports=K}if(j.deduplicateDeclarations){let{declarations:J,removed:K}=A(H);H=J,L.removedDeclarations+=K}if(j.mergeInterfaces){let{declarations:J,merged:K}=z(H);H=J,L.mergedInterfaces=K}if(j.removeEmptyInterfaces){let{declarations:J,removed:K}=v(H);H=J,L.removedDeclarations+=K}if(j.inlineSimpleTypes){let{declarations:J,inlined:K}=P(H);H=J,L.inlinedTypes=K}if(j.sortImports)H=R(H);if(j.sortDeclarations)H=D(H);return{declarations:H,result:L}}async function g(G,j={}){if(!U(G))throw Error(`File not found: ${G}`);let H=O(G,"utf-8"),L=Buffer.byteLength(H,"utf-8"),J=$(H,G,!j.removeComments),{declarations:K,result:M}=B(J,j),Q=h(K,j);if(j.minify)Q=x(Q);let V=Buffer.byteLength(Q,"utf-8");return M.originalSize=L,M.optimizedSize=V,M.savings=L-V,M.savingsPercent=Math.round(M.savings/L*100),q(G,Q),M}function h(G,j){let H=[];for(let L of G){if(!j.removeComments&&L.leadingComments)for(let J of L.leadingComments)H.push(J);if(L.text)H.push(L.text);else H.push(I(L));H.push("")}return H.join(`
2
+ import{ec as $}from"./chunk-2w3g3g00.js";import{existsSync as U,readFileSync as O,writeFileSync as q}from"fs";function _(G){let j=[],H=/\b([A-Z][a-zA-Z0-9]*)\b/g,L;while((L=H.exec(G))!==null){let J=L[1];if(!N(J))j.push(J)}return[...new Set(j)]}function N(G){return new Set(["Array","Object","String","Number","Boolean","Symbol","BigInt","Function","Promise","Map","Set","WeakMap","WeakSet","Date","RegExp","Error","TypeError","RangeError","SyntaxError","Partial","Required","Readonly","Pick","Omit","Record","Exclude","Extract","NonNullable","ReturnType","Parameters","ConstructorParameters","InstanceType","ThisType","Uppercase","Lowercase","Capitalize","Uncapitalize","Awaited","NoInfer","Generator","AsyncGenerator","IterableIterator","AsyncIterableIterator","PropertyKey","Iterable","AsyncIterable","ArrayLike","PromiseLike","ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Uint8Array","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"]).has(G)}function C(G){if(G.kind!=="type")return!1;let j=G.typeAnnotation||"";if(G.generics)return!1;if(j.includes("{")||j.includes("(")||j.includes("<"))return!1;return/^[\w\s|&]+$/.test(j)}function E(G){if(G.kind!=="interface")return!1;if(!G.members||G.members.length===0){if(!G.extends)return!0}return!1}function F(G,j){let H={...G,members:[...G.members||[],...j.members||[]],leadingComments:[...G.leadingComments||[],...j.leadingComments||[]]};if(G.extends&&j.extends){let L=G.extends.split(",").map((K)=>K.trim()),J=j.extends.split(",").map((K)=>K.trim());H.extends=[...new Set([...L,...J])].join(", ")}else H.extends=G.extends||j.extends;return H}function D(G){let j=["import","interface","type","class","enum","function","variable","export"];return[...G].sort((H,L)=>{let J=j.indexOf(H.kind)-j.indexOf(L.kind);if(J!==0)return J;return H.name.localeCompare(L.name)})}function R(G){let j=G.filter((J)=>J.kind==="import"),H=G.filter((J)=>J.kind!=="import");return[...[...j].sort((J,K)=>{let M=J.source||"",Q=K.source||"",V=M.startsWith("node:")||M==="bun",W=Q.startsWith("node:")||Q==="bun";if(V&&!W)return-1;if(!V&&W)return 1;let Y=!M.startsWith("."),X=!Q.startsWith(".");if(Y&&!X)return-1;if(!Y&&X)return 1;return M.localeCompare(Q)}),...H]}function k(G){let j=new Set;for(let J of G){if(J.kind==="import")continue;let K=J.text||"",M=J.typeAnnotation||"",Q=J.returnType||"",V=J.extends||"",W=J.implements?.join(" ")||"",Y=`${K} ${M} ${Q} ${V} ${W}`;for(let X of _(Y))j.add(X);if(J.members)for(let X of J.members){let Z=`${X.typeAnnotation||""} ${X.returnType||""}`;for(let w of _(Z))j.add(w)}if(J.parameters){for(let X of J.parameters)if(X.type)for(let Z of _(X.type))j.add(Z)}}let H=0;return{declarations:G.map((J)=>{if(J.kind!=="import"||!J.specifiers)return J;let K=J.specifiers.filter((M)=>{let Q=M.alias||M.name;return j.has(Q)});if(K.length===0){if(!J.isSideEffect)return H++,null}if(K.length<(J.specifiers?.length||0))return H+=(J.specifiers?.length||0)-K.length,{...J,specifiers:K};return J}).filter((J)=>J!==null),removed:H}}function A(G){let j=new Map,H=0;for(let L of G){if(L.kind==="import"){let K=`import:${L.source}`;if(j.has(K)){let M=j.get(K),Q=[...M.specifiers||[],...L.specifiers||[]],V=Array.from(new Map(Q.map((W)=>[W.alias||W.name,W])).values());j.set(K,{...M,specifiers:V}),H++}else j.set(K,L);continue}let J=`${L.kind}:${L.name}`;if(j.has(J))H++;else j.set(J,L)}return{declarations:Array.from(j.values()),removed:H}}function z(G){let j=new Map,H=[];for(let K of G)if(K.kind==="interface"){let M=K.name;if(!j.has(M))j.set(M,[]);j.get(M).push(K)}else H.push(K);let L=0,J=[];for(let[K,M]of j)if(M.length>1){let Q=M[0];for(let V=1;V<M.length;V++)Q=F(Q,M[V]),L++;J.push(Q)}else J.push(M[0]);return{declarations:[...H,...J],merged:L}}function P(G){let j=new Map,H=new Set;for(let K of G)if(C(K))j.set(K.name,K.typeAnnotation||""),H.add(K.name);if(j.size===0)return{declarations:G,inlined:0};function L(K){let M=K;for(let[Q,V]of j){let W=new RegExp(`\\b${Q}\\b`,"g");M=M.replace(W,V)}return M}return{declarations:G.filter((K)=>K.kind!=="type"||!H.has(K.name)).map((K)=>{if(K.typeAnnotation)K={...K,typeAnnotation:L(K.typeAnnotation)};if(K.returnType)K={...K,returnType:L(K.returnType)};if(K.extends)K={...K,extends:L(K.extends)};return K}),inlined:j.size}}function v(G){let j=G.length,H=G.filter((L)=>!E(L));return{declarations:H,removed:j-H.length}}function B(G,j={}){let H=[...G],L={originalSize:0,optimizedSize:0,savings:0,savingsPercent:0,removedImports:0,removedDeclarations:0,mergedInterfaces:0,inlinedTypes:0};if(j.removeUnusedImports){let{declarations:J,removed:K}=k(H);H=J,L.removedImports=K}if(j.deduplicateDeclarations){let{declarations:J,removed:K}=A(H);H=J,L.removedDeclarations+=K}if(j.mergeInterfaces){let{declarations:J,merged:K}=z(H);H=J,L.mergedInterfaces=K}if(j.removeEmptyInterfaces){let{declarations:J,removed:K}=v(H);H=J,L.removedDeclarations+=K}if(j.inlineSimpleTypes){let{declarations:J,inlined:K}=P(H);H=J,L.inlinedTypes=K}if(j.sortImports)H=R(H);if(j.sortDeclarations)H=D(H);return{declarations:H,result:L}}async function g(G,j={}){if(!U(G))throw Error(`File not found: ${G}`);let H=O(G,"utf-8"),L=Buffer.byteLength(H,"utf-8"),J=$(H,G,!j.removeComments),{declarations:K,result:M}=B(J,j),Q=h(K,j);if(j.minify)Q=x(Q);let V=Buffer.byteLength(Q,"utf-8");return M.originalSize=L,M.optimizedSize=V,M.savings=L-V,M.savingsPercent=Math.round(M.savings/L*100),q(G,Q),M}function h(G,j){let H=[];for(let L of G){if(!j.removeComments&&L.leadingComments)for(let J of L.leadingComments)H.push(J);if(L.text)H.push(L.text);else H.push(I(L));H.push("")}return H.join(`
3
3
  `)}function I(G){let j=[];if(G.isExported)j.push("export");if(G.isDefault)j.push("default");switch(G.kind){case"import":if(G.isTypeOnly)j.push("import type");else j.push("import");if(G.specifiers&&G.specifiers.length>0){let H=G.specifiers.map((L)=>{let J=L.isType?"type ":"";return L.alias?`${J}${L.name} as ${L.alias}`:`${J}${L.name}`}).join(", ");j.push(`{ ${H} }`)}j.push("from"),j.push(`'${G.source}'`);break;case"function":if(j.push("declare function"),j.push(G.name),G.generics)j.push(G.generics);if(j.push(`(${S(G.parameters)})`),G.returnType)j.push(`: ${G.returnType}`);break;case"variable":if(j.push("declare const"),j.push(G.name),G.typeAnnotation)j.push(`: ${G.typeAnnotation}`);break;case"interface":if(j.push("interface"),j.push(G.name),G.generics)j.push(G.generics);if(G.extends)j.push(`extends ${G.extends}`);if(j.push("{"),G.members)for(let H of G.members)j.push(` ${H.name}${H.typeAnnotation?`: ${H.typeAnnotation}`:""}`);j.push("}");break;case"type":if(j.push("type"),j.push(G.name),G.generics)j.push(G.generics);j.push("="),j.push(G.typeAnnotation||"unknown");break;case"class":if(j.push("declare class"),j.push(G.name),G.generics)j.push(G.generics);if(G.extends)j.push(`extends ${G.extends}`);if(G.implements?.length)j.push(`implements ${G.implements.join(", ")}`);j.push("{ }");break;case"enum":j.push("declare enum"),j.push(G.name),j.push("{ }");break;default:return G.text||""}return j.join(" ")}function S(G){if(!G)return"";return G.map((j)=>{let H="";if(j.rest)H+="...";if(H+=j.name,j.optional)H+="?";if(j.type)H+=`: ${j.type}`;return H}).join(", ")}function x(G){return G.replace(/(?<!\/\*\*)\/\/[^\n]*/g,"").replace(/^\s*[\r\n]/gm,"").replace(/ {2,}/g," ").replace(/\s*([{}[\]();,:])\s*/g,"$1").replace(/(\w)(\{)/g,"$1 $2").replace(/(\})([a-z])/gi,"$1 $2").replace(/(export|import|type|interface|class|function|const|let|var|extends|implements|declare)\s*/g,"$1 ").trim()}
4
4
  export{B as a,g as b,x as c};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as C}from"./chunk-3mxzfgcv.js";function y(F={}){let{onStart:H=!1,onEnd:I=!0,onGenerated:J,onError:z,...q}=F,B=async()=>{try{let k=await C(q);J?.(k)}catch(k){let j=k instanceof Error?k:Error(String(k));if(z?.(j),!z)console.error("[dtsx] Generation failed:",j.message)}};return{name:"dtsx",setup(k){let j=k.initialOptions;if(!q.entrypoints&&j.entryPoints)if(Array.isArray(j.entryPoints))q.entrypoints=j.entryPoints;else q.entrypoints=Object.values(j.entryPoints);if(!q.outdir){if(j.outdir)q.outdir=j.outdir;else if(j.outfile){let w=j.outfile.lastIndexOf("/");if(w!==-1)q.outdir=j.outfile.substring(0,w)}}if(H)k.onStart(async()=>{await B()});if(I)k.onEnd(async(w)=>{if(w.errors.length===0)await B()})}}}var L=y,M=y,P=y;
2
+ import{tb as C}from"./chunk-8dx98fd5.js";function y(F={}){let{onStart:H=!1,onEnd:I=!0,onGenerated:J,onError:z,...q}=F,B=async()=>{try{let k=await C(q);J?.(k)}catch(k){let j=k instanceof Error?k:Error(String(k));if(z?.(j),!z)console.error("[dtsx] Generation failed:",j.message)}};return{name:"dtsx",setup(k){let j=k.initialOptions;if(!q.entrypoints&&j.entryPoints)if(Array.isArray(j.entryPoints))q.entrypoints=j.entryPoints;else q.entrypoints=Object.values(j.entryPoints);if(!q.outdir){if(j.outdir)q.outdir=j.outdir;else if(j.outfile){let w=j.outfile.lastIndexOf("/");if(w!==-1)q.outdir=j.outfile.substring(0,w)}}if(H)k.onStart(async()=>{await B()});if(I)k.onEnd(async(w)=>{if(w.errors.length===0)await B()})}}}var L=y,M=y,P=y;
3
3
  export{y as ia,L as ja,M as ka,P as la};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{nc as J}from"./chunk-rnt0wkrk.js";var S=typeof globalThis.Bun?.hash==="function";function z(u){if(S)return Bun.hash(u);let g=0;for(let f=0;f<u.length;f++){let b=u.charCodeAt(f);g=(g<<5)-g+b,g=g&g}return g}var T=100,G=0,B=new Map;function Y(u,g,f=!0,b=!1){let x=z(u),F=`${g}:${f?1:0}:${b?1:0}`,p=B.get(F);if(p&&p.contentHash===x)return p.lastAccess=++G,p.declarations;let j=J(u,g,f,b);if(B.set(F,{declarations:j,contentHash:x,lastAccess:++G}),B.size>T){let w=null,q=1/0;for(let[Q,v]of B)if(v.lastAccess<q)q=v.lastAccess,w=Q;if(w)B.delete(w)}return j}function $(){B.clear()}
2
+ import{nc as J}from"./chunk-me2ae6f0.js";var S=typeof globalThis.Bun?.hash==="function";function z(u){if(S)return Bun.hash(u);let g=0;for(let f=0;f<u.length;f++){let b=u.charCodeAt(f);g=(g<<5)-g+b,g=g&g}return g}var T=100,G=0,B=new Map;function Y(u,g,f=!0,b=!1){let x=z(u),F=`${g}:${f?1:0}:${b?1:0}`,p=B.get(F);if(p&&p.contentHash===x)return p.lastAccess=++G,p.declarations;let j=J(u,g,f,b);if(B.set(F,{declarations:j,contentHash:x,lastAccess:++G}),B.size>T){let w=null,q=1/0;for(let[Q,v]of B)if(v.lastAccess<q)q=v.lastAccess,w=Q;if(w)B.delete(w)}return j}function $(){B.clear()}
3
3
  export{z as kc,Y as lc,$ as mc};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"./chunk-bn29kee5.js";import"./chunk-9mjc7ddv.js";import"./chunk-p1d09y82.js";import"./chunk-74j5mydx.js";import"./chunk-rnt0wkrk.js";import"./chunk-dk2vv0np.js";import"./chunk-57agx6g8.js";import"./chunk-rw6j20e2.js";export{a as parseJSDoc,f as generateTypeDocJSON,c as generateMarkdown,e as generateJSON,d as generateHTML,g as generateDocs,b as extractDocumentation,h as createDocsGenerator};
2
+ import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"./chunk-20kdv9bh.js";import"./chunk-2w3g3g00.js";import"./chunk-p1d09y82.js";import"./chunk-gpxdn99a.js";import"./chunk-me2ae6f0.js";import"./chunk-0fhq2wva.js";import"./chunk-57agx6g8.js";import"./chunk-rw6j20e2.js";export{a as parseJSDoc,f as generateTypeDocJSON,c as generateMarkdown,e as generateJSON,d as generateHTML,g as generateDocs,b as extractDocumentation,h as createDocsGenerator};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ec as F}from"./chunk-9mjc7ddv.js";import{Bc as N}from"./chunk-j22v8wfe.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(`
2
+ import{ec as F}from"./chunk-2w3g3g00.js";import{Bc as N}from"./chunk-97pgeywh.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(`
@@ -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-9mjc7ddv.js";import"./chunk-p1d09y82.js";import"./chunk-74j5mydx.js";import"./chunk-rnt0wkrk.js";import{Nc as f}from"./chunk-dk2vv0np.js";import"./chunk-rw6j20e2.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};
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-2w3g3g00.js";import"./chunk-p1d09y82.js";import"./chunk-gpxdn99a.js";import"./chunk-me2ae6f0.js";import{Nc as f}from"./chunk-0fhq2wva.js";import"./chunk-rw6j20e2.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 b,ub as c,vb as d}from"./chunk-8dx98fd5.js";import"./chunk-2w3g3g00.js";import"./chunk-p1d09y82.js";import{ic as a}from"./chunk-qn0xktfx.js";import"./chunk-gpxdn99a.js";import"./chunk-me2ae6f0.js";import"./chunk-97pgeywh.js";import"./chunk-0fhq2wva.js";import"./chunk-f18nyrrb.js";import"./chunk-57agx6g8.js";import"./chunk-rw6j20e2.js";export{d as watch,a as processSource,c as processFile,b as generate};
@@ -0,0 +1,23 @@
1
+ // @bun
2
+ function y(g){return g===32||g===9||g===10||g===13}function Oj(g){return g>=65&&g<=90||g>=97&&g<=122||g===95||g===36||g>127}function S(g){return Oj(g)||g>=48&&g<=57}function Wj(g){if(g.charCodeAt(0)===82&&g.startsWith("Record<"))return!0;if(g.charCodeAt(0)===65&&g.startsWith("Array<"))return!0;if(g.charCodeAt(0)===123&&g.includes("[")&&g.includes("]:"))return!0;if(g==="any"||g==="object"||g==="unknown")return!0;return!1}var Fj=["public","protected","private","readonly","override"];function xj(g,e,A=!0,h=!1){let Y=g,a=A,P=h,V=Y.length,L=[],b=new Map,u=new Set,j=0;if(j<V&&Y.charCodeAt(j)===65279)j++;function w(J,H){if(J<H){let X=Y.charCodeAt(J),U=Y.charCodeAt(H-1);if(X!==32&&X!==9&&X!==10&&X!==13&&U!==32&&U!==9&&U!==10&&U!==13)return Y.slice(J,H)}while(J<H&&y(Y.charCodeAt(J)))J++;while(H>J&&y(Y.charCodeAt(H-1)))H--;return Y.slice(J,H)}function O(){if(j>=V)return;let J=Y.charCodeAt(j);if(J!==32&&J!==9&&J!==10&&J!==13&&J!==47)return;while(j<V){let H=Y.charCodeAt(j);if(H===32||H===9||H===10||H===13){j++;continue}if(H===47&&j+1<V){let X=Y.charCodeAt(j+1);if(X===47){let U=Y.indexOf(`
3
+ `,j+2);j=U===-1?V:U+1;continue}if(X===42){let U=Y.indexOf("*/",j+2);j=U===-1?V:U+2;continue}}break}}function bj(J){let H=J.length,X=0,U=H;for(let Z=0;Z<H;Z++){let Q=J.charCodeAt(Z);if(X){if(Q===92){Z++;continue}if(Q===X)X=0;continue}if(Q===39||Q===34||Q===96){X=Q;continue}if(Q===47&&Z+1<H){let F=J.charCodeAt(Z+1);if(F===47){U=Z;while(U>0&&(J.charCodeAt(U-1)===32||J.charCodeAt(U-1)===9))U--;return J.slice(0,U)}if(F===42){let G=J.indexOf("*/",Z+2);if(G!==-1){J=`${J.slice(0,Z)} ${J.slice(G+2)}`,Z--;continue}}}}U=H;while(U>0&&(J.charCodeAt(U-1)===32||J.charCodeAt(U-1)===9||J.charCodeAt(U-1)===13))U--;return U<H?J.slice(0,U):J}function l(J){j++;let H=J===39?"'":'"';while(j<V){let X=Y.indexOf(H,j);if(X===-1){j=V;return}let U=0,Z=X-1;while(Z>=0&&Y.charCodeAt(Z)===92)U++,Z--;if(U%2===0){j=X+1;return}j=X+1}}function jj(){j++;let J=0;while(j<V){let H=Y.charCodeAt(j);if(H===92){j+=2;continue}if(H===96&&J===0){j++;return}if(H===36&&j+1<V&&Y.charCodeAt(j+1)===123){j+=2,J++;continue}if(H===125&&J>0){J--,j++;continue}j++}}function f(){let J=Y.charCodeAt(j);if(J===39||J===34)return l(J),!0;if(J===96)return jj(),!0;if(J===47&&j+1<V){let H=Y.charCodeAt(j+1);if(H===47){let X=Y.indexOf(`
4
+ `,j+2);return j=X===-1?V:X+1,!0}if(H===42){let X=Y.indexOf("*/",j+2);return j=X===-1?V:X+2,!0}if(wj())return vj(),!0}return!1}function wj(){let J=j-1;while(J>=0&&(Y.charCodeAt(J)===32||Y.charCodeAt(J)===9||Y.charCodeAt(J)===10||Y.charCodeAt(J)===13))J--;if(J<0)return!0;let H=Y.charCodeAt(J);if(H===61||H===40||H===91||H===33||H===38||H===124||H===63||H===58||H===44||H===59||H===123||H===125||H===94||H===126||H===43||H===45||H===42||H===37||H===60||H===62)return!0;if(S(H)){let X=J;while(X>=0&&S(Y.charCodeAt(X)))X--;let U=Y.slice(X+1,J+1);if(U==="return"||U==="typeof"||U==="void"||U==="delete"||U==="throw"||U==="new"||U==="in"||U==="of"||U==="case"||U==="instanceof"||U==="yield"||U==="await")return!0}return!1}function vj(){j++;let J=!1;while(j<V){let H=Y.charCodeAt(j);if(H===92){j+=2;continue}if(J){if(H===93)J=!1;j++;continue}if(H===91){J=!0,j++;continue}if(H===47){j++;break}if(H===10||H===13)break;j++}while(j<V&&S(Y.charCodeAt(j)))j++}function E(){let J=j;while(j<V&&S(Y.charCodeAt(j)))j++;return Y.slice(J,j)}function z(J){if(j+J.length>V)return!1;for(let H=0;H<J.length;H++)if(Y.charCodeAt(j+H)!==J.charCodeAt(H))return!1;if(j+J.length<V&&S(Y.charCodeAt(j+J.length)))return!1;return!0}function Ij(){if(j>=V)return!1;switch(Y.charCodeAt(j)){case 101:return z("export")||z("enum");case 105:return z("import")||z("interface");case 102:return z("function");case 99:return z("class")||z("const");case 116:return z("type");case 108:return z("let");case 118:return z("var");case 100:return z("declare")||z("default");case 109:return z("module");case 110:return z("namespace");case 97:return z("abstract")||z("async");default:return!1}}function p(){let J=Y.charCodeAt(j);if(J!==10&&J!==13)return!1;let H=j;if(j++,J===13&&j<V&&Y.charCodeAt(j)===10)j++;while(j<V){let U=Y.charCodeAt(j);if(U===32||U===9||U===13||U===10){j++;continue}if(U===47&&j+1<V){let Z=Y.charCodeAt(j+1);if(Z===47){let Q=Y.indexOf(`
5
+ `,j+2);j=Q===-1?V:Q+1;continue}if(Z===42){let Q=Y.indexOf("*/",j+2);j=Q===-1?V:Q+2;continue}}break}let X=j>=V||Ij()||Y.charCodeAt(j)===125;return j=H,X}function o(){let J=Y.charCodeAt(j);if(J!==10&&J!==13)return!1;let H=j;if(j++,J===13&&j<V&&Y.charCodeAt(j)===10)j++;while(j<V){let U=Y.charCodeAt(j);if(U===32||U===9||U===13||U===10){j++;continue}if(U===47&&j+1<V&&Y.charCodeAt(j+1)===47){let Z=Y.indexOf(`
6
+ `,j+2);j=Z===-1?V:Z+1;continue}break}if(j>=V)return j=H,!0;let X=Y.charCodeAt(j);if(X===124||X===38||X===46||X===63)return j=H,!1;if(z("extends")||z("keyof")||z("typeof")||z("infer")||z("is")||z("as")||z("in"))return j=H,!1;return j=H,!0}let Ej=/[{}'"`\/]/g,fj=/[()'"`\/]/g,yj=/[[\]'"`\/]/g,Tj=/[<>'"`\/]/g;function T(J,H){let X=1;j++;let U=J===123?Ej:J===40?fj:J===91?yj:Tj;U.lastIndex=j;let Z;while((Z=U.exec(Y))!==null){let Q=Z.index,F=Y.charCodeAt(Q);if(F===39||F===34){j=Q,l(F),U.lastIndex=j;continue}if(F===96){j=Q,jj(),U.lastIndex=j;continue}if(F===47){if(j=Q,f()){U.lastIndex=j;continue}U.lastIndex=Q+1;continue}if(F===J)X++;else if(F===H){if(H===62&&Q>0&&Y.charCodeAt(Q-1)===61){U.lastIndex=Q+1;continue}if(X--,X===0)return j=Q+1,j}U.lastIndex=Q+1}return j=V,j}function C(){return j>0&&Y.charCodeAt(j-1)===61}let x=/[{};'"`\/\n\r]/g;function I(){let J=0;x.lastIndex=j;let H;while((H=x.exec(Y))!==null){let X=H.index,U=Y.charCodeAt(X);if(U===39||U===34){j=X,l(U),x.lastIndex=j;continue}if(U===96){j=X,jj(),x.lastIndex=j;continue}if(U===47){if(j=X,f()){x.lastIndex=j;continue}x.lastIndex=X+1;continue}if(U===123){J++,x.lastIndex=X+1;continue}if(U===125){if(J--,J<=0){j=X+1;return}x.lastIndex=X+1;continue}if(U===59&&J===0){j=X+1;return}if((U===10||U===13)&&J===0){if(j=X,p())return}x.lastIndex=X+1}j=V}function Bj(){T(123,125);while(j<V&&y(Y.charCodeAt(j)))j++;if(z("from")){j+=4;while(j<V&&y(Y.charCodeAt(j)))j++;if(j<V){let J=Y.charCodeAt(j);if(J===39||J===34)l(J)}}while(j<V&&(Y.charCodeAt(j)===32||Y.charCodeAt(j)===9))j++;if(j<V&&Y.charCodeAt(j)===59)j++}function Gj(){j++;while(j<V&&y(Y.charCodeAt(j)))j++;if(z("as")){j+=2;while(j<V&&y(Y.charCodeAt(j)))j++;E();while(j<V&&y(Y.charCodeAt(j)))j++}if(z("from")){j+=4;while(j<V&&y(Y.charCodeAt(j)))j++;if(j<V){let J=Y.charCodeAt(j);if(J===39||J===34)l(J)}}while(j<V&&(Y.charCodeAt(j)===32||Y.charCodeAt(j)===9))j++;if(j<V&&Y.charCodeAt(j)===59)j++}function k(J){if(!a)return;let H=J-1;while(H>=0&&y(Y.charCodeAt(H)))H--;if(H<0)return;let X=[],U=!1;while(H>=0){if(H>=1&&Y.charCodeAt(H)===47&&Y.charCodeAt(H-1)===42){let F=Y.lastIndexOf("/*",H-2);if(F>=0){X.push(Y.slice(F,H+1)),U=!0,H=F-1;while(H>=0&&y(Y.charCodeAt(H)))H--;continue}break}let Z=H;while(Z>0&&Y.charCodeAt(Z-1)!==10)Z--;let Q=w(Z,H+1);if(Q.startsWith("//")){if(U)break;let F=[Q];H=Z-1;while(H>=0&&(Y.charCodeAt(H)===10||Y.charCodeAt(H)===13))H--;while(H>=0){let G=H;while(G>0&&Y.charCodeAt(G-1)!==10)G--;let K=w(G,H+1);if(K.startsWith("//")){F.push(K),H=G-1;while(H>=0&&(Y.charCodeAt(H)===10||Y.charCodeAt(H)===13))H--}else if(K===""){H=G-1;while(H>=0&&(Y.charCodeAt(H)===10||Y.charCodeAt(H)===13))H--}else break}F.reverse(),X.push(F.join(`
7
+ `));continue}break}if(X.length===0)return;return X.reverse(),X}function Aj(J){let H=J,X=!1;while(j<V){let K=Y.charCodeAt(j);if(K===59){j++;break}if(K===39||K===34){l(K),X=!0;while(j<V&&(Y.charCodeAt(j)===32||Y.charCodeAt(j)===9))j++;if(j<V&&Y.charCodeAt(j)===59)j++;break}if(K===10&&X)break;j++}let U=w(H,j),Z=U.charCodeAt(7)===116&&(U.startsWith("import type ")||U.startsWith("import type{")),Q=!1;{let K=6;while(K<U.length&&(U.charCodeAt(K)===32||U.charCodeAt(K)===9))K++;if(K<U.length&&U.charCodeAt(K)===116&&U.startsWith("type",K)){K+=4;while(K<U.length&&(U.charCodeAt(K)===32||U.charCodeAt(K)===9))K++}if(K<U.length){let $=U.charCodeAt(K);Q=$===39||$===34}}let F="";{let K=U.indexOf("from ");if(K!==-1){let $=K+5;while($<U.length&&(U.charCodeAt($)===32||U.charCodeAt($)===9))$++;if($<U.length){let B=U.charCodeAt($);if(B===39||B===34){let N=U.indexOf(String.fromCharCode(B),$+1);if(N!==-1)F=U.slice($+1,N)}}}else if(Q){let $=6;while($<U.length&&U.charCodeAt($)!==39&&U.charCodeAt($)!==34)$++;if($<U.length){let B=U.charCodeAt($),N=U.indexOf(String.fromCharCode(B),$+1);if(N!==-1)F=U.slice($+1,N)}}}let G=k(H);return{kind:"import",name:"",text:U,isExported:!1,isTypeOnly:Z,isSideEffect:Q,source:F,leadingComments:G,start:H,end:j}}function Jj(){let J=j;return T(123,125),Y.slice(J,j)}function qj(J){let H=J.indexOf("(");if(H===-1)return J;let X=J.slice(H);if(X.indexOf("=")===-1)return J;let U=!1;for(let K=0;K<X.length;K++)if(X.charCodeAt(K)===61){let B=K>0?X.charCodeAt(K-1):0,N=K+1<X.length?X.charCodeAt(K+1):0;if(B!==61&&B!==33&&B!==60&&B!==62&&N!==61&&N!==62){U=!0;break}}if(!U)return J;let Z=0,Q=-1;for(let K=H;K<J.length;K++){let $=J.charCodeAt(K);if($===40)Z++;else if($===41){if(Z--,Z===0){Q=K;break}}}if(Q===-1)return J;let F=J.slice(H,Q+1),G=c(F);return J.slice(0,H)+G+J.slice(Q+1)}function Rj(J){let H=J.indexOf("//")!==-1||J.indexOf("/*")!==-1,X=J.split(`
8
+ `),U=[],Z=[],Q=[],F=!1,G=1/0;for(let B=0;B<X.length;B++){let N=X[B];if(H){if(F){if(N.includes("*/"))F=!1;continue}let D=N.trim();if(D.length===0)continue;let q=D.charCodeAt(0);if(q===47){let v=D.charCodeAt(1);if(v===47)continue;if(v===42){if(!D.includes("*/"))F=!0;continue}}if(q===42)continue;let R=bj(N);if(R.charCodeAt(R.length-1)===59)R=R.slice(0,-1);R=qj(R);let _=R.trim();if(!_)continue;U.push(R),Z.push(_);let M=0;while(M<R.length&&y(R.charCodeAt(M)))M++;if(_!=="{"&&_!=="}"){if(M<G)G=M}Q.push(M)}else{let D=N.length;while(D>0&&(N.charCodeAt(D-1)===32||N.charCodeAt(D-1)===9||N.charCodeAt(D-1)===13))D--;if(D===0)continue;let q=D<N.length?N.slice(0,D):N;if(q.charCodeAt(q.length-1)===59)q=q.slice(0,-1);q=qj(q);let R=q.trim();if(!R)continue;U.push(q),Z.push(R);let _=0;while(_<q.length&&y(q.charCodeAt(_)))_++;if(R!=="{"&&R!=="}"){if(_<G)G=_}Q.push(_)}}if(U.length===0)return"{}";if(G===1/0||G<=2)return U.join(`
9
+ `);let K=G-2,$=Array(U.length);for(let B=0;B<U.length;B++){let N=Z[B];if(N==="{"){$[B]=N;continue}let D=Q[B];if(D>G)$[B]=U[B];else if(D===G&&(N.charCodeAt(0)===125||N.charCodeAt(0)===93||N.charCodeAt(0)===41))$[B]=U[B];else{let q=Math.max(0,D-K);$[B]=" ".repeat(q)+N}}return $.join(`
10
+ `)}function W(){if(j>=V||Y.charCodeAt(j)!==60)return"";let J=j;T(60,62);let H=Y.slice(J,j);if(H.includes(`
11
+ `)){let X="",U=!1;for(let Z=0;Z<H.length;Z++){let Q=H.charCodeAt(Z);if(Q===32||Q===9||Q===10||Q===13){if(!U&&X.length>0)X+=" ",U=!0}else X+=H[Z],U=!1}if(X.charCodeAt(1)===32)X=`<${X.slice(2)}`;if(X.charCodeAt(X.length-2)===32)X=`${X.slice(0,-2)}>`;return X}return H}function m(){if(j>=V||Y.charCodeAt(j)!==40)return"()";let J=j;return T(40,41),Y.slice(J,j)}function c(J){let H=J.slice(1,-1).trim();if(!H)return"()";if(J.indexOf(`
12
+ `)===-1&&H.indexOf(":")!==-1&&H.indexOf("{")===-1&&H.indexOf("[")===-1&&H.indexOf("=")===-1&&H.indexOf("@")===-1&&H.indexOf("...")===-1){let K=0,$=0,B=0;for(let N=0;N<H.length;N++){let D=H.charCodeAt(N);if(D===40||D===60||D===123)B++;else if(D===41||D===62||D===125)B--;else if(B===0){if(D===58)K++;else if(D===44)$++}}if(K>=$+1){let N=!1;for(let D=0;D<Fj.length;D++){let q=Fj[D],R=H.indexOf(q);if(R!==-1){let _=R+q.length;if((R===0||!S(H.charCodeAt(R-1)))&&(_>=H.length||!S(H.charCodeAt(_)))){N=!0;break}}}if(!N)return J}}let X=[],U=0,Z=0,Q=!1,F=0;for(let K=0;K<=H.length;K++){if(K===H.length){X.push(H.slice(U).trim());break}let $=H.charCodeAt(K);if(Q){if($===92){K++;continue}if($===F)Q=!1;continue}if($===39||$===34||$===96){Q=!0,F=$;continue}if($===40||$===123||$===91||$===60)Z++;else if($===41||$===125||$===93||$===62&&!(K>0&&H.charCodeAt(K-1)===61))Z--;else if($===44&&Z===0)X.push(H.slice(U,K).trim()),U=K+1}let G=[];for(let K of X){if(!K)continue;let $=K.trim();if($.startsWith("//")||$.startsWith("/*"))continue;let B=K;{let N=!1,D=0;for(let q=0;q<B.length-1;q++){let R=B.charCodeAt(q);if(N){if(R===92){q++;continue}if(R===D)N=!1;continue}if(R===39||R===34||R===96){N=!0,D=R;continue}if(R===47&&B.charCodeAt(q+1)===47){B=B.slice(0,q).trimEnd();break}}}if(!B.trim())continue;G.push(Nj(B))}return`(${G.join(", ")})`}function kj(J){if(!J.startsWith("{")&&!J.startsWith("["))return J;let H="",X=0,U=0,Z=!1,Q=0;while(X<J.length){let F=J.charCodeAt(X);if(Z){if(F===92&&X+1<J.length){H+=J[X]+J[X+1],X+=2;continue}if(F===Q)Z=!1;H+=J[X],X++;continue}if(F===39||F===34||F===96){Z=!0,Q=F,H+=J[X],X++;continue}if(F===123||F===91||F===40)U++;else if(F===125||F===93||F===41)U--;if(U>=1&&F===61&&(X+1>=J.length||J.charCodeAt(X+1)!==61&&J.charCodeAt(X+1)!==62)){while(H.length>0&&(H[H.length-1]===" "||H[H.length-1]==="\t"||H[H.length-1]===`
13
+ `))H=H.slice(0,-1);X++;let G=0;while(X<J.length){let K=J.charCodeAt(X);if(K===39||K===34||K===96){let $=K;X++;while(X<J.length){if(J.charCodeAt(X)===92){X+=2;continue}if(J.charCodeAt(X)===$){X++;break}X++}continue}if(K===123||K===91||K===40)G++;else if(K===125||K===93||K===41){if(G===0)break;G--}else if(K===44&&G===0)break;X++}continue}if(U===1&&F===46&&X+2<J.length&&J.charCodeAt(X+1)===46&&J.charCodeAt(X+2)===46){X+=3;continue}H+=J[X],X++}return H}function Nj(J){let H=J.trim(),X=H.startsWith("...");if(X)H=H.slice(3).trim();while(H.startsWith("@")){let R=1;while(R<H.length&&S(H.charCodeAt(R)))R++;if(R<H.length&&H.charCodeAt(R)===40){let _=1;R++;while(R<H.length&&_>0){if(H.charCodeAt(R)===40)_++;else if(H.charCodeAt(R)===41)_--;R++}}H=H.slice(R).trim()}let U=!0;while(U){U=!1;for(let R of Fj)if(H.startsWith(R)&&H.length>R.length&&!S(H.charCodeAt(R.length))){H=H.slice(R.length).trim(),U=!0;break}}let Z=-1,Q=-1,F=0,G=!1,K=0;for(let R=0;R<H.length;R++){let _=H.charCodeAt(R);if(G){if(_===92){R++;continue}if(_===K)G=!1;continue}if(_===39||_===34||_===96){G=!0,K=_;continue}if(_===40||_===123||_===91||_===60)F++;else if(_===41||_===125||_===93||_===62&&!(R>0&&H.charCodeAt(R-1)===61))F--;else if(F===0){if(_===58&&Z===-1)Z=R;else if(_===61&&Q===-1&&(R===0||H.charCodeAt(R-1)!==61)&&(R+1>=H.length||H.charCodeAt(R+1)!==61&&H.charCodeAt(R+1)!==62))Q=R}}let $,B,N=Q!==-1;if(Z!==-1&&(Q===-1||Z<Q))if($=H.slice(0,Z).trim(),Q!==-1)B=H.slice(Z+1,Q).trim();else B=H.slice(Z+1).trim();else if(Q!==-1)$=H.slice(0,Q).trim(),B=Uj(H.slice(Q+1).trim());else $=H,B="unknown";if($=kj($),($.startsWith("{")||$.startsWith("["))&&$.includes(`
14
+ `)){let R=$.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(R.length<=40)$=R;else $=$.split(`
15
+ `).map((M)=>{let v=M.trim();if(!v)return"";if(v==="{"||v==="}"||v==="["||v==="]"||v.startsWith("}")||v.startsWith("]"))return v;return` ${v}`}).join(`
16
+ `)}let D=$.endsWith("?")||N;if($.endsWith("?"))$=$.slice(0,-1).trim();let q=D&&!X?"?":"";if(X)return`...${$}: ${B}`;return`${$}${q}: ${B}`}function Dj(J){let H=0;if(H<J.length&&J.charCodeAt(H)===45)H++;if(H>=J.length)return!1;let X=J.charCodeAt(H);if(X<48||X>57)return!1;while(H<J.length&&J.charCodeAt(H)>=48&&J.charCodeAt(H)<=57)H++;if(H<J.length&&J.charCodeAt(H)===46){if(H++,H>=J.length||J.charCodeAt(H)<48||J.charCodeAt(H)>57)return!1;while(H<J.length&&J.charCodeAt(H)>=48&&J.charCodeAt(H)<=57)H++}return H===J.length}function Uj(J){let H=J.trim();if(H==="true"||H==="false")return"boolean";if(Dj(H))return"number";if(H.startsWith("'")&&H.endsWith("'")||H.startsWith('"')&&H.endsWith('"'))return"string";if(H.startsWith("["))return"unknown[]";if(H.startsWith("{"))return"Record<string, unknown>";return"unknown"}function Xj(J){let H=J.trim();if(H==="true"||H==="false")return H;if(Dj(H))return H;if(H.startsWith("'")&&H.endsWith("'")||H.startsWith('"')&&H.endsWith('"'))return H;return"unknown"}function Yj(J){if(J.endsWith("as const"))return null;let H=0,X=-1;for(let Z=0;Z<J.length;Z++){let Q=J.charCodeAt(Z);if(Q===123||Q===91||Q===40)H++;else if(Q===125||Q===93||Q===41)H--;else if(H===0&&Q===32&&Z+4<=J.length&&J.substring(Z,Z+4)===" as ")X=Z}if(X===-1)return null;return J.slice(X+4).trim()||null}function s(){if(O(),j<V&&Y.charCodeAt(j)===58){j++,O();let J=j,H=0;while(j<V){if(f())continue;let X=Y.charCodeAt(j);if(X===40||X===91||X===60)H++;else if(X===41||X===93||X===62&&!C())H--;else if(X===123)if(H>0)H++;else{let U=w(J,j),Z=(Q)=>{let F=U.length-Q.length;return F>=0&&U.endsWith(Q)&&(F===0||!S(U.charCodeAt(F-1)))};if(U.length===0||U.endsWith("|")||U.endsWith("&")||Z("is")||Z("extends"))H++;else break}else if(X===125){if(H===0)break;H--}else if(H===0&&X===59)break;if(H===0&&o())break;j++}return w(J,j)}return""}function n(J,H,X,U){j+=8,O();let Z=j<V&&Y.charCodeAt(j)===42;if(Z)j++,O();let Q=E();if(!Q&&!U)return null;O();let F=W();O();let G=m();O();let K=s();if(!K)if(X&&Z)K="AsyncGenerator<unknown, void, unknown>";else if(Z)K="Generator<unknown, void, unknown>";else if(X)K="Promise<void>";else K="void";O();let $=!1;if(j<V&&Y.charCodeAt(j)===123)$=!0,T(123,125);else if(j<V&&Y.charCodeAt(j)===59)j++;let B=c(G),N=`${H?"export ":""}declare function ${Q||"default"}${F}${B}: ${K};`,D=k(J);if($)u.add(L.length);return{kind:"function",name:Q||"default",text:N,isExported:H,isDefault:U,isAsync:X,isGenerator:Z,returnType:K,generics:F||void 0,leadingComments:D,start:J,end:j}}function t(J,H,X){j+=H.length,O();let U=[];do{if(O(),j>=V)break;let Z=Y.charCodeAt(j);if(Z===123||Z===91)return I(),U;let Q=E();if(!Q)return I(),U;O();let F,G,K=!1;if(j<V&&Y.charCodeAt(j)===58){j++,O();let N=j,D=0;while(j<V){if(f())continue;let q=Y.charCodeAt(j);if(q===40||q===123||q===91||q===60)D++;else if(q===41||q===125||q===93||q===62&&!C())D--;else if(D===0&&(q===61||q===59||q===44))break;if(D===0&&p())break;j++}F=w(N,j)}if(j<V&&Y.charCodeAt(j)===61)if(P&&F&&!Wj(F))I();else{j++,O();let N=j,D=0;while(j<V){if(f())continue;let q=Y.charCodeAt(j);if(q===40||q===123||q===91||q===60)D++;else if(q===41||q===125||q===93||q===62&&!C())D--;else if(D===0&&(q===59||q===44))break;if(D===0&&p())break;j++}if(G=w(N,j),G.endsWith(" as const")||G==="const"){if(K=!0,!F){let q=G.endsWith(" as const")?G.slice(0,-9).trim():G,R=Xj(q);F=R!=="unknown"?R:void 0}}else if(!F){let q=Yj(G);if(q)F=q}}if(j<V){let N=Y.charCodeAt(j);if(N===44){j++;continue}if(N===59)j++}let $=k(J),B=`export declare ${H} ${Q}: ${F||"unknown"};`;U.push({kind:"variable",name:Q,text:B,isExported:!0,typeAnnotation:F,value:G,modifiers:K?[H,"const assertion"]:[H],leadingComments:$,start:J,end:j});break}while(j<V);return U}function Zj(J,H){j+=9,O();let X=E();O();let U=W();O();let Z="";if(z("extends")){j+=7,O();let $=j,B=0;while(j<V){if(f())continue;let N=Y.charCodeAt(j);if(N===60)B++;else if(N===62&&!C())B--;else if(N===123&&B===0)break;j++}Z=w($,j)}O();let Q=j<V&&Y.charCodeAt(j)===123?Jj():"{}",F=Rj(Q),G=`${H?"export ":""}declare interface ${X}${U}${Z?` extends ${Z}`:""} ${F}`,K=k(J);return{kind:"interface",name:X,text:G,isExported:H,extends:Z||void 0,generics:U||void 0,leadingComments:K,start:J,end:j}}function $j(J,H){j+=4,O();let X=E();O();let U=W();if(O(),j<V&&Y.charCodeAt(j)===61)j++;O();let Z=j,Q=0;while(j<V){if(f())continue;let $=Y.charCodeAt(j);if($===40||$===123||$===91||$===60)Q++;else if($===41||$===125||$===93||$===62&&!C())Q--;else if(Q===0&&$===59)break;if(Q===0&&p())break;j++}let F=w(Z,j);if(j<V&&Y.charCodeAt(j)===59)j++;let G=`${H?"export ":""}type ${X}${U} = ${F}`,K=k(J);return{kind:"type",name:X,text:G,isExported:H,generics:U||void 0,leadingComments:K,start:J,end:j}}function r(J,H,X){j+=4,O();let U=E();O();let Z=j;if(j<V&&Y.charCodeAt(j)===123)T(123,125);let Q=w(J,j),F=k(J);return{kind:"enum",name:U,text:Q,isExported:H,modifiers:X?["const"]:void 0,leadingComments:F,start:J,end:j}}function d(J,H,X){j+=5,O();let U=E()||"AnonymousClass";O();let Z=W();O();let Q="";if(z("extends")){j+=7,O();let B=j,N=0;while(j<V){if(f())continue;let D=Y.charCodeAt(j);if(D===60)N++;else if(D===62&&!C())N--;else if(N===0&&(D===123||z("implements")))break;j++}Q=w(B,j)}let F;if(z("implements")){j+=10,O();let B=j,N=0;while(j<V){if(f())continue;let q=Y.charCodeAt(j);if(q===60)N++;else if(q===62&&!C())N--;else if(N===0&&q===123)break;j++}let D=w(B,j);if(D)F=D.split(",").map((q)=>q.trim())}O();let G=Qj(),K=`${H?"export ":""}declare ${X?"abstract ":""}class ${U}${Z}${Q?` extends ${Q}`:""}${F&&F.length>0?` implements ${F.join(", ")}`:""} ${G}`,$=k(J);return{kind:"class",name:U,text:K,isExported:H,extends:Q||void 0,implements:F,generics:Z||void 0,modifiers:X?["abstract"]:void 0,leadingComments:$,start:J,end:j}}function Qj(){if(j>=V||Y.charCodeAt(j)!==123)return"{}";j++;let J=[];while(j<V){if(O(),j>=V)break;if(Y.charCodeAt(j)===125){j++;break}if(Y.charCodeAt(j)===59){j++;continue}if(z("static")&&_j("static")===123){j+=6,O(),T(123,125);continue}let H=!1,X=!1,U=!1,Z=!1,Q=!1,F=!1,G=!1,K=!1,$=!0;while($){if(O(),z("private")){H=!0,j+=7;continue}if(z("protected")){X=!0,j+=9;continue}if(z("public")){j+=6;continue}if(z("static")){U=!0,j+=6;continue}if(z("abstract")){Z=!0,j+=8;continue}if(z("readonly")){Q=!0,j+=8;continue}if(z("override")){F=!0,j+=8;continue}if(z("accessor")){G=!0,j+=8;continue}if(z("async")){K=!0,j+=5;continue}if(z("declare")){j+=7;continue}break}if(O(),j>=V||Y.charCodeAt(j)===125)break;if(Y.charCodeAt(j)===35)H=!0;if(H){Vj();continue}let B=" ";if(X)B+="protected ";if(U)B+="static ";if(Z)B+="abstract ";if(Q)B+="readonly ";if(z("constructor")){j+=11,O();let N=m();if(O(),Cj(N,J),j<V&&Y.charCodeAt(j)===123)T(123,125);else if(j<V&&Y.charCodeAt(j)===59)j++;let D=c(N);J.push(` constructor${D};`)}else if(z("get"))if(j+=3,O(),j<V&&(Oj(Y.charCodeAt(j))||Y.charCodeAt(j)===91||Y.charCodeAt(j)===35)){let N=Kj();if(N.startsWith("#")){if(O(),j<V&&Y.charCodeAt(j)===40)m();if(O(),s(),O(),j<V&&Y.charCodeAt(j)===123)T(123,125);else if(j<V&&Y.charCodeAt(j)===59)j++;continue}O(),m(),O();let D=s()||"unknown";if(O(),j<V&&Y.charCodeAt(j)===123)T(123,125);else if(j<V&&Y.charCodeAt(j)===59)j++;J.push(`${B}get ${N}(): ${D};`)}else Lj("get",B,U,Q,K,J);else if(z("set"))if(j+=3,O(),j<V&&(Oj(Y.charCodeAt(j))||Y.charCodeAt(j)===91||Y.charCodeAt(j)===35)){let N=Kj();if(N.startsWith("#")){if(O(),j<V&&Y.charCodeAt(j)===40)m();if(O(),j<V&&Y.charCodeAt(j)===123)T(123,125);else if(j<V&&Y.charCodeAt(j)===59)j++;continue}O();let D=m();if(O(),j<V&&Y.charCodeAt(j)===123)T(123,125);else if(j<V&&Y.charCodeAt(j)===59)j++;let q=c(D);J.push(`${B}set ${N}${q};`)}else Lj("set",B,U,Q,K,J);else{let N=Y.charCodeAt(j)===42;if(N)j++,O();let D=Kj();if(!D){Vj();continue}gj(D,B,U,Q,N,Z,K,J)}}return`{
17
+ ${J.join(`
18
+ `)}
19
+ }`}function Kj(){if(j>=V)return"";let J=Y.charCodeAt(j);if(J===91){let H=j;return T(91,93),Y.slice(H,j)}if(J===35)return j++,`#${E()}`;return E()}function _j(J){let H=j+J.length;while(H<V&&y(Y.charCodeAt(H)))H++;return H<V?Y.charCodeAt(H):0}function Vj(){let J=0;while(j<V){if(f())continue;let H=Y.charCodeAt(j);if(H===123||H===40)J++;else if(H===125||H===41){if(J===0)return;J--}else if(H===59&&J===0){j++;return}if(J===0&&o())return;j++}}function Lj(J,H,X,U,Z,Q){gj(J,H,X,U,!1,!1,Z,Q)}function gj(J,H,X,U,Z,Q,F,G){if(O(),j>=V)return;let K=Y.charCodeAt(j),$=!1;if(K===63)$=!0,j++,O();if(j<V&&Y.charCodeAt(j)===33)j++,O();let B=j<V?Y.charCodeAt(j):0;if(B===40||B===60){let N=B===60?W():"";O();let D=m();O();let q=s();if(!q)if(F&&Z)q="AsyncGenerator<unknown, void, unknown>";else if(Z)q="Generator<unknown, void, unknown>";else if(F)q="Promise<void>";else q="void";if(O(),j<V&&Y.charCodeAt(j)===123)T(123,125);else if(j<V&&Y.charCodeAt(j)===59)j++;let R=c(D),_=$?"?":"",M=Z?"*":"";G.push(`${H}${M}${J}${_}${N}${R}: ${q};`)}else if(B===58||B===61||B===59||B===125||B===10||B===13){let N="";if(B===58){j++,O();let R=j,_=0;while(j<V){if(f())continue;let M=Y.charCodeAt(j);if(M===40||M===123||M===91||M===60)_++;else if(M===41||M===125||M===93||M===62&&!C()){if(_===0)break;_--}else if(_===0&&(M===59||M===61||M===44))break;if(_===0&&o())break;j++}N=w(R,j)}let D="";if(j<V&&Y.charCodeAt(j)===61)if(P&&N){j++;let R=0;while(j<V){if(f())continue;let _=Y.charCodeAt(j);if(_===40||_===123||_===91)R++;else if(_===41||_===125||_===93){if(R===0&&_===125)break;R--}else if(R===0&&_===59)break;if(R===0&&o())break;j++}}else{j++,O();let R=j,_=0;while(j<V){if(f())continue;let M=Y.charCodeAt(j);if(M===40||M===123||M===91)_++;else if(M===41||M===125||M===93){if(_===0&&M===125)break;_--}else if(_===0&&M===59)break;if(_===0&&o())break;j++}D=w(R,j)}if(j<V&&Y.charCodeAt(j)===59)j++;if(!N)if(D){let R=Yj(D);if(R)N=R;else N=X&&U?Xj(D):Uj(D)}else N="unknown";let q=$?"?":"";G.push(`${H}${J}${q}: ${N};`)}else Vj()}function Cj(J,H){let X=J.slice(1,-1).trim();if(!X)return;let U=[],Z=0,Q=0,F=!1,G=0;for(let K=0;K<=X.length;K++){if(K===X.length){U.push(X.slice(Z).trim());break}let $=X.charCodeAt(K);if(F){if($===92){K++;continue}if($===G)F=!1;continue}if($===39||$===34||$===96){F=!0,G=$;continue}if($===40||$===123||$===91||$===60)Q++;else if($===41||$===125||$===93||$===62&&!(K>0&&X.charCodeAt(K-1)===61))Q--;else if($===44&&Q===0)U.push(X.slice(Z,K).trim()),Z=K+1}for(let K of U){let $=K.startsWith("public ")||K.startsWith("public\t"),B=K.startsWith("protected ")||K.startsWith("protected\t"),N=K.startsWith("private ")||K.startsWith("private\t"),D=K.includes("readonly ");if(!$&&!B&&!N&&!D)continue;if(N)continue;let q=K,R=[];if($){let v=6;while(v<q.length&&y(q.charCodeAt(v)))v++;q=q.slice(v),R.push("public")}if(B){let v=9;while(v<q.length&&y(q.charCodeAt(v)))v++;q=q.slice(v),R.push("protected")}if(D){let v=q.indexOf("readonly ");if(v!==-1){let Hj=v+8;while(Hj<q.length&&y(q.charCodeAt(Hj)))Hj++;q=q.slice(0,v)+q.slice(Hj)}R.push("readonly")}let _=R.length>0?`${R.join(" ")} `:"",M=Nj(q);H.push(` ${_}${M};`)}}function zj(J=" "){if(j>=V||Y.charCodeAt(j)!==123)return"{}";j++;let H=[];while(j<V){if(O(),j>=V)break;if(Y.charCodeAt(j)===125){j++;break}if(Y.charCodeAt(j)===59){j++;continue}let X=!1;if(z("export"))X=!0,j+=6,O();if(z("declare"))j+=7,O();let U=X?"export ":"";if(z("function")||z("async")&&Sj("async","function")){let Z=!1;if(z("async"))Z=!0,j+=5,O();if(j+=8,O(),j<V&&Y.charCodeAt(j)===42)j++,O();let F=E();O();let G=W();O();let K=m();O();let $=s();if(!$)$=Z?"Promise<void>":"void";if(O(),j<V&&Y.charCodeAt(j)===123)T(123,125);else if(j<V&&Y.charCodeAt(j)===59)j++;let B=c(K);H.push(`${J}${U}function ${F}${G}${B}: ${$};`)}else if(z("const")||z("let")||z("var")){let Z=z("const")?"const":z("let")?"let":"var";j+=Z.length,O();let Q=E();if(!Q){I();continue}O();let F="";if(j<V&&Y.charCodeAt(j)===58){j++,O();let K=j,$=0;while(j<V){if(f())continue;let B=Y.charCodeAt(j);if(B===40||B===123||B===91||B===60)$++;else if(B===41||B===125||B===93||B===62&&!C())$--;else if($===0&&(B===61||B===59||B===44))break;if($===0&&p())break;j++}F=w(K,j)}let G="";if(j<V&&Y.charCodeAt(j)===61){j++,O();let K=j,$=0;while(j<V){if(f())continue;let B=Y.charCodeAt(j);if(B===40||B===123||B===91||B===60)$++;else if(B===41||B===125||B===93||B===62&&!C())$--;else if($===0&&(B===59||B===44))break;if($===0&&p())break;j++}G=w(K,j)}if(j<V&&Y.charCodeAt(j)===59)j++;if(!F&&G){let K=Yj(G);if(K)F=K;else if(Z==="const")F=Xj(G);else F=Uj(G)}if(!F)F="unknown";H.push(`${J}${U}${Z} ${Q}: ${F};`)}else if(z("interface")){j+=9,O();let Z=E();O();let Q=W();O();let F="";if(z("extends")){let K=j;while(j<V&&Y.charCodeAt(j)!==123){if(f())continue;j++}F=Y.slice(K,j)}let G=Rj(Jj());H.push(`${J}${U}interface ${Z}${Q}${F} ${G}`)}else if(z("type")){j+=4,O();let Z=E();O();let Q=W();if(O(),j<V&&Y.charCodeAt(j)===61){j++,O();let F=j,G=0;while(j<V){if(f())continue;let $=Y.charCodeAt(j);if($===40||$===123||$===91||$===60)G++;else if($===41||$===125||$===93||$===62&&!C())G--;else if(G===0&&$===59)break;if(G===0&&p())break;j++}let K=w(F,j);if(j<V&&Y.charCodeAt(j)===59)j++;H.push(`${J}${U}type ${Z}${Q} = ${K}`)}}else if(z("class")){j+=5,O();let Z=E();O();let Q=W();O();let F=j;while(j<V&&Y.charCodeAt(j)!==123){if(f())continue;j++}let G=w(F,j),K=G?` ${G}`:"",$=Qj();H.push(`${J}${U}class ${Z}${Q}${K} ${$}`)}else if(z("enum")){j+=4,O();let Z=E();O();let Q=Jj();H.push(`${J}${U}enum ${Z} ${Q}`)}else if(z("namespace")||z("module")){let Z=z("namespace")?"namespace":"module";j+=Z.length,O();let Q=E();O();let F=zj(J);H.push(`${J}${U}${Z} ${Q} ${F}`)}else if(z("abstract"))if(j+=8,O(),z("class")){j+=5,O();let Z=E();O();let Q=W();O();let F=j;while(j<V&&Y.charCodeAt(j)!==123){if(f())continue;j++}let G=w(F,j),K=G?` ${G}`:"",$=Qj();H.push(`${J}${U}abstract class ${Z}${Q}${K} ${$}`)}else I();else if(X&&z("default")){j+=7,O();let Z=j;I();let Q=w(Z,j);if(Q.charCodeAt(Q.length-1)===59)Q=Q.slice(0,-1);if(Q)H.push(`${J}export default ${Q};`)}else if(!X&&(Y.charCodeAt(j)===39||Y.charCodeAt(j)===34||Y.charCodeAt(j)===96))I();else I()}if(H.length===0)return"{}";return`{
20
+ ${H.join(`
21
+ `)}
22
+ }`}function Sj(J,H){let X=j+J.length;while(X<V&&y(Y.charCodeAt(X)))X++;for(let U=0;U<H.length;U++)if(X+U>=V||Y.charCodeAt(X+U)!==H.charCodeAt(U))return!1;return X+H.length>=V||!S(Y.charCodeAt(X+H.length))}function i(J,H,X){j+=X.length,O();let U="",Z=Y.charCodeAt(j);if(Z===39||Z===34){let $=j;l(Z),U=Y.slice($,j)}else{U=E();while(j<V&&Y.charCodeAt(j)===46)j++,U+=`.${E()}`}O();let Q=j<V&&Y.charCodeAt(j)===123?zj():"{}",F=`${H?"export ":""}declare ${X} ${U} ${Q}`,G=k(J),K=U.startsWith("'")||U.startsWith('"');return{kind:"module",name:U,text:F,isExported:H,source:K?U.slice(1,-1):void 0,leadingComments:G,start:J,end:j}}while(j<V){if(O(),j>=V)break;let J=j,H=Y.charCodeAt(j);if(H===105&&z("import"))L.push(Aj(J));else if(H===101&&z("export")){j+=6,O();let X=Y.charCodeAt(j);if(X===100&&z("default")){j+=7,O();let U=Y.charCodeAt(j);if(U===102&&z("function")){let Z=n(J,!0,!1,!0);if(Z)L.push(Z)}else if(U===97&&z("async")&&_j("async")!==59)if(j+=5,O(),z("function")){let Z=n(J,!0,!0,!0);if(Z)L.push(Z)}else{I();let Z=w(J,j);L.push({kind:"export",name:"default",text:Z,isExported:!0,isTypeOnly:!1,start:J,end:j})}else if(U===99&&z("class")){let Z=d(J,!0,!1);L.push(Z)}else if(U===97&&z("abstract")){if(j+=8,O(),z("class")){let Z=d(J,!0,!0);L.push(Z)}}else{I();let Z=w(J,j),Q=k(J);L.push({kind:"export",name:"default",text:Z,isExported:!0,isTypeOnly:!1,leadingComments:Q,start:J,end:j})}}else if(X===116&&z("type")){let U=j;if(j+=4,O(),j<V&&Y.charCodeAt(j)===123){Bj();let Z=w(J,j),Q=k(J);L.push({kind:"export",name:"",text:Z,isExported:!0,isTypeOnly:!0,leadingComments:Q,start:J,end:j})}else if(j<V&&Y.charCodeAt(j)===42){Gj();let Z=w(J,j);L.push({kind:"export",name:"",text:Z,isExported:!0,isTypeOnly:!0,start:J,end:j})}else{j=U;let Z=$j(J,!0);L.push(Z)}}else if(X===105&&z("interface")){let U=Zj(J,!0);L.push(U)}else if(X===102&&z("function")){let U=n(J,!0,!1,!1);if(U)L.push(U)}else if(X===97&&z("async"))if(j+=5,O(),z("function")){let U=n(J,!0,!0,!1);if(U)L.push(U)}else I();else if(X===99)if(z("class")){let U=d(J,!0,!1);L.push(U)}else if(z("const")){let U=j;if(j+=5,O(),z("enum")){j=U+5,O();let Z=r(J,!0,!0);L.push(Z)}else{j=U;let Z=t(J,"const",!0);for(let Q=0;Q<Z.length;Q++)L.push(Z[Q])}}else I();else if(X===97&&z("abstract")){if(j+=8,O(),z("class")){let U=d(J,!0,!0);L.push(U)}}else if(X===108&&z("let")){let U=t(J,"let",!0);for(let Z=0;Z<U.length;Z++)L.push(U[Z])}else if(X===118&&z("var")){let U=t(J,"var",!0);for(let Z=0;Z<U.length;Z++)L.push(U[Z])}else if(X===101&&z("enum")){let U=r(J,!0,!1);L.push(U)}else if(X===100&&z("declare"))j+=7,O(),Mj(J,!0);else if(X===110&&z("namespace")){let U=i(J,!0,"namespace");L.push(U)}else if(X===109&&z("module")){let U=i(J,!0,"module");L.push(U)}else if(X===123){Bj();let U=w(J,j),Z=U.includes("export type"),Q=k(J);L.push({kind:"export",name:"",text:U,isExported:!0,isTypeOnly:Z,leadingComments:Q,start:J,end:j})}else if(X===42){Gj();let U=w(J,j),Z=k(J),Q,F=U.indexOf("from ");if(F!==-1){let G=F+5;while(G<U.length&&(U.charCodeAt(G)===32||U.charCodeAt(G)===9))G++;if(G<U.length){let K=U.charCodeAt(G);if(K===39||K===34){let $=U.indexOf(U[G],G+1);if($!==-1)Q=U.slice(G+1,$)}}}L.push({kind:"export",name:"",text:U,isExported:!0,isTypeOnly:!1,source:Q,leadingComments:Z,start:J,end:j})}else{I();let U=w(J,j);if(U)L.push({kind:"export",name:"",text:U,isExported:!0,start:J,end:j})}}else if(H===100&&z("declare"))j+=7,O(),Mj(J,!1);else if(H===105&&z("interface")){let X=Zj(J,!1);b.set(X.name,X)}else if(H===116&&z("type")){let X=$j(J,!1);b.set(X.name,X),L.push(X)}else if(H===102&&z("function"))I();else if(H===97)if(z("async"))I();else if(z("abstract"))if(j+=8,O(),z("class")){let X=d(J,!1,!1);b.set(X.name,X),L.push(X)}else I();else j++,I();else if(H===99)if(z("class")){let X=d(J,!1,!1);b.set(X.name,X),L.push(X)}else if(z("const")){let X=j;if(j+=5,O(),z("enum")){j=X+5,O();let U=r(J,!1,!0);b.set(U.name,U),L.push(U)}else j=X,I()}else j++,I();else if(H===101&&z("enum")){let X=r(J,!1,!1);b.set(X.name,X),L.push(X)}else if(H===108&&z("let"))I();else if(H===118&&z("var"))I();else if(H===109&&z("module")){let X=i(J,!1,"module");L.push(X)}else if(H===110&&z("namespace")){let X=i(J,!1,"namespace");L.push(X)}else{let X=Y.charCodeAt(j);if(X===39||X===34){if(l(X),j<V&&Y.charCodeAt(j)===59)j++}else if(X===96){if(jj(),j<V&&Y.charCodeAt(j)===59)j++}else if(X===64){if(j++,E(),O(),j<V&&Y.charCodeAt(j)===46)j++,E(),O();if(j<V&&Y.charCodeAt(j)===40)T(40,41)}else j++,I()}}if(b.size>0)uj(L,b);if(u.size>0){let J=new Map;for(let X of L)if(X.kind==="function")J.set(X.name,(J.get(X.name)||0)+1);let H=new Set;for(let[X,U]of J)if(U>1)H.add(X);if(H.size>0){let X=new Set;for(let U of H)for(let Z=L.length-1;Z>=0;Z--)if(L[Z].kind==="function"&&L[Z].name===U&&u.has(Z)){X.add(Z);break}if(X.size>0){let U=[...X].sort((Z,Q)=>Q-Z);for(let Z of U)L.splice(Z,1)}}}return L;function Mj(J,H){if(z("function")){let X=n(J,H,!1,!1);if(X)L.push(X)}else if(z("async")){if(j+=5,O(),z("function")){let X=n(J,H,!0,!1);if(X)L.push(X)}}else if(z("class")){let X=d(J,H,!1);L.push(X)}else if(z("abstract")){if(j+=8,O(),z("class")){let X=d(J,H,!0);L.push(X)}}else if(z("interface")){let X=Zj(J,H);L.push(X)}else if(z("type")){let X=$j(J,H);L.push(X)}else if(z("enum")){let X=r(J,H,!1);L.push(X)}else if(z("const")){let X=j;if(j+=5,O(),z("enum")){j=X+5,O();let U=r(J,H,!0);L.push(U)}else if(H){j=X;let U=t(J,"const",!0);for(let Z=0;Z<U.length;Z++)L.push(U[Z])}else I()}else if(z("let")||z("var"))if(H){let X=z("let")?"let":"var",U=t(J,X,!0);for(let Z=0;Z<U.length;Z++)L.push(U[Z])}else I();else if(z("module")){let X=i(J,H,"module");L.push(X)}else if(z("namespace")){let X=i(J,H,"namespace");L.push(X)}else if(z("global")){j+=6,O();let U=`declare global ${j<V&&Y.charCodeAt(j)===123?zj():"{}"}`,Z=k(J);L.push({kind:"module",name:"global",text:U,isExported:!1,leadingComments:Z,start:J,end:j})}else I()}}function Pj(g,e){let A=0,h=g.length;while(A<h){let Y=g.charCodeAt(A);if(Y>=65&&Y<=90||Y>=97&&Y<=122||Y===95||Y===36||Y>127){let a=A;A++;while(A<h){let P=g.charCodeAt(A);if(P>=65&&P<=90||P>=97&&P<=122||P>=48&&P<=57||P===95||P===36||P>127)A++;else break}e.add(g.substring(a,A))}else A++}}function uj(g,e){let A=new Set,h=new Set;for(let P of g)h.add(P.name);let Y=new Set,a=[];for(let P=0;P<g.length;P++)if(g[P].kind!=="import")a.push(g[P].text),Pj(g[P].text,Y);for(;;){let P=[];for(let[b,u]of e){if(A.has(b))continue;if(Y.has(b)){if(!h.has(b))P.push(u),h.add(b);A.add(b)}}if(P.length===0)break;P.sort((b,u)=>(b.start??1/0)-(u.start??1/0));let V=[],L=0;for(let b=0;b<g.length;b++){let u=g[b].start??1/0;while(L<P.length&&(P[L].start??1/0)<=u)V.push(P[L++]);V.push(g[b])}while(L<P.length)V.push(P[L++]);g.length=0;for(let b=0;b<V.length;b++)g.push(V[b]);for(let b of P)if(b.kind!=="import")a.push(b.text),Pj(b.text,Y)}}
23
+ export{xj as nc};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as z}from"./chunk-3mxzfgcv.js";function C(F={}){let{preBuild:H=!1,postBuild:I=!0,onGenerated:J,onError:w,...q}=F,y=async()=>{try{let j=await z(q);J?.(j)}catch(j){let k=j instanceof Error?j:Error(String(j));if(w?.(k),!w)console.error("[dtsx] Generation failed:",k.message)}};return{name:"dtsx",async setup(j){let k=j.config;if(!q.entrypoints&&k.entrypoints)q.entrypoints=k.entrypoints;if(!q.outdir&&k.outdir)q.outdir=k.outdir;if(!q.root&&k.root)q.root=k.root;if(H)j.onStart(async()=>{await y()});if(I){let v=!1;j.onLoad({filter:/.*/},async(K)=>{if(!v)queueMicrotask(async()=>{if(!v)v=!0,await y()});return})}}}}var M=C,P=C;
2
+ import{tb as z}from"./chunk-8dx98fd5.js";function C(F={}){let{preBuild:H=!1,postBuild:I=!0,onGenerated:J,onError:w,...q}=F,y=async()=>{try{let j=await z(q);J?.(j)}catch(j){let k=j instanceof Error?j:Error(String(j));if(w?.(k),!w)console.error("[dtsx] Generation failed:",k.message)}};return{name:"dtsx",async setup(j){let k=j.config;if(!q.entrypoints&&k.entrypoints)q.entrypoints=k.entrypoints;if(!q.outdir&&k.outdir)q.outdir=k.outdir;if(!q.root&&k.root)q.root=k.root;if(H)j.onStart(async()=>{await y()});if(I){let v=!1;j.onLoad({filter:/.*/},async(K)=>{if(!v)queueMicrotask(async()=>{if(!v)v=!0,await y()});return})}}}}var M=C,P=C;
3
3
  export{C as fa,M as ga,P as ha};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{lc as I}from"./chunk-74j5mydx.js";import{nc as H}from"./chunk-rnt0wkrk.js";import{Bc as G}from"./chunk-j22v8wfe.js";function N(q,v="stdin.ts",z=!0,B=["bun"],E=!1){let A=I(q,v,z,E);return G(A,{filePath:v,sourceCode:q,declarations:A},z,B)}function P(q,v="stdin.ts",z=!0,B=["bun"],E=!1){let A=H(q,v,z,E);return G(A,{filePath:v,sourceCode:q,declarations:A},z,B)}
2
+ import{lc as I}from"./chunk-gpxdn99a.js";import{nc as H}from"./chunk-me2ae6f0.js";import{Bc as G}from"./chunk-97pgeywh.js";function N(q,v="stdin.ts",z=!0,B=["bun"],E=!1){let A=I(q,v,z,E);return G(A,{filePath:v,sourceCode:q,declarations:A},z,B)}function P(q,v="stdin.ts",z=!0,B=["bun"],E=!1){let A=H(q,v,z,E);return G(A,{filePath:v,sourceCode:q,declarations:A},z,B)}
3
3
  export{N as ic,P as jc};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{tb as K}from"./chunk-3mxzfgcv.js";function L(N={}){let{buildStart:P=!0,buildEnd:Q=!1,writeBundle:T=!1,modes:y,onGenerated:U,onError:H,...W}=N,I="production",z=async()=>{try{let q=await K(W);U?.(q)}catch(q){let J=q instanceof Error?q:Error(String(q));if(H?.(J),!H)console.error("[dtsx] Generation failed:",J.message)}},F=()=>{if(!y||y.length===0)return!0;return y.includes(I)};return{name:"dtsx",apply(q){return I=q.mode,!0},async buildStart(){if(P&&F())await z()},async buildEnd(){if(Q&&F())await z()},async writeBundle(){if(T&&F())await z()}}}var Y=L,_=L;
2
+ import{tb as K}from"./chunk-8dx98fd5.js";function L(N={}){let{buildStart:P=!0,buildEnd:Q=!1,writeBundle:T=!1,modes:y,onGenerated:U,onError:H,...W}=N,I="production",z=async()=>{try{let q=await K(W);U?.(q)}catch(q){let J=q instanceof Error?q:Error(String(q));if(H?.(J),!H)console.error("[dtsx] Generation failed:",J.message)}},F=()=>{if(!y||y.length===0)return!0;return y.includes(I)};return{name:"dtsx",apply(q){return I=q.mode,!0},async buildStart(){if(P&&F())await z()},async buildEnd(){if(Q&&F())await z()},async writeBundle(){if(T&&F())await z()}}}var Y=L,_=L;
3
3
  export{L as ca,Y as da,_ as ea};
@@ -1,2 +1,2 @@
1
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-09zp67d8.js";import"./chunk-3mxzfgcv.js";import"./chunk-9mjc7ddv.js";import"./chunk-p1d09y82.js";import"./chunk-1mm3t0nr.js";import"./chunk-74j5mydx.js";import"./chunk-rnt0wkrk.js";import"./chunk-j22v8wfe.js";import"./chunk-dk2vv0np.js";import"./chunk-f18nyrrb.js";import"./chunk-57agx6g8.js";import"./chunk-rw6j20e2.js";export{b as sortProjectsByDependencies,f as resolveWorkspacePatterns,c as generateWorkspace,d as generateMonorepo,g as generateFromPackageWorkspaces,a as discoverWorkspaceProjects,e as discoverWorkspaceFromPackageJson};
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-5fveksya.js";import"./chunk-8dx98fd5.js";import"./chunk-2w3g3g00.js";import"./chunk-p1d09y82.js";import"./chunk-qn0xktfx.js";import"./chunk-gpxdn99a.js";import"./chunk-me2ae6f0.js";import"./chunk-97pgeywh.js";import"./chunk-0fhq2wva.js";import"./chunk-f18nyrrb.js";import"./chunk-57agx6g8.js";import"./chunk-rw6j20e2.js";export{b as sortProjectsByDependencies,f as resolveWorkspacePatterns,c as generateWorkspace,d as generateMonorepo,g as generateFromPackageWorkspaces,a as discoverWorkspaceProjects,e as discoverWorkspaceFromPackageJson};
@@ -6,7 +6,7 @@ export declare function createIncrementalBuilder(cache: IncrementalCache, config
6
6
  /**
7
7
  * Prune old cache entries
8
8
  */
9
- export declare function pruneCache(cache: IncrementalCache, _maxAge?: number, // 7 days default: unknown): Promise<number>;
9
+ export declare function pruneCache(cache: IncrementalCache, _maxAge?: number): Promise<number>;
10
10
  /**
11
11
  * Format incremental build result
12
12
  */
package/dist/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{a as b9,b as P9,c as x9}from"../chunk-fw6wcdfd.js";import{d as O8,e as A8,f as G8,g as B8,h as z8,i as N8,j as j8,k as R8}from"../chunk-bn29kee5.js";import{l as m9,m as p9,n as d9,o as c9,p as l9,q as o9,r as s9}from"../chunk-09zp67d8.js";import{s as w9,t as I9,u as T9,v as S9,w as k9,x as C9,y as v9}from"../chunk-fbqcsr60.js";import{A as I6,B as T6,C as S6,D as k6,E as C6,F as v6,G as b6,H as P6,z as w6}from"../chunk-jm5ywn4e.js";import{I as f8,J as u8,K as m8,L as p8,M as d8,N as c8,O as l8,P as o8}from"../chunk-d0p3jzwb.js";import{Q as x6,R as y6,S as h6,T as g6,U as f6,V as u6,W as m6,X as p6,Y as d6}from"../chunk-r1ywapeb.js";import{$ as g9,Z as y9,_ as h9,aa as f9,ba as u9}from"../chunk-6qv7p9sg.js";import{$a as h8,Aa as M6,Ba as c6,Ca as l6,Da as o6,Ea as QX,Fa as s6,Ga as a6,Ha as i6,Ia as n6,Ja as r6,Ka as t6,La as F8,Ma as D8,Na as E8,Oa as L8,Pa as M8,Qa as w8,Ra as I8,Sa as T8,Ta as S8,Ua as k8,Va as C8,Wa as v8,Xa as b8,Ya as P8,Za as x8,_a as y8,ab as g8,bb as s8,cb as a8,db as i8,eb as n8,fb as r8,gb as t8,hb as mX,ib as e8,jb as X9,kb as Z9,lb as A9,mb as G9,nb as B9,ob as z9,pb as N9,qb as j9,rb as R9,sb as F9,tb as E9,ua as j6,ub as L9,va as R6,vb as M9,wa as F6,xa as D6,ya as E6,za as L6}from"../chunk-3mxzfgcv.js";import{$b as _6,Ab as v4,Bb as gZ,Cb as fZ,Db as p4,Eb as d4,Fb as c4,Gb as l4,Hb as o4,Ib as s4,Jb as a4,Kb as i4,Lb as n4,Mb as r4,Nb as t4,Ob as e4,Pb as X6,Qb as Z6,Rb as $6,Sb as J6,Tb as Q6,Ub as q6,Vb as Y6,Wb as V6,Xb as W6,Yb as K6,Zb as H6,_b as U6,ac as O6,bc as A6,cc as G6,dc as B6,ec as EX,fc as z6,gc as N6,wb as T4,xb as S4,yb as k4,zb as C4}from"../chunk-9mjc7ddv.js";import{hc as SZ}from"../chunk-p1d09y82.js";import{ic as D9}from"../chunk-1mm3t0nr.js";import"../chunk-74j5mydx.js";import"../chunk-rnt0wkrk.js";import{Ac as O9,Bc as LX,oc as uZ,pc as $9,qc as J9,rc as Q9,sc as q9,tc as Y9,uc as V9,vc as W9,wc as K9,xc as H9,yc as U9,zc as _9}from"../chunk-j22v8wfe.js";import{Ec as b4,Fc as P4,Gc as x4,Hc as y4,Ic as h4,Jc as hZ,Kc as g4,Lc as f4,Mc as u4,Nc as m4}from"../chunk-dk2vv0np.js";import{Oc as V8,Pc as W8,Qc as K8,Rc as H8,Sc as U8,Tc as _8}from"../chunk-f18nyrrb.js";import{$c as Y8,Uc as e6,Vc as X8,Wc as Z8,Xc as $8,Yc as J8,Zc as Q8,_c as q8}from"../chunk-57agx6g8.js";import{ad as TZ,cd as v}from"../chunk-rw6j20e2.js";function C0(X){if(!X||typeof X!=="string")throw Error("Invalid file path: must be a non-empty string");return X}function v0(X){if(!X||typeof X!=="string")throw Error("Invalid directory path: must be a non-empty string");return X}function b0(X){if(!X||typeof X!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return X}function P0(X){if(typeof X!=="string")throw TypeError("Invalid source code: must be a string");return X}function x0(X){if(typeof X!=="string")throw TypeError("Invalid DTS content: must be a string");return X}function y0(X){if(!X||typeof X!=="string")throw Error("Invalid module specifier: must be a non-empty string");return X}function h0(X){if(!X||typeof X!=="string")throw Error("Invalid type name: must be a non-empty string");if(!["string","number","boolean","symbol","bigint","undefined","null","void","never","any","unknown","object"].includes(X)&&!/^[A-Z_$]/.test(X));return X}function g0(X){if(!X||typeof X!=="string")throw Error("Invalid declaration name: must be a non-empty string");return X}function f0(X){if(!X||typeof X!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!X.startsWith("/")&&!/^[A-Z]:/i.test(X))throw Error("Invalid absolute path: must start with / or drive letter");return X}function u0(X){if(!X||typeof X!=="string")throw Error("Invalid relative path: must be a non-empty string");if(X.startsWith("/")||/^[A-Z]:/i.test(X))throw Error("Invalid relative path: must not be absolute");return X}function m0(X){if(typeof X!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(X)}catch{throw Error("Invalid JSON string: must be valid JSON")}return X}function p0(X,Z){return typeof X==="string"||typeof X==="number"}function d0(X){return X}var c0={join(X,...Z){let{join:$}=v("path");return $(X,...Z)},dirname(X){let{dirname:Z}=v("path");return Z(X)},basename(X){let{basename:Z}=v("path");return Z(X)},resolve(...X){let{resolve:Z}=v("path");return Z(...X)},isAbsolute(X){let{isAbsolute:Z}=v("path");return Z(X)},relative(X,Z){let{relative:$}=v("path");return $(X,Z)}};function nX(X,Z){let $=X.length,J=Z.length,Q=Array.from({length:$+1},()=>Array(J+1).fill(0));for(let q=1;q<=$;q++)for(let Y=1;Y<=J;Y++)if(X[q-1]===Z[Y-1])Q[q][Y]=Q[q-1][Y-1]+1;else Q[q][Y]=Math.max(Q[q-1][Y],Q[q][Y-1]);return Q}function rX(X,Z,$,J,Q){let q=[];while(J>0||Q>0)if(J>0&&Q>0&&Z[J-1]===$[Q-1])q.unshift({op:"equal",oldIdx:J-1,newIdx:Q-1,line:Z[J-1]}),J--,Q--;else if(Q>0&&(J===0||X[J][Q-1]>=X[J-1][Q]))q.unshift({op:"add",newIdx:Q-1,line:$[Q-1]}),Q--;else if(J>0)q.unshift({op:"remove",oldIdx:J-1,line:Z[J-1]}),J--;return q}function JX(X,Z){let $=X;if(Z.ignoreWhitespace)$=$.replace(/\s+/g," ").trim();return $}function d(X,Z,$,J={}){let{context:Q=3,ignoreWhitespace:q=!1,ignoreBlankLines:Y=!1}=J,V=X.split(`
2
+ import{a as b9,b as P9,c as x9}from"../chunk-efkpkyz9.js";import{d as O8,e as A8,f as G8,g as B8,h as z8,i as N8,j as j8,k as R8}from"../chunk-20kdv9bh.js";import{l as m9,m as p9,n as d9,o as c9,p as l9,q as o9,r as s9}from"../chunk-5fveksya.js";import{s as w9,t as I9,u as T9,v as S9,w as k9,x as C9,y as v9}from"../chunk-jddkdjap.js";import{A as I6,B as T6,C as S6,D as k6,E as C6,F as v6,G as b6,H as P6,z as w6}from"../chunk-jm5ywn4e.js";import{I as f8,J as u8,K as m8,L as p8,M as d8,N as c8,O as l8,P as o8}from"../chunk-d0p3jzwb.js";import{Q as x6,R as y6,S as h6,T as g6,U as f6,V as u6,W as m6,X as p6,Y as d6}from"../chunk-r1ywapeb.js";import{$ as g9,Z as y9,_ as h9,aa as f9,ba as u9}from"../chunk-6qv7p9sg.js";import{$a as h8,Aa as M6,Ba as c6,Ca as l6,Da as o6,Ea as QX,Fa as s6,Ga as a6,Ha as i6,Ia as n6,Ja as r6,Ka as t6,La as F8,Ma as D8,Na as E8,Oa as L8,Pa as M8,Qa as w8,Ra as I8,Sa as T8,Ta as S8,Ua as k8,Va as C8,Wa as v8,Xa as b8,Ya as P8,Za as x8,_a as y8,ab as g8,bb as s8,cb as a8,db as i8,eb as n8,fb as r8,gb as t8,hb as mX,ib as e8,jb as X9,kb as Z9,lb as A9,mb as G9,nb as B9,ob as z9,pb as N9,qb as j9,rb as R9,sb as F9,tb as E9,ua as j6,ub as L9,va as R6,vb as M9,wa as F6,xa as D6,ya as E6,za as L6}from"../chunk-8dx98fd5.js";import{$b as _6,Ab as v4,Bb as gZ,Cb as fZ,Db as p4,Eb as d4,Fb as c4,Gb as l4,Hb as o4,Ib as s4,Jb as a4,Kb as i4,Lb as n4,Mb as r4,Nb as t4,Ob as e4,Pb as X6,Qb as Z6,Rb as $6,Sb as J6,Tb as Q6,Ub as q6,Vb as Y6,Wb as V6,Xb as W6,Yb as K6,Zb as H6,_b as U6,ac as O6,bc as A6,cc as G6,dc as B6,ec as EX,fc as z6,gc as N6,wb as T4,xb as S4,yb as k4,zb as C4}from"../chunk-2w3g3g00.js";import{hc as SZ}from"../chunk-p1d09y82.js";import{ic as D9}from"../chunk-qn0xktfx.js";import"../chunk-gpxdn99a.js";import"../chunk-me2ae6f0.js";import{Ac as O9,Bc as LX,oc as uZ,pc as $9,qc as J9,rc as Q9,sc as q9,tc as Y9,uc as V9,vc as W9,wc as K9,xc as H9,yc as U9,zc as _9}from"../chunk-97pgeywh.js";import{Ec as b4,Fc as P4,Gc as x4,Hc as y4,Ic as h4,Jc as hZ,Kc as g4,Lc as f4,Mc as u4,Nc as m4}from"../chunk-0fhq2wva.js";import{Oc as V8,Pc as W8,Qc as K8,Rc as H8,Sc as U8,Tc as _8}from"../chunk-f18nyrrb.js";import{$c as Y8,Uc as e6,Vc as X8,Wc as Z8,Xc as $8,Yc as J8,Zc as Q8,_c as q8}from"../chunk-57agx6g8.js";import{ad as TZ,cd as v}from"../chunk-rw6j20e2.js";function C0(X){if(!X||typeof X!=="string")throw Error("Invalid file path: must be a non-empty string");return X}function v0(X){if(!X||typeof X!=="string")throw Error("Invalid directory path: must be a non-empty string");return X}function b0(X){if(!X||typeof X!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return X}function P0(X){if(typeof X!=="string")throw TypeError("Invalid source code: must be a string");return X}function x0(X){if(typeof X!=="string")throw TypeError("Invalid DTS content: must be a string");return X}function y0(X){if(!X||typeof X!=="string")throw Error("Invalid module specifier: must be a non-empty string");return X}function h0(X){if(!X||typeof X!=="string")throw Error("Invalid type name: must be a non-empty string");if(!["string","number","boolean","symbol","bigint","undefined","null","void","never","any","unknown","object"].includes(X)&&!/^[A-Z_$]/.test(X));return X}function g0(X){if(!X||typeof X!=="string")throw Error("Invalid declaration name: must be a non-empty string");return X}function f0(X){if(!X||typeof X!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!X.startsWith("/")&&!/^[A-Z]:/i.test(X))throw Error("Invalid absolute path: must start with / or drive letter");return X}function u0(X){if(!X||typeof X!=="string")throw Error("Invalid relative path: must be a non-empty string");if(X.startsWith("/")||/^[A-Z]:/i.test(X))throw Error("Invalid relative path: must not be absolute");return X}function m0(X){if(typeof X!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(X)}catch{throw Error("Invalid JSON string: must be valid JSON")}return X}function p0(X,Z){return typeof X==="string"||typeof X==="number"}function d0(X){return X}var c0={join(X,...Z){let{join:$}=v("path");return $(X,...Z)},dirname(X){let{dirname:Z}=v("path");return Z(X)},basename(X){let{basename:Z}=v("path");return Z(X)},resolve(...X){let{resolve:Z}=v("path");return Z(...X)},isAbsolute(X){let{isAbsolute:Z}=v("path");return Z(X)},relative(X,Z){let{relative:$}=v("path");return $(X,Z)}};function nX(X,Z){let $=X.length,J=Z.length,Q=Array.from({length:$+1},()=>Array(J+1).fill(0));for(let q=1;q<=$;q++)for(let Y=1;Y<=J;Y++)if(X[q-1]===Z[Y-1])Q[q][Y]=Q[q-1][Y-1]+1;else Q[q][Y]=Math.max(Q[q-1][Y],Q[q][Y-1]);return Q}function rX(X,Z,$,J,Q){let q=[];while(J>0||Q>0)if(J>0&&Q>0&&Z[J-1]===$[Q-1])q.unshift({op:"equal",oldIdx:J-1,newIdx:Q-1,line:Z[J-1]}),J--,Q--;else if(Q>0&&(J===0||X[J][Q-1]>=X[J-1][Q]))q.unshift({op:"add",newIdx:Q-1,line:$[Q-1]}),Q--;else if(J>0)q.unshift({op:"remove",oldIdx:J-1,line:Z[J-1]}),J--;return q}function JX(X,Z){let $=X;if(Z.ignoreWhitespace)$=$.replace(/\s+/g," ").trim();return $}function d(X,Z,$,J={}){let{context:Q=3,ignoreWhitespace:q=!1,ignoreBlankLines:Y=!1}=J,V=X.split(`
3
3
  `),W=Z.split(`
4
4
  `);if(V[V.length-1]==="")V.pop();if(W[W.length-1]==="")W.pop();let K=V.map((F)=>JX(F,{ignoreWhitespace:q})),U=W.map((F)=>JX(F,{ignoreWhitespace:q})),O=K,H=U,A=V.map((F,w)=>w),_=W.map((F,w)=>w);if(Y)O=[],H=[],A=[],_=[],K.forEach((F,w)=>{if(F.trim())O.push(F),A.push(w)}),U.forEach((F,w)=>{if(F.trim())H.push(F),_.push(w)});let G=nX(O,H),B=rX(G,O,H,O.length,H.length),z=B.every((F)=>F.op==="equal"),j=0,N=0,R=0;for(let F of B)if(F.op==="add")j++;else if(F.op==="remove")N++;else R++;let k=tX(B,V,W,A,_,Q);return{filePath:$,identical:z,hunks:k,stats:{additions:j,deletions:N,unchanged:R},oldContent:X,newContent:Z}}function tX(X,Z,$,J,Q,q){let Y=[],V=[];if(X.forEach((U,O)=>{if(U.op!=="equal")V.push(O)}),V.length===0)return Y;let W=[],K=[V[0]];for(let U=1;U<V.length;U++)if(V[U]-V[U-1]<=q*2+1)K.push(V[U]);else W.push(K),K=[V[U]];W.push(K);for(let U of W){let O=Math.max(0,U[0]-q),H=Math.min(X.length-1,U[U.length-1]+q),A=X.slice(O,H+1),_=[],G=1,B=1,z=0,j=0;for(let N=0;N<O;N++){let R=X[N];if(R.op==="equal"||R.op==="remove")G++;if(R.op==="equal"||R.op==="add")B++}for(let N of A)if(N.op==="equal")_.push(` ${N.line}`),z++,j++;else if(N.op==="remove")_.push(`-${N.line}`),z++;else if(N.op==="add")_.push(`+${N.line}`),j++;Y.push({operation:"equal",lines:_,oldStart:G,oldCount:z,newStart:B,newCount:j})}return Y}function s0(X){if(X.identical)return"";let Z=[];Z.push(`--- a/${X.filePath}`),Z.push(`+++ b/${X.filePath}`);for(let $ of X.hunks)Z.push(`@@ -${$.oldStart},${$.oldCount} +${$.newStart},${$.newCount} @@`),Z.push(...$.lines);return Z.join(`
5
5
  `)}function eX(X){if(X.identical)return`\x1B[32m\u2713 ${X.filePath} (unchanged)\x1B[0m`;let Z=[],$=`+${X.stats.additions} -${X.stats.deletions}`;Z.push(`\x1B[1m${X.filePath}\x1B[0m \x1B[90m(${$})\x1B[0m`),Z.push("");for(let J of X.hunks){Z.push(`\x1B[36m@@ -${J.oldStart},${J.oldCount} +${J.newStart},${J.newCount} @@\x1B[0m`);for(let Q of J.lines)if(Q.startsWith("+"))Z.push(`\x1B[32m${Q}\x1B[0m`);else if(Q.startsWith("-"))Z.push(`\x1B[31m${Q}\x1B[0m`);else Z.push(`\x1B[90m${Q}\x1B[0m`);Z.push("")}return Z.join(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{fa as a,ga as b,ha as c}from"../../chunk-ffqpf34b.js";import"../../chunk-3mxzfgcv.js";import"../../chunk-9mjc7ddv.js";import"../../chunk-p1d09y82.js";import"../../chunk-1mm3t0nr.js";import"../../chunk-74j5mydx.js";import"../../chunk-rnt0wkrk.js";import"../../chunk-j22v8wfe.js";import"../../chunk-dk2vv0np.js";import"../../chunk-f18nyrrb.js";import"../../chunk-57agx6g8.js";import"../../chunk-rw6j20e2.js";export{a as dts,c as default,b as bunDts};
2
+ import{fa as a,ga as b,ha as c}from"../../chunk-p09jmjq8.js";import"../../chunk-8dx98fd5.js";import"../../chunk-2w3g3g00.js";import"../../chunk-p1d09y82.js";import"../../chunk-qn0xktfx.js";import"../../chunk-gpxdn99a.js";import"../../chunk-me2ae6f0.js";import"../../chunk-97pgeywh.js";import"../../chunk-0fhq2wva.js";import"../../chunk-f18nyrrb.js";import"../../chunk-57agx6g8.js";import"../../chunk-rw6j20e2.js";export{a as dts,c as default,b as bunDts};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ia as a,ja as b,ka as c,la as d}from"../../chunk-4ev1n7r7.js";import"../../chunk-3mxzfgcv.js";import"../../chunk-9mjc7ddv.js";import"../../chunk-p1d09y82.js";import"../../chunk-1mm3t0nr.js";import"../../chunk-74j5mydx.js";import"../../chunk-rnt0wkrk.js";import"../../chunk-j22v8wfe.js";import"../../chunk-dk2vv0np.js";import"../../chunk-f18nyrrb.js";import"../../chunk-57agx6g8.js";import"../../chunk-rw6j20e2.js";export{b as esbuildDts,a as dtsx,c as dts,d as default};
2
+ import{ia as a,ja as b,ka as c,la as d}from"../../chunk-fjjs2r77.js";import"../../chunk-8dx98fd5.js";import"../../chunk-2w3g3g00.js";import"../../chunk-p1d09y82.js";import"../../chunk-qn0xktfx.js";import"../../chunk-gpxdn99a.js";import"../../chunk-me2ae6f0.js";import"../../chunk-97pgeywh.js";import"../../chunk-0fhq2wva.js";import"../../chunk-f18nyrrb.js";import"../../chunk-57agx6g8.js";import"../../chunk-rw6j20e2.js";export{b as esbuildDts,a as dtsx,c as dts,d as default};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ca as s}from"../../chunk-9a3jfxnc.js";import{fa as t}from"../../chunk-ffqpf34b.js";import{ia as i,ka as p}from"../../chunk-4ev1n7r7.js";import{ma as e,oa as u}from"../../chunk-q75q4w1s.js";import{qa as l,ra as a,sa as n}from"../../chunk-e3j9tecw.js";import"../../chunk-3mxzfgcv.js";import"../../chunk-9mjc7ddv.js";import"../../chunk-p1d09y82.js";import"../../chunk-1mm3t0nr.js";import"../../chunk-74j5mydx.js";import"../../chunk-rnt0wkrk.js";import"../../chunk-j22v8wfe.js";import"../../chunk-dk2vv0np.js";import"../../chunk-f18nyrrb.js";import"../../chunk-57agx6g8.js";import"../../chunk-rw6j20e2.js";export{n as webpackPlugin,a as webpackDts,s as viteDts,s as vite,u as tsupPlugin,e as tsupDts,e as tsup,p as esbuildPlugin,i as esbuildDts,i as esbuild,t as bunDts,t as bun,l as DtsxWebpackPlugin};
2
+ import{ca as s}from"../../chunk-xe1z54pq.js";import{fa as t}from"../../chunk-p09jmjq8.js";import{ia as i,ka as p}from"../../chunk-fjjs2r77.js";import{ma as e,oa as u}from"../../chunk-91gpfz27.js";import{qa as l,ra as a,sa as n}from"../../chunk-7vj8vtzh.js";import"../../chunk-8dx98fd5.js";import"../../chunk-2w3g3g00.js";import"../../chunk-p1d09y82.js";import"../../chunk-qn0xktfx.js";import"../../chunk-gpxdn99a.js";import"../../chunk-me2ae6f0.js";import"../../chunk-97pgeywh.js";import"../../chunk-0fhq2wva.js";import"../../chunk-f18nyrrb.js";import"../../chunk-57agx6g8.js";import"../../chunk-rw6j20e2.js";export{n as webpackPlugin,a as webpackDts,s as viteDts,s as vite,u as tsupPlugin,e as tsupDts,e as tsup,p as esbuildPlugin,i as esbuildDts,i as esbuild,t as bunDts,t as bun,l as DtsxWebpackPlugin};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ma as a,na as b,oa as c,pa as d}from"../../chunk-q75q4w1s.js";import"../../chunk-3mxzfgcv.js";import"../../chunk-9mjc7ddv.js";import"../../chunk-p1d09y82.js";import"../../chunk-1mm3t0nr.js";import"../../chunk-74j5mydx.js";import"../../chunk-rnt0wkrk.js";import"../../chunk-j22v8wfe.js";import"../../chunk-dk2vv0np.js";import"../../chunk-f18nyrrb.js";import"../../chunk-57agx6g8.js";import"../../chunk-rw6j20e2.js";export{b as tsupDts,a as dtsxPlugin,c as dts,d as default};
2
+ import{ma as a,na as b,oa as c,pa as d}from"../../chunk-91gpfz27.js";import"../../chunk-8dx98fd5.js";import"../../chunk-2w3g3g00.js";import"../../chunk-p1d09y82.js";import"../../chunk-qn0xktfx.js";import"../../chunk-gpxdn99a.js";import"../../chunk-me2ae6f0.js";import"../../chunk-97pgeywh.js";import"../../chunk-0fhq2wva.js";import"../../chunk-f18nyrrb.js";import"../../chunk-57agx6g8.js";import"../../chunk-rw6j20e2.js";export{b as tsupDts,a as dtsxPlugin,c as dts,d as default};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ca as a,da as b,ea as c}from"../../chunk-9a3jfxnc.js";import"../../chunk-3mxzfgcv.js";import"../../chunk-9mjc7ddv.js";import"../../chunk-p1d09y82.js";import"../../chunk-1mm3t0nr.js";import"../../chunk-74j5mydx.js";import"../../chunk-rnt0wkrk.js";import"../../chunk-j22v8wfe.js";import"../../chunk-dk2vv0np.js";import"../../chunk-f18nyrrb.js";import"../../chunk-57agx6g8.js";import"../../chunk-rw6j20e2.js";export{b as viteDts,a as dts,c as default};
2
+ import{ca as a,da as b,ea as c}from"../../chunk-xe1z54pq.js";import"../../chunk-8dx98fd5.js";import"../../chunk-2w3g3g00.js";import"../../chunk-p1d09y82.js";import"../../chunk-qn0xktfx.js";import"../../chunk-gpxdn99a.js";import"../../chunk-me2ae6f0.js";import"../../chunk-97pgeywh.js";import"../../chunk-0fhq2wva.js";import"../../chunk-f18nyrrb.js";import"../../chunk-57agx6g8.js";import"../../chunk-rw6j20e2.js";export{b as viteDts,a as dts,c as default};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{qa as a,ra as b,sa as c,ta as d}from"../../chunk-e3j9tecw.js";import"../../chunk-3mxzfgcv.js";import"../../chunk-9mjc7ddv.js";import"../../chunk-p1d09y82.js";import"../../chunk-1mm3t0nr.js";import"../../chunk-74j5mydx.js";import"../../chunk-rnt0wkrk.js";import"../../chunk-j22v8wfe.js";import"../../chunk-dk2vv0np.js";import"../../chunk-f18nyrrb.js";import"../../chunk-57agx6g8.js";import"../../chunk-rw6j20e2.js";export{b as dtsxWebpack,c as dts,d as default,a as DtsxWebpackPlugin};
2
+ import{qa as a,ra as b,sa as c,ta as d}from"../../chunk-7vj8vtzh.js";import"../../chunk-8dx98fd5.js";import"../../chunk-2w3g3g00.js";import"../../chunk-p1d09y82.js";import"../../chunk-qn0xktfx.js";import"../../chunk-gpxdn99a.js";import"../../chunk-me2ae6f0.js";import"../../chunk-97pgeywh.js";import"../../chunk-0fhq2wva.js";import"../../chunk-f18nyrrb.js";import"../../chunk-57agx6g8.js";import"../../chunk-rw6j20e2.js";export{b as dtsxWebpack,c as dts,d as default,a as DtsxWebpackPlugin};
@@ -23,37 +23,13 @@ export declare const strictTypeMapper: TypeMapper;
23
23
  * @defaultValue
24
24
  * ```ts
25
25
  * {
26
- * /**
27
- * * Make all types readonly
28
- * */
29
26
  * makeReadonly: (type: string) => any,
30
- * /**
31
- * * Make type nullable
32
- * */
33
27
  * makeNullable: (type: string) => any,
34
- * /**
35
- * * Make type optional (add undefined)
36
- * */
37
28
  * makeOptional: (type: string) => any,
38
- * /**
39
- * * Remove null/undefined from type
40
- * */
41
29
  * makeRequired: (type: string) => any,
42
- * /**
43
- * * Wrap in Promise
44
- * */
45
30
  * promisify: (type: string) => any,
46
- * /**
47
- * * Unwrap Promise
48
- * */
49
31
  * unpromisify: (type: string) => any,
50
- * /**
51
- * * Convert to array type
52
- * */
53
32
  * arrayify: (type: string) => any,
54
- * /**
55
- * * Unwrap array type
56
- * */
57
33
  * unarrayify: (type: string) => any
58
34
  * }
59
35
  * ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/dtsx",
3
3
  "type": "module",
4
- "version": "0.9.10",
4
+ "version": "0.9.12",
5
5
  "description": "A modern, fast .d.ts generation tool, powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{ic as a,jc as b}from"./chunk-1mm3t0nr.js";import"./chunk-74j5mydx.js";import"./chunk-rnt0wkrk.js";import"./chunk-j22v8wfe.js";import"./chunk-dk2vv0np.js";import"./chunk-rw6j20e2.js";export{b as processSourceDirect,a as processSource};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{nc as a}from"./chunk-rnt0wkrk.js";import"./chunk-rw6j20e2.js";export{a as scanDeclarations};
@@ -1,15 +0,0 @@
1
- // @bun
2
- var k=!1,M=null;function a(){k=!0,M=null}function r(){k=!1;let J=M;return M=null,J}function T(J){let Y=J.length;if(Y===0)return!1;let X=0;if(J.charCodeAt(X)===45)X++;if(X>=Y)return!1;let G=X;while(X<Y&&J.charCodeAt(X)>=48&&J.charCodeAt(X)<=57)X++;if(X===G)return!1;if(X<Y&&J.charCodeAt(X)===46){X++;let z=X;while(X<Y&&J.charCodeAt(X)>=48&&J.charCodeAt(X)<=57)X++;if(X===z)return!1}return X===Y}function o(J){for(let Y=0,X=J.length-1;Y<X;Y++){let G=J.charCodeAt(Y);if(G<48||G>57)return!1}return!0}function E(J,Y){let X=0,G=0;while((G=J.indexOf(Y,G))!==-1)X++,G+=Y.length;return X}function P(J){let Y=J.length,X=!1;for(let Z=1;Z<Y;Z++)if(J.charCodeAt(Z)<=32&&J.charCodeAt(Z-1)<=32){X=!0;break}if(!X)for(let Z=0;Z<Y;Z++){let H=J.charCodeAt(Z);if(H===10||H===13||H===9){X=!0;break}}if(!X)return J;let G=[],z=-1,B=!1;for(let Z=0;Z<Y;Z++)if(J.charCodeAt(Z)<=32){if(!B){if(z>=0)G.push(J.substring(z,Z));G.push(" "),B=!0,z=-1}}else{if(B||z<0)z=Z;B=!1}if(z>=0)G.push(J.substring(z));return G.join("")}function V(J,Y=!1,X=!1,G=0){if(!J||typeof J!=="string")return"unknown";if(G>=20)return"unknown";let z=J.trim();if(z.startsWith("BigInt("))return"bigint";if(z.startsWith("Symbol.for("))return"symbol";if(z.includes(".raw`")||z.includes("String.raw`"))return"string";if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'")||z.startsWith("`")&&z.endsWith("`")){if(!z.includes("${")){if(!Y)return"string";return z}if(Y)return z;return"string"}if(T(z)){if(!Y)return"number";return z}if(z==="true"||z==="false"){if(!Y)return"boolean";return z}if(z==="null")return"null";if(z==="undefined")return"undefined";if(z.startsWith("[")&&z.endsWith("]"))return D(z,Y,G+1);if(z.startsWith("{")&&z.endsWith("}"))return d(z,Y,G+1);if(z.startsWith("new "))return m(z);if(z.includes("=>")||z.startsWith("function")||z.startsWith("async"))return h(z,X,G,Y);if(z.endsWith("as const")){let B=z.slice(0,-8).trim();if(B.startsWith("[")&&B.endsWith("]")){let Z=B.slice(1,-1).trim();if(!Z)return"readonly []";return`readonly [${U(Z).map((j)=>V(j.trim(),!0,!1,G+1)).join(", ")}]`}return V(B,!0,X,G+1)}if(z.startsWith("`")&&z.endsWith("`"))return l(z,Y);if(z.startsWith("Promise."))return y(z,Y,G);if(z.startsWith("await "))return"unknown";if(z.charCodeAt(z.length-1)===110&&z.length>1&&o(z)){if(Y)return z;return"bigint"}if(z.startsWith("Symbol(")||z==="Symbol.for")return"symbol";return"unknown"}function p(J,Y=!1,X=0){return V(J,Y,!0,X)}function l(J,Y){if(J.includes(".raw`")||J.includes("String.raw`"))return"string";if(!Y)return"string";if(!J.includes("${"))return J;return"string"}function m(J){let Y=4;while(Y<J.length&&J.charCodeAt(Y)<=32)Y++;let X=Y,G=J.charCodeAt(Y);if(G<65||G>90)return"unknown";while(Y<J.length&&x(J.charCodeAt(Y)))Y++;if(Y===X)return"unknown";let z=J.slice(X,Y);{let B=J.slice(Y);if(B.startsWith("<")){let Z=0,H=-1;for(let $=0;$<B.length;$++)if(B[$]==="<")Z++;else if(B[$]===">"){if(Z--,Z===0){H=$;break}}if(H!==-1){let $=B.slice(0,H+1);return`${z}${$}`}}switch(z){case"Date":return"Date";case"Map":return"Map<any, any>";case"Set":return"Set<any>";case"WeakMap":return"WeakMap<any, any>";case"WeakSet":return"WeakSet<any>";case"RegExp":return"RegExp";case"Error":return"Error";case"Array":return"any[]";case"Object":return"object";case"Function":return"Function";case"Promise":return"Promise<any>";default:return z}}return"unknown"}function y(J,Y,X=0){if(J.startsWith("Promise.resolve(")){let z=J.indexOf(")",16);if(z!==-1){let B=J.slice(16,z).trim();if(B)return`Promise<${V(B,Y,!1,X+1)}>`}return"Promise<unknown>"}if(J.startsWith("Promise.reject("))return"Promise<never>";if(J.startsWith("Promise.all(")){let G=J.indexOf("[",12),z=J.lastIndexOf("]");if(G!==-1&&z>G){let B=J.slice(G+1,z).trim();return`Promise<[${U(B).map(($)=>{let j=$.trim();if(j.startsWith("Promise.resolve(")){let O=y(j,Y,X+1),Q=O.indexOf("<"),K=O.lastIndexOf(">");return Q!==-1&&K>Q?O.slice(Q+1,K):"unknown"}return V(j,Y,!1,X+1)}).join(", ")}]>`}return"Promise<unknown[]>"}return"Promise<unknown>"}function D(J,Y,X=0){let G=J.slice(1,-1).trim();if(!G)return"never[]";if(X>=20)return"unknown[]";let z=U(G),B=!1;for(let Q=0;Q<z.length;Q++){let K=z[Q],F=K.length;while(F>0&&K.charCodeAt(F-1)<=32)F--;if(F>=8&&K.slice(F-8,F)==="as const"){B=!0;break}}if(B)return`readonly [
3
- ${z.map((K)=>{let F=K.trim();if(F.endsWith("as const")){let L=F.slice(0,-8).trim();if(L.startsWith("[")&&L.endsWith("]")){let W=L.slice(1,-1).trim();return`readonly [${U(W).map((A)=>V(A.trim(),!0,!1,X+1)).join(", ")}]`}return V(L,!0,!1,X+1)}if(F.startsWith("[")&&F.endsWith("]"))return D(F,!0,X+1);return V(F,!0,!1,X+1)}).join(` |
4
- `)}
5
- ]`;let Z=k&&!Y,H=[],$=[];for(let Q of z){let K=Q.trim(),F=M;if(M=null,K.startsWith("[")&&K.endsWith("]"))H.push(D(K,Y,X+1));else H.push(p(K,Y,X+1));if(Z)$.push(M);M=F}if(Z)if(_(J))M=P(J);else{let Q=[];for(let K=0;K<z.length;K++){let F=z[K].trim();if(F.endsWith("as const"))continue;if(w(F)||F==="null"||F==="undefined")Q.push(F);else if(F.startsWith("[")&&_(F))Q.push(P(F));else if(F.startsWith("{")){if($[K])Q.push($[K])}else{let L=V(F,!1,!1,0);if(L!=="unknown")Q.push(L)}}if(Q.length>0)M=`[${Q.join(", ")}]`}if(Y)return`readonly [${H.join(", ")}]`;let j=[],O=!0;for(let Q of H){let K=!1;for(let F of j)if(Q===F){K=!0;break}if(!K)j.push(Q);if(O){if(!(T(Q)||Q==="true"||Q==="false"||Q.charCodeAt(0)===34&&Q.charCodeAt(Q.length-1)===34||Q.charCodeAt(0)===39&&Q.charCodeAt(Q.length-1)===39))O=!1}}if(O&&H.length<=10)return`readonly [${H.join(", ")}]`;if(j.length===1)return`${j[0]}[]`;return`(${j.join(" | ")})[]`}function U(J){let Y=[],X=0,G=0,z=!1,B=0;for(let H=0;H<J.length;H++){let $=J.charCodeAt(H);if(!z&&($===34||$===39||$===96))z=!0,B=$;else if(z&&$===B&&(H===0||J.charCodeAt(H-1)!==92))z=!1;if(!z){if($===91||$===123||$===40)G++;else if($===93||$===125||$===41)G--;else if($===44&&G===0){let j=J.substring(X,H).trim();if(j)Y.push(j);X=H+1;continue}}}let Z=J.substring(X).trim();if(Z)Y.push(Z);return Y}function w(J){if(T(J))return!0;if(J==="true"||J==="false")return!0;if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return!0;return!1}function c(J){return J==="number"||J==="string"||J==="boolean"}function _(J){let Y=!1,X=0,G=J.length;for(let z=0;z<G;z++){let B=J.charCodeAt(z);if(Y){if(B===92){z++;continue}if(B===X)Y=!1;continue}if(B===34||B===39||B===96){Y=!0,X=B;continue}if(B===61&&z+1<G&&J.charCodeAt(z+1)===62)return!1;if(B>=97&&B<=122){let Z=z;while(z<G&&(J.charCodeAt(z)>=97&&J.charCodeAt(z)<=122||J.charCodeAt(z)>=65&&J.charCodeAt(z)<=90||J.charCodeAt(z)>=48&&J.charCodeAt(z)<=57||J.charCodeAt(z)===95||J.charCodeAt(z)===36))z++;let H=J.slice(Z,z);if(H==="new"||H==="async"||H==="await"||H==="function"||H==="yield"||H==="console"||H==="process")return!1;let $=z;while($<G&&J.charCodeAt($)<=32)$++;if($<G&&J.charCodeAt($)===40)return!1;z--}}return!0}function d(J,Y,X=0){let G=J.slice(1,-1).trim();if(!G)return"{}";if(X>=20)return"Record<string, unknown>";let z=i(G),B=[],Z=k&&!Y,H=[];for(let[$,j]of z){let O=M;M=null;let Q=V(j,Y,!1,X+1),K=M;if(M=O,Q.includes("=>")||Q.includes("function")||Q.includes("async"))Q=I(Q);let F=j.trim();if(!Y&&c(Q)&&w(F))B.push(`/** @defaultValue ${F} */
6
- ${$}: ${Q}`);else B.push(`${$}: ${Q}`);if(Z){if(F.endsWith("as const"));else if(w(F))H.push(`${$}: ${F}`);else if(F.startsWith("[")&&_(F))H.push(`${$}: ${P(F)}`);else if(F.startsWith("{")){if(K)H.push(`${$}: ${K}`)}else if(!F.startsWith("[")&&(F.includes("=>")||F.startsWith("function")||F.startsWith("async"))){let L=h(F,!1,0,!0);H.push(`${$}: ${L}`)}}}if(Z&&H.length>0){let $=X>0?(X-1)/2:0,j=`{ ${H.join(", ")} }`;if(j.length<=80)M=j;else{let O=" ".repeat(($+1)*2),Q=" ".repeat($*2);M=`{
7
- ${O}${H.join(`,
8
- ${O}`)}
9
- ${Q}}`}}return`{
10
- ${B.join(`;
11
- `)}
12
- }`}function I(J){let X=J,G=X.indexOf("async");if(G!==-1){let O=G>0?X.charCodeAt(G-1):32,Q=G+5<X.length?X.charCodeAt(G+5):32;if(!x(O)&&!x(Q))X=(X.slice(0,G)+X.slice(G+5)).trim()}let z=X.indexOf("(");if(z!==-1){let O=g(X,z,"(",")");if(O!==-1){let Q=X.slice(z,O+1),K=b(Q);X=X.slice(0,z)+K+X.slice(O+1)}}let B=X.length,Z="",H=[],$=!1,j=!1;for(let O=0;O<B;O++){let Q=X.charCodeAt(O);if(Q===123||Q===40)H.push(Q);else if(Q===125||Q===41)H.pop();if(Q<=32){if($=!0,Q===10||Q===13)j=!0;continue}if($&&Z.length>0){let F=(H.length>0?H[H.length-1]:0)===123;if(j&&F){let L=Z.charCodeAt(Z.length-1),W=L===59||L===44||L===123||Q===125,q=Z.length>=2&&Z.charCodeAt(Z.length-1)===47&&Z.charCodeAt(Z.length-2)===42;if(!W&&!q)Z+="; ";else Z+=" "}else Z+=" "}$=!1,j=!1,Z+=X[O]}return Z.trim()}function x(J){return J>=97&&J<=122||J>=65&&J<=90||J>=48&&J<=57||J===95||J===36}function b(J){let Y=J.trim(),X,G=!1;if(Y.startsWith("(")&&Y.endsWith(")"))X=Y.slice(1,-1),G=!0;else X=Y;let z=X.trim();if(!z)return G?"()":"";let B=!1;{let L=0;for(let W=0;W<z.length;W++){let q=z.charCodeAt(W);if(q===40||q===60||q===91||q===123)L++;else if(q===41||q===62||q===93||q===125)L--;else if(L===0&&q===61){let N=W>0?z.charCodeAt(W-1):0,A=W+1<z.length?z.charCodeAt(W+1):0;if(N!==61&&N!==33&&N!==60&&N!==62&&A!==61&&A!==62){B=!0;break}}}}if(!B)return Y;let Z=[],H=[],$=0,j=0,O=!1,Q=0;for(let L=0;L<=z.length;L++){if(L===z.length){Z.push(z.slice($));break}let W=z.charCodeAt(L);if(O){if(W===92){L++;continue}if(W===Q)O=!1;continue}if(W===39||W===34||W===96){O=!0,Q=W;continue}if(W===40||W===60||W===91||W===123)j++;else if(W===41||W===62||W===93||W===125)j--;else if(W===44&&j===0){Z.push(z.slice($,L));let q=",",N=L+1;while(N<z.length&&z.charCodeAt(N)<=32)q+=z[N],N++;H.push(q),$=N}}let K=[];for(let L of Z){let W=L.trim();if(!W){K.push(L);continue}let q=L.slice(0,L.length-L.trimStart().length);K.push(q+s(W))}let F=K[0]||"";for(let L=1;L<K.length;L++)F+=(H[L-1]||", ")+K[L];return G?`(${F})`:F}function s(J){if(J.startsWith("..."))return J;let Y=-1,X=-1,G=0,z=!1,B=0;for(let H=0;H<J.length;H++){let $=J.charCodeAt(H);if(z){if($===92){H++;continue}if($===B)z=!1;continue}if($===39||$===34||$===96){z=!0,B=$;continue}if($===40||$===60||$===91||$===123)G++;else if($===41||$===62||$===93||$===125)G--;else if(G===0){if($===58&&Y===-1)Y=H;else if($===61&&X===-1&&(H===0||J.charCodeAt(H-1)!==61)&&(H+1>=J.length||J.charCodeAt(H+1)!==61&&J.charCodeAt(H+1)!==62))X=H}}let Z=X!==-1;if(Y!==-1&&(X===-1||Y<X)){let H=J.slice(0,Y).trim(),$=X!==-1?J.slice(Y+1,X).trim():J.slice(Y+1).trim(),j=Z&&!H.endsWith("?")?"?":"";return`${H}${j}: ${$}`}else if(X!==-1){let H=J.slice(0,X).trim(),$=!H.endsWith("?")?"?":"",j=J.slice(X+1).trim(),O="unknown";if(j==="true"||j==="false")O="boolean";else if(/^-?\d+(\.\d+)?$/.test(j))O="number";else if(j.startsWith("'")&&j.endsWith("'")||j.startsWith('"')&&j.endsWith('"'))O="string";else if(j.startsWith("["))O="unknown[]";else if(j.startsWith("{"))O="Record<string, unknown>";return`${H}${$}: ${O}`}return J}function i(J){let Y=[],X="",G="",z=0,B=!1,Z="",H=!0,$=!1,j=0;for(let O=0;O<J.length;O++){let Q=J[O],K=O>0?J[O-1]:"",F=O<J.length-1?J[O+1]:"";if(!B&&!$&&Q==="/"&&F==="/"){O+=2;while(O<J.length&&J[O]!==`
13
- `)O++;continue}if(!B&&!$&&Q==="/"&&F==="*"){$=!0,j=1,X+="/*",O++;continue}else if($&&Q==="*"&&F==="/"){if(j--,X+="*/",O++,j===0)$=!1;continue}else if($&&Q==="/"&&F==="*"){j++,X+="/*",O++;continue}if(!B&&(Q==='"'||Q==="'"||Q==="`"))B=!0,Z=Q,X+=Q;else if(B&&Q===Z&&K!=="\\")B=!1,X+=Q;else if(!B&&!$)if(Q==="("&&z===0&&H){if(G=X.trim(),G.startsWith("async "))G=G.slice(6).trim();X=Q,H=!1,z=1}else if(Q==="{"||Q==="["||Q==="(")z++,X+=Q;else if(Q==="}"||Q==="]"||Q===")")z--,X+=Q;else if(Q===":"&&z===0&&H)G=X.trim(),X="",H=!1;else if(Q===","&&z===0){if(G&&X.trim()){let L=X.trim();if(L.startsWith("("))L=v(G,L);else if(L.includes("=>")||L.includes("function")||L.includes("async"))L=I(L);Y.push([G,L])}X="",G="",H=!0}else X+=Q;else X+=Q}if(G&&X.trim()){let O=X.trim();if(O.startsWith("("))O=v(G,O);else if(O.includes("=>")||O.includes("function")||O.includes("async"))O=I(O);Y.push([G,O])}return Y}function v(J,Y){let X=Y,G=0;while(G<X.length&&X.charCodeAt(G)<=32)G++;if(X.startsWith("async",G)&&G+5<X.length&&X.charCodeAt(G+5)<=32)X=X.slice(G+5).trimStart();let z="";if(X.charCodeAt(0)===60){let Q=0,K=-1;for(let F=0;F<X.length;F++)if(X.charCodeAt(F)===60)Q++;else if(X.charCodeAt(F)===62){if(Q--,Q===0){K=F;break}}if(K!==-1)z=X.slice(0,K+1),X=X.slice(K+1).trimStart()}let B=X.indexOf("("),Z=g(X,B,"(",")");if(B===-1||Z===-1)return"() => unknown";let H=X.slice(B,Z+1),$="unknown",j=X.slice(Z+1).trimStart();if(j.charCodeAt(0)===58){let Q=j.indexOf("{");if(Q!==-1)$=j.slice(1,Q).trim();else $=j.slice(1).trim()}let O=b(H);return`${z}${O} => ${$}`}function g(J,Y,X,G){let z=0;for(let B=Y;B<J.length;B++)if(J[B]===X)z++;else if(J[B]===G){if(z--,z===0)return B}return-1}function n(J){let Y=0,X=0,G=!1,z="";for(let B=0;B<J.length-1;B++){let Z=J[B],H=J[B+1],$=B>0?J[B-1]:"";if(!G&&(Z==='"'||Z==="'"||Z==="`"))G=!0,z=Z;else if(G&&Z===z&&$!=="\\")G=!1;if(!G){if(Z==="(")Y++;else if(Z===")")Y--;else if(Z==="[")X++;else if(Z==="]")X--;if(Z==="="&&H===">"&&Y===0&&X===0)return B}}return-1}function h(J,Y=!1,X=0,G=!0){let z=J.trim();if(z.length>200&&E(z,"=>")>2&&E(z,"<")>5&&!z.startsWith("function"))return Y?"((...args: any[]) => any)":"(...args: any[]) => any";if(z.startsWith("async ")&&z.includes("=>")){let Z=z.slice(5).trim(),H=Z.indexOf("=>"),$=Z.substring(0,H).trim(),j=Z.substring(H+2).trim();if($=b($),$==="()"||$==="")$="()";else if(!$.startsWith("("))$=`(${$})`;let O="unknown";if(j.startsWith("{"))O="unknown";else O=V(j,G,!1,X+1);let Q=`${$} => Promise<${O}>`;return Y?`(${Q})`:Q}if(z.includes("=>")){let Z="",H=z;if(z.startsWith("<")){let W=g(z,0,"<",">");if(W!==-1)Z=z.substring(0,W+1),H=z.substring(W+1).trim()}let $=n(H);if($===-1)return Y?"(() => unknown)":"() => unknown";let j=H.substring(0,$).trim(),O=H.substring($+2).trim(),Q="",K=j.lastIndexOf("):");if(K!==-1){let W=j.substring(K+2).trim();if(W&&!W.includes("=>")&&!W.includes("="))Q=W,j=j.substring(0,K+1)}if(j=b(j),j==="()"||j==="")j="()";else if(!j.startsWith("("))j=`(${j})`;let F="unknown";if(Q)F=Q;else if(O.startsWith("{"))F="unknown";else if(O.includes("=>")){let W=O.trimStart(),q=W.indexOf("("),N=q!==-1?W.indexOf(")",q):-1,A=N!==-1?W.indexOf("=>",N):-1;if(q===0&&N!==-1&&A!==-1){let R=W.substring(q+1,N).trim();if(Z.includes("T")&&R.includes("T"))F=`(${R}) => T`;else F=`(${R}) => any`}else F="any"}else if(Y)F="unknown";else F=V(O,G,!1,X+1);let L=`${Z}${j} => ${F}`;return Y?`(${L})`:L}if(z.startsWith("function")){let Z=8,H=z.length;while(Z<H&&z.charCodeAt(Z)<=32)Z++;let $=!1;if(Z<H&&z.charCodeAt(Z)===42){$=!0,Z++;while(Z<H&&z.charCodeAt(Z)<=32)Z++}let j="";if(Z<H&&z.charCodeAt(Z)===60){let K=Z,F=1;Z++;while(Z<H&&F>0){let L=z.charCodeAt(Z);if(L===60)F++;else if(L===62)F--;Z++}j=z.substring(K,Z);while(Z<H&&z.charCodeAt(Z)<=32)Z++}let O=z.indexOf("(",Z);if(O!==-1){let K=1,F=O+1;while(F<H&&K>0){let N=z.charCodeAt(F);if(N===40)K++;else if(N===41)K--;F++}let L=z.substring(O+1,F-1).trim(),W=L?`(${L})`:"()";if($){let N=z.substring(F).trim(),A=N.indexOf("Generator<");if(A!==-1){let S=A+10,f=N.indexOf(">",S);if(f!==-1){let u=N.substring(S,f),C=`${j}${W} => Generator<${u}>`;return Y?`(${C})`:C}}let R=`${j}${W} => Generator<any, any, any>`;return Y?`(${R})`:R}let q=`${j}${W} => unknown`;return Y?`(${q})`:q}let Q="(...args: any[]) => unknown";return Y?`(${Q})`:Q}if(z.includes("=>")&&z.includes("(")&&z.includes(")")){if(z.length>100||E(z,"=>")>2){let Z="";if(z.charCodeAt(0)===60){let Q=z.indexOf(">");if(Q!==-1)Z=z.substring(0,Q+1)}let H=z.indexOf("("),$=H!==-1?z.indexOf(")",H):-1,j=H!==-1&&$!==-1?z.substring(H,$+1):"(...args: any[])",O=`${Z}${j} => any`;return Y?`(${O})`:O}return Y?`(${z})`:z}let B="() => unknown";return Y?`(${B})`:B}function t(J){let Y=J.trim();if(Y==="any"||Y==="object"||Y==="unknown")return!0;if(Y.startsWith("Record<")&&Y.endsWith(">"))return!0;if(Y.startsWith("Array<")&&Y.endsWith(">"))return!0;if(/^\{\s*\[[^\]]*\]:\s*(any|string|number|unknown)\s*\}$/.test(Y))return!0;return!1}function e(J){let Y=J.lastIndexOf(" satisfies ");if(Y===-1)return null;let X=J.slice(Y+11).trim();if(X.endsWith(";"))X=X.slice(0,-1).trim();return X||null}function Jz(J){let Y=[],X=0;for(let G=0;G<=J.length;G++)if(G===J.length||J[G]===`
14
- `){let z=X,B=G;while(z<B&&(J[z]===" "||J[z]==="\t"||J[z]==="\r"))z++;while(B>z&&(J[B-1]===" "||J[B-1]==="\t"||J[B-1]==="\r"))B--;let Z=J.slice(z,B);if(X=G+1,Z.startsWith("///")){if(Z.match(/^\/\/\/\s*<reference\s+(path|types|lib|no-default-lib)\s*=\s*["'][^"']+["']\s*\/>/))Y.push(Z);else if(Z.match(/^\/\/\/\s*<amd-module\s+name\s*=\s*["'][^"']+["']\s*\/>/))Y.push(Z);else if(Z.match(/^\/\/\/\s*<amd-dependency\s+path\s*=\s*["'][^"']+["']/))Y.push(Z)}else if(Z===""||Z.startsWith("//"))continue;else break}return Y}
15
- export{a as Cc,r as Dc,V as Ec,p as Fc,D as Gc,U as Hc,d as Ic,g as Jc,h as Kc,t as Lc,e as Mc,Jz as Nc};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{a,b,c}from"./chunk-fw6wcdfd.js";import"./chunk-9mjc7ddv.js";import"./chunk-p1d09y82.js";import"./chunk-74j5mydx.js";import"./chunk-rnt0wkrk.js";import"./chunk-dk2vv0np.js";import"./chunk-rw6j20e2.js";export{b as optimizeFile,a as optimizeDeclarations,c as minifyDts};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{tb as b,ub as c,vb as d}from"./chunk-3mxzfgcv.js";import"./chunk-9mjc7ddv.js";import"./chunk-p1d09y82.js";import{ic as a}from"./chunk-1mm3t0nr.js";import"./chunk-74j5mydx.js";import"./chunk-rnt0wkrk.js";import"./chunk-j22v8wfe.js";import"./chunk-dk2vv0np.js";import"./chunk-f18nyrrb.js";import"./chunk-57agx6g8.js";import"./chunk-rw6j20e2.js";export{d as watch,a as processSource,c as processFile,b as generate};
@@ -1,23 +0,0 @@
1
- // @bun
2
- function y(g){return g===32||g===9||g===10||g===13}function Oj(g){return g>=65&&g<=90||g>=97&&g<=122||g===95||g===36||g>127}function S(g){return Oj(g)||g>=48&&g<=57}function Wj(g){if(g.charCodeAt(0)===82&&g.startsWith("Record<"))return!0;if(g.charCodeAt(0)===65&&g.startsWith("Array<"))return!0;if(g.charCodeAt(0)===123&&g.includes("[")&&g.includes("]:"))return!0;if(g==="any"||g==="object"||g==="unknown")return!0;return!1}var Fj=["public","protected","private","readonly","override"];function xj(g,e,A=!0,h=!1){let Y=g,c=A,P=h,K=Y.length,L=[],b=new Map,u=new Set,j=0;if(j<K&&Y.charCodeAt(j)===65279)j++;function w(J,H){if(J<H){let X=Y.charCodeAt(J),U=Y.charCodeAt(H-1);if(X!==32&&X!==9&&X!==10&&X!==13&&U!==32&&U!==9&&U!==10&&U!==13)return Y.slice(J,H)}while(J<H&&y(Y.charCodeAt(J)))J++;while(H>J&&y(Y.charCodeAt(H-1)))H--;return Y.slice(J,H)}function O(){if(j>=K)return;let J=Y.charCodeAt(j);if(J!==32&&J!==9&&J!==10&&J!==13&&J!==47)return;while(j<K){let H=Y.charCodeAt(j);if(H===32||H===9||H===10||H===13){j++;continue}if(H===47&&j+1<K){let X=Y.charCodeAt(j+1);if(X===47){let U=Y.indexOf(`
3
- `,j+2);j=U===-1?K:U+1;continue}if(X===42){let U=Y.indexOf("*/",j+2);j=U===-1?K:U+2;continue}}break}}function bj(J){let H=J.length,X=0,U=H;for(let Z=0;Z<H;Z++){let $=J.charCodeAt(Z);if(X){if($===92){Z++;continue}if($===X)X=0;continue}if($===39||$===34||$===96){X=$;continue}if($===47&&Z+1<H){let F=J.charCodeAt(Z+1);if(F===47){U=Z;while(U>0&&(J.charCodeAt(U-1)===32||J.charCodeAt(U-1)===9))U--;return J.slice(0,U)}if(F===42){let G=J.indexOf("*/",Z+2);if(G!==-1){J=`${J.slice(0,Z)} ${J.slice(G+2)}`,Z--;continue}}}}U=H;while(U>0&&(J.charCodeAt(U-1)===32||J.charCodeAt(U-1)===9||J.charCodeAt(U-1)===13))U--;return U<H?J.slice(0,U):J}function l(J){j++;let H=J===39?"'":'"';while(j<K){let X=Y.indexOf(H,j);if(X===-1){j=K;return}let U=0,Z=X-1;while(Z>=0&&Y.charCodeAt(Z)===92)U++,Z--;if(U%2===0){j=X+1;return}j=X+1}}function jj(){j++;let J=0;while(j<K){let H=Y.charCodeAt(j);if(H===92){j+=2;continue}if(H===96&&J===0){j++;return}if(H===36&&j+1<K&&Y.charCodeAt(j+1)===123){j+=2,J++;continue}if(H===125&&J>0){J--,j++;continue}j++}}function f(){let J=Y.charCodeAt(j);if(J===39||J===34)return l(J),!0;if(J===96)return jj(),!0;if(J===47&&j+1<K){let H=Y.charCodeAt(j+1);if(H===47){let X=Y.indexOf(`
4
- `,j+2);return j=X===-1?K:X+1,!0}if(H===42){let X=Y.indexOf("*/",j+2);return j=X===-1?K:X+2,!0}if(wj())return vj(),!0}return!1}function wj(){let J=j-1;while(J>=0&&(Y.charCodeAt(J)===32||Y.charCodeAt(J)===9||Y.charCodeAt(J)===10||Y.charCodeAt(J)===13))J--;if(J<0)return!0;let H=Y.charCodeAt(J);if(H===61||H===40||H===91||H===33||H===38||H===124||H===63||H===58||H===44||H===59||H===123||H===125||H===94||H===126||H===43||H===45||H===42||H===37||H===60||H===62)return!0;if(S(H)){let X=J;while(X>=0&&S(Y.charCodeAt(X)))X--;let U=Y.slice(X+1,J+1);if(U==="return"||U==="typeof"||U==="void"||U==="delete"||U==="throw"||U==="new"||U==="in"||U==="of"||U==="case"||U==="instanceof"||U==="yield"||U==="await")return!0}return!1}function vj(){j++;let J=!1;while(j<K){let H=Y.charCodeAt(j);if(H===92){j+=2;continue}if(J){if(H===93)J=!1;j++;continue}if(H===91){J=!0,j++;continue}if(H===47){j++;break}if(H===10||H===13)break;j++}while(j<K&&S(Y.charCodeAt(j)))j++}function E(){let J=j;while(j<K&&S(Y.charCodeAt(j)))j++;return Y.slice(J,j)}function z(J){if(j+J.length>K)return!1;for(let H=0;H<J.length;H++)if(Y.charCodeAt(j+H)!==J.charCodeAt(H))return!1;if(j+J.length<K&&S(Y.charCodeAt(j+J.length)))return!1;return!0}function Ij(){if(j>=K)return!1;switch(Y.charCodeAt(j)){case 101:return z("export")||z("enum");case 105:return z("import")||z("interface");case 102:return z("function");case 99:return z("class")||z("const");case 116:return z("type");case 108:return z("let");case 118:return z("var");case 100:return z("declare")||z("default");case 109:return z("module");case 110:return z("namespace");case 97:return z("abstract")||z("async");default:return!1}}function a(){let J=Y.charCodeAt(j);if(J!==10&&J!==13)return!1;let H=j;if(j++,J===13&&j<K&&Y.charCodeAt(j)===10)j++;while(j<K){let U=Y.charCodeAt(j);if(U===32||U===9||U===13||U===10){j++;continue}if(U===47&&j+1<K){let Z=Y.charCodeAt(j+1);if(Z===47){let $=Y.indexOf(`
5
- `,j+2);j=$===-1?K:$+1;continue}if(Z===42){let $=Y.indexOf("*/",j+2);j=$===-1?K:$+2;continue}}break}let X=j>=K||Ij()||Y.charCodeAt(j)===125;return j=H,X}function o(){let J=Y.charCodeAt(j);if(J!==10&&J!==13)return!1;let H=j;if(j++,J===13&&j<K&&Y.charCodeAt(j)===10)j++;while(j<K){let U=Y.charCodeAt(j);if(U===32||U===9||U===13||U===10){j++;continue}if(U===47&&j+1<K&&Y.charCodeAt(j+1)===47){let Z=Y.indexOf(`
6
- `,j+2);j=Z===-1?K:Z+1;continue}break}if(j>=K)return j=H,!0;let X=Y.charCodeAt(j);if(X===124||X===38||X===46||X===63)return j=H,!1;if(z("extends")||z("keyof")||z("typeof")||z("infer")||z("is")||z("as")||z("in"))return j=H,!1;return j=H,!0}let Ej=/[{}'"`\/]/g,fj=/[()'"`\/]/g,yj=/[[\]'"`\/]/g,Tj=/[<>'"`\/]/g;function T(J,H){let X=1;j++;let U=J===123?Ej:J===40?fj:J===91?yj:Tj;U.lastIndex=j;let Z;while((Z=U.exec(Y))!==null){let $=Z.index,F=Y.charCodeAt($);if(F===39||F===34){j=$,l(F),U.lastIndex=j;continue}if(F===96){j=$,jj(),U.lastIndex=j;continue}if(F===47){if(j=$,f()){U.lastIndex=j;continue}U.lastIndex=$+1;continue}if(F===J)X++;else if(F===H){if(H===62&&$>0&&Y.charCodeAt($-1)===61){U.lastIndex=$+1;continue}if(X--,X===0)return j=$+1,j}U.lastIndex=$+1}return j=K,j}function C(){return j>0&&Y.charCodeAt(j-1)===61}let x=/[{};'"`\/\n\r]/g;function I(){let J=0;x.lastIndex=j;let H;while((H=x.exec(Y))!==null){let X=H.index,U=Y.charCodeAt(X);if(U===39||U===34){j=X,l(U),x.lastIndex=j;continue}if(U===96){j=X,jj(),x.lastIndex=j;continue}if(U===47){if(j=X,f()){x.lastIndex=j;continue}x.lastIndex=X+1;continue}if(U===123){J++,x.lastIndex=X+1;continue}if(U===125){if(J--,J<=0){j=X+1;return}x.lastIndex=X+1;continue}if(U===59&&J===0){j=X+1;return}if((U===10||U===13)&&J===0){if(j=X,a())return}x.lastIndex=X+1}j=K}function Bj(){T(123,125);while(j<K&&y(Y.charCodeAt(j)))j++;if(z("from")){j+=4;while(j<K&&y(Y.charCodeAt(j)))j++;if(j<K){let J=Y.charCodeAt(j);if(J===39||J===34)l(J)}}while(j<K&&(Y.charCodeAt(j)===32||Y.charCodeAt(j)===9))j++;if(j<K&&Y.charCodeAt(j)===59)j++}function Gj(){j++;while(j<K&&y(Y.charCodeAt(j)))j++;if(z("as")){j+=2;while(j<K&&y(Y.charCodeAt(j)))j++;E();while(j<K&&y(Y.charCodeAt(j)))j++}if(z("from")){j+=4;while(j<K&&y(Y.charCodeAt(j)))j++;if(j<K){let J=Y.charCodeAt(j);if(J===39||J===34)l(J)}}while(j<K&&(Y.charCodeAt(j)===32||Y.charCodeAt(j)===9))j++;if(j<K&&Y.charCodeAt(j)===59)j++}function k(J){if(!c)return;let H=J-1;while(H>=0&&y(Y.charCodeAt(H)))H--;if(H<0)return;let X=[],U=!1;while(H>=0){if(H>=1&&Y.charCodeAt(H)===47&&Y.charCodeAt(H-1)===42){let F=Y.lastIndexOf("/*",H-2);if(F>=0){X.push(Y.slice(F,H+1)),U=!0,H=F-1;while(H>=0&&y(Y.charCodeAt(H)))H--;continue}break}let Z=H;while(Z>0&&Y.charCodeAt(Z-1)!==10)Z--;let $=w(Z,H+1);if($.startsWith("//")){if(U)break;let F=[$];H=Z-1;while(H>=0&&(Y.charCodeAt(H)===10||Y.charCodeAt(H)===13))H--;while(H>=0){let G=H;while(G>0&&Y.charCodeAt(G-1)!==10)G--;let V=w(G,H+1);if(V.startsWith("//")){F.push(V),H=G-1;while(H>=0&&(Y.charCodeAt(H)===10||Y.charCodeAt(H)===13))H--}else if(V===""){H=G-1;while(H>=0&&(Y.charCodeAt(H)===10||Y.charCodeAt(H)===13))H--}else break}F.reverse(),X.push(F.join(`
7
- `));continue}break}if(X.length===0)return;return X.reverse(),X}function Aj(J){let H=J,X=!1;while(j<K){let V=Y.charCodeAt(j);if(V===59){j++;break}if(V===39||V===34){l(V),X=!0;while(j<K&&(Y.charCodeAt(j)===32||Y.charCodeAt(j)===9))j++;if(j<K&&Y.charCodeAt(j)===59)j++;break}if(V===10&&X)break;j++}let U=w(H,j),Z=U.charCodeAt(7)===116&&(U.startsWith("import type ")||U.startsWith("import type{")),$=!1;{let V=6;while(V<U.length&&(U.charCodeAt(V)===32||U.charCodeAt(V)===9))V++;if(V<U.length&&U.charCodeAt(V)===116&&U.startsWith("type",V)){V+=4;while(V<U.length&&(U.charCodeAt(V)===32||U.charCodeAt(V)===9))V++}if(V<U.length){let Q=U.charCodeAt(V);$=Q===39||Q===34}}let F="";{let V=U.indexOf("from ");if(V!==-1){let Q=V+5;while(Q<U.length&&(U.charCodeAt(Q)===32||U.charCodeAt(Q)===9))Q++;if(Q<U.length){let B=U.charCodeAt(Q);if(B===39||B===34){let q=U.indexOf(String.fromCharCode(B),Q+1);if(q!==-1)F=U.slice(Q+1,q)}}}else if($){let Q=6;while(Q<U.length&&U.charCodeAt(Q)!==39&&U.charCodeAt(Q)!==34)Q++;if(Q<U.length){let B=U.charCodeAt(Q),q=U.indexOf(String.fromCharCode(B),Q+1);if(q!==-1)F=U.slice(Q+1,q)}}}let G=k(H);return{kind:"import",name:"",text:U,isExported:!1,isTypeOnly:Z,isSideEffect:$,source:F,leadingComments:G,start:H,end:j}}function Jj(){let J=j;return T(123,125),Y.slice(J,j)}function qj(J){let H=J.indexOf("(");if(H===-1)return J;let X=J.slice(H);if(X.indexOf("=")===-1)return J;let U=!1;for(let V=0;V<X.length;V++)if(X.charCodeAt(V)===61){let B=V>0?X.charCodeAt(V-1):0,q=V+1<X.length?X.charCodeAt(V+1):0;if(B!==61&&B!==33&&B!==60&&B!==62&&q!==61&&q!==62){U=!0;break}}if(!U)return J;let Z=0,$=-1;for(let V=H;V<J.length;V++){let Q=J.charCodeAt(V);if(Q===40)Z++;else if(Q===41){if(Z--,Z===0){$=V;break}}}if($===-1)return J;let F=J.slice(H,$+1),G=p(F);return J.slice(0,H)+G+J.slice($+1)}function Rj(J){let H=J.indexOf("//")!==-1||J.indexOf("/*")!==-1,X=J.split(`
8
- `),U=[],Z=[],$=[],F=!1,G=1/0;for(let B=0;B<X.length;B++){let q=X[B];if(H){if(F){if(q.includes("*/"))F=!1;continue}let D=q.trim();if(D.length===0)continue;let R=D.charCodeAt(0);if(R===47){let v=D.charCodeAt(1);if(v===47)continue;if(v===42){if(!D.includes("*/"))F=!0;continue}}if(R===42)continue;let N=bj(q);if(N.charCodeAt(N.length-1)===59)N=N.slice(0,-1);N=qj(N);let _=N.trim();if(!_)continue;U.push(N),Z.push(_);let M=0;while(M<N.length&&y(N.charCodeAt(M)))M++;if(_!=="{"&&_!=="}"){if(M<G)G=M}$.push(M)}else{let D=q.length;while(D>0&&(q.charCodeAt(D-1)===32||q.charCodeAt(D-1)===9||q.charCodeAt(D-1)===13))D--;if(D===0)continue;let R=D<q.length?q.slice(0,D):q;if(R.charCodeAt(R.length-1)===59)R=R.slice(0,-1);R=qj(R);let N=R.trim();if(!N)continue;U.push(R),Z.push(N);let _=0;while(_<R.length&&y(R.charCodeAt(_)))_++;if(N!=="{"&&N!=="}"){if(_<G)G=_}$.push(_)}}if(U.length===0)return"{}";if(G===1/0||G<=2)return U.join(`
9
- `);let V=G-2,Q=Array(U.length);for(let B=0;B<U.length;B++){let q=Z[B];if(q==="{"){Q[B]=q;continue}let D=$[B];if(D>G)Q[B]=U[B];else if(D===G&&(q.charCodeAt(0)===125||q.charCodeAt(0)===93||q.charCodeAt(0)===41))Q[B]=U[B];else{let R=Math.max(0,D-V);Q[B]=" ".repeat(R)+q}}return Q.join(`
10
- `)}function W(){if(j>=K||Y.charCodeAt(j)!==60)return"";let J=j;T(60,62);let H=Y.slice(J,j);if(H.includes(`
11
- `)){let X="",U=!1;for(let Z=0;Z<H.length;Z++){let $=H.charCodeAt(Z);if($===32||$===9||$===10||$===13){if(!U&&X.length>0)X+=" ",U=!0}else X+=H[Z],U=!1}if(X.charCodeAt(1)===32)X=`<${X.slice(2)}`;if(X.charCodeAt(X.length-2)===32)X=`${X.slice(0,-2)}>`;return X}return H}function m(){if(j>=K||Y.charCodeAt(j)!==40)return"()";let J=j;return T(40,41),Y.slice(J,j)}function p(J){let H=J.slice(1,-1).trim();if(!H)return"()";if(J.indexOf(`
12
- `)===-1&&H.indexOf(":")!==-1&&H.indexOf("{")===-1&&H.indexOf("[")===-1&&H.indexOf("=")===-1&&H.indexOf("@")===-1&&H.indexOf("...")===-1){let V=0,Q=0,B=0;for(let q=0;q<H.length;q++){let D=H.charCodeAt(q);if(D===40||D===60||D===123)B++;else if(D===41||D===62||D===125)B--;else if(B===0){if(D===58)V++;else if(D===44)Q++}}if(V>=Q+1){let q=!1;for(let D=0;D<Fj.length;D++){let R=Fj[D],N=H.indexOf(R);if(N!==-1){let _=N+R.length;if((N===0||!S(H.charCodeAt(N-1)))&&(_>=H.length||!S(H.charCodeAt(_)))){q=!0;break}}}if(!q)return J}}let X=[],U=0,Z=0,$=!1,F=0;for(let V=0;V<=H.length;V++){if(V===H.length){X.push(H.slice(U).trim());break}let Q=H.charCodeAt(V);if($){if(Q===92){V++;continue}if(Q===F)$=!1;continue}if(Q===39||Q===34||Q===96){$=!0,F=Q;continue}if(Q===40||Q===123||Q===91||Q===60)Z++;else if(Q===41||Q===125||Q===93||Q===62&&!(V>0&&H.charCodeAt(V-1)===61))Z--;else if(Q===44&&Z===0)X.push(H.slice(U,V).trim()),U=V+1}let G=[];for(let V of X){if(!V)continue;G.push(Nj(V))}return`(${G.join(", ")})`}function kj(J){if(!J.startsWith("{")&&!J.startsWith("["))return J;let H="",X=0,U=0,Z=!1,$=0;while(X<J.length){let F=J.charCodeAt(X);if(Z){if(F===92&&X+1<J.length){H+=J[X]+J[X+1],X+=2;continue}if(F===$)Z=!1;H+=J[X],X++;continue}if(F===39||F===34||F===96){Z=!0,$=F,H+=J[X],X++;continue}if(F===123||F===91||F===40)U++;else if(F===125||F===93||F===41)U--;if(U>=1&&F===61&&(X+1>=J.length||J.charCodeAt(X+1)!==61&&J.charCodeAt(X+1)!==62)){while(H.length>0&&(H[H.length-1]===" "||H[H.length-1]==="\t"||H[H.length-1]===`
13
- `))H=H.slice(0,-1);X++;let G=0;while(X<J.length){let V=J.charCodeAt(X);if(V===39||V===34||V===96){let Q=V;X++;while(X<J.length){if(J.charCodeAt(X)===92){X+=2;continue}if(J.charCodeAt(X)===Q){X++;break}X++}continue}if(V===123||V===91||V===40)G++;else if(V===125||V===93||V===41){if(G===0)break;G--}else if(V===44&&G===0)break;X++}continue}if(U===1&&F===46&&X+2<J.length&&J.charCodeAt(X+1)===46&&J.charCodeAt(X+2)===46){X+=3;continue}H+=J[X],X++}return H}function Nj(J){let H=J.trim(),X=H.startsWith("...");if(X)H=H.slice(3).trim();while(H.startsWith("@")){let N=1;while(N<H.length&&S(H.charCodeAt(N)))N++;if(N<H.length&&H.charCodeAt(N)===40){let _=1;N++;while(N<H.length&&_>0){if(H.charCodeAt(N)===40)_++;else if(H.charCodeAt(N)===41)_--;N++}}H=H.slice(N).trim()}let U=!0;while(U){U=!1;for(let N of Fj)if(H.startsWith(N)&&H.length>N.length&&!S(H.charCodeAt(N.length))){H=H.slice(N.length).trim(),U=!0;break}}let Z=-1,$=-1,F=0,G=!1,V=0;for(let N=0;N<H.length;N++){let _=H.charCodeAt(N);if(G){if(_===92){N++;continue}if(_===V)G=!1;continue}if(_===39||_===34||_===96){G=!0,V=_;continue}if(_===40||_===123||_===91||_===60)F++;else if(_===41||_===125||_===93||_===62&&!(N>0&&H.charCodeAt(N-1)===61))F--;else if(F===0){if(_===58&&Z===-1)Z=N;else if(_===61&&$===-1&&(N===0||H.charCodeAt(N-1)!==61)&&(N+1>=H.length||H.charCodeAt(N+1)!==61&&H.charCodeAt(N+1)!==62))$=N}}let Q,B,q=$!==-1;if(Z!==-1&&($===-1||Z<$))if(Q=H.slice(0,Z).trim(),$!==-1)B=H.slice(Z+1,$).trim();else B=H.slice(Z+1).trim();else if($!==-1)Q=H.slice(0,$).trim(),B=Uj(H.slice($+1).trim());else Q=H,B="unknown";if(Q=kj(Q),(Q.startsWith("{")||Q.startsWith("["))&&Q.includes(`
14
- `)){let N=Q.replace(/\s*\n\s*/g," ").replace(/\s+/g," ");if(N.length<=40)Q=N;else Q=Q.split(`
15
- `).map((M)=>{let v=M.trim();if(!v)return"";if(v==="{"||v==="}"||v==="["||v==="]"||v.startsWith("}")||v.startsWith("]"))return v;return` ${v}`}).join(`
16
- `)}let D=Q.endsWith("?")||q;if(Q.endsWith("?"))Q=Q.slice(0,-1).trim();let R=D&&!X?"?":"";if(X)return`...${Q}: ${B}`;return`${Q}${R}: ${B}`}function Dj(J){let H=0;if(H<J.length&&J.charCodeAt(H)===45)H++;if(H>=J.length)return!1;let X=J.charCodeAt(H);if(X<48||X>57)return!1;while(H<J.length&&J.charCodeAt(H)>=48&&J.charCodeAt(H)<=57)H++;if(H<J.length&&J.charCodeAt(H)===46){if(H++,H>=J.length||J.charCodeAt(H)<48||J.charCodeAt(H)>57)return!1;while(H<J.length&&J.charCodeAt(H)>=48&&J.charCodeAt(H)<=57)H++}return H===J.length}function Uj(J){let H=J.trim();if(H==="true"||H==="false")return"boolean";if(Dj(H))return"number";if(H.startsWith("'")&&H.endsWith("'")||H.startsWith('"')&&H.endsWith('"'))return"string";if(H.startsWith("["))return"unknown[]";if(H.startsWith("{"))return"Record<string, unknown>";return"unknown"}function Xj(J){let H=J.trim();if(H==="true"||H==="false")return H;if(Dj(H))return H;if(H.startsWith("'")&&H.endsWith("'")||H.startsWith('"')&&H.endsWith('"'))return H;return"unknown"}function Yj(J){if(J.endsWith("as const"))return null;let H=0,X=-1;for(let Z=0;Z<J.length;Z++){let $=J.charCodeAt(Z);if($===123||$===91||$===40)H++;else if($===125||$===93||$===41)H--;else if(H===0&&$===32&&Z+4<=J.length&&J.substring(Z,Z+4)===" as ")X=Z}if(X===-1)return null;return J.slice(X+4).trim()||null}function s(){if(O(),j<K&&Y.charCodeAt(j)===58){j++,O();let J=j,H=0;while(j<K){if(f())continue;let X=Y.charCodeAt(j);if(X===40||X===91||X===60)H++;else if(X===41||X===93||X===62&&!C())H--;else if(X===123)if(H>0)H++;else{let U=w(J,j),Z=($)=>{let F=U.length-$.length;return F>=0&&U.endsWith($)&&(F===0||!S(U.charCodeAt(F-1)))};if(U.length===0||U.endsWith("|")||U.endsWith("&")||Z("is")||Z("extends"))H++;else break}else if(X===125){if(H===0)break;H--}else if(H===0&&X===59)break;if(H===0&&o())break;j++}return w(J,j)}return""}function n(J,H,X,U){j+=8,O();let Z=j<K&&Y.charCodeAt(j)===42;if(Z)j++,O();let $=E();if(!$&&!U)return null;O();let F=W();O();let G=m();O();let V=s();if(!V)if(X&&Z)V="AsyncGenerator<unknown, void, unknown>";else if(Z)V="Generator<unknown, void, unknown>";else if(X)V="Promise<void>";else V="void";O();let Q=!1;if(j<K&&Y.charCodeAt(j)===123)Q=!0,T(123,125);else if(j<K&&Y.charCodeAt(j)===59)j++;let B=p(G),q=`${H?"export ":""}declare function ${$||"default"}${F}${B}: ${V};`,D=k(J);if(Q)u.add(L.length);return{kind:"function",name:$||"default",text:q,isExported:H,isDefault:U,isAsync:X,isGenerator:Z,returnType:V,generics:F||void 0,leadingComments:D,start:J,end:j}}function t(J,H,X){j+=H.length,O();let U=[];do{if(O(),j>=K)break;let Z=Y.charCodeAt(j);if(Z===123||Z===91)return I(),U;let $=E();if(!$)return I(),U;O();let F,G,V=!1;if(j<K&&Y.charCodeAt(j)===58){j++,O();let q=j,D=0;while(j<K){if(f())continue;let R=Y.charCodeAt(j);if(R===40||R===123||R===91||R===60)D++;else if(R===41||R===125||R===93||R===62&&!C())D--;else if(D===0&&(R===61||R===59||R===44))break;if(D===0&&a())break;j++}F=w(q,j)}if(j<K&&Y.charCodeAt(j)===61)if(P&&F&&!Wj(F))I();else{j++,O();let q=j,D=0;while(j<K){if(f())continue;let R=Y.charCodeAt(j);if(R===40||R===123||R===91||R===60)D++;else if(R===41||R===125||R===93||R===62&&!C())D--;else if(D===0&&(R===59||R===44))break;if(D===0&&a())break;j++}if(G=w(q,j),G.endsWith(" as const")||G==="const"){if(V=!0,!F){let R=G.endsWith(" as const")?G.slice(0,-9).trim():G,N=Xj(R);F=N!=="unknown"?N:void 0}}else if(!F){let R=Yj(G);if(R)F=R}}if(j<K){let q=Y.charCodeAt(j);if(q===44){j++;continue}if(q===59)j++}let Q=k(J),B=`export declare ${H} ${$}: ${F||"unknown"};`;U.push({kind:"variable",name:$,text:B,isExported:!0,typeAnnotation:F,value:G,modifiers:V?[H,"const assertion"]:[H],leadingComments:Q,start:J,end:j});break}while(j<K);return U}function Zj(J,H){j+=9,O();let X=E();O();let U=W();O();let Z="";if(z("extends")){j+=7,O();let Q=j,B=0;while(j<K){if(f())continue;let q=Y.charCodeAt(j);if(q===60)B++;else if(q===62&&!C())B--;else if(q===123&&B===0)break;j++}Z=w(Q,j)}O();let $=j<K&&Y.charCodeAt(j)===123?Jj():"{}",F=Rj($),G=`${H?"export ":""}declare interface ${X}${U}${Z?` extends ${Z}`:""} ${F}`,V=k(J);return{kind:"interface",name:X,text:G,isExported:H,extends:Z||void 0,generics:U||void 0,leadingComments:V,start:J,end:j}}function $j(J,H){j+=4,O();let X=E();O();let U=W();if(O(),j<K&&Y.charCodeAt(j)===61)j++;O();let Z=j,$=0;while(j<K){if(f())continue;let Q=Y.charCodeAt(j);if(Q===40||Q===123||Q===91||Q===60)$++;else if(Q===41||Q===125||Q===93||Q===62&&!C())$--;else if($===0&&Q===59)break;if($===0&&a())break;j++}let F=w(Z,j);if(j<K&&Y.charCodeAt(j)===59)j++;let G=`${H?"export ":""}type ${X}${U} = ${F}`,V=k(J);return{kind:"type",name:X,text:G,isExported:H,generics:U||void 0,leadingComments:V,start:J,end:j}}function r(J,H,X){j+=4,O();let U=E();O();let Z=j;if(j<K&&Y.charCodeAt(j)===123)T(123,125);let $=w(J,j),F=k(J);return{kind:"enum",name:U,text:$,isExported:H,modifiers:X?["const"]:void 0,leadingComments:F,start:J,end:j}}function d(J,H,X){j+=5,O();let U=E()||"AnonymousClass";O();let Z=W();O();let $="";if(z("extends")){j+=7,O();let B=j,q=0;while(j<K){if(f())continue;let D=Y.charCodeAt(j);if(D===60)q++;else if(D===62&&!C())q--;else if(q===0&&(D===123||z("implements")))break;j++}$=w(B,j)}let F;if(z("implements")){j+=10,O();let B=j,q=0;while(j<K){if(f())continue;let R=Y.charCodeAt(j);if(R===60)q++;else if(R===62&&!C())q--;else if(q===0&&R===123)break;j++}let D=w(B,j);if(D)F=D.split(",").map((R)=>R.trim())}O();let G=Qj(),V=`${H?"export ":""}declare ${X?"abstract ":""}class ${U}${Z}${$?` extends ${$}`:""}${F&&F.length>0?` implements ${F.join(", ")}`:""} ${G}`,Q=k(J);return{kind:"class",name:U,text:V,isExported:H,extends:$||void 0,implements:F,generics:Z||void 0,modifiers:X?["abstract"]:void 0,leadingComments:Q,start:J,end:j}}function Qj(){if(j>=K||Y.charCodeAt(j)!==123)return"{}";j++;let J=[];while(j<K){if(O(),j>=K)break;if(Y.charCodeAt(j)===125){j++;break}if(Y.charCodeAt(j)===59){j++;continue}if(z("static")&&_j("static")===123){j+=6,O(),T(123,125);continue}let H=!1,X=!1,U=!1,Z=!1,$=!1,F=!1,G=!1,V=!1,Q=!0;while(Q){if(O(),z("private")){H=!0,j+=7;continue}if(z("protected")){X=!0,j+=9;continue}if(z("public")){j+=6;continue}if(z("static")){U=!0,j+=6;continue}if(z("abstract")){Z=!0,j+=8;continue}if(z("readonly")){$=!0,j+=8;continue}if(z("override")){F=!0,j+=8;continue}if(z("accessor")){G=!0,j+=8;continue}if(z("async")){V=!0,j+=5;continue}if(z("declare")){j+=7;continue}break}if(O(),j>=K||Y.charCodeAt(j)===125)break;if(Y.charCodeAt(j)===35)H=!0;if(H){Vj();continue}let B=" ";if(X)B+="protected ";if(U)B+="static ";if(Z)B+="abstract ";if($)B+="readonly ";if(z("constructor")){j+=11,O();let q=m();if(O(),Cj(q,J),j<K&&Y.charCodeAt(j)===123)T(123,125);else if(j<K&&Y.charCodeAt(j)===59)j++;let D=p(q);J.push(` constructor${D};`)}else if(z("get"))if(j+=3,O(),j<K&&(Oj(Y.charCodeAt(j))||Y.charCodeAt(j)===91||Y.charCodeAt(j)===35)){let q=Kj();if(q.startsWith("#")){if(O(),j<K&&Y.charCodeAt(j)===40)m();if(O(),s(),O(),j<K&&Y.charCodeAt(j)===123)T(123,125);else if(j<K&&Y.charCodeAt(j)===59)j++;continue}O(),m(),O();let D=s()||"unknown";if(O(),j<K&&Y.charCodeAt(j)===123)T(123,125);else if(j<K&&Y.charCodeAt(j)===59)j++;J.push(`${B}get ${q}(): ${D};`)}else Lj("get",B,U,$,V,J);else if(z("set"))if(j+=3,O(),j<K&&(Oj(Y.charCodeAt(j))||Y.charCodeAt(j)===91||Y.charCodeAt(j)===35)){let q=Kj();if(q.startsWith("#")){if(O(),j<K&&Y.charCodeAt(j)===40)m();if(O(),j<K&&Y.charCodeAt(j)===123)T(123,125);else if(j<K&&Y.charCodeAt(j)===59)j++;continue}O();let D=m();if(O(),j<K&&Y.charCodeAt(j)===123)T(123,125);else if(j<K&&Y.charCodeAt(j)===59)j++;let R=p(D);J.push(`${B}set ${q}${R};`)}else Lj("set",B,U,$,V,J);else{let q=Y.charCodeAt(j)===42;if(q)j++,O();let D=Kj();if(!D){Vj();continue}gj(D,B,U,$,q,Z,V,J)}}return`{
17
- ${J.join(`
18
- `)}
19
- }`}function Kj(){if(j>=K)return"";let J=Y.charCodeAt(j);if(J===91){let H=j;return T(91,93),Y.slice(H,j)}if(J===35)return j++,`#${E()}`;return E()}function _j(J){let H=j+J.length;while(H<K&&y(Y.charCodeAt(H)))H++;return H<K?Y.charCodeAt(H):0}function Vj(){let J=0;while(j<K){if(f())continue;let H=Y.charCodeAt(j);if(H===123||H===40)J++;else if(H===125||H===41){if(J===0)return;J--}else if(H===59&&J===0){j++;return}if(J===0&&o())return;j++}}function Lj(J,H,X,U,Z,$){gj(J,H,X,U,!1,!1,Z,$)}function gj(J,H,X,U,Z,$,F,G){if(O(),j>=K)return;let V=Y.charCodeAt(j),Q=!1;if(V===63)Q=!0,j++,O();if(j<K&&Y.charCodeAt(j)===33)j++,O();let B=j<K?Y.charCodeAt(j):0;if(B===40||B===60){let q=B===60?W():"";O();let D=m();O();let R=s();if(!R)if(F&&Z)R="AsyncGenerator<unknown, void, unknown>";else if(Z)R="Generator<unknown, void, unknown>";else if(F)R="Promise<void>";else R="void";if(O(),j<K&&Y.charCodeAt(j)===123)T(123,125);else if(j<K&&Y.charCodeAt(j)===59)j++;let N=p(D),_=Q?"?":"",M=Z?"*":"";G.push(`${H}${M}${J}${_}${q}${N}: ${R};`)}else if(B===58||B===61||B===59||B===125||B===10||B===13){let q="";if(B===58){j++,O();let N=j,_=0;while(j<K){if(f())continue;let M=Y.charCodeAt(j);if(M===40||M===123||M===91||M===60)_++;else if(M===41||M===125||M===93||M===62&&!C()){if(_===0)break;_--}else if(_===0&&(M===59||M===61||M===44))break;if(_===0&&o())break;j++}q=w(N,j)}let D="";if(j<K&&Y.charCodeAt(j)===61)if(P&&q){j++;let N=0;while(j<K){if(f())continue;let _=Y.charCodeAt(j);if(_===40||_===123||_===91)N++;else if(_===41||_===125||_===93){if(N===0&&_===125)break;N--}else if(N===0&&_===59)break;if(N===0&&o())break;j++}}else{j++,O();let N=j,_=0;while(j<K){if(f())continue;let M=Y.charCodeAt(j);if(M===40||M===123||M===91)_++;else if(M===41||M===125||M===93){if(_===0&&M===125)break;_--}else if(_===0&&M===59)break;if(_===0&&o())break;j++}D=w(N,j)}if(j<K&&Y.charCodeAt(j)===59)j++;if(!q)if(D){let N=Yj(D);if(N)q=N;else q=X&&U?Xj(D):Uj(D)}else q="unknown";let R=Q?"?":"";G.push(`${H}${J}${R}: ${q};`)}else Vj()}function Cj(J,H){let X=J.slice(1,-1).trim();if(!X)return;let U=[],Z=0,$=0,F=!1,G=0;for(let V=0;V<=X.length;V++){if(V===X.length){U.push(X.slice(Z).trim());break}let Q=X.charCodeAt(V);if(F){if(Q===92){V++;continue}if(Q===G)F=!1;continue}if(Q===39||Q===34||Q===96){F=!0,G=Q;continue}if(Q===40||Q===123||Q===91||Q===60)$++;else if(Q===41||Q===125||Q===93||Q===62&&!(V>0&&X.charCodeAt(V-1)===61))$--;else if(Q===44&&$===0)U.push(X.slice(Z,V).trim()),Z=V+1}for(let V of U){let Q=V.startsWith("public ")||V.startsWith("public\t"),B=V.startsWith("protected ")||V.startsWith("protected\t"),q=V.startsWith("private ")||V.startsWith("private\t"),D=V.includes("readonly ");if(!Q&&!B&&!q&&!D)continue;if(q)continue;let R=V,N=[];if(Q){let v=6;while(v<R.length&&y(R.charCodeAt(v)))v++;R=R.slice(v),N.push("public")}if(B){let v=9;while(v<R.length&&y(R.charCodeAt(v)))v++;R=R.slice(v),N.push("protected")}if(D){let v=R.indexOf("readonly ");if(v!==-1){let Hj=v+8;while(Hj<R.length&&y(R.charCodeAt(Hj)))Hj++;R=R.slice(0,v)+R.slice(Hj)}N.push("readonly")}let _=N.length>0?`${N.join(" ")} `:"",M=Nj(R);H.push(` ${_}${M};`)}}function zj(J=" "){if(j>=K||Y.charCodeAt(j)!==123)return"{}";j++;let H=[];while(j<K){if(O(),j>=K)break;if(Y.charCodeAt(j)===125){j++;break}if(Y.charCodeAt(j)===59){j++;continue}let X=!1;if(z("export"))X=!0,j+=6,O();if(z("declare"))j+=7,O();let U=X?"export ":"";if(z("function")||z("async")&&Sj("async","function")){let Z=!1;if(z("async"))Z=!0,j+=5,O();if(j+=8,O(),j<K&&Y.charCodeAt(j)===42)j++,O();let F=E();O();let G=W();O();let V=m();O();let Q=s();if(!Q)Q=Z?"Promise<void>":"void";if(O(),j<K&&Y.charCodeAt(j)===123)T(123,125);else if(j<K&&Y.charCodeAt(j)===59)j++;let B=p(V);H.push(`${J}${U}function ${F}${G}${B}: ${Q};`)}else if(z("const")||z("let")||z("var")){let Z=z("const")?"const":z("let")?"let":"var";j+=Z.length,O();let $=E();if(!$){I();continue}O();let F="";if(j<K&&Y.charCodeAt(j)===58){j++,O();let V=j,Q=0;while(j<K){if(f())continue;let B=Y.charCodeAt(j);if(B===40||B===123||B===91||B===60)Q++;else if(B===41||B===125||B===93||B===62&&!C())Q--;else if(Q===0&&(B===61||B===59||B===44))break;if(Q===0&&a())break;j++}F=w(V,j)}let G="";if(j<K&&Y.charCodeAt(j)===61){j++,O();let V=j,Q=0;while(j<K){if(f())continue;let B=Y.charCodeAt(j);if(B===40||B===123||B===91||B===60)Q++;else if(B===41||B===125||B===93||B===62&&!C())Q--;else if(Q===0&&(B===59||B===44))break;if(Q===0&&a())break;j++}G=w(V,j)}if(j<K&&Y.charCodeAt(j)===59)j++;if(!F&&G){let V=Yj(G);if(V)F=V;else if(Z==="const")F=Xj(G);else F=Uj(G)}if(!F)F="unknown";H.push(`${J}${U}${Z} ${$}: ${F};`)}else if(z("interface")){j+=9,O();let Z=E();O();let $=W();O();let F="";if(z("extends")){let V=j;while(j<K&&Y.charCodeAt(j)!==123){if(f())continue;j++}F=Y.slice(V,j)}let G=Rj(Jj());H.push(`${J}${U}interface ${Z}${$}${F} ${G}`)}else if(z("type")){j+=4,O();let Z=E();O();let $=W();if(O(),j<K&&Y.charCodeAt(j)===61){j++,O();let F=j,G=0;while(j<K){if(f())continue;let Q=Y.charCodeAt(j);if(Q===40||Q===123||Q===91||Q===60)G++;else if(Q===41||Q===125||Q===93||Q===62&&!C())G--;else if(G===0&&Q===59)break;if(G===0&&a())break;j++}let V=w(F,j);if(j<K&&Y.charCodeAt(j)===59)j++;H.push(`${J}${U}type ${Z}${$} = ${V}`)}}else if(z("class")){j+=5,O();let Z=E();O();let $=W();O();let F=j;while(j<K&&Y.charCodeAt(j)!==123){if(f())continue;j++}let G=w(F,j),V=G?` ${G}`:"",Q=Qj();H.push(`${J}${U}class ${Z}${$}${V} ${Q}`)}else if(z("enum")){j+=4,O();let Z=E();O();let $=Jj();H.push(`${J}${U}enum ${Z} ${$}`)}else if(z("namespace")||z("module")){let Z=z("namespace")?"namespace":"module";j+=Z.length,O();let $=E();O();let F=zj(J);H.push(`${J}${U}${Z} ${$} ${F}`)}else if(z("abstract"))if(j+=8,O(),z("class")){j+=5,O();let Z=E();O();let $=W();O();let F=j;while(j<K&&Y.charCodeAt(j)!==123){if(f())continue;j++}let G=w(F,j),V=G?` ${G}`:"",Q=Qj();H.push(`${J}${U}abstract class ${Z}${$}${V} ${Q}`)}else I();else if(X&&z("default")){j+=7,O();let Z=j;I();let $=w(Z,j);if($.charCodeAt($.length-1)===59)$=$.slice(0,-1);if($)H.push(`${J}export default ${$};`)}else if(!X&&(Y.charCodeAt(j)===39||Y.charCodeAt(j)===34||Y.charCodeAt(j)===96))I();else I()}if(H.length===0)return"{}";return`{
20
- ${H.join(`
21
- `)}
22
- }`}function Sj(J,H){let X=j+J.length;while(X<K&&y(Y.charCodeAt(X)))X++;for(let U=0;U<H.length;U++)if(X+U>=K||Y.charCodeAt(X+U)!==H.charCodeAt(U))return!1;return X+H.length>=K||!S(Y.charCodeAt(X+H.length))}function i(J,H,X){j+=X.length,O();let U="",Z=Y.charCodeAt(j);if(Z===39||Z===34){let Q=j;l(Z),U=Y.slice(Q,j)}else{U=E();while(j<K&&Y.charCodeAt(j)===46)j++,U+=`.${E()}`}O();let $=j<K&&Y.charCodeAt(j)===123?zj():"{}",F=`${H?"export ":""}declare ${X} ${U} ${$}`,G=k(J),V=U.startsWith("'")||U.startsWith('"');return{kind:"module",name:U,text:F,isExported:H,source:V?U.slice(1,-1):void 0,leadingComments:G,start:J,end:j}}while(j<K){if(O(),j>=K)break;let J=j,H=Y.charCodeAt(j);if(H===105&&z("import"))L.push(Aj(J));else if(H===101&&z("export")){j+=6,O();let X=Y.charCodeAt(j);if(X===100&&z("default")){j+=7,O();let U=Y.charCodeAt(j);if(U===102&&z("function")){let Z=n(J,!0,!1,!0);if(Z)L.push(Z)}else if(U===97&&z("async")&&_j("async")!==59)if(j+=5,O(),z("function")){let Z=n(J,!0,!0,!0);if(Z)L.push(Z)}else{I();let Z=w(J,j);L.push({kind:"export",name:"default",text:Z,isExported:!0,isTypeOnly:!1,start:J,end:j})}else if(U===99&&z("class")){let Z=d(J,!0,!1);L.push(Z)}else if(U===97&&z("abstract")){if(j+=8,O(),z("class")){let Z=d(J,!0,!0);L.push(Z)}}else{I();let Z=w(J,j),$=k(J);L.push({kind:"export",name:"default",text:Z,isExported:!0,isTypeOnly:!1,leadingComments:$,start:J,end:j})}}else if(X===116&&z("type")){let U=j;if(j+=4,O(),j<K&&Y.charCodeAt(j)===123){Bj();let Z=w(J,j),$=k(J);L.push({kind:"export",name:"",text:Z,isExported:!0,isTypeOnly:!0,leadingComments:$,start:J,end:j})}else if(j<K&&Y.charCodeAt(j)===42){Gj();let Z=w(J,j);L.push({kind:"export",name:"",text:Z,isExported:!0,isTypeOnly:!0,start:J,end:j})}else{j=U;let Z=$j(J,!0);L.push(Z)}}else if(X===105&&z("interface")){let U=Zj(J,!0);L.push(U)}else if(X===102&&z("function")){let U=n(J,!0,!1,!1);if(U)L.push(U)}else if(X===97&&z("async"))if(j+=5,O(),z("function")){let U=n(J,!0,!0,!1);if(U)L.push(U)}else I();else if(X===99)if(z("class")){let U=d(J,!0,!1);L.push(U)}else if(z("const")){let U=j;if(j+=5,O(),z("enum")){j=U+5,O();let Z=r(J,!0,!0);L.push(Z)}else{j=U;let Z=t(J,"const",!0);for(let $=0;$<Z.length;$++)L.push(Z[$])}}else I();else if(X===97&&z("abstract")){if(j+=8,O(),z("class")){let U=d(J,!0,!0);L.push(U)}}else if(X===108&&z("let")){let U=t(J,"let",!0);for(let Z=0;Z<U.length;Z++)L.push(U[Z])}else if(X===118&&z("var")){let U=t(J,"var",!0);for(let Z=0;Z<U.length;Z++)L.push(U[Z])}else if(X===101&&z("enum")){let U=r(J,!0,!1);L.push(U)}else if(X===100&&z("declare"))j+=7,O(),Mj(J,!0);else if(X===110&&z("namespace")){let U=i(J,!0,"namespace");L.push(U)}else if(X===109&&z("module")){let U=i(J,!0,"module");L.push(U)}else if(X===123){Bj();let U=w(J,j),Z=U.includes("export type"),$=k(J);L.push({kind:"export",name:"",text:U,isExported:!0,isTypeOnly:Z,leadingComments:$,start:J,end:j})}else if(X===42){Gj();let U=w(J,j),Z=k(J),$,F=U.indexOf("from ");if(F!==-1){let G=F+5;while(G<U.length&&(U.charCodeAt(G)===32||U.charCodeAt(G)===9))G++;if(G<U.length){let V=U.charCodeAt(G);if(V===39||V===34){let Q=U.indexOf(U[G],G+1);if(Q!==-1)$=U.slice(G+1,Q)}}}L.push({kind:"export",name:"",text:U,isExported:!0,isTypeOnly:!1,source:$,leadingComments:Z,start:J,end:j})}else{I();let U=w(J,j);if(U)L.push({kind:"export",name:"",text:U,isExported:!0,start:J,end:j})}}else if(H===100&&z("declare"))j+=7,O(),Mj(J,!1);else if(H===105&&z("interface")){let X=Zj(J,!1);b.set(X.name,X)}else if(H===116&&z("type")){let X=$j(J,!1);b.set(X.name,X),L.push(X)}else if(H===102&&z("function"))I();else if(H===97)if(z("async"))I();else if(z("abstract"))if(j+=8,O(),z("class")){let X=d(J,!1,!1);b.set(X.name,X),L.push(X)}else I();else j++,I();else if(H===99)if(z("class")){let X=d(J,!1,!1);b.set(X.name,X),L.push(X)}else if(z("const")){let X=j;if(j+=5,O(),z("enum")){j=X+5,O();let U=r(J,!1,!0);b.set(U.name,U),L.push(U)}else j=X,I()}else j++,I();else if(H===101&&z("enum")){let X=r(J,!1,!1);b.set(X.name,X),L.push(X)}else if(H===108&&z("let"))I();else if(H===118&&z("var"))I();else if(H===109&&z("module")){let X=i(J,!1,"module");L.push(X)}else if(H===110&&z("namespace")){let X=i(J,!1,"namespace");L.push(X)}else{let X=Y.charCodeAt(j);if(X===39||X===34){if(l(X),j<K&&Y.charCodeAt(j)===59)j++}else if(X===96){if(jj(),j<K&&Y.charCodeAt(j)===59)j++}else if(X===64){if(j++,E(),O(),j<K&&Y.charCodeAt(j)===46)j++,E(),O();if(j<K&&Y.charCodeAt(j)===40)T(40,41)}else j++,I()}}if(b.size>0)uj(L,b);if(u.size>0){let J=new Map;for(let X of L)if(X.kind==="function")J.set(X.name,(J.get(X.name)||0)+1);let H=new Set;for(let[X,U]of J)if(U>1)H.add(X);if(H.size>0){let X=new Set;for(let U of H)for(let Z=L.length-1;Z>=0;Z--)if(L[Z].kind==="function"&&L[Z].name===U&&u.has(Z)){X.add(Z);break}if(X.size>0){let U=[...X].sort((Z,$)=>$-Z);for(let Z of U)L.splice(Z,1)}}}return L;function Mj(J,H){if(z("function")){let X=n(J,H,!1,!1);if(X)L.push(X)}else if(z("async")){if(j+=5,O(),z("function")){let X=n(J,H,!0,!1);if(X)L.push(X)}}else if(z("class")){let X=d(J,H,!1);L.push(X)}else if(z("abstract")){if(j+=8,O(),z("class")){let X=d(J,H,!0);L.push(X)}}else if(z("interface")){let X=Zj(J,H);L.push(X)}else if(z("type")){let X=$j(J,H);L.push(X)}else if(z("enum")){let X=r(J,H,!1);L.push(X)}else if(z("const")){let X=j;if(j+=5,O(),z("enum")){j=X+5,O();let U=r(J,H,!0);L.push(U)}else if(H){j=X;let U=t(J,"const",!0);for(let Z=0;Z<U.length;Z++)L.push(U[Z])}else I()}else if(z("let")||z("var"))if(H){let X=z("let")?"let":"var",U=t(J,X,!0);for(let Z=0;Z<U.length;Z++)L.push(U[Z])}else I();else if(z("module")){let X=i(J,H,"module");L.push(X)}else if(z("namespace")){let X=i(J,H,"namespace");L.push(X)}else if(z("global")){j+=6,O();let U=`declare global ${j<K&&Y.charCodeAt(j)===123?zj():"{}"}`,Z=k(J);L.push({kind:"module",name:"global",text:U,isExported:!1,leadingComments:Z,start:J,end:j})}else I()}}function Pj(g,e){let A=0,h=g.length;while(A<h){let Y=g.charCodeAt(A);if(Y>=65&&Y<=90||Y>=97&&Y<=122||Y===95||Y===36||Y>127){let c=A;A++;while(A<h){let P=g.charCodeAt(A);if(P>=65&&P<=90||P>=97&&P<=122||P>=48&&P<=57||P===95||P===36||P>127)A++;else break}e.add(g.substring(c,A))}else A++}}function uj(g,e){let A=new Set,h=new Set;for(let P of g)h.add(P.name);let Y=new Set,c=[];for(let P=0;P<g.length;P++)if(g[P].kind!=="import")c.push(g[P].text),Pj(g[P].text,Y);for(;;){let P=[];for(let[b,u]of e){if(A.has(b))continue;if(Y.has(b)){if(!h.has(b))P.push(u),h.add(b);A.add(b)}}if(P.length===0)break;P.sort((b,u)=>(b.start??1/0)-(u.start??1/0));let K=[],L=0;for(let b=0;b<g.length;b++){let u=g[b].start??1/0;while(L<P.length&&(P[L].start??1/0)<=u)K.push(P[L++]);K.push(g[b])}while(L<P.length)K.push(P[L++]);g.length=0;for(let b=0;b<K.length;b++)g.push(K[b]);for(let b of P)if(b.kind!=="import")c.push(b.text),Pj(b.text,Y)}}
23
- export{xj as nc};