@dtsx/dtsx 0.11.41 → 0.11.42

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 (80) hide show
  1. package/dist/bin/cli.js +1 -1
  2. package/dist/{chunk-8qvphjgv.js → chunk-298wqs3n.js} +1 -1
  3. package/dist/{chunk-jvaqq9fq.js → chunk-3jtwkmfx.js} +1 -1
  4. package/dist/{chunk-8g4wk8mm.js → chunk-3qx4ys4v.js} +19 -19
  5. package/dist/{chunk-grqy03qp.js → chunk-537hj5pj.js} +1 -1
  6. package/dist/{chunk-01jwgm2m.js → chunk-54d8mt4c.js} +1 -1
  7. package/dist/{chunk-dpanh3p5.js → chunk-5ezj0r3g.js} +1 -1
  8. package/dist/{chunk-jfsj0sd2.js → chunk-bre2x1bd.js} +1 -1
  9. package/dist/{chunk-3f3byyqp.js → chunk-cyfnxk8d.js} +1 -1
  10. package/dist/{chunk-gn3zapr9.js → chunk-cywe5sgm.js} +1 -1
  11. package/dist/{chunk-k4pkkkmh.js → chunk-eatp44nf.js} +1 -1
  12. package/dist/{chunk-6yn2edca.js → chunk-ej7jt519.js} +1 -1
  13. package/dist/{chunk-sp0k32m0.js → chunk-f2yhf6gj.js} +1 -1
  14. package/dist/{chunk-yf6v2p6x.js → chunk-g4dpvmfy.js} +1 -1
  15. package/dist/{chunk-epjq1edf.js → chunk-gc7y4wav.js} +1 -1
  16. package/dist/{chunk-ves9h7g2.js → chunk-gt5k2mff.js} +1 -1
  17. package/dist/{chunk-059gzhxc.js → chunk-gv9brtta.js} +1 -1
  18. package/dist/{chunk-pq1n1xqh.js → chunk-jf8mxazb.js} +1 -1
  19. package/dist/{chunk-rajfxka5.js → chunk-k9695p66.js} +1 -1
  20. package/dist/{chunk-q11f576t.js → chunk-kdnqedyb.js} +1 -1
  21. package/dist/{chunk-wma315wm.js → chunk-msr5zymd.js} +1 -1
  22. package/dist/{chunk-q4ph9qa2.js → chunk-pd30356m.js} +1 -1
  23. package/dist/{chunk-2ck79rny.js → chunk-prst4szw.js} +1 -1
  24. package/dist/{chunk-xmj05115.js → chunk-q4fhsthj.js} +1 -1
  25. package/dist/{chunk-geqv8t08.js → chunk-q4gxj6qk.js} +1 -1
  26. package/dist/{chunk-qnwcsmsg.js → chunk-q76b61w9.js} +1 -1
  27. package/dist/{chunk-v55m1ae1.js → chunk-r27pfg4r.js} +1 -1
  28. package/dist/{chunk-vgdsxnc2.js → chunk-s0sretav.js} +1 -1
  29. package/dist/{chunk-k0mqnrc1.js → chunk-t76sqybd.js} +1 -1
  30. package/dist/{chunk-df8p90w4.js → chunk-t8cgznk6.js} +1 -1
  31. package/dist/{chunk-yyqay3jp.js → chunk-vjtcxr3q.js} +1 -1
  32. package/dist/{chunk-w8ws29dq.js → chunk-x4qkjqda.js} +1 -1
  33. package/dist/{chunk-9pharkp0.js → chunk-zbyvnsny.js} +1 -1
  34. package/dist/{chunk-5mbfgcvp.js → chunk-zy5jxjmg.js} +1 -1
  35. package/dist/src/augmentation-graph.js +1 -1
  36. package/dist/src/bundle-linker.js +1 -1
  37. package/dist/src/bundler.js +1 -1
  38. package/dist/src/circular.js +1 -1
  39. package/dist/src/declaration-project.js +1 -1
  40. package/dist/src/declaration-publication.js +1 -1
  41. package/dist/src/docs.js +1 -1
  42. package/dist/src/extractor/extract.js +1 -1
  43. package/dist/src/extractor/scanner.js +1 -1
  44. package/dist/src/extractor.js +1 -1
  45. package/dist/src/function-properties.js +1 -1
  46. package/dist/src/generator.js +1 -1
  47. package/dist/src/index.js +1 -1
  48. package/dist/src/inferred-imports.js +1 -1
  49. package/dist/src/lsp.js +1 -1
  50. package/dist/src/native-checker.js +1 -1
  51. package/dist/src/native-extractor.js +1 -1
  52. package/dist/src/native-generation.js +1 -1
  53. package/dist/src/native-project.js +1 -1
  54. package/dist/src/optimizer.js +1 -1
  55. package/dist/src/parallel-processor.js +1 -1
  56. package/dist/src/parser.js +1 -1
  57. package/dist/src/plugins/bun.js +1 -1
  58. package/dist/src/plugins/esbuild.js +1 -1
  59. package/dist/src/plugins/index.js +1 -1
  60. package/dist/src/plugins/tsdown.js +1 -1
  61. package/dist/src/plugins/tsup.js +1 -1
  62. package/dist/src/plugins/vite.js +1 -1
  63. package/dist/src/plugins/webpack.js +1 -1
  64. package/dist/src/process-source.js +1 -1
  65. package/dist/src/processor/declarations.js +1 -1
  66. package/dist/src/processor/import-usage.js +1 -1
  67. package/dist/src/processor/index.js +1 -1
  68. package/dist/src/processor/type-inference.js +1 -1
  69. package/dist/src/processor.js +1 -1
  70. package/dist/src/return-type-scope.js +1 -1
  71. package/dist/src/value-inference.js +1 -1
  72. package/dist/src/worker-thread.js +1 -1
  73. package/dist/src/workspace.js +1 -1
  74. package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
  75. package/native/darwin-x64/libzig-dtsx.dylib +0 -0
  76. package/native/freebsd-x64/libzig-dtsx.so +0 -0
  77. package/native/linux-arm64/libzig-dtsx.so +0 -0
  78. package/native/linux-x64/libzig-dtsx.so +0 -0
  79. package/native/windows-x64/zig-dtsx.dll +0 -0
  80. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-wma315wm.js";function me(a={}){let{onStart:d=!1,onEnd:l=!0,onGenerated:u,onError:i,...n}=a,e=async()=>{try{let r=await s(n);u?.(r)}catch(r){let t=r instanceof Error?r:Error(String(r));if(i?.(t),!i)console.error("[dtsx] Generation failed:",t.message)}};return{name:"dtsx",setup(r){let t=r.initialOptions;if(!n.entrypoints&&t.entryPoints)if(Array.isArray(t.entryPoints))n.entrypoints=t.entryPoints;else n.entrypoints=Object.values(t.entryPoints);if(!n.outdir){if(t.outdir)n.outdir=t.outdir;else if(t.outfile){let o=t.outfile.lastIndexOf("/");if(o!==-1)n.outdir=t.outfile.substring(0,o)}}if(d)r.onStart(async()=>{await e()});if(l)r.onEnd(async(o)=>{if(o.errors.length===0)await e()})}}}var Aa=me,sr=me,Pa=me;
2
+ import{s}from"./chunk-msr5zymd.js";function me(a={}){let{onStart:d=!1,onEnd:l=!0,onGenerated:u,onError:i,...n}=a,e=async()=>{try{let r=await s(n);u?.(r)}catch(r){let t=r instanceof Error?r:Error(String(r));if(i?.(t),!i)console.error("[dtsx] Generation failed:",t.message)}};return{name:"dtsx",setup(r){let t=r.initialOptions;if(!n.entrypoints&&t.entryPoints)if(Array.isArray(t.entryPoints))n.entrypoints=t.entryPoints;else n.entrypoints=Object.values(t.entryPoints);if(!n.outdir){if(t.outdir)n.outdir=t.outdir;else if(t.outfile){let o=t.outfile.lastIndexOf("/");if(o!==-1)n.outdir=t.outfile.substring(0,o)}}if(d)r.onStart(async()=>{await e()});if(l)r.onEnd(async(o)=>{if(o.errors.length===0)await e()})}}}var Aa=me,sr=me,Pa=me;
3
3
  export{me,Aa,sr,Pa};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{r}from"./chunk-xmj05115.js";import{l}from"./chunk-yyqay3jp.js";import{existsSync as P,readFileSync as b,unwatchFile as w}from"fs";var Nr;((o)=>{o[o.Error=1]="Error";o[o.Warning=2]="Warning";o[o.Information=3]="Information";o[o.Hint=4]="Hint"})(Nr||={});var Br;((s)=>{s[s.File=1]="File";s[s.Module=2]="Module";s[s.Namespace=3]="Namespace";s[s.Package=4]="Package";s[s.Class=5]="Class";s[s.Method=6]="Method";s[s.Property=7]="Property";s[s.Field=8]="Field";s[s.Constructor=9]="Constructor";s[s.Enum=10]="Enum";s[s.Interface=11]="Interface";s[s.Function=12]="Function";s[s.Variable=13]="Variable";s[s.Constant=14]="Constant";s[s.String=15]="String";s[s.Number=16]="Number";s[s.Boolean=17]="Boolean";s[s.Array=18]="Array";s[s.Object=19]="Object";s[s.Key=20]="Key";s[s.Null=21]="Null";s[s.EnumMember=22]="EnumMember";s[s.Struct=23]="Struct";s[s.Event=24]="Event";s[s.Operator=25]="Operator";s[s.TypeParameter=26]="TypeParameter"})(Br||={});var Wr;((c)=>{c[c.Text=1]="Text";c[c.Method=2]="Method";c[c.Function=3]="Function";c[c.Constructor=4]="Constructor";c[c.Field=5]="Field";c[c.Variable=6]="Variable";c[c.Class=7]="Class";c[c.Interface=8]="Interface";c[c.Module=9]="Module";c[c.Property=10]="Property";c[c.Unit=11]="Unit";c[c.Value=12]="Value";c[c.Enum=13]="Enum";c[c.Keyword=14]="Keyword";c[c.Snippet=15]="Snippet";c[c.Color=16]="Color";c[c.File=17]="File";c[c.Reference=18]="Reference";c[c.Folder=19]="Folder";c[c.EnumMember=20]="EnumMember";c[c.Constant=21]="Constant";c[c.Struct=22]="Struct";c[c.Event=23]="Event";c[c.Operator=24]="Operator";c[c.TypeParameter=25]="TypeParameter"})(Wr||={});var _r;((n)=>{n[n.Text=1]="Text";n[n.Read=2]="Read";n[n.Write=3]="Write"})(_r||={});class nn{documents=new Map;rootUri=null;config={};messageId=0;watchers=new Map;initialize(t){return this.rootUri=t.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(t){let{uri:e,text:i,version:n}=t.textDocument;this.updateDocument(e,i,n)}didChange(t){let{uri:e,version:i}=t.textDocument,n=t.contentChanges[0]?.text||"";this.updateDocument(e,n,i)}didClose(t){let e=t.textDocument.uri;if(this.documents.delete(e),this.watchers.get(e))w(this.uriToPath(e)),this.watchers.delete(e)}updateDocument(t,e,i){let n=this.uriToPath(t),o=r(e,n,!0);this.documents.set(t,{content:e,version:i,declarations:o})}getDiagnostics(t){let e=this.documents.get(t);if(!e)return[];let i=[];for(let n of e.declarations){if(n.isExported&&n.kind==="variable"&&!n.typeAnnotation)i.push({range:this.getDeclarationRange(n,e.content),severity:2,code:"missing-type",source:"dtsx",message:`Exported variable '${n.name}' should have an explicit type annotation for better declaration generation`});if(n.typeAnnotation==="any"||n.returnType==="any")i.push({range:this.getDeclarationRange(n,e.content),severity:3,code:"any-type",source:"dtsx",message:"Consider using a more specific type instead of 'any'"});if(n.kind==="function"&&n.isExported&&!n.returnType)i.push({range:this.getDeclarationRange(n,e.content),severity:3,code:"missing-return-type",source:"dtsx",message:`Function '${n.name}' should have an explicit return type for better declaration generation`})}return i}hover(t){let e=this.documents.get(t.textDocument.uri);if(!e)return null;let{line:i,character:n}=t.position,a=e.content.split(`
2
+ import{r}from"./chunk-q4fhsthj.js";import{l}from"./chunk-vjtcxr3q.js";import{existsSync as P,readFileSync as b,unwatchFile as w}from"fs";var Nr;((o)=>{o[o.Error=1]="Error";o[o.Warning=2]="Warning";o[o.Information=3]="Information";o[o.Hint=4]="Hint"})(Nr||={});var Br;((s)=>{s[s.File=1]="File";s[s.Module=2]="Module";s[s.Namespace=3]="Namespace";s[s.Package=4]="Package";s[s.Class=5]="Class";s[s.Method=6]="Method";s[s.Property=7]="Property";s[s.Field=8]="Field";s[s.Constructor=9]="Constructor";s[s.Enum=10]="Enum";s[s.Interface=11]="Interface";s[s.Function=12]="Function";s[s.Variable=13]="Variable";s[s.Constant=14]="Constant";s[s.String=15]="String";s[s.Number=16]="Number";s[s.Boolean=17]="Boolean";s[s.Array=18]="Array";s[s.Object=19]="Object";s[s.Key=20]="Key";s[s.Null=21]="Null";s[s.EnumMember=22]="EnumMember";s[s.Struct=23]="Struct";s[s.Event=24]="Event";s[s.Operator=25]="Operator";s[s.TypeParameter=26]="TypeParameter"})(Br||={});var Wr;((c)=>{c[c.Text=1]="Text";c[c.Method=2]="Method";c[c.Function=3]="Function";c[c.Constructor=4]="Constructor";c[c.Field=5]="Field";c[c.Variable=6]="Variable";c[c.Class=7]="Class";c[c.Interface=8]="Interface";c[c.Module=9]="Module";c[c.Property=10]="Property";c[c.Unit=11]="Unit";c[c.Value=12]="Value";c[c.Enum=13]="Enum";c[c.Keyword=14]="Keyword";c[c.Snippet=15]="Snippet";c[c.Color=16]="Color";c[c.File=17]="File";c[c.Reference=18]="Reference";c[c.Folder=19]="Folder";c[c.EnumMember=20]="EnumMember";c[c.Constant=21]="Constant";c[c.Struct=22]="Struct";c[c.Event=23]="Event";c[c.Operator=24]="Operator";c[c.TypeParameter=25]="TypeParameter"})(Wr||={});var _r;((n)=>{n[n.Text=1]="Text";n[n.Read=2]="Read";n[n.Write=3]="Write"})(_r||={});class nn{documents=new Map;rootUri=null;config={};messageId=0;watchers=new Map;initialize(t){return this.rootUri=t.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(t){let{uri:e,text:i,version:n}=t.textDocument;this.updateDocument(e,i,n)}didChange(t){let{uri:e,version:i}=t.textDocument,n=t.contentChanges[0]?.text||"";this.updateDocument(e,n,i)}didClose(t){let e=t.textDocument.uri;if(this.documents.delete(e),this.watchers.get(e))w(this.uriToPath(e)),this.watchers.delete(e)}updateDocument(t,e,i){let n=this.uriToPath(t),o=r(e,n,!0);this.documents.set(t,{content:e,version:i,declarations:o})}getDiagnostics(t){let e=this.documents.get(t);if(!e)return[];let i=[];for(let n of e.declarations){if(n.isExported&&n.kind==="variable"&&!n.typeAnnotation)i.push({range:this.getDeclarationRange(n,e.content),severity:2,code:"missing-type",source:"dtsx",message:`Exported variable '${n.name}' should have an explicit type annotation for better declaration generation`});if(n.typeAnnotation==="any"||n.returnType==="any")i.push({range:this.getDeclarationRange(n,e.content),severity:3,code:"any-type",source:"dtsx",message:"Consider using a more specific type instead of 'any'"});if(n.kind==="function"&&n.isExported&&!n.returnType)i.push({range:this.getDeclarationRange(n,e.content),severity:3,code:"missing-return-type",source:"dtsx",message:`Function '${n.name}' should have an explicit return type for better declaration generation`})}return i}hover(t){let e=this.documents.get(t.textDocument.uri);if(!e)return null;let{line:i,character:n}=t.position,a=e.content.split(`
3
3
  `)[i]||"",u=a.slice(0,n).match(/[\w$]+$/),d=a.slice(n).match(/^[\w$]+/);if(!u&&!d)return null;let g=(u?.[0]||"")+(d?.[0]||""),f=e.declarations.find((x)=>x.name===g);if(!f)return null;let m=`\`\`\`typescript
4
4
  ${this.buildSignature(f)}
5
5
  \`\`\``;if(f.leadingComments&&f.leadingComments.length>0){let v=f.leadingComments.join(`
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-wma315wm.js";class _e{options;generateOptions;constructor(t={}){let{onCompile:r=!1,afterEmit:e=!0,onWatchRun:n=!1,onGenerated:o,onError:i,...a}=t;this.options={onCompile:r,afterEmit:e,onWatchRun:n,onGenerated:o,onError:i},this.generateOptions=a}apply(t){if(!this.generateOptions.outdir&&t.options.output?.path)this.generateOptions.outdir=t.options.output.path;if(!this.generateOptions.cwd&&t.options.context)this.generateOptions.cwd=t.options.context;if(!this.generateOptions.entrypoints&&t.options.entry){let e=t.options.entry;if(typeof e==="string")this.generateOptions.entrypoints=[e];else if(Array.isArray(e))this.generateOptions.entrypoints=e;else if(typeof e==="object"&&e!==null){let n=[];for(let o of Object.values(e))if(typeof o==="string")n.push(o);else if(Array.isArray(o))n.push(...o.filter((i)=>typeof i==="string"));else if(typeof o==="object"&&o!==null&&"import"in o){let i=o.import;if(typeof i==="string")n.push(i);else if(Array.isArray(i))n.push(...i)}if(n.length>0)this.generateOptions.entrypoints=n}}if(this.options.onCompile)t.hooks.compile.tap("DtsxWebpackPlugin",()=>{this.runGenerate()});if(this.options.afterEmit)t.hooks.afterEmit.tapAsync("DtsxWebpackPlugin",async(e,n)=>{await this.runGenerate(),n()});if(this.options.onWatchRun)t.hooks.watchRun.tapAsync("DtsxWebpackPlugin",async(e,n)=>{await this.runGenerate(),n()})}async runGenerate(){try{let t=await s(this.generateOptions);this.options.onGenerated?.(t)}catch(t){let r=t instanceof Error?t:Error(String(t));if(this.options.onError?.(r),!this.options.onError)console.error("[dtsx] Generation failed:",r.message)}}}function _t(t={}){return new _e(t)}var ir=_t,Ta=_e;
2
+ import{s}from"./chunk-msr5zymd.js";class _e{options;generateOptions;constructor(t={}){let{onCompile:r=!1,afterEmit:e=!0,onWatchRun:n=!1,onGenerated:o,onError:i,...a}=t;this.options={onCompile:r,afterEmit:e,onWatchRun:n,onGenerated:o,onError:i},this.generateOptions=a}apply(t){if(!this.generateOptions.outdir&&t.options.output?.path)this.generateOptions.outdir=t.options.output.path;if(!this.generateOptions.cwd&&t.options.context)this.generateOptions.cwd=t.options.context;if(!this.generateOptions.entrypoints&&t.options.entry){let e=t.options.entry;if(typeof e==="string")this.generateOptions.entrypoints=[e];else if(Array.isArray(e))this.generateOptions.entrypoints=e;else if(typeof e==="object"&&e!==null){let n=[];for(let o of Object.values(e))if(typeof o==="string")n.push(o);else if(Array.isArray(o))n.push(...o.filter((i)=>typeof i==="string"));else if(typeof o==="object"&&o!==null&&"import"in o){let i=o.import;if(typeof i==="string")n.push(i);else if(Array.isArray(i))n.push(...i)}if(n.length>0)this.generateOptions.entrypoints=n}}if(this.options.onCompile)t.hooks.compile.tap("DtsxWebpackPlugin",()=>{this.runGenerate()});if(this.options.afterEmit)t.hooks.afterEmit.tapAsync("DtsxWebpackPlugin",async(e,n)=>{await this.runGenerate(),n()});if(this.options.onWatchRun)t.hooks.watchRun.tapAsync("DtsxWebpackPlugin",async(e,n)=>{await this.runGenerate(),n()})}async runGenerate(){try{let t=await s(this.generateOptions);this.options.onGenerated?.(t)}catch(t){let r=t instanceof Error?t:Error(String(t));if(this.options.onError?.(r),!this.options.onError)console.error("[dtsx] Generation failed:",r.message)}}}function _t(t={}){return new _e(t)}var ir=_t,Ta=_e;
3
3
  export{_e,_t,ir,Ta};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-wma315wm.js";import{mkdtemp as y,readFile as v,realpath as l,rm as x}from"fs/promises";import{tmpdir as b}from"os";import{join as p,resolve as i}from"path";function at(r={}){if(Reflect.get(r,"declarationMap"))throw Error("dtsx: bundled declaration maps are not supported");let u=new Map,c=(t,n)=>`${i(t)}\x00${n}`;return{name:"dtsx",tsdownConfig:()=>({dts:!1}),tsdownConfigResolved(t){u.set(c(i(t.cwd??process.cwd(),t.outDir??"dist"),t.format),t)},async generateBundle(t,n){let d=u.get(c(t.dir??"dist",t.format??"es"));if(!d)throw Error("dtsx: expected a resolved tsdown build before generating declarations");let f=await l(i(r.cwd??d.cwd??process.cwd())),m=await l(i(f,r.root??d.root)),a=await y(p(b(),"dtsx-tsdown-"));try{for(let e of Object.values(n)){if(e.type!=="chunk"||!e.isEntry||!e.facadeModuleId)continue;let w=await l(e.facadeModuleId),g=e.fileName.endsWith(".cjs")?".d.cts":e.fileName.endsWith(".mjs")?".d.mts":".d.ts",o=e.fileName.replace(/\.(?:c|m)?js$/,g);if(o===e.fileName)throw Error(`dtsx: unsupported tsdown JavaScript output ${e.fileName}`);if((await s({...r,cwd:f,root:m,entrypoints:[w],outdir:a,bundle:!0,bundleOutput:o,clean:!1,dryRun:!1,outputStructure:"mirror",declarationMap:!1,moduleSpecifierMode:r.moduleSpecifierMode??"node"})).filesFailed)throw Error(`dtsx: declaration generation failed for ${e.facadeModuleId}`);this.emitFile({type:"asset",fileName:o,source:await v(p(a,o),"utf8")})}}finally{await x(a,{recursive:!0,force:!0})}}}}var $a=at;
2
+ import{s}from"./chunk-msr5zymd.js";import{mkdtemp as y,readFile as v,realpath as l,rm as x}from"fs/promises";import{tmpdir as b}from"os";import{join as p,resolve as i}from"path";function at(r={}){if(Reflect.get(r,"declarationMap"))throw Error("dtsx: bundled declaration maps are not supported");let u=new Map,c=(t,n)=>`${i(t)}\x00${n}`;return{name:"dtsx",tsdownConfig:()=>({dts:!1}),tsdownConfigResolved(t){u.set(c(i(t.cwd??process.cwd(),t.outDir??"dist"),t.format),t)},async generateBundle(t,n){let d=u.get(c(t.dir??"dist",t.format??"es"));if(!d)throw Error("dtsx: expected a resolved tsdown build before generating declarations");let f=await l(i(r.cwd??d.cwd??process.cwd())),m=await l(i(f,r.root??d.root)),a=await y(p(b(),"dtsx-tsdown-"));try{for(let e of Object.values(n)){if(e.type!=="chunk"||!e.isEntry||!e.facadeModuleId)continue;let w=await l(e.facadeModuleId),g=e.fileName.endsWith(".cjs")?".d.cts":e.fileName.endsWith(".mjs")?".d.mts":".d.ts",o=e.fileName.replace(/\.(?:c|m)?js$/,g);if(o===e.fileName)throw Error(`dtsx: unsupported tsdown JavaScript output ${e.fileName}`);if((await s({...r,cwd:f,root:m,entrypoints:[w],outdir:a,bundle:!0,bundleOutput:o,clean:!1,dryRun:!1,outputStructure:"mirror",declarationMap:!1,moduleSpecifierMode:r.moduleSpecifierMode??"node"})).filesFailed)throw Error(`dtsx: declaration generation failed for ${e.facadeModuleId}`);this.emitFile({type:"asset",fileName:o,source:await v(p(a,o),"utf8")})}}finally{await x(a,{recursive:!0,force:!0})}}}}var $a=at;
3
3
  export{at,$a};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{c,i,Ne,de}from"./chunk-8kj9pkw5.js";import{t,d,Fe,m}from"./chunk-g0dxj89b.js";import{Le}from"./chunk-ywv56grs.js";import{tr}from"./chunk-73qsp464.js";import{Yn}from"./chunk-fv3x086v.js";import{_,qn}from"./chunk-zf96k060.js";import{Bn}from"./chunk-7g0hjhqy.js";import{Oe,fe,Ie}from"./chunk-8wk7nw3c.js";import{z,it,n,I,L,Jn,Wt,Re,j}from"./chunk-8g4wk8mm.js";import{Nn}from"./chunk-w8ws29dq.js";import{h}from"./chunk-qnwcsmsg.js";import{jn}from"./chunk-df8p90w4.js";function Ei(S,Z,H,G,te=""){let ne=new Map,f={start:0,end:S.length,header:0,name:"",children:[],results:new Map},K=t(S),me=[],g=[],ce=[],P=new Map;for(let e=0;e<K.length;e++){let le=K[e];if(le.kind!=="punctuation")continue;let he=S.slice(le.start,le.end);if(he==="(")ce.push(e);else if(he===")"){let ue=ce.pop();if(ue!==void 0)P.set(e,ue)}else if(he==="{")g.push(e);else if(he==="}"){let ue=g.pop();if(ue===void 0)continue;let se=K[ue].start,Y=ue-1,ee=Y>=0?S.slice(K[Y].start,K[Y].end):"";if(ee===")"){let V=P.get(Y);if(V!==void 0&&V>0&&["if","for","while","switch","catch","with"].includes(S.slice(K[V-1].start,K[V-1].end)))se=K[V-1].start}else if(["else","try","finally","do"].includes(ee))se=K[Y].start;me.push({open:K[ue].start,close:le.start,header:se})}}let ae=0,Q=(e,le=new Set)=>{let he=new Set(le),ue=t(S.slice(e.start,e.end)),se=0;for(let re=0;re+1<ue.length;re++){let qe=S.slice(e.start+ue[re].start,e.start+ue[re].end);if(qe==="{")se++;else if(qe==="}")se--;else if(!se&&["type","interface"].includes(qe))he.add(S.slice(e.start+ue[re+1].start,e.start+ue[re+1].end))}let Y="",ee=e.start,V=[...e.results].map(([re,qe])=>({type:re,name:qe}));for(let re of e.children.sort((qe,Ge)=>qe.header-Ge.header)){let qe=Q(re,he);Y+=S.slice(ee,re.header)+`
2
+ import{c,i,Ne,de}from"./chunk-8kj9pkw5.js";import{t,d,Fe,m}from"./chunk-g0dxj89b.js";import{Le}from"./chunk-ywv56grs.js";import{tr}from"./chunk-73qsp464.js";import{Yn}from"./chunk-fv3x086v.js";import{_,qn}from"./chunk-zf96k060.js";import{Bn}from"./chunk-7g0hjhqy.js";import{Oe,fe,Ie}from"./chunk-8wk7nw3c.js";import{z,it,n,I,L,Jn,Wt,Re,j}from"./chunk-3qx4ys4v.js";import{Nn}from"./chunk-x4qkjqda.js";import{h}from"./chunk-q76b61w9.js";import{jn}from"./chunk-t8cgznk6.js";function Ei(S,Z,H,G,te=""){let ne=new Map,f={start:0,end:S.length,header:0,name:"",children:[],results:new Map},K=t(S),me=[],g=[],ce=[],P=new Map;for(let e=0;e<K.length;e++){let le=K[e];if(le.kind!=="punctuation")continue;let he=S.slice(le.start,le.end);if(he==="(")ce.push(e);else if(he===")"){let ue=ce.pop();if(ue!==void 0)P.set(e,ue)}else if(he==="{")g.push(e);else if(he==="}"){let ue=g.pop();if(ue===void 0)continue;let se=K[ue].start,Y=ue-1,ee=Y>=0?S.slice(K[Y].start,K[Y].end):"";if(ee===")"){let V=P.get(Y);if(V!==void 0&&V>0&&["if","for","while","switch","catch","with"].includes(S.slice(K[V-1].start,K[V-1].end)))se=K[V-1].start}else if(["else","try","finally","do"].includes(ee))se=K[Y].start;me.push({open:K[ue].start,close:le.start,header:se})}}let ae=0,Q=(e,le=new Set)=>{let he=new Set(le),ue=t(S.slice(e.start,e.end)),se=0;for(let re=0;re+1<ue.length;re++){let qe=S.slice(e.start+ue[re].start,e.start+ue[re].end);if(qe==="{")se++;else if(qe==="}")se--;else if(!se&&["type","interface"].includes(qe))he.add(S.slice(e.start+ue[re+1].start,e.start+ue[re+1].end))}let Y="",ee=e.start,V=[...e.results].map(([re,qe])=>({type:re,name:qe}));for(let re of e.children.sort((qe,Ge)=>qe.header-Ge.header)){let qe=Q(re,he);Y+=S.slice(ee,re.header)+`
3
3
  declare namespace ${re.name} {
4
4
  ${qe.text}
5
5
  }
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-wma315wm.js";import w from"process";import{dirname as x,relative as y,resolve as B,sep as l}from"path";function We(p={}){let{preBuild:c=!1,postBuild:r=!0,onGenerated:n,onError:o,failOnError:E=!0,...e}=p,v=async(i)=>{try{let t=await s(i);n?.(t)}catch(t){let d=t instanceof Error?t:Error(String(t));if(o?.(d),!o)console.error("[dtsx] Generation failed:",d.message);if(E)throw d}};return{name:"dtsx",async setup(i){if(!c&&!r)return;let t=e.cwd||w.cwd(),u=(i.config.entrypoints||[]).map((a)=>B(t,a)),g=e.root||i.config.root||(u.length>0?y(t,G(u))||".":"./src"),f=B(t,g),m=e.entrypoints||u.filter((a)=>a===f||a.startsWith(`${f}${l}`)).map((a)=>y(f,a));await v({...e,cwd:t,root:g,entrypoints:m.length>0?m:["index.ts"],outdir:e.outdir||i.config.outdir||"./dist",moduleSpecifierMode:e.moduleSpecifierMode??(i.config.target==="node"?"node":"preserve")})}}}function G(p){let c=p.map((n)=>x(n).split(l)),r=c[0];for(let n of c.slice(1)){let o=0;while(o<r.length&&o<n.length&&r[o]===n[o])o++;r=r.slice(0,o)}return r.join(l)||l}var va=We,Sa=We;
2
+ import{s}from"./chunk-msr5zymd.js";import w from"process";import{dirname as x,relative as y,resolve as B,sep as l}from"path";function We(p={}){let{preBuild:c=!1,postBuild:r=!0,onGenerated:n,onError:o,failOnError:E=!0,...e}=p,v=async(i)=>{try{let t=await s(i);n?.(t)}catch(t){let d=t instanceof Error?t:Error(String(t));if(o?.(d),!o)console.error("[dtsx] Generation failed:",d.message);if(E)throw d}};return{name:"dtsx",async setup(i){if(!c&&!r)return;let t=e.cwd||w.cwd(),u=(i.config.entrypoints||[]).map((a)=>B(t,a)),g=e.root||i.config.root||(u.length>0?y(t,G(u))||".":"./src"),f=B(t,g),m=e.entrypoints||u.filter((a)=>a===f||a.startsWith(`${f}${l}`)).map((a)=>y(f,a));await v({...e,cwd:t,root:g,entrypoints:m.length>0?m:["index.ts"],outdir:e.outdir||i.config.outdir||"./dist",moduleSpecifierMode:e.moduleSpecifierMode??(i.config.target==="node"?"node":"preserve")})}}}function G(p){let c=p.map((n)=>x(n).split(l)),r=c[0];for(let n of c.slice(1)){let o=0;while(o<r.length&&o<n.length&&r[o]===n[o])o++;r=r.slice(0,o)}return r.join(l)||l}var va=We,Sa=We;
3
3
  export{We,va,Sa};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{r}from"./chunk-xmj05115.js";import{existsSync as j,mkdirSync as N,readFileSync as z,writeFileSync as G}from"fs";import{dirname as K,relative as L,resolve as _}from"path";async function ls(t,e,n){let u=new Map,f=[],x=new Set,D=0,w=0,S=0,C=[];for(let i of t){let o=e.get(i);if(!o)continue;C.push({file:i,decls:r(o,i,n.keepComments)})}for(let{file:i,decls:o}of C){D+=o.length;for(let s of o)if(s.kind==="import"){w++;let c=s.source||"";if(c.startsWith("."))continue;if(!u.has(c))u.set(c,{source:c,specifiers:new Map,isTypeOnly:s.isTypeOnly||!1,isSideEffect:s.isSideEffect||!1});let l=u.get(c);if(s.specifiers)for(let h of s.specifiers){let W=h.alias||h.name;if(!l.specifiers.has(W))l.specifiers.set(W,{name:h.name,alias:h.alias,isType:h.isType||!1})}if(!s.isTypeOnly)l.isTypeOnly=!1}else if(s.isExported||s.kind==="export"){if(S++,s.kind==="export"&&s.source&&(s.source.startsWith(".")||s.source.startsWith("/")))continue;if(s.name&&x.has(s.name))continue;if(s.name)x.add(s.name);f.push({declaration:s,file:i})}}let a=[];a.push("/**"),a.push(" * Bundled TypeScript declarations"),a.push(` * Generated from ${t.length} source files`),a.push(" */"),a.push("");let T=n.importOrder||["bun"],y=Array.from(u.values()),p=Array(y.length);for(let i=0;i<y.length;i++){let o=y[i].source,s=T.length;for(let c=0;c<T.length;c++)if(o.startsWith(T[c])){s=c;break}p[i]=s}let g=y.map((i,o)=>o);g.sort((i,o)=>{let s=p[i],c=p[o];if(s!==c)return s-c;return y[i].source.localeCompare(y[o].source)});let b=g.map((i)=>y[i]);for(let i of b)if(i.isSideEffect)a.push(`import '${i.source}';`);else if(i.specifiers.size>0){let s=Array.from(i.specifiers.values()).map((l)=>{let h=l.isType?"type ":"";return l.alias?`${h}${l.name} as ${l.alias}`:`${h}${l.name}`}),c=i.isTypeOnly?"type ":"";a.push(`import ${c}{ ${s.join(", ")} } from '${i.source}';`)}if(b.length>0)a.push("");let m=new Map;for(let{declaration:i,file:o}of f){if(!m.has(o))m.set(o,[]);m.get(o).push(i)}for(let[i,o]of m){let s=L(n.cwd,i);a.push(`// From: ${s}`);for(let c of o){if(n.keepComments&&c.leadingComments)for(let l of c.leadingComments)a.push(l);a.push(F(c))}a.push("")}let d=a.join(`
2
+ import{r}from"./chunk-q4fhsthj.js";import{existsSync as j,mkdirSync as N,readFileSync as z,writeFileSync as G}from"fs";import{dirname as K,relative as L,resolve as _}from"path";async function ls(t,e,n){let u=new Map,f=[],x=new Set,D=0,w=0,S=0,C=[];for(let i of t){let o=e.get(i);if(!o)continue;C.push({file:i,decls:r(o,i,n.keepComments)})}for(let{file:i,decls:o}of C){D+=o.length;for(let s of o)if(s.kind==="import"){w++;let c=s.source||"";if(c.startsWith("."))continue;if(!u.has(c))u.set(c,{source:c,specifiers:new Map,isTypeOnly:s.isTypeOnly||!1,isSideEffect:s.isSideEffect||!1});let l=u.get(c);if(s.specifiers)for(let h of s.specifiers){let W=h.alias||h.name;if(!l.specifiers.has(W))l.specifiers.set(W,{name:h.name,alias:h.alias,isType:h.isType||!1})}if(!s.isTypeOnly)l.isTypeOnly=!1}else if(s.isExported||s.kind==="export"){if(S++,s.kind==="export"&&s.source&&(s.source.startsWith(".")||s.source.startsWith("/")))continue;if(s.name&&x.has(s.name))continue;if(s.name)x.add(s.name);f.push({declaration:s,file:i})}}let a=[];a.push("/**"),a.push(" * Bundled TypeScript declarations"),a.push(` * Generated from ${t.length} source files`),a.push(" */"),a.push("");let T=n.importOrder||["bun"],y=Array.from(u.values()),p=Array(y.length);for(let i=0;i<y.length;i++){let o=y[i].source,s=T.length;for(let c=0;c<T.length;c++)if(o.startsWith(T[c])){s=c;break}p[i]=s}let g=y.map((i,o)=>o);g.sort((i,o)=>{let s=p[i],c=p[o];if(s!==c)return s-c;return y[i].source.localeCompare(y[o].source)});let b=g.map((i)=>y[i]);for(let i of b)if(i.isSideEffect)a.push(`import '${i.source}';`);else if(i.specifiers.size>0){let s=Array.from(i.specifiers.values()).map((l)=>{let h=l.isType?"type ":"";return l.alias?`${h}${l.name} as ${l.alias}`:`${h}${l.name}`}),c=i.isTypeOnly?"type ":"";a.push(`import ${c}{ ${s.join(", ")} } from '${i.source}';`)}if(b.length>0)a.push("");let m=new Map;for(let{declaration:i,file:o}of f){if(!m.has(o))m.set(o,[]);m.get(o).push(i)}for(let[i,o]of m){let s=L(n.cwd,i);a.push(`// From: ${s}`);for(let c of o){if(n.keepComments&&c.leadingComments)for(let l of c.leadingComments)a.push(l);a.push(F(c))}a.push("")}let d=a.join(`
3
3
  `);return{content:d,files:t,declarationCount:D,importCount:w,exportCount:S,size:Buffer.byteLength(d,"utf8"),warnings:[]}}function F(t){if(t.text){let n=t.text.trim();if(t.isExported&&!n.startsWith("export"))n=`export ${n}`;if(!n.endsWith(";")&&!n.endsWith("}"))n+=";";return n}let e=[];if(t.isExported)e.push("export");if(t.isDefault)e.push("default");switch(t.kind){case"function":if(e.push("declare function"),e.push(t.name),t.generics)e.push(t.generics);if(e.push(`(${V(t.parameters)})`),t.returnType)e.push(`: ${t.returnType}`);break;case"variable":if(e.push("declare const"),e.push(t.name),t.typeAnnotation)e.push(`: ${t.typeAnnotation}`);break;case"interface":if(e.push("interface"),e.push(t.name),t.generics)e.push(t.generics);if(t.extends)e.push(`extends ${t.extends}`);if(e.push("{"),t.members)for(let n of t.members)e.push(` ${n.name}${n.typeAnnotation?`: ${n.typeAnnotation}`:""};`);e.push("}");break;case"type":if(e.push("type"),e.push(t.name),t.generics)e.push(t.generics);e.push("="),e.push(t.typeAnnotation||"unknown");break;case"class":if(e.push("declare class"),e.push(t.name),t.generics)e.push(t.generics);if(t.extends)e.push(`extends ${t.extends}`);if(t.implements&&t.implements.length>0)e.push(`implements ${t.implements.join(", ")}`);if(e.push("{"),t.members)for(let n of t.members)e.push(` ${F(n)}`);e.push("}");break;case"enum":if(e.push("declare enum"),e.push(t.name),e.push("{"),t.members){let n=t.members.map((u)=>u.value!==void 0?`${u.name} = ${u.value}`:u.name);e.push(` ${n.join(`,
4
4
  `)}`)}e.push("}");break;default:return t.text||""}return e.join(" ")}function V(t){if(!t||t.length===0)return"";return t.map((e)=>{let n="";if(e.rest)n+="...";if(n+=e.name,e.optional)n+="?";if(e.type)n+=`: ${e.type}`;if(e.defaultValue)n+=` = ${e.defaultValue}`;return n}).join(", ")}async function Kt(t,e={}){let n=[],u=new Map,f=[],x=[],D=new Set,w=0,S=0,C=0;for(let p of t){if(!j(p)){n.push(`File not found: ${p}`);continue}let g=z(p,"utf-8");x.push(p);let b=g.split(`
5
5
  `),m=[],d=0,i=!1;for(let o of b){let s=o.trim();if(!s&&!i)continue;if(s.startsWith("import ")){S++;let l=s.match(/import\s+(type\s+)?(?:\{([^}]+)\}|(\w+)|\*\s+as\s+(\w+))\s+from\s+['"]([^'"]+)['"]/);if(l){let[,h,W,q,H,A]=l;if(e.externals?.some((P)=>A.startsWith(P))){f.push(s);continue}if(A.startsWith("."))continue;if(!u.has(A))u.set(A,{source:A,specifiers:new Map,isTypeOnly:!!h,isSideEffect:!1});let E=u.get(A);if(W){let P=W.split(",").map((k)=>k.trim());for(let k of P){let[I,v]=k.split(/\s+as\s+/).map((M)=>M.trim()),R=I.startsWith("type "),O=R?I.replace("type ",""):I;E.specifiers.set(v||O,{name:O,alias:v!==O?v:void 0,isType:R})}}if(!h)E.isTypeOnly=!1}continue}if(/^(export\s+)?(declare\s+)?(interface|type|class|function|const|let|var|enum|namespace|module)\s/.test(s)){if(i=!0,m=[o],d=(o.match(/\{/g)||[]).length-(o.match(/\}/g)||[]).length,d===0&&(s.endsWith(";")||!s.includes("{"))){let l=B(s);if(!D.has(l)||!e.mergeDuplicates){if(D.add(l),f.push(o),w++,s.startsWith("export"))C++}i=!1,m=[]}}else if(i){if(m.push(o),d+=(o.match(/\{/g)||[]).length-(o.match(/\}/g)||[]).length,d<=0){let l=m.join(`
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Le}from"./chunk-ywv56grs.js";import{T}from"./chunk-epjq1edf.js";import{b}from"./chunk-a2dn9j88.js";function kn(i,r){let n=new Set;for(let e of T(i,"imports.ts",!1)){if(e.kind!=="import")continue;let t=b(e.text),a=t&&r.get(t.source);if(!t||t.isTypeOnly||!a)continue;let s=Je(a);for(let o of t.namedItems)if(!o.isTypeOnly&&s.some((m)=>m.name===o.originalName))n.add(o.name);if(t.defaultName&&s.some((o)=>o.isDefault))n.add(t.defaultName)}return n}function Je(i){let r=T(i,"dependency.ts",!1).filter((n)=>n.kind==="function");return r.filter((n)=>n.isExported&&!n.generics&&r.filter((e)=>e.name===n.name).length===1&&Le(i,n.name)===1).map((n)=>({name:n.name,isDefault:Boolean(n.isDefault)})).sort((n,e)=>n.name.localeCompare(e.name))}
2
+ import{Le}from"./chunk-ywv56grs.js";import{T}from"./chunk-gc7y4wav.js";import{b}from"./chunk-a2dn9j88.js";function kn(i,r){let n=new Set;for(let e of T(i,"imports.ts",!1)){if(e.kind!=="import")continue;let t=b(e.text),a=t&&r.get(t.source);if(!t||t.isTypeOnly||!a)continue;let s=Je(a);for(let o of t.namedItems)if(!o.isTypeOnly&&s.some((m)=>m.name===o.originalName))n.add(o.name);if(t.defaultName&&s.some((o)=>o.isDefault))n.add(t.defaultName)}return n}function Je(i){let r=T(i,"dependency.ts",!1).filter((n)=>n.kind==="function");return r.filter((n)=>n.isExported&&!n.generics&&r.filter((e)=>e.name===n.name).length===1&&Le(i,n.name)===1).map((n)=>({name:n.name,isDefault:Boolean(n.isDefault)})).sort((n,e)=>n.name.localeCompare(e.name))}
3
3
  export{kn,Je};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{B}from"./chunk-60wrxcjt.js";import{k}from"./chunk-7khy25x0.js";import{Ce,ve}from"./chunk-q4ph9qa2.js";import{createHash as x}from"crypto";import{readFile as d}from"fs/promises";import{resolve as m}from"path";async function An(g){let e={...B,...g},n=e.moduleSpecifierMode??"preserve";if(n!=="node"&&n!=="preserve")throw Error("moduleSpecifierMode must be preserve or node");if(e.plugins?.length)throw Error("Native project planning does not support generation plugins");let o=await Ce(e),l=[];for(let r of o.files){let s=await d(r),a=s.toString("utf8");if(!Buffer.from(a,"utf8").equals(s))throw Error(`Native declaration source must be valid UTF-8: ${r}`);let u=o.outputBySource.get(r),v=ve(r,e,o.resolver),i=[],S=new Set(k(a,{includeImports:!0}).map((t)=>t.specifier));for(let t of S){let p=v(t);if(p.kind!=="local")continue;let{resolvedSource:h,declarationOutput:w,emittedSpecifier:y}=p;i.push({specifier:t,resolvedSource:h,declarationOutput:w,emittedSpecifier:y})}let c={version:1,moduleSpecifierMode:n,sourceFile:r,outputFile:u,sourceHash:x("sha256").update(s).digest("hex"),rewrites:i};if(!e.isolatedDeclarations&&i.length)c.inferenceSources=await Promise.all(i.map(async(t)=>({specifier:t.specifier,source:await d(t.resolvedSource,"utf8")})));let f=o.augmentationImports.get(r);if(f?.size)c.augmentationImports=[...f];l.push(Object.freeze({sourceFile:r,outputFile:u,source:a,context:c}))}return Object.freeze({version:1,rootPath:m(e.cwd,e.root),outdirPath:m(e.cwd,e.outdir),files:Object.freeze(l)})}
2
+ import{B}from"./chunk-60wrxcjt.js";import{k}from"./chunk-7khy25x0.js";import{Ce,ve}from"./chunk-pd30356m.js";import{createHash as x}from"crypto";import{readFile as d}from"fs/promises";import{resolve as m}from"path";async function An(g){let e={...B,...g},n=e.moduleSpecifierMode??"preserve";if(n!=="node"&&n!=="preserve")throw Error("moduleSpecifierMode must be preserve or node");if(e.plugins?.length)throw Error("Native project planning does not support generation plugins");let o=await Ce(e),l=[];for(let r of o.files){let s=await d(r),a=s.toString("utf8");if(!Buffer.from(a,"utf8").equals(s))throw Error(`Native declaration source must be valid UTF-8: ${r}`);let u=o.outputBySource.get(r),v=ve(r,e,o.resolver),i=[],S=new Set(k(a,{includeImports:!0}).map((t)=>t.specifier));for(let t of S){let p=v(t);if(p.kind!=="local")continue;let{resolvedSource:h,declarationOutput:w,emittedSpecifier:y}=p;i.push({specifier:t,resolvedSource:h,declarationOutput:w,emittedSpecifier:y})}let c={version:1,moduleSpecifierMode:n,sourceFile:r,outputFile:u,sourceHash:x("sha256").update(s).digest("hex"),rewrites:i};if(!e.isolatedDeclarations&&i.length)c.inferenceSources=await Promise.all(i.map(async(t)=>({specifier:t.specifier,source:await d(t.resolvedSource,"utf8")})));let f=o.augmentationImports.get(r);if(f?.size)c.augmentationImports=[...f];l.push(Object.freeze({sourceFile:r,outputFile:u,source:a,context:c}))}return Object.freeze({version:1,rootPath:m(e.cwd,e.root),outdirPath:m(e.cwd,e.outdir),files:Object.freeze(l)})}
3
3
  export{An};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-wma315wm.js";function Be(d={}){let{buildStart:l=!0,buildEnd:u=!1,writeBundle:c=!1,modes:t,onGenerated:f,onError:o,...p}=d,i="production",r=async()=>{try{let e=await s(p);f?.(e)}catch(e){let a=e instanceof Error?e:Error(String(e));if(o?.(a),!o)console.error("[dtsx] Generation failed:",a.message)}},n=()=>{if(!t||t.length===0)return!0;return t.includes(i)};return{name:"dtsx",apply(e){return i=e.mode,!0},async buildStart(){if(l&&n())await r()},async buildEnd(){if(u&&n())await r()},async writeBundle(){if(c&&n())await r()}}}var wa=Be,Ca=Be;
2
+ import{s}from"./chunk-msr5zymd.js";function Be(d={}){let{buildStart:l=!0,buildEnd:u=!1,writeBundle:c=!1,modes:t,onGenerated:f,onError:o,...p}=d,i="production",r=async()=>{try{let e=await s(p);f?.(e)}catch(e){let a=e instanceof Error?e:Error(String(e));if(o?.(a),!o)console.error("[dtsx] Generation failed:",a.message)}},n=()=>{if(!t||t.length===0)return!0;return t.includes(i)};return{name:"dtsx",apply(e){return i=e.mode,!0},async buildStart(){if(l&&n())await r()},async buildEnd(){if(u&&n())await r()},async writeBundle(){if(c&&n())await r()}}}var wa=Be,Ca=Be;
3
3
  export{Be,wa,Ca};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{g,te,Et,u}from"./chunk-85d82vn3.js";import{W}from"./chunk-k5wz43yh.js";import{R,M}from"./chunk-2ngfncfx.js";import{P,D}from"./chunk-hqph3vnd.js";import{r}from"./chunk-xmj05115.js";import{Se}from"./chunk-01jwgm2m.js";import{e,A}from"./chunk-btc6zbyj.js";import{Ee,k,Pn,U}from"./chunk-7khy25x0.js";import{vn}from"./chunk-9pharkp0.js";import{He,xt}from"./chunk-1vc3eend.js";import{E}from"./chunk-60wrxcjt.js";import{Ce,Z,V,ve}from"./chunk-q4ph9qa2.js";import{Ke,G,J,wt,Ct,vt,St}from"./chunk-13tjnp25.js";import{q,he}from"./chunk-2ck79rny.js";import{ze,bt}from"./chunk-6vz1grv8.js";import{K}from"./chunk-3r9dptyy.js";import{kn,Je}from"./chunk-pq1n1xqh.js";import{ye}from"./chunk-4q78f5pg.js";import{Ve}from"./chunk-550teag8.js";import{we}from"./chunk-01zsk2q8.js";import{l}from"./chunk-yyqay3jp.js";import{Y,$t}from"./chunk-qzb5pswc.js";import{mkdir as xe}from"fs/promises";import{availableParallelism as Pe}from"os";import{basename as ue,dirname as fe,relative as B,resolve as ie}from"path";var oe=new WeakMap,ce=new WeakMap;function se(d){let a=oe.get(d);if(!a)a=Ee(d),oe.set(d,a),a.catch(()=>oe.delete(d));return a}async function le(d,a,t,f,w,h=G){let o=ue(d)||"output.d.ts",C=B(fe(d),a),I=`${o}.map`,Q=t.lastIndexOf(`
2
+ import{g,te,Et,u}from"./chunk-85d82vn3.js";import{W}from"./chunk-k5wz43yh.js";import{R,M}from"./chunk-2ngfncfx.js";import{P,D}from"./chunk-hqph3vnd.js";import{r}from"./chunk-q4fhsthj.js";import{Se}from"./chunk-54d8mt4c.js";import{e,A}from"./chunk-btc6zbyj.js";import{Ee,k,Pn,U}from"./chunk-7khy25x0.js";import{vn}from"./chunk-zbyvnsny.js";import{He,xt}from"./chunk-1vc3eend.js";import{E}from"./chunk-60wrxcjt.js";import{Ce,Z,V,ve}from"./chunk-pd30356m.js";import{Ke,G,J,wt,Ct,vt,St}from"./chunk-13tjnp25.js";import{q,he}from"./chunk-prst4szw.js";import{ze,bt}from"./chunk-6vz1grv8.js";import{K}from"./chunk-3r9dptyy.js";import{kn,Je}from"./chunk-jf8mxazb.js";import{ye}from"./chunk-4q78f5pg.js";import{Ve}from"./chunk-550teag8.js";import{we}from"./chunk-01zsk2q8.js";import{l}from"./chunk-vjtcxr3q.js";import{Y,$t}from"./chunk-qzb5pswc.js";import{mkdir as xe}from"fs/promises";import{availableParallelism as Pe}from"os";import{basename as ue,dirname as fe,relative as B,resolve as ie}from"path";var oe=new WeakMap,ce=new WeakMap;function se(d){let a=oe.get(d);if(!a)a=Ee(d),oe.set(d,a),a.catch(()=>oe.delete(d));return a}async function le(d,a,t,f,w,h=G){let o=ue(d)||"output.d.ts",C=B(fe(d),a),I=`${o}.map`,Q=t.lastIndexOf(`
3
3
  ${Ke()}`),p=Q===-1?t:t.slice(0,Q),y=vt(p,o,C,f),b=`${d}.map`;return await h(b,JSON.stringify(y)),e.debug(` Generated source map: ${B(w,b)}`),I}async function s(d){let a=Date.now(),t={...E,...d};if(t.logLevel)A(t.logLevel);else if(t.verbose)A("debug");let f=new we;if(t.plugins&&t.plugins.length>0){for(let n of t.plugins)f.register(n),e.debug(`Registered plugin: ${n.name}`);t=await f.runOnStart(t)}if(t.moduleSpecifierMode!==void 0&&t.moduleSpecifierMode!=="preserve"&&t.moduleSpecifierMode!=="node")throw Error("moduleSpecifierMode must be preserve or node");if(await q(t),t.isolatedDeclarations===void 0)t.isolatedDeclarations=await J(t);let w=t.typeMappings?Y(t.typeMappings):void 0,h=null,o={generationMode:t.isolatedDeclarations?"isolated":"semantic",filesProcessed:0,filesGenerated:0,filesFailed:0,filesValidated:0,validationErrors:0,declarationsFound:0,importsProcessed:0,exportsProcessed:0,durationMs:0,errors:[]},C=0;e.debug("Starting DTS generation..."),e.debug(`Using ${o.generationMode} declaration generation path`),e.debug("Config:",t);let I=await Ce(t,()=>se(t)),Q=I.entryFiles,p=[...I.files],{resolver:y,reachability:b}=I;if(ce.set(t,new Set(p)),t.incremental){let n=I.getResolutionFingerprint();if(!t.isolatedDeclarations){let i=new Set(p),m=new Map;for(let S of p){let T=await u(S);m.set(S,Je(T));for(let ee of k(T,{includeImports:!0})){let O=y(ee.specifier,S).resolved;if(O&&!O.split(/[/\\]/).includes("node_modules")&&!i.has(O))i.add(O),m.set(O,Je(await u(O)))}}let c=[...m].sort(([S],[T])=>S.localeCompare(T));n=JSON.stringify([n,c])}if(h=new He(t,n),t.clearCache){if(e.debug("Clearing build cache..."),!t.dryRun)h.clear()}else if(h.load()){let m=h.getStats();e.debug(`Loaded build cache with ${m.entries} entries`)}else e.debug("No existing build cache found, starting fresh");if(!t.dryRun)xt(t.cwd)}if(h&&!t.dryRun){let n=h.prune(new Set(p),t.cwd);if(n>0)e.debug(`Pruned ${n} deleted files from cache`)}if(e.debug(`Found ${p.length} TypeScript files`),t.progress&&p.length>0){let n=t.parallel?"parallel":"sequential";e.info(`Processing ${p.length} files (${n})...`)}let L=new Map,N=new Map,v=async(n,i,m="lf")=>{N.set(n,{content:i,lineEnding:m})},x=async(n,i)=>{let m;try{let c=V(n,t),S=async(F)=>{if(!t.diff)return;try{let j=await u(c),_=Ct(j,F,B(t.cwd,c));if(_)e.info(`
4
4
  ${_}`);else e.debug(`[no changes] ${c}`)}catch{e.info(`[new file] ${B(t.cwd,c)}`)}},T=(F)=>{if(!t.validate)return 0;let j=wt(F,c);if(j.isValid)return e.debug(`[validation] ${c} - OK`),0;e.warn(`[validation] ${B(t.cwd,c)} has ${j.errors.length} error(s):`);for(let _ of j.errors){let ae=` Line ${_.line}:${_.column}`;if(_.code)ae+=` [${_.code}]`;if(ae+=` - ${_.message}`,e.warn(ae),_.suggestion)e.warn(` Suggestion: ${_.suggestion}`)}return j.errors.length},ee=(F)=>{e.info(`[dry-run] Would generate: ${c}`),e.debug("--- Content preview ---"),e.debug(F.slice(0,500)+(F.length>500?`
5
5
  ...`:"")),e.debug("--- End preview ---")};if(h){let F=h.getCachedIfValid(n,t.cwd);if(F){if(t.bundle)L.set(n,F);await S(F);let j=T(F);if(t.dryRun)ee(F);else{if(t.declarationMap)m=i??await u(n),await le(c,n,F,m,t.cwd,v);await v(c,F,t.lineEnding)}return e.debug(`[cached] ${B(t.cwd,c)}`),{success:!0,file:n,declarationCount:0,importCount:0,exportCount:0,cached:!0,validationErrorCount:j}}}m=i??await u(n);let{content:O,declarationCount:ge,importCount:be,exportCount:$e}=await me(n,m,t,f,w,I.augmentationImports.get(n));if(t.bundle)L.set(n,O);let H=O;if(t.prettier||t.indentStyle||t.indentSize){let F=await K(H,{usePrettier:t.prettier,builtIn:{indentSize:t.indentSize||2,useTabs:t.indentStyle==="tabs",normalizeWhitespace:!0,sortImports:!0,trailingNewline:!0}},c);H=F.content;for(let j of F.warnings??[])e.warn(`[format] ${j}`)}if(t.declarationMap){let F=`${ue(c)||"output.d.ts"}.map`;H=St(H,F)}await S(H);let De=T(H);if(t.dryRun)ee(H);else{if(t.declarationMap&&m)await le(c,n,H,m,t.cwd,v);if(await v(c,H,t.lineEnding),h&&m)h.update(n,m,H,t.cwd);e.debug(`Generated: ${c}`)}return{success:!0,file:n,declarationCount:ge,importCount:be,exportCount:$e,validationErrorCount:De}}catch(c){let S=ze(c,n,m);if(t.plugins&&t.plugins.length>0)await f.runOnError(c instanceof Error?c:Error(String(c)),n,m||"");return{success:!1,file:n,declarationCount:0,importCount:0,exportCount:0,dtsError:S,validationErrorCount:0}}},z=t.parallel||t.parallel!==!1&&p.length>=10,X=W(t.concurrency,Pe?.()??8),ne=new Map;if(z&&p.length>1){let n=p.map(async(i)=>{try{let m=await u(i);return{file:i,source:m}}catch{return{file:i,source:null}}});for(let i of await Promise.all(n))if(i.source!==null)ne.set(i.file,i.source)}let re=(n)=>{if(o.filesProcessed++,n.success){if(n.cached)C++;else o.filesGenerated++,o.declarationsFound+=n.declarationCount,o.importsProcessed+=n.importCount,o.exportsProcessed+=n.exportCount;if(t.validate){if(o.filesValidated++,n.validationErrorCount)o.validationErrors+=n.validationErrorCount}}else if(o.filesFailed++,n.dtsError){o.errors.push(n.dtsError);let i=bt(n.dtsError);if(t.continueOnError)e.warn(i);else throw e.error(i),Error(n.dtsError.message)}};if(z)for(let n=0;n<p.length;n+=X){let i=p.slice(n,n+X),m=await Promise.all(i.map((c)=>x(c,ne.get(c))));for(let c of m)re(c);if(t.progress){let c=Math.round(o.filesProcessed/p.length*100);e.info(`[${o.filesProcessed}/${p.length}] ${c}%`)}}else for(let n of p){let i=await x(n);if(re(i),t.progress){let m=Math.round(o.filesProcessed/p.length*100),c=i.cached?"[cached]":"";e.info(`[${o.filesProcessed}/${p.length}] ${m}% - ${B(t.cwd,n)} ${c}`)}}if(!t.bundle){let n=[];if(b)for(let i of b.unresolved)n.push({from:i.from,specifier:i.specifier,reason:"missing"});if(t.autoIncludeReExports===!1&&p.length>0){let i=new Set(p);for(let m of p){let c;try{c=await u(m)}catch{continue}for(let S of k(c)){let T=y(S.specifier,m);if(!T.isRelative)continue;if(!T.resolved)n.push({from:m,specifier:S.specifier,reason:"missing"});else if(!/\.d\.(?:ts|mts|cts)$/.test(T.resolved)&&!i.has(T.resolved))n.push({from:m,specifier:S.specifier,reason:"not-emitted"})}}}if(n.length>0){let i=[];i.push(`Found ${n.length} re-export(s) pointing at siblings that won't be in the output:`);for(let c of n){let S=B(t.cwd,c.from);if(c.reason==="missing")i.push(` ${S} \u2192 '${c.specifier}' (path not found on disk)`);else i.push(` ${S} \u2192 '${c.specifier}' (resolved but not in entrypoints; set autoIncludeReExports: true or add to entrypoints)`)}let m=i.join(`
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Se}from"./chunk-01jwgm2m.js";import{e}from"./chunk-btc6zbyj.js";import{Ee,U}from"./chunk-7khy25x0.js";import{existsSync as x}from"fs";import{basename as D,dirname as M,extname as R,isAbsolute as v,relative as p,resolve as m}from"path";var{Glob:j}=globalThis.Bun;async function Ce(r,o){let s=await F(r);C(r,s);let n=s.slice(),a=await(o?o():Ee(r)),t=null;if(r.autoIncludeReExports!==!1&&n.length>0){t=await U(n,{includeImports:!0,resolveSpecifier:a});let l=m(r.cwd,r.root),u=r.exclude||[],f=[];for(let c of t.reachable){if(n.includes(c))continue;if(!b(c))continue;if(c.endsWith(".d.ts"))continue;if(c.includes("node_modules"))continue;let E=r.outputStructure==="flat"&&s.some((O)=>a.isPackageLocal?.(O,c));if(!S(c,l)&&!E){e.warn(`Skipping auto-included source outside root: ${p(r.cwd,c)}`);continue}if(Z(c,u,l))continue;f.push(c)}if(f.length>0)n=[...n,...f],e.debug(`Auto-included ${f.length} file(s) reached via relative re-exports`)}let i=N(n,r),d=t??await U(n,{includeImports:!0,resolveSpecifier:a}),g=await Se([...d.sources.keys()],a,r.isolatedDeclarations??!1,d.sources),h=new Set(n);for(let[l,u]of g){if(!h.has(l))continue;for(let f of u){let c=a(f,l).resolved;if(c&&!h.has(c))throw Error(`Module augmentation import ${JSON.stringify(f)} from ${l} requires a source not emitted by this package build: ${c}`)}}let y=[...g].map(([l,u])=>[l,[...u].sort()]).sort(([l],[u])=>l.localeCompare(u));return Object.freeze({entryFiles:Object.freeze(s),files:Object.freeze(n),outputBySource:i,resolver:a,reachability:t,augmentationImports:g,getResolutionFingerprint:()=>JSON.stringify({resolution:a.cacheKey?.(n),augmentations:y})})}var P=50,w=new Map;function k(r){let o=w.get(r);if(!o){if(o=new j(r),w.set(r,o),w.size>P){let s=w.keys().next().value;if(s!==void 0)w.delete(s)}}return o}function Z(r,o,s){if(!o||o.length===0)return!1;let n=p(s,r);for(let a of o){let t=k(a);if(t.match(n)||t.match(r))return!0}return!1}var G=/[*?[\]{}!]/;function C(r,o){let s=m(r.cwd,r.root),n=` root: ${s}
2
+ import{Se}from"./chunk-54d8mt4c.js";import{e}from"./chunk-btc6zbyj.js";import{Ee,U}from"./chunk-7khy25x0.js";import{existsSync as x}from"fs";import{basename as D,dirname as M,extname as R,isAbsolute as v,relative as p,resolve as m}from"path";var{Glob:j}=globalThis.Bun;async function Ce(r,o){let s=await F(r);C(r,s);let n=s.slice(),a=await(o?o():Ee(r)),t=null;if(r.autoIncludeReExports!==!1&&n.length>0){t=await U(n,{includeImports:!0,resolveSpecifier:a});let l=m(r.cwd,r.root),u=r.exclude||[],f=[];for(let c of t.reachable){if(n.includes(c))continue;if(!b(c))continue;if(c.endsWith(".d.ts"))continue;if(c.includes("node_modules"))continue;let E=r.outputStructure==="flat"&&s.some((O)=>a.isPackageLocal?.(O,c));if(!S(c,l)&&!E){e.warn(`Skipping auto-included source outside root: ${p(r.cwd,c)}`);continue}if(Z(c,u,l))continue;f.push(c)}if(f.length>0)n=[...n,...f],e.debug(`Auto-included ${f.length} file(s) reached via relative re-exports`)}let i=N(n,r),d=t??await U(n,{includeImports:!0,resolveSpecifier:a}),g=await Se([...d.sources.keys()],a,r.isolatedDeclarations??!1,d.sources),h=new Set(n);for(let[l,u]of g){if(!h.has(l))continue;for(let f of u){let c=a(f,l).resolved;if(c&&!h.has(c))throw Error(`Module augmentation import ${JSON.stringify(f)} from ${l} requires a source not emitted by this package build: ${c}`)}}let y=[...g].map(([l,u])=>[l,[...u].sort()]).sort(([l],[u])=>l.localeCompare(u));return Object.freeze({entryFiles:Object.freeze(s),files:Object.freeze(n),outputBySource:i,resolver:a,reachability:t,augmentationImports:g,getResolutionFingerprint:()=>JSON.stringify({resolution:a.cacheKey?.(n),augmentations:y})})}var P=50,w=new Map;function k(r){let o=w.get(r);if(!o){if(o=new j(r),w.set(r,o),w.size>P){let s=w.keys().next().value;if(s!==void 0)w.delete(s)}}return o}function Z(r,o,s){if(!o||o.length===0)return!1;let n=p(s,r);for(let a of o){let t=k(a);if(t.match(n)||t.match(r))return!0}return!1}var G=/[*?[\]{}!]/;function C(r,o){let s=m(r.cwd,r.root),n=` root: ${s}
3
3
  entrypoints: ${r.entrypoints.map((t)=>JSON.stringify(t)).join(", ")||"(none)"}
4
4
  `+(r.exclude?.length?` exclude: ${r.exclude.map((t)=>JSON.stringify(t)).join(", ")}
5
5
  `:"")+"Entrypoints are resolved relative to --root. Pass several by repeating --entrypoints or separating them with commas.";if(o.length===0){if(r.entrypoints.filter((i)=>v(i)&&x(i)&&!S(i,s)).length===r.entrypoints.length)return;throw Error(`No source files matched. Nothing was generated.
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{S}from"./chunk-q4ph9qa2.js";import{G}from"./chunk-13tjnp25.js";import{chmod as j,lstat as P,mkdir as y,readdir as L,realpath as W,rename as D,rm as R,rmdir as _,stat as A,writeFile as B}from"fs/promises";import{basename as J,dirname as m,isAbsolute as M,parse as U,relative as F,resolve as l}from"path";function f(a,e){return a instanceof Error&&"code"in a&&a.code===e}async function w(a){try{return await P(a)}catch(e){if(f(e,"ENOENT"))return;throw e}}async function g(a){let e=l(a);try{return await W(e)}catch(n){if(!f(n,"ENOENT")||m(e)===e)throw n;return l(await g(m(e)),J(e))}}async function q(a){let e=l(a.cwd,a.outdir);if(a.bundle&&a.bundleOutput){if(M(a.bundleOutput))throw Error("bundleOutput must be relative to outdir");if(!S(l(e,a.bundleOutput),e))throw Error("bundleOutput must stay within outdir")}if(!a.clean||a.dryRun)return;if(e===U(e).root)throw Error("Refusing to clean declarations from the filesystem root");let[n,r]=await Promise.all([g(e),g(l(a.cwd,a.root))]);if(S(r,n))throw Error("Refusing to clean an outdir that contains the source root")}function z(a){return[".d.ts",".d.mts",".d.cts",".d.ts.map",".d.mts.map",".d.cts.map"].some((e)=>a.endsWith(e))}function k(a,e){return a.dev===e.dev&&a.ino===e.ino}async function x(a,e){try{if(!(await A(a)).isDirectory())throw Error(`Declaration output parent is not a directory: ${a}`);return}catch(r){if(!f(r,"ENOENT"))throw r}let n=m(a);if(n===a)throw Error(`Cannot create declaration output directory: ${a}`);await x(n,e);try{await y(a),e.push(a)}catch(r){if(!f(r,"EEXIST")||!(await A(a)).isDirectory())throw r}}async function X(a,e,n){for(let r of(await L(a,{withFileTypes:!0})).sort((s,p)=>s.name.localeCompare(p.name))){let s=l(a,r.name);if(s===e)continue;if(r.isDirectory())await X(s,e,n);else if(z(r.name)){let p=await w(s);if(!p)throw Error(`Declaration output changed during inventory: ${s}`);n.set(s,p)}}}function O(a,e,n,r,s){return Object.assign(AggregateError(e,a),{code:"DTSX_PUBLICATION_FAILED",phase:n,recoveryDirectory:r,outputsCommitted:s})}async function he(a,e){if(a.dryRun||e.size===0&&!a.clean)return;await q(a);let n=l(a.cwd,a.outdir);if(e.size===0&&!await w(n))return;let r=l(n,".dtsx-publication"),s=new Map;for(let[o,c]of e){let t=l(o);if(!M(o)||t===n||!S(t,n)||S(t,r)||!z(t))throw Error(`Invalid declaration publication target: ${o}`);if(s.has(t))throw Error(`Duplicate declaration publication target: ${o}`);s.set(t,c)}let p=[],T=[],I=[],b=!1,E,d,C=!1;async function h(o,c){let t=await g(m(o));if(!S(t,c))throw Error(`Declaration publication parent escapes outdir: ${o}`);if(S(t,l(c,".dtsx-publication")))throw Error(`Declaration publication target overlaps its transaction directory: ${o}`)}async function N(){if(!b)return;if(!E)throw Error(`Cannot verify declaration publication ownership: ${r}`);let o=await w(r);if(!o||!k(o,E))throw Error(`Declaration publication ownership changed: ${r}`);if(d&&await g(r)!==l(d,".dtsx-publication"))throw Error(`Declaration publication location changed: ${r}`);await R(r,{recursive:!0})}try{await x(n,p);try{await y(r)}catch(t){if(f(t,"EEXIST"))throw Error(`Declaration publication is active or requires recovery at ${r}`,{cause:t});throw t}b=!0,E=await P(r),d=await g(n);let o=new Map;if(a.clean)await X(n,r,o);for(let t of s.keys()){await h(t,d);let i=await w(t);if(i&&!i.isFile())throw Error(`Declaration publication target is not a regular file: ${t}`);if(i)o.set(t,i)}for(let t of o.keys())await h(t,d);await y(l(r,"staged")),await y(l(r,"backups"));let c=new Map;for(let t of new Set([...o.keys(),...s.keys()])){let i=c.size.toString();c.set(t,{path:t,existing:o.get(t),backup:l(r,"backups",i),staged:s.has(t)?l(r,"staged",i):void 0})}await B(l(r,"manifest.json"),JSON.stringify({version:1,outdir:n,targets:[...c.values()].map((t)=>({path:F(n,t.path),backup:F(r,t.backup),hadPrevious:!!t.existing}))}));for(let[t,i]of s){let u=c.get(t),v=u.staged;if(await G(v,i.content,i.lineEnding),!a.clean&&u.existing)await j(v,u.existing.mode&511);u.stagedIdentity=await P(v)}for(let t of c.values()){if(!t.existing)continue;await h(t.path,d);let i=await w(t.path);if(!i||!k(i,t.existing))throw Error(`Declaration output changed before commit: ${t.path}`);await D(t.path,t.backup),T.push(t)}for(let t of c.values()){if(!t.staged||!t.stagedIdentity)continue;if(await h(t.path,d),await x(m(t.path),p),await h(t.path,d),await w(t.path))throw Error(`Declaration output appeared during commit: ${t.path}`);await D(t.staged,t.path),I.push({path:t.path,identity:t.stagedIdentity})}C=!0;try{await N()}catch(t){throw O(`Declaration outputs committed, but transaction cleanup failed at ${r}`,[t],"finalize",r,!0)}}catch(o){if(C)throw o;let c=[];for(let i of I.toReversed())try{if(d)await h(i.path,d);let u=await w(i.path);if(!u)continue;if(!k(u,i.identity))throw Error(`Installed declaration changed before rollback: ${i.path}`);await R(i.path)}catch(u){c.push(u)}for(let i of T.toReversed())try{if(d)await h(i.path,d);if(await w(i.path))throw Error(`Cannot restore declaration over an existing path: ${i.path}`);await D(i.backup,i.path)}catch(u){c.push(u)}if(c.length>0)throw O(`Declaration rollback failed; recovery data retained at ${r}`,[o,...c],"rollback",r,!1);let t=[];try{await N()}catch(i){t.push(i)}for(let i of p.toReversed())try{await _(i)}catch(u){if(!f(u,"ENOENT")&&!f(u,"ENOTEMPTY")&&!f(u,"EEXIST"))t.push(u)}if(t.length>0)throw O(`Prior declarations retained, but publication cleanup failed at ${r}`,[o,...t],"cleanup",b?r:void 0,!1);throw o}}
2
+ import{S}from"./chunk-pd30356m.js";import{G}from"./chunk-13tjnp25.js";import{chmod as j,lstat as P,mkdir as y,readdir as L,realpath as W,rename as D,rm as R,rmdir as _,stat as A,writeFile as B}from"fs/promises";import{basename as J,dirname as m,isAbsolute as M,parse as U,relative as F,resolve as l}from"path";function f(a,e){return a instanceof Error&&"code"in a&&a.code===e}async function w(a){try{return await P(a)}catch(e){if(f(e,"ENOENT"))return;throw e}}async function g(a){let e=l(a);try{return await W(e)}catch(n){if(!f(n,"ENOENT")||m(e)===e)throw n;return l(await g(m(e)),J(e))}}async function q(a){let e=l(a.cwd,a.outdir);if(a.bundle&&a.bundleOutput){if(M(a.bundleOutput))throw Error("bundleOutput must be relative to outdir");if(!S(l(e,a.bundleOutput),e))throw Error("bundleOutput must stay within outdir")}if(!a.clean||a.dryRun)return;if(e===U(e).root)throw Error("Refusing to clean declarations from the filesystem root");let[n,r]=await Promise.all([g(e),g(l(a.cwd,a.root))]);if(S(r,n))throw Error("Refusing to clean an outdir that contains the source root")}function z(a){return[".d.ts",".d.mts",".d.cts",".d.ts.map",".d.mts.map",".d.cts.map"].some((e)=>a.endsWith(e))}function k(a,e){return a.dev===e.dev&&a.ino===e.ino}async function x(a,e){try{if(!(await A(a)).isDirectory())throw Error(`Declaration output parent is not a directory: ${a}`);return}catch(r){if(!f(r,"ENOENT"))throw r}let n=m(a);if(n===a)throw Error(`Cannot create declaration output directory: ${a}`);await x(n,e);try{await y(a),e.push(a)}catch(r){if(!f(r,"EEXIST")||!(await A(a)).isDirectory())throw r}}async function X(a,e,n){for(let r of(await L(a,{withFileTypes:!0})).sort((s,p)=>s.name.localeCompare(p.name))){let s=l(a,r.name);if(s===e)continue;if(r.isDirectory())await X(s,e,n);else if(z(r.name)){let p=await w(s);if(!p)throw Error(`Declaration output changed during inventory: ${s}`);n.set(s,p)}}}function O(a,e,n,r,s){return Object.assign(AggregateError(e,a),{code:"DTSX_PUBLICATION_FAILED",phase:n,recoveryDirectory:r,outputsCommitted:s})}async function he(a,e){if(a.dryRun||e.size===0&&!a.clean)return;await q(a);let n=l(a.cwd,a.outdir);if(e.size===0&&!await w(n))return;let r=l(n,".dtsx-publication"),s=new Map;for(let[o,c]of e){let t=l(o);if(!M(o)||t===n||!S(t,n)||S(t,r)||!z(t))throw Error(`Invalid declaration publication target: ${o}`);if(s.has(t))throw Error(`Duplicate declaration publication target: ${o}`);s.set(t,c)}let p=[],T=[],I=[],b=!1,E,d,C=!1;async function h(o,c){let t=await g(m(o));if(!S(t,c))throw Error(`Declaration publication parent escapes outdir: ${o}`);if(S(t,l(c,".dtsx-publication")))throw Error(`Declaration publication target overlaps its transaction directory: ${o}`)}async function N(){if(!b)return;if(!E)throw Error(`Cannot verify declaration publication ownership: ${r}`);let o=await w(r);if(!o||!k(o,E))throw Error(`Declaration publication ownership changed: ${r}`);if(d&&await g(r)!==l(d,".dtsx-publication"))throw Error(`Declaration publication location changed: ${r}`);await R(r,{recursive:!0})}try{await x(n,p);try{await y(r)}catch(t){if(f(t,"EEXIST"))throw Error(`Declaration publication is active or requires recovery at ${r}`,{cause:t});throw t}b=!0,E=await P(r),d=await g(n);let o=new Map;if(a.clean)await X(n,r,o);for(let t of s.keys()){await h(t,d);let i=await w(t);if(i&&!i.isFile())throw Error(`Declaration publication target is not a regular file: ${t}`);if(i)o.set(t,i)}for(let t of o.keys())await h(t,d);await y(l(r,"staged")),await y(l(r,"backups"));let c=new Map;for(let t of new Set([...o.keys(),...s.keys()])){let i=c.size.toString();c.set(t,{path:t,existing:o.get(t),backup:l(r,"backups",i),staged:s.has(t)?l(r,"staged",i):void 0})}await B(l(r,"manifest.json"),JSON.stringify({version:1,outdir:n,targets:[...c.values()].map((t)=>({path:F(n,t.path),backup:F(r,t.backup),hadPrevious:!!t.existing}))}));for(let[t,i]of s){let u=c.get(t),v=u.staged;if(await G(v,i.content,i.lineEnding),!a.clean&&u.existing)await j(v,u.existing.mode&511);u.stagedIdentity=await P(v)}for(let t of c.values()){if(!t.existing)continue;await h(t.path,d);let i=await w(t.path);if(!i||!k(i,t.existing))throw Error(`Declaration output changed before commit: ${t.path}`);await D(t.path,t.backup),T.push(t)}for(let t of c.values()){if(!t.staged||!t.stagedIdentity)continue;if(await h(t.path,d),await x(m(t.path),p),await h(t.path,d),await w(t.path))throw Error(`Declaration output appeared during commit: ${t.path}`);await D(t.staged,t.path),I.push({path:t.path,identity:t.stagedIdentity})}C=!0;try{await N()}catch(t){throw O(`Declaration outputs committed, but transaction cleanup failed at ${r}`,[t],"finalize",r,!0)}}catch(o){if(C)throw o;let c=[];for(let i of I.toReversed())try{if(d)await h(i.path,d);let u=await w(i.path);if(!u)continue;if(!k(u,i.identity))throw Error(`Installed declaration changed before rollback: ${i.path}`);await R(i.path)}catch(u){c.push(u)}for(let i of T.toReversed())try{if(d)await h(i.path,d);if(await w(i.path))throw Error(`Cannot restore declaration over an existing path: ${i.path}`);await D(i.backup,i.path)}catch(u){c.push(u)}if(c.length>0)throw O(`Declaration rollback failed; recovery data retained at ${r}`,[o,...c],"rollback",r,!1);let t=[];try{await N()}catch(i){t.push(i)}for(let i of p.toReversed())try{await _(i)}catch(u){if(!f(u,"ENOENT")&&!f(u,"ENOTEMPTY")&&!f(u,"EEXIST"))t.push(u)}if(t.length>0)throw O(`Prior declarations retained, but publication cleanup failed at ${r}`,[o,...t],"cleanup",b?r:void 0,!1);throw o}}
3
3
  export{q,he};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{W}from"./chunk-k5wz43yh.js";import{Te,Rn}from"./chunk-5mbfgcvp.js";import{ne,On}from"./chunk-7387m006.js";function Si(){On(),Rn()}function r(e,t,c=!0,n=!1,o){return Te(e,t,c,n,o)}async function Dn(e,t,c=!0,n={}){return await ne(t,e,n),r(e,t,c)}async function $i(e,t={}){let c=W(t.concurrency,4),n=new Map;for(let o=0;o<e.length;o+=c){let s=e.slice(o,o+c),i=await Promise.all(s.map(async(a)=>({path:a.filePath,declarations:await Dn(a.sourceCode,a.filePath,a.keepComments,t)})));for(let a of i)n.set(a.path,a.declarations)}return n}
2
+ import{W}from"./chunk-k5wz43yh.js";import{Te,Rn}from"./chunk-zy5jxjmg.js";import{ne,On}from"./chunk-7387m006.js";function Si(){On(),Rn()}function r(e,t,c=!0,n=!1,o){return Te(e,t,c,n,o)}async function Dn(e,t,c=!0,n={}){return await ne(t,e,n),r(e,t,c)}async function $i(e,t={}){let c=W(t.concurrency,4),n=new Map;for(let o=0;o<e.length;o+=c){let s=e.slice(o,o+c),i=await Promise.all(s.map(async(a)=>({path:a.filePath,declarations:await Dn(a.sourceCode,a.filePath,a.keepComments,t)})));for(let a of i)n.set(a.path,a.declarations)}return n}
3
3
  export{Si,r,Dn,$i};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{r}from"./chunk-xmj05115.js";import{existsSync as g,readFileSync as h,writeFileSync as b}from"fs";function d(t){let e=[],s=/\b([A-Z][a-zA-Z0-9]*)\b/g,o;while((o=s.exec(t))!==null){let i=o[1];if(!D(i))e.push(i)}return[...new Set(e)]}function D(t){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(t)}function x(t){if(t.kind!=="type")return!1;let e=t.typeAnnotation||"";if(t.generics)return!1;if(e.includes("{")||e.includes("(")||e.includes("<"))return!1;return/^[\w\s|&]+$/.test(e)}function v(t){if(t.kind!=="interface")return!1;if(!t.members||t.members.length===0){if(!t.extends)return!0}return!1}function I(t,e){let s={...t,members:[...t.members||[],...e.members||[]],leadingComments:[...t.leadingComments||[],...e.leadingComments||[]]};if(t.extends&&e.extends){let o=t.extends.split(",").map((n)=>n.trim()),i=e.extends.split(",").map((n)=>n.trim());s.extends=[...new Set([...o,...i])].join(", ")}else s.extends=t.extends||e.extends;return s}function A(t){let e={import:0,interface:1,type:2,class:3,enum:4,function:5,variable:6,export:7};return[...t].sort((s,o)=>{let i=e[s.kind]??99,n=e[o.kind]??99;if(i!==n)return i-n;return s.name.localeCompare(o.name)})}function T(t){let e=[],s=[];for(let i=0;i<t.length;i++){let n=t[i];if(n.kind==="import")e.push(n);else s.push(n)}return[...[...e].sort((i,n)=>{let a=i.source||"",c=n.source||"",p=a.startsWith("node:")||a==="bun",m=c.startsWith("node:")||c==="bun";if(p&&!m)return-1;if(!p&&m)return 1;let l=!a.startsWith("."),u=!c.startsWith(".");if(l&&!u)return-1;if(!l&&u)return 1;return a.localeCompare(c)}),...s]}function S(t){let e=new Set;for(let i of t){if(i.kind==="import")continue;let n=i.text||"",a=i.typeAnnotation||"",c=i.returnType||"",p=i.extends||"",m=i.implements?.join(" ")||"",l=`${n} ${a} ${c} ${p} ${m}`;for(let u of d(l))e.add(u);if(i.members)for(let u of i.members){let f=`${u.typeAnnotation||""} ${u.returnType||""}`;for(let y of d(f))e.add(y)}if(i.parameters){for(let u of i.parameters)if(u.type)for(let f of d(u.type))e.add(f)}}let s=0;return{declarations:t.map((i)=>{if(i.kind!=="import"||!i.specifiers)return i;let n=i.specifiers.filter((a)=>{let c=a.alias||a.name;return e.has(c)});if(n.length===0){if(!i.isSideEffect)return s++,null}if(n.length<(i.specifiers?.length||0))return s+=(i.specifiers?.length||0)-n.length,{...i,specifiers:n};return i}).filter((i)=>i!==null),removed:s}}function k(t){let e=new Map,s=0;for(let o of t){if(o.kind==="import"){let n=`import:${o.source}`;if(e.has(n)){let a=e.get(n),c=[...a.specifiers||[],...o.specifiers||[]],p=Array.from(new Map(c.map((m)=>[m.alias||m.name,m])).values());e.set(n,{...a,specifiers:p}),s++}else e.set(n,o);continue}let i=`${o.kind}:${o.name}`;if(e.has(i))s++;else e.set(i,o)}return{declarations:Array.from(e.values()),removed:s}}function z(t){let e=new Map,s=[];for(let n of t)if(n.kind==="interface"){let a=n.name;if(!e.has(a))e.set(a,[]);e.get(a).push(n)}else s.push(n);let o=0,i=[];for(let[n,a]of e)if(a.length>1){let c=a[0];for(let p=1;p<a.length;p++)c=I(c,a[p]),o++;i.push(c)}else i.push(a[0]);return{declarations:[...s,...i],merged:o}}function w(t){let e=new Map,s=new Set;for(let n of t)if(x(n))e.set(n.name,n.typeAnnotation||""),s.add(n.name);if(e.size===0)return{declarations:t,inlined:0};function o(n){let a=n;for(let[c,p]of e){let m=new RegExp(`\\b${c}\\b`,"g");a=a.replace(m,p)}return a}return{declarations:t.filter((n)=>n.kind!=="type"||!s.has(n.name)).map((n)=>{if(n.typeAnnotation)n={...n,typeAnnotation:o(n.typeAnnotation)};if(n.returnType)n={...n,returnType:o(n.returnType)};if(n.extends)n={...n,extends:o(n.extends)};return n}),inlined:e.size}}function R(t){let e=t.length,s=t.filter((o)=>!v(o));return{declarations:s,removed:e-s.length}}function or(t,e={}){let s=[...t],o={originalSize:0,optimizedSize:0,savings:0,savingsPercent:0,removedImports:0,removedDeclarations:0,mergedInterfaces:0,inlinedTypes:0};if(e.removeUnusedImports){let{declarations:i,removed:n}=S(s);s=i,o.removedImports=n}if(e.deduplicateDeclarations){let{declarations:i,removed:n}=k(s);s=i,o.removedDeclarations+=n}if(e.mergeInterfaces){let{declarations:i,merged:n}=z(s);s=i,o.mergedInterfaces=n}if(e.removeEmptyInterfaces){let{declarations:i,removed:n}=R(s);s=i,o.removedDeclarations+=n}if(e.inlineSimpleTypes){let{declarations:i,inlined:n}=w(s);s=i,o.inlinedTypes=n}if(e.sortImports)s=T(s);if(e.sortDeclarations)s=A(s);return{declarations:s,result:o}}async function Pi(t,e={}){if(!g(t))throw Error(`File not found: ${t}`);let s=h(t,"utf-8"),o=Buffer.byteLength(s,"utf-8"),i=r(s,t,!e.removeComments),{declarations:n,result:a}=or(i,e),c=C(n,e);if(e.minify)c=ar(c);let p=Buffer.byteLength(c,"utf-8");return a.originalSize=o,a.optimizedSize=p,a.savings=o-p,a.savingsPercent=Math.round(a.savings/o*100),b(t,c),a}function C(t,e){let s=[];for(let o of t){if(!e.removeComments&&o.leadingComments)for(let i of o.leadingComments)s.push(i);if(o.text)s.push(o.text);else s.push(E(o));s.push("")}return s.join(`
2
+ import{r}from"./chunk-q4fhsthj.js";import{existsSync as g,readFileSync as h,writeFileSync as b}from"fs";function d(t){let e=[],s=/\b([A-Z][a-zA-Z0-9]*)\b/g,o;while((o=s.exec(t))!==null){let i=o[1];if(!D(i))e.push(i)}return[...new Set(e)]}function D(t){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(t)}function x(t){if(t.kind!=="type")return!1;let e=t.typeAnnotation||"";if(t.generics)return!1;if(e.includes("{")||e.includes("(")||e.includes("<"))return!1;return/^[\w\s|&]+$/.test(e)}function v(t){if(t.kind!=="interface")return!1;if(!t.members||t.members.length===0){if(!t.extends)return!0}return!1}function I(t,e){let s={...t,members:[...t.members||[],...e.members||[]],leadingComments:[...t.leadingComments||[],...e.leadingComments||[]]};if(t.extends&&e.extends){let o=t.extends.split(",").map((n)=>n.trim()),i=e.extends.split(",").map((n)=>n.trim());s.extends=[...new Set([...o,...i])].join(", ")}else s.extends=t.extends||e.extends;return s}function A(t){let e={import:0,interface:1,type:2,class:3,enum:4,function:5,variable:6,export:7};return[...t].sort((s,o)=>{let i=e[s.kind]??99,n=e[o.kind]??99;if(i!==n)return i-n;return s.name.localeCompare(o.name)})}function T(t){let e=[],s=[];for(let i=0;i<t.length;i++){let n=t[i];if(n.kind==="import")e.push(n);else s.push(n)}return[...[...e].sort((i,n)=>{let a=i.source||"",c=n.source||"",p=a.startsWith("node:")||a==="bun",m=c.startsWith("node:")||c==="bun";if(p&&!m)return-1;if(!p&&m)return 1;let l=!a.startsWith("."),u=!c.startsWith(".");if(l&&!u)return-1;if(!l&&u)return 1;return a.localeCompare(c)}),...s]}function S(t){let e=new Set;for(let i of t){if(i.kind==="import")continue;let n=i.text||"",a=i.typeAnnotation||"",c=i.returnType||"",p=i.extends||"",m=i.implements?.join(" ")||"",l=`${n} ${a} ${c} ${p} ${m}`;for(let u of d(l))e.add(u);if(i.members)for(let u of i.members){let f=`${u.typeAnnotation||""} ${u.returnType||""}`;for(let y of d(f))e.add(y)}if(i.parameters){for(let u of i.parameters)if(u.type)for(let f of d(u.type))e.add(f)}}let s=0;return{declarations:t.map((i)=>{if(i.kind!=="import"||!i.specifiers)return i;let n=i.specifiers.filter((a)=>{let c=a.alias||a.name;return e.has(c)});if(n.length===0){if(!i.isSideEffect)return s++,null}if(n.length<(i.specifiers?.length||0))return s+=(i.specifiers?.length||0)-n.length,{...i,specifiers:n};return i}).filter((i)=>i!==null),removed:s}}function k(t){let e=new Map,s=0;for(let o of t){if(o.kind==="import"){let n=`import:${o.source}`;if(e.has(n)){let a=e.get(n),c=[...a.specifiers||[],...o.specifiers||[]],p=Array.from(new Map(c.map((m)=>[m.alias||m.name,m])).values());e.set(n,{...a,specifiers:p}),s++}else e.set(n,o);continue}let i=`${o.kind}:${o.name}`;if(e.has(i))s++;else e.set(i,o)}return{declarations:Array.from(e.values()),removed:s}}function z(t){let e=new Map,s=[];for(let n of t)if(n.kind==="interface"){let a=n.name;if(!e.has(a))e.set(a,[]);e.get(a).push(n)}else s.push(n);let o=0,i=[];for(let[n,a]of e)if(a.length>1){let c=a[0];for(let p=1;p<a.length;p++)c=I(c,a[p]),o++;i.push(c)}else i.push(a[0]);return{declarations:[...s,...i],merged:o}}function w(t){let e=new Map,s=new Set;for(let n of t)if(x(n))e.set(n.name,n.typeAnnotation||""),s.add(n.name);if(e.size===0)return{declarations:t,inlined:0};function o(n){let a=n;for(let[c,p]of e){let m=new RegExp(`\\b${c}\\b`,"g");a=a.replace(m,p)}return a}return{declarations:t.filter((n)=>n.kind!=="type"||!s.has(n.name)).map((n)=>{if(n.typeAnnotation)n={...n,typeAnnotation:o(n.typeAnnotation)};if(n.returnType)n={...n,returnType:o(n.returnType)};if(n.extends)n={...n,extends:o(n.extends)};return n}),inlined:e.size}}function R(t){let e=t.length,s=t.filter((o)=>!v(o));return{declarations:s,removed:e-s.length}}function or(t,e={}){let s=[...t],o={originalSize:0,optimizedSize:0,savings:0,savingsPercent:0,removedImports:0,removedDeclarations:0,mergedInterfaces:0,inlinedTypes:0};if(e.removeUnusedImports){let{declarations:i,removed:n}=S(s);s=i,o.removedImports=n}if(e.deduplicateDeclarations){let{declarations:i,removed:n}=k(s);s=i,o.removedDeclarations+=n}if(e.mergeInterfaces){let{declarations:i,merged:n}=z(s);s=i,o.mergedInterfaces=n}if(e.removeEmptyInterfaces){let{declarations:i,removed:n}=R(s);s=i,o.removedDeclarations+=n}if(e.inlineSimpleTypes){let{declarations:i,inlined:n}=w(s);s=i,o.inlinedTypes=n}if(e.sortImports)s=T(s);if(e.sortDeclarations)s=A(s);return{declarations:s,result:o}}async function Pi(t,e={}){if(!g(t))throw Error(`File not found: ${t}`);let s=h(t,"utf-8"),o=Buffer.byteLength(s,"utf-8"),i=r(s,t,!e.removeComments),{declarations:n,result:a}=or(i,e),c=C(n,e);if(e.minify)c=ar(c);let p=Buffer.byteLength(c,"utf-8");return a.originalSize=o,a.optimizedSize=p,a.savings=o-p,a.savingsPercent=Math.round(a.savings/o*100),b(t,c),a}function C(t,e){let s=[];for(let o of t){if(!e.removeComments&&o.leadingComments)for(let i of o.leadingComments)s.push(i);if(o.text)s.push(o.text);else s.push(E(o));s.push("")}return s.join(`
3
3
  `)}function E(t){let e=[];if(t.isExported)e.push("export");if(t.isDefault)e.push("default");switch(t.kind){case"import":if(t.isTypeOnly)e.push("import type");else e.push("import");if(t.specifiers&&t.specifiers.length>0){let s=t.specifiers.map((o)=>{let i=o.isType?"type ":"";return o.alias?`${i}${o.name} as ${o.alias}`:`${i}${o.name}`}).join(", ");e.push(`{ ${s} }`)}e.push("from"),e.push(`'${t.source}'`);break;case"function":if(e.push("declare function"),e.push(t.name),t.generics)e.push(t.generics);if(e.push(`(${B(t.parameters)})`),t.returnType)e.push(`: ${t.returnType}`);break;case"variable":if(e.push("declare const"),e.push(t.name),t.typeAnnotation)e.push(`: ${t.typeAnnotation}`);break;case"interface":if(e.push("interface"),e.push(t.name),t.generics)e.push(t.generics);if(t.extends)e.push(`extends ${t.extends}`);if(e.push("{"),t.members)for(let s of t.members)e.push(` ${s.name}${s.typeAnnotation?`: ${s.typeAnnotation}`:""}`);e.push("}");break;case"type":if(e.push("type"),e.push(t.name),t.generics)e.push(t.generics);e.push("="),e.push(t.typeAnnotation||"unknown");break;case"class":if(e.push("declare class"),e.push(t.name),t.generics)e.push(t.generics);if(t.extends)e.push(`extends ${t.extends}`);if(t.implements?.length)e.push(`implements ${t.implements.join(", ")}`);e.push("{ }");break;case"enum":e.push("declare enum"),e.push(t.name),e.push("{ }");break;default:return t.text||""}return e.join(" ")}function B(t){if(!t)return"";return t.map((e)=>{let s="";if(e.rest)s+="...";if(s+=e.name,e.optional)s+="?";if(e.type)s+=`: ${e.type}`;return s}).join(", ")}function ar(t){return t.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{or,Pi,ar};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{f,ue}from"./chunk-a3apthex.js";import{Ft,Nt,n,Me,j}from"./chunk-8g4wk8mm.js";function g(t){if(t.includes(`
2
+ import{f,ue}from"./chunk-a3apthex.js";import{Ft,Nt,n,Me,j}from"./chunk-3qx4ys4v.js";function g(t){if(t.includes(`
3
3
  `))return`/**
4
4
  * ${t}
5
5
  */
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{r}from"./chunk-xmj05115.js";import{e}from"./chunk-btc6zbyj.js";import{existsSync as j,mkdirSync as S,readFileSync as E,writeFileSync as f}from"fs";import{basename as h,join as g}from"path";function Zt(t){let n={description:"",params:[],examples:[],tags:{},see:[],throws:[]};if(!t||t.length===0)return n;for(let s of t){let o=s.replace(/^\/\*\*/,"").replace(/\*\/$/,"").split(`
2
+ import{r}from"./chunk-q4fhsthj.js";import{e}from"./chunk-btc6zbyj.js";import{existsSync as j,mkdirSync as S,readFileSync as E,writeFileSync as f}from"fs";import{basename as h,join as g}from"path";function Zt(t){let n={description:"",params:[],examples:[],tags:{},see:[],throws:[]};if(!t||t.length===0)return n;for(let s of t){let o=s.replace(/^\/\*\*/,"").replace(/\*\/$/,"").split(`
3
3
  `).map((p)=>p.replace(/^\s*\*\s?/,"")).join(`
4
4
  `).trim(),i=o.search(/@\w+/);if(i===-1){n.description=o;continue}else if(i>0)n.description=o.slice(0,i).trim(),o=o.slice(i);let a=/@(\w+)(?:\s+\{([^}]+)\})?\s*([^\n@]*(?:\n(?!@)[^\n@]*)*)/g,c;while((c=a.exec(o))!==null){let[,p,u,d]=c,m=d.trim();switch(p){case"param":{let l=m.match(/^(\[)?(\w+)\]?\s*(?:-\s*)?(.*)/);if(l)n.params.push({name:l[2],type:u,description:l[3].trim(),optional:!!l[1]});break}case"returns":case"return":n.returns={type:u,description:m};break;case"example":n.examples.push(m);break;case"deprecated":n.deprecated=m||"Deprecated";break;case"since":n.since=m;break;case"see":n.see.push(m);break;case"throws":case"throw":n.throws.push({type:u,description:m});break;case"category":n.category=m;break;default:if(!n.tags[p])n.tags[p]=[];n.tags[p].push(m)}}}return n}function w(t,n){let s=Zt(t.leadingComments),o="";switch(t.kind){case"function":o=M(t);break;case"variable":o=C(t);break;case"interface":o=P(t);break;case"type":o=v(t);break;case"class":o=T(t);break;case"enum":o=F(t);break;default:o=t.text||t.name}let i={name:t.name,kind:t.kind,signature:o,jsdoc:s,isExported:t.isExported,isDefault:t.isDefault,sourceFile:n};if(t.members&&t.members.length>0)i.members=t.members.map((a)=>w(a,n));return i}function M(t){let n=[];if(t.isExported)n.push("export");if(t.isDefault)n.push("default");if(n.push("function"),n.push(t.name),t.generics)n.push(t.generics);if(t.parameters){let s=t.parameters.map((o)=>{let i="";if(o.rest)i+="...";if(i+=o.name,o.optional)i+="?";if(o.type)i+=`: ${o.type}`;return i}).join(", ");n.push(`(${s})`)}else n.push("()");if(t.returnType)n.push(`: ${t.returnType}`);return n.join(" ").replace(/\s+/g," ")}function C(t){let n=[];if(t.isExported)n.push("export");if(n.push("const"),n.push(t.name),t.typeAnnotation)n.push(`: ${t.typeAnnotation}`);return n.join(" ")}function P(t){let n=[];if(t.isExported)n.push("export");if(n.push("interface"),n.push(t.name),t.generics)n.push(t.generics);if(t.extends)n.push(`extends ${t.extends}`);return n.join(" ")}function v(t){let n=[];if(t.isExported)n.push("export");if(n.push("type"),n.push(t.name),t.generics)n.push(t.generics);if(n.push("="),t.typeAnnotation)n.push(t.typeAnnotation);return n.join(" ")}function T(t){let n=[];if(t.isExported)n.push("export");if(t.isDefault)n.push("default");if(n.push("class"),n.push(t.name),t.generics)n.push(t.generics);if(t.extends)n.push(`extends ${t.extends}`);if(t.implements&&t.implements.length>0)n.push(`implements ${t.implements.join(", ")}`);return n.join(" ")}function F(t){let n=[];if(t.isExported)n.push("export");return n.push("enum"),n.push(t.name),n.join(" ")}async function Qt(t,n={}){let s=[],o=new Map;for(let i of t){if(!j(i)){e.warn(`File not found: ${i}`);continue}let a=E(i,"utf-8"),c=r(a,i,!0);for(let p of c){if(p.kind==="import")continue;if(!n.includePrivate&&p.name.startsWith("_"))continue;if(!n.includeInternal&&p.leadingComments?.some((d)=>d.includes("@internal")))continue;let u=w(p,i);if(s.push(u),n.groupByCategory&&u.jsdoc.category){let d=u.jsdoc.category;if(!o.has(d))o.set(d,[]);o.get(d).push(u)}}}return{title:n.title||"API Documentation",description:n.description,entries:s,categories:o,generatedAt:new Date}}function je(t,n={}){let s=[];if(s.push(`# ${t.title}`),s.push(""),t.description)s.push(t.description),s.push("");if(s.push(`> Generated on ${t.generatedAt.toISOString()}`),s.push(""),s.push("## Table of Contents"),s.push(""),n.groupByCategory&&t.categories.size>0)for(let o of t.categories.keys())s.push(`- [${o}](#${D(o)})`);else{let o=x(t.entries);for(let[i,a]of o)if(a.length>0)s.push(`- [${b(i)}](#${D(b(i))})`)}if(s.push(""),n.groupByCategory&&t.categories.size>0)for(let[o,i]of t.categories){s.push(`## ${o}`),s.push("");for(let a of i)s.push(...k(a,n))}else{let o=x(t.entries);for(let[i,a]of o)if(a.length>0){s.push(`## ${b(i)}`),s.push("");for(let c of a)s.push(...k(c,n))}}return s.join(`
5
5
  `)}function k(t,n){let s=[];if(s.push(`### ${t.name}`),s.push(""),t.jsdoc.deprecated)s.push(`> **Deprecated:** ${t.jsdoc.deprecated}`),s.push("");if(s.push("```typescript"),s.push(t.signature),s.push("```"),s.push(""),t.jsdoc.description)s.push(t.jsdoc.description),s.push("");if(t.jsdoc.params.length>0){s.push("**Parameters:**"),s.push(""),s.push("| Name | Type | Description |"),s.push("|------|------|-------------|");for(let o of t.jsdoc.params){let i=o.optional?" (optional)":"",a=o.type||"any";s.push(`| \`${o.name}\`${i} | \`${a}\` | ${o.description} |`)}s.push("")}if(t.jsdoc.returns){s.push("**Returns:**"),s.push("");let o=t.jsdoc.returns.type?`\`${t.jsdoc.returns.type}\``:"";s.push(`${o} ${t.jsdoc.returns.description}`),s.push("")}if(t.jsdoc.throws.length>0){s.push("**Throws:**"),s.push("");for(let o of t.jsdoc.throws){let i=o.type?`\`${o.type}\``:"";s.push(`- ${i} ${o.description}`)}s.push("")}if(t.jsdoc.examples.length>0){s.push("**Examples:**"),s.push("");for(let o of t.jsdoc.examples)s.push("```typescript"),s.push(o),s.push("```"),s.push("")}if(t.jsdoc.see.length>0){s.push("**See also:**"),s.push("");for(let o of t.jsdoc.see)s.push(`- ${o}`);s.push("")}if(t.jsdoc.since)s.push(`*Since: ${t.jsdoc.since}*`),s.push("");if(n.includeSourceLinks&&t.sourceFile){let o=t.sourceFile;if(n.sourceBaseUrl)s.push(`[Source](${n.sourceBaseUrl}/${o})`);else s.push(`*Source: ${o}*`);s.push("")}if(t.members&&t.members.length>0){s.push("**Members:**"),s.push("");for(let o of t.members)if(s.push(`#### ${o.name}`),s.push(""),s.push("```typescript"),s.push(o.signature),s.push("```"),s.push(""),o.jsdoc.description)s.push(o.jsdoc.description),s.push("")}return s.push("---"),s.push(""),s}function en(t,n={}){let s=je(t,n);return`<!DOCTYPE html>
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-wma315wm.js";function pe(d={}){let{onBuildStart:u=!1,onBuildEnd:f=!0,onGenerated:l,onError:i,...c}=d,o,r,e=async()=>{let t={...c};if(!t.outdir&&o)t.outdir=o;if(!t.entrypoints&&r)t.entrypoints=r;try{let n=await s(t);l?.(n)}catch(n){let a=n instanceof Error?n:Error(String(n));if(i?.(a),!i)console.error("[dtsx] Generation failed:",a.message)}};return{name:"dtsx",esbuildOptions(t){if(t.outdir&&typeof t.outdir==="string")o=t.outdir;if(t.entryPoints){if(Array.isArray(t.entryPoints))r=t.entryPoints;else if(typeof t.entryPoints==="object")r=Object.values(t.entryPoints)}},async buildStart(){if(u)await e()},async buildEnd(t){if(f)await e()}}}var Ea=pe,rr=pe,ka=pe;
2
+ import{s}from"./chunk-msr5zymd.js";function pe(d={}){let{onBuildStart:u=!1,onBuildEnd:f=!0,onGenerated:l,onError:i,...c}=d,o,r,e=async()=>{let t={...c};if(!t.outdir&&o)t.outdir=o;if(!t.entrypoints&&r)t.entrypoints=r;try{let n=await s(t);l?.(n)}catch(n){let a=n instanceof Error?n:Error(String(n));if(i?.(a),!i)console.error("[dtsx] Generation failed:",a.message)}};return{name:"dtsx",esbuildOptions(t){if(t.outdir&&typeof t.outdir==="string")o=t.outdir;if(t.entryPoints){if(Array.isArray(t.entryPoints))r=t.entryPoints;else if(typeof t.entryPoints==="object")r=Object.values(t.entryPoints)}},async buildStart(){if(u)await e()},async buildEnd(t){if(f)await e()}}}var Ea=pe,rr=pe,ka=pe;
3
3
  export{pe,Ea,rr,ka};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- var e="@dtsx/dtsx",i="module",n="0.11.41",r=!0,c="A modern, fast .d.ts generation tool, powered by Bun.",u="Chris Breuer <chris@stacksjs.org>",a="MIT",b="https://github.com/stacksjs/dtsx#readme",o={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},p={url:"https://github.com/stacksjs/dtsx/issues"},d=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],m={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},k="./dist/index.js",l="./dist/index.d.ts",x={dtsx:"./dist/cli.js"},g=["dist"],h={benchmark:"bun benchmark/index.ts","benchmark:prepare":"cd packages/zig-dtsx && zig build -Doptimize=ReleaseFast && cd ../.. && bun build benchmark/oxc-emit.ts --compile --splitting --bytecode --minify --format=esm --outfile benchmark/oxc-emit","benchmark:publish":"bun benchmark/index.ts --json benchmark/results.json --runs 3 && bun benchmark/render.ts","benchmark:tsdown":"bun benchmark/tsdown.ts",build:"bun --filter './packages/dtsx' build",test:"find packages -name '*.test.ts' -print | xargs bun test","test:public-sdk":"bun scripts/verify-public-sdk.ts","test:standalone":"bun scripts/verify-standalone.ts","typecheck:public-sdk":"bun x tsc --project tsconfig.public-sdk.json",lint:"bun x --bun pickier .","lint:fix":"bun x --bun pickier . --fix",format:"bun x --bun pickier . --format","format:fix":"bun x --bun pickier . --format --write",changelog:"bun x @stacksjs/logsmith --verbose","changelog:generate":"bun x @stacksjs/logsmith --output CHANGELOG.md",release:"bun x --bun @stacksjs/bumpx prompt --recursive","release:patch":"bun x --bun @stacksjs/bumpx patch --recursive --commit --tag --push --yes","release:minor":"bun x --bun @stacksjs/bumpx minor --recursive --commit --tag --push --yes",typecheck:"bun x tsc --noEmit","dev:docs":"bun --bun bunpress dev docs","build:docs":"bun --bun bunpress build docs","preview:docs":"bun --bun bunpress preview docs"},j={"@stacksjs/bumpx":"^0.2.32","@stacksjs/bunpress":"^0.2.31","@stacksjs/clapp":"^0.2.16",pickier:"^0.1.88","@stacksjs/gitlint":"^0.1.8","@stacksjs/logsmith":"^0.2.14","@types/bun":"^1.4.4","buddy-bot":"^0.10.5","bun-git-hooks":"^0.3.3","@dtsx/bun":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.157.0","oxc-parser":"^0.157.0",tsdown:"^0.23.7",typescript:"^7.0.2"},y=["packages/*"],f={typescript:"^7.0.2"},v={name:e,type:i,version:n,private:r,description:c,author:u,license:a,homepage:b,repository:o,bugs:p,keywords:d,exports:m,module:k,types:l,bin:x,files:g,scripts:h,devDependencies:j,workspaces:y,overrides:f,"git-hooks":{"pre-commit":{"staged-lint":{"*.{js,ts,json,yaml,yml,md}":"bun x --bun pickier lint --fix"}},"commit-msg":"bun x gitlint --edit .git/COMMIT_EDITMSG"}};export{u as author,x as bin,p as bugs,v as default,c as description,j as devDependencies,m as exports,g as files,b as homepage,d as keywords,a as license,k as module,e as name,f as overrides,r as private,o as repository,h as scripts,i as type,l as types,n as version,y as workspaces};
2
+ var e="@dtsx/dtsx",i="module",n="0.11.42",r=!0,c="A modern, fast .d.ts generation tool, powered by Bun.",u="Chris Breuer <chris@stacksjs.org>",a="MIT",b="https://github.com/stacksjs/dtsx#readme",o={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},p={url:"https://github.com/stacksjs/dtsx/issues"},d=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],m={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},k="./dist/index.js",l="./dist/index.d.ts",x={dtsx:"./dist/cli.js"},g=["dist"],h={benchmark:"bun benchmark/index.ts","benchmark:prepare":"cd packages/zig-dtsx && zig build -Doptimize=ReleaseFast && cd ../.. && bun build benchmark/oxc-emit.ts --compile --splitting --bytecode --minify --format=esm --outfile benchmark/oxc-emit","benchmark:publish":"bun benchmark/index.ts --json benchmark/results.json --runs 3 && bun benchmark/render.ts","benchmark:tsdown":"bun benchmark/tsdown.ts",build:"bun --filter './packages/dtsx' build",test:"find packages -name '*.test.ts' -print | xargs bun test","test:public-sdk":"bun scripts/verify-public-sdk.ts","test:standalone":"bun scripts/verify-standalone.ts","typecheck:public-sdk":"bun x tsc --project tsconfig.public-sdk.json",lint:"bun x --bun pickier .","lint:fix":"bun x --bun pickier . --fix",format:"bun x --bun pickier . --format","format:fix":"bun x --bun pickier . --format --write",changelog:"bun x @stacksjs/logsmith --verbose","changelog:generate":"bun x @stacksjs/logsmith --output CHANGELOG.md",release:"bun x --bun @stacksjs/bumpx prompt --recursive","release:patch":"bun x --bun @stacksjs/bumpx patch --recursive --commit --tag --push --yes","release:minor":"bun x --bun @stacksjs/bumpx minor --recursive --commit --tag --push --yes",typecheck:"bun x tsc --noEmit","dev:docs":"bun --bun bunpress dev docs","build:docs":"bun --bun bunpress build docs","preview:docs":"bun --bun bunpress preview docs"},j={"@stacksjs/bumpx":"^0.2.32","@stacksjs/bunpress":"^0.2.31","@stacksjs/clapp":"^0.2.16",pickier:"^0.1.88","@stacksjs/gitlint":"^0.1.8","@stacksjs/logsmith":"^0.2.14","@types/bun":"^1.4.4","buddy-bot":"^0.10.5","bun-git-hooks":"^0.3.3","@dtsx/bun":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.157.0","oxc-parser":"^0.157.0",tsdown:"^0.23.7",typescript:"^7.0.2"},y=["packages/*"],f={typescript:"^7.0.2"},v={name:e,type:i,version:n,private:r,description:c,author:u,license:a,homepage:b,repository:o,bugs:p,keywords:d,exports:m,module:k,types:l,bin:x,files:g,scripts:h,devDependencies:j,workspaces:y,overrides:f,"git-hooks":{"pre-commit":{"staged-lint":{"*.{js,ts,json,yaml,yml,md}":"bun x --bun pickier lint --fix"}},"commit-msg":"bun x gitlint --edit .git/COMMIT_EDITMSG"}};export{u as author,x as bin,p as bugs,v as default,c as description,j as devDependencies,m as exports,g as files,b as homepage,d as keywords,a as license,k as module,e as name,f as overrides,r as private,o as repository,h as scripts,i as type,l as types,n as version,y as workspaces};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{c,i}from"./chunk-8kj9pkw5.js";import{t,F}from"./chunk-g0dxj89b.js";import{rt,Lt}from"./chunk-zf96k060.js";import{y}from"./chunk-a2dn9j88.js";import{n}from"./chunk-8g4wk8mm.js";function q(g,w){let C=(D)=>t(D).map((b)=>D.slice(b.start,b.end)).join("");return C(g)===C(w)}function de(g){if(["number","string","boolean","bigint","symbol","undefined","null"].includes(g))return g;let w=n(g,!1);return["number","string","boolean","bigint","undefined","null"].includes(w)?w:void 0}function oe(g,w){if(q(g,w))return g;let C=de(w);if(!C)return;let D=t(g),b=0,v=0,B=[];for(let S of D){let k=g.slice(S.start,S.end);if(k==="("||k==="["||k==="{"||k==="<")b++;else if(k===")"||k==="]"||k==="}"||k===">")b--;else if(k==="|"&&b===0)B.push(g.slice(v,S.start).trim()),v=S.end}B.push(g.slice(v).trim());let O=B.find((S)=>q(S,w));if(O)return O;if(B.includes(C))return C==="boolean"&&(w==="true"||w==="false")?w:C;return}function jn(g,w,C,D=new Set){let b=new Map,v=[],B=new Set;for(let e of[...w,...C.values()]){if(B.has(e))continue;if(B.add(e),v.push(e),e.kind==="import")for(let o of y(e.text))b.set(o,{declared:`typeof ${o}`,flow:`typeof ${o}`,unresolved:!1});else if(["function","class","enum"].includes(e.kind))b.set(e.name,{declared:`typeof ${e.name}`,flow:`typeof ${e.name}`,unresolved:!1});else if(e.kind==="variable")b.set(e.name,{declared:e.typeAnnotation,unresolved:!1})}v.sort((e,o)=>(e.start??0)-(o.start??0));let O=new Set(v.filter((e)=>e.kind==="function"&&!e.generics).map((e)=>e.name));for(let e of D)O.add(e);let S=new Map,k=(e)=>{if(e=e.trimStart(),S.has(e))return S.get(e);if(S.set(e,void 0),!c(e.charCodeAt(0)))return;let o=1;while(i(e.charCodeAt(o)))o++;if(!O.has(e.slice(0,o)))return;let r=t(e);if(r[0]?.kind!=="word"||!r[1]||e.slice(r[1].start,r[1].end)!=="(")return;let d=1;for(let s=2;s<r.length;s++){let a=e.slice(r[s].start,r[s].end);if(a==="(")d++;else if(a===")"&&--d===0){let l=s===r.length-1?e.slice(r[0].start,r[0].end):void 0;return S.set(e,l),l}}return},E=new Set(v.filter((e)=>e.kind==="variable"&&!e.typeAnnotation&&typeof e.value==="string").map((e)=>k(e.value)).filter((e)=>e!==void 0)).size?F(g):void 0,x=new Map;if(E){let e=0;for(let o=0;o<E.length;o++){let r=g.slice(E[o].start,E[o].end);if(e===0&&r==="function"){let d=E[o+1],s=d&&g.slice(d.start,d.end)==="*"?E[o+2]:d;if(s?.kind==="word"){let a=g.slice(s.start,s.end);x.set(a,(x.get(a)??0)+1)}}if(["{","(","["].includes(r))e++;else if(["}",")","]"].includes(r))e--}}let R=new Map;for(let e of v)if(e.kind==="function"&&!e.generics&&x.get(e.name)===1)R.set(e.name,e);for(let e of D){let o=v.find((r)=>r.kind==="import"&&y(r.text).includes(e));if(o)R.set(e,o)}let W="__dtsx_call_result";while(g.includes(W))W+="_";let K=(e)=>`(typeof ${e}) extends (...args: never[]) => infer ${W} ? ${W} : never`,X=new Map,H=!1;for(let e of v){if(e.kind!=="variable"||e.typeAnnotation||typeof e.value!=="string")continue;let o=k(e.value);if(o&&R.has(o))X.set(e,K(o)),b.get(e.name).active=!0,b.get(o).active=!0,H=!0;if(e.modifiers?.[0]!=="const")continue;let r=rt(e.value);if(!r||r===e.name||!b.has(r))continue;b.get(r).active=!0,b.get(e.name).active=!0,H=!0}if(!H)return;let u=E??F(g),f=(e)=>u[e]?g.slice(u[e].start,u[e].end):"",m=new Map,_=new Map,G=new Set,L=new Set,J=new Set,Q=new Map,I=[];for(let e=0;e<u.length;e++){let o=f(e),r=I.at(-1);if(r!==void 0)_.set(e,r);if(o==="{"&&["=","(","[",",",":","?","return","yield"].includes(f(e-1)))G.add(e);if(["(","[","{"].includes(o))I.push(e);else if([")","]","}"].includes(o)){let d=I.at(-1);if(d!==void 0&&["()","[]","{}"].includes(f(d)+o))I.pop(),m.set(d,e)}}let Y=new Map;for(let e=0;e<u.length;){if(u[e].kind!=="punctuation"){e++;continue}let r=[">>>=","**=","&&=","||=","??=","<<=",">>=","===","!==",">>>","**","&&","||","??","<<",">>","=>","==","!=","<=",">=","++","--","+=","-=","*=","/=","%=","&=","|=","^=","="].find((s)=>g.startsWith(s,u[e].start))??f(e);Y.set(e,r);let d=u[e].start+r.length;do e++;while(e<u.length&&u[e].start<d)}for(let e=0;e<u.length;e++){let o=ne(e);if(o!==void 0)L.add(o)}for(let e of L)le(e);let h=0;function Z(e){let o=rt(e);if(o){let a=b.get(o);return{type:a?.flow,unresolved:a?.unresolved??!1}}let r=k(e),d=r?R.get(r):void 0;if(d)return{type:d.returnType&&de(d.returnType)?d.returnType:K(r),unresolved:!1};let s=n(e,!0);return{type:s==="unknown"?void 0:s,unresolved:!1}}function T(e){return Y.get(e)??""}function N(e){if(u[e]?.kind!=="word"||J.has(e)||f(e-1)==="."||f(e-1)==="#"&&f(e-2)===".")return;let o=b.get(f(e));if(!o?.active)return;let r=T(e+1);if(["=","+=","-=","*=","/=","%=","**=","<<=",">>=",">>>=","&=","|=","^=","&&=","||=","??="].includes(r))return{binding:o,operator:r};if(["++","--"].includes(r)&&!/[\r\n]/.test(g.slice(u[e].end,u[e+1].start)))return{binding:o,operator:r};if(e>=2&&["++","--"].includes(T(e-2))){let d=u[e-3],s=d&&(d.kind==="word"||d.kind==="quoted"||[")","]"].includes(f(e-3)));if(!d||!s||/[\r\n;]/.test(g.slice(d.end,u[e-2].start)))return{binding:o,operator:T(e-2)}}return}function ee(e){let o=N(e);return o?.operator==="="?o.binding:void 0}function ne(e){if(u[e]?.kind!=="word"||f(e)!=="class"||f(e-1)==="."||["(",":","="].includes(f(e+1)))return;let o=e+1,r=0;while(o<u.length){let d=f(o);if(d==="{"&&r===0)return o;if(d==="class"){let s=ne(o);if(s!==void 0){o=(m.get(s)??s)+1;continue}}if(d==="function"){let s=se(o,u.length);if(s){o=s.end;continue}}if(d==="<")r++;else if(d===">"&&T(o-1)!=="=>"&&r>0)r--;if(d===";")break;o=(m.get(o)??o)+1}return}function te(e,o,r){let d=e,s=!1,a=r?["public","protected","private","static","abstract","override","declare","readonly","accessor","async","get","set"]:["async","get","set"];while(a.includes(f(d))&&!["(","<","?","!",":","=",";","}"].includes(f(d+1))){if(f(d)==="static")s=!0;d++}if(f(d)==="*")d++;if(r&&f(d)==="#")d++;if(f(d)==="["){let p=m.get(d);return p===void 0?void 0:{next:p+1,isStatic:s}}if(u[d]?.kind==="word"||u[d]?.kind==="quoted")return{next:d+1,isStatic:s};let l=d+1;while(l<o&&u[l-1].end===u[l].start&&!["(","<","?","!",":","=",";","}","[","{",","].includes(f(l)))l++;if(d<o&&n(g.slice(u[d].start,u[l-1].end),!1)==="number")return{next:l,isStatic:s};return}function P(e,o,r){let d=te(e,o,r);if(!d)return;let s=d.next;if(r&&["?","!"].includes(f(s)))s++;if(f(s)==="<"){let a=1;s++;while(s<o&&a>0){if(f(s)==="<")a++;else if(f(s)===">"&&T(s-1)!=="=>")a--;s=(m.get(s)??s)+1}if(a!==0)return}return s}function ie(e,o,r){return P(e,o,r)===o}function fe(e,o){let r=0,d=-1;for(let s=e;s<o;s=(m.get(s)??s)+1)if(f(s)==="<"&&(r>0||s>e&&(u[s-1].kind==="word"||[")","]"].includes(f(s-1))))){if(r===0)d=s;r++}else if(f(s)===">"&&T(s-1)!=="=>"&&r>0){if(r--,s===o-1&&r===0)return d<s-1}return!1}function ae(e,o){if(f(e)==="static"&&f(e+1)==="{")return!0;let r=P(e,o,!0);return r!==void 0&&(r===o||["(",":","=",";","}"].includes(f(r)))}function U(e,o,r=!1){let d=m.get(o)??u.length,s=e;while(s<d){if(f(s)===";"||r&&T(s)==="=")return s;if(s>e&&_.get(s)===o&&/[\r\n]/.test(g.slice(u[s-1].end,u[s].start))){let a=f(s-1),p=!(a===">"&&fe(e,s)&&ae(s,d))&&["+","-","*","/","%","=","<",">","&","|","^","!","~","?",":",",",".","(","[","{","as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","yield","void"].includes(a),M=[".","?",":",")","]","}",",","+","-","*","/","%","<",">","=","&","|","^","`","(","[","as","satisfies","instanceof","in"].includes(f(s));if(!p&&!M)return s}s=(m.get(s)??s)+1}return d}function V(e,o){for(let r=e;r<o;r++){if(f(r)==="["&&m.has(r)){r=m.get(r);continue}if(u[r].kind==="word")J.add(r)}}function le(e){let o=m.get(e)??u.length,r=e+1;while(r<o){if(f(r)===";"){r++;continue}if(f(r)==="static"&&f(r+1)==="{"){r=(m.get(r+1)??r+1)+1;continue}let d=te(r,o,!0);if(!d){r++;continue}let s=P(r,o,!0);if(s===void 0){r++;continue}if(V(r,s),f(s)==="("){let l=m.get(s),p=l===void 0?void 0:re(l,o);if(p!==void 0){r=(m.get(p)??p)+1;continue}}let a=s;if(f(a)===":")a=U(a+1,e,!0);if(T(a)==="="){V(r,a+1);let l=a+1,p=U(l,e);if(!d.isStatic&&p>l)Q.set(l,p);r=p}else{let l=U(s,e);V(r,l),r=Math.max(r+1,l)}}}function ce(e){let o=_.get(e);if(o===void 0)return!1;let r=L.has(o);if(!r&&!G.has(o))return!1;if(ie(o+1,e,r))return!0;for(let d=o+1;d<e;d++){let s=_.get(d),a=_.get(d)===o&&(f(d)===","||r&&f(d)===";"),l=r&&f(d)==="}"&&s!==void 0&&_.get(s)===o,p=r&&_.get(d+1)===o&&/[\r\n]/.test(g.slice(u[d].end,u[d+1].start));if((a||l||p)&&ie(d+1,e,r))return!0}return!1}function re(e,o){let r=e+1,d=f(r)===":"?r+1:void 0;while(r<o){if(f(r)==="{"&&(d===void 0||!Lt(g.slice(u[d].start,u[r].start))))return r;if(d===void 0)return;r=(m.get(r)??r)+1}return}function se(e,o){let r=-1;if(f(e)==="("){let s=m.get(e);if(s!==void 0&&ce(e))r=re(s,o)??-1;else if(s!==void 0&&T(s+1)==="=>")r=s+3;else if(s!==void 0&&f(s+1)===":"){let a=s+2;while(a<o&&f(a)!==";"){if(T(a)==="=>"){r=a+2;break}a=(m.get(a)??a)+1}}}else if(u[e]?.kind==="word"&&T(e+1)==="=>")r=e+3;else if(f(e)==="function"){let s=e+1;while(s<o&&f(s)!=="(")s=(m.get(s)??s)+1;let a=m.get(s);if(a===void 0)return;r=a+1;let l=f(r)===":"?r+1:void 0;while(r<o){if(f(r)==="{"&&(l===void 0||!Lt(g.slice(u[l].start,u[r].start))))break;r=(m.get(r)??r)+1}}if(r<0||r>=o)return;if(f(r)==="{")return{start:e,end:(m.get(r)??o-1)+1};let d=r;while(d<o&&![",",";",")","]","}"].includes(f(d)))d=(m.get(d)??d)+1;return{start:e,end:d}}function j(e,o,r=!0){for(let d=e;d<o;d++){let s=Q.get(d);if(s!==void 0){d=Math.min(s,o)-1;continue}let a=r?se(d,o):void 0;if(a){let p=a.end;while(f(p)===")")p++;if(f(p)==="("||f(p)==="."&&["call","apply"].includes(f(p+1))&&f(p+2)==="(")j(a.start,a.end,!1);d=a.end-1;continue}let l=N(d);if(l)l.binding.flow=void 0,l.binding.unresolved=!0}}function ue(e){let o=!1;while(h<u.length&&u[h].start<e){let r=f(h);if(["if","else","for","while","do","switch","try","catch","finally","with"].includes(r))o=!0;if(r===";")o=!1;if(r==="("||r==="{"||r==="["){let l=m.get(h)??h+1;while(l<u.length&&u[l].start>=e)l--;if(j(h+1,l),h=l+1,r==="{")o=!1;continue}let d=ee(h);if(d){let a=h+2,l=a,p=[];while(l<u.length&&u[l].start<e){let A=f(l);if(p.length===0&&(A===";"||l>a&&/[\r\n]/.test(g.slice(u[l-1].end,u[l].start))&&(ee(l)||["if","for","while","switch","try","do","return","throw"].includes(A))))break;if(A==="("||A==="{"||A==="[")p.push(A==="("?")":A==="{"?"}":"]");else if(A===p.at(-1))p.pop();l++}let M=l>a?g.slice(u[a].start,u[l-1].end):"";j(a,l);let z=Z(M);d.flow=!o&&z.type?d.declared?oe(d.declared,z.type):z.type:void 0,d.unresolved=o||z.unresolved||!d.flow,h=l;continue}let s=N(h);if(s)s.binding.flow=void 0,s.binding.unresolved=!0;h++}}for(let e of v){ue(e.start??0);let o=h;while(h<u.length&&u[h].start<(e.end??0))h++;if(e.kind!=="variable")continue;if(e.initializerStart!==void 0){let M=o;while(M<h&&u[M].start<e.initializerStart)M++;j(M,h)}let r=b.get(e.name);if(!r.active)continue;let d=typeof e.value==="string"?e.value:"";if(!d){r.flow=r.declared;continue}let s=Z(d),a=rt(d),l=a?b.get(a):void 0,p=X.get(e);if(p)e.inferredType=p,e.text=`${e.isExported?"export ":""}declare ${e.modifiers?.[0]??"const"} ${e.name}: ${p};`;else if(!e.typeAnnotation&&e.modifiers?.[0]==="const"&&a&&a!==e.name&&l){if(s.unresolved)e.inferenceError="DTSX_UNSUPPORTED_VALUE_FLOW";else if(s.type)e.inferredType=l.declared&&q(l.declared,s.type)?`typeof ${a}`:s.type,e.text=`${e.isExported?"export ":""}declare const ${e.name}: ${e.inferredType};`}if(e.typeAnnotation)r.flow=s.type?oe(e.typeAnnotation,s.type)??e.typeAnnotation:e.typeAnnotation;else if(e.inferredType)r.declared=e.inferredType,r.flow=e.inferredType;else{let M=e.modifiers?.[0]==="const",z=d.trim().startsWith("{")||d.trim().startsWith("["),A=n(d,M&&!z);r.declared=A==="unknown"?void 0:A,r.flow=r.declared}r.unresolved=s.unresolved}}
2
+ import{c,i}from"./chunk-8kj9pkw5.js";import{t,F}from"./chunk-g0dxj89b.js";import{rt,Lt}from"./chunk-zf96k060.js";import{y}from"./chunk-a2dn9j88.js";import{n}from"./chunk-3qx4ys4v.js";function q(g,w){let C=(D)=>t(D).map((b)=>D.slice(b.start,b.end)).join("");return C(g)===C(w)}function de(g){if(["number","string","boolean","bigint","symbol","undefined","null"].includes(g))return g;let w=n(g,!1);return["number","string","boolean","bigint","undefined","null"].includes(w)?w:void 0}function oe(g,w){if(q(g,w))return g;let C=de(w);if(!C)return;let D=t(g),b=0,v=0,B=[];for(let S of D){let k=g.slice(S.start,S.end);if(k==="("||k==="["||k==="{"||k==="<")b++;else if(k===")"||k==="]"||k==="}"||k===">")b--;else if(k==="|"&&b===0)B.push(g.slice(v,S.start).trim()),v=S.end}B.push(g.slice(v).trim());let O=B.find((S)=>q(S,w));if(O)return O;if(B.includes(C))return C==="boolean"&&(w==="true"||w==="false")?w:C;return}function jn(g,w,C,D=new Set){let b=new Map,v=[],B=new Set;for(let e of[...w,...C.values()]){if(B.has(e))continue;if(B.add(e),v.push(e),e.kind==="import")for(let o of y(e.text))b.set(o,{declared:`typeof ${o}`,flow:`typeof ${o}`,unresolved:!1});else if(["function","class","enum"].includes(e.kind))b.set(e.name,{declared:`typeof ${e.name}`,flow:`typeof ${e.name}`,unresolved:!1});else if(e.kind==="variable")b.set(e.name,{declared:e.typeAnnotation,unresolved:!1})}v.sort((e,o)=>(e.start??0)-(o.start??0));let O=new Set(v.filter((e)=>e.kind==="function"&&!e.generics).map((e)=>e.name));for(let e of D)O.add(e);let S=new Map,k=(e)=>{if(e=e.trimStart(),S.has(e))return S.get(e);if(S.set(e,void 0),!c(e.charCodeAt(0)))return;let o=1;while(i(e.charCodeAt(o)))o++;if(!O.has(e.slice(0,o)))return;let r=t(e);if(r[0]?.kind!=="word"||!r[1]||e.slice(r[1].start,r[1].end)!=="(")return;let d=1;for(let s=2;s<r.length;s++){let a=e.slice(r[s].start,r[s].end);if(a==="(")d++;else if(a===")"&&--d===0){let l=s===r.length-1?e.slice(r[0].start,r[0].end):void 0;return S.set(e,l),l}}return},E=new Set(v.filter((e)=>e.kind==="variable"&&!e.typeAnnotation&&typeof e.value==="string").map((e)=>k(e.value)).filter((e)=>e!==void 0)).size?F(g):void 0,x=new Map;if(E){let e=0;for(let o=0;o<E.length;o++){let r=g.slice(E[o].start,E[o].end);if(e===0&&r==="function"){let d=E[o+1],s=d&&g.slice(d.start,d.end)==="*"?E[o+2]:d;if(s?.kind==="word"){let a=g.slice(s.start,s.end);x.set(a,(x.get(a)??0)+1)}}if(["{","(","["].includes(r))e++;else if(["}",")","]"].includes(r))e--}}let R=new Map;for(let e of v)if(e.kind==="function"&&!e.generics&&x.get(e.name)===1)R.set(e.name,e);for(let e of D){let o=v.find((r)=>r.kind==="import"&&y(r.text).includes(e));if(o)R.set(e,o)}let W="__dtsx_call_result";while(g.includes(W))W+="_";let K=(e)=>`(typeof ${e}) extends (...args: never[]) => infer ${W} ? ${W} : never`,X=new Map,H=!1;for(let e of v){if(e.kind!=="variable"||e.typeAnnotation||typeof e.value!=="string")continue;let o=k(e.value);if(o&&R.has(o))X.set(e,K(o)),b.get(e.name).active=!0,b.get(o).active=!0,H=!0;if(e.modifiers?.[0]!=="const")continue;let r=rt(e.value);if(!r||r===e.name||!b.has(r))continue;b.get(r).active=!0,b.get(e.name).active=!0,H=!0}if(!H)return;let u=E??F(g),f=(e)=>u[e]?g.slice(u[e].start,u[e].end):"",m=new Map,_=new Map,G=new Set,L=new Set,J=new Set,Q=new Map,I=[];for(let e=0;e<u.length;e++){let o=f(e),r=I.at(-1);if(r!==void 0)_.set(e,r);if(o==="{"&&["=","(","[",",",":","?","return","yield"].includes(f(e-1)))G.add(e);if(["(","[","{"].includes(o))I.push(e);else if([")","]","}"].includes(o)){let d=I.at(-1);if(d!==void 0&&["()","[]","{}"].includes(f(d)+o))I.pop(),m.set(d,e)}}let Y=new Map;for(let e=0;e<u.length;){if(u[e].kind!=="punctuation"){e++;continue}let r=[">>>=","**=","&&=","||=","??=","<<=",">>=","===","!==",">>>","**","&&","||","??","<<",">>","=>","==","!=","<=",">=","++","--","+=","-=","*=","/=","%=","&=","|=","^=","="].find((s)=>g.startsWith(s,u[e].start))??f(e);Y.set(e,r);let d=u[e].start+r.length;do e++;while(e<u.length&&u[e].start<d)}for(let e=0;e<u.length;e++){let o=ne(e);if(o!==void 0)L.add(o)}for(let e of L)le(e);let h=0;function Z(e){let o=rt(e);if(o){let a=b.get(o);return{type:a?.flow,unresolved:a?.unresolved??!1}}let r=k(e),d=r?R.get(r):void 0;if(d)return{type:d.returnType&&de(d.returnType)?d.returnType:K(r),unresolved:!1};let s=n(e,!0);return{type:s==="unknown"?void 0:s,unresolved:!1}}function T(e){return Y.get(e)??""}function N(e){if(u[e]?.kind!=="word"||J.has(e)||f(e-1)==="."||f(e-1)==="#"&&f(e-2)===".")return;let o=b.get(f(e));if(!o?.active)return;let r=T(e+1);if(["=","+=","-=","*=","/=","%=","**=","<<=",">>=",">>>=","&=","|=","^=","&&=","||=","??="].includes(r))return{binding:o,operator:r};if(["++","--"].includes(r)&&!/[\r\n]/.test(g.slice(u[e].end,u[e+1].start)))return{binding:o,operator:r};if(e>=2&&["++","--"].includes(T(e-2))){let d=u[e-3],s=d&&(d.kind==="word"||d.kind==="quoted"||[")","]"].includes(f(e-3)));if(!d||!s||/[\r\n;]/.test(g.slice(d.end,u[e-2].start)))return{binding:o,operator:T(e-2)}}return}function ee(e){let o=N(e);return o?.operator==="="?o.binding:void 0}function ne(e){if(u[e]?.kind!=="word"||f(e)!=="class"||f(e-1)==="."||["(",":","="].includes(f(e+1)))return;let o=e+1,r=0;while(o<u.length){let d=f(o);if(d==="{"&&r===0)return o;if(d==="class"){let s=ne(o);if(s!==void 0){o=(m.get(s)??s)+1;continue}}if(d==="function"){let s=se(o,u.length);if(s){o=s.end;continue}}if(d==="<")r++;else if(d===">"&&T(o-1)!=="=>"&&r>0)r--;if(d===";")break;o=(m.get(o)??o)+1}return}function te(e,o,r){let d=e,s=!1,a=r?["public","protected","private","static","abstract","override","declare","readonly","accessor","async","get","set"]:["async","get","set"];while(a.includes(f(d))&&!["(","<","?","!",":","=",";","}"].includes(f(d+1))){if(f(d)==="static")s=!0;d++}if(f(d)==="*")d++;if(r&&f(d)==="#")d++;if(f(d)==="["){let p=m.get(d);return p===void 0?void 0:{next:p+1,isStatic:s}}if(u[d]?.kind==="word"||u[d]?.kind==="quoted")return{next:d+1,isStatic:s};let l=d+1;while(l<o&&u[l-1].end===u[l].start&&!["(","<","?","!",":","=",";","}","[","{",","].includes(f(l)))l++;if(d<o&&n(g.slice(u[d].start,u[l-1].end),!1)==="number")return{next:l,isStatic:s};return}function P(e,o,r){let d=te(e,o,r);if(!d)return;let s=d.next;if(r&&["?","!"].includes(f(s)))s++;if(f(s)==="<"){let a=1;s++;while(s<o&&a>0){if(f(s)==="<")a++;else if(f(s)===">"&&T(s-1)!=="=>")a--;s=(m.get(s)??s)+1}if(a!==0)return}return s}function ie(e,o,r){return P(e,o,r)===o}function fe(e,o){let r=0,d=-1;for(let s=e;s<o;s=(m.get(s)??s)+1)if(f(s)==="<"&&(r>0||s>e&&(u[s-1].kind==="word"||[")","]"].includes(f(s-1))))){if(r===0)d=s;r++}else if(f(s)===">"&&T(s-1)!=="=>"&&r>0){if(r--,s===o-1&&r===0)return d<s-1}return!1}function ae(e,o){if(f(e)==="static"&&f(e+1)==="{")return!0;let r=P(e,o,!0);return r!==void 0&&(r===o||["(",":","=",";","}"].includes(f(r)))}function U(e,o,r=!1){let d=m.get(o)??u.length,s=e;while(s<d){if(f(s)===";"||r&&T(s)==="=")return s;if(s>e&&_.get(s)===o&&/[\r\n]/.test(g.slice(u[s-1].end,u[s].start))){let a=f(s-1),p=!(a===">"&&fe(e,s)&&ae(s,d))&&["+","-","*","/","%","=","<",">","&","|","^","!","~","?",":",",",".","(","[","{","as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","yield","void"].includes(a),M=[".","?",":",")","]","}",",","+","-","*","/","%","<",">","=","&","|","^","`","(","[","as","satisfies","instanceof","in"].includes(f(s));if(!p&&!M)return s}s=(m.get(s)??s)+1}return d}function V(e,o){for(let r=e;r<o;r++){if(f(r)==="["&&m.has(r)){r=m.get(r);continue}if(u[r].kind==="word")J.add(r)}}function le(e){let o=m.get(e)??u.length,r=e+1;while(r<o){if(f(r)===";"){r++;continue}if(f(r)==="static"&&f(r+1)==="{"){r=(m.get(r+1)??r+1)+1;continue}let d=te(r,o,!0);if(!d){r++;continue}let s=P(r,o,!0);if(s===void 0){r++;continue}if(V(r,s),f(s)==="("){let l=m.get(s),p=l===void 0?void 0:re(l,o);if(p!==void 0){r=(m.get(p)??p)+1;continue}}let a=s;if(f(a)===":")a=U(a+1,e,!0);if(T(a)==="="){V(r,a+1);let l=a+1,p=U(l,e);if(!d.isStatic&&p>l)Q.set(l,p);r=p}else{let l=U(s,e);V(r,l),r=Math.max(r+1,l)}}}function ce(e){let o=_.get(e);if(o===void 0)return!1;let r=L.has(o);if(!r&&!G.has(o))return!1;if(ie(o+1,e,r))return!0;for(let d=o+1;d<e;d++){let s=_.get(d),a=_.get(d)===o&&(f(d)===","||r&&f(d)===";"),l=r&&f(d)==="}"&&s!==void 0&&_.get(s)===o,p=r&&_.get(d+1)===o&&/[\r\n]/.test(g.slice(u[d].end,u[d+1].start));if((a||l||p)&&ie(d+1,e,r))return!0}return!1}function re(e,o){let r=e+1,d=f(r)===":"?r+1:void 0;while(r<o){if(f(r)==="{"&&(d===void 0||!Lt(g.slice(u[d].start,u[r].start))))return r;if(d===void 0)return;r=(m.get(r)??r)+1}return}function se(e,o){let r=-1;if(f(e)==="("){let s=m.get(e);if(s!==void 0&&ce(e))r=re(s,o)??-1;else if(s!==void 0&&T(s+1)==="=>")r=s+3;else if(s!==void 0&&f(s+1)===":"){let a=s+2;while(a<o&&f(a)!==";"){if(T(a)==="=>"){r=a+2;break}a=(m.get(a)??a)+1}}}else if(u[e]?.kind==="word"&&T(e+1)==="=>")r=e+3;else if(f(e)==="function"){let s=e+1;while(s<o&&f(s)!=="(")s=(m.get(s)??s)+1;let a=m.get(s);if(a===void 0)return;r=a+1;let l=f(r)===":"?r+1:void 0;while(r<o){if(f(r)==="{"&&(l===void 0||!Lt(g.slice(u[l].start,u[r].start))))break;r=(m.get(r)??r)+1}}if(r<0||r>=o)return;if(f(r)==="{")return{start:e,end:(m.get(r)??o-1)+1};let d=r;while(d<o&&![",",";",")","]","}"].includes(f(d)))d=(m.get(d)??d)+1;return{start:e,end:d}}function j(e,o,r=!0){for(let d=e;d<o;d++){let s=Q.get(d);if(s!==void 0){d=Math.min(s,o)-1;continue}let a=r?se(d,o):void 0;if(a){let p=a.end;while(f(p)===")")p++;if(f(p)==="("||f(p)==="."&&["call","apply"].includes(f(p+1))&&f(p+2)==="(")j(a.start,a.end,!1);d=a.end-1;continue}let l=N(d);if(l)l.binding.flow=void 0,l.binding.unresolved=!0}}function ue(e){let o=!1;while(h<u.length&&u[h].start<e){let r=f(h);if(["if","else","for","while","do","switch","try","catch","finally","with"].includes(r))o=!0;if(r===";")o=!1;if(r==="("||r==="{"||r==="["){let l=m.get(h)??h+1;while(l<u.length&&u[l].start>=e)l--;if(j(h+1,l),h=l+1,r==="{")o=!1;continue}let d=ee(h);if(d){let a=h+2,l=a,p=[];while(l<u.length&&u[l].start<e){let A=f(l);if(p.length===0&&(A===";"||l>a&&/[\r\n]/.test(g.slice(u[l-1].end,u[l].start))&&(ee(l)||["if","for","while","switch","try","do","return","throw"].includes(A))))break;if(A==="("||A==="{"||A==="[")p.push(A==="("?")":A==="{"?"}":"]");else if(A===p.at(-1))p.pop();l++}let M=l>a?g.slice(u[a].start,u[l-1].end):"";j(a,l);let z=Z(M);d.flow=!o&&z.type?d.declared?oe(d.declared,z.type):z.type:void 0,d.unresolved=o||z.unresolved||!d.flow,h=l;continue}let s=N(h);if(s)s.binding.flow=void 0,s.binding.unresolved=!0;h++}}for(let e of v){ue(e.start??0);let o=h;while(h<u.length&&u[h].start<(e.end??0))h++;if(e.kind!=="variable")continue;if(e.initializerStart!==void 0){let M=o;while(M<h&&u[M].start<e.initializerStart)M++;j(M,h)}let r=b.get(e.name);if(!r.active)continue;let d=typeof e.value==="string"?e.value:"";if(!d){r.flow=r.declared;continue}let s=Z(d),a=rt(d),l=a?b.get(a):void 0,p=X.get(e);if(p)e.inferredType=p,e.text=`${e.isExported?"export ":""}declare ${e.modifiers?.[0]??"const"} ${e.name}: ${p};`;else if(!e.typeAnnotation&&e.modifiers?.[0]==="const"&&a&&a!==e.name&&l){if(s.unresolved)e.inferenceError="DTSX_UNSUPPORTED_VALUE_FLOW";else if(s.type)e.inferredType=l.declared&&q(l.declared,s.type)?`typeof ${a}`:s.type,e.text=`${e.isExported?"export ":""}declare const ${e.name}: ${e.inferredType};`}if(e.typeAnnotation)r.flow=s.type?oe(e.typeAnnotation,s.type)??e.typeAnnotation:e.typeAnnotation;else if(e.inferredType)r.declared=e.inferredType,r.flow=e.inferredType;else{let M=e.modifiers?.[0]==="const",z=d.trim().startsWith("{")||d.trim().startsWith("["),A=n(d,M&&!z);r.declared=A==="unknown"?void 0:A,r.flow=r.declared}r.unresolved=s.unresolved}}
3
3
  export{jn};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{_,Hn,Kn}from"./chunk-zf96k060.js";import{bn}from"./chunk-veh8ks5v.js";import{f}from"./chunk-a3apthex.js";import{re,h,ie,se,oe,ae,ce}from"./chunk-qnwcsmsg.js";import{Pe,b}from"./chunk-a2dn9j88.js";import{$e}from"./chunk-8qvphjgv.js";function V(k,x){throw Error(x||`Unexpected value: ${k}`)}var j=null,q=[],z=[];function l(k,x,d=!0,y=["bun"]){let o="",m=x.sourceCode;if(m){let e=0;while(e<m.length&&(m.charCodeAt(e)===32||m.charCodeAt(e)===9||m.charCodeAt(e)===10||m.charCodeAt(e)===13))e++;if(e<m.length-2&&m.charCodeAt(e)===47&&m.charCodeAt(e+1)===47&&m.charCodeAt(e+2)===47){let i=bn(m);if(i.length>0)for(let r=0;r<i.length;r++){if(o)o+=`
2
+ import{_,Hn,Kn}from"./chunk-zf96k060.js";import{bn}from"./chunk-veh8ks5v.js";import{f}from"./chunk-a3apthex.js";import{re,h,ie,se,oe,ae,ce}from"./chunk-q76b61w9.js";import{Pe,b}from"./chunk-a2dn9j88.js";import{$e}from"./chunk-298wqs3n.js";function V(k,x){throw Error(x||`Unexpected value: ${k}`)}var j=null,q=[],z=[];function l(k,x,d=!0,y=["bun"]){let o="",m=x.sourceCode;if(m){let e=0;while(e<m.length&&(m.charCodeAt(e)===32||m.charCodeAt(e)===9||m.charCodeAt(e)===10||m.charCodeAt(e)===13))e++;if(e<m.length-2&&m.charCodeAt(e)===47&&m.charCodeAt(e+1)===47&&m.charCodeAt(e+2)===47){let i=bn(m);if(i.length>0)for(let r=0;r<i.length;r++){if(o)o+=`
3
3
  `;o+=i[r]}}}let w=[],N=[],M=[],P=[],U=[],W=[],F=[],C=[],T=[];for(let e of k){let i=e.kind;switch(i){case"import":w.push(e);break;case"function":N.push(e);break;case"variable":M.push(e);break;case"interface":P.push(e);break;case"type":U.push(e);break;case"class":W.push(e);break;case"enum":F.push(e);break;case"module":C.push(e);break;case"export":T.push(e);break;case"namespace":C.push(e);break;case"unknown":break;default:V(i,`Unhandled declaration kind: ${i}`)}}let S=[],v=[],A=[],K=new Set;for(let e of T){let i=f(e.leadingComments,d);if(e.text.startsWith("export default")){let r=e.text.endsWith(";")?e.text:`${e.text};`;A.push(i+r)}else{let r=e.text.trim();if(!r.endsWith(";"))r+=";";let a=i+r;if(!K.has(a))if(K.add(a),a.includes("export type"))S.push(a);else v.push(a)}}let u=[];if(w.length>0){let{usedItems:e}=$e(k);for(let r of w){if(r.isSideEffect){let t=r.text.trim(),p=t.endsWith(";")?t:`${t};`;u.push(p);continue}let a=b(r.text);if(!a)continue;let{defaultName:s,namedItems:n,isTypeOnly:g,namespaceName:c}=a,D=s?e.has(s):!1,L=c?e.has(c):!1;if(a.isImportEquals){if(D){let t=r.text.trim();u.push(t.endsWith(";")?t:`${t};`)}else if(x.augmentationImports?.has(a.source)){let t=Pe(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}continue}let I="",E=0;for(let t=0;t<n.length;t++){let p=n[t];if(e.has(p.name)){if(E>0)I+=", ";if(!g&&p.isTypeOnly)I+="type ";I+=p.originalName===p.name?p.name:`${p.originalName} as ${p.name}`,E++}}if(D||L||E>0){let t=g?"import type ":"import ";if(L&&c){if(D&&s)t+=`${s}, `;t+=`* as ${c}`}else if(D&&s)t+=E>0?`${s}, { ${I} }`:s;else if(E>0)t+=`{ ${I} }`;let p=Pe(r.text);if(!p)throw Error("Cannot locate a grammatical module literal in the import declaration");t+=` from ${p};`,u.push(t)}else if(x.augmentationImports?.has(a.source)){let t=Pe(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}}let i=y.length;if(u.length>1){if(j!==y)j=y,q=y.map((n)=>`from '${n}`),z=y.map((n)=>`from "${n}`);let r=q,a=z,s=new Map;for(let n of u){let g=i;for(let c=0;c<y.length;c++)if(n.includes(r[c])||n.includes(a[c])){g=c;break}s.set(n,g)}u.sort((n,g)=>{let c=s.get(n),D=s.get(g);return c!==D?c-D:n.localeCompare(g)})}}for(let e=0;e<u.length;e++){if(o)o+=`
4
4
  `;o+=u[e]}for(let e=0;e<S.length;e++){if(o)o+=`
5
5
  `;o+=S[e]}let G=[N,M,P,U,W,F,C];for(let e=0;e<G.length;e++){let i=G[e];for(let r=0;r<i.length;r++){let a=i[r],s="",n=a.kind;switch(n){case"function":s=re(a,d);break;case"variable":s=h(a,d);break;case"interface":s=ie(a,d);break;case"type":s=se(a,d);break;case"class":s=oe(a,d);break;case"enum":s=ae(a,d);break;case"module":case"namespace":s=ce(a,d);break;case"import":case"export":case"unknown":break;default:V(n,`Unhandled declaration kind in processor: ${n}`)}if(s){if(o)o+=`
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,F}from"./chunk-g0dxj89b.js";import{n}from"./chunk-8g4wk8mm.js";function Nn(p,y,D,k){let r=new Map,i=new Map;for(let e of[...y,...D.values(),...[...k.values()].flat()])if(r.set(e.name,e),e.kind==="function"&&!i.has(e.name))i.set(e.name,e);for(let[e,o]of k)if(o.length)i.set(e,o[0]);if(!i.size)return;let u=new Set;for(let[e,o]of k)if(o.length>1)u.add(e);let a=new Map;for(let e of y)if(e.kind==="function"){let o=(a.get(e.name)??0)+1;if(a.set(e.name,o),o>1)u.add(e.name)}let s=F(p),d=(e)=>s[e]?p.slice(s[e].start,s[e].end):"",g=new Map,h=0;for(let e=0;e<s.length;e++){let o=s[e];if(o.kind==="punctuation"){let l=p.charCodeAt(o.start);if(l===40||l===91||l===123)h++;else if(l===41||l===93||l===125)h--;continue}if(h||s[e+2]?.kind!=="word"||d(e+1)!=="."||d(e+3)!=="=")continue;let c=d(e);if(!i.has(c))continue;let b=d(e+2),x=e+4,f=x,m=0;for(;f<s.length;f++){let l=d(f);if(!m&&l===";")break;if(!m&&f>x&&/[\r\n]/.test(p.slice(s[f-1].end,s[f].start))&&(["export","const","let","var","function","class"].includes(l)||i.has(l)&&d(f+1)==="."))break;if(["(","[","{"].includes(l))m++;else if([")","]","}"].includes(l))m--}if(f===x)continue;let w=A(p.slice(s[x].start,s[f-1].end),r,u),M=g.get(c);if(!M)g.set(c,M=new Map);let v=M.get(b);if(!v)M.set(b,v=[]);if(!v.includes(w))v.push(w);e=f-1}for(let[e,o]of g){let c=i.get(e),b=[...o].map(([f,m])=>` let ${f}: ${m.map((w)=>w.includes("=>")&&m.length>1?`(${w})`:w).join(" | ")};`).join(`
2
+ import{t,F}from"./chunk-g0dxj89b.js";import{n}from"./chunk-3qx4ys4v.js";function Nn(p,y,D,k){let r=new Map,i=new Map;for(let e of[...y,...D.values(),...[...k.values()].flat()])if(r.set(e.name,e),e.kind==="function"&&!i.has(e.name))i.set(e.name,e);for(let[e,o]of k)if(o.length)i.set(e,o[0]);if(!i.size)return;let u=new Set;for(let[e,o]of k)if(o.length>1)u.add(e);let a=new Map;for(let e of y)if(e.kind==="function"){let o=(a.get(e.name)??0)+1;if(a.set(e.name,o),o>1)u.add(e.name)}let s=F(p),d=(e)=>s[e]?p.slice(s[e].start,s[e].end):"",g=new Map,h=0;for(let e=0;e<s.length;e++){let o=s[e];if(o.kind==="punctuation"){let l=p.charCodeAt(o.start);if(l===40||l===91||l===123)h++;else if(l===41||l===93||l===125)h--;continue}if(h||s[e+2]?.kind!=="word"||d(e+1)!=="."||d(e+3)!=="=")continue;let c=d(e);if(!i.has(c))continue;let b=d(e+2),x=e+4,f=x,m=0;for(;f<s.length;f++){let l=d(f);if(!m&&l===";")break;if(!m&&f>x&&/[\r\n]/.test(p.slice(s[f-1].end,s[f].start))&&(["export","const","let","var","function","class"].includes(l)||i.has(l)&&d(f+1)==="."))break;if(["(","[","{"].includes(l))m++;else if([")","]","}"].includes(l))m--}if(f===x)continue;let w=A(p.slice(s[x].start,s[f-1].end),r,u),M=g.get(c);if(!M)g.set(c,M=new Map);let v=M.get(b);if(!v)M.set(b,v=[]);if(!v.includes(w))v.push(w);e=f-1}for(let[e,o]of g){let c=i.get(e),b=[...o].map(([f,m])=>` let ${f}: ${m.map((w)=>w.includes("=>")&&m.length>1?`(${w})`:w).join(" | ")};`).join(`
3
3
  `),x=c.isExported&&!c.isDefault?"export ":"";if(c.isDefault)c.text=c.text.replace("export default function ","declare function ");if(c.text+=`
4
4
  ${x}declare namespace ${e} {
5
5
  ${b}
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,d}from"./chunk-g0dxj89b.js";import{_}from"./chunk-zf96k060.js";import{It}from"./chunk-epjq1edf.js";import{b}from"./chunk-a2dn9j88.js";import{Q}from"./chunk-7khy25x0.js";import{relative as O}from"path";function J(n){let y=t(n),c=(l)=>y[l]?n.slice(y[l].start,y[l].end):"",i=c(0)==="export"?1:0;if(c(i++)!=="declare")return;let f;if(c(i)==="module"&&y[i+1]?.kind==="quoted"){if(f=d(c(i+1)),f===void 0)return;i+=2}else if(c(i++)!=="global")return;if(c(i)!=="{")return;let h=y[i].end,S=1;for(i++;i<y.length;i++)if(c(i)==="{")S++;else if(c(i)==="}"&&--S===0)return{specifier:f,body:n.slice(h,y[i].start),start:h,end:y[i].start};return}var ne=/^[A-Z_$][\w$]*$/i;function Eo(n){let y=[],c=[],i=0,f=0,h=[],S=!1,l=0,E=n.length,R=(a)=>{let w=n.slice(i,a).trim();if(i=a,!w)return;if(se(w)){c.push(w);return}y.push({text:w,comments:c}),c=[]};while(l<E){let a=n[l];if(S){if(a==="\\"){l+=2;continue}if(a==="`"){S=!1,l++;continue}if(a==="$"&&n[l+1]==="{"){h.push(f),f++,S=!1,l+=2;continue}l++;continue}if(a==="/"&&n[l+1]==="*"){let w=n.indexOf("*/",l+2);l=w===-1?E:w+2;continue}if(a==="/"&&n[l+1]==="/"){let w=n.indexOf(`
2
+ import{t,d}from"./chunk-g0dxj89b.js";import{_}from"./chunk-zf96k060.js";import{It}from"./chunk-gc7y4wav.js";import{b}from"./chunk-a2dn9j88.js";import{Q}from"./chunk-7khy25x0.js";import{relative as O}from"path";function J(n){let y=t(n),c=(l)=>y[l]?n.slice(y[l].start,y[l].end):"",i=c(0)==="export"?1:0;if(c(i++)!=="declare")return;let f;if(c(i)==="module"&&y[i+1]?.kind==="quoted"){if(f=d(c(i+1)),f===void 0)return;i+=2}else if(c(i++)!=="global")return;if(c(i)!=="{")return;let h=y[i].end,S=1;for(i++;i<y.length;i++)if(c(i)==="{")S++;else if(c(i)==="}"&&--S===0)return{specifier:f,body:n.slice(h,y[i].start),start:h,end:y[i].start};return}var ne=/^[A-Z_$][\w$]*$/i;function Eo(n){let y=[],c=[],i=0,f=0,h=[],S=!1,l=0,E=n.length,R=(a)=>{let w=n.slice(i,a).trim();if(i=a,!w)return;if(se(w)){c.push(w);return}y.push({text:w,comments:c}),c=[]};while(l<E){let a=n[l];if(S){if(a==="\\"){l+=2;continue}if(a==="`"){S=!1,l++;continue}if(a==="$"&&n[l+1]==="{"){h.push(f),f++,S=!1,l+=2;continue}l++;continue}if(a==="/"&&n[l+1]==="*"){let w=n.indexOf("*/",l+2);l=w===-1?E:w+2;continue}if(a==="/"&&n[l+1]==="/"){let w=n.indexOf(`
3
3
  `,l);l=w===-1?E:w;continue}if(a==="'"||a==='"'){l++;while(l<E&&n[l]!==a&&n[l]!==`
4
4
  `){if(n[l]==="\\")l++;l++}l++;continue}if(a==="`"){S=!0,l++;continue}if(a==="("||a==="["||a==="{"){f++,l++;continue}if(a===")"||a==="]"||a==="}"){if(f--,h.length>0&&a==="}"&&f===h[h.length-1])h.pop(),S=!0;l++;continue}if(f===0&&a===";"){R(l+1),l++;continue}if(f===0&&a===`
5
5
  `){let w=n[l+1];if(w!==void 0&&/[\w$@/]/.test(w))R(l+1);l++;continue}l++}return R(E),y}function se(n){let y=0;while(y<n.length){while(y<n.length&&/\s/.test(n[y]))y++;if(y>=n.length)return!0;if(n.startsWith("//",y)){let c=n.indexOf(`
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{R,M}from"./chunk-2ngfncfx.js";import{P,D}from"./chunk-hqph3vnd.js";import{nr}from"./chunk-g0dxj89b.js";import{p}from"./chunk-v6fwy63g.js";import{T,O}from"./chunk-epjq1edf.js";var y=100,h=0,s=new Map;function Te(n,a,c=!0,i=!1,l){if(R(a))n=M(n);else if(P(a))n=D(n);let f=p(n),m=`${a}:${c?1:0}:${i?1:0}:${JSON.stringify([...l??[]].sort())}`,r=s.get(m);if(r&&r.contentHash===f)return r.lastAccess=++h,r.declarations;let g=i?T(n,a,c):O(n,a,c,l);if(s.set(m,{declarations:g,contentHash:f,lastAccess:++h}),s.size>y){let S=Math.max(1,Math.ceil(s.size*0.1)),e=[];for(let[t,o]of s)e.push([t,o.lastAccess]);e.sort((t,o)=>t[1]-o[1]);for(let t=0;t<S&&t<e.length;t++)s.delete(e[t][0])}return g}function Rn(){s.clear(),nr()}
2
+ import{R,M}from"./chunk-2ngfncfx.js";import{P,D}from"./chunk-hqph3vnd.js";import{nr}from"./chunk-g0dxj89b.js";import{p}from"./chunk-v6fwy63g.js";import{T,O}from"./chunk-gc7y4wav.js";var y=100,h=0,s=new Map;function Te(n,a,c=!0,i=!1,l){if(R(a))n=M(n);else if(P(a))n=D(n);let f=p(n),m=`${a}:${c?1:0}:${i?1:0}:${JSON.stringify([...l??[]].sort())}`,r=s.get(m);if(r&&r.contentHash===f)return r.lastAccess=++h,r.declarations;let g=i?T(n,a,c):O(n,a,c,l);if(s.set(m,{declarations:g,contentHash:f,lastAccess:++h}),s.size>y){let S=Math.max(1,Math.ceil(s.size*0.1)),e=[];for(let[t,o]of s)e.push([t,o.lastAccess]);e.sort((t,o)=>t[1]-o[1]);for(let t=0;t<S&&t<e.length;t++)s.delete(e[t][0])}return g}function Rn(){s.clear(),nr()}
3
3
  export{Te,Rn};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Xo,Se}from"../chunk-01jwgm2m.js";import"../chunk-8qvphjgv.js";import"../chunk-85d82vn3.js";import"../chunk-xmj05115.js";import"../chunk-5mbfgcvp.js";import"../chunk-hqph3vnd.js";import"../chunk-2ngfncfx.js";import"../chunk-7387m006.js";import"../chunk-k5wz43yh.js";import"../chunk-v6fwy63g.js";import"../chunk-epjq1edf.js";import"../chunk-w8ws29dq.js";import"../chunk-7g0hjhqy.js";import"../chunk-qnwcsmsg.js";import"../chunk-df8p90w4.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-8g4wk8mm.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{Se as planAugmentationImports,Xo as scanModuleAugmentations};
2
+ import{Xo,Se}from"../chunk-54d8mt4c.js";import"../chunk-298wqs3n.js";import"../chunk-85d82vn3.js";import"../chunk-q4fhsthj.js";import"../chunk-zy5jxjmg.js";import"../chunk-hqph3vnd.js";import"../chunk-2ngfncfx.js";import"../chunk-7387m006.js";import"../chunk-k5wz43yh.js";import"../chunk-v6fwy63g.js";import"../chunk-gc7y4wav.js";import"../chunk-x4qkjqda.js";import"../chunk-7g0hjhqy.js";import"../chunk-q76b61w9.js";import"../chunk-t8cgznk6.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-3qx4ys4v.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{Se as planAugmentationImports,Xo as scanModuleAugmentations};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Eo,qe,vn}from"../chunk-9pharkp0.js";import"../chunk-7khy25x0.js";import"../chunk-w3zqfm8a.js";import"../chunk-bkbsg2bv.js";import"../chunk-85d82vn3.js";import"../chunk-btc6zbyj.js";import"../chunk-epjq1edf.js";import"../chunk-w8ws29dq.js";import"../chunk-7g0hjhqy.js";import"../chunk-qnwcsmsg.js";import"../chunk-df8p90w4.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-8g4wk8mm.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{vn as linkBundle,qe as renameIdentifiers,Eo as splitTopLevelStatements};
2
+ import{Eo,qe,vn}from"../chunk-zbyvnsny.js";import"../chunk-7khy25x0.js";import"../chunk-w3zqfm8a.js";import"../chunk-bkbsg2bv.js";import"../chunk-85d82vn3.js";import"../chunk-btc6zbyj.js";import"../chunk-gc7y4wav.js";import"../chunk-x4qkjqda.js";import"../chunk-7g0hjhqy.js";import"../chunk-q76b61w9.js";import"../chunk-t8cgznk6.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-3qx4ys4v.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{vn as linkBundle,qe as renameIdentifiers,Eo as splitTopLevelStatements};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ls,Kt,wr,us,fs}from"../chunk-059gzhxc.js";import"../chunk-xmj05115.js";import"../chunk-5mbfgcvp.js";import"../chunk-hqph3vnd.js";import"../chunk-2ngfncfx.js";import"../chunk-7387m006.js";import"../chunk-k5wz43yh.js";import"../chunk-v6fwy63g.js";import"../chunk-epjq1edf.js";import"../chunk-w8ws29dq.js";import"../chunk-7g0hjhqy.js";import"../chunk-qnwcsmsg.js";import"../chunk-df8p90w4.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-8g4wk8mm.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{wr as bundleAndWrite,ls as bundleDeclarations,Kt as bundleDtsFiles,us as createBundler,fs as resolveEntryFiles};
2
+ import{ls,Kt,wr,us,fs}from"../chunk-gv9brtta.js";import"../chunk-q4fhsthj.js";import"../chunk-zy5jxjmg.js";import"../chunk-hqph3vnd.js";import"../chunk-2ngfncfx.js";import"../chunk-7387m006.js";import"../chunk-k5wz43yh.js";import"../chunk-v6fwy63g.js";import"../chunk-gc7y4wav.js";import"../chunk-x4qkjqda.js";import"../chunk-7g0hjhqy.js";import"../chunk-q76b61w9.js";import"../chunk-t8cgznk6.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-3qx4ys4v.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{wr as bundleAndWrite,ls as bundleDeclarations,Kt as bundleDtsFiles,us as createBundler,fs as resolveEntryFiles};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Cr,vr,ds,ps,ms,gs,hs,ys,bs}from"../chunk-jfsj0sd2.js";import"../chunk-xmj05115.js";import"../chunk-5mbfgcvp.js";import"../chunk-hqph3vnd.js";import"../chunk-2ngfncfx.js";import"../chunk-7387m006.js";import"../chunk-k5wz43yh.js";import"../chunk-v6fwy63g.js";import"../chunk-epjq1edf.js";import"../chunk-w8ws29dq.js";import"../chunk-7g0hjhqy.js";import"../chunk-qnwcsmsg.js";import"../chunk-df8p90w4.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-8g4wk8mm.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{ds as analyzeCircularDependencies,Cr as buildDependencyGraph,vr as detectCircularDependencies,ys as exportGraphAsDot,bs as exportGraphAsJson,hs as findAllDependencies,gs as findAllDependents,ps as formatCircularAnalysis,ms as getGraphSummary};
2
+ import{Cr,vr,ds,ps,ms,gs,hs,ys,bs}from"../chunk-bre2x1bd.js";import"../chunk-q4fhsthj.js";import"../chunk-zy5jxjmg.js";import"../chunk-hqph3vnd.js";import"../chunk-2ngfncfx.js";import"../chunk-7387m006.js";import"../chunk-k5wz43yh.js";import"../chunk-v6fwy63g.js";import"../chunk-gc7y4wav.js";import"../chunk-x4qkjqda.js";import"../chunk-7g0hjhqy.js";import"../chunk-q76b61w9.js";import"../chunk-t8cgznk6.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-3qx4ys4v.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{ds as analyzeCircularDependencies,Cr as buildDependencyGraph,vr as detectCircularDependencies,ys as exportGraphAsDot,bs as exportGraphAsJson,hs as findAllDependencies,gs as findAllDependents,ps as formatCircularAnalysis,ms as getGraphSummary};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ce,Z,S,V,Yo,ve}from"../chunk-q4ph9qa2.js";import"../chunk-01jwgm2m.js";import"../chunk-8qvphjgv.js";import"../chunk-7khy25x0.js";import"../chunk-w3zqfm8a.js";import"../chunk-bkbsg2bv.js";import"../chunk-85d82vn3.js";import"../chunk-btc6zbyj.js";import"../chunk-xmj05115.js";import"../chunk-5mbfgcvp.js";import"../chunk-hqph3vnd.js";import"../chunk-2ngfncfx.js";import"../chunk-7387m006.js";import"../chunk-k5wz43yh.js";import"../chunk-v6fwy63g.js";import"../chunk-epjq1edf.js";import"../chunk-w8ws29dq.js";import"../chunk-7g0hjhqy.js";import"../chunk-qnwcsmsg.js";import"../chunk-df8p90w4.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-8g4wk8mm.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{ve as createDeclarationReferenceResolver,V as getDeclarationOutputPath,Yo as getDeclarationSpecifier,Z as isExcluded,S as isWithinRoot,Ce as planDeclarationProject};
2
+ import{Ce,Z,S,V,Yo,ve}from"../chunk-pd30356m.js";import"../chunk-54d8mt4c.js";import"../chunk-298wqs3n.js";import"../chunk-7khy25x0.js";import"../chunk-w3zqfm8a.js";import"../chunk-bkbsg2bv.js";import"../chunk-85d82vn3.js";import"../chunk-btc6zbyj.js";import"../chunk-q4fhsthj.js";import"../chunk-zy5jxjmg.js";import"../chunk-hqph3vnd.js";import"../chunk-2ngfncfx.js";import"../chunk-7387m006.js";import"../chunk-k5wz43yh.js";import"../chunk-v6fwy63g.js";import"../chunk-gc7y4wav.js";import"../chunk-x4qkjqda.js";import"../chunk-7g0hjhqy.js";import"../chunk-q76b61w9.js";import"../chunk-t8cgznk6.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-3qx4ys4v.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{ve as createDeclarationReferenceResolver,V as getDeclarationOutputPath,Yo as getDeclarationSpecifier,Z as isExcluded,S as isWithinRoot,Ce as planDeclarationProject};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{q,he}from"../chunk-2ck79rny.js";import"../chunk-13tjnp25.js";import"../chunk-vae5wxar.js";import"../chunk-7bt7x8sy.js";import"../chunk-9gp0e3kn.js";import"../chunk-q4ph9qa2.js";import"../chunk-01jwgm2m.js";import"../chunk-8qvphjgv.js";import"../chunk-60wrxcjt.js";import"../chunk-7khy25x0.js";import"../chunk-w3zqfm8a.js";import"../chunk-bkbsg2bv.js";import"../chunk-85d82vn3.js";import"../chunk-btc6zbyj.js";import"../chunk-xmj05115.js";import"../chunk-5mbfgcvp.js";import"../chunk-hqph3vnd.js";import"../chunk-2ngfncfx.js";import"../chunk-7387m006.js";import"../chunk-k5wz43yh.js";import"../chunk-v6fwy63g.js";import"../chunk-epjq1edf.js";import"../chunk-w8ws29dq.js";import"../chunk-7g0hjhqy.js";import"../chunk-qnwcsmsg.js";import"../chunk-df8p90w4.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-8g4wk8mm.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{q as assertSafeOutputConfiguration,he as publishDeclarationOutputs};
2
+ import{q,he}from"../chunk-prst4szw.js";import"../chunk-13tjnp25.js";import"../chunk-vae5wxar.js";import"../chunk-7bt7x8sy.js";import"../chunk-9gp0e3kn.js";import"../chunk-pd30356m.js";import"../chunk-54d8mt4c.js";import"../chunk-298wqs3n.js";import"../chunk-60wrxcjt.js";import"../chunk-7khy25x0.js";import"../chunk-w3zqfm8a.js";import"../chunk-bkbsg2bv.js";import"../chunk-85d82vn3.js";import"../chunk-btc6zbyj.js";import"../chunk-q4fhsthj.js";import"../chunk-zy5jxjmg.js";import"../chunk-hqph3vnd.js";import"../chunk-2ngfncfx.js";import"../chunk-7387m006.js";import"../chunk-k5wz43yh.js";import"../chunk-v6fwy63g.js";import"../chunk-gc7y4wav.js";import"../chunk-x4qkjqda.js";import"../chunk-7g0hjhqy.js";import"../chunk-q76b61w9.js";import"../chunk-t8cgznk6.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-3qx4ys4v.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{q as assertSafeOutputConfiguration,he as publishDeclarationOutputs};
package/dist/src/docs.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Zt,Qt,je,en,tn,Dr,Rs,Ms}from"../chunk-v55m1ae1.js";import"../chunk-btc6zbyj.js";import"../chunk-xmj05115.js";import"../chunk-5mbfgcvp.js";import"../chunk-hqph3vnd.js";import"../chunk-2ngfncfx.js";import"../chunk-7387m006.js";import"../chunk-k5wz43yh.js";import"../chunk-v6fwy63g.js";import"../chunk-epjq1edf.js";import"../chunk-w8ws29dq.js";import"../chunk-7g0hjhqy.js";import"../chunk-qnwcsmsg.js";import"../chunk-df8p90w4.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-8g4wk8mm.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{Ms as createDocsGenerator,Qt as extractDocumentation,Rs as generateDocs,en as generateHTML,tn as generateJSON,je as generateMarkdown,Dr as generateTypeDocJSON,Zt as parseJSDoc};
2
+ import{Zt,Qt,je,en,tn,Dr,Rs,Ms}from"../chunk-r27pfg4r.js";import"../chunk-btc6zbyj.js";import"../chunk-q4fhsthj.js";import"../chunk-zy5jxjmg.js";import"../chunk-hqph3vnd.js";import"../chunk-2ngfncfx.js";import"../chunk-7387m006.js";import"../chunk-k5wz43yh.js";import"../chunk-v6fwy63g.js";import"../chunk-gc7y4wav.js";import"../chunk-x4qkjqda.js";import"../chunk-7g0hjhqy.js";import"../chunk-q76b61w9.js";import"../chunk-t8cgznk6.js";import"../chunk-a2dn9j88.js";import"../chunk-kv3x5jrs.js";import"../chunk-zf96k060.js";import"../chunk-3qx4ys4v.js";import"../chunk-a3apthex.js";import"../chunk-fv3x086v.js";import"../chunk-8wk7nw3c.js";import"../chunk-73qsp464.js";import"../chunk-ywv56grs.js";import"../chunk-g0dxj89b.js";import"../chunk-8kj9pkw5.js";export{Ms as createDocsGenerator,Qt as extractDocumentation,Rs as generateDocs,en as generateHTML,tn as generateJSON,je as generateMarkdown,Dr as generateTypeDocJSON,Zt as parseJSDoc};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Te,Rn}from"../../chunk-5mbfgcvp.js";import"../../chunk-hqph3vnd.js";import"../../chunk-2ngfncfx.js";import"../../chunk-v6fwy63g.js";import"../../chunk-epjq1edf.js";import"../../chunk-w8ws29dq.js";import"../../chunk-7g0hjhqy.js";import"../../chunk-qnwcsmsg.js";import"../../chunk-df8p90w4.js";import"../../chunk-a2dn9j88.js";import"../../chunk-kv3x5jrs.js";import"../../chunk-zf96k060.js";import"../../chunk-8g4wk8mm.js";import"../../chunk-a3apthex.js";import"../../chunk-fv3x086v.js";import"../../chunk-8wk7nw3c.js";import"../../chunk-73qsp464.js";import"../../chunk-ywv56grs.js";import"../../chunk-g0dxj89b.js";import"../../chunk-8kj9pkw5.js";export{Rn as clearDeclarationCache,Te as extractDeclarations};
2
+ import{Te,Rn}from"../../chunk-zy5jxjmg.js";import"../../chunk-hqph3vnd.js";import"../../chunk-2ngfncfx.js";import"../../chunk-v6fwy63g.js";import"../../chunk-gc7y4wav.js";import"../../chunk-x4qkjqda.js";import"../../chunk-7g0hjhqy.js";import"../../chunk-q76b61w9.js";import"../../chunk-t8cgznk6.js";import"../../chunk-a2dn9j88.js";import"../../chunk-kv3x5jrs.js";import"../../chunk-zf96k060.js";import"../../chunk-3qx4ys4v.js";import"../../chunk-a3apthex.js";import"../../chunk-fv3x086v.js";import"../../chunk-8wk7nw3c.js";import"../../chunk-73qsp464.js";import"../../chunk-ywv56grs.js";import"../../chunk-g0dxj89b.js";import"../../chunk-8kj9pkw5.js";export{Rn as clearDeclarationCache,Te as extractDeclarations};