@dtsx/dtsx 0.11.48 → 0.11.51

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 (130) hide show
  1. package/dist/bin/cli.js +1 -1
  2. package/dist/{chunk-8qpzh9yc.js → chunk-0v6vmemf.js} +3 -3
  3. package/dist/{chunk-4e02xmrg.js → chunk-19626hwq.js} +2 -2
  4. package/dist/{chunk-mjaf2je8.js → chunk-1jmwmc2a.js} +1 -1
  5. package/dist/{chunk-znsgvx9t.js → chunk-2q641ekp.js} +1 -1
  6. package/dist/{chunk-1dnqddk9.js → chunk-3e6q952c.js} +1 -1
  7. package/dist/{chunk-qmg1535a.js → chunk-3mp0jaa7.js} +2 -2
  8. package/dist/{chunk-bxjswrak.js → chunk-3z75j224.js} +2 -2
  9. package/dist/{chunk-nqdc6n5d.js → chunk-4nrrjn7g.js} +15 -15
  10. package/dist/{chunk-29m9mhwt.js → chunk-4sasxrdr.js} +2 -2
  11. package/dist/{chunk-ex02f2vm.js → chunk-4xvx77zs.js} +6 -6
  12. package/dist/{chunk-adhnnbe1.js → chunk-5mh2gqd4.js} +1 -1
  13. package/dist/{chunk-8hwmssy9.js → chunk-5ym0xgg0.js} +1 -1
  14. package/dist/{chunk-nf10pph8.js → chunk-6e5dyfx2.js} +2 -2
  15. package/dist/{chunk-d0dbet9n.js → chunk-6ekgn7sc.js} +3 -3
  16. package/dist/{chunk-hzybfasv.js → chunk-7ryea8wn.js} +1 -1
  17. package/dist/{chunk-r2h572w9.js → chunk-7xgwvv94.js} +1 -1
  18. package/dist/{chunk-pp9aevcb.js → chunk-90jwk3zy.js} +2 -2
  19. package/dist/{chunk-rnvqc8st.js → chunk-937czex4.js} +2 -2
  20. package/dist/{chunk-p458sykz.js → chunk-9b0jah2a.js} +1 -1
  21. package/dist/{chunk-jjdjk59m.js → chunk-9wxhpnya.js} +1 -1
  22. package/dist/{chunk-wrvgt39b.js → chunk-a04yhmwb.js} +1 -1
  23. package/dist/{chunk-h6ngkqg7.js → chunk-anr9ncep.js} +1 -1
  24. package/dist/{chunk-h5esm323.js → chunk-b6xcyrnx.js} +5 -5
  25. package/dist/{chunk-y3vhsctr.js → chunk-b7g1pyea.js} +3 -3
  26. package/dist/{chunk-rkdyetby.js → chunk-bj3r4j0a.js} +1 -1
  27. package/dist/{chunk-8dyz1cte.js → chunk-bkrftw1s.js} +3 -3
  28. package/dist/{chunk-fkngq7na.js → chunk-bsj770f8.js} +2 -2
  29. package/dist/chunk-cgqg1br8.js +5 -0
  30. package/dist/{chunk-cgz4sy6k.js → chunk-cq5zpg9c.js} +1 -1
  31. package/dist/{chunk-zerajrvv.js → chunk-cx4rq49z.js} +1 -1
  32. package/dist/{chunk-h2007n8k.js → chunk-cyzr3xat.js} +1 -1
  33. package/dist/{chunk-xs0ke3f2.js → chunk-czgjmefa.js} +3 -3
  34. package/dist/{chunk-agq858s0.js → chunk-dc0059dr.js} +1 -1
  35. package/dist/{chunk-qpahzkm0.js → chunk-dq0nmept.js} +1 -1
  36. package/dist/{chunk-gqk2s9wt.js → chunk-e29deb0h.js} +2 -2
  37. package/dist/{chunk-fn2xxavw.js → chunk-e4f5kxrh.js} +1 -1
  38. package/dist/{chunk-d27xpsa4.js → chunk-fjkswqq2.js} +1 -1
  39. package/dist/{chunk-w5m9qv5k.js → chunk-jkeqyj50.js} +1 -1
  40. package/dist/{chunk-pkdrq4sh.js → chunk-kf4sza0n.js} +1 -1
  41. package/dist/{chunk-kdz4gxdq.js → chunk-m7jndt3v.js} +4 -4
  42. package/dist/{chunk-475bjqea.js → chunk-m8w98p7p.js} +3 -3
  43. package/dist/chunk-m9b6cqn7.js +38 -0
  44. package/dist/{chunk-564pr6v4.js → chunk-n0tw6p7g.js} +1 -1
  45. package/dist/{chunk-x5bspdyq.js → chunk-p99myphf.js} +2 -2
  46. package/dist/{chunk-c87yyjv7.js → chunk-r9gdz351.js} +1 -1
  47. package/dist/chunk-sbmdk35p.js +4 -0
  48. package/dist/{chunk-atzh1g6f.js → chunk-t4cdpfrr.js} +1 -1
  49. package/dist/{chunk-4kn7y9ns.js → chunk-taa77k3y.js} +1 -1
  50. package/dist/{chunk-g4eb5tgt.js → chunk-tpjz15nc.js} +1 -1
  51. package/dist/{chunk-cgrta603.js → chunk-vekg5zy6.js} +1 -1
  52. package/dist/{chunk-0kvy1dh8.js → chunk-w60gzzxc.js} +2 -2
  53. package/dist/{chunk-zesjexqf.js → chunk-x67zh0tr.js} +1 -1
  54. package/dist/{chunk-689tfwjh.js → chunk-xph91r7p.js} +1 -1
  55. package/dist/{chunk-a8djrg2n.js → chunk-xsaw8abt.js} +2 -2
  56. package/dist/{chunk-vwn5fx4f.js → chunk-zbrj37wa.js} +1 -1
  57. package/dist/{chunk-vhna4qch.js → chunk-zpvcnc7c.js} +1 -1
  58. package/dist/src/augmentation-graph.js +1 -1
  59. package/dist/src/binding-patterns.js +1 -1
  60. package/dist/src/branded-types.js +1 -1
  61. package/dist/src/bundle-linker.js +1 -1
  62. package/dist/src/bundler.js +1 -1
  63. package/dist/src/cache.js +1 -1
  64. package/dist/src/call-signatures.js +1 -1
  65. package/dist/src/circular.js +1 -1
  66. package/dist/src/computed-keys.js +1 -1
  67. package/dist/src/config.js +1 -1
  68. package/dist/src/declaration-project.js +1 -1
  69. package/dist/src/declaration-publication.js +1 -1
  70. package/dist/src/declaration-references.d.ts +1 -1
  71. package/dist/src/declaration-references.js +1 -1
  72. package/dist/src/docs.js +1 -1
  73. package/dist/src/enum-declarations.js +1 -1
  74. package/dist/src/errors.js +1 -1
  75. package/dist/src/extractor/extract.js +1 -1
  76. package/dist/src/extractor/scanner.js +1 -1
  77. package/dist/src/extractor.js +1 -1
  78. package/dist/src/function-properties.js +1 -1
  79. package/dist/src/generator.js +1 -1
  80. package/dist/src/incremental.js +1 -1
  81. package/dist/src/index.js +1 -1
  82. package/dist/src/inferred-imports.js +1 -1
  83. package/dist/src/initializer-type-spans.js +1 -1
  84. package/dist/src/lexical.js +1 -1
  85. package/dist/src/logger.js +1 -1
  86. package/dist/src/lsp.js +1 -1
  87. package/dist/src/memory.js +1 -1
  88. package/dist/src/module-graph.js +1 -1
  89. package/dist/src/module-references.js +1 -1
  90. package/dist/src/native-checker.js +1 -1
  91. package/dist/src/native-extractor.js +1 -1
  92. package/dist/src/native-generation.js +1 -1
  93. package/dist/src/native-project.js +1 -1
  94. package/dist/src/optimizer.js +1 -1
  95. package/dist/src/parallel-processor.js +1 -1
  96. package/dist/src/parameters.js +1 -1
  97. package/dist/src/parser.js +1 -1
  98. package/dist/src/plugins/bun.js +1 -1
  99. package/dist/src/plugins/esbuild.js +1 -1
  100. package/dist/src/plugins/index.js +1 -1
  101. package/dist/src/plugins/tsdown.js +1 -1
  102. package/dist/src/plugins/tsup.js +1 -1
  103. package/dist/src/plugins/vite.js +1 -1
  104. package/dist/src/plugins/webpack.js +1 -1
  105. package/dist/src/process-source.js +1 -1
  106. package/dist/src/processor/declarations.js +1 -1
  107. package/dist/src/processor/import-usage.js +1 -1
  108. package/dist/src/processor/imports.js +1 -1
  109. package/dist/src/processor/index.js +1 -1
  110. package/dist/src/processor/type-inference.js +1 -1
  111. package/dist/src/processor.js +1 -1
  112. package/dist/src/return-type-scope.js +1 -1
  113. package/dist/src/source-cache.js +1 -1
  114. package/dist/src/sourcemap.js +1 -1
  115. package/dist/src/transformers.js +1 -1
  116. package/dist/src/utils.js +1 -1
  117. package/dist/src/value-inference.js +1 -1
  118. package/dist/src/worker-thread.js +1 -1
  119. package/dist/src/worker.js +1 -1
  120. package/dist/src/workspace.js +1 -1
  121. package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
  122. package/native/darwin-x64/libzig-dtsx.dylib +0 -0
  123. package/native/freebsd-x64/libzig-dtsx.so +0 -0
  124. package/native/linux-arm64/libzig-dtsx.so +0 -0
  125. package/native/linux-x64/libzig-dtsx.so +0 -0
  126. package/native/windows-x64/zig-dtsx.dll +0 -0
  127. package/package.json +1 -1
  128. package/dist/chunk-hnw7mwcw.js +0 -3
  129. package/dist/chunk-hzjesnf1.js +0 -38
  130. package/dist/chunk-mm1cfz16.js +0 -5
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{u}from"./chunk-02yqpwv0.js";import{e}from"./chunk-qmg1535a.js";import{E,b}from"./chunk-d0dbet9n.js";import{ce}from"./chunk-x6ddycvm.js";import{existsSync as W,readFileSync as P,realpathSync as w,statSync as q}from"fs";import{builtinModules as X}from"module";import{dirname as T,extname as F,isAbsolute as I,join as J,relative as U,resolve as S}from"path";var A=[".ts",".tsx",".mts",".cts",".vue",".stx",".js",".jsx",".mjs",".cjs",".d.ts",".d.mts",".d.cts"],V={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".ts",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function k(t){try{return q(t).isFile()}catch{return!1}}function ae(t,i){let s=t.replace(/[?#].*$/,"");if(!(s.startsWith("./")||s.startsWith("../")||s==="."||s==="..")&&!I(s))return{resolved:null,isRelative:!1};let a=T(i),c=S(a,s);if(k(c))return{resolved:c,isRelative:!0};let p=F(c),d=V[p];if(d){let f=c.slice(0,-p.length);for(let r of d){let o=f+r;if(k(o))return{resolved:o,isRelative:!0}}}for(let f of A){let r=c+f;if(k(r))return{resolved:r,isRelative:!0}}if(W(c))for(let f of A){let r=J(c,`index${f}`);if(k(r))return{resolved:r,isRelative:!0}}return{resolved:null,isRelative:!0}}function C(t,i){let s=t.indexOf("*");return s===-1?i===t:i.startsWith(t.slice(0,s))&&i.endsWith(t.slice(s+1))&&i.length>=t.length-1}function K(t,i){if(Object.hasOwn(t,i))return t[i]!==null;let s=Object.keys(t).filter((l)=>l.includes("*")&&C(l,i)).sort((l,a)=>a.indexOf("*")-l.indexOf("*")||a.length-l.length)[0];return s!==void 0&&t[s]!==null}function B(t,i){if(!t.name||i!==t.name&&!i.startsWith(`${t.name}/`))return!1;if(t.exports===void 0)return!0;let s=i===t.name?".":`.${i.slice(t.name.length)}`;if(typeof t.exports==="string"||Array.isArray(t.exports))return s===".";if(!t.exports||typeof t.exports!=="object")return!1;let l=t.exports;if(!Object.keys(l).some((c)=>c.startsWith(".")))return s===".";return K(l,s)}function N(t,i){let s=U(t,i);return s!==".."&&!s.startsWith(`..${process.platform==="win32"?"\\":"/"}`)&&!I(s)}async function Oe(t){let i=await ce(S(t.cwd,t.tsconfigPath||"tsconfig.json")),s=Object.entries(i?.paths??{});if(s.length===0){let r=(o,n)=>ae(o,n);return r.cacheKey=(o)=>JSON.stringify(o.map((n)=>({file:n,references:D(P(n,"utf8"),{includeImports:!0}).map((g)=>({specifier:g.specifier,resolution:r(g.specifier,n)}))}))),r}let l=i?.baseUrl??i?.pathsBasePath??t.cwd,a=S(t.cwd,t.root),c=new Map,p=new Set([...X,"bun"]),d=(r)=>{let o=T(r),n=[];while(!0){if(c.has(o)){let m=c.get(o);for(let x of n)c.set(x,m);return m}n.push(o);let g=J(o,"package.json");if(W(g)){let x={...JSON.parse(P(g,"utf8")),directory:w(o)};for(let O of n)c.set(O,x);return x}let v=T(o);if(v===o)return;o=v}},f=(r,o)=>{if(r.startsWith(".")||I(r))return ae(r,o);if(r.startsWith("node:")||r.startsWith("bun:")||p.has(r))return{resolved:null,isRelative:!1};let n=d(o),g=r.startsWith("@")?/^@[^/]+\/[^/]+/.exec(r)?.[0]:r.split("/")[0];if(n&&(B(n,r)||K(n.imports??{},r)||g&&[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies].some((h)=>Object.hasOwn(h??{},g))))return{resolved:null,isRelative:!1};let v=s.filter(([h])=>C(h,r)).sort(([h],[y])=>{if(!h.includes("*"))return-1;if(!y.includes("*"))return 1;return y.indexOf("*")-h.indexOf("*")})[0];if(!v)return{resolved:null,isRelative:!1};let[m,x]=v,O=m.indexOf("*"),L=O===-1?"":r.slice(O,r.length-(m.length-O-1));for(let h of x){let y=S(l,h.replace("*",L)),M=d(y);if(M&&B(M,r)&&!M.private&&M.directory!==n?.directory)return{resolved:null,isRelative:!1};let j=ae(y,o);if(!j.resolved)continue;let R=w(j.resolved),_=t.outputStructure==="flat"||W(a)&&N(w(a),R);if(!n||!N(n.directory,R)||!_||d(R)?.directory!==n.directory||/\.d\.(?:ts|mts|cts)$/.test(R))throw Error(`Local alias ${JSON.stringify(r)} from ${o} resolves outside its emitted package source: ${R}`);return e.debug(`Resolved local declaration alias ${r} from ${o} to ${R}`),{resolved:t.outputStructure==="flat"?j.resolved:S(a,U(w(a),R)),isRelative:!0,isAlias:!0,suffix:y.match(/[?#].*$/)?.[0]??""}}throw Error(`Cannot resolve local alias ${JSON.stringify(r)} from ${o} using ${t.tsconfigPath||"tsconfig.json"} (${JSON.stringify(m)})`)};return f.isPackageLocal=(r,o)=>{let n=d(r);return!!n&&d(o)?.directory===n.directory&&N(n.directory,w(o))},f.cacheKey=(r)=>{let o=r.map((g)=>({file:g,references:D(P(g,"utf8"),{includeImports:!0}).map((v)=>({specifier:v.specifier,resolution:f(v.specifier,g)}))})),n=[...new Set(c.values())].filter((g)=>g!==void 0).sort((g,v)=>g.directory.localeCompare(v.directory));return JSON.stringify({root:a,compilerOptions:i,packages:n,edges:o})},f}function D(t,i={}){let s=b(t);return(i.includeImports?["export","static-import","import-type","augmentation"]:["export"]).flatMap((a)=>s.filter((c)=>c.category===a).map(({specifier:c,kind:p,isTypeOnly:d})=>({specifier:c,kind:p,isTypeOnly:d})))}function Fn(t,i){let s=[];for(let a of b(t)){let c=i(a.specifier);if(c!==a.specifier)s.push({start:a.start,end:a.end,value:E(c,t[a.start])})}let l=t;for(let a of s.reverse())l=l.slice(0,a.start)+a.value+l.slice(a.end);return l}async function Z(t,i={}){let s=new Set,l=new Map,a=[],c=new Map,p=[];for(let d of t){let f=S(d);if(!s.has(f))s.add(f),p.push(f)}while(p.length>0){let d=p.shift(),f;try{f=await u(d)}catch{continue}c.set(d,f);let r=D(f,i);l.set(d,r);for(let o of r){let n=(i.resolveSpecifier??ae)(o.specifier,d);if(!n.isRelative)continue;if(n.resolved){if(!s.has(n.resolved))s.add(n.resolved),p.push(n.resolved)}else a.push({from:d,specifier:o.specifier,isTypeOnly:o.isTypeOnly})}}return{reachable:s,reExports:l,unresolved:a,sources:c}}
3
- export{ae,Oe,D,Fn,Z};
2
+ import{u}from"./chunk-02yqpwv0.js";import{e}from"./chunk-3mp0jaa7.js";import{E,b}from"./chunk-6ekgn7sc.js";import{ce}from"./chunk-x6ddycvm.js";import{existsSync as T,readFileSync as N,realpathSync as w,statSync as q}from"fs";import{builtinModules as X}from"module";import{dirname as I,extname as F,isAbsolute as A,join as J,relative as U,resolve as S}from"path";var B=[".ts",".tsx",".mts",".cts",".vue",".stx",".js",".jsx",".mjs",".cjs",".d.ts",".d.mts",".d.cts"],V={".js":[".ts",".tsx",".d.ts"],".jsx":[".tsx",".ts",".d.ts"],".mjs":[".mts",".d.mts"],".cjs":[".cts",".d.cts"]};function k(t){try{return q(t).isFile()}catch{return!1}}function ae(t,i){let s=t.replace(/[?#].*$/,"");if(!(s.startsWith("./")||s.startsWith("../")||s==="."||s==="..")&&!A(s))return{resolved:null,isRelative:!1};let a=I(i),c=S(a,s);if(k(c))return{resolved:c,isRelative:!0};let p=F(c),d=V[p];if(d){let f=c.slice(0,-p.length);for(let r of d){let o=f+r;if(k(o))return{resolved:o,isRelative:!0}}}for(let f of B){let r=c+f;if(k(r))return{resolved:r,isRelative:!0}}if(T(c))for(let f of B){let r=J(c,`index${f}`);if(k(r))return{resolved:r,isRelative:!0}}return{resolved:null,isRelative:!0}}function C(t,i){let s=t.indexOf("*");return s===-1?i===t:i.startsWith(t.slice(0,s))&&i.endsWith(t.slice(s+1))&&i.length>=t.length-1}function K(t,i){if(Object.hasOwn(t,i))return t[i]!==null;let s=Object.keys(t).filter((l)=>l.includes("*")&&C(l,i)).sort((l,a)=>a.indexOf("*")-l.indexOf("*")||a.length-l.length)[0];return s!==void 0&&t[s]!==null}function D(t,i){if(!t.name||i!==t.name&&!i.startsWith(`${t.name}/`))return!1;if(t.exports===void 0)return!0;let s=i===t.name?".":`.${i.slice(t.name.length)}`;if(typeof t.exports==="string"||Array.isArray(t.exports))return s===".";if(!t.exports||typeof t.exports!=="object")return!1;let l=t.exports;if(!Object.keys(l).some((c)=>c.startsWith(".")))return s===".";return K(l,s)}function W(t,i){let s=U(t,i);return s!==".."&&!s.startsWith(`..${process.platform==="win32"?"\\":"/"}`)&&!A(s)}async function Oe(t){let i=await ce(S(t.cwd,t.tsconfigPath||"tsconfig.json")),s=Object.entries(i?.paths??{});if(s.length===0){let r=(o,n)=>ae(o,n);return r.cacheKey=(o)=>JSON.stringify(o.map((n)=>({file:n,references:P(N(n,"utf8"),{includeImports:!0}).map((g)=>({specifier:g.specifier,resolution:r(g.specifier,n)}))}))),r}let l=i?.baseUrl??i?.pathsBasePath??t.cwd,a=S(t.cwd,t.root),c=new Map,p=new Set([...X,"bun"]),d=(r)=>{let o=I(r),n=[];while(!0){if(c.has(o)){let m=c.get(o);for(let x of n)c.set(x,m);return m}n.push(o);let g=J(o,"package.json");if(T(g)){let x={...JSON.parse(N(g,"utf8")),directory:w(o)};for(let O of n)c.set(O,x);return x}let v=I(o);if(v===o)return;o=v}},f=(r,o)=>{if(r.startsWith(".")||A(r))return ae(r,o);if(r.startsWith("node:")||r.startsWith("bun:")||p.has(r))return{resolved:null,isRelative:!1};let n=d(o),g=r.startsWith("@")?/^@[^/]+\/[^/]+/.exec(r)?.[0]:r.split("/")[0];if(n&&(D(n,r)||K(n.imports??{},r)||g&&[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies].some((h)=>Object.hasOwn(h??{},g))))return{resolved:null,isRelative:!1};let v=s.filter(([h])=>C(h,r)).sort(([h],[y])=>{if(!h.includes("*"))return-1;if(!y.includes("*"))return 1;return y.indexOf("*")-h.indexOf("*")})[0];if(!v)return{resolved:null,isRelative:!1};let[m,x]=v,O=m.indexOf("*"),L=O===-1?"":r.slice(O,r.length-(m.length-O-1));for(let h of x){let y=S(l,h.replace("*",L)),M=d(y);if(M&&D(M,r)&&!M.private&&M.directory!==n?.directory)return{resolved:null,isRelative:!1};let j=ae(y,o);if(!j.resolved)continue;let R=w(j.resolved),_=t.outputStructure==="flat"||T(a)&&W(w(a),R);if(!n||!W(n.directory,R)||!_||d(R)?.directory!==n.directory||/\.d\.(?:ts|mts|cts)$/.test(R))throw Error(`Local alias ${JSON.stringify(r)} from ${o} resolves outside its emitted package source: ${R}`);return e.debug(`Resolved local declaration alias ${r} from ${o} to ${R}`),{resolved:t.outputStructure==="flat"?j.resolved:S(a,U(w(a),R)),isRelative:!0,isAlias:!0,suffix:y.match(/[?#].*$/)?.[0]??""}}throw Error(`Cannot resolve local alias ${JSON.stringify(r)} from ${o} using ${t.tsconfigPath||"tsconfig.json"} (${JSON.stringify(m)})`)};return f.isPackageLocal=(r,o)=>{let n=d(r);return!!n&&d(o)?.directory===n.directory&&W(n.directory,w(o))},f.cacheKey=(r)=>{let o=r.map((g)=>({file:g,references:P(N(g,"utf8"),{includeImports:!0}).map((v)=>({specifier:v.specifier,resolution:f(v.specifier,g)}))})),n=[...new Set(c.values())].filter((g)=>g!==void 0).sort((g,v)=>g.directory.localeCompare(v.directory));return JSON.stringify({root:a,compilerOptions:i,packages:n,edges:o})},f}function P(t,i={}){let s=b(t);return(i.includeImports?["export","static-import","import-type","augmentation"]:["export"]).flatMap((a)=>s.filter((c)=>c.category===a).map(({specifier:c,kind:p,isTypeOnly:d})=>({specifier:c,kind:p,isTypeOnly:d})))}function Fn(t,i){let s=[];for(let a of b(t)){let c=i(a.specifier);if(c!==a.specifier)s.push({start:a.start,end:a.end,value:E(c,t[a.start])})}let l=t;for(let a of s.reverse())l=l.slice(0,a.start)+a.value+l.slice(a.end);return l}async function Z(t,i={}){let s=new Set,l=new Map,a=[],c=new Map,p=[];for(let d of t){let f=S(d);if(!s.has(f))s.add(f),p.push(f)}while(p.length>0){let d=p.shift(),f;try{f=await u(d)}catch{continue}c.set(d,f);let r=P(f,i);l.set(d,r);for(let o of r){let n=(i.resolveSpecifier??ae)(o.specifier,d);if(!n.isRelative)continue;if(n.resolved){if(!s.has(n.resolved))s.add(n.resolved),p.push(n.resolved)}else a.push({from:d,specifier:o.specifier,isTypeOnly:o.isTypeOnly})}}return{reachable:s,reExports:l,unresolved:a,sources:c}}
3
+ export{ae,Oe,P,Fn,Z};
@@ -1,13 +1,13 @@
1
1
  // @bun
2
- import{w,le,Mt,u}from"./chunk-02yqpwv0.js";import{G}from"./chunk-srfpcjtn.js";import{L,N}from"./chunk-8gksa73c.js";import{O,I}from"./chunk-kcfc6zg6.js";import{r}from"./chunk-wrvgt39b.js";import{Re}from"./chunk-p458sykz.js";import{e,M}from"./chunk-qmg1535a.js";import{Oe,D,Fn,Z}from"./chunk-29m9mhwt.js";import{Dn}from"./chunk-xs0ke3f2.js";import{et,kt}from"./chunk-mjaf2je8.js";import{P}from"./chunk-kdz4gxdq.js";import{Pe,oe,X,De}from"./chunk-475bjqea.js";import{tt,Y,re,Tt,At,Pt,Dt}from"./chunk-h5esm323.js";import{ne,$e}from"./chunk-cgrta603.js";import{Qe,Et}from"./chunk-fkngq7na.js";import{te}from"./chunk-s9e2a0t7.js";import{In,rt}from"./chunk-r2h572w9.js";import{q,Ee}from"./chunk-a0900w7b.js";import{Xe}from"./chunk-9kfzjkd1.js";import{Ae}from"./chunk-290jpwny.js";import{l}from"./chunk-w5m9qv5k.js";import{ie,Rt}from"./chunk-j0y149qx.js";import{mkdir as ye}from"fs/promises";import{availableParallelism as Se}from"os";import{basename as fe,dirname as pe,relative as V,resolve as ee}from"path";var Q=new WeakMap,ce=new WeakMap;function se(d){let a=Q.get(d);if(!a)a=Oe(d),Q.set(d,a),a.catch(()=>Q.delete(d));return a}async function de(d,a,t,f,h,g=Y){let o=fe(d)||"output.d.ts",C=V(pe(d),a),T=`${o}.map`,j=t.lastIndexOf(`
3
- ${tt()}`),p=j===-1?t:t.slice(0,j),y=Pt(p,o,C,f),b=`${d}.map`;return await g(b,JSON.stringify(y)),e.debug(` Generated source map: ${V(h,b)}`),T}async function s(d){let a=Date.now(),t={...P,...d};if(t.logLevel)M(t.logLevel);else if(t.verbose)M("debug");let f=new Ae;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(q(t.engine,"engine"),await ne(t),t.isolatedDeclarations===void 0)t.isolatedDeclarations=await re(t);let h=t.typeMappings?ie(t.typeMappings):void 0,g=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 T=await Pe(t,()=>se(t)),j=T.entryFiles,p=[...T.files],{resolver:y,reachability:b}=T;if(ce.set(t,new Set(p)),t.incremental){let n=T.getResolutionFingerprint();if(!t.isolatedDeclarations){let i=new Set(p),m=new Map;for(let S of p){let F=await u(S);m.set(S,rt(F));for(let U of D(F,{includeImports:!0})){let R=y(U.specifier,S).resolved;if(R&&!R.split(/[/\\]/).includes("node_modules")&&!i.has(R))i.add(R),m.set(R,rt(await u(R)))}}let c=[...m].sort(([S],[F])=>S.localeCompare(F));n=JSON.stringify([n,c])}if(g=new et(t,n),t.clearCache){if(e.debug("Clearing build cache..."),!t.dryRun)g.clear()}else if(g.load()){let m=g.getStats();e.debug(`Loaded build cache with ${m.entries} entries`)}else e.debug("No existing build cache found, starting fresh");if(!t.dryRun)kt(t.cwd)}if(g&&!t.dryRun){let n=g.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 k=new Map,z=new Map,v=async(n,i,m="lf")=>{z.set(n,{content:i,lineEnding:m})},E=async(n,i)=>{let m;try{let c=X(n,t),S=async(x)=>{if(!t.diff)return;try{let B=await u(c),H=At(B,x,V(t.cwd,c));if(H)e.info(`
2
+ import{w,le,Mt,u}from"./chunk-02yqpwv0.js";import{G}from"./chunk-srfpcjtn.js";import{L,N}from"./chunk-8gksa73c.js";import{O,I}from"./chunk-kcfc6zg6.js";import{r}from"./chunk-a04yhmwb.js";import{Re}from"./chunk-9b0jah2a.js";import{e,M}from"./chunk-3mp0jaa7.js";import{Oe,P,Fn,Z}from"./chunk-4sasxrdr.js";import{Pn}from"./chunk-czgjmefa.js";import{et,kt}from"./chunk-1jmwmc2a.js";import{D}from"./chunk-m7jndt3v.js";import{De,oe,X,Pe}from"./chunk-m8w98p7p.js";import{tt,Y,re,Tt,At,Dt,Pt}from"./chunk-b6xcyrnx.js";import{ne,$e}from"./chunk-vekg5zy6.js";import{Qe,Et}from"./chunk-bsj770f8.js";import{te}from"./chunk-s9e2a0t7.js";import{In,rt}from"./chunk-7xgwvv94.js";import{q,Ee}from"./chunk-a0900w7b.js";import{Xe}from"./chunk-9kfzjkd1.js";import{Ae}from"./chunk-290jpwny.js";import{l}from"./chunk-jkeqyj50.js";import{ie,Rt}from"./chunk-j0y149qx.js";import{mkdir as ye}from"fs/promises";import{availableParallelism as Se}from"os";import{basename as fe,dirname as pe,relative as V,resolve as ee}from"path";var Q=new WeakMap,ce=new WeakMap;function se(d){let a=Q.get(d);if(!a)a=Oe(d),Q.set(d,a),a.catch(()=>Q.delete(d));return a}async function de(d,a,t,f,h,g=Y){let o=fe(d)||"output.d.ts",C=V(pe(d),a),T=`${o}.map`,j=t.lastIndexOf(`
3
+ ${tt()}`),p=j===-1?t:t.slice(0,j),y=Dt(p,o,C,f),b=`${d}.map`;return await g(b,JSON.stringify(y)),e.debug(` Generated source map: ${V(h,b)}`),T}async function s(d){let a=Date.now(),t={...D,...d};if(t.logLevel)M(t.logLevel);else if(t.verbose)M("debug");let f=new Ae;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(q(t.engine,"engine"),await ne(t),t.isolatedDeclarations===void 0)t.isolatedDeclarations=await re(t);let h=t.typeMappings?ie(t.typeMappings):void 0,g=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 T=await De(t,()=>se(t)),j=T.entryFiles,p=[...T.files],{resolver:y,reachability:b}=T;if(ce.set(t,new Set(p)),t.incremental){let n=T.getResolutionFingerprint();if(!t.isolatedDeclarations){let i=new Set(p),m=new Map;for(let S of p){let F=await u(S);m.set(S,rt(F));for(let U of P(F,{includeImports:!0})){let R=y(U.specifier,S).resolved;if(R&&!R.split(/[/\\]/).includes("node_modules")&&!i.has(R))i.add(R),m.set(R,rt(await u(R)))}}let c=[...m].sort(([S],[F])=>S.localeCompare(F));n=JSON.stringify([n,c])}if(g=new et(t,n),t.clearCache){if(e.debug("Clearing build cache..."),!t.dryRun)g.clear()}else if(g.load()){let m=g.getStats();e.debug(`Loaded build cache with ${m.entries} entries`)}else e.debug("No existing build cache found, starting fresh");if(!t.dryRun)kt(t.cwd)}if(g&&!t.dryRun){let n=g.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 k=new Map,z=new Map,v=async(n,i,m="lf")=>{z.set(n,{content:i,lineEnding:m})},E=async(n,i)=>{let m;try{let c=X(n,t),S=async(x)=>{if(!t.diff)return;try{let B=await u(c),H=At(B,x,V(t.cwd,c));if(H)e.info(`
4
4
  ${H}`);else e.debug(`[no changes] ${c}`)}catch{e.info(`[new file] ${V(t.cwd,c)}`)}},F=(x)=>{if(!t.validate)return 0;let B=Tt(x,c);if(B.isValid)return e.debug(`[validation] ${c} - OK`),0;e.warn(`[validation] ${V(t.cwd,c)} has ${B.errors.length} error(s):`);for(let H of B.errors){let ae=` Line ${H.line}:${H.column}`;if(H.code)ae+=` [${H.code}]`;if(ae+=` - ${H.message}`,e.warn(ae),H.suggestion)e.warn(` Suggestion: ${H.suggestion}`)}return B.errors.length},U=(x)=>{e.info(`[dry-run] Would generate: ${c}`),e.debug("--- Content preview ---"),e.debug(x.slice(0,500)+(x.length>500?`
5
- ...`:"")),e.debug("--- End preview ---")};if(g){let x=g.getCachedIfValid(n,t.cwd);if(x){if(t.bundle)k.set(n,x);await S(x);let B=F(x);if(t.dryRun)U(x);else{if(t.declarationMap)m=i??await u(n),await de(c,n,x,m,t.cwd,v);await v(c,x,t.lineEnding)}return e.debug(`[cached] ${V(t.cwd,c)}`),{success:!0,file:n,declarationCount:0,importCount:0,exportCount:0,cached:!0,validationErrorCount:B}}}m=i??await u(n);let{content:R,declarationCount:he,importCount:we,exportCount:Ce}=await ge(n,m,t,f,h,T.augmentationImports.get(n));if(t.bundle)k.set(n,R);let A=R;if(t.prettier||t.indentStyle||t.indentSize){let x=await te(A,{usePrettier:t.prettier,builtIn:{indentSize:t.indentSize||2,useTabs:t.indentStyle==="tabs",normalizeWhitespace:!0,sortImports:!0,trailingNewline:!0}},c);A=x.content;for(let B of x.warnings??[])e.warn(`[format] ${B}`)}if(t.declarationMap){let x=`${fe(c)||"output.d.ts"}.map`;A=Dt(A,x)}await S(A);let be=F(A);if(t.dryRun)U(A);else{if(t.declarationMap&&m)await de(c,n,A,m,t.cwd,v);if(await v(c,A,t.lineEnding),g&&m)g.update(n,m,A,t.cwd);e.debug(`Generated: ${c}`)}return{success:!0,file:n,declarationCount:he,importCount:we,exportCount:Ce,validationErrorCount:be}}catch(c){let S=Qe(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}}},W=t.parallel||t.parallel!==!1&&p.length>=10,J=G(t.concurrency,Se?.()??8),_=new Map;if(W&&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)_.set(i.file,i.source)}let K=(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=Et(n.dtsError);if(t.continueOnError)e.warn(i);else throw e.error(i),Error(n.dtsError.message)}};if(W)for(let n=0;n<p.length;n+=J){let i=p.slice(n,n+J),m=await Promise.all(i.map((c)=>E(c,_.get(c))));for(let c of m)K(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 E(n);if(K(i),t.progress){let m=Math.round(o.filesProcessed/p.length*100),c=i.cached?"[cached]":"";e.info(`[${o.filesProcessed}/${p.length}] ${m}% - ${V(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 D(c)){let F=y(S.specifier,m);if(!F.isRelative)continue;if(!F.resolved)n.push({from:m,specifier:S.specifier,reason:"missing"});else if(!/\.d\.(?:ts|mts|cts)$/.test(F.resolved)&&!i.has(F.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=V(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(`
6
- `);if(t.failOnUnresolvedReExport)throw Error(m);e.warn(m),e.warn('Generated .d.ts files reference modules that were not emitted \u2014 consumers will see "has no exported member" errors.')}}if(t.bundle&&(o.filesGenerated>0||C>0)&&j.length>0)try{e.debug("Bundling declarations...");let n=j.length===1&&!!t.bundleOutput;for(let i of j){let m=await Z([i],{includeImports:!0,resolveSpecifier:y}),c=new Set;for(let R of m.reachable){if(R.endsWith(".d.ts"))continue;if(R.includes("node_modules"))continue;c.add(R)}let S=p.filter((R)=>c.has(R));if(!S.includes(i))S.push(i);let F=Dn(i,S,k,{cwd:t.cwd,keepComments:t.keepComments});for(let R of new Set(F.warnings))e.warn(`[bundle] ${R}`);let U=n?ee(t.cwd,t.outdir,t.bundleOutput):X(i,t);if(t.dryRun)e.info(`[dry-run] Would bundle ${F.files.length} files to: ${V(t.cwd,U)}`);else await v(U,F.content,t.lineEnding),e.debug(`Prepared ${F.files.length} bundled files for: ${V(t.cwd,U)}`);if(n)break}}catch(n){let i=n instanceof Error?n.message:String(n);throw e.error(`Bundle failed: ${i}`),n}if(!t.dryRun)await $e(t,z);if(g&&!t.dryRun)g.save(),e.debug("Saved build cache");if(o.durationMs=Date.now()-a,t.stats)if(t.outputFormat==="json")console.log(JSON.stringify(o,null,2));else{if(e.info(`
5
+ ...`:"")),e.debug("--- End preview ---")};if(g){let x=g.getCachedIfValid(n,t.cwd);if(x){if(t.bundle)k.set(n,x);await S(x);let B=F(x);if(t.dryRun)U(x);else{if(t.declarationMap)m=i??await u(n),await de(c,n,x,m,t.cwd,v);await v(c,x,t.lineEnding)}return e.debug(`[cached] ${V(t.cwd,c)}`),{success:!0,file:n,declarationCount:0,importCount:0,exportCount:0,cached:!0,validationErrorCount:B}}}m=i??await u(n);let{content:R,declarationCount:he,importCount:we,exportCount:Ce}=await ge(n,m,t,f,h,T.augmentationImports.get(n));if(t.bundle)k.set(n,R);let A=R;if(t.prettier||t.indentStyle||t.indentSize){let x=await te(A,{usePrettier:t.prettier,builtIn:{indentSize:t.indentSize||2,useTabs:t.indentStyle==="tabs",normalizeWhitespace:!0,sortImports:!0,trailingNewline:!0}},c);A=x.content;for(let B of x.warnings??[])e.warn(`[format] ${B}`)}if(t.declarationMap){let x=`${fe(c)||"output.d.ts"}.map`;A=Pt(A,x)}await S(A);let be=F(A);if(t.dryRun)U(A);else{if(t.declarationMap&&m)await de(c,n,A,m,t.cwd,v);if(await v(c,A,t.lineEnding),g&&m)g.update(n,m,A,t.cwd);e.debug(`Generated: ${c}`)}return{success:!0,file:n,declarationCount:he,importCount:we,exportCount:Ce,validationErrorCount:be}}catch(c){let S=Qe(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}}},W=t.parallel||t.parallel!==!1&&p.length>=10,J=G(t.concurrency,Se?.()??8),_=new Map;if(W&&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)_.set(i.file,i.source)}let K=(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=Et(n.dtsError);if(t.continueOnError)e.warn(i);else throw e.error(i),Error(n.dtsError.message)}};if(W)for(let n=0;n<p.length;n+=J){let i=p.slice(n,n+J),m=await Promise.all(i.map((c)=>E(c,_.get(c))));for(let c of m)K(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 E(n);if(K(i),t.progress){let m=Math.round(o.filesProcessed/p.length*100),c=i.cached?"[cached]":"";e.info(`[${o.filesProcessed}/${p.length}] ${m}% - ${V(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 P(c)){let F=y(S.specifier,m);if(!F.isRelative)continue;if(!F.resolved)n.push({from:m,specifier:S.specifier,reason:"missing"});else if(!/\.d\.(?:ts|mts|cts)$/.test(F.resolved)&&!i.has(F.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=V(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(`
6
+ `);if(t.failOnUnresolvedReExport)throw Error(m);e.warn(m),e.warn('Generated .d.ts files reference modules that were not emitted \u2014 consumers will see "has no exported member" errors.')}}if(t.bundle&&(o.filesGenerated>0||C>0)&&j.length>0)try{e.debug("Bundling declarations...");let n=j.length===1&&!!t.bundleOutput;for(let i of j){let m=await Z([i],{includeImports:!0,resolveSpecifier:y}),c=new Set;for(let R of m.reachable){if(R.endsWith(".d.ts"))continue;if(R.includes("node_modules"))continue;c.add(R)}let S=p.filter((R)=>c.has(R));if(!S.includes(i))S.push(i);let F=Pn(i,S,k,{cwd:t.cwd,keepComments:t.keepComments});for(let R of new Set(F.warnings))e.warn(`[bundle] ${R}`);let U=n?ee(t.cwd,t.outdir,t.bundleOutput):X(i,t);if(t.dryRun)e.info(`[dry-run] Would bundle ${F.files.length} files to: ${V(t.cwd,U)}`);else await v(U,F.content,t.lineEnding),e.debug(`Prepared ${F.files.length} bundled files for: ${V(t.cwd,U)}`);if(n)break}}catch(n){let i=n instanceof Error?n.message:String(n);throw e.error(`Bundle failed: ${i}`),n}if(!t.dryRun)await $e(t,z);if(g&&!t.dryRun)g.save(),e.debug("Saved build cache");if(o.durationMs=Date.now()-a,t.stats)if(t.outputFormat==="json")console.log(JSON.stringify(o,null,2));else{if(e.info(`
7
7
  --- Generation Statistics ---`),e.info(`Files processed: ${o.filesProcessed}`),e.info(`Files generated: ${o.filesGenerated}`),C>0)e.info(`Files cached: ${C}`);if(o.filesFailed>0)e.info(`Files failed: ${o.filesFailed}`);if(e.info(`Declarations found: ${o.declarationsFound}`),e.info(`Imports processed: ${o.importsProcessed}`),e.info(`Exports processed: ${o.exportsProcessed}`),o.filesValidated>0){if(e.info(`Files validated: ${o.filesValidated}`),o.validationErrors>0)e.info(`Validation errors: ${o.validationErrors}`)}if(e.info(`Duration: ${o.durationMs}ms`),o.errors.length>0){e.info(`
8
8
  Errors:`);for(let n of o.errors){let i=` - ${n.file}`;if(n.location)i+=`:${n.location.line}:${n.location.column}`;if(n.code)i+=` [${n.code}]`;if(i+=`: ${n.message}`,e.info(i),n.suggestion)e.info(` Suggestion: ${n.suggestion}`)}}e.info(`-----------------------------
9
- `)}if(t.plugins&&t.plugins.length>0)await f.runOnEnd(o);return e.debug("DTS generation complete!"),o}async function ve(d,a,t){let f=await se(t),h=De(a,t,f,ce.get(t));return Fn(d,(g)=>h(g).emittedSpecifier)}async function fo(d,a){Q.delete(a),ce.delete(a);let t=await se(a),f=await Z([d],{includeImports:!0,resolveSpecifier:t}),h=await Re([...f.sources.keys()],t,a.isolatedDeclarations??!1,f.sources);return(await me(d,a,void 0,h.get(ee(d)))).content}async function me(d,a,t,f){let h=await u(d),g=a.typeMappings?ie(a.typeMappings):void 0;return ge(d,h,a,t,g,f)}async function ge(d,a,t,f,h,g){let o=a;if(f)o=await f.runOnBeforeFile(d,a);let C=new Map;if(!t.isolatedDeclarations){let v=await se(t);for(let E of D(o,{includeImports:!0})){let W=v(E.specifier,d).resolved;if(W&&!W.split(/[/\\]/).includes("node_modules"))C.set(E.specifier,await u(W))}}let T=f?.hasDeclarationHooks()?null:Me(o,d,t,C,g);if(T!==null)return ue(T,d,o,t,f,h,xe(T));let j=C.size?In(o,C):void 0,p=r(o,d,t.keepComments,t.isolatedDeclarations??!1,j);if(f)p=await f.runOnDeclarations(d,o,p);let y=0,b=0;for(let v=0;v<p.length;v++){let E=p[v];if(E.kind==="import")y++;if(E.kind==="export"||E.isExported)b++}let z=l(p,{filePath:d,sourceCode:o,declarations:p,augmentationImports:g},t.keepComments,t.importOrder);return ue(z,d,o,t,f,h,{declarationCount:p.length,importCount:y,exportCount:b})}function xe(d){let a=0,t=0,f=0;for(let h of d.split(`
10
- `)){if(!h||h.startsWith(" ")||h.startsWith("\t")||h.startsWith("}")||h.startsWith("*")||h.startsWith("/"))continue;if(a++,h.startsWith("import "))t++;else if(h.startsWith("export "))f++}return{declarationCount:a,importCount:t,exportCount:f}}function Me(d,a,t,f,h){let g=t.importOrder??["bun"];if(g.length!==1||g[0]!=="bun")return null;let o=L(a)?N(d):O(a)?I(d):d;return Ee(o,{keepComments:t.keepComments??!0,isolatedDeclarations:t.isolatedDeclarations??!1,engine:t.engine,sourceFile:a,inferenceSources:f,augmentationImports:h})}async function ue(d,a,t,f,h,g,o){let C=await ve(d,a,f);if(g)C=Rt(C,g,{filePath:a});if(f.normalizeOutput===!0||f.declarationOrder)C=Xe(C,{lineEnding:"lf",declarationOrder:f.declarationOrder,indent:{style:f.indentStyle??"spaces",size:f.indentSize??2}});if(h)C=await h.runOnAfterFile(a,t,C);return{content:C,...o}}async function po(d){let a={...P,...d};if(a.logLevel)M(a.logLevel);let t=ee(a.cwd,a.root),f=150,h=5,g=1e4,o={pendingChanges:new Set,debounceTimer:null,isProcessing:!1,errorCount:0,lastErrorTime:0};e.info(`Watching for changes in ${t}...`),e.info(`Press Ctrl+C to stop
9
+ `)}if(t.plugins&&t.plugins.length>0)await f.runOnEnd(o);return e.debug("DTS generation complete!"),o}async function ve(d,a,t){let f=await se(t),h=Pe(a,t,f,ce.get(t));return Fn(d,(g)=>h(g).emittedSpecifier)}async function fo(d,a){Q.delete(a),ce.delete(a);let t=await se(a),f=await Z([d],{includeImports:!0,resolveSpecifier:t}),h=await Re([...f.sources.keys()],t,a.isolatedDeclarations??!1,f.sources);return(await me(d,a,void 0,h.get(ee(d)))).content}async function me(d,a,t,f){let h=await u(d),g=a.typeMappings?ie(a.typeMappings):void 0;return ge(d,h,a,t,g,f)}async function ge(d,a,t,f,h,g){let o=a;if(f)o=await f.runOnBeforeFile(d,a);let C=new Map;if(!t.isolatedDeclarations){let v=await se(t);for(let E of P(o,{includeImports:!0})){let W=v(E.specifier,d).resolved;if(W&&!W.split(/[/\\]/).includes("node_modules"))C.set(E.specifier,await u(W))}}let T=f?.hasDeclarationHooks()?null:Me(o,d,t,C,g);if(T!==null)return ue(T,d,o,t,f,h,xe(T));let j=C.size?In(o,C):void 0,p=r(o,d,t.keepComments,t.isolatedDeclarations??!1,j);if(f)p=await f.runOnDeclarations(d,o,p);let y=0,b=0;for(let v=0;v<p.length;v++){let E=p[v];if(E.kind==="import")y++;if(E.kind==="export"||E.isExported)b++}let z=l(p,{filePath:d,sourceCode:o,declarations:p,augmentationImports:g},t.keepComments,t.importOrder);return ue(z,d,o,t,f,h,{declarationCount:p.length,importCount:y,exportCount:b})}function xe(d){let a=0,t=0,f=0;for(let h of d.split(`
10
+ `)){if(!h||h.startsWith(" ")||h.startsWith("\t")||h.startsWith("}")||h.startsWith("*")||h.startsWith("/"))continue;if(a++,h.startsWith("import "))t++;else if(h.startsWith("export "))f++}return{declarationCount:a,importCount:t,exportCount:f}}function Me(d,a,t,f,h){let g=t.importOrder??["bun"];if(g.length!==1||g[0]!=="bun")return null;let o=L(a)?N(d):O(a)?I(d):d;return Ee(o,{keepComments:t.keepComments??!0,isolatedDeclarations:t.isolatedDeclarations??!1,engine:t.engine,sourceFile:a,inferenceSources:f,augmentationImports:h})}async function ue(d,a,t,f,h,g,o){let C=await ve(d,a,f);if(g)C=Rt(C,g,{filePath:a});if(f.normalizeOutput===!0||f.declarationOrder)C=Xe(C,{lineEnding:"lf",declarationOrder:f.declarationOrder,indent:{style:f.indentStyle??"spaces",size:f.indentSize??2}});if(h)C=await h.runOnAfterFile(a,t,C);return{content:C,...o}}async function po(d){let a={...D,...d};if(a.logLevel)M(a.logLevel);let t=ee(a.cwd,a.root),f=150,h=5,g=1e4,o={pendingChanges:new Set,debounceTimer:null,isProcessing:!1,errorCount:0,lastErrorTime:0};e.info(`Watching for changes in ${t}...`),e.info(`Press Ctrl+C to stop
11
11
  `);try{await s(a),e.info(`[watch] Initial generation complete
12
12
  `)}catch(y){let b=y instanceof Error?y.message:String(y);e.error(`[watch] Initial generation failed: ${b}`),e.info(`[watch] Continuing to watch for changes...
13
13
  `)}async function C(){if(o.isProcessing||o.pendingChanges.size===0)return;let y=Date.now();if(o.errorCount>=h){if(y-o.lastErrorTime<g){e.warn(`[watch] Too many errors, pausing for ${Math.ceil((g-(y-o.lastErrorTime))/1000)}s...`);return}o.errorCount=0}o.isProcessing=!0;let b=Array.from(o.pendingChanges);o.pendingChanges.clear();let k=new Date().toLocaleTimeString();if(b.length===1)e.info(`
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-ex02f2vm.js";class He{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 qt(t={}){return new He(t)}var ur=qt,Ta=He;
2
+ import{s}from"./chunk-4xvx77zs.js";class He{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 qt(t={}){return new He(t)}var ur=qt,Ta=He;
3
3
  export{He,qt,ur,Ta};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{j}from"./chunk-kdz4gxdq.js";import{D}from"./chunk-29m9mhwt.js";import{Pe,De}from"./chunk-475bjqea.js";import{createHash as x}from"crypto";import{readFile as d}from"fs/promises";import{resolve as m}from"path";async function Nn(g){let e={...j,...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 Pe(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=De(r,e,o.resolver),i=[],S=new Set(D(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{j}from"./chunk-m7jndt3v.js";import{P}from"./chunk-4sasxrdr.js";import{De,Pe}from"./chunk-m8w98p7p.js";import{createHash as x}from"crypto";import{readFile as d}from"fs/promises";import{resolve as m}from"path";async function Nn(g){let e={...j,...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 De(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=Pe(r,e,o.resolver),i=[],S=new Set(P(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{Nn};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{r}from"./chunk-wrvgt39b.js";import{readFile as D}from"fs/promises";import{dirname as x,relative as g,resolve as C}from"path";async function Ar(s,i={}){let e=new Map,n=i.rootDir||process.cwd(),t=[];for(let o of s){if(i.ignore?.some((p)=>M(o,p)))continue;if(!i.includeNodeModules&&o.includes("node_modules"))continue;t.push(o)}let c=await Promise.all(t.map((o)=>b(o,n)));for(let o=0;o<t.length;o++){let p=c[o];if(p)e.set(t[o],p)}for(let[o,p]of e)for(let a of p.dependencies){let d=e.get(a);if(d)d.dependents.add(o)}return e}async function b(s,i){try{let e=await D(s,"utf-8"),n={path:s,exports:new Set,imports:new Map,dependencies:new Set,dependents:new Set};for(let t of r(e,s,!1)){if(t.isExported&&t.name)n.exports.add(t.isTypeOnly||t.kind==="type"||t.kind==="interface"?"type":t.name);if(!t.source)continue;let c=w(t.source,s,i);if(!c)continue;if(n.dependencies.add(c),t.kind==="import")for(let o of t.specifiers??[])n.imports.set(t.isTypeOnly||o.isType?`type ${o.alias??o.name}`:o.alias??o.name,c)}return n}catch{return null}}function w(s,i,e){if(!s.startsWith(".")&&!s.startsWith("/"))return null;let n=x(i),t=C(n,s);if(t.includes("node_modules"))return null;if(t.endsWith(".ts")||t.endsWith(".tsx"))return t.replace(/\.tsx?$/,".ts");return`${t}.ts`}function M(s,i){let e=i.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(e).test(s)}function Pr(s,i={}){let e=[],n=new Set,t=new Set,c=[],o=new Map,p=i.maxDepth||100;function a(d,y){if(y>p)return;if(t.has(d)){let u=o.get(d)??c.indexOf(d),l=c.slice(u);l.push(d);let h=S(l,s),f=z(l,s);if(!i.typesOnly||f)e.push({chain:l,symbols:h,severity:f?"error":"warning",reason:f?"Type-level circular dependency can cause compilation issues":"Value-level circular dependency may cause runtime issues"});return}if(n.has(d))return;let m=s.get(d);if(!m)return;t.add(d),o.set(d,c.length),c.push(d);for(let u of m.dependencies)a(u,y+1);t.delete(d),c.pop(),o.delete(d),n.add(d)}for(let d of s.keys())if(!n.has(d))a(d,0);return N(e)}function S(s,i){let e=[];for(let n=0;n<s.length-1;n++){let t=i.get(s[n]),c=s[n+1];if(t){for(let[o,p]of t.imports)if(p===c)e.push(o)}}return[...new Set(e)]}function z(s,i){return s.some((e)=>e.endsWith(".d.ts")||i.get(e)?.exports.has("type")||[...i.get(e)?.imports.keys()||[]].some((n)=>n.startsWith("type ")||n==="type"))}function N(s){let i=new Set,e=[];for(let n of s){let t=v(n.chain),c=t.join(" -> ");if(!i.has(c))i.add(c),e.push({...n,chain:t})}return e}function v(s){if(s.length<=1)return s;let i=s.slice(0,-1),e=i;for(let n=1;n<i.length;n++){let t=[...i.slice(n),...i.slice(0,n)];if(t.join("")<e.join(""))e=t}return[...e,e[0]]}async function xs(s,i={}){let e=Date.now(),n=await Ar(s,i),t=Pr(n,i);return{hasCircular:t.length>0,cycles:t,graph:n,filesAnalyzed:s,durationMs:Date.now()-e}}function Cs(s,i){let e=[];if(!s.hasCircular)return e.push(`\u2713 No circular dependencies found (${s.filesAnalyzed.length} files analyzed in ${s.durationMs}ms)`),e.join(`
2
+ import{r}from"./chunk-a04yhmwb.js";import{readFile as D}from"fs/promises";import{dirname as x,relative as g,resolve as C}from"path";async function Ar(s,i={}){let e=new Map,n=i.rootDir||process.cwd(),t=[];for(let o of s){if(i.ignore?.some((p)=>M(o,p)))continue;if(!i.includeNodeModules&&o.includes("node_modules"))continue;t.push(o)}let c=await Promise.all(t.map((o)=>b(o,n)));for(let o=0;o<t.length;o++){let p=c[o];if(p)e.set(t[o],p)}for(let[o,p]of e)for(let a of p.dependencies){let d=e.get(a);if(d)d.dependents.add(o)}return e}async function b(s,i){try{let e=await D(s,"utf-8"),n={path:s,exports:new Set,imports:new Map,dependencies:new Set,dependents:new Set};for(let t of r(e,s,!1)){if(t.isExported&&t.name)n.exports.add(t.isTypeOnly||t.kind==="type"||t.kind==="interface"?"type":t.name);if(!t.source)continue;let c=w(t.source,s,i);if(!c)continue;if(n.dependencies.add(c),t.kind==="import")for(let o of t.specifiers??[])n.imports.set(t.isTypeOnly||o.isType?`type ${o.alias??o.name}`:o.alias??o.name,c)}return n}catch{return null}}function w(s,i,e){if(!s.startsWith(".")&&!s.startsWith("/"))return null;let n=x(i),t=C(n,s);if(t.includes("node_modules"))return null;if(t.endsWith(".ts")||t.endsWith(".tsx"))return t.replace(/\.tsx?$/,".ts");return`${t}.ts`}function M(s,i){let e=i.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(e).test(s)}function Dr(s,i={}){let e=[],n=new Set,t=new Set,c=[],o=new Map,p=i.maxDepth||100;function a(d,y){if(y>p)return;if(t.has(d)){let u=o.get(d)??c.indexOf(d),l=c.slice(u);l.push(d);let h=S(l,s),f=z(l,s);if(!i.typesOnly||f)e.push({chain:l,symbols:h,severity:f?"error":"warning",reason:f?"Type-level circular dependency can cause compilation issues":"Value-level circular dependency may cause runtime issues"});return}if(n.has(d))return;let m=s.get(d);if(!m)return;t.add(d),o.set(d,c.length),c.push(d);for(let u of m.dependencies)a(u,y+1);t.delete(d),c.pop(),o.delete(d),n.add(d)}for(let d of s.keys())if(!n.has(d))a(d,0);return N(e)}function S(s,i){let e=[];for(let n=0;n<s.length-1;n++){let t=i.get(s[n]),c=s[n+1];if(t){for(let[o,p]of t.imports)if(p===c)e.push(o)}}return[...new Set(e)]}function z(s,i){return s.some((e)=>e.endsWith(".d.ts")||i.get(e)?.exports.has("type")||[...i.get(e)?.imports.keys()||[]].some((n)=>n.startsWith("type ")||n==="type"))}function N(s){let i=new Set,e=[];for(let n of s){let t=v(n.chain),c=t.join(" -> ");if(!i.has(c))i.add(c),e.push({...n,chain:t})}return e}function v(s){if(s.length<=1)return s;let i=s.slice(0,-1),e=i;for(let n=1;n<i.length;n++){let t=[...i.slice(n),...i.slice(0,n)];if(t.join("")<e.join(""))e=t}return[...e,e[0]]}async function xs(s,i={}){let e=Date.now(),n=await Ar(s,i),t=Dr(n,i);return{hasCircular:t.length>0,cycles:t,graph:n,filesAnalyzed:s,durationMs:Date.now()-e}}function Cs(s,i){let e=[];if(!s.hasCircular)return e.push(`\u2713 No circular dependencies found (${s.filesAnalyzed.length} files analyzed in ${s.durationMs}ms)`),e.join(`
3
3
  `);e.push(`\u2717 Found ${s.cycles.length} circular dependency chain(s)`),e.push("");for(let n of s.cycles){let t=n.severity==="error"?"\uD83D\uDD34":"\uD83D\uDFE1";e.push(`${t} ${n.severity.toUpperCase()}: Circular dependency`);let c=n.chain.map((o)=>i?g(i,o):o);if(e.push(` ${c.join(" \u2192 ")}`),n.symbols.length>0)e.push(` Symbols: ${n.symbols.join(", ")}`);e.push(` ${n.reason}`),e.push("")}return e.push(`Analyzed ${s.filesAnalyzed.length} files in ${s.durationMs}ms`),e.join(`
4
4
  `)}function vs(s){let i=0,e={file:"",count:0},n={file:"",count:0},t=[];for(let[c,o]of s){let p=o.dependencies.size;if(i+=p,p>e.count)e={file:c,count:p};if(p===0&&o.dependents.size===0)t.push(c);if(o.dependents.size>n.count)n={file:c,count:o.dependents.size}}return{totalFiles:s.size,totalDependencies:i,avgDependencies:s.size>0?i/s.size:0,maxDependencies:e,isolatedFiles:t,mostDepended:n}}function Ss(s,i){let e=new Set,n=[s];while(n.length>0){let t=n.shift(),c=i.get(t);if(c){for(let o of c.dependents)if(!e.has(o))e.add(o),n.push(o)}}return e}function $s(s,i){let e=new Set,n=[s];while(n.length>0){let t=n.shift(),c=i.get(t);if(c){for(let o of c.dependencies)if(!e.has(o))e.add(o),n.push(o)}}return e}function Es(s,i){let e=["digraph dependencies {"," rankdir=LR;"," node [shape=box];",""];for(let[n,t]of s){let c=i?g(i,n):n,o=n.replace(/[^a-z0-9]/gi,"_");e.push(` ${o} [label="${c}"];`);for(let p of t.dependencies){let a=p.replace(/[^a-z0-9]/gi,"_");e.push(` ${o} -> ${a};`)}}return e.push("}"),e.join(`
5
5
  `)}function ks(s,i){let e=[];for(let[n,t]of s){let c=i?g(i,n):n;e.push({id:n,path:c,exports:[...t.exports],imports:Object.fromEntries(t.imports),dependencies:[...t.dependencies],dependents:[...t.dependents]})}return JSON.stringify({nodes:e},null,2)}
6
- export{Ar,Pr,xs,Cs,vs,Ss,$s,Es,ks};
6
+ export{Ar,Dr,xs,Cs,vs,Ss,$s,Es,ks};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{a,i,h,g,xe,ze}from"./chunk-mm1cfz16.js";function t(f){let o=[],c=f.length,l=new Set,e=ze(f,l),r=0;function k(){let S=r++;while(r<c){let y=f.charCodeAt(r);if(y===92)r+=2;else if(y===96){o.push({start:S,end:++r,kind:"literal"});return}else if(y===36&&f.charCodeAt(r+1)===123)o.push({start:S,end:r+1,kind:"literal"}),o.push({start:r+1,end:r+2,kind:"punctuation"}),r+=2,p(!0),S=r;else r++}o.push({start:S,end:r,kind:"literal"})}function p(S=!1){let y=0,M=0;while(r<c){let w=r,n=f.charCodeAt(r);if(n===60&&(M>0||f[r+1]!=="/"&&xe(f,r,o.at(-1)?.end??0))){let u=e(r);if(u){if(M=Math.max(0,M+u.delta),u.delta<0){r=u.end+1,o.push({start:w,end:r,kind:"literal"});continue}}}if(n===32||n>=9&&n<=13||n>127&&/\s/.test(f[r])){r++;continue}if(n===47){let u=f.charCodeAt(r+1);if(u===47){let s=f.indexOf(`
2
+ import{a,i,h,g,xe,Ue}from"./chunk-cgqg1br8.js";function t(f){let o=[],c=f.length,l=new Set,e=Ue(f,l),r=0;function k(){let S=r++;while(r<c){let y=f.charCodeAt(r);if(y===92)r+=2;else if(y===96){o.push({start:S,end:++r,kind:"literal"});return}else if(y===36&&f.charCodeAt(r+1)===123)o.push({start:S,end:r+1,kind:"literal"}),o.push({start:r+1,end:r+2,kind:"punctuation"}),r+=2,p(!0),S=r;else r++}o.push({start:S,end:r,kind:"literal"})}function p(S=!1){let y=0,M=0;while(r<c){let w=r,n=f.charCodeAt(r);if(n===60&&(M>0||f[r+1]!=="/"&&xe(f,r,o.at(-1)?.end??0))){let u=e(r);if(u){if(M=Math.max(0,M+u.delta),u.delta<0){r=u.end+1,o.push({start:w,end:r,kind:"literal"});continue}}}if(n===32||n>=9&&n<=13||n>127&&/\s/.test(f[r])){r++;continue}if(n===47){let u=f.charCodeAt(r+1);if(u===47){let s=f.indexOf(`
3
3
  `,r+2);r=s===-1?c:s+1;continue}if(u===42){let s=f.indexOf("*/",r+2);r=s===-1?c:s+2;continue}if(!l.has(r)&&h(f,r,o.at(-1)?.end??0)){r=g(f,r),o.push({start:w,end:r,kind:"literal"});continue}}else if(n===96){k();continue}else if(n===34||n===39){r++;let u=!1;while(r<c){let s=f.charCodeAt(r++);if(s===92)r++;else if(s===n){u=!0;break}}o.push({start:w,end:Math.min(r,c),kind:u?"quoted":"literal"});continue}else if(a(n)){while(i(f.charCodeAt(++r)));o.push({start:w,end:r,kind:"word"});continue}if(o.push({start:w,end:++r,kind:"punctuation"}),S){if(n===123)y++;else if(n===125){if(y===0)return;y--}}}}return p(),o}var R,q=[];function m(f){if(f!==R)q=t(f),R=f;return q}function lr(){R=void 0,q=[]}function d(f){let o="",c=f.length-1;for(let l=1;l<c;l++){if(f[l]!=="\\"){o+=f[l];continue}let e=f[++l];if(l>=c)return;switch(e){case`
4
4
  `:break;case"\r":if(f[l+1]===`
5
5
  `)l++;break;case"n":o+=`
6
- `;break;case"r":o+="\r";break;case"t":o+="\t";break;case"b":o+="\b";break;case"f":o+="\f";break;case"v":o+="\v";break;case"0":if(/\d/.test(f[l+1]??""))return;o+="\x00";break;case"x":case"u":{let r=e==="u"&&f[l+1]==="{",k=l+(r?2:1),p=r?f.indexOf("}",k):k+(e==="x"?2:4),S=f.slice(k,p);if(p<k||p>c||!/^[\da-f]+$/i.test(S)||r&&S.length>6)return;let y=Number.parseInt(S,16);if(y>1114111)return;o+=String.fromCodePoint(y),l=r?p:p-1;break}default:if(/\d/.test(e))return;o+=e}}return o}function E(f,o){let c=o;for(let l of f){let e=l.charCodeAt(0);if(l===o||l==="\\")c+=`\\${l}`;else if(e<32||e===8232||e===8233||l.length===1&&e>=55296&&e<=57343)c+=`\\u${e.toString(16).padStart(4,"0")}`;else c+=l}return c+o}function Ue(f){let o=t(f),c=(p)=>o[p]?f.slice(o[p].start,o[p].end):"";if(c(0)!=="import")return;let l=c(1)==="type"&&c(2)!=="=",e=l?2:1;if(o[e]?.kind!=="word"||c(e+1)!=="="||c(e+2)!=="require"||c(e+3)!=="("||o[e+4]?.kind!=="quoted"||c(e+5)!==")")return;let r=e+6;if(o.length!==r&&!(o.length===r+1&&c(r)===";"))return;let k=d(c(e+4));if(k===void 0)return;return{name:c(e),source:k,isTypeOnly:l,end:o[o.length-1].end}}function b(f){let o=t(f),c=[],l=new Set,e=(n)=>n>=0&&n<o.length?f.slice(o[n].start,o[n].end):"",r=(n)=>o[n]?.kind==="quoted",k=(n)=>o[n]?.kind==="word",p=[],S=!1,y=0;if(f.includes("declare")&&f.includes("module"))for(let n=0;n<o.length;n++){let u=e(n);if(y===0&&k(n)&&e(n-1)!=="."&&e(n-1)!=="#"){if(u==="export"||u==="import"&&e(n+1)!=="("&&e(n+1)!==".")S=!0;if(u==="declare"&&e(n+1)==="module"&&r(n+2)&&e(n+3)==="{")p.push(n+2)}if(u==="{"||u==="("||u==="[")y++;else if(u==="}"||u===")"||u==="]")y--}function M(n,u=!1){if(e(n)==="*"){if(e(n+1)==="as")return k(n+2)||u&&r(n+2)?n+3:-1;return u?n+1:-1}if(e(n)!=="{")return-1;let s=1;for(let x=n+1;x<o.length;x++)if(e(x)==="{")s++;else if(e(x)==="}"&&--s===0)return x+1;else if(o[x].kind==="literal"||e(x)===";")return-1;return-1}function w(n,u,s,x){let T=o[n];if(!T||T.kind!=="quoted"||l.has(T.start))return;let C=d(f.slice(T.start,T.end));if(C===void 0)return;l.add(T.start),c.push({specifier:C,kind:u,isTypeOnly:s,category:x,start:T.start,end:T.end})}for(let n=0;n<o.length;n++){if(!k(n)||e(n-1)==="."||e(n-1)==="#")continue;let u=e(n),s=n+1;if(u==="export"){let x=e(s)==="type";if(x)s++;let T=e(s)==="*"?e(s+1)==="as"?"export-star-as":"export-star":"export-named",C=M(s,!0);if(C>=0&&e(C)==="from")w(C+1,T,x,"export")}else if(u==="import"){if(r(s)){w(s,"import",!1,"static-import");continue}if(e(s)==="("){if(e(s+2)===")"||e(s+2)===",")w(s+1,"import",!1,"import-type");continue}let x=e(s)==="type"&&e(s+1)!=="from"&&e(s+1)!=="="&&e(s+1)!==",";if(x)s++;if(k(s)){if(s++,e(s)==="="){if(e(s+1)==="require"&&e(s+2)==="("&&e(s+4)===")")w(s+3,"import",x,"static-import");continue}if(e(s)===",")s=M(s+1)}else s=M(s);if(s>=0&&e(s)==="from")w(s+1,"import",x,"static-import")}}if(S&&p.length){for(let n of p)w(n,"import",!0,"augmentation");c.sort((n,u)=>n.start-u.start)}return c}
7
- export{t,m,lr,d,E,Ue,b};
6
+ `;break;case"r":o+="\r";break;case"t":o+="\t";break;case"b":o+="\b";break;case"f":o+="\f";break;case"v":o+="\v";break;case"0":if(/\d/.test(f[l+1]??""))return;o+="\x00";break;case"x":case"u":{let r=e==="u"&&f[l+1]==="{",k=l+(r?2:1),p=r?f.indexOf("}",k):k+(e==="x"?2:4),S=f.slice(k,p);if(p<k||p>c||!/^[\da-f]+$/i.test(S)||r&&S.length>6)return;let y=Number.parseInt(S,16);if(y>1114111)return;o+=String.fromCodePoint(y),l=r?p:p-1;break}default:if(/\d/.test(e))return;o+=e}}return o}function E(f,o){let c=o;for(let l of f){let e=l.charCodeAt(0);if(l===o||l==="\\")c+=`\\${l}`;else if(e<32||e===8232||e===8233||l.length===1&&e>=55296&&e<=57343)c+=`\\u${e.toString(16).padStart(4,"0")}`;else c+=l}return c+o}function ze(f){let o=t(f),c=(p)=>o[p]?f.slice(o[p].start,o[p].end):"";if(c(0)!=="import")return;let l=c(1)==="type"&&c(2)!=="=",e=l?2:1;if(o[e]?.kind!=="word"||c(e+1)!=="="||c(e+2)!=="require"||c(e+3)!=="("||o[e+4]?.kind!=="quoted"||c(e+5)!==")")return;let r=e+6;if(o.length!==r&&!(o.length===r+1&&c(r)===";"))return;let k=d(c(e+4));if(k===void 0)return;return{name:c(e),source:k,isTypeOnly:l,end:o[o.length-1].end}}function b(f){let o=t(f),c=[],l=new Set,e=(n)=>n>=0&&n<o.length?f.slice(o[n].start,o[n].end):"",r=(n)=>o[n]?.kind==="quoted",k=(n)=>o[n]?.kind==="word",p=[],S=!1,y=0;if(f.includes("declare")&&f.includes("module"))for(let n=0;n<o.length;n++){let u=e(n);if(y===0&&k(n)&&e(n-1)!=="."&&e(n-1)!=="#"){if(u==="export"||u==="import"&&e(n+1)!=="("&&e(n+1)!==".")S=!0;if(u==="declare"&&e(n+1)==="module"&&r(n+2)&&e(n+3)==="{")p.push(n+2)}if(u==="{"||u==="("||u==="[")y++;else if(u==="}"||u===")"||u==="]")y--}function M(n,u=!1){if(e(n)==="*"){if(e(n+1)==="as")return k(n+2)||u&&r(n+2)?n+3:-1;return u?n+1:-1}if(e(n)!=="{")return-1;let s=1;for(let x=n+1;x<o.length;x++)if(e(x)==="{")s++;else if(e(x)==="}"&&--s===0)return x+1;else if(o[x].kind==="literal"||e(x)===";")return-1;return-1}function w(n,u,s,x){let T=o[n];if(!T||T.kind!=="quoted"||l.has(T.start))return;let C=d(f.slice(T.start,T.end));if(C===void 0)return;l.add(T.start),c.push({specifier:C,kind:u,isTypeOnly:s,category:x,start:T.start,end:T.end})}for(let n=0;n<o.length;n++){if(!k(n)||e(n-1)==="."||e(n-1)==="#")continue;let u=e(n),s=n+1;if(u==="export"){let x=e(s)==="type";if(x)s++;let T=e(s)==="*"?e(s+1)==="as"?"export-star-as":"export-star":"export-named",C=M(s,!0);if(C>=0&&e(C)==="from")w(C+1,T,x,"export")}else if(u==="import"){if(r(s)){w(s,"import",!1,"static-import");continue}if(e(s)==="("){if(e(s+2)===")"||e(s+2)===",")w(s+1,"import",!1,"import-type");continue}let x=e(s)==="type"&&e(s+1)!=="from"&&e(s+1)!=="="&&e(s+1)!==",";if(x)s++;if(k(s)){if(s++,e(s)==="="){if(e(s+1)==="require"&&e(s+2)==="("&&e(s+4)===")")w(s+3,"import",x,"static-import");continue}if(e(s)===",")s=M(s+1)}else s=M(s);if(s>=0&&e(s)==="from")w(s+1,"import",x,"static-import")}}if(S&&p.length){for(let n of p)w(n,"import",!0,"augmentation");c.sort((n,u)=>n.start-u.start)}return c}
7
+ export{t,m,lr,d,E,ze,b};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-ex02f2vm.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 mt(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 Ia=mt;
2
+ import{s}from"./chunk-4xvx77zs.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 mt(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 Ia=mt;
3
3
  export{mt,Ia};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Ve}from"./chunk-znsgvx9t.js";import{R}from"./chunk-hzjesnf1.js";import{v}from"./chunk-vhna4qch.js";function In(i,r){let n=new Set;for(let e of R(i,"imports.ts",!1)){if(e.kind!=="import")continue;let t=v(e.text),a=t&&r.get(t.source);if(!t||t.isTypeOnly||!a)continue;let s=rt(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 rt(i){let r=R(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&&Ve(i,n.name)===1).map((n)=>({name:n.name,isDefault:Boolean(n.isDefault)})).sort((n,e)=>n.name.localeCompare(e.name))}
2
+ import{Ve}from"./chunk-2q641ekp.js";import{R}from"./chunk-m9b6cqn7.js";import{v}from"./chunk-zpvcnc7c.js";function In(i,r){let n=new Set;for(let e of R(i,"imports.ts",!1)){if(e.kind!=="import")continue;let t=v(e.text),a=t&&r.get(t.source);if(!t||t.isTypeOnly||!a)continue;let s=rt(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 rt(i){let r=R(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&&Ve(i,n.name)===1).map((n)=>({name:n.name,isDefault:Boolean(n.isDefault)})).sort((n,e)=>n.name.localeCompare(e.name))}
3
3
  export{In,rt};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{basename as e,dirname as n,isAbsolute as i,join as o,relative as a,resolve as s}from"path";function Ui(t){if(!t||typeof t!=="string")throw Error("Invalid file path: must be a non-empty string");return t}function zi(t){if(!t||typeof t!=="string")throw Error("Invalid directory path: must be a non-empty string");return t}function Hi(t){if(!t||typeof t!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return t}function Ki(t){if(typeof t!=="string")throw TypeError("Invalid source code: must be a string");return t}function qi(t){if(typeof t!=="string")throw TypeError("Invalid DTS content: must be a string");return t}function Ji(t){if(!t||typeof t!=="string")throw Error("Invalid module specifier: must be a non-empty string");return t}function Yi(t){if(!t||typeof t!=="string")throw Error("Invalid type name: must be a non-empty string");if(!["string","number","boolean","symbol","bigint","undefined","null","void","never","any","unknown","object"].includes(t)&&!/^[A-Z_$]/.test(t));return t}function Xi(t){if(!t||typeof t!=="string")throw Error("Invalid declaration name: must be a non-empty string");return t}function Zi(t){if(!t||typeof t!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!t.startsWith("/")&&!/^[A-Z]:/i.test(t))throw Error("Invalid absolute path: must start with / or drive letter");return t}function Qi(t){if(!t||typeof t!=="string")throw Error("Invalid relative path: must be a non-empty string");if(t.startsWith("/")||/^[A-Z]:/i.test(t))throw Error("Invalid relative path: must not be absolute");return t}function es(t){if(typeof t!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(t)}catch{throw Error("Invalid JSON string: must be valid JSON")}return t}function ts(t,r){return typeof t==="string"||typeof t==="number"}function ns(t){return t}var rs={join(t,...r){return o(t,...r)},dirname(t){return n(t)},basename(t){return e(t)},resolve(...t){return s(...t)},isAbsolute(t){return i(t)},relative(t,r){return a(t,r)}};
3
- export{Ui,zi,Hi,Ki,qi,Ji,Yi,Xi,Zi,Qi,es,ts,ns,rs};
2
+ import{basename as e,dirname as n,isAbsolute as i,join as o,relative as a,resolve as s}from"path";function zi(t){if(!t||typeof t!=="string")throw Error("Invalid file path: must be a non-empty string");return t}function Ui(t){if(!t||typeof t!=="string")throw Error("Invalid directory path: must be a non-empty string");return t}function Hi(t){if(!t||typeof t!=="string")throw Error("Invalid glob pattern: must be a non-empty string");return t}function Ki(t){if(typeof t!=="string")throw TypeError("Invalid source code: must be a string");return t}function qi(t){if(typeof t!=="string")throw TypeError("Invalid DTS content: must be a string");return t}function Ji(t){if(!t||typeof t!=="string")throw Error("Invalid module specifier: must be a non-empty string");return t}function Yi(t){if(!t||typeof t!=="string")throw Error("Invalid type name: must be a non-empty string");if(!["string","number","boolean","symbol","bigint","undefined","null","void","never","any","unknown","object"].includes(t)&&!/^[A-Z_$]/.test(t));return t}function Xi(t){if(!t||typeof t!=="string")throw Error("Invalid declaration name: must be a non-empty string");return t}function Zi(t){if(!t||typeof t!=="string")throw Error("Invalid absolute path: must be a non-empty string");if(!t.startsWith("/")&&!/^[A-Z]:/i.test(t))throw Error("Invalid absolute path: must start with / or drive letter");return t}function Qi(t){if(!t||typeof t!=="string")throw Error("Invalid relative path: must be a non-empty string");if(t.startsWith("/")||/^[A-Z]:/i.test(t))throw Error("Invalid relative path: must not be absolute");return t}function es(t){if(typeof t!=="string")throw TypeError("Invalid JSON string: must be a string");try{JSON.parse(t)}catch{throw Error("Invalid JSON string: must be valid JSON")}return t}function ts(t,r){return typeof t==="string"||typeof t==="number"}function ns(t){return t}var rs={join(t,...r){return o(t,...r)},dirname(t){return n(t)},basename(t){return e(t)},resolve(...t){return s(...t)},isAbsolute(t){return i(t)},relative(t,r){return a(t,r)}};
3
+ export{zi,Ui,Hi,Ki,qi,Ji,Yi,Xi,Zi,Qi,es,ts,ns,rs};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{G}from"./chunk-srfpcjtn.js";import{p}from"./chunk-v6fwy63g.js";var f=100,c=new Map,a=new Map,u=new Map,g=0;function d(e,n,t){let r={fileName:e,text:n};c.delete(e),c.set(e,{file:r,hash:t});while(c.size>f){let s=c.keys().next().value;if(s===void 0)break;c.delete(s)}return r}function b(e,n,t){return u.set(e,(u.get(e)??0)+1),d(e,n,t)}function _t(e,n,t=p(n)){let r=c.get(e);if(r?.hash===t)return c.delete(e),c.set(e,r),r.file;return b(e,n,t)}async function ue(e,n,t={}){let r=p(n);if(c.get(e)?.hash===r)return _t(e,n,r);let o=`${e}\x00${String(r)}`,i=a.get(o);if(i)return i;let h=(u.get(e)??0)+1;u.set(e,h);let m=g,l;return l=Promise.resolve().then(async()=>{try{if(n.length>=(t.asyncThreshold??1e5))await new Promise((y)=>setTimeout(y,Math.max(0,t.yieldInterval??0)));if(m===g&&u.get(e)===h)return d(e,n,r);return{fileName:e,text:n}}finally{if(a.get(o)===l)a.delete(o)}}),a.set(o,l),l}async function _n(e,n={}){let t=new Map,r=G(n.concurrency,4);for(let s=0;s<e.length;s+=r){let o=await Promise.all(e.slice(s,s+r).map(async(i)=>({path:i.filePath,file:await ue(i.filePath,i.sourceCode,n)})));for(let i of o)t.set(i.path,i.file)}return t}function jn(){g++,c.clear(),a.clear(),u.clear()}function Gn(){return c.size}function Vn(){return a.size}function Un(e,n={}){return e.length>=(n.asyncThreshold??1e5)}
3
- export{_t,ue,_n,jn,Gn,Vn,Un};
2
+ import{G}from"./chunk-srfpcjtn.js";import{p}from"./chunk-v6fwy63g.js";var f=100,c=new Map,a=new Map,u=new Map,g=0;function d(e,n,t){let r={fileName:e,text:n};c.delete(e),c.set(e,{file:r,hash:t});while(c.size>f){let s=c.keys().next().value;if(s===void 0)break;c.delete(s)}return r}function b(e,n,t){return u.set(e,(u.get(e)??0)+1),d(e,n,t)}function _t(e,n,t=p(n)){let r=c.get(e);if(r?.hash===t)return c.delete(e),c.set(e,r),r.file;return b(e,n,t)}async function ue(e,n,t={}){let r=p(n);if(c.get(e)?.hash===r)return _t(e,n,r);let o=`${e}\x00${String(r)}`,i=a.get(o);if(i)return i;let h=(u.get(e)??0)+1;u.set(e,h);let m=g,l;return l=Promise.resolve().then(async()=>{try{if(n.length>=(t.asyncThreshold??1e5))await new Promise((y)=>setTimeout(y,Math.max(0,t.yieldInterval??0)));if(m===g&&u.get(e)===h)return d(e,n,r);return{fileName:e,text:n}}finally{if(a.get(o)===l)a.delete(o)}}),a.set(o,l),l}async function _n(e,n={}){let t=new Map,r=G(n.concurrency,4);for(let s=0;s<e.length;s+=r){let o=await Promise.all(e.slice(s,s+r).map(async(i)=>({path:i.filePath,file:await ue(i.filePath,i.sourceCode,n)})));for(let i of o)t.set(i.path,i.file)}return t}function jn(){g++,c.clear(),a.clear(),u.clear()}function Gn(){return c.size}function Vn(){return a.size}function zn(e,n={}){return e.length>=(n.asyncThreshold??1e5)}
3
+ export{_t,ue,_n,jn,Gn,Vn,zn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{u}from"./chunk-02yqpwv0.js";import{b}from"./chunk-d0dbet9n.js";import{C}from"./chunk-vhna4qch.js";import{r}from"./chunk-wrvgt39b.js";import{Me}from"./chunk-atzh1g6f.js";function sa(c){if(!c.includes("declare")||!c.includes("module"))return[];return b(c).filter((d)=>d.category==="augmentation").map((d)=>d.specifier)}function A(c,d){let m=new Set([c]);for(let S of m)for(let p of d(S))m.add(p);return m}async function Re(c,d,m=!1,S){let p=new Map,v=new Map;for(let e of c){let g=S?.get(e)??await u(e);p.set(e,g);let s=sa(g);if(s.length)v.set(e,s)}let w=new Map;if(v.size===0)return w;let l=new Map,x=(e,g)=>{let s=d(e,g);if(s.resolved)return s.resolved;if(!s.isRelative&&!s.isAlias)return`external:${e}`;return};for(let[e,g]of p){let s=r(g,e,!1,m),a=Me(s),f={edges:[],declarations:new Set,augmentations:new Set},h=(n,i,t)=>{let o=x(n.specifier,e);if(!o)return;if(p.has(o))f.edges.push({specifier:n.specifier,target:o,import:i});if(t)f.declarations.add(o)};for(let n of s){if(n.kind!=="import")continue;let i=n.isSideEffect||C(n.text).some((t)=>a.usedItems.has(t));for(let t of b(n.text))h(t,!0,!!i)}for(let n of b(a.referenceText))h(n,!1,!0);for(let n of v.get(e)??[]){let i=x(n,e);if(i)f.augmentations.add(i),f.declarations.add(i)}l.set(e,f)}let y=!0;while(y){y=!1;for(let[e,g]of l){let s=A(e,(a)=>l.get(a)?.declarations??[]);for(let[a,f]of l){if(s.has(a)||!f.augmentations.size||![...f.augmentations].some((t)=>s.has(t)))continue;let h=[e],n=new Map,i=new Set([e]);for(let t of h){if(t===a)break;for(let o of l.get(t).edges){if(i.has(o.target))continue;i.add(o.target),n.set(o.target,{from:t,edge:o}),h.push(o.target)}}if(!n.has(a))continue;for(let t=a;t!==e;){let{from:o,edge:R}=n.get(t),I=l.get(o);if(R.import){let M=w.get(o);if(!M)M=new Set,w.set(o,M);M.add(R.specifier)}if(!I.declarations.has(t))I.declarations.add(t),y=!0;t=o}}}}return w}
2
+ import{u}from"./chunk-02yqpwv0.js";import{b}from"./chunk-6ekgn7sc.js";import{C}from"./chunk-zpvcnc7c.js";import{r}from"./chunk-a04yhmwb.js";import{Me}from"./chunk-t4cdpfrr.js";function sa(c){if(!c.includes("declare")||!c.includes("module"))return[];return b(c).filter((d)=>d.category==="augmentation").map((d)=>d.specifier)}function A(c,d){let m=new Set([c]);for(let S of m)for(let p of d(S))m.add(p);return m}async function Re(c,d,m=!1,S){let p=new Map,v=new Map;for(let e of c){let g=S?.get(e)??await u(e);p.set(e,g);let s=sa(g);if(s.length)v.set(e,s)}let w=new Map;if(v.size===0)return w;let l=new Map,x=(e,g)=>{let s=d(e,g);if(s.resolved)return s.resolved;if(!s.isRelative&&!s.isAlias)return`external:${e}`;return};for(let[e,g]of p){let s=r(g,e,!1,m),a=Me(s),f={edges:[],declarations:new Set,augmentations:new Set},h=(n,i,t)=>{let o=x(n.specifier,e);if(!o)return;if(p.has(o))f.edges.push({specifier:n.specifier,target:o,import:i});if(t)f.declarations.add(o)};for(let n of s){if(n.kind!=="import")continue;let i=n.isSideEffect||C(n.text).some((t)=>a.usedItems.has(t));for(let t of b(n.text))h(t,!0,!!i)}for(let n of b(a.referenceText))h(n,!1,!0);for(let n of v.get(e)??[]){let i=x(n,e);if(i)f.augmentations.add(i),f.declarations.add(i)}l.set(e,f)}let y=!0;while(y){y=!1;for(let[e,g]of l){let s=A(e,(a)=>l.get(a)?.declarations??[]);for(let[a,f]of l){if(s.has(a)||!f.augmentations.size||![...f.augmentations].some((t)=>s.has(t)))continue;let h=[e],n=new Map,i=new Set([e]);for(let t of h){if(t===a)break;for(let o of l.get(t).edges){if(i.has(o.target))continue;i.add(o.target),n.set(o.target,{from:t,edge:o}),h.push(o.target)}}if(!n.has(a))continue;for(let t=a;t!==e;){let{from:o,edge:R}=n.get(t),I=l.get(o);if(R.import){let M=w.get(o);if(!M)M=new Set,w.set(o,M);M.add(R.specifier)}if(!I.declarations.has(t))I.declarations.add(t),y=!0;t=o}}}}return w}
3
3
  export{sa,Re};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{r}from"./chunk-wrvgt39b.js";import{l}from"./chunk-w5m9qv5k.js";import{existsSync as v}from"fs";import{readFile as D}from"fs/promises";import{dirname as N,join as k,resolve as S}from"path";async function $r(e,o=process.cwd()){let i=new Map;for(let t of e){let n=S(o,t),s=await F(n,o);i.set(n,{path:n,dependencies:s,dependents:new Set,state:"pending"})}for(let[t,n]of i)for(let s of n.dependencies){let c=i.get(s);if(c)c.dependents.add(t)}return i}async function F(e,o){let i=new Set;try{let t=await D(e,"utf-8"),n=N(e);for(let s of r(t,e,!1)){let c=s.source;if(!c||!c.startsWith(".")&&!c.startsWith("/"))continue;let a=z(c,n,o);if(a)i.add(a)}}catch{}return i}function z(e,o,i){let t=S(o,e);if(/\.(?:ts|tsx|mts|cts)$/.test(e))return t.includes("node_modules")?null:t;let n=[".ts",".tsx",".mts",".cts"];for(let c of n){let a=`${t}${c}`;if(v(a))return a}for(let c of n){let a=k(t,`index${c}`);if(v(a))return a}let s=`${t}.ts`;return s.includes("node_modules")?null:s}function G(e){let o=[];for(let[i,t]of e){if(t.state!=="pending")continue;let n=!0;for(let s of t.dependencies){let c=e.get(s);if(c&&c.state!=="completed"){n=!1;break}}if(n)o.push(i)}return o}async function I(e,o={}){let i=await D(e,"utf-8"),t=o.keepComments??!0,n=r(i,e,t,o.isolatedDeclarations??!1);return l(n,{filePath:e,sourceCode:i,declarations:n},t,o.importOrder)}async function ms(e,o={}){let i=performance.now(),{maxConcurrency:t=4,rootDir:n=process.cwd(),config:s={},onProgress:c,onError:a}=o,g=await $r(e,n),w=new Map,P=new Map,h=[],x=0,u=0,m=0,b=g.size;while(m<b){let y=G(g);if(y.length===0){let f=[...g.values()].filter((d)=>d.state==="pending");if(f.length>0)for(let d of f)d.state="failed",d.error=Error("Circular dependency detected or dependency failed"),P.set(d.path,d.error),m++;break}let C=y.slice(0,t-u);for(let f of C){let d=g.get(f);d.state="processing",u++}x=Math.max(x,u);let E=C.map(async(f)=>{let d=g.get(f),M=performance.now();try{let p=await I(f,s);d.state="completed",d.result=p,d.duration=performance.now()-M,w.set(f,p),h.push(f)}catch(p){if(d.state="failed",d.error=p instanceof Error?p:Error(String(p)),d.duration=performance.now()-M,P.set(f,d.error),a&&!a(f,d.error))throw Error("Processing aborted by error handler")}finally{u--,m++,c?.(m,b,f)}});await Promise.all(E)}return{success:w,failed:P,totalTimeMs:performance.now()-i,maxConcurrent:x,processingOrder:h}}function gs(e){let o=[],i=new Set,t=new Set;function n(s){if(i.has(s))return;if(t.has(s))return;t.add(s);let c=e.get(s);if(c){for(let a of c.dependencies)if(e.has(a))n(a)}t.delete(s),i.add(s),o.push(s)}for(let s of e.keys())n(s);return o}function Er(e){let o=[];for(let[i,t]of e){let n=!1;for(let s of t.dependencies)if(e.has(s)){n=!0;break}if(!n)o.push(i)}return o}function kr(e){let o=[],i=new Set;while(i.size<e.size){let t=[];for(let[n,s]of e){if(i.has(n))continue;let c=!0;for(let a of s.dependencies)if(e.has(a)&&!i.has(a)){c=!1;break}if(c)t.push(n)}if(t.length===0){for(let n of e.keys())if(!i.has(n))t.push(n)}for(let n of t)i.add(n);o.push(t)}return o}function hs(e){let o=kr(e),i=Er(e),t=Math.max(...o.map((s)=>s.length)),n=e.size/o.length;return{totalFiles:e.size,independentFiles:i.length,maxParallelism:t,levels:o.length,estimatedSpeedup:n}}
2
+ import{r}from"./chunk-a04yhmwb.js";import{l}from"./chunk-jkeqyj50.js";import{existsSync as v}from"fs";import{readFile as D}from"fs/promises";import{dirname as N,join as k,resolve as S}from"path";async function $r(e,o=process.cwd()){let i=new Map;for(let t of e){let n=S(o,t),s=await F(n,o);i.set(n,{path:n,dependencies:s,dependents:new Set,state:"pending"})}for(let[t,n]of i)for(let s of n.dependencies){let c=i.get(s);if(c)c.dependents.add(t)}return i}async function F(e,o){let i=new Set;try{let t=await D(e,"utf-8"),n=N(e);for(let s of r(t,e,!1)){let c=s.source;if(!c||!c.startsWith(".")&&!c.startsWith("/"))continue;let a=z(c,n,o);if(a)i.add(a)}}catch{}return i}function z(e,o,i){let t=S(o,e);if(/\.(?:ts|tsx|mts|cts)$/.test(e))return t.includes("node_modules")?null:t;let n=[".ts",".tsx",".mts",".cts"];for(let c of n){let a=`${t}${c}`;if(v(a))return a}for(let c of n){let a=k(t,`index${c}`);if(v(a))return a}let s=`${t}.ts`;return s.includes("node_modules")?null:s}function G(e){let o=[];for(let[i,t]of e){if(t.state!=="pending")continue;let n=!0;for(let s of t.dependencies){let c=e.get(s);if(c&&c.state!=="completed"){n=!1;break}}if(n)o.push(i)}return o}async function I(e,o={}){let i=await D(e,"utf-8"),t=o.keepComments??!0,n=r(i,e,t,o.isolatedDeclarations??!1);return l(n,{filePath:e,sourceCode:i,declarations:n},t,o.importOrder)}async function ms(e,o={}){let i=performance.now(),{maxConcurrency:t=4,rootDir:n=process.cwd(),config:s={},onProgress:c,onError:a}=o,g=await $r(e,n),w=new Map,P=new Map,h=[],x=0,u=0,m=0,b=g.size;while(m<b){let y=G(g);if(y.length===0){let f=[...g.values()].filter((d)=>d.state==="pending");if(f.length>0)for(let d of f)d.state="failed",d.error=Error("Circular dependency detected or dependency failed"),P.set(d.path,d.error),m++;break}let C=y.slice(0,t-u);for(let f of C){let d=g.get(f);d.state="processing",u++}x=Math.max(x,u);let E=C.map(async(f)=>{let d=g.get(f),M=performance.now();try{let p=await I(f,s);d.state="completed",d.result=p,d.duration=performance.now()-M,w.set(f,p),h.push(f)}catch(p){if(d.state="failed",d.error=p instanceof Error?p:Error(String(p)),d.duration=performance.now()-M,P.set(f,d.error),a&&!a(f,d.error))throw Error("Processing aborted by error handler")}finally{u--,m++,c?.(m,b,f)}});await Promise.all(E)}return{success:w,failed:P,totalTimeMs:performance.now()-i,maxConcurrent:x,processingOrder:h}}function gs(e){let o=[],i=new Set,t=new Set;function n(s){if(i.has(s))return;if(t.has(s))return;t.add(s);let c=e.get(s);if(c){for(let a of c.dependencies)if(e.has(a))n(a)}t.delete(s),i.add(s),o.push(s)}for(let s of e.keys())n(s);return o}function Er(e){let o=[];for(let[i,t]of e){let n=!1;for(let s of t.dependencies)if(e.has(s)){n=!0;break}if(!n)o.push(i)}return o}function kr(e){let o=[],i=new Set;while(i.size<e.size){let t=[];for(let[n,s]of e){if(i.has(n))continue;let c=!0;for(let a of s.dependencies)if(e.has(a)&&!i.has(a)){c=!1;break}if(c)t.push(n)}if(t.length===0){for(let n of e.keys())if(!i.has(n))t.push(n)}for(let n of t)i.add(n);o.push(t)}return o}function hs(e){let o=kr(e),i=Er(e),t=Math.max(...o.map((s)=>s.length)),n=e.size/o.length;return{totalFiles:e.size,independentFiles:i.length,maxParallelism:t,levels:o.length,estimatedSpeedup:n}}
3
3
  export{$r,ms,gs,Er,kr,hs};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{G}from"./chunk-srfpcjtn.js";import{Le,Wn}from"./chunk-cgz4sy6k.js";import{ue,jn}from"./chunk-rnvqc8st.js";function Ri(){jn(),Wn()}function r(e,t,c=!0,n=!1,o){return Le(e,t,c,n,o)}async function Bn(e,t,c=!0,n={}){return await ue(t,e,n),r(e,t,c)}async function Mi(e,t={}){let c=G(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 Bn(a.sourceCode,a.filePath,a.keepComments,t)})));for(let a of i)n.set(a.path,a.declarations)}return n}
2
+ import{G}from"./chunk-srfpcjtn.js";import{Le,Wn}from"./chunk-cq5zpg9c.js";import{ue,jn}from"./chunk-937czex4.js";function Ri(){jn(),Wn()}function r(e,t,c=!0,n=!1,o){return Le(e,t,c,n,o)}async function Bn(e,t,c=!0,n={}){return await ue(t,e,n),r(e,t,c)}async function Mi(e,t={}){let c=G(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 Bn(a.sourceCode,a.filePath,a.keepComments,t)})));for(let a of i)n.set(a.path,a.declarations)}return n}
3
3
  export{Ri,r,Bn,Mi};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-ex02f2vm.js";function ve(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 La=ve,dr=ve,Na=ve;
2
+ import{s}from"./chunk-4xvx77zs.js";function ve(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 La=ve,dr=ve,Na=ve;
3
3
  export{ve,La,dr,Na};
@@ -1,14 +1,14 @@
1
1
  // @bun
2
- import{st}from"./chunk-02yqpwv0.js";import{P}from"./chunk-kdz4gxdq.js";import{Mn}from"./chunk-rwdcmcx3.js";import{ke}from"./chunk-hgg4aqvf.js";import{ce}from"./chunk-x6ddycvm.js";import y from"process";import{readdir as v}from"fs/promises";import{join as C,resolve as D}from"path";function tt(){return`${String.fromCharCode(47,47,35)} sourceMappingURL=`}function Mo(n,r){throw Error(r||`Unexpected value: ${n}`)}async function Y(n,r,o="lf"){let t=r.replace(/\r\n/g,`
2
+ import{st}from"./chunk-02yqpwv0.js";import{D}from"./chunk-m7jndt3v.js";import{Mn}from"./chunk-rwdcmcx3.js";import{ke}from"./chunk-hgg4aqvf.js";import{ce}from"./chunk-x6ddycvm.js";import y from"process";import{readdir as v}from"fs/promises";import{join as C,resolve as b}from"path";function tt(){return`${String.fromCharCode(47,47,35)} sourceMappingURL=`}function Mo(n,r){throw Error(r||`Unexpected value: ${n}`)}async function Y(n,r,o="lf"){let t=r.replace(/\r\n/g,`
3
3
  `);if(!t.endsWith(`
4
4
  `))t+=`
5
5
  `;if(o==="crlf")t=t.replace(/\n/g,`\r
6
- `);if(await st(n,t)!==Buffer.byteLength(t,"utf8"))throw Error(`Incomplete declaration write: ${n}`)}async function yi(n){let r=n??P.root,o=await v(r,{withFileTypes:!0});return(await Promise.all(o.map((i)=>{let c=C(r,i.name);return i.isDirectory()?yi(c):c}))).flat(1/0).filter((i)=>{if(typeof i!=="string")return!1;return/\.(?:ts|tsx|mts|cts)$/.test(i)&&!/\.d\.(?:ts|mts|cts)$/.test(i)})}async function re(n){try{let r=n?.cwd||y.cwd();return(await ce(D(r,n?.tsconfigPath||"tsconfig.json"),{allowCircular:!0}))?.isolatedDeclarations??!1}catch{return!1}}function Tt(n,r){let o={isValid:!0,errors:[]};for(let t of ke(n))o.errors.push({line:t.line,column:t.column,message:t.message,code:t.code});for(let t of Mn(n))o.errors.push({line:t.line,column:1,message:`'${t.name}' is used but never declared or imported here, so it resolves to an error type for anything consuming this file. It is most likely an ambient global in the source project \u2014 import it explicitly. Referenced by: ${t.context}`,code:"dangling-type-reference"});return o.isValid=o.errors.length===0,o}function At(n,r,o){if(n===r)return"";let t=n.split(`
6
+ `);if(await st(n,t)!==Buffer.byteLength(t,"utf8"))throw Error(`Incomplete declaration write: ${n}`)}async function yi(n){let r=n??D.root,o=await v(r,{withFileTypes:!0});return(await Promise.all(o.map((i)=>{let c=C(r,i.name);return i.isDirectory()?yi(c):c}))).flat(1/0).filter((i)=>{if(typeof i!=="string")return!1;return/\.(?:ts|tsx|mts|cts)$/.test(i)&&!/\.d\.(?:ts|mts|cts)$/.test(i)})}async function re(n){try{let r=n?.cwd||y.cwd();return(await ce(b(r,n?.tsconfigPath||"tsconfig.json"),{allowCircular:!0}))?.isolatedDeclarations??!1}catch{return!1}}function Tt(n,r){let o={isValid:!0,errors:[]};for(let t of ke(n))o.errors.push({line:t.line,column:t.column,message:t.message,code:t.code});for(let t of Mn(n))o.errors.push({line:t.line,column:1,message:`'${t.name}' is used but never declared or imported here, so it resolves to an error type for anything consuming this file. It is most likely an ambient global in the source project \u2014 import it explicitly. Referenced by: ${t.context}`,code:"dangling-type-reference"});return o.isValid=o.errors.length===0,o}function At(n,r,o){if(n===r)return"";let t=n.split(`
7
7
  `),i=r.split(`
8
8
  `),c=new Map,a=new Map;for(let e=0;e<t.length;e++)c.set(t[e],(c.get(t[e])??0)+1);for(let e=0;e<i.length;e++)a.set(i[e],(a.get(i[e])??0)+1);let g=[],u=[];for(let[e,s]of c){let m=s-(a.get(e)??0);for(let l=0;l<m;l++)g.push(e)}for(let[e,s]of a){let m=s-(c.get(e)??0);for(let l=0;l<m;l++)u.push(e)}if(g.length===0&&u.length===0)return"";let p=[`--- ${o}`,`+++ ${o}`];for(let e=0;e<g.length;e++)p.push(`- ${g[e]}`);for(let e=0;e<u.length;e++)p.push(`+ ${u[e]}`);return p.join(`
9
- `)}function Pt(n,r,o,t){let i=n.split(`
9
+ `)}function Dt(n,r,o,t){let i=n.split(`
10
10
  `),c=[];function a(s){let l="",f=s<0?-s<<1|1:s<<1;do{let d=f&31;if(f>>>=5,f>0)d|=32;l+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[d]}while(f>0);return l}let g=0,u=0,p=0,e=t.split(`
11
- `).length;for(let s=0;s<i.length;s++){if(i[s].trim()===""){c.push("");continue}g=0;let l=Math.min(s,e-1),f=[],d=0-g,h=0,w=l-u,x=0-p;f.push(a(d)+a(h)+a(w)+a(x)),g=0,u=l,p=0,c.push(f.join(","))}return{version:3,file:r,sourceRoot:"",sources:[o],sourcesContent:[t],mappings:c.join(";")}}function Dt(n,r){return`${n}
11
+ `).length;for(let s=0;s<i.length;s++){if(i[s].trim()===""){c.push("");continue}g=0;let l=Math.min(s,e-1),f=[],d=0-g,h=0,w=l-u,x=0-p;f.push(a(d)+a(h)+a(w)+a(x)),g=0,u=l,p=0,c.push(f.join(","))}return{version:3,file:r,sourceRoot:"",sources:[o],sourcesContent:[t],mappings:c.join(";")}}function Pt(n,r){return`${n}
12
12
  ${tt()}${r}
13
13
  `}
14
- export{tt,Mo,Y,yi,re,Tt,At,Pt,Dt};
14
+ export{tt,Mo,Y,yi,re,Tt,At,Dt,Pt};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{r}from"./chunk-wrvgt39b.js";import{l}from"./chunk-w5m9qv5k.js";import{existsSync as P,readFileSync as b,unwatchFile as w}from"fs";var Ur;((o)=>{o[o.Error=1]="Error";o[o.Warning=2]="Warning";o[o.Information=3]="Information";o[o.Hint=4]="Hint"})(Ur||={});var zr;((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"})(zr||={});var Hr;((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"})(Hr||={});var Kr;((n)=>{n[n.Text=1]="Text";n[n.Read=2]="Read";n[n.Write=3]="Write"})(Kr||={});class fn{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-a04yhmwb.js";import{l}from"./chunk-jkeqyj50.js";import{existsSync as P,readFileSync as b,unwatchFile as w}from"fs";var zr;((o)=>{o[o.Error=1]="Error";o[o.Warning=2]="Warning";o[o.Information=3]="Information";o[o.Hint=4]="Hint"})(zr||={});var Ur;((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"})(Ur||={});var Hr;((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"})(Hr||={});var Kr;((n)=>{n[n.Text=1]="Text";n[n.Read=2]="Read";n[n.Write=3]="Write"})(Kr||={});class fn{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(`
@@ -18,5 +18,5 @@ ${v[1].trim()}`}return{contents:{kind:"markdown",value:m}}}completion(t){let e=t
18
18
  \r
19
19
  `);if(n===-1)break;let a=e.slice(0,n).match(/Content-Length:\s*(\d+)/i);if(!a){e=e.slice(n+4);continue}let u=Number.parseInt(a[1],10),d=n+4,g=d+u;if(e.length<g)break;let f=e.slice(d,g);e=e.slice(g);try{let p=JSON.parse(f),m=t.handleMessage(p);if(m){let x=JSON.stringify(m),v=Buffer.byteLength(x,"utf8");process.stdout.write(`Content-Length: ${v}\r
20
20
  \r
21
- ${x}`)}}catch(p){console.error("Error parsing LSP message:",p)}}})}function Us(t,e){return(i)=>{if(!P(i))return;let n=b(i,"utf-8"),o=`file://${i}`;t.didOpen({textDocument:{uri:o,languageId:"typescript",version:1,text:n}});let a=t.getDiagnostics(o);e(o,a)}}
22
- export{Ur,zr,Hr,Kr,fn,Vs,Us};
21
+ ${x}`)}}catch(p){console.error("Error parsing LSP message:",p)}}})}function zs(t,e){return(i)=>{if(!P(i))return;let n=b(i,"utf-8"),o=`file://${i}`;t.didOpen({textDocument:{uri:o,languageId:"typescript",version:1,text:n}});let a=t.getDiagnostics(o);e(o,a)}}
22
+ export{zr,Ur,Hr,Kr,fn,Vs,zs};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{r}from"./chunk-wrvgt39b.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 ys(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-a04yhmwb.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 ys(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 tn(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,16 +1,16 @@
1
1
  // @bun
2
- import{f,be}from"./chunk-587w6ktw.js";import{Vt,Ut,n,We,z}from"./chunk-nqdc6n5d.js";function h(t){if(t.includes(`
2
+ import{f,be}from"./chunk-587w6ktw.js";import{Vt,zt,n,We,U}from"./chunk-4nrrjn7g.js";function h(t){if(t.includes(`
3
3
  `))return`/**
4
4
  * ${t}
5
5
  */
6
6
  `;return`/** ${t} */
7
- `}function D(t){let o=t.indexOf("{");if(o===-1)return-1;let s=t.indexOf("<");if(s===-1||s>o)return o;let e=0,r=!1,a="";for(let i=0;i<t.length;i++){let l=t[i],u=i>0?t[i-1]:"";if(!r&&(l==='"'||l==="'"||l==="`"))r=!0,a=l;else if(r&&l===a&&u!=="\\")r=!1;if(!r){if(l==="<")e++;else if(l===">")e--;else if(l==="{"&&e===0)return i}}return-1}function fe(t,o=!0){return f(t.leadingComments,o)+t.text}function x(t,o=!0){if(t.inferenceError)throw Object.assign(Error(`Cannot infer alias '${t.name}': unsupported source value flow`),{code:t.inferenceError});let s=f(t.leadingComments,o);if(!t.typeAnnotation&&t.inferredType)return s+t.text;if(t.typeAnnotation&&!t.value)return s+t.text;let e="";if(t.isExported)e+="export ";e+="declare ";let r=t.modifiers?.[0]||"const";e+=`${r} `,e+=t.name;let{typeAnnotation:a,value:i}=t,l=!a&&i?z(i):null;if(l)a=l;else if(!a&&i&&i.trim().endsWith("as const"))a=n(i,!0,!1,0,t.computedKeyConstants);else if(!a&&i&&r==="const"){let c=i.trim(),m=c.startsWith("{")||c.startsWith("[");if(m)Vt();a=n(i,!m,!1,0,t.computedKeyConstants)}else if(!a&&i)a=n(i,r==="const",!1,0,t.computedKeyConstants);if(!a)a="unknown";let u="";if(o&&i&&!t.typeAnnotation&&!i.trim().endsWith("as const")){let c=i.trim();if(r!=="const"){if((a==="string"||a==="number"||a==="boolean")&&c.length>0)u=`@defaultValue ${c}`}else if(c.startsWith("{")||c.startsWith("[")){let m=Ut();if(m)if(m.includes(`
7
+ `}function D(t){let o=t.indexOf("{");if(o===-1)return-1;let s=t.indexOf("<");if(s===-1||s>o)return o;let e=0,r=!1,a="";for(let i=0;i<t.length;i++){let l=t[i],u=i>0?t[i-1]:"";if(!r&&(l==='"'||l==="'"||l==="`"))r=!0,a=l;else if(r&&l===a&&u!=="\\")r=!1;if(!r){if(l==="<")e++;else if(l===">")e--;else if(l==="{"&&e===0)return i}}return-1}function fe(t,o=!0){return f(t.leadingComments,o)+t.text}function x(t,o=!0){if(t.inferenceError)throw Object.assign(Error(`Cannot infer alias '${t.name}': unsupported source value flow`),{code:t.inferenceError});let s=f(t.leadingComments,o);if(!t.typeAnnotation&&t.inferredType)return s+t.text;if(t.typeAnnotation&&!t.value)return s+t.text;let e="";if(t.isExported)e+="export ";e+="declare ";let r=t.modifiers?.[0]||"const";e+=`${r} `,e+=t.name;let{typeAnnotation:a,value:i}=t,l=!a&&i?U(i):null;if(l)a=l;else if(!a&&i&&i.trim().endsWith("as const"))a=n(i,!0,!1,0,t.computedKeyConstants);else if(!a&&i&&r==="const"){let c=i.trim(),m=c.startsWith("{")||c.startsWith("[");if(m)Vt();a=n(i,!m,!1,0,t.computedKeyConstants)}else if(!a&&i)a=n(i,r==="const",!1,0,t.computedKeyConstants);if(!a)a="unknown";let u="";if(o&&i&&!t.typeAnnotation&&!i.trim().endsWith("as const")){let c=i.trim();if(r!=="const"){if((a==="string"||a==="number"||a==="boolean")&&c.length>0)u=`@defaultValue ${c}`}else if(c.startsWith("{")||c.startsWith("[")){let m=zt();if(m)if(m.includes(`
8
8
  `))u=`@defaultValue
9
9
  * \`\`\`ts
10
10
  ${m.split(`
11
11
  `).map((p)=>` * ${p}`).join(`
12
12
  `)}
13
- * \`\`\``;else u=`@defaultValue \`${m}\``}}else if(o&&i&&t.typeAnnotation&&We(t.typeAnnotation)){Vt();let c=i.trim(),m=c.endsWith("as const")?c.slice(0,-8).trim():c;n(m,!1,!1,0,t.computedKeyConstants);let d=Ut();if(d)if(d.includes(`
13
+ * \`\`\``;else u=`@defaultValue \`${m}\``}}else if(o&&i&&t.typeAnnotation&&We(t.typeAnnotation)){Vt();let c=i.trim(),m=c.endsWith("as const")?c.slice(0,-8).trim():c;n(m,!1,!1,0,t.computedKeyConstants);let d=zt();if(d)if(d.includes(`
14
14
  `))u=`@defaultValue
15
15
  * \`\`\`ts
16
16
  ${d.split(`
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  var Se={PARSE_ERROR:"PARSE_ERROR",SYNTAX_ERROR:"SYNTAX_ERROR",FILE_NOT_FOUND:"FILE_NOT_FOUND",FILE_READ_ERROR:"FILE_READ_ERROR",FILE_WRITE_ERROR:"FILE_WRITE_ERROR",TYPE_INFERENCE_ERROR:"TYPE_INFERENCE_ERROR",UNRESOLVED_TYPE:"UNRESOLVED_TYPE",EXTRACTION_ERROR:"EXTRACTION_ERROR",PROCESSING_ERROR:"PROCESSING_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",INVALID_DECLARATION:"INVALID_DECLARATION",CONFIG_ERROR:"CONFIG_ERROR",INVALID_ENTRYPOINT:"INVALID_ENTRYPOINT",CIRCULAR_DEPENDENCY:"CIRCULAR_DEPENDENCY",TIMEOUT_ERROR:"TIMEOUT_ERROR",NOT_SUPPORTED:"NOT_SUPPORTED",UNKNOWN_ERROR:"UNKNOWN_ERROR"};class T extends Error{code;context;constructor(n,e="UNKNOWN_ERROR",t){super(n);if(this.name="DtsxError",this.code=e,this.context=t,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toString(){let n=`${this.name} [${this.code}]: ${this.message}`;if(this.context)n+=`
3
- Context: ${JSON.stringify(this.context,null,2)}`;return n}toJSON(){return{name:this.name,code:this.code,message:this.message,context:this.context,stack:this.stack}}}class Tn extends T{filePath;line;column;constructor(n,e,t){super(n,"PARSE_ERROR",{filePath:e,line:t?.line,column:t?.column});if(this.name="ParseError",this.filePath=e,this.line=t?.line,this.column=t?.column,t?.cause)this.cause=t.cause}get locationString(){if(this.line!==void 0&&this.column!==void 0)return`${this.filePath}:${this.line}:${this.column}`;return this.line!==void 0?`${this.filePath}:${this.line}`:this.filePath}}class ui extends T{filePath;declarationKind;constructor(n,e,t,s){super(n,"EXTRACTION_ERROR",{filePath:e,declarationKind:t});if(this.name="ExtractionError",this.filePath=e,this.declarationKind=t,s)this.cause=s}}class fi extends T{declarationName;constructor(n,e,t){super(n,"PROCESSING_ERROR",{declarationName:e});if(this.name="ProcessingError",this.declarationName=e,t)this.cause=t}}class An extends T{filePath;operation;constructor(n,e,t,s){super(n,t==="read"?"FILE_READ_ERROR":"FILE_WRITE_ERROR",{filePath:e,operation:t});if(this.name="FileError",this.filePath=e,this.operation=t,s)this.cause=s}}class Pn extends T{configPath;invalidKey;constructor(n,e){super(n,"CONFIG_ERROR",{configPath:e?.configPath,invalidKey:e?.invalidKey});if(this.name="ConfigError",this.configPath=e?.configPath,this.invalidKey=e?.invalidKey,e?.cause)this.cause=e.cause}}class di extends T{cycle;constructor(n){super(`Circular dependency detected: ${n.join(" -> ")}`,"CIRCULAR_DEPENDENCY",{cycle:n});this.name="CircularDependencyError",this.cycle=n}}function xo(n){return n instanceof T}function Co(n){return n instanceof Tn}function vo(n){return n instanceof An}function So(n){return n instanceof Pn}function $o(n,e="UNKNOWN_ERROR",t){if(n instanceof T)return n;let s=t||(n instanceof Error?n.message:String(n)),r=new T(s,e);if(n instanceof Error)r.cause=n;return r}function Eo(n,e){let t=1,s=1,r=0;for(let i of n){if(r>=e)break;if(i===`
3
+ Context: ${JSON.stringify(this.context,null,2)}`;return n}toJSON(){return{name:this.name,code:this.code,message:this.message,context:this.context,stack:this.stack}}}class Tn extends T{filePath;line;column;constructor(n,e,t){super(n,"PARSE_ERROR",{filePath:e,line:t?.line,column:t?.column});if(this.name="ParseError",this.filePath=e,this.line=t?.line,this.column=t?.column,t?.cause)this.cause=t.cause}get locationString(){if(this.line!==void 0&&this.column!==void 0)return`${this.filePath}:${this.line}:${this.column}`;return this.line!==void 0?`${this.filePath}:${this.line}`:this.filePath}}class ui extends T{filePath;declarationKind;constructor(n,e,t,s){super(n,"EXTRACTION_ERROR",{filePath:e,declarationKind:t});if(this.name="ExtractionError",this.filePath=e,this.declarationKind=t,s)this.cause=s}}class fi extends T{declarationName;constructor(n,e,t){super(n,"PROCESSING_ERROR",{declarationName:e});if(this.name="ProcessingError",this.declarationName=e,t)this.cause=t}}class An extends T{filePath;operation;constructor(n,e,t,s){super(n,t==="read"?"FILE_READ_ERROR":"FILE_WRITE_ERROR",{filePath:e,operation:t});if(this.name="FileError",this.filePath=e,this.operation=t,s)this.cause=s}}class Dn extends T{configPath;invalidKey;constructor(n,e){super(n,"CONFIG_ERROR",{configPath:e?.configPath,invalidKey:e?.invalidKey});if(this.name="ConfigError",this.configPath=e?.configPath,this.invalidKey=e?.invalidKey,e?.cause)this.cause=e.cause}}class di extends T{cycle;constructor(n){super(`Circular dependency detected: ${n.join(" -> ")}`,"CIRCULAR_DEPENDENCY",{cycle:n});this.name="CircularDependencyError",this.cycle=n}}function xo(n){return n instanceof T}function Co(n){return n instanceof Tn}function vo(n){return n instanceof An}function So(n){return n instanceof Dn}function $o(n,e="UNKNOWN_ERROR",t){if(n instanceof T)return n;let s=t||(n instanceof Error?n.message:String(n)),r=new T(s,e);if(n instanceof Error)r.cause=n;return r}function Eo(n,e){let t=1,s=1,r=0;for(let i of n){if(r>=e)break;if(i===`
4
4
  `)t++,s=1;else s++;r++}return{line:t,column:s,offset:e}}function ko(n,e,t,s){let r=n.split(`
5
5
  `),i=e.line-1,o=[];if(s)o.push(`${s}:${e.line}:${e.column}`);else o.push(`Line ${e.line}, Column ${e.column}`);o.push(`Error: ${t}`),o.push("");let E=Math.max(0,i-1),c=Math.min(r.length-1,i+1);for(let a=E;a<=c;a++){let R=(a+1).toString().padStart(4," "),u=a===i?">":" ";if(o.push(`${u} ${R} | ${r[a]}`),a===i){let l=" ".repeat(8+e.column-1);o.push(`${l}^`)}}return o.join(`
6
6
  `)}function Qe(n,e,t){let s={file:e,message:"Unknown error",code:Se.UNKNOWN_ERROR};if(n instanceof Error){s.message=n.message,s.stack=n.stack;let r=n.message.match(/\((\d+),(\d+)\)/);if(r)s.location={line:Number.parseInt(r[1],10),column:Number.parseInt(r[2],10)};if(n.message.includes("Cannot find")||n.message.includes("not found"))s.code=Se.FILE_NOT_FOUND,s.suggestion="Check that the file path is correct and the file exists.";else if(n.message.includes("syntax")||n.message.includes("Unexpected token"))s.code=Se.SYNTAX_ERROR,s.suggestion="Check for syntax errors in your TypeScript code.";else if(n.message.includes("type")&&n.message.includes("cannot"))s.code=Se.TYPE_INFERENCE_ERROR,s.suggestion="Add explicit type annotations to help with type inference.";else if(n.message.includes("parse")||n.message.includes("Parse"))s.code=Se.PARSE_ERROR,s.suggestion="The file contains invalid TypeScript syntax."}else if(typeof n==="string")s.message=n;return s}function Et(n,e){let t=[],s=n.file;if(n.location)s+=`:${n.location.line}:${n.location.column}`;if(n.code)s+=` [${n.code}]`;if(t.push(s),t.push(` Error: ${n.message}`),e&&n.location){t.push("");let r=e.split(`
7
7
  `),i=n.location.line-1;if(i>=0&&i<r.length){let o=Math.max(0,i-1),E=Math.min(r.length-1,i+1);for(let c=o;c<=E;c++){let a=(c+1).toString().padStart(4," "),R=c===i?">":" ";if(t.push(` ${R} ${a} | ${r[c]}`),c===i&&n.location.column>0){let u=" ".repeat(10+n.location.column-1);t.push(` ${u}^`)}}}}if(n.suggestion)t.push(""),t.push(` Suggestion: ${n.suggestion}`);return t.join(`
8
8
  `)}function To(n){if(n.length===0)return"No errors";let e=new Map;for(let s of n){let r=s.code||"UNKNOWN";e.set(r,(e.get(r)||0)+1)}let t=[`${n.length} error(s) found:`];for(let[s,r]of e.entries())t.push(` - ${s}: ${r}`);return t.join(`
9
9
  `)}
10
- export{Se,T,Tn,ui,fi,An,Pn,di,xo,Co,vo,So,$o,Eo,ko,Qe,Et,To};
10
+ export{Se,T,Tn,ui,fi,An,Dn,di,xo,Co,vo,So,$o,Eo,ko,Qe,Et,To};
@@ -0,0 +1,5 @@
1
+ // @bun
2
+ function a(e){return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36||e>127}function i(e){return a(e)||e>=48&&e<=57}function L(e,_){let n=_;for(;;){while(n>=0&&(e.charCodeAt(n)===32||e.charCodeAt(n)===9||e.charCodeAt(n)===10||e.charCodeAt(n)===13))n--;if(n<0)return-1;if(e.charCodeAt(n)===47&&n>0&&e.charCodeAt(n-1)===42){let l=e.lastIndexOf("/*",n-2);if(l===-1)return-1;n=l-1;continue}let H=e.lastIndexOf(`
3
+ `,n)+1,r=x(e,H,n);if(r!==-1){n=r-1;continue}return n}}function x(e,_,n){if(!e.slice(_,n+1).includes("//"))return-1;return R(e,n).lineCommentStart??-1}function m(e){return e===61||e===40||e===91||e===33||e===38||e===124||e===63||e===58||e===44||e===59||e===123||e===125||e===94||e===126||e===43||e===45||e===42||e===37||e===60||e===62}function p(e){return e==="return"||e==="typeof"||e==="void"||e==="delete"||e==="throw"||e==="new"||e==="in"||e==="of"||e==="case"||e==="instanceof"||e==="yield"||e==="await"||e==="else"||e==="do"}function R(e,_){let n=[],H=[],r=0,l=!1,f="",d="",c=!0,C=0,s=(t,A=!1)=>{d=f,f=t,c=A};while(C<=_){let t=e.charCodeAt(C);if(l){if(t===92){C+=2;continue}if(t===96)l=!1,s("literal");else if(t===36&&e.charCodeAt(C+1)===123)H.push(r++),l=!1,s("{",!0),C++;C++;continue}if(t===32||t===9||t===10||t===13){C++;continue}if(t===47&&e.charCodeAt(C+1)===47){let A=e.indexOf(`
4
+ `,C+2);if(A===-1||A>_)return{regexAllowed:c,closesControlHeader:!1,lineCommentStart:C};C=A===-1?e.length:A+1;continue}if(t===47&&e.charCodeAt(C+1)===42){let A=e.indexOf("*/",C+2);C=A===-1?e.length:A+2;continue}if(t===39||t===34){let A=t;C++;while(C<e.length){let S=e.charCodeAt(C++);if(S===92)C++;else if(S===A)break}s("literal");continue}if(t===96){l=!0,C++;continue}if(a(t)||t===35&&a(e.charCodeAt(C+1))){let A=C++;while(i(e.charCodeAt(C)))C++;let S=e.slice(A,C);s(S,f!=="."&&p(S));continue}if((t===43||t===45)&&e.charCodeAt(C+1)===t){s(e.slice(C,C+2),c),C+=2;continue}if(t===33&&e.charCodeAt(C+1)!==61){s("!",c),C++;continue}if(t===40){let A=d!=="."&&(f==="if"||f==="while"||f==="for"||f==="with"||f==="switch"||f==="catch"||f==="await"&&d==="for");n.push(A),s("(",!0)}else if(t===41){let A=n.pop()??!1;if(C===_)return{regexAllowed:A,closesControlHeader:A};s(")",A)}else if(t===47&&c){C=g(e,C),s("literal");continue}else{if(t===123)r++;else if(t===125){if(r--,H.at(-1)===r)H.pop(),l=!0}s(e[C],t===47||m(t))}C++}return{regexAllowed:c,closesControlHeader:!1}}function h(e,_,n){let H=n===void 0?L(e,_-1):n-1;if(H<0)return!0;let r=e.charCodeAt(H);if(r===33||(r===43||r===45)&&e.charCodeAt(H-1)===r)return R(e,H).regexAllowed;if(r===41)return R(e,H).closesControlHeader;if(m(r))return!0;if(i(r)){let l=H;while(l>=0&&i(e.charCodeAt(l)))l--;let f=e.charCodeAt(L(e,l));if(f===46||f===35)return!1;return p(e.slice(l+1,H+1))}return!1}function g(e,_){let n=_,H=e.length;n++;let r=!1;while(n<H){let l=e.charCodeAt(n);if(l===92){n+=2;continue}if(r){if(l===93)r=!1;n++;continue}if(l===91){r=!0,n++;continue}if(l===47){n++;break}if(l===10||l===13)break;n++}while(n<H&&i(e.charCodeAt(n)))n++;return n}function xe(e,_,n){let H=n===void 0?L(e,_-1):n-1;if(H<0)return!0;let r=e[H];if("=([{,:;!?+-*/%&|^~<".includes(r))return!0;if(r===">"&&e[H-1]==="=")return!0;let l=H;while(l>=0&&i(e.charCodeAt(l)))l--;return["return","throw","yield","await","case","void","typeof","delete","new","else","do"].includes(e.slice(l+1,H+1))}function E(e,_,n,H){let r=e.length;if(e.charCodeAt(_)!==60||_+1>=r)return null;let l=e.charCodeAt(_+1);if(l===62)return{delta:1,end:_+1};if(l===47){let o=_+2;if(e.charCodeAt(o)!==62){if(!a(e.charCodeAt(o)))return null;while(o<r&&(i(e.charCodeAt(o))||".:-".includes(e[o])))o++;while(o<r&&/\s/.test(e[o]))o++}return e.charCodeAt(o)===62?{delta:-1,end:o}:null}if(!a(l))return null;let f=_+2;while(f<r){let o=e.charCodeAt(f);if(!i(o)&&o!==46&&o!==58&&o!==45)break;f++}let d=e.slice(_+1,f),c=e.charCodeAt(f);if(c>32&&c!==62&&c!==47)return null;let C=0,s=0,t=f,A=f;for(;t<r;t++){let o=e.charCodeAt(t);if(s!==0){if(o===92)t++;else if(o===s)s=0,A=t+1;continue}if(o===60&&C>0&&(e[t+1]==="/"||xe(e,t,A))){let u=H?H(t):E(e,t,n);if(u){t=u.end,A=t+1;continue}}if(o===47&&C>0){let u=e.charCodeAt(t+1);if(u===47){while(t<r&&e.charCodeAt(t)!==10&&e.charCodeAt(t)!==13)t++;continue}if(u===42){let b=e.indexOf("*/",t+2);if(b===-1)return null;t=b+1;continue}if(h(e,t,A)){t=g(e,t)-1,A=t+1;continue}}if(o===39||o===34||o===96)s=o;else if(o===123)C++;else if(o===125&&C>0)C--;else if(o===60&&C===0)return null;else if(o===62&&C===0)break;if(o>32)A=t+1}if(t>=r)return null;let S=t-1;while(S>_&&e.charCodeAt(S)<=32)S--;if(e.charCodeAt(S)===47)return{delta:0,end:t};return(n?n.get(d)??-1:e.indexOf(`</${d}`,t+1))>t?{delta:1,end:t}:null}function Ue(e,_){let n,H=new Map;function r(l){if(H.has(l))return H.get(l);if(!n){n=new Map;let d=e.indexOf("</");while(d!==-1){let c=E(e,d);if(c){let C=d+2;while(C<c.end&&!/\s/.test(e[C]))C++;n.set(e.slice(d+2,C),d)}d=e.indexOf("</",d+2)}}let f=E(e,l,n,r);if(H.set(l,f),f&&e[f.end-1]==="/")_?.add(f.end-1);return f}return r}
5
+ export{a,i,h,g,xe,Ue};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{L,N}from"./chunk-8gksa73c.js";import{O,I}from"./chunk-kcfc6zg6.js";import{lr}from"./chunk-d0dbet9n.js";import{p}from"./chunk-v6fwy63g.js";import{R,F}from"./chunk-hzjesnf1.js";var y=100,h=0,e=new Map;function Le(n,s,c=!0,i=!1,l){if(L(s??""))n=N(n);else if(O(s??""))n=I(n);let f=p(n),m=JSON.stringify([s,c,i,[...l??[]].sort()]),a=e.get(m);if(a&&a.contentHash===f)return a.lastAccess=++h,a.declarations;let g=i?R(n,s,c):F(n,s,c,l);if(e.set(m,{declarations:g,contentHash:f,lastAccess:++h}),e.size>y){let S=Math.max(1,Math.ceil(e.size*0.1)),r=[];for(let[t,o]of e)r.push([t,o.lastAccess]);r.sort((t,o)=>t[1]-o[1]);for(let t=0;t<S&&t<r.length;t++)e.delete(r[t][0])}return g}function Wn(){e.clear(),lr()}
2
+ import{L,N}from"./chunk-8gksa73c.js";import{O,I}from"./chunk-kcfc6zg6.js";import{lr}from"./chunk-6ekgn7sc.js";import{p}from"./chunk-v6fwy63g.js";import{R,F}from"./chunk-m9b6cqn7.js";var y=100,h=0,e=new Map;function Le(n,s,c=!0,i=!1,l){if(L(s??""))n=N(n);else if(O(s??""))n=I(n);let f=p(n),m=JSON.stringify([s,c,i,[...l??[]].sort()]),a=e.get(m);if(a&&a.contentHash===f)return a.lastAccess=++h,a.declarations;let g=i?R(n,s,c):F(n,s,c,l);if(e.set(m,{declarations:g,contentHash:f,lastAccess:++h}),e.size>y){let S=Math.max(1,Math.ceil(e.size*0.1)),r=[];for(let[t,o]of e)r.push([t,o.lastAccess]);r.sort((t,o)=>t[1]-o[1]);for(let t=0;t<S&&t<r.length;t++)e.delete(r[t][0])}return g}function Wn(){e.clear(),lr()}
3
3
  export{Le,Wn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{L,N}from"./chunk-8gksa73c.js";import{O,I}from"./chunk-kcfc6zg6.js";import{p}from"./chunk-v6fwy63g.js";import{R,F}from"./chunk-hzjesnf1.js";import{Le}from"./chunk-cgz4sy6k.js";import{l}from"./chunk-w5m9qv5k.js";import{J,Ee}from"./chunk-a0900w7b.js";function Ze(t,n,r,s,e,i){if(s.length!==1||s[0]!=="bun")return null;if(J(i)==="typescript")return null;let a=L(n??"")?N(t):O(n??"")?I(t):t;return Ee(a,{keepComments:r,isolatedDeclarations:e,engine:i,sourceFile:n})}var y=100,x=0,c=new Map;function $t(t,n,r=!0,s=["bun"],e=!1,i){let a=p(t),b=JSON.stringify([n,r,e,s,J(i)]),g=c.get(b);if(g&&g.contentHash===a)return g.lastAccess=++x,g.result;let h=Ze(t,n,r,s,e,i)??E(t,n,r,s,e);if(c.set(b,{result:h,contentHash:a,lastAccess:++x}),c.size>y){let S=Math.max(1,Math.ceil(c.size*0.1)),u=[];for(let[o,f]of c)u.push([o,f.lastAccess]);u.sort((o,f)=>o[1]-f[1]);for(let o=0;o<S&&o<u.length;o++)c.delete(u[o][0])}return h}function ai(t,n,r=!0,s=["bun"]){return $t(t,n,r,s,!0)}function ci(t,n,r=!0,s=["bun"]){return $t(t,n,r,s,!1)}function E(t,n,r,s,e){let i=Le(t,n,r,e);return l(i,{filePath:n??"stdin.ts",sourceCode:t,declarations:i},r,s)}function li(){c.clear()}function Fa(t,n,r=!0,s=["bun"],e=!1,i){return Ze(t,n,r,s,e,i)??En(t,n,r,s,e)}function En(t,n,r=!0,s=["bun"],e=!1){if(L(n??""))t=N(t);else if(O(n??""))t=I(t);let i=e?R(t,n,r):F(t,n,r);return l(i,{filePath:n??"stdin.ts",sourceCode:t,declarations:i},r,s)}
2
+ import{L,N}from"./chunk-8gksa73c.js";import{O,I}from"./chunk-kcfc6zg6.js";import{p}from"./chunk-v6fwy63g.js";import{R,F}from"./chunk-m9b6cqn7.js";import{Le}from"./chunk-cq5zpg9c.js";import{l}from"./chunk-jkeqyj50.js";import{J,Ee}from"./chunk-a0900w7b.js";function Ze(t,n,r,s,e,i){if(s.length!==1||s[0]!=="bun")return null;if(J(i)==="typescript")return null;let a=L(n??"")?N(t):O(n??"")?I(t):t;return Ee(a,{keepComments:r,isolatedDeclarations:e,engine:i,sourceFile:n})}var y=100,x=0,c=new Map;function $t(t,n,r=!0,s=["bun"],e=!1,i){let a=p(t),b=JSON.stringify([n,r,e,s,J(i)]),g=c.get(b);if(g&&g.contentHash===a)return g.lastAccess=++x,g.result;let h=Ze(t,n,r,s,e,i)??E(t,n,r,s,e);if(c.set(b,{result:h,contentHash:a,lastAccess:++x}),c.size>y){let S=Math.max(1,Math.ceil(c.size*0.1)),u=[];for(let[o,f]of c)u.push([o,f.lastAccess]);u.sort((o,f)=>o[1]-f[1]);for(let o=0;o<S&&o<u.length;o++)c.delete(u[o][0])}return h}function ai(t,n,r=!0,s=["bun"]){return $t(t,n,r,s,!0)}function ci(t,n,r=!0,s=["bun"]){return $t(t,n,r,s,!1)}function E(t,n,r,s,e){let i=Le(t,n,r,e);return l(i,{filePath:n??"stdin.ts",sourceCode:t,declarations:i},r,s)}function li(){c.clear()}function Fa(t,n,r=!0,s=["bun"],e=!1,i){return Ze(t,n,r,s,e,i)??En(t,n,r,s,e)}function En(t,n,r=!0,s=["bun"],e=!1){if(L(n??""))t=N(t);else if(O(n??""))t=I(t);let i=e?R(t,n,r):F(t,n,r);return l(i,{filePath:n??"stdin.ts",sourceCode:t,declarations:i},r,s)}
3
3
  export{Ze,$t,ai,ci,li,Fa,En};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{t}from"./chunk-d0dbet9n.js";function j(n){let s=t(n),r=(e)=>s[e]?n.slice(s[e].start,s[e].end):"",d=new Map,k=[];for(let e=0;e<s.length;e++)if(["(","[","{"].includes(r(e)))k.push(e);else if([")","]","}"].includes(r(e))){let i=k.pop();if(i===void 0||!["()","[]","{}"].includes(r(i)+r(e)))throw Error("Unbalanced binding pattern");d.set(i,e)}if(k.length)throw Error("Unbalanced binding pattern");for(let e=0;e<s.length;e++){if(r(e)!=="<")continue;let i=["=",",","(",":","?","[","{"].includes(r(e-1)),f=1;for(let a=e+1;a<s.length;a++){if(r(a)==="="&&r(a+1)!==">"&&f===1&&!i)break;if(r(a)==="<")f++;else if(r(a)===">"&&r(a-1)!=="="&&--f===0){if(a+1===s.length||["(","[",".",",","}","]",")","?",":",";","=",">"].includes(r(a+1)))d.set(e,a);break}let u=d.get(a);if(u!==void 0)a=u}}let g=(e,i)=>({text:e<i?n.slice(s[e].start,s[i-1].end):"",offset:s[e]?.start??n.length}),w=(e,i,f)=>{for(let a=e;a<i;a++){if(r(a)===f)return a;let u=d.get(a);if(u!==void 0)a=u}return},b=(e,i)=>{let f=w(e,i,"="),a=f===void 0?void 0:g(f+1,i);if(f!==void 0)i=f;if(e+1===i&&s[e]?.kind==="word")return{kind:"name",name:r(e),defaultValue:a};let u=r(e)==="{"?"object":r(e)==="["?"array":void 0;if(!u||d.get(e)!==i-1)throw Error(`Invalid binding target: ${g(e,i).text}`);let m=[],o=e+1;while(o<i-1){let h=w(o,i-1,","),p=h??i-1;if(o===p)m.push(void 0);else if(r(o)==="."&&r(o+1)==="."&&r(o+2)===".")m.push({rest:!0,target:b(o+3,p)});else if(u==="array")m.push({rest:!1,target:b(o,p)});else if(r(o)==="["){let c=d.get(o);if(c===void 0||r(c+1)!==":")throw Error("Computed binding needs a target");m.push({computed:g(o+1,c),rest:!1,target:b(c+2,p)})}else{let c=o+1;if(s[o].kind!=="word"&&s[o].kind!=="quoted")while(c<p&&r(c)!==":")c++;let l=r(c)===":";if(!l&&s[o].kind!=="word")throw Error("Invalid object binding key");m.push({key:g(o,l?c:o+1).text,rest:!1,target:b(l?c+1:o,p)})}if(h===void 0)break;o=h+1}return{kind:u,elements:m,defaultValue:a}};return b(0,s.length)}function y(n,s){if(n.kind==="name")s.push(n.name);else for(let r of n.elements)if(r)y(r.target,s)}function Ge(n){let s=[];return y(j(n),s),s}function cr(n){let s=j(n.pattern),r=[];if(y(s,r),!r.length)return[];let d=[n.root],k=!1,g={start:n.root.start,end:n.root.end},w=(e,i)=>{let f=n.allocateName();return d.push({kind:"variable",name:f,text:`declare ${i} ${f}: unknown;`,value:e.text,initializerStart:n.patternOffset+e.offset,modifiers:[i],isExported:!1,...g}),f},b=(e,i)=>{if(e.defaultValue){let l=w(e.defaultValue,n.kind),x=n.allocateName();i=`(${i}) extends infer ${x} ? ${x} extends undefined ? typeof ${l} : ${x} : never`}if(e.kind==="name"){let l=k?void 0:n.comments;k=!0,d.push({kind:"variable",name:e.name,text:`${n.exported?"export ":""}declare ${n.kind} ${e.name}: ${i};`,typeAnnotation:i,modifiers:[n.kind],isExported:n.exported,leadingComments:l,...g});return}let f=e.elements,a=[],u=[],m=[];for(let l of f){if(!l){a.push("");continue}let x=n.allocateName(),E=l.key;if(l.computed)E=`[${w(l.computed,"const")}]`;a.push(l.rest?`...${x}`:e.kind==="object"?`${E}: ${x}`:x),u.push({target:l.target,index:m.length}),m.push(`typeof ${x}`)}let o=n.allocateName(),h=n.allocateName(),p=n.allocateName(),c=e.kind==="object"?`{ ${a.join(", ")} }`:`[${a.join(", ")}]`;d.push({kind:"function",name:o,text:`declare function ${o}(${c}: ${i}): [${m.join(", ")}];`,isExported:!1,...g}),d.push({kind:"type",name:h,text:`type ${h} = (typeof ${o}) extends (...args: never[]) => infer ${p} ? ${p} : never;`,isExported:!1,...g});for(let l of u)b(l.target,`${h}[${l.index}]`)};return b(s,`typeof ${n.root.name}`),d}
2
+ import{t}from"./chunk-6ekgn7sc.js";function j(n){let s=t(n),r=(e)=>s[e]?n.slice(s[e].start,s[e].end):"",d=new Map,k=[];for(let e=0;e<s.length;e++)if(["(","[","{"].includes(r(e)))k.push(e);else if([")","]","}"].includes(r(e))){let i=k.pop();if(i===void 0||!["()","[]","{}"].includes(r(i)+r(e)))throw Error("Unbalanced binding pattern");d.set(i,e)}if(k.length)throw Error("Unbalanced binding pattern");for(let e=0;e<s.length;e++){if(r(e)!=="<")continue;let i=["=",",","(",":","?","[","{"].includes(r(e-1)),f=1;for(let a=e+1;a<s.length;a++){if(r(a)==="="&&r(a+1)!==">"&&f===1&&!i)break;if(r(a)==="<")f++;else if(r(a)===">"&&r(a-1)!=="="&&--f===0){if(a+1===s.length||["(","[",".",",","}","]",")","?",":",";","=",">"].includes(r(a+1)))d.set(e,a);break}let u=d.get(a);if(u!==void 0)a=u}}let g=(e,i)=>({text:e<i?n.slice(s[e].start,s[i-1].end):"",offset:s[e]?.start??n.length}),w=(e,i,f)=>{for(let a=e;a<i;a++){if(r(a)===f)return a;let u=d.get(a);if(u!==void 0)a=u}return},b=(e,i)=>{let f=w(e,i,"="),a=f===void 0?void 0:g(f+1,i);if(f!==void 0)i=f;if(e+1===i&&s[e]?.kind==="word")return{kind:"name",name:r(e),defaultValue:a};let u=r(e)==="{"?"object":r(e)==="["?"array":void 0;if(!u||d.get(e)!==i-1)throw Error(`Invalid binding target: ${g(e,i).text}`);let m=[],o=e+1;while(o<i-1){let h=w(o,i-1,","),p=h??i-1;if(o===p)m.push(void 0);else if(r(o)==="."&&r(o+1)==="."&&r(o+2)===".")m.push({rest:!0,target:b(o+3,p)});else if(u==="array")m.push({rest:!1,target:b(o,p)});else if(r(o)==="["){let c=d.get(o);if(c===void 0||r(c+1)!==":")throw Error("Computed binding needs a target");m.push({computed:g(o+1,c),rest:!1,target:b(c+2,p)})}else{let c=o+1;if(s[o].kind!=="word"&&s[o].kind!=="quoted")while(c<p&&r(c)!==":")c++;let l=r(c)===":";if(!l&&s[o].kind!=="word")throw Error("Invalid object binding key");m.push({key:g(o,l?c:o+1).text,rest:!1,target:b(l?c+1:o,p)})}if(h===void 0)break;o=h+1}return{kind:u,elements:m,defaultValue:a}};return b(0,s.length)}function y(n,s){if(n.kind==="name")s.push(n.name);else for(let r of n.elements)if(r)y(r.target,s)}function Ge(n){let s=[];return y(j(n),s),s}function cr(n){let s=j(n.pattern),r=[];if(y(s,r),!r.length)return[];let d=[n.root],k=!1,g={start:n.root.start,end:n.root.end},w=(e,i)=>{let f=n.allocateName();return d.push({kind:"variable",name:f,text:`declare ${i} ${f}: unknown;`,value:e.text,initializerStart:n.patternOffset+e.offset,modifiers:[i],isExported:!1,...g}),f},b=(e,i)=>{if(e.defaultValue){let l=w(e.defaultValue,n.kind),x=n.allocateName();i=`(${i}) extends infer ${x} ? ${x} extends undefined ? typeof ${l} : ${x} : never`}if(e.kind==="name"){let l=k?void 0:n.comments;k=!0,d.push({kind:"variable",name:e.name,text:`${n.exported?"export ":""}declare ${n.kind} ${e.name}: ${i};`,typeAnnotation:i,modifiers:[n.kind],isExported:n.exported,leadingComments:l,...g});return}let f=e.elements,a=[],u=[],m=[];for(let l of f){if(!l){a.push("");continue}let x=n.allocateName(),E=l.key;if(l.computed)E=`[${w(l.computed,"const")}]`;a.push(l.rest?`...${x}`:e.kind==="object"?`${E}: ${x}`:x),u.push({target:l.target,index:m.length}),m.push(`typeof ${x}`)}let o=n.allocateName(),h=n.allocateName(),p=n.allocateName(),c=e.kind==="object"?`{ ${a.join(", ")} }`:`[${a.join(", ")}]`;d.push({kind:"function",name:o,text:`declare function ${o}(${c}: ${i}): [${m.join(", ")}];`,isExported:!1,...g}),d.push({kind:"type",name:h,text:`type ${h} = (typeof ${o}) extends (...args: never[]) => infer ${p} ? ${p} : never;`,isExported:!1,...g});for(let l of u)b(l.target,`${h}[${l.index}]`)};return b(s,`typeof ${n.root.name}`),d}
3
3
  export{Ge,cr};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,d}from"./chunk-d0dbet9n.js";import{V}from"./chunk-hnw7mwcw.js";import{jt}from"./chunk-hzjesnf1.js";import{v}from"./chunk-vhna4qch.js";import{ae}from"./chunk-29m9mhwt.js";import{relative as O}from"path";function P(n){let k=t(n),c=(l)=>k[l]?n.slice(k[l].start,k[l].end):"",i=c(0)==="export"?1:0;if(c(i++)!=="declare")return;let f;if(c(i)==="module"&&k[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=k[i].end,M=1;for(i++;i<k.length;i++)if(c(i)==="{")M++;else if(c(i)==="}"&&--M===0)return{specifier:f,body:n.slice(h,k[i].start),start:h,end:k[i].start};return}var te=/^[A-Z_$][\w$]*$/i;function Oo(n){let k=[],c=[],i=0,f=0,h=[],M=!1,l=0,y=n.length,R=(a)=>{let b=n.slice(i,a).trim();if(i=a,!b)return;if(ne(b)){c.push(b);return}k.push({text:b,comments:c}),c=[]};while(l<y){let a=n[l];if(M){if(a==="\\"){l+=2;continue}if(a==="`"){M=!1,l++;continue}if(a==="$"&&n[l+1]==="{"){h.push(f),f++,M=!1,l+=2;continue}l++;continue}if(a==="/"&&n[l+1]==="*"){let b=n.indexOf("*/",l+2);l=b===-1?y:b+2;continue}if(a==="/"&&n[l+1]==="/"){let b=n.indexOf(`
2
+ import{t,d}from"./chunk-6ekgn7sc.js";import{V}from"./chunk-sbmdk35p.js";import{jt}from"./chunk-m9b6cqn7.js";import{v}from"./chunk-zpvcnc7c.js";import{ae}from"./chunk-4sasxrdr.js";import{relative as O}from"path";function P(n){let k=t(n),c=(l)=>k[l]?n.slice(k[l].start,k[l].end):"",i=c(0)==="export"?1:0;if(c(i++)!=="declare")return;let f;if(c(i)==="module"&&k[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=k[i].end,M=1;for(i++;i<k.length;i++)if(c(i)==="{")M++;else if(c(i)==="}"&&--M===0)return{specifier:f,body:n.slice(h,k[i].start),start:h,end:k[i].start};return}var te=/^[A-Z_$][\w$]*$/i;function Oo(n){let k=[],c=[],i=0,f=0,h=[],M=!1,l=0,y=n.length,R=(a)=>{let b=n.slice(i,a).trim();if(i=a,!b)return;if(ne(b)){c.push(b);return}k.push({text:b,comments:c}),c=[]};while(l<y){let a=n[l];if(M){if(a==="\\"){l+=2;continue}if(a==="`"){M=!1,l++;continue}if(a==="$"&&n[l+1]==="{"){h.push(f),f++,M=!1,l+=2;continue}l++;continue}if(a==="/"&&n[l+1]==="*"){let b=n.indexOf("*/",l+2);l=b===-1?y:b+2;continue}if(a==="/"&&n[l+1]==="/"){let b=n.indexOf(`
3
3
  `,l);l=b===-1?y:b;continue}if(a==="'"||a==='"'){l++;while(l<y&&n[l]!==a&&n[l]!==`
4
4
  `){if(n[l]==="\\")l++;l++}l++;continue}if(a==="`"){M=!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(),M=!0;l++;continue}if(f===0&&a===";"){R(l+1),l++;continue}if(f===0&&a===`
5
5
  `){let b=n[l+1];if(b!==void 0&&/[\w$@/]/.test(b))R(l+1);l++;continue}l++}return R(y),k}function ne(n){let k=0;while(k<n.length){while(k<n.length&&/\s/.test(n[k]))k++;if(k>=n.length)return!0;if(n.startsWith("//",k)){let c=n.indexOf(`
@@ -8,7 +8,7 @@ import{t,d}from"./chunk-d0dbet9n.js";import{V}from"./chunk-hnw7mwcw.js";import{j
8
8
  `;while(a<b){let m=i.get(a);if(m!==void 0){R+=n.slice(a,m),a=m,S="`";continue}let x=n[a];if(x==="/"&&n[a+1]==="*"){let w=n.indexOf("*/",a+2),N=w===-1?b:w+2;R+=n.slice(a,N),a=N;continue}if(x==="/"&&n[a+1]==="/"){let w=n.indexOf(`
9
9
  `,a),N=w===-1?b:w;R+=n.slice(a,N),a=N;continue}if(x==="'"||x==='"'){let w=a+1;while(w<b&&n[w]!==x&&n[w]!==`
10
10
  `){if(n[w]==="\\")w++;w++}R+=n.slice(a,w+1),a=w+1,S=x;continue}if(/[A-Z_$]/i.test(x)){let w=a+1;while(w<b&&/[\w$]/.test(n[w]))w++;let N=n.slice(a,w),I=k.get(N);if(I!==void 0&&S!=="."&&!y.has(a)){let u=w;while(u<b&&(n[u]===" "||n[u]==="\t"))u++;let D=(n[u]===":"||n[u]==="?"&&n[u+1]===":")&&/[{;,(\n]/.test(S);R+=D?N:I}else R+=N;S="a",a=w;continue}if(R+=x,x===`
11
- `||!/\s/.test(x))S=x;a++}return R}function Dn(n,k,c,i){let f=[],h=new Map,M=[n,...k.filter((e)=>e!==n)];for(let e of M){let s=c.get(e);if(s===void 0){f.push(`No declarations were generated for ${O(i.cwd,e)}; it is left out of the bundle`);continue}h.set(e,q(e,s))}let l=(e,s)=>{if(!e.startsWith(".")&&!e.startsWith("/"))return null;let o=ae(e,s).resolved;return o&&h.has(o)?o:null},y=(e)=>e.startsWith(".")||e.startsWith("/"),R=new Set,a=(e)=>{let s=e;for(let o=1;R.has(s);o++)s=`${e}_${o}`;return R.add(s),s},b=new Map;for(let[e,s]of h){let o=new Map;for(let g of s.declared)o.set(g,a(g));b.set(e,o)}let S=new Map,m=(e,s,o)=>{let g=`${e}\x00${s}`,r=S.get(g);if(!r)r=a(o),S.set(g,r);return r},x=new Map,w=new Map,N=new Set,I=new Map,u=!0,D=(e,s,o)=>{let g=l(s,e.file);if(g){if(o==="*")return{kind:"namespace",file:g};let r=L(g).get(o);if(!r&&!u)f.push(`${O(i.cwd,e.file)}: '${o}' is not exported by '${s}'`);return r??null}if(y(s))return f.push(`${O(i.cwd,e.file)}: '${s}' is not part of the bundle`),null;return o==="*"?{kind:"external-namespace",source:s}:{kind:"external",source:s,imported:o}},Y=(e,s)=>{if(e.declared.has(s))return{kind:"local",name:b.get(e.file).get(s)};let o=e.imports.get(s);if(o)return D(e,o.specifier,o.imported);return f.push(`${O(i.cwd,e.file)}: cannot resolve exported name '${s}'`),null};function L(e){let s=x.get(e);if(s)return s;let o=new Map,g=h.get(e);if(!g||N.has(e))return o;N.add(e);let r=new Set;for(let[p,E]of g.localExports){let B=Y(g,E);if(B)o.set(p,B)}for(let p of g.namedReExports){let E=D(g,p.specifier,p.imported);if(E)o.set(p.exported,E)}for(let p of g.namespaceReExports){let E=D(g,p.specifier,"*");if(E)o.set(p.exported,E)}for(let p of g.starReExports){let E=l(p,e);if(E){for(let[B,C]of L(E))if(B!=="default"&&!o.has(B))o.set(B,C);for(let B of w.get(E)??[])r.add(B)}else if(y(p))f.push(`${O(i.cwd,e)}: '${p}' is not part of the bundle`);else r.add(p)}for(let[p,E]of I.get(e)??[])o.set(p,E);return N.delete(e),x.set(e,o),w.set(e,r),o}for(let[e,s]of h)for(let o of s.augmentations){let g=l(o.specifier,e);if(!g)continue;for(let r of q(e,o.body,!0).declared){if(L(g).has(r))continue;let p=I.get(g);if(!p)p=new Map,I.set(g,p);p.set(r,{kind:"local",name:a(r)}),x.clear()}}u=!1,x.clear(),w.clear();let J=new Map,F=[],z=(e,s)=>{switch(e.kind){case"local":return e.name;case"external":return m(e.source,e.imported,e.imported==="default"?s:e.imported);case"external-namespace":return m(e.source,"*",s);case"namespace":return ee(e.file,s)}};function ee(e,s){let o=J.get(e);if(o)return o;let g=a(s);J.set(e,g);let r=[];for(let[p,E]of L(e)){if(p==="default")continue;let B=z(E,p);r.push(B===p?p:`${B} as ${p}`)}if(w.get(e)?.size)f.push(`${O(i.cwd,e)}: 'export * from' an external module cannot be expressed inside namespace '${g}'`);return F.push(`declare namespace ${g} {
11
+ `||!/\s/.test(x))S=x;a++}return R}function Pn(n,k,c,i){let f=[],h=new Map,M=[n,...k.filter((e)=>e!==n)];for(let e of M){let s=c.get(e);if(s===void 0){f.push(`No declarations were generated for ${O(i.cwd,e)}; it is left out of the bundle`);continue}h.set(e,q(e,s))}let l=(e,s)=>{if(!e.startsWith(".")&&!e.startsWith("/"))return null;let o=ae(e,s).resolved;return o&&h.has(o)?o:null},y=(e)=>e.startsWith(".")||e.startsWith("/"),R=new Set,a=(e)=>{let s=e;for(let o=1;R.has(s);o++)s=`${e}_${o}`;return R.add(s),s},b=new Map;for(let[e,s]of h){let o=new Map;for(let g of s.declared)o.set(g,a(g));b.set(e,o)}let S=new Map,m=(e,s,o)=>{let g=`${e}\x00${s}`,r=S.get(g);if(!r)r=a(o),S.set(g,r);return r},x=new Map,w=new Map,N=new Set,I=new Map,u=!0,D=(e,s,o)=>{let g=l(s,e.file);if(g){if(o==="*")return{kind:"namespace",file:g};let r=L(g).get(o);if(!r&&!u)f.push(`${O(i.cwd,e.file)}: '${o}' is not exported by '${s}'`);return r??null}if(y(s))return f.push(`${O(i.cwd,e.file)}: '${s}' is not part of the bundle`),null;return o==="*"?{kind:"external-namespace",source:s}:{kind:"external",source:s,imported:o}},Y=(e,s)=>{if(e.declared.has(s))return{kind:"local",name:b.get(e.file).get(s)};let o=e.imports.get(s);if(o)return D(e,o.specifier,o.imported);return f.push(`${O(i.cwd,e.file)}: cannot resolve exported name '${s}'`),null};function L(e){let s=x.get(e);if(s)return s;let o=new Map,g=h.get(e);if(!g||N.has(e))return o;N.add(e);let r=new Set;for(let[p,E]of g.localExports){let B=Y(g,E);if(B)o.set(p,B)}for(let p of g.namedReExports){let E=D(g,p.specifier,p.imported);if(E)o.set(p.exported,E)}for(let p of g.namespaceReExports){let E=D(g,p.specifier,"*");if(E)o.set(p.exported,E)}for(let p of g.starReExports){let E=l(p,e);if(E){for(let[B,C]of L(E))if(B!=="default"&&!o.has(B))o.set(B,C);for(let B of w.get(E)??[])r.add(B)}else if(y(p))f.push(`${O(i.cwd,e)}: '${p}' is not part of the bundle`);else r.add(p)}for(let[p,E]of I.get(e)??[])o.set(p,E);return N.delete(e),x.set(e,o),w.set(e,r),o}for(let[e,s]of h)for(let o of s.augmentations){let g=l(o.specifier,e);if(!g)continue;for(let r of q(e,o.body,!0).declared){if(L(g).has(r))continue;let p=I.get(g);if(!p)p=new Map,I.set(g,p);p.set(r,{kind:"local",name:a(r)}),x.clear()}}u=!1,x.clear(),w.clear();let J=new Map,F=[],z=(e,s)=>{switch(e.kind){case"local":return e.name;case"external":return m(e.source,e.imported,e.imported==="default"?s:e.imported);case"external-namespace":return m(e.source,"*",s);case"namespace":return ee(e.file,s)}};function ee(e,s){let o=J.get(e);if(o)return o;let g=a(s);J.set(e,g);let r=[];for(let[p,E]of L(e)){if(p==="default")continue;let B=z(E,p);r.push(B===p?p:`${B} as ${p}`)}if(w.get(e)?.size)f.push(`${O(i.cwd,e)}: 'export * from' an external module cannot be expressed inside namespace '${g}'`);return F.push(`declare namespace ${g} {
12
12
  export { ${r.join(", ")} };
13
13
  }`),g}let Q=[],A=[],H=new Set;for(let[e,s]of h){for(let r of s.directives)H.add(r);let o=new Map;for(let[r,p]of b.get(e))if(r!==p)o.set(r,p);for(let[r,p]of s.imports){if(s.declared.has(r))continue;let E=D(s,p.specifier,p.imported);if(!E)continue;let B=z(E,r);if(B!==r)o.set(r,B)}let g=[];for(let r of s.declarations){if(i.keepComments)g.push(...r.statement.comments);let p=nt(r.emit,o);if(!/[;}]$/.test(p))p+=";";g.push(p)}for(let r of s.verbatim){if(i.keepComments)A.push(...r.comments);let p=P(r.text);if(p){let E=new Map(o);for(let B of q(e,p.body,!0).declared)E.delete(B);A.push(r.text.slice(0,p.start)+nt(p.body,E)+r.text.slice(p.end))}else{let E=t(r.text),B=E[1]?.kind==="quoted"?d(r.text.slice(E[1].start,E[1].end)):void 0;if(B===void 0||!l(B,e))A.push(nt(r.text,o))}}for(let r of s.augmentations){let p=l(r.specifier,e),E=q(e,r.body,!0),B=new Map(o);if(!p){for(let K of E.declared)B.delete(K);let C=P(r.statement.text);if(i.keepComments)A.push(...r.statement.comments);A.push(r.statement.text.slice(0,C.start)+nt(C.body,B)+r.statement.text.slice(C.end));continue}for(let[C,K]of L(p))B.set(C,z(K,C));if(i.keepComments)g.push(...r.statement.comments);for(let C of E.declarations){if(!C.name||!L(p).has(C.name))throw Error(`Cannot link augmentation '${r.specifier}' member '${C.name??C.emit}'`);if(i.keepComments)g.push(...C.statement.comments);g.push(nt(C.emit,B))}}if(g.length>0)Q.push(`// From: ${O(i.cwd,e)}
14
14
  ${g.join(`
@@ -24,4 +24,4 @@ ${g.join(`
24
24
 
25
25
  `)}
26
26
  `,files:[...h.keys()],exportCount:U.size,warnings:f}}
27
- export{Oo,nt,Dn};
27
+ export{Oo,nt,Pn};