@dtsx/dtsx 0.11.56 → 0.11.57

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 (187) hide show
  1. package/dist/bin/cli.js +1 -1
  2. package/dist/{chunk-g25sbqbw.js → chunk-14zb70ca.js} +3 -3
  3. package/dist/{chunk-tgaear7n.js → chunk-1b003vaa.js} +6 -6
  4. package/dist/{chunk-2qbj76ap.js → chunk-31t6c3q1.js} +19 -19
  5. package/dist/{chunk-6b6rt0yh.js → chunk-3phg2e1n.js} +2 -2
  6. package/dist/{chunk-6c8nk9rm.js → chunk-4rchw3mn.js} +4 -4
  7. package/dist/{chunk-9h17ws4c.js → chunk-4tk9w4ms.js} +1 -1
  8. package/dist/chunk-59q0p96t.js +3 -0
  9. package/dist/{chunk-hgg4aqvf.js → chunk-5af6meh8.js} +2 -2
  10. package/dist/{chunk-9bj73ygx.js → chunk-5egg62em.js} +3 -3
  11. package/dist/{chunk-h7ebvy8j.js → chunk-5ncggctz.js} +2 -2
  12. package/dist/{chunk-spdw3tc0.js → chunk-5t69y2qj.js} +2 -2
  13. package/dist/{chunk-mzxxgnp8.js → chunk-5zcampnz.js} +2 -2
  14. package/dist/{chunk-8r7rmcz7.js → chunk-6bsft59m.js} +5 -5
  15. package/dist/chunk-6m4fpfzj.js +31 -0
  16. package/dist/{chunk-msa98cgm.js → chunk-6mg1pbfj.js} +10 -10
  17. package/dist/chunk-6rxhkcx0.js +3 -0
  18. package/dist/{chunk-yxcyqezk.js → chunk-6vhzmpy0.js} +4 -4
  19. package/dist/{chunk-nnayqrp5.js → chunk-6yvk3q1e.js} +2 -2
  20. package/dist/{chunk-bt2n0b75.js → chunk-7061vwkq.js} +2 -2
  21. package/dist/chunk-72txgcxc.js +3 -0
  22. package/dist/{chunk-heqx5083.js → chunk-8j311f4n.js} +4 -4
  23. package/dist/{chunk-gwa4hmfa.js → chunk-8z4tvwyd.js} +2 -2
  24. package/dist/{chunk-hj7gs32r.js → chunk-93jzvstf.js} +2 -2
  25. package/dist/{chunk-hkcqbex1.js → chunk-9hz32qxh.js} +2 -2
  26. package/dist/{chunk-c726s7aj.js → chunk-a018gbxq.js} +4 -4
  27. package/dist/{chunk-pnfjhm01.js → chunk-aa3k6rcj.js} +2 -2
  28. package/dist/{chunk-njknd1pt.js → chunk-abe0mchv.js} +4 -4
  29. package/dist/{chunk-hbmnkmzb.js → chunk-b1wmavr8.js} +3 -3
  30. package/dist/{chunk-btcj8fgc.js → chunk-c094c8jt.js} +3 -3
  31. package/dist/{chunk-qhkxctek.js → chunk-ctpxwa1v.js} +2 -2
  32. package/dist/{chunk-x6ddycvm.js → chunk-dc6thsdb.js} +2 -2
  33. package/dist/{chunk-k8tnz2qd.js → chunk-ered54kd.js} +8 -8
  34. package/dist/{chunk-38r6thfe.js → chunk-f27fd50q.js} +2 -2
  35. package/dist/{chunk-eskywkxz.js → chunk-fcx6r0m1.js} +4 -4
  36. package/dist/{chunk-mph001z4.js → chunk-fnncnk59.js} +4 -4
  37. package/dist/{chunk-ekf33t9z.js → chunk-fpbcgcwd.js} +3 -3
  38. package/dist/chunk-fxx9zbtq.js +3 -0
  39. package/dist/{chunk-555w3kcr.js → chunk-g2s10ehd.js} +2 -2
  40. package/dist/{chunk-srm0ddsk.js → chunk-gzjccs8y.js} +9 -9
  41. package/dist/{chunk-cgqg1br8.js → chunk-h3m1vfa2.js} +3 -3
  42. package/dist/{chunk-b6994asf.js → chunk-hnjv8zsq.js} +2 -2
  43. package/dist/{chunk-6j6dvj8a.js → chunk-hqytpz18.js} +2 -2
  44. package/dist/{chunk-vk5r6pgx.js → chunk-jb43rwce.js} +2 -2
  45. package/dist/chunk-jhjj15ey.js +38 -0
  46. package/dist/{chunk-fpa2ea8k.js → chunk-k2axmtyh.js} +5 -5
  47. package/dist/{chunk-kkshxyex.js → chunk-kqyqbrcv.js} +3 -3
  48. package/dist/{chunk-81jrzxr6.js → chunk-mzpbqdd2.js} +4 -4
  49. package/dist/{chunk-ewgs91y1.js → chunk-n8044s0h.js} +2 -2
  50. package/dist/{chunk-4rsk49xj.js → chunk-naweq349.js} +2 -2
  51. package/dist/{chunk-v22xpr7j.js → chunk-p023fhce.js} +3 -3
  52. package/dist/{chunk-7dmn623d.js → chunk-ppybvpk4.js} +3 -3
  53. package/dist/{chunk-1mzxq1rg.js → chunk-q8dtn1qf.js} +2 -2
  54. package/dist/{chunk-mqv5m22t.js → chunk-qg691xj0.js} +4 -4
  55. package/dist/{chunk-j7rpp55s.js → chunk-qhbdh4gy.js} +3 -3
  56. package/dist/{chunk-1t77gtcx.js → chunk-qhsgmwcm.js} +2 -2
  57. package/dist/{chunk-dak0dhnx.js → chunk-qxkvzznc.js} +2 -2
  58. package/dist/chunk-r7qq9579.js +7 -0
  59. package/dist/{chunk-qbk49jz5.js → chunk-rb602c8k.js} +11 -11
  60. package/dist/{chunk-tw99ftp1.js → chunk-rcmdt2gs.js} +2 -2
  61. package/dist/{chunk-7pw9ayve.js → chunk-rzjj16rb.js} +3 -3
  62. package/dist/{chunk-9mdgtq38.js → chunk-s28gyv8z.js} +2 -2
  63. package/dist/{chunk-qt9gjs57.js → chunk-s3mxfatw.js} +2 -2
  64. package/dist/{chunk-djbck65n.js → chunk-s5rja20d.js} +2 -2
  65. package/dist/{chunk-62428w6e.js → chunk-s9937pks.js} +6 -6
  66. package/dist/{chunk-5bdwrsqt.js → chunk-srbye4cm.js} +4 -4
  67. package/dist/{chunk-8vvryt8p.js → chunk-ss3na6s0.js} +2 -2
  68. package/dist/chunk-szxyqpfq.js +3 -0
  69. package/dist/{chunk-9wwsqemm.js → chunk-try1hmvs.js} +2 -2
  70. package/dist/{chunk-r46rw8gr.js → chunk-vdt9x6h8.js} +5 -5
  71. package/dist/chunk-vej5fnnp.js +3 -0
  72. package/dist/{chunk-f5jc2v3k.js → chunk-vs6ay4t3.js} +2 -2
  73. package/dist/{chunk-20jq5v1p.js → chunk-w482p1x8.js} +6 -6
  74. package/dist/{chunk-h6ddkhyq.js → chunk-wmzg12wb.js} +2 -2
  75. package/dist/{chunk-g9emajpc.js → chunk-xvp60m78.js} +2 -2
  76. package/dist/chunk-y18th8yp.js +3 -0
  77. package/dist/{chunk-6r01zgys.js → chunk-yd8rwwzf.js} +2 -2
  78. package/dist/{chunk-4cr1q0yf.js → chunk-ynpxjf6d.js} +2 -2
  79. package/dist/{chunk-nmht3krt.js → chunk-ysgfcqvf.js} +4 -4
  80. package/dist/{chunk-7rdazac9.js → chunk-ywzc3ym6.js} +20 -20
  81. package/dist/{chunk-rzcnab8j.js → chunk-z03w2v8h.js} +2 -2
  82. package/dist/{chunk-0d5nemtn.js → chunk-zddtg858.js} +2 -2
  83. package/dist/{chunk-6ekemc3h.js → chunk-zf6qpv30.js} +2 -2
  84. package/dist/src/augmentation-graph.js +1 -1
  85. package/dist/src/binding-patterns.js +1 -1
  86. package/dist/src/branded-types.js +1 -1
  87. package/dist/src/bundle-linker.js +1 -1
  88. package/dist/src/bundler.js +1 -1
  89. package/dist/src/cache.js +1 -1
  90. package/dist/src/call-signatures.js +1 -1
  91. package/dist/src/circular.js +1 -1
  92. package/dist/src/compat.js +1 -1
  93. package/dist/src/computed-keys.js +1 -1
  94. package/dist/src/config.js +1 -1
  95. package/dist/src/dangling-refs.js +1 -1
  96. package/dist/src/declaration-project.js +1 -1
  97. package/dist/src/declaration-publication.js +1 -1
  98. package/dist/src/declaration-references.js +1 -1
  99. package/dist/src/diff.js +1 -1
  100. package/dist/src/docs.js +1 -1
  101. package/dist/src/enum-declarations.js +1 -1
  102. package/dist/src/errors.js +1 -1
  103. package/dist/src/extractor/directives.js +1 -1
  104. package/dist/src/extractor/extract.js +1 -1
  105. package/dist/src/extractor/scanner.js +1 -1
  106. package/dist/src/extractor.js +1 -1
  107. package/dist/src/formats.js +1 -1
  108. package/dist/src/formatter.js +1 -1
  109. package/dist/src/function-properties.js +1 -1
  110. package/dist/src/generator.js +1 -1
  111. package/dist/src/global-types.js +1 -1
  112. package/dist/src/import-sorter.js +1 -1
  113. package/dist/src/incremental.js +1 -1
  114. package/dist/src/index.js +1 -1
  115. package/dist/src/inferred-imports.js +1 -1
  116. package/dist/src/initializer-type-spans.js +1 -1
  117. package/dist/src/json-config.js +1 -1
  118. package/dist/src/lexical.js +1 -1
  119. package/dist/src/logger.js +1 -1
  120. package/dist/src/lsp.js +1 -1
  121. package/dist/src/memory.js +1 -1
  122. package/dist/src/merger.js +1 -1
  123. package/dist/src/module-graph.js +1 -1
  124. package/dist/src/module-references.js +1 -1
  125. package/dist/src/native-checker.js +1 -1
  126. package/dist/src/native-engine.js +1 -1
  127. package/dist/src/native-extractor.js +1 -1
  128. package/dist/src/native-generation.js +1 -1
  129. package/dist/src/native-project.js +1 -1
  130. package/dist/src/numeric-literals.js +1 -1
  131. package/dist/src/optimizer.js +1 -1
  132. package/dist/src/output-normalizer.js +1 -1
  133. package/dist/src/parallel-processor.js +1 -1
  134. package/dist/src/parameters.js +1 -1
  135. package/dist/src/parser.js +1 -1
  136. package/dist/src/plugins/bun.js +1 -1
  137. package/dist/src/plugins/esbuild.js +1 -1
  138. package/dist/src/plugins/index.js +1 -1
  139. package/dist/src/plugins/tsdown.js +1 -1
  140. package/dist/src/plugins/tsup.js +1 -1
  141. package/dist/src/plugins/vite.js +1 -1
  142. package/dist/src/plugins/webpack.js +1 -1
  143. package/dist/src/plugins.js +1 -1
  144. package/dist/src/process-source.js +1 -1
  145. package/dist/src/processor/cache.js +1 -1
  146. package/dist/src/processor/declarations.js +1 -1
  147. package/dist/src/processor/import-usage.js +1 -1
  148. package/dist/src/processor/imports.js +1 -1
  149. package/dist/src/processor/index.js +1 -1
  150. package/dist/src/processor/type-inference.js +1 -1
  151. package/dist/src/processor.js +1 -1
  152. package/dist/src/profiling.js +1 -1
  153. package/dist/src/return-type-scope.js +1 -1
  154. package/dist/src/security.js +1 -1
  155. package/dist/src/source-cache.js +1 -1
  156. package/dist/src/sourcemap.js +1 -1
  157. package/dist/src/stx.js +1 -1
  158. package/dist/src/syntax-validator.js +1 -1
  159. package/dist/src/tracking.js +1 -1
  160. package/dist/src/transformers.js +1 -1
  161. package/dist/src/tree-shaker.js +1 -1
  162. package/dist/src/tsconfig.js +1 -1
  163. package/dist/src/type-mappings.js +1 -1
  164. package/dist/src/utils.js +1 -1
  165. package/dist/src/value-inference.js +1 -1
  166. package/dist/src/vue.js +1 -1
  167. package/dist/src/watcher.js +1 -1
  168. package/dist/src/worker-thread.js +1 -1
  169. package/dist/src/worker.js +1 -1
  170. package/dist/src/workspace.js +1 -1
  171. package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
  172. package/native/darwin-x64/libzig-dtsx.dylib +0 -0
  173. package/native/freebsd-x64/libzig-dtsx.so +0 -0
  174. package/native/linux-arm64/libzig-dtsx.so +0 -0
  175. package/native/linux-x64/libzig-dtsx.so +0 -0
  176. package/native/windows-x64/zig-dtsx.dll +0 -0
  177. package/package.json +1 -1
  178. package/dist/chunk-0a1xppye.js +0 -3
  179. package/dist/chunk-5tn8854w.js +0 -31
  180. package/dist/chunk-5yx2x4v4.js +0 -3
  181. package/dist/chunk-cfjd81h8.js +0 -3
  182. package/dist/chunk-daasy0pw.js +0 -3
  183. package/dist/chunk-h28vzayq.js +0 -3
  184. package/dist/chunk-sjbm1trn.js +0 -3
  185. package/dist/chunk-t5nmnzy6.js +0 -7
  186. package/dist/chunk-vt5hr8vs.js +0 -3
  187. package/dist/chunk-wq5r1ms9.js +0 -38
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{p}from"./chunk-v6fwy63g.js";import{createHash as g}from"crypto";import{mkdir as y,readFile as l,stat as m,writeFile as v}from"fs/promises";import{dirname as C,join as o}from"path";var c="1.0.0",b=".dtsx-cache",d="manifest.json";class gi{config;manifest=null;dirty=!1;stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0};constructor(t={}){this.config={enabled:t.enabled??!0,cacheDir:t.cacheDir??b,format:t.format??"json",maxAge:t.maxAge??86400000,force:t.force??!1,validateCache:t.validateCache??!0}}async init(){if(!this.config.enabled)return;try{await y(this.config.cacheDir,{recursive:!0}),await this.loadManifest()}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async loadManifest(){let t=o(this.config.cacheDir,d);try{let e=await l(t,"utf-8");if(this.manifest=JSON.parse(e),this.manifest.version!==c){await this.clear();return}this.stats.totalEntries=Object.keys(this.manifest.entries).length}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async save(){if(!this.config.enabled||!this.manifest||!this.dirty)return;let t=o(this.config.cacheDir,d);this.manifest.updatedAt=Date.now(),await v(t,JSON.stringify(this.manifest,null,2)),this.dirty=!1}async get(t,e){if(!this.config.enabled||!this.manifest||this.config.force)return this.stats.misses++,null;let s=this.manifest.entries[t];if(!s)return this.stats.misses++,null;if(s.configHash!==e)return this.stats.misses++,null;if(Date.now()-s.cachedAt>this.config.maxAge)return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null;if(this.config.validateCache)try{let a=(await m(t)).mtimeMs;if(a!==s.mtime){let i=await l(t,"utf-8");if(this.hashContent(i)!==s.hash)return this.stats.misses++,null;s.mtime=a,this.dirty=!0}}catch{return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null}if(s.dependencies.length>0){if((await Promise.all(s.dependencies.map(async(a)=>{let i=this.manifest.entries[a];if(!i)return!0;try{return(await m(a)).mtimeMs===i.mtime}catch{return!1}}))).some((a)=>!a))return this.stats.misses++,null}return this.stats.hits++,this.stats.timeSavedMs+=50,this.updateHitRatio(),s}async set(t,e,s,r,a,i){if(!this.config.enabled||!this.manifest)return;let n=Date.now();try{n=(await m(t)).mtimeMs}catch{}let h={filePath:t,hash:this.hashContent(e),mtime:n,declarations:s,dtsContent:r,dependencies:a,cachedAt:Date.now(),configHash:i};if(!(t in this.manifest.entries))this.stats.totalEntries++;this.manifest.entries[t]=h,this.dirty=!0}invalidate(t){if(!this.manifest)return;delete this.manifest.entries[t],this.dirty=!0;for(let[e,s]of Object.entries(this.manifest.entries))if(s.dependencies.includes(t))delete this.manifest.entries[e]}async clear(){this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()},this.stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0},this.dirty=!0,await this.save()}getStats(){return{...this.stats}}hashContent(t){return String(p(t))}updateHitRatio(){let t=this.stats.hits+this.stats.misses;this.stats.hitRatio=t>0?this.stats.hits/t:0}static hashConfig(t){let e={outdir:t.outdir,clean:t.clean,tsconfigPath:t.tsconfigPath};return g("sha256").update(JSON.stringify(e)).digest("hex").slice(0,16)}}function Do(t,e){let s=[],r=[],a=[];return{async needsRebuild(i){return await t.get(i,e)===null},async getCachedDeclarations(i){let n=await t.get(i,e);if(n)return r.push(i),n.declarations;return null},async getCachedDts(i){let n=await t.get(i,e);if(n)return n.dtsContent;return null},async cacheResult(i,n,h,u,f=[]){await t.set(i,n,h,u,f,e),s.push(i)},skip(i){a.push(i)},getResult(){return{rebuilt:s,cached:r,skipped:a,stats:t.getStats()}},async save(){await t.save()}}}async function Po(t,e=604800000){let s=t.getStats();if(s.totalEntries>1000)return await t.clear(),s.totalEntries;return 0}function Ro(t){let e=[];return e.push("Incremental Build Results:"),e.push(` Rebuilt: ${t.rebuilt.length} files`),e.push(` From cache: ${t.cached.length} files`),e.push(` Skipped: ${t.skipped.length} files`),e.push(""),e.push("Cache Statistics:"),e.push(` Total entries: ${t.stats.totalEntries}`),e.push(` Hit ratio: ${(t.stats.hitRatio*100).toFixed(1)}%`),e.push(` Time saved: ~${t.stats.timeSavedMs}ms`),e.join(`
3
- `)}function Mo(t,e){let s=[],r=/import\s+(?:type\s+)?(?:.+(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])from\s+)?['"]([^'"]+)['"]/g,a;while((a=r.exec(t))!==null){let i=a[1];if(i.startsWith(".")){let n=o(C(e),i);s.push(n),s.push(`${n}.ts`),s.push(`${n}.tsx`),s.push(o(n,"index.ts")),s.push(o(n,"index.tsx"))}}return s}
4
- export{gi,Do,Po,Ro,Mo};
2
+ import{p}from"./chunk-v6fwy63g.js";import{createHash as g}from"crypto";import{mkdir as y,readFile as l,stat as m,writeFile as v}from"fs/promises";import{dirname as C,join as o}from"path";var c="1.0.0",b=".dtsx-cache",d="manifest.json";class $r{config;manifest=null;dirty=!1;stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0};constructor(t={}){this.config={enabled:t.enabled??!0,cacheDir:t.cacheDir??b,format:t.format??"json",maxAge:t.maxAge??86400000,force:t.force??!1,validateCache:t.validateCache??!0}}async init(){if(!this.config.enabled)return;try{await y(this.config.cacheDir,{recursive:!0}),await this.loadManifest()}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async loadManifest(){let t=o(this.config.cacheDir,d);try{let e=await l(t,"utf-8");if(this.manifest=JSON.parse(e),this.manifest.version!==c){await this.clear();return}this.stats.totalEntries=Object.keys(this.manifest.entries).length}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async save(){if(!this.config.enabled||!this.manifest||!this.dirty)return;let t=o(this.config.cacheDir,d);this.manifest.updatedAt=Date.now(),await v(t,JSON.stringify(this.manifest,null,2)),this.dirty=!1}async get(t,e){if(!this.config.enabled||!this.manifest||this.config.force)return this.stats.misses++,null;let s=this.manifest.entries[t];if(!s)return this.stats.misses++,null;if(s.configHash!==e)return this.stats.misses++,null;if(Date.now()-s.cachedAt>this.config.maxAge)return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null;if(this.config.validateCache)try{let a=(await m(t)).mtimeMs;if(a!==s.mtime){let i=await l(t,"utf-8");if(this.hashContent(i)!==s.hash)return this.stats.misses++,null;s.mtime=a,this.dirty=!0}}catch{return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null}if(s.dependencies.length>0){if((await Promise.all(s.dependencies.map(async(a)=>{let i=this.manifest.entries[a];if(!i)return!0;try{return(await m(a)).mtimeMs===i.mtime}catch{return!1}}))).some((a)=>!a))return this.stats.misses++,null}return this.stats.hits++,this.stats.timeSavedMs+=50,this.updateHitRatio(),s}async set(t,e,s,r,a,i){if(!this.config.enabled||!this.manifest)return;let n=Date.now();try{n=(await m(t)).mtimeMs}catch{}let h={filePath:t,hash:this.hashContent(e),mtime:n,declarations:s,dtsContent:r,dependencies:a,cachedAt:Date.now(),configHash:i};if(!(t in this.manifest.entries))this.stats.totalEntries++;this.manifest.entries[t]=h,this.dirty=!0}invalidate(t){if(!this.manifest)return;delete this.manifest.entries[t],this.dirty=!0;for(let[e,s]of Object.entries(this.manifest.entries))if(s.dependencies.includes(t))delete this.manifest.entries[e]}async clear(){this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()},this.stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0},this.dirty=!0,await this.save()}getStats(){return{...this.stats}}hashContent(t){return String(p(t))}updateHitRatio(){let t=this.stats.hits+this.stats.misses;this.stats.hitRatio=t>0?this.stats.hits/t:0}static hashConfig(t){let e={outdir:t.outdir,clean:t.clean,tsconfigPath:t.tsconfigPath};return g("sha256").update(JSON.stringify(e)).digest("hex").slice(0,16)}}function cs(t,e){let s=[],r=[],a=[];return{async needsRebuild(i){return await t.get(i,e)===null},async getCachedDeclarations(i){let n=await t.get(i,e);if(n)return r.push(i),n.declarations;return null},async getCachedDts(i){let n=await t.get(i,e);if(n)return n.dtsContent;return null},async cacheResult(i,n,h,u,f=[]){await t.set(i,n,h,u,f,e),s.push(i)},skip(i){a.push(i)},getResult(){return{rebuilt:s,cached:r,skipped:a,stats:t.getStats()}},async save(){await t.save()}}}async function ls(t,e=604800000){let s=t.getStats();if(s.totalEntries>1000)return await t.clear(),s.totalEntries;return 0}function us(t){let e=[];return e.push("Incremental Build Results:"),e.push(` Rebuilt: ${t.rebuilt.length} files`),e.push(` From cache: ${t.cached.length} files`),e.push(` Skipped: ${t.skipped.length} files`),e.push(""),e.push("Cache Statistics:"),e.push(` Total entries: ${t.stats.totalEntries}`),e.push(` Hit ratio: ${(t.stats.hitRatio*100).toFixed(1)}%`),e.push(` Time saved: ~${t.stats.timeSavedMs}ms`),e.join(`
3
+ `)}function fs(t,e){let s=[],r=/import\s+(?:type\s+)?(?:.+(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])from\s+)?['"]([^'"]+)['"]/g,a;while((a=r.exec(t))!==null){let i=a[1];if(i.startsWith(".")){let n=o(C(e),i);s.push(n),s.push(`${n}.ts`),s.push(`${n}.tsx`),s.push(o(n,"index.ts")),s.push(o(n,"index.tsx"))}}return s}
4
+ export{$r,cs,ls,us,fs};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-5tn8854w.js";function Ke(d={}){let{buildStart:l=!0,buildEnd:u=!1,writeBundle:c=!1,modes:t,onGenerated:f,onError:o,...p}=d,i="production",r=async()=>{try{let e=await s(p);f?.(e)}catch(e){let a=e instanceof Error?e:Error(String(e));if(o?.(a),!o)console.error("[dtsx] Generation failed:",a.message)}},n=()=>{if(!t||t.length===0)return!0;return t.includes(i)};return{name:"dtsx",apply(e){return i=e.mode,!0},async buildStart(){if(l&&n())await r()},async buildEnd(){if(u&&n())await r()},async writeBundle(){if(c&&n())await r()}}}var Ra=Ke,Ma=Ke;
3
- export{Ke,Ra,Ma};
2
+ import{s}from"./chunk-6m4fpfzj.js";function Ke(d={}){let{buildStart:l=!0,buildEnd:u=!1,writeBundle:c=!1,modes:t,onGenerated:f,onError:o,...p}=d,i="production",r=async()=>{try{let e=await s(p);f?.(e)}catch(e){let a=e instanceof Error?e:Error(String(e));if(o?.(a),!o)console.error("[dtsx] Generation failed:",a.message)}},n=()=>{if(!t||t.length===0)return!0;return t.includes(i)};return{name:"dtsx",apply(e){return i=e.mode,!0},async buildStart(){if(l&&n())await r()},async buildEnd(){if(u&&n())await r()},async writeBundle(){if(c&&n())await r()}}}var La=Ke,Na=Ke;
3
+ export{Ke,La,Na};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Ie}from"./chunk-g9emajpc.js";import{readFileSync as m,statSync as w}from"fs";import{readFile as y}from"fs/promises";import{createRequire as v}from"module";import{dirname as g,isAbsolute as b,join as u,resolve as p}from"path";function l(t){let o=[t];if(!t.endsWith(".json"))o.push(`${t}.json`);o.push(u(t,"tsconfig.json"));for(let a of o)try{if(w(a).isFile())return a}catch{}return null}function E(t,o){if(b(t)||t.startsWith("."))return l(p(g(o),t));let a=v(o),n=t.startsWith("@")?/^@[^/]+\/[^/]+/.exec(t)?.[0]:t.split("/")[0];if(n)for(let d of a.resolve.paths(n)??[]){let e=l(u(d,n,"package.json"));if(!e)continue;let i=JSON.parse(m(e,"utf8"));if(t===n){if(i.tsconfig!==void 0){if(typeof i.tsconfig!=="string")throw Error(`Invalid tsconfig field in ${e}`);let r=l(p(g(e),i.tsconfig));if(!r)throw Error(`Cannot resolve tsconfig ${JSON.stringify(i.tsconfig)} from ${e}`);return r}let s=l(u(g(e),"tsconfig.json"));if(s)return s}break}for(let d of[`${t}/tsconfig.json`,t])try{let e=a.resolve(d),i=e.endsWith(".json")?l(e):null;if(i)return i}catch{}return null}async function ce(t,o={},a=new Set){let n=l(t);if(!n)return;if(a.has(n)){if(o.allowCircular)return;throw Error(`Circular tsconfig extends: ${n}`)}let d=new Set(a).add(n),e=JSON.parse(Ie(await y(n,"utf8"))),i=typeof e.extends==="string"?[e.extends]:e.extends??[];if(!Array.isArray(i)||i.some((f)=>typeof f!=="string"))throw Error(`Invalid tsconfig extends in ${n}`);let s={};for(let f of i){let c=E(f,n);if(!c)throw Error(`Cannot resolve tsconfig extends ${JSON.stringify(f)} from ${n}`);s={...s,...await ce(c,o,d)}}let r=e.compilerOptions??{};if(r.isolatedDeclarations!==void 0)s.isolatedDeclarations=r.isolatedDeclarations;if(r.baseUrl!==void 0){if(typeof r.baseUrl!=="string")throw Error(`Invalid baseUrl in ${n}`);s.baseUrl=p(g(n),r.baseUrl)}if(r.paths!==void 0){if(!r.paths||typeof r.paths!=="object"||Array.isArray(r.paths))throw Error(`Invalid paths in ${n}`);for(let[f,c]of Object.entries(r.paths))if(f.split("*").length>2||!Array.isArray(c)||c.length===0||c.some((h)=>typeof h!=="string"||h.split("*").length>2))throw Error(`Invalid path mapping ${JSON.stringify(f)} in ${n}`);s.paths=r.paths,s.pathsBasePath=g(n)}return s}
3
- export{ce};
2
+ import{Ne}from"./chunk-xvp60m78.js";import{readFileSync as m,statSync as w}from"fs";import{readFile as y}from"fs/promises";import{createRequire as v}from"module";import{dirname as g,isAbsolute as b,join as u,resolve as p}from"path";function l(t){let o=[t];if(!t.endsWith(".json"))o.push(`${t}.json`);o.push(u(t,"tsconfig.json"));for(let a of o)try{if(w(a).isFile())return a}catch{}return null}function E(t,o){if(b(t)||t.startsWith("."))return l(p(g(o),t));let a=v(o),n=t.startsWith("@")?/^@[^/]+\/[^/]+/.exec(t)?.[0]:t.split("/")[0];if(n)for(let d of a.resolve.paths(n)??[]){let e=l(u(d,n,"package.json"));if(!e)continue;let i=JSON.parse(m(e,"utf8"));if(t===n){if(i.tsconfig!==void 0){if(typeof i.tsconfig!=="string")throw Error(`Invalid tsconfig field in ${e}`);let r=l(p(g(e),i.tsconfig));if(!r)throw Error(`Cannot resolve tsconfig ${JSON.stringify(i.tsconfig)} from ${e}`);return r}let s=l(u(g(e),"tsconfig.json"));if(s)return s}break}for(let d of[`${t}/tsconfig.json`,t])try{let e=a.resolve(d),i=e.endsWith(".json")?l(e):null;if(i)return i}catch{}return null}async function le(t,o={},a=new Set){let n=l(t);if(!n)return;if(a.has(n)){if(o.allowCircular)return;throw Error(`Circular tsconfig extends: ${n}`)}let d=new Set(a).add(n),e=JSON.parse(Ne(await y(n,"utf8"))),i=typeof e.extends==="string"?[e.extends]:e.extends??[];if(!Array.isArray(i)||i.some((f)=>typeof f!=="string"))throw Error(`Invalid tsconfig extends in ${n}`);let s={};for(let f of i){let c=E(f,n);if(!c)throw Error(`Cannot resolve tsconfig extends ${JSON.stringify(f)} from ${n}`);s={...s,...await le(c,o,d)}}let r=e.compilerOptions??{};if(r.isolatedDeclarations!==void 0)s.isolatedDeclarations=r.isolatedDeclarations;if(r.baseUrl!==void 0){if(typeof r.baseUrl!=="string")throw Error(`Invalid baseUrl in ${n}`);s.baseUrl=p(g(n),r.baseUrl)}if(r.paths!==void 0){if(!r.paths||typeof r.paths!=="object"||Array.isArray(r.paths))throw Error(`Invalid paths in ${n}`);for(let[f,c]of Object.entries(r.paths))if(f.split("*").length>2||!Array.isArray(c)||c.length===0||c.some((h)=>typeof h!=="string"||h.split("*").length>2))throw Error(`Invalid path mapping ${JSON.stringify(f)} in ${n}`);s.paths=r.paths,s.pathsBasePath=g(n)}return s}
3
+ export{le};
@@ -1,13 +1,13 @@
1
1
  // @bun
2
- function p(r,t){let e=r.trim();if(e==="string")return{type:"string"};if(e==="number")return{type:"number"};if(e==="boolean")return{type:"boolean"};if(e==="null")return{type:"null"};if(e==="undefined")return{type:"null"};if(e==="any"||e==="unknown")return{};if(e==="never")return{not:{}};if(e==="void")return{type:"null"};if(e==="bigint")return{type:"integer"};if(e==="symbol")return{type:"string",description:"Symbol type"};if(e==="object")return{type:"object"};if(e.startsWith("'")||e.startsWith('"'))return{const:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{const:Number.parseFloat(e)};if(e==="true")return{const:!0};if(e==="false")return{const:!1};let n=e.match(/^(.+)\[\]$/)||e.match(/^Array<(.+)>$/i);if(n)return{type:"array",items:p(n[1],t)};let i=e.match(/^\[(.+)\]$/);if(i){let f=l(i[1],",").map((d)=>p(d.trim(),t));return{type:"array",items:f,minItems:f.length,maxItems:f.length}}if(e.includes("|")){let f=l(e,"|");if(f.length>1){let d=f.filter((a)=>a.trim()!=="null"&&a.trim()!=="undefined");if(f.some((a)=>a.trim()==="null"||a.trim()==="undefined")&&d.length===1){let a=p(d[0],t);if(a.type&&typeof a.type==="string")return{...a,type:[a.type,"null"]};return{oneOf:[a,{type:"null"}]}}return{oneOf:f.map((a)=>p(a.trim(),t))}}}if(e.includes("&")){let f=l(e,"&");if(f.length>1)return{allOf:f.map((d)=>p(d.trim(),t))}}let s=e.match(/^Record<(.+),\s*(.+)>$/i);if(s)return{type:"object",additionalProperties:p(s[2],t)};let o=e.match(/^Promise<(.+)>$/i);if(o)return p(o[1],t);let u=e.match(/^Partial<(.+)>$/i);if(u)return{...p(u[1],t),required:[]};let h=e.match(/^Required<(.+)>$/i);if(h)return p(h[1],t);let c=e.match(/^Readonly<(.+)>$/i);if(c)return p(c[1],t);let y=e.match(/^Pick<(.+),\s*(.+)>$/i);if(y)return p(y[1],t);let b=e.match(/^Omit<(.+),\s*(.+)>$/i);if(b)return p(b[1],t);if(e==="Date")return{type:"string",format:"date-time"};if(/^[A-Z]\w*$/.test(e))return{$ref:`#/$defs/${e}`};return{type:"object"}}function Wr(r,t={}){let e=t.indent??2,n=t.jsonSchemaDraft??"2020-12",i={"2020-12":"https://json-schema.org/draft/2020-12/schema","2019-09":"https://json-schema.org/draft/2019-09/schema","draft-07":"http://json-schema.org/draft-07/schema#"}[n],s=new Map,o={$schema:t.includeSchema!==!1?i:void 0,$defs:{}};for(let u of r)if(u.kind==="interface"||u.kind==="type"){let h=N(u,s,t);if(o.$defs)o.$defs[u.name]=h}if(o.$defs&&Object.keys(o.$defs).length===1){let[u,h]=Object.entries(o.$defs)[0];return JSON.stringify({$schema:o.$schema,title:u,...h},null,e)}return JSON.stringify(o,null,e)}function N(r,t,e){let n={type:"object"};if(e.includeDescriptions&&r.leadingComments?.length){let i=v(r.leadingComments);if(i)n.description=i}if(r.members&&r.members.length>0){n.properties={},n.required=[];for(let i of r.members)if(i.name&&i.typeAnnotation){let s=p(i.typeAnnotation,t);if(e.includeDescriptions&&i.leadingComments?.length){let u=v(i.leadingComments);if(u)s.description=u}if(n.properties[i.name]=s,!(i.modifiers?.includes("?")||i.text?.includes("?:")||e.allOptional))n.required.push(i.name)}if(n.required.length===0)delete n.required}else if(r.typeAnnotation)return p(r.typeAnnotation,t);return n}function _r(r,t={}){let e=["import { z } from 'zod'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Schema`,s=x(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = z.infer<typeof ${i}>`),e.push("")}return e.join(`
2
+ function p(r,t){let e=r.trim();if(e==="string")return{type:"string"};if(e==="number")return{type:"number"};if(e==="boolean")return{type:"boolean"};if(e==="null")return{type:"null"};if(e==="undefined")return{type:"null"};if(e==="any"||e==="unknown")return{};if(e==="never")return{not:{}};if(e==="void")return{type:"null"};if(e==="bigint")return{type:"integer"};if(e==="symbol")return{type:"string",description:"Symbol type"};if(e==="object")return{type:"object"};if(e.startsWith("'")||e.startsWith('"'))return{const:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{const:Number.parseFloat(e)};if(e==="true")return{const:!0};if(e==="false")return{const:!1};let n=e.match(/^(.+)\[\]$/)||e.match(/^Array<(.+)>$/i);if(n)return{type:"array",items:p(n[1],t)};let i=e.match(/^\[(.+)\]$/);if(i){let f=l(i[1],",").map((d)=>p(d.trim(),t));return{type:"array",items:f,minItems:f.length,maxItems:f.length}}if(e.includes("|")){let f=l(e,"|");if(f.length>1){let d=f.filter((a)=>a.trim()!=="null"&&a.trim()!=="undefined");if(f.some((a)=>a.trim()==="null"||a.trim()==="undefined")&&d.length===1){let a=p(d[0],t);if(a.type&&typeof a.type==="string")return{...a,type:[a.type,"null"]};return{oneOf:[a,{type:"null"}]}}return{oneOf:f.map((a)=>p(a.trim(),t))}}}if(e.includes("&")){let f=l(e,"&");if(f.length>1)return{allOf:f.map((d)=>p(d.trim(),t))}}let s=e.match(/^Record<(.+),\s*(.+)>$/i);if(s)return{type:"object",additionalProperties:p(s[2],t)};let o=e.match(/^Promise<(.+)>$/i);if(o)return p(o[1],t);let u=e.match(/^Partial<(.+)>$/i);if(u)return{...p(u[1],t),required:[]};let h=e.match(/^Required<(.+)>$/i);if(h)return p(h[1],t);let c=e.match(/^Readonly<(.+)>$/i);if(c)return p(c[1],t);let y=e.match(/^Pick<(.+),\s*(.+)>$/i);if(y)return p(y[1],t);let b=e.match(/^Omit<(.+),\s*(.+)>$/i);if(b)return p(b[1],t);if(e==="Date")return{type:"string",format:"date-time"};if(/^[A-Z]\w*$/.test(e))return{$ref:`#/$defs/${e}`};return{type:"object"}}function xi(r,t={}){let e=t.indent??2,n=t.jsonSchemaDraft??"2020-12",i={"2020-12":"https://json-schema.org/draft/2020-12/schema","2019-09":"https://json-schema.org/draft/2019-09/schema","draft-07":"http://json-schema.org/draft-07/schema#"}[n],s=new Map,o={$schema:t.includeSchema!==!1?i:void 0,$defs:{}};for(let u of r)if(u.kind==="interface"||u.kind==="type"){let h=N(u,s,t);if(o.$defs)o.$defs[u.name]=h}if(o.$defs&&Object.keys(o.$defs).length===1){let[u,h]=Object.entries(o.$defs)[0];return JSON.stringify({$schema:o.$schema,title:u,...h},null,e)}return JSON.stringify(o,null,e)}function N(r,t,e){let n={type:"object"};if(e.includeDescriptions&&r.leadingComments?.length){let i=v(r.leadingComments);if(i)n.description=i}if(r.members&&r.members.length>0){n.properties={},n.required=[];for(let i of r.members)if(i.name&&i.typeAnnotation){let s=p(i.typeAnnotation,t);if(e.includeDescriptions&&i.leadingComments?.length){let u=v(i.leadingComments);if(u)s.description=u}if(n.properties[i.name]=s,!(i.modifiers?.includes("?")||i.text?.includes("?:")||e.allOptional))n.required.push(i.name)}if(n.required.length===0)delete n.required}else if(r.typeAnnotation)return p(r.typeAnnotation,t);return n}function Ci(r,t={}){let e=["import { z } from 'zod'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Schema`,s=x(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = z.infer<typeof ${i}>`),e.push("")}return e.join(`
3
3
  `)}function x(r,t){if(r.members&&r.members.length>0)return`z.object({
4
4
  ${r.members.filter((n)=>n.name&&n.typeAnnotation).map((n)=>{let i=m(n.typeAnnotation);if(n.modifiers?.includes("?")||n.text?.includes("?:")||t.allOptional)i=`${i}.optional()`;if(t.includeDescriptions&&n.leadingComments?.length){let o=v(n.leadingComments);if(o)i=`${i}.describe(${JSON.stringify(o)})`}return` ${n.name}: ${i}`}).join(`,
5
5
  `)}
6
- })`;if(r.typeAnnotation)return m(r.typeAnnotation);return"z.unknown()"}function m(r){let t=r.trim();if(t==="string")return"z.string()";if(t==="number")return"z.number()";if(t==="boolean")return"z.boolean()";if(t==="null")return"z.null()";if(t==="undefined")return"z.undefined()";if(t==="any")return"z.any()";if(t==="unknown")return"z.unknown()";if(t==="never")return"z.never()";if(t==="void")return"z.void()";if(t==="bigint")return"z.bigint()";if(t==="symbol")return"z.symbol()";if(t==="Date")return"z.date()";if(t.startsWith("'")||t.startsWith('"'))return`z.literal(${t})`;if(/^-?\d+(\.\d+)?$/.test(t))return`z.literal(${t})`;if(t==="true"||t==="false")return`z.literal(${t})`;let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`z.array(${m(e[1])})`;let n=t.match(/^\[(.+)\]$/);if(n)return`z.tuple([${l(n[1],",").map((b)=>m(b.trim())).join(", ")}])`;if(t.includes("|")){let y=l(t,"|");if(y.length>1){let b=y.filter((a)=>a.trim()!=="null"&&a.trim()!=="undefined"),f=y.some((a)=>a.trim()==="null"),d=y.some((a)=>a.trim()==="undefined");if((f||d)&&b.length===1){let a=m(b[0]);if(f)a=`${a}.nullable()`;if(d)a=`${a}.optional()`;return a}return`z.union([${y.map((a)=>m(a.trim())).join(", ")}])`}}if(t.includes("&")){let y=l(t,"&");if(y.length>1)return y.map((f)=>m(f.trim())).reduce((f,d)=>`${f}.and(${d})`)}let i=t.match(/^Record<(.+),\s*(.+)>$/i);if(i)return`z.record(${m(i[1])}, ${m(i[2])})`;let s=t.match(/^Promise<(.+)>$/i);if(s)return`z.promise(${m(s[1])})`;let o=t.match(/^Map<(.+),\s*(.+)>$/i);if(o)return`z.map(${m(o[1])}, ${m(o[2])})`;let u=t.match(/^Set<(.+)>$/i);if(u)return`z.set(${m(u[1])})`;let h=t.match(/^Partial<(.+)>$/i);if(h)return`${m(h[1])}.partial()`;let c=t.match(/^Required<(.+)>$/i);if(c)return`${m(c[1])}.required()`;if(/^[A-Z]\w*$/.test(t))return`${t}Schema`;return"z.unknown()"}function jr(r,t={}){let e=["import * as v from 'valibot'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Schema`,s=j(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = v.InferOutput<typeof ${i}>`),e.push("")}return e.join(`
6
+ })`;if(r.typeAnnotation)return m(r.typeAnnotation);return"z.unknown()"}function m(r){let t=r.trim();if(t==="string")return"z.string()";if(t==="number")return"z.number()";if(t==="boolean")return"z.boolean()";if(t==="null")return"z.null()";if(t==="undefined")return"z.undefined()";if(t==="any")return"z.any()";if(t==="unknown")return"z.unknown()";if(t==="never")return"z.never()";if(t==="void")return"z.void()";if(t==="bigint")return"z.bigint()";if(t==="symbol")return"z.symbol()";if(t==="Date")return"z.date()";if(t.startsWith("'")||t.startsWith('"'))return`z.literal(${t})`;if(/^-?\d+(\.\d+)?$/.test(t))return`z.literal(${t})`;if(t==="true"||t==="false")return`z.literal(${t})`;let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`z.array(${m(e[1])})`;let n=t.match(/^\[(.+)\]$/);if(n)return`z.tuple([${l(n[1],",").map((b)=>m(b.trim())).join(", ")}])`;if(t.includes("|")){let y=l(t,"|");if(y.length>1){let b=y.filter((a)=>a.trim()!=="null"&&a.trim()!=="undefined"),f=y.some((a)=>a.trim()==="null"),d=y.some((a)=>a.trim()==="undefined");if((f||d)&&b.length===1){let a=m(b[0]);if(f)a=`${a}.nullable()`;if(d)a=`${a}.optional()`;return a}return`z.union([${y.map((a)=>m(a.trim())).join(", ")}])`}}if(t.includes("&")){let y=l(t,"&");if(y.length>1)return y.map((f)=>m(f.trim())).reduce((f,d)=>`${f}.and(${d})`)}let i=t.match(/^Record<(.+),\s*(.+)>$/i);if(i)return`z.record(${m(i[1])}, ${m(i[2])})`;let s=t.match(/^Promise<(.+)>$/i);if(s)return`z.promise(${m(s[1])})`;let o=t.match(/^Map<(.+),\s*(.+)>$/i);if(o)return`z.map(${m(o[1])}, ${m(o[2])})`;let u=t.match(/^Set<(.+)>$/i);if(u)return`z.set(${m(u[1])})`;let h=t.match(/^Partial<(.+)>$/i);if(h)return`${m(h[1])}.partial()`;let c=t.match(/^Required<(.+)>$/i);if(c)return`${m(c[1])}.required()`;if(/^[A-Z]\w*$/.test(t))return`${t}Schema`;return"z.unknown()"}function vi(r,t={}){let e=["import * as v from 'valibot'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Schema`,s=j(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = v.InferOutput<typeof ${i}>`),e.push("")}return e.join(`
7
7
  `)}function j(r,t){if(r.members&&r.members.length>0)return`v.object({
8
8
  ${r.members.filter((n)=>n.name&&n.typeAnnotation).map((n)=>{let i=g(n.typeAnnotation);if(n.modifiers?.includes("?")||n.text?.includes("?:")||t.allOptional)i=`v.optional(${i})`;return` ${n.name}: ${i}`}).join(`,
9
9
  `)}
10
- })`;if(r.typeAnnotation)return g(r.typeAnnotation);return"v.unknown()"}function g(r){let t=r.trim();if(t==="string")return"v.string()";if(t==="number")return"v.number()";if(t==="boolean")return"v.boolean()";if(t==="null")return"v.null_()";if(t==="undefined")return"v.undefined_()";if(t==="any")return"v.any()";if(t==="unknown")return"v.unknown()";if(t==="never")return"v.never()";if(t==="void")return"v.void_()";if(t==="bigint")return"v.bigint()";if(t==="symbol")return"v.symbol()";if(t==="Date")return"v.date()";if(t.startsWith("'")||t.startsWith('"'))return`v.literal(${t})`;if(/^-?\d+(\.\d+)?$/.test(t))return`v.literal(${t})`;if(t==="true"||t==="false")return`v.literal(${t})`;let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`v.array(${g(e[1])})`;let n=t.match(/^\[(.+)\]$/);if(n)return`v.tuple([${l(n[1],",").map((o)=>g(o.trim())).join(", ")}])`;if(t.includes("|")){let s=l(t,"|");if(s.length>1){let o=s.filter((c)=>c.trim()!=="null"&&c.trim()!=="undefined"),u=s.some((c)=>c.trim()==="null"),h=s.some((c)=>c.trim()==="undefined");if((u||h)&&o.length===1){let c=g(o[0]);if(u)c=`v.nullable(${c})`;if(h)c=`v.optional(${c})`;return c}return`v.union([${s.map((c)=>g(c.trim())).join(", ")}])`}}if(t.includes("&")){let s=l(t,"&");if(s.length>1)return`v.intersect([${s.map((o)=>g(o.trim())).join(", ")}])`}let i=t.match(/^Record<(.+),\s*(.+)>$/i);if(i)return`v.record(${g(i[1])}, ${g(i[2])})`;if(/^[A-Z]\w*$/.test(t))return`${t}Schema`;return"v.unknown()"}function Gr(r,t={}){let e=["import * as t from 'io-ts'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Codec`,s=A(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = t.TypeOf<typeof ${i}>`),e.push("")}return e.join(`
10
+ })`;if(r.typeAnnotation)return g(r.typeAnnotation);return"v.unknown()"}function g(r){let t=r.trim();if(t==="string")return"v.string()";if(t==="number")return"v.number()";if(t==="boolean")return"v.boolean()";if(t==="null")return"v.null_()";if(t==="undefined")return"v.undefined_()";if(t==="any")return"v.any()";if(t==="unknown")return"v.unknown()";if(t==="never")return"v.never()";if(t==="void")return"v.void_()";if(t==="bigint")return"v.bigint()";if(t==="symbol")return"v.symbol()";if(t==="Date")return"v.date()";if(t.startsWith("'")||t.startsWith('"'))return`v.literal(${t})`;if(/^-?\d+(\.\d+)?$/.test(t))return`v.literal(${t})`;if(t==="true"||t==="false")return`v.literal(${t})`;let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`v.array(${g(e[1])})`;let n=t.match(/^\[(.+)\]$/);if(n)return`v.tuple([${l(n[1],",").map((o)=>g(o.trim())).join(", ")}])`;if(t.includes("|")){let s=l(t,"|");if(s.length>1){let o=s.filter((c)=>c.trim()!=="null"&&c.trim()!=="undefined"),u=s.some((c)=>c.trim()==="null"),h=s.some((c)=>c.trim()==="undefined");if((u||h)&&o.length===1){let c=g(o[0]);if(u)c=`v.nullable(${c})`;if(h)c=`v.optional(${c})`;return c}return`v.union([${s.map((c)=>g(c.trim())).join(", ")}])`}}if(t.includes("&")){let s=l(t,"&");if(s.length>1)return`v.intersect([${s.map((o)=>g(o.trim())).join(", ")}])`}let i=t.match(/^Record<(.+),\s*(.+)>$/i);if(i)return`v.record(${g(i[1])}, ${g(i[2])})`;if(/^[A-Z]\w*$/.test(t))return`${t}Schema`;return"v.unknown()"}function Si(r,t={}){let e=["import * as t from 'io-ts'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Codec`,s=A(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = t.TypeOf<typeof ${i}>`),e.push("")}return e.join(`
11
11
  `)}function A(r,t){if(r.members&&r.members.length>0){let e=[],n=[];for(let i of r.members){if(!i.name||!i.typeAnnotation)continue;let s=O(i.typeAnnotation),o=i.modifiers?.includes("?")||i.text?.includes("?:")||t.allOptional,u=` ${i.name}: ${s}`;if(o)n.push(u);else e.push(u)}if(n.length>0)return`t.intersection([
12
12
  t.type({
13
13
  ${e.join(`,
@@ -20,15 +20,15 @@ ${n.join(`,
20
20
  ])`;return`t.type({
21
21
  ${e.join(`,
22
22
  `)}
23
- })`}if(r.typeAnnotation)return O(r.typeAnnotation);return"t.unknown"}function O(r){let t=r.trim();if(t==="string")return"t.string";if(t==="number")return"t.number";if(t==="boolean")return"t.boolean";if(t==="null")return"t.null";if(t==="undefined")return"t.undefined";if(t==="any")return"t.unknown";if(t==="unknown")return"t.unknown";if(t==="never")return"t.never";if(t==="void")return"t.void";if(t.startsWith("'")||t.startsWith('"'))return`t.literal(${t})`;if(/^-?\d+(\.\d+)?$/.test(t))return`t.literal(${t})`;if(t==="true"||t==="false")return`t.literal(${t})`;let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`t.array(${O(e[1])})`;let n=t.match(/^\[(.+)\]$/);if(n)return`t.tuple([${l(n[1],",").map((o)=>O(o.trim())).join(", ")}])`;if(t.includes("|")){let s=l(t,"|");if(s.length>1)return`t.union([${s.map((o)=>O(o.trim())).join(", ")}])`}if(t.includes("&")){let s=l(t,"&");if(s.length>1)return`t.intersection([${s.map((o)=>O(o.trim())).join(", ")}])`}let i=t.match(/^Record<(.+),\s*(.+)>$/i);if(i)return`t.record(${O(i[1])}, ${O(i[2])})`;if(/^[A-Z]\w*$/.test(t))return`${t}Codec`;return"t.unknown"}function Vr(r,t={}){let e=["import * as yup from 'yup'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Schema`,s=z(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = yup.InferType<typeof ${i}>`),e.push("")}return e.join(`
23
+ })`}if(r.typeAnnotation)return O(r.typeAnnotation);return"t.unknown"}function O(r){let t=r.trim();if(t==="string")return"t.string";if(t==="number")return"t.number";if(t==="boolean")return"t.boolean";if(t==="null")return"t.null";if(t==="undefined")return"t.undefined";if(t==="any")return"t.unknown";if(t==="unknown")return"t.unknown";if(t==="never")return"t.never";if(t==="void")return"t.void";if(t.startsWith("'")||t.startsWith('"'))return`t.literal(${t})`;if(/^-?\d+(\.\d+)?$/.test(t))return`t.literal(${t})`;if(t==="true"||t==="false")return`t.literal(${t})`;let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`t.array(${O(e[1])})`;let n=t.match(/^\[(.+)\]$/);if(n)return`t.tuple([${l(n[1],",").map((o)=>O(o.trim())).join(", ")}])`;if(t.includes("|")){let s=l(t,"|");if(s.length>1)return`t.union([${s.map((o)=>O(o.trim())).join(", ")}])`}if(t.includes("&")){let s=l(t,"&");if(s.length>1)return`t.intersection([${s.map((o)=>O(o.trim())).join(", ")}])`}let i=t.match(/^Record<(.+),\s*(.+)>$/i);if(i)return`t.record(${O(i[1])}, ${O(i[2])})`;if(/^[A-Z]\w*$/.test(t))return`${t}Codec`;return"t.unknown"}function $i(r,t={}){let e=["import * as yup from 'yup'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||`${n.name}Schema`,s=z(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name} = yup.InferType<typeof ${i}>`),e.push("")}return e.join(`
24
24
  `)}function z(r,t){if(r.members&&r.members.length>0)return`yup.object({
25
25
  ${r.members.filter((n)=>n.name&&n.typeAnnotation).map((n)=>{let i=T(n.typeAnnotation);if(!(n.modifiers?.includes("?")||n.text?.includes("?:")||t.allOptional))i=`${i}.required()`;return` ${n.name}: ${i}`}).join(`,
26
26
  `)}
27
- })`;if(r.typeAnnotation)return T(r.typeAnnotation);return"yup.mixed()"}function T(r){let t=r.trim();if(t==="string")return"yup.string()";if(t==="number")return"yup.number()";if(t==="boolean")return"yup.boolean()";if(t==="Date")return"yup.date()";if(t==="any"||t==="unknown")return"yup.mixed()";let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`yup.array().of(${T(e[1])})`;if(t.includes("|")){let n=l(t,"|");if(n.length>1){let i=n.filter((o)=>o.trim()!=="null"&&o.trim()!=="undefined");if(n.some((o)=>o.trim()==="null"||o.trim()==="undefined")&&i.length===1)return`${T(i[0])}.nullable()`}}if(/^[A-Z]\w*$/.test(t))return`${t}Schema`;return"yup.mixed()"}function zr(r,t={}){let e=["import { type } from 'arktype'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||n.name,s=w(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name}Type = typeof ${i}.infer`),e.push("")}return e.join(`
27
+ })`;if(r.typeAnnotation)return T(r.typeAnnotation);return"yup.mixed()"}function T(r){let t=r.trim();if(t==="string")return"yup.string()";if(t==="number")return"yup.number()";if(t==="boolean")return"yup.boolean()";if(t==="Date")return"yup.date()";if(t==="any"||t==="unknown")return"yup.mixed()";let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`yup.array().of(${T(e[1])})`;if(t.includes("|")){let n=l(t,"|");if(n.length>1){let i=n.filter((o)=>o.trim()!=="null"&&o.trim()!=="undefined");if(n.some((o)=>o.trim()==="null"||o.trim()==="undefined")&&i.length===1)return`${T(i[0])}.nullable()`}}if(/^[A-Z]\w*$/.test(t))return`${t}Schema`;return"yup.mixed()"}function Ei(r,t={}){let e=["import { type } from 'arktype'",""];for(let n of r)if(n.kind==="interface"||n.kind==="type"){let i=t.exportName||n.name,s=w(n,t);if(e.push(`export const ${i} = ${s}`),e.push(""),t.useInfer!==!1)e.push(`export type ${n.name}Type = typeof ${i}.infer`),e.push("")}return e.join(`
28
28
  `)}function w(r,t){if(r.members&&r.members.length>0)return`type({
29
29
  ${r.members.filter((n)=>n.name&&n.typeAnnotation).map((n)=>{let i=S(n.typeAnnotation);return` ${n.modifiers?.includes("?")||n.text?.includes("?:")||t.allOptional?`'${n.name}?'`:`${n.name}`}: ${i}`}).join(`,
30
30
  `)}
31
- })`;if(r.typeAnnotation)return`type(${S(r.typeAnnotation)})`;return"type('unknown')"}function S(r){let t=r.trim();if(t==="string")return"'string'";if(t==="number")return"'number'";if(t==="boolean")return"'boolean'";if(t==="null")return"'null'";if(t==="undefined")return"'undefined'";if(t==="bigint")return"'bigint'";if(t==="symbol")return"'symbol'";if(t==="Date")return"'Date'";if(t==="any"||t==="unknown")return"'unknown'";let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`${S(e[1])}.array()`;if(t.includes("|")){let n=l(t,"|");if(n.length>1)return`'${n.map((i)=>i.trim()).join(" | ")}'`}if(t.startsWith("'")||t.startsWith('"'))return`'${t}'`;return`'${t}'`}function l(r,t){let e=[],n="",i=0;for(let s=0;s<r.length;s++){let o=r[s];if(o==="<"||o==="("||o==="["||o==="{")i++,n+=o;else if(o===">"||o===")"||o==="]"||o==="}")i--,n+=o;else if(i===0&&r.slice(s,s+t.length)===t)e.push(n.trim()),n="",s+=t.length-1;else n+=o}if(n.trim())e.push(n.trim());return e}function v(r){for(let t of r){let e=t.replace(/^\/\*\*|\*\/$/g,"").replace(/^\s*\*\s?/gm,"").replace(/@\w.*/g,"").trim();if(e)return e}return null}function Gs(r,t){switch(t.format){case"json-schema":return Wr(r,t);case"zod":return _r(r,t);case"valibot":return jr(r,t);case"io-ts":return Gr(r,t);case"yup":return Vr(r,t);case"arktype":return zr(r,t);case"dts":default:return r.map((e)=>e.text).join(`
31
+ })`;if(r.typeAnnotation)return`type(${S(r.typeAnnotation)})`;return"type('unknown')"}function S(r){let t=r.trim();if(t==="string")return"'string'";if(t==="number")return"'number'";if(t==="boolean")return"'boolean'";if(t==="null")return"'null'";if(t==="undefined")return"'undefined'";if(t==="bigint")return"'bigint'";if(t==="symbol")return"'symbol'";if(t==="Date")return"'Date'";if(t==="any"||t==="unknown")return"'unknown'";let e=t.match(/^(.+)\[\]$/)||t.match(/^Array<(.+)>$/i);if(e)return`${S(e[1])}.array()`;if(t.includes("|")){let n=l(t,"|");if(n.length>1)return`'${n.map((i)=>i.trim()).join(" | ")}'`}if(t.startsWith("'")||t.startsWith('"'))return`'${t}'`;return`'${t}'`}function l(r,t){let e=[],n="",i=0;for(let s=0;s<r.length;s++){let o=r[s];if(o==="<"||o==="("||o==="["||o==="{")i++,n+=o;else if(o===">"||o===")"||o==="]"||o==="}")i--,n+=o;else if(i===0&&r.slice(s,s+t.length)===t)e.push(n.trim()),n="",s+=t.length-1;else n+=o}if(n.trim())e.push(n.trim());return e}function v(r){for(let t of r){let e=t.replace(/^\/\*\*|\*\/$/g,"").replace(/^\s*\*\s?/gm,"").replace(/@\w.*/g,"").trim();if(e)return e}return null}function Ko(r,t){switch(t.format){case"json-schema":return xi(r,t);case"zod":return Ci(r,t);case"valibot":return vi(r,t);case"io-ts":return Si(r,t);case"yup":return $i(r,t);case"arktype":return Ei(r,t);case"dts":default:return r.map((e)=>e.text).join(`
32
32
 
33
- `)}}function Vs(r){switch(r){case"json-schema":return".schema.json";case"zod":case"valibot":case"io-ts":case"yup":case"arktype":return".schema.ts";case"dts":default:return".d.ts"}}
34
- export{Wr,_r,jr,Gr,Vr,zr,Gs,Vs};
33
+ `)}}function qo(r){switch(r){case"json-schema":return".schema.json";case"zod":case"valibot":case"io-ts":case"yup":case"arktype":return".schema.ts";case"dts":default:return".d.ts"}}
34
+ export{xi,Ci,vi,Si,$i,Ei,Ko,qo};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{u}from"./chunk-6b6rt0yh.js";import{b}from"./chunk-t5nmnzy6.js";import{C}from"./chunk-9mdgtq38.js";import{r}from"./chunk-0a1xppye.js";import{Me}from"./chunk-bt2n0b75.js";function oa(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=oa(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
- export{oa,Re};
2
+ import{u}from"./chunk-3phg2e1n.js";import{b}from"./chunk-r7qq9579.js";import{C}from"./chunk-s28gyv8z.js";import{r}from"./chunk-59q0p96t.js";import{Re}from"./chunk-7061vwkq.js";function Ao(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 Pe(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=Ao(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=Re(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
+ export{Ao,Pe};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{r}from"./chunk-0a1xppye.js";import{l}from"./chunk-81jrzxr6.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 Hr;((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"})(Hr||={});var Kr;((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"})(Kr||={});var qr;((n)=>{n[n.Text=1]="Text";n[n.Read=2]="Read";n[n.Write=3]="Write"})(qr||={});class dn{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-59q0p96t.js";import{l}from"./chunk-mzpbqdd2.js";import{existsSync as P,readFileSync as b,unwatchFile as w}from"fs";var Nr;((o)=>{o[o.Error=1]="Error";o[o.Warning=2]="Warning";o[o.Information=3]="Information";o[o.Hint=4]="Hint"})(Nr||={});var Fr;((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"})(Fr||={});var Br;((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"})(Br||={});var Wr;((n)=>{n[n.Text=1]="Text";n[n.Read=2]="Read";n[n.Write=3]="Write"})(Wr||={});class an{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(`
@@ -14,9 +14,9 @@ ${v[1].trim()}`}return{contents:{kind:"markdown",value:m}}}completion(t){let e=t
14
14
  `)[e.line]||"",a=o.slice(0,e.character).match(/[\w$]+$/),u=o.slice(e.character).match(/^[\w$]+/);if(!a&&!u)return null;return(a?.[0]||"")+(u?.[0]||"")}getWordAtRange(t,e){let i=this.documents.get(t);if(!i)return null;let n=i.content.split(`
15
15
  `);if(e.start.line===e.end.line)return n[e.start.line]?.slice(e.start.character,e.end.character)||null;return null}getDeclarationAtPosition(t,e){let i=this.documents.get(t);if(!i)return null;for(let n of i.declarations){let o=this.getDeclarationRange(n,i.content);if(this.positionInRange(e,o))return n}return null}positionInRange(t,e){if(t.line<e.start.line||t.line>e.end.line)return!1;if(t.line===e.start.line&&t.character<e.start.character)return!1;if(t.line===e.end.line&&t.character>e.end.character)return!1;return!0}declarationKindToSymbolKind(t){switch(t){case"function":return 12;case"class":return 5;case"interface":return 11;case"type":return 11;case"enum":return 10;case"variable":return 13;case"const":return 14;case"property":return 7;case"method":return 6;case"module":return 2;case"namespace":return 3;default:return 13}}generateDts(t){let e=this.documents.get(t);if(!e)return null;let i={filePath:this.uriToPath(t),sourceCode:e.content,declarations:e.declarations};return l(e.declarations,i,!0,this.config.importOrder)}buildSignature(t){switch(t.kind){case"function":{let e=t.parameters?.map((o)=>{let a="";if(o.rest)a+="...";if(a+=o.name,o.optional)a+="?";if(o.type)a+=`: ${o.type}`;return a}).join(", ")||"",i=t.generics||"",n=t.returnType?`: ${t.returnType}`:"";return`function ${t.name}${i}(${e})${n}`}case"variable":return`const ${t.name}: ${t.typeAnnotation||"unknown"}`;case"interface":return`interface ${t.name}${t.generics||""}${t.extends?` extends ${t.extends}`:""}`;case"type":return`type ${t.name}${t.generics||""} = ${t.typeAnnotation||"unknown"}`;case"class":return`class ${t.name}${t.generics||""}${t.extends?` extends ${t.extends}`:""}`;case"enum":return`enum ${t.name}`;default:return t.name}}getDeclarationRange(t,e){if(t.start!==void 0&&t.end!==void 0)return{start:this.offsetToPosition(t.start,e),end:this.offsetToPosition(t.end,e)};let i=e.split(`
16
16
  `);for(let n=0;n<i.length;n++){let o=i[n].indexOf(t.name);if(o!==-1)return{start:{line:n,character:o},end:{line:n,character:o+t.name.length}}}return{start:{line:0,character:0},end:{line:0,character:0}}}offsetToPosition(t,e){let i=0,n=0;for(let o=0;o<t&&o<e.length;o++)if(e[o]===`
17
- `)i++,n=0;else n++;return{line:i,character:n}}uriToPath(t){if(t.startsWith("file://"))return decodeURIComponent(t.slice(7));return t}pathToUri(t){return`file://${encodeURIComponent(t).replace(/%2F/g,"/")}`}handleMessage(t){if(t.method==="initialize")return{jsonrpc:"2.0",id:t.id,result:this.initialize(t.params)};if(t.method==="initialized")return null;if(t.method==="shutdown")return{jsonrpc:"2.0",id:t.id,result:null};if(t.method==="exit")process.exit(0);let e=t.params;if(t.method==="textDocument/didOpen")return this.didOpen(e),null;if(t.method==="textDocument/didChange")return this.didChange(e),null;if(t.method==="textDocument/didClose")return this.didClose(e),null;if(t.method==="textDocument/hover")return{jsonrpc:"2.0",id:t.id,result:this.hover(e)};if(t.method==="textDocument/completion")return{jsonrpc:"2.0",id:t.id,result:this.completion(e)};if(t.method==="textDocument/definition")return{jsonrpc:"2.0",id:t.id,result:this.definition(e)};if(t.method==="textDocument/references")return{jsonrpc:"2.0",id:t.id,result:this.references(e)};if(t.method==="textDocument/prepareRename")return{jsonrpc:"2.0",id:t.id,result:this.prepareRename(e)};if(t.method==="textDocument/rename")return{jsonrpc:"2.0",id:t.id,result:this.rename(e)};if(t.method==="textDocument/documentSymbol")return{jsonrpc:"2.0",id:t.id,result:this.documentSymbols(e)};if(t.method==="workspace/symbol")return{jsonrpc:"2.0",id:t.id,result:this.workspaceSymbols(e)};if(t.method==="textDocument/codeAction")return{jsonrpc:"2.0",id:t.id,result:this.codeActions(e)};if(t.method==="textDocument/signatureHelp")return{jsonrpc:"2.0",id:t.id,result:this.signatureHelp(e)};if(t.method==="textDocument/documentHighlight")return{jsonrpc:"2.0",id:t.id,result:this.documentHighlight(e)};if(t.method==="textDocument/formatting")return{jsonrpc:"2.0",id:t.id,result:this.formatting(e)};if(t.method==="textDocument/diagnostic"){let i=e?.textDocument?.uri;return{jsonrpc:"2.0",id:t.id,result:{kind:"full",items:i?this.getDiagnostics(i):[]}}}if(t.id!==void 0)return{jsonrpc:"2.0",id:t.id,error:{code:-32601,message:`Method not found: ${t.method}`}};return null}}function zs(){let t=new dn,e="";process.stdin.setEncoding("utf8"),process.stdin.on("data",(i)=>{e+=i;while(!0){let n=e.indexOf(`\r
17
+ `)i++,n=0;else n++;return{line:i,character:n}}uriToPath(t){if(t.startsWith("file://"))return decodeURIComponent(t.slice(7));return t}pathToUri(t){return`file://${encodeURIComponent(t).replace(/%2F/g,"/")}`}handleMessage(t){if(t.method==="initialize")return{jsonrpc:"2.0",id:t.id,result:this.initialize(t.params)};if(t.method==="initialized")return null;if(t.method==="shutdown")return{jsonrpc:"2.0",id:t.id,result:null};if(t.method==="exit")process.exit(0);let e=t.params;if(t.method==="textDocument/didOpen")return this.didOpen(e),null;if(t.method==="textDocument/didChange")return this.didChange(e),null;if(t.method==="textDocument/didClose")return this.didClose(e),null;if(t.method==="textDocument/hover")return{jsonrpc:"2.0",id:t.id,result:this.hover(e)};if(t.method==="textDocument/completion")return{jsonrpc:"2.0",id:t.id,result:this.completion(e)};if(t.method==="textDocument/definition")return{jsonrpc:"2.0",id:t.id,result:this.definition(e)};if(t.method==="textDocument/references")return{jsonrpc:"2.0",id:t.id,result:this.references(e)};if(t.method==="textDocument/prepareRename")return{jsonrpc:"2.0",id:t.id,result:this.prepareRename(e)};if(t.method==="textDocument/rename")return{jsonrpc:"2.0",id:t.id,result:this.rename(e)};if(t.method==="textDocument/documentSymbol")return{jsonrpc:"2.0",id:t.id,result:this.documentSymbols(e)};if(t.method==="workspace/symbol")return{jsonrpc:"2.0",id:t.id,result:this.workspaceSymbols(e)};if(t.method==="textDocument/codeAction")return{jsonrpc:"2.0",id:t.id,result:this.codeActions(e)};if(t.method==="textDocument/signatureHelp")return{jsonrpc:"2.0",id:t.id,result:this.signatureHelp(e)};if(t.method==="textDocument/documentHighlight")return{jsonrpc:"2.0",id:t.id,result:this.documentHighlight(e)};if(t.method==="textDocument/formatting")return{jsonrpc:"2.0",id:t.id,result:this.formatting(e)};if(t.method==="textDocument/diagnostic"){let i=e?.textDocument?.uri;return{jsonrpc:"2.0",id:t.id,result:{kind:"full",items:i?this.getDiagnostics(i):[]}}}if(t.id!==void 0)return{jsonrpc:"2.0",id:t.id,error:{code:-32601,message:`Method not found: ${t.method}`}};return null}}function ks(){let t=new an,e="";process.stdin.setEncoding("utf8"),process.stdin.on("data",(i)=>{e+=i;while(!0){let n=e.indexOf(`\r
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,Hr,Kr,qr,dn,zs,Us};
21
+ ${x}`)}}catch(p){console.error("Error parsing LSP message:",p)}}})}function Ts(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{Nr,Fr,Br,Wr,an,ks,Ts};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var sn=["builtin","external","internal","parent","sibling","index","type","unknown"];function on(e){let i=e.match(/^(import\s+)(type\s+)?(.+?)\s+from\s+['"]([^'"]+)['"]/);if(!i){let p=e.match(/^import\s+['"]([^'"]+)['"]/);if(p)return{statement:e,source:p[1],isTypeOnly:!1,group:xt(p[1]),specifiers:[]};return null}let[,,u,l,c]=i,g=!!u,m,h,f=[],n=l.trim(),a=n.match(/^\*\s+as\s+(\w+)$/);if(a)h=a[1];else if(n.includes("{")){let p=n.match(/^(\w+)\s*,/);if(p)m=p[1];let d=n.match(/\{([^}]+)\}/);if(d){let I=d[1].split(",").map((y)=>y.trim()).filter(Boolean);f.push(...I)}}else if(/^\w+$/.test(n))m=n;else{let p=n.match(/\{([^}]+)\}/);if(p){let d=p[1].split(",").map((I)=>I.trim()).filter(Boolean);f.push(...d)}}return{statement:e,source:c,isTypeOnly:g,group:xt(c,g),specifiers:f,defaultImport:m,namespaceImport:h}}function xt(e,i=!1){if(i)return"type";if(e.startsWith("node:")||O(e))return"builtin";if(e.startsWith("./"))return"sibling";if(e.startsWith("../"))return"parent";if(e==="."||e==="./index")return"index";if(e.startsWith("@/")||e.startsWith("~/")||e.startsWith("#"))return"internal";if(e.startsWith("@")||/^[a-z]/.test(e))return"external";return"unknown"}var b=new Set(["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","tty","url","util","v8","vm","wasi","worker_threads","zlib"]);function O(e){return b.has(e)}function an(e,i={}){let{order:u=[],groupByType:l=!0,groups:c=sn,alphabetize:g=!0,caseInsensitive:m=!0,typeImportsLast:h=!1,separateTypeImports:f=!1}=i,n=[];for(let t of e){let r=on(t);if(r)n.push(r);else n.push({statement:t,source:"",isTypeOnly:!1,group:"unknown",specifiers:[]})}let a=u.length>0?u.map((t)=>{if(t.startsWith("^"))try{return{regex:new RegExp(t),prefix:t.slice(1)}}catch{return{prefix:t.slice(1)}}return{prefix:t}}):[],p=(t)=>{for(let r=0;r<a.length;r++){let s=a[r];if(s.regex){if(s.regex.test(t))return r}else if(t.startsWith(s.prefix)||t.includes(`/${s.prefix}`))return r}return a.length},d=new Map,I=(t)=>{let r=d.get(t);if(r!==void 0)return r;let s=c.indexOf(t),o=s>=0?s:c.length;return d.set(t,o),o},y=(t,r)=>{if(a.length>0){let s=p(t.source),o=p(r.source);if(s!==o)return s-o}if(l){let s=I(t.group),o=I(r.group);if(s!==o)return s-o}if(h&&t.isTypeOnly!==r.isTypeOnly)return t.isTypeOnly?1:-1;if(g){let s=m?t.source.toLowerCase():t.source,o=m?r.source.toLowerCase():r.source;return s.localeCompare(o)}return 0};if(n.sort(y),l){let t=[],r=null;for(let s of n){if(r!==null&&s.group!==r){let o=c.indexOf(r),x=c.indexOf(s.group);if(o>=0&&x>=0&&o!==x)t.push("")}t.push(s.statement),r=s.group}return t}return n.map((t)=>t.statement)}function Fr(e,i={}){let u=e.split(`
3
- `),l=[],c=[],g=-1;for(let n=0;n<u.length;n++){let a=u[n].trim();if(a.startsWith("import "))l.push(u[n]),c.push(n),g=n;else if(l.length>0&&a==="")continue;else if(l.length>0&&!a.startsWith("import "))break}if(l.length===0)return e;let m=an(l,i),h=u.slice(0,c[0]),f=u.slice(g+1);while(f.length>0&&f[0].trim()==="")f.shift();return[...h,...m,"",...f].join(`
4
- `)}function Bs(e={}){return{sort:(i)=>an(i,e),sortContent:(i)=>Fr(i,e),parse:on,detectGroup:xt}}var Ws={default:{groupByType:!0,groups:sn,alphabetize:!0,caseInsensitive:!0},node:{order:["node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},bun:{order:["bun","node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},typeSeparated:{groupByType:!0,groups:["builtin","external","internal","parent","sibling","index","type"],separateTypeImports:!0,alphabetize:!0},alphabetical:{groupByType:!1,alphabetize:!0,caseInsensitive:!0},none:{groupByType:!1,alphabetize:!1}};
5
- export{sn,on,xt,an,Fr,Bs,Ws};
2
+ var nn=["builtin","external","internal","parent","sibling","index","type","unknown"];function rn(e){let i=e.match(/^(import\s+)(type\s+)?(.+?)\s+from\s+['"]([^'"]+)['"]/);if(!i){let p=e.match(/^import\s+['"]([^'"]+)['"]/);if(p)return{statement:e,source:p[1],isTypeOnly:!1,group:gt(p[1]),specifiers:[]};return null}let[,,u,l,c]=i,g=!!u,m,h,f=[],n=l.trim(),a=n.match(/^\*\s+as\s+(\w+)$/);if(a)h=a[1];else if(n.includes("{")){let p=n.match(/^(\w+)\s*,/);if(p)m=p[1];let d=n.match(/\{([^}]+)\}/);if(d){let I=d[1].split(",").map((y)=>y.trim()).filter(Boolean);f.push(...I)}}else if(/^\w+$/.test(n))m=n;else{let p=n.match(/\{([^}]+)\}/);if(p){let d=p[1].split(",").map((I)=>I.trim()).filter(Boolean);f.push(...d)}}return{statement:e,source:c,isTypeOnly:g,group:gt(c,g),specifiers:f,defaultImport:m,namespaceImport:h}}function gt(e,i=!1){if(i)return"type";if(e.startsWith("node:")||O(e))return"builtin";if(e.startsWith("./"))return"sibling";if(e.startsWith("../"))return"parent";if(e==="."||e==="./index")return"index";if(e.startsWith("@/")||e.startsWith("~/")||e.startsWith("#"))return"internal";if(e.startsWith("@")||/^[a-z]/.test(e))return"external";return"unknown"}var b=new Set(["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","tty","url","util","v8","vm","wasi","worker_threads","zlib"]);function O(e){return b.has(e)}function sn(e,i={}){let{order:u=[],groupByType:l=!0,groups:c=nn,alphabetize:g=!0,caseInsensitive:m=!0,typeImportsLast:h=!1,separateTypeImports:f=!1}=i,n=[];for(let t of e){let r=rn(t);if(r)n.push(r);else n.push({statement:t,source:"",isTypeOnly:!1,group:"unknown",specifiers:[]})}let a=u.length>0?u.map((t)=>{if(t.startsWith("^"))try{return{regex:new RegExp(t),prefix:t.slice(1)}}catch{return{prefix:t.slice(1)}}return{prefix:t}}):[],p=(t)=>{for(let r=0;r<a.length;r++){let s=a[r];if(s.regex){if(s.regex.test(t))return r}else if(t.startsWith(s.prefix)||t.includes(`/${s.prefix}`))return r}return a.length},d=new Map,I=(t)=>{let r=d.get(t);if(r!==void 0)return r;let s=c.indexOf(t),o=s>=0?s:c.length;return d.set(t,o),o},y=(t,r)=>{if(a.length>0){let s=p(t.source),o=p(r.source);if(s!==o)return s-o}if(l){let s=I(t.group),o=I(r.group);if(s!==o)return s-o}if(h&&t.isTypeOnly!==r.isTypeOnly)return t.isTypeOnly?1:-1;if(g){let s=m?t.source.toLowerCase():t.source,o=m?r.source.toLowerCase():r.source;return s.localeCompare(o)}return 0};if(n.sort(y),l){let t=[],r=null;for(let s of n){if(r!==null&&s.group!==r){let o=c.indexOf(r),x=c.indexOf(s.group);if(o>=0&&x>=0&&o!==x)t.push("")}t.push(s.statement),r=s.group}return t}return n.map((t)=>t.statement)}function Sr(e,i={}){let u=e.split(`
3
+ `),l=[],c=[],g=-1;for(let n=0;n<u.length;n++){let a=u[n].trim();if(a.startsWith("import "))l.push(u[n]),c.push(n),g=n;else if(l.length>0&&a==="")continue;else if(l.length>0&&!a.startsWith("import "))break}if(l.length===0)return e;let m=sn(l,i),h=u.slice(0,c[0]),f=u.slice(g+1);while(f.length>0&&f[0].trim()==="")f.shift();return[...h,...m,"",...f].join(`
4
+ `)}function os(e={}){return{sort:(i)=>sn(i,e),sortContent:(i)=>Sr(i,e),parse:rn,detectGroup:gt}}var as={default:{groupByType:!0,groups:nn,alphabetize:!0,caseInsensitive:!0},node:{order:["node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},bun:{order:["bun","node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},typeSeparated:{groupByType:!0,groups:["builtin","external","internal","parent","sibling","index","type"],separateTypeImports:!0,alphabetize:!0},alphabetical:{groupByType:!1,alphabetize:!0,caseInsensitive:!0},none:{groupByType:!1,alphabetize:!1}};
5
+ export{nn,rn,gt,sn,Sr,os,as};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{e,M}from"./chunk-8vvryt8p.js";import{Ie}from"./chunk-g9emajpc.js";import{s}from"./chunk-5tn8854w.js";import{existsSync as u,readFileSync as w}from"fs";import{dirname as W,join as d,resolve as v}from"path";async function ti(i){let c=[],n=new Set;async function t(a,f){let o=v(a);if(n.has(o))return;if(n.add(o),!u(o)){e.warn(`tsconfig not found: ${o}`);return}try{let p=w(o,"utf-8"),r=JSON.parse(Ie(p)),l=W(o),g=P(l,f),m=[];if(r.references)for(let y of r.references){let h=v(l,y.path),C=u(d(h,"tsconfig.json"))?d(h,"tsconfig.json"):h;await t(C,g);let G=P(W(C),g);m.push(G)}let j="./src";if(r.compilerOptions?.rootDir)j=r.compilerOptions.rootDir;else if(r.include&&r.include.length>0){if(r.include[0].startsWith("src/"))j="./src"}let k="./dist";if(r.compilerOptions?.outDir)k=r.compilerOptions.outDir;else if(r.compilerOptions?.declarationDir)k=r.compilerOptions.declarationDir;c.push({name:g,root:l,tsconfigPath:o,references:m,config:{root:j,outdir:k}})}catch(p){let r=p instanceof Error?p.message:String(p);e.warn(`Failed to parse ${o}: ${r}`)}}return await t(i),c}function P(i,c){let n=d(i,"package.json");if(u(n))try{let a=w(n,"utf-8"),f=JSON.parse(a);if(f.name)return f.name}catch{}let t=i.split("/").pop()||"unknown";return c?`${c}/${t}`:t}function ni(i){let c=new Map(i.map((o)=>[o.name,o])),n=[],t=new Set,a=new Set;function f(o){if(t.has(o))return;if(a.has(o)){e.warn(`Circular dependency detected involving: ${o}`);return}a.add(o);let p=c.get(o);if(p){for(let r of p.references)f(r);n.push(p)}a.delete(o),t.add(o)}for(let o of i)f(o.name);return n}async function bn(i){let c=Date.now(),n=ni(i.projects);e.info(`Generating declarations for ${n.length} projects...`);let t=[],a=!0;for(let r of n){e.info(`
2
+ import{e,j}from"./chunk-ss3na6s0.js";import{Ne}from"./chunk-xvp60m78.js";import{s}from"./chunk-6m4fpfzj.js";import{existsSync as u,readFileSync as y}from"fs";import{dirname as v,join as d,resolve as G}from"path";async function Gr(i){let c=[],n=new Set;async function t(a,f){let o=G(a);if(n.has(o))return;if(n.add(o),!u(o)){e.warn(`tsconfig not found: ${o}`);return}try{let p=y(o,"utf-8"),r=JSON.parse(Ne(p)),l=v(o),g=w(l,f),m=[];if(r.references)for(let C of r.references){let P=G(l,C.path),W=u(d(P,"tsconfig.json"))?d(P,"tsconfig.json"):P;await t(W,g);let D=w(v(W),g);m.push(D)}let k="./src";if(r.compilerOptions?.rootDir)k=r.compilerOptions.rootDir;else if(r.include&&r.include.length>0){if(r.include[0].startsWith("src/"))k="./src"}let h="./dist";if(r.compilerOptions?.outDir)h=r.compilerOptions.outDir;else if(r.compilerOptions?.declarationDir)h=r.compilerOptions.declarationDir;c.push({name:g,root:l,tsconfigPath:o,references:m,config:{root:k,outdir:h}})}catch(p){let r=p instanceof Error?p.message:String(p);e.warn(`Failed to parse ${o}: ${r}`)}}return await t(i),c}function w(i,c){let n=d(i,"package.json");if(u(n))try{let a=y(n,"utf-8"),f=JSON.parse(a);if(f.name)return f.name}catch{}let t=i.split("/").pop()||"unknown";return c?`${c}/${t}`:t}function Vr(i){let c=new Map(i.map((o)=>[o.name,o])),n=[],t=new Set,a=new Set;function f(o){if(t.has(o))return;if(a.has(o)){e.warn(`Circular dependency detected involving: ${o}`);return}a.add(o);let p=c.get(o);if(p){for(let r of p.references)f(r);n.push(p)}a.delete(o),t.add(o)}for(let o of i)f(o.name);return n}async function fn(i){let c=Date.now(),n=Vr(i.projects);e.info(`Generating declarations for ${n.length} projects...`);let t=[],a=!0;for(let r of n){e.info(`
3
3
  [${r.name}] Generating...`);try{let l={...i.sharedConfig,...r.config,cwd:r.root,tsconfigPath:r.tsconfigPath},g=await s(l),m=g.filesFailed===0;if(!m)a=!1;t.push({name:r.name,stats:g,success:m}),e.info(`[${r.name}] Generated ${g.filesGenerated} files`)}catch(l){a=!1;let g=l instanceof Error?l.message:String(l);t.push({name:r.name,stats:{generationMode:r.config?.isolatedDeclarations||i.sharedConfig?.isolatedDeclarations?"isolated":"semantic",filesProcessed:0,filesGenerated:0,filesFailed:0,filesValidated:0,validationErrors:0,declarationsFound:0,importsProcessed:0,exportsProcessed:0,durationMs:0,errors:[]},success:!1,error:g}),e.error(`[${r.name}] Failed: ${g}`)}}let f=Date.now()-c,o=t.filter((r)=>r.success).length,p=t.length-o;if(e.info(`
4
4
  --- Workspace Generation Summary ---`),e.info(`Projects processed: ${t.length}`),e.info(`Successful: ${o}`),p>0)e.info(`Failed: ${p}`);return e.info(`Total duration: ${f}ms`),e.info(`------------------------------------
5
- `),{success:a,projects:t,durationMs:f}}async function uo(i,c){if(c?.logLevel)M(c.logLevel);let n=d(i,"tsconfig.json");if(!u(n))throw Error(`Root tsconfig.json not found at: ${n}`);e.info("Discovering workspace projects...");let t=await ti(n);if(t.length===0)return e.warn("No projects found in workspace"),{success:!0,projects:[],durationMs:0};return e.info(`Found ${t.length} projects`),bn({root:i,projects:t,sharedConfig:c})}async function ri(i){let c=d(i,"package.json");if(!u(c))return[];try{let n=w(c,"utf-8"),t=JSON.parse(n),a=[];if(Array.isArray(t.workspaces))a=t.workspaces;else if(t.workspaces?.packages)a=t.workspaces.packages;return a}catch{return[]}}async function ii(i,c){let{Glob:n}=await Promise.resolve(globalThis.Bun),t=[];for(let a of c){let f=new n(a);for await(let o of f.scan({cwd:i,absolute:!0,onlyFiles:!1})){let p=d(o,"package.json");if(u(p))t.push(o)}}return t}async function fo(i,c){if(c?.logLevel)M(c.logLevel);let n=await ri(i);if(n.length===0)return e.warn("No workspace patterns found in package.json"),{success:!0,projects:[],durationMs:0};e.info(`Found workspace patterns: ${n.join(", ")}`);let t=await ii(i,n);if(t.length===0)return e.warn("No projects found matching workspace patterns"),{success:!0,projects:[],durationMs:0};e.info(`Found ${t.length} workspace packages`);let a=t.map((f)=>{let o=d(f,"tsconfig.json");return{name:P(f),root:f,tsconfigPath:u(o)?o:"",references:[]}});return bn({root:i,projects:a,sharedConfig:c})}
6
- export{ti,ni,bn,uo,ri,ii,fo};
5
+ `),{success:a,projects:t,durationMs:f}}async function Ms(i,c){if(c?.logLevel)j(c.logLevel);let n=d(i,"tsconfig.json");if(!u(n))throw Error(`Root tsconfig.json not found at: ${n}`);e.info("Discovering workspace projects...");let t=await Gr(n);if(t.length===0)return e.warn("No projects found in workspace"),{success:!0,projects:[],durationMs:0};return e.info(`Found ${t.length} projects`),fn({root:i,projects:t,sharedConfig:c})}async function zr(i){let c=d(i,"package.json");if(!u(c))return[];try{let n=y(c,"utf-8"),t=JSON.parse(n),a=[];if(Array.isArray(t.workspaces))a=t.workspaces;else if(t.workspaces?.packages)a=t.workspaces.packages;return a}catch{return[]}}async function Ur(i,c){let{Glob:n}=await Promise.resolve(globalThis.Bun),t=[];for(let a of c){let f=new n(a);for await(let o of f.scan({cwd:i,absolute:!0,onlyFiles:!1})){let p=d(o,"package.json");if(u(p))t.push(o)}}return t}async function Os(i,c){if(c?.logLevel)j(c.logLevel);let n=await zr(i);if(n.length===0)return e.warn("No workspace patterns found in package.json"),{success:!0,projects:[],durationMs:0};e.info(`Found workspace patterns: ${n.join(", ")}`);let t=await Ur(i,n);if(t.length===0)return e.warn("No projects found matching workspace patterns"),{success:!0,projects:[],durationMs:0};e.info(`Found ${t.length} workspace packages`);let a=t.map((f)=>{let o=d(f,"tsconfig.json");return{name:w(f),root:f,tsconfigPath:u(o)?o:"",references:[]}});return fn({root:i,projects:a,sharedConfig:c})}
6
+ export{Gr,Vr,fn,Ms,zr,Ur,Os};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{m}from"./chunk-r7qq9579.js";import{h,S}from"./chunk-jb43rwce.js";function _(b){let f=m(b),e=0,v,I,g,D=[new Map,new Map],n=(t=e)=>f[t]?b.slice(f[t].start,f[t].end):"",d=(t=e)=>f[t]?.kind==="word",y=(t,u)=>/[\r\n]/.test(b.slice(t,u));function r(t){if(n()!==t)return!1;return e++,!0}function k(t){let u=e;for(let a of t)if(!r(a)||e>u+1&&f[e-2].end!==f[e-1].start)return e=u,!1;return!0}function w(t){let u=e;if(t())return!0;return e=u,!1}function o(){if(!d())return!1;return e++,!0}function T(){let t=e,u=e;while(u<f.length&&(u===t||f[u-1].end===f[u].start)){let i=n(u),l=(i==="+"||i==="-")&&/[eE]$/.test(n(u-1));if(!d(u)&&!/^[0-9.]$/.test(i)&&!l)break;u++}if(u===t)return!1;let a=b.slice(f[t].start,f[u-1].end);if(!h(a)&&!S(a))return!1;return e=u,!0}function A(){if(!["(","[","{"].includes(n()))return!1;if(!v){v=new Map;let u=[];for(let a=0;a<f.length;a++){let i=n(a);if(["(","[","{"].includes(i))u.push(a);else if([")","]","}"].includes(i)){let l=u.pop();if(l!==void 0&&["()","[]","{}"].includes(n(l)+i))v.set(l,a+1);else u.length=0}}}let t=v.get(e);if(t===void 0)return!1;return e=t,!0}function F(){return o()||(n()==="{"||n()==="[")&&A()}function N(){if(!r("("))return!1;if(r(")"))return!0;do{if(k("..."),!F())return!1;if(r("?"),r(":")&&!s())return!1;if(n()===")")break}while(r(",")&&n()!==")");return r(")")}function x(){if(!r("<"))return!1;if(n()===">")return!1;do{if(n()==="const")e++;while((n()==="in"||n()==="out")&&d(e+1)&&n(e+1)!=="extends")e++;if(!o())return!1;if(r("extends")&&!s(!1))return!1;if(r("=")&&!s())return!1;if(n()===">")break}while(r(",")&&n()!==">");return r(">")}function O(){if(!r("<")||n()===">")return!1;do{if(!s())return!1;if(n()===">")break}while(r(",")&&n()!==">");return r(">")}function G(){if(r("abstract"),r("new"),n()==="<"&&!x())return!1;return N()&&k("=>")&&q()}function H(){if(f[e]?.kind!=="literal"||b.charCodeAt(f[e].start)!==96)return!1;for(;;){let t=f[e++];if(!t)return!1;if(b.charCodeAt(t.end-1)===96)return!0;if(b.charCodeAt(t.end-1)!==36||!r("{")||!s()||!r("}"))return!1;if(f[e]?.kind!=="literal")return!1}}function J(){if(!r("["))return!1;if(r("]"))return!0;do{k("...");let t=e;if(d()||f[e]?.kind==="quoted"){if(e++,r("?"),!r(":"))e=t}if(!s())return!1;if(r("?"),n()==="]")break}while(r(",")&&n()!=="]");return r("]")}function q(){if(r("asserts")){if(!o())return!1;return!r("is")||s()}if(d()&&n(e+1)==="is")return e+=2,s();return s()}function B(){if(n()==="<"&&!x())return!1;if(!N())return!1;return!r(":")||q()}function K(){if(!r("["))return!1;if(d()&&(n(e+1)==="in"||n(e+1)===":")){e++;let t=r("in");if(!t&&!r(":"))return!1;if(!s())return!1;if(t&&r("as")&&!s())return!1}else{if(!o()&&!T()){if(f[e]?.kind!=="quoted")return!1;e++}while(r("."))if(!o())return!1}return r("]")}function L(){if(n()==="[")return K();if(o()||T())return!0;if(f[e]?.kind!=="quoted")return!1;return e++,!0}function Q(){if(n()!=="get"&&n()!=="set")return;let t=e++;e=L()&&n()==="("?t+1:t}function P(){if(!r("{"))return!1;while(!r("}")){if(e>=f.length)return!1;let t=e;if((n()==="+"||n()==="-")&&n(e+1)==="readonly")e++;if(n()==="readonly"&&n(e+1)!==":"&&n(e+1)!=="?"&&n(e+1)!=="("&&n(e+1)!==";"&&n(e+1)!=="}")e++;if(n()==="new"&&(n(e+1)==="("||n(e+1)==="<"))e++;if(n()==="("||n()==="<"){if(!B())return!1}else{if(Q(),!L())return!1;if(n()==="+"||n()==="-"){if(e++,!r("?"))return!1}else r("?");if(r(":")){if(!s())return!1}else if(n()==="("||n()==="<"){if(!B())return!1}}if(e===t)return!1;if(r(";")||r(","))continue;if(n()!=="}"&&!y(f[e-1].end,f[e]?.start??b.length))return!1}return!0}function R(){if(w(G))return!0;if(r("("))return s()&&r(")");if(n()==="{")return P();if(n()==="[")return J();if(w(H))return!0;if(f[e]?.kind==="quoted")return e++,!0;if(r("-"))return T();if(w(T))return!0;if(r("typeof")){if(n()==="import")return R();if(!o())return!1;while(r("."))if(!o())return!1;if(n()==="<"&&!O())return!1;return!0}if(r("import")){if(!r("(")||!s())return!1;if(r(",")&&!P())return!1;return r(")")}if(["export","function","class","const","let","var","return","throw","default","new","abstract"].includes(n()))return!1;return o()}function E(){if(n()==="keyof"||n()==="readonly"||n()==="unique")return e++,E();if(r("infer")){if(!o())return!1;if(r("extends")&&!s(!1))return!1;return!0}if(!R())return!1;for(;;)if(r(".")){if(!o())return!1}else if(n()==="<"){if(y(f[e-1].end,f[e].start))return!0;if(!O())return!1}else if(n()==="["){if(y(f[e-1].end,f[e].start))return!0;if(e++,!r("]")&&!(s()&&r("]")))return!1}else return!0}function j(){if(r("&"),!E())return!1;while(r("&"))if(!E())return!1;return!0}function s(t=!0){let u=e,a=D[t?1:0],i=a.get(u);if(i!==void 0){if(i<0)return!1;return e=i,!0}let l=U(t);if(a.set(u,l?e:-1),!l)e=u;return l}function U(t){if(r("|"),!j())return!1;while(r("|"))if(!j())return!1;if(t&&n()==="extends"&&!y(f[e-1].end,f[e].start))return e++,s(!1)&&r("?")&&s()&&r(":")&&s();return!0}function V(){if(n()!=="("||!A())return!1;if(r(":")&&!q())return!1;return k("=>")}function W(){r("async");let t=r("function");if(t){if(r("*"),d())e++}if(n()==="<"&&!x())return!1;if(n()!=="("||!A())return!1;if(r(":")&&!q())return!1;return t?n()==="{":k("=>")}function X(){let t=n();if(t==="<"||t===">"||t==="+"||t==="-")return!1;if(t==="("||f[e]?.kind==="literal"&&b.charCodeAt(f[e].start)===96)return!0;if(!f[e]||y(f[e-1].end,f[e].start))return!0;if(["*","/","%","=","&","|","^","?",":",",",";",")","]","}","in","instanceof","as","satisfies"].includes(t))return!0;if(t==="!")return n(e+1)==="="&&f[e].end===f[e+1]?.start;return!d()&&f[e]?.kind!=="quoted"&&f[e]?.kind!=="literal"&&!["{","[","~","#","@"].includes(t)&&!/^[0-9]$/.test(t)}return(t,u,a)=>{let i=0,l=f.length;while(i<l){let p=i+l>>>1;if(f[p].start<t)i=p+1;else l=p}if(f[i]?.start!==t)return;if(I!==u){I=u,g=void 0;let p=0,M=i;while(p<M){let C=p+M>>>1;if(f[C].start<u)p=C+1;else M=C}if(e=p,W())g=n()==="{"?f[e].start:f[e-1].end}if(g!==void 0&&t<g)return{end:g,completeOperand:!1,parameters:!0};if(n(i)!=="<")return;e=i;let c=n(i-1),z=t===u||["=","+","-","*","/","%","&","|","^","!","~","?",":","<",">","void","typeof","await","yield","delete"].includes(c);if((c==="function"||c==="class"||c==="*"&&n(i-2)==="function"||d(i-1)&&(n(i-2)==="function"||n(i-2)==="class"||n(i-2)==="*"&&n(i-3)==="function"))&&w(x))return{end:f[e-1].end,completeOperand:!1,parameters:!0};if(e=i,(z||c==="async")&&w(x)){let p=f[e-1].end;if(w(V))return{end:p,completeOperand:!1,parameters:!0}}e=i;let Y=c==="."&&n(i-2)==="?"&&f[i-2].end===f[i-1].start;if((f[i-1]?.end??-1)>=u&&(Y||d(i-1)||c===")"||c==="]"||c==="!"||c===">"&&f[i-1].end===a)&&w(O)&&X())return{end:f[e-1].end,completeOperand:!0};if(e=i,z&&r("<")&&s()&&r(">"))return{end:f[e-1].end,completeOperand:!1};return}}
3
+ export{_};
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import{t,m}from"./chunk-t5nmnzy6.js";import{n}from"./chunk-7rdazac9.js";function Hn(p,k,b,h){let r=new Map,i=new Map;for(let e of[...k,...b.values(),...[...h.values()].flat()])if(r.set(e.name,e),e.kind==="function"&&!i.has(e.name))i.set(e.name,e);for(let[e,o]of h)if(o.length)i.set(e,o[0]);if(!i.size)return;let u=new Set;for(let[e,o]of h)if(o.length>1)u.add(e);let a=new Map;for(let e of k)if(e.kind==="function"){let o=(a.get(e.name)??0)+1;if(a.set(e.name,o),o>1)u.add(e.name)}let s=m(p),d=(e)=>s[e]?p.slice(s[e].start,s[e].end):"",g=new Map,x=0;for(let e=0;e<s.length;e++){let o=s[e];if(o.kind==="punctuation"){let l=p.charCodeAt(o.start);if(l===40||l===91||l===123)x++;else if(l===41||l===93||l===125)x--;continue}if(x||s[e+2]?.kind!=="word"||d(e+1)!=="."||d(e+3)!=="=")continue;let c=d(e);if(!i.has(c))continue;let M=d(e+2),w=e+4,f=w,y=0;for(;f<s.length;f++){let l=d(f);if(!y&&l===";")break;if(!y&&f>w&&/[\r\n]/.test(p.slice(s[f-1].end,s[f].start))&&(["export","const","let","var","function","class"].includes(l)||i.has(l)&&d(f+1)==="."))break;if(["(","[","{"].includes(l))y++;else if([")","]","}"].includes(l))y--}if(f===w)continue;let D=R(p.slice(s[w].start,s[f-1].end),r,u),v=g.get(c);if(!v)g.set(c,v=new Map);let A=v.get(M);if(!A)v.set(M,A=[]);if(!A.includes(D))A.push(D);e=f-1}for(let[e,o]of g){let c=i.get(e),M=[...o].map(([f,y])=>` let ${f}: ${y.map((D)=>D.includes("=>")&&y.length>1?`(${D})`:D).join(" | ")};`).join(`
2
+ import{t,m}from"./chunk-r7qq9579.js";import{n}from"./chunk-ywzc3ym6.js";function qn(p,k,b,h){let r=new Map,i=new Map;for(let e of[...k,...b.values(),...[...h.values()].flat()])if(r.set(e.name,e),e.kind==="function"&&!i.has(e.name))i.set(e.name,e);for(let[e,o]of h)if(o.length)i.set(e,o[0]);if(!i.size)return;let u=new Set;for(let[e,o]of h)if(o.length>1)u.add(e);let a=new Map;for(let e of k)if(e.kind==="function"){let o=(a.get(e.name)??0)+1;if(a.set(e.name,o),o>1)u.add(e.name)}let s=m(p),d=(e)=>s[e]?p.slice(s[e].start,s[e].end):"",g=new Map,x=0;for(let e=0;e<s.length;e++){let o=s[e];if(o.kind==="punctuation"){let l=p.charCodeAt(o.start);if(l===40||l===91||l===123)x++;else if(l===41||l===93||l===125)x--;continue}if(x||s[e+2]?.kind!=="word"||d(e+1)!=="."||d(e+3)!=="=")continue;let c=d(e);if(!i.has(c))continue;let M=d(e+2),w=e+4,f=w,y=0;for(;f<s.length;f++){let l=d(f);if(!y&&l===";")break;if(!y&&f>w&&/[\r\n]/.test(p.slice(s[f-1].end,s[f].start))&&(["export","const","let","var","function","class"].includes(l)||i.has(l)&&d(f+1)==="."))break;if(["(","[","{"].includes(l))y++;else if([")","]","}"].includes(l))y--}if(f===w)continue;let D=R(p.slice(s[w].start,s[f-1].end),r,u),v=g.get(c);if(!v)g.set(c,v=new Map);let A=v.get(M);if(!A)v.set(M,A=[]);if(!A.includes(D))A.push(D);e=f-1}for(let[e,o]of g){let c=i.get(e),M=[...o].map(([f,y])=>` let ${f}: ${y.map((D)=>D.includes("=>")&&y.length>1?`(${D})`:D).join(" | ")};`).join(`
3
3
  `),w=c.isExported&&!c.isDefault?"export ":"";if(c.isDefault)c.text=c.text.replace("export default function ","declare function ");if(c.text+=`
4
4
  ${w}declare namespace ${e} {
5
5
  ${M}
6
6
  }`,c.isDefault)c.text+=`
7
7
  export default ${e};`}}function R(p,k,b,h=0){let r=p.trim(),i=k.get(r);if(i?.kind==="variable"&&h<64){if(i.typeAnnotation)return i.typeAnnotation==="unique symbol"?`typeof ${r}`:i.typeAnnotation;if(typeof i.value==="string")return R(i.value,k,b,h+1)}let u=n(r,!1);if(u!=="unknown")return u;let a=t(r);if(a[0]?.kind==="word"&&a[1]&&r.slice(a[1].start,a[1].end)==="("&&r.endsWith(")")){let s=0,d=-1;for(let e=1;e<a.length;e++){let o=r.slice(a[e].start,a[e].end);if(o==="(")s++;else if(o===")"&&--s===0){d=e;break}}if(d!==a.length-1)return u;let g=r.slice(a[0].start,a[0].end),x=k.get(g);if(x?.kind==="function"&&!x.generics&&!b.has(g))return`ReturnType<typeof ${g}>`}if(/^[$A-Z_a-z][$\w]*(?:\.[$A-Z_a-z][$\w]*)*$/.test(r))return`typeof ${r}`;return u}
8
- export{Hn};
8
+ export{qn};
@@ -1,27 +1,27 @@
1
1
  // @bun
2
- import{t,d}from"./chunk-t5nmnzy6.js";import{z}from"./chunk-4cr1q0yf.js";import{jt}from"./chunk-wq5r1ms9.js";import{v}from"./chunk-9mdgtq38.js";import{ae}from"./chunk-1t77gtcx.js";import{relative as O}from"path";function J(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 Io(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-r7qq9579.js";import{U}from"./chunk-ynpxjf6d.js";import{jt}from"./chunk-jhjj15ey.js";import{v}from"./chunk-s28gyv8z.js";import{ce}from"./chunk-qhsgmwcm.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 ma(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(`
6
- `,k);k=c===-1?n.length:c;continue}if(n.startsWith("/*",k)){let c=n.indexOf("*/",k+2);if(c===-1)return!0;k=c+2;continue}return!1}return!0}function X(n){let k=[];for(let c of n.split(",")){let i=c.replace(/\/\*[\s\S]*?\*\//g,"").trim().replace(/^type\s+/,"");if(!i)continue;let f=i.match(/^([\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!f)continue;k.push({local:f[1],exported:f[2]??f[1]})}return k}var se=/^(?:export\s+)?(default\s+)?(?:declare\s+)?(abstract\s+)?(class|interface|type|function\s*\*?|enum|const\s+enum|namespace|module|const|let|var|async\s+function)\b\s*([\w$]+)?/;function ie(n,k){let c=n.replace(/^export\s+/,""),i=/^default\s+/.test(c);if(c=c.replace(/^default\s+/,""),i)c=c.replace(/^((?:declare\s+)?(?:abstract\s+)?(?:class|function\s*\*?|async\s+function\s*\*?))\s*(?=[(<{])/,(f,h)=>`${h.trimEnd()} ${k}`);if(/^(?:interface|type)\b/.test(c)||/^declare\b/.test(c))return c;return`declare ${c}`}function F(n,k,c=!1){let i={file:n,declarations:[],declared:new Set,imports:new Map,localExports:new Map,namedReExports:[],starReExports:[],namespaceReExports:[],verbatim:[],augmentations:[],directives:[]},f=c?jt(k,n).map((h)=>({text:h.text,comments:[...h.leadingComments??[]]})):Io(k);for(let h of f){h.comments=h.comments.filter((b)=>{if(/^\/\/\/\s*</.test(b))return i.directives.push(...b.split(`
7
- `).map((S)=>S.trim()).filter((S)=>S.startsWith("///"))),!1;return!0});let M=h.text.replace(/;\s*$/,"").trim(),l=M.startsWith("import")?v(M):null;if(l&&!l.isImportEquals){let b=l.source;if(l.defaultName)i.imports.set(l.defaultName,{specifier:b,imported:"default"});if(l.namespaceName)i.imports.set(l.namespaceName,{specifier:b,imported:"*"});for(let S of l.namedItems)i.imports.set(S.name,{specifier:b,imported:/^['"]/.test(S.originalName)?d(S.originalName):S.originalName});continue}if(/^import\s+['"]/.test(M)){i.verbatim.push(h);continue}let y=M.match(/^export\s+(?:type\s+)?\*\s+as\s+([\w$]+)\s+from\s+(['"])([^'"]+)\2/);if(y){i.namespaceReExports.push({specifier:y[3],exported:y[1]});continue}if(y=M.match(/^export\s+(?:type\s+)?\*\s+from\s+(['"])([^'"]+)\1/),y){i.starReExports.push(y[2]);continue}if(y=M.match(/^export\s+(?:type\s+)?\{([\s\S]*)\}\s+from\s+(['"])([^'"]+)\2/),y){for(let b of X(y[1]))i.namedReExports.push({specifier:y[3],imported:b.local,exported:b.exported});continue}if(y=M.match(/^export\s+(?:type\s+)?\{([\s\S]*)\}$/),y){for(let b of X(y[1]))i.localExports.set(b.exported,b.local);continue}if(y=M.match(/^export\s+default\s+([\w$]+)$/),y&&te.test(y[1])){i.localExports.set("default",y[1]);continue}let R=J(M);if(R?.specifier!==void 0&&z(k)){i.augmentations.push({statement:h,specifier:R.specifier,body:R.body});continue}if(/^export\s+as\s+namespace\b/.test(M)||R){i.verbatim.push(h);continue}let a=M.match(se);if(a){let b=!!a[1],S=a[4]??(b?"_default":null);if(S){if(i.declared.add(S),/^export\s/.test(M))i.localExports.set(b?"default":S,S);i.declarations.push({statement:h,name:S,emit:ie(h.text,S)});continue}}i.declarations.push({statement:h,name:null,emit:h.text})}return i}function nt(n,k){if(k.size===0)return n;let c=t(n),i=new Map(c.filter((m)=>m.kind==="literal").map((m)=>[m.start,m.end])),f=(m)=>c[m]?n.slice(c[m].start,c[m].end):"",h=new Map,M=[];for(let m=0;m<c.length;m++){let x=f(m);if(["(","[","{","<"].includes(x))M.push(m);else if([")","]","}",">"].includes(x)&&!(x===">"&&f(m-1)==="=")){let w=M.at(-1);if(w!==void 0&&["()","[]","{}","<>"].includes(f(w)+x))M.pop(),h.set(w,m)}}let l=(m)=>{for(let x=m;x<c.length;x++){if([";",",",")","]","}"].includes(f(x))||f(x)===">"&&f(x-1)!=="=")return x;let w=h.get(x);if(w!==void 0)x=w}return c.length},y=new Set;for(let m=0;m<c.length;m++){let x=h.get(m);if(f(m)!=="<"||x===void 0)continue;let w=["class","interface","type"].includes(f(m-2));if(!w&&f(x+1)!=="(")continue;let N=new Set;for(let u=m+1;u<x;u++){if(u===m+1||f(u-1)===","){while(["const","in","out"].includes(f(u)))u++;if(c[u]?.kind==="word")N.add(f(u))}let D=h.get(u);if(D!==void 0)u=D}let I=l(x+1);if(w&&f(m-2)!=="type")for(let u=x+1;u<c.length;u++){if(f(u)==="{"){I=h.get(u)??I;break}let D=h.get(u);if(D!==void 0)u=D}for(let u=m+1;u<I;u++){let D=f(m-2)==="class"&&u>x&&f(u-1)==="extends";if(N.has(f(u))&&f(u-1)!=="typeof"&&!D)y.add(c[u].start)}}for(let m=0;m<c.length;m++){if(!["namespace","module"].includes(f(m))||c[m+1]?.kind!=="word"||f(m+2)!=="{")continue;let x=h.get(m+2);if(x===void 0)continue;let w=jt(n.slice(c[m+2].end,c[x].start),"bundle-namespace.ts"),N=new Set(w.filter((u)=>["class","interface","type","enum","module","namespace"].includes(u.kind)).map((u)=>u.name)),I=new Set(w.filter((u)=>["class","variable","function","enum","module","namespace"].includes(u.kind)).map((u)=>u.name));for(let u=m+3;u<x;u++)if((f(u-1)==="typeof"?I:N).has(f(u)))y.add(c[u].start)}let R="",a=0,b=n.length,S=`
6
+ `,k);k=c===-1?n.length:c;continue}if(n.startsWith("/*",k)){let c=n.indexOf("*/",k+2);if(c===-1)return!0;k=c+2;continue}return!1}return!0}function X(n){let k=[];for(let c of n.split(",")){let i=c.replace(/\/\*[\s\S]*?\*\//g,"").trim().replace(/^type\s+/,"");if(!i)continue;let f=i.match(/^([\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!f)continue;k.push({local:f[1],exported:f[2]??f[1]})}return k}var se=/^(?:export\s+)?(default\s+)?(?:declare\s+)?(abstract\s+)?(class|interface|type|function\s*\*?|enum|const\s+enum|namespace|module|const|let|var|async\s+function)\b\s*([\w$]+)?/;function ie(n,k){let c=n.replace(/^export\s+/,""),i=/^default\s+/.test(c);if(c=c.replace(/^default\s+/,""),i)c=c.replace(/^((?:declare\s+)?(?:abstract\s+)?(?:class|function\s*\*?|async\s+function\s*\*?))\s*(?=[(<{])/,(f,h)=>`${h.trimEnd()} ${k}`);if(/^(?:interface|type)\b/.test(c)||/^declare\b/.test(c))return c;return`declare ${c}`}function q(n,k,c=!1){let i={file:n,declarations:[],declared:new Set,imports:new Map,localExports:new Map,namedReExports:[],starReExports:[],namespaceReExports:[],verbatim:[],augmentations:[],directives:[]},f=c?jt(k,n).map((h)=>({text:h.text,comments:[...h.leadingComments??[]]})):ma(k);for(let h of f){h.comments=h.comments.filter((b)=>{if(/^\/\/\/\s*</.test(b))return i.directives.push(...b.split(`
7
+ `).map((S)=>S.trim()).filter((S)=>S.startsWith("///"))),!1;return!0});let M=h.text.replace(/;\s*$/,"").trim(),l=M.startsWith("import")?v(M):null;if(l&&!l.isImportEquals){let b=l.source;if(l.defaultName)i.imports.set(l.defaultName,{specifier:b,imported:"default"});if(l.namespaceName)i.imports.set(l.namespaceName,{specifier:b,imported:"*"});for(let S of l.namedItems)i.imports.set(S.name,{specifier:b,imported:/^['"]/.test(S.originalName)?d(S.originalName):S.originalName});continue}if(/^import\s+['"]/.test(M)){i.verbatim.push(h);continue}let y=M.match(/^export\s+(?:type\s+)?\*\s+as\s+([\w$]+)\s+from\s+(['"])([^'"]+)\2/);if(y){i.namespaceReExports.push({specifier:y[3],exported:y[1]});continue}if(y=M.match(/^export\s+(?:type\s+)?\*\s+from\s+(['"])([^'"]+)\1/),y){i.starReExports.push(y[2]);continue}if(y=M.match(/^export\s+(?:type\s+)?\{([\s\S]*)\}\s+from\s+(['"])([^'"]+)\2/),y){for(let b of X(y[1]))i.namedReExports.push({specifier:y[3],imported:b.local,exported:b.exported});continue}if(y=M.match(/^export\s+(?:type\s+)?\{([\s\S]*)\}$/),y){for(let b of X(y[1]))i.localExports.set(b.exported,b.local);continue}if(y=M.match(/^export\s+default\s+([\w$]+)$/),y&&te.test(y[1])){i.localExports.set("default",y[1]);continue}let R=P(M);if(R?.specifier!==void 0&&U(k)){i.augmentations.push({statement:h,specifier:R.specifier,body:R.body});continue}if(/^export\s+as\s+namespace\b/.test(M)||R){i.verbatim.push(h);continue}let a=M.match(se);if(a){let b=!!a[1],S=a[4]??(b?"_default":null);if(S){if(i.declared.add(S),/^export\s/.test(M))i.localExports.set(b?"default":S,S);i.declarations.push({statement:h,name:S,emit:ie(h.text,S)});continue}}i.declarations.push({statement:h,name:null,emit:h.text})}return i}function lt(n,k){if(k.size===0)return n;let c=t(n),i=new Map(c.filter((m)=>m.kind==="literal").map((m)=>[m.start,m.end])),f=(m)=>c[m]?n.slice(c[m].start,c[m].end):"",h=new Map,M=[];for(let m=0;m<c.length;m++){let x=f(m);if(["(","[","{","<"].includes(x))M.push(m);else if([")","]","}",">"].includes(x)&&!(x===">"&&f(m-1)==="=")){let w=M.at(-1);if(w!==void 0&&["()","[]","{}","<>"].includes(f(w)+x))M.pop(),h.set(w,m)}}let l=(m)=>{for(let x=m;x<c.length;x++){if([";",",",")","]","}"].includes(f(x))||f(x)===">"&&f(x-1)!=="=")return x;let w=h.get(x);if(w!==void 0)x=w}return c.length},y=new Set;for(let m=0;m<c.length;m++){let x=h.get(m);if(f(m)!=="<"||x===void 0)continue;let w=["class","interface","type"].includes(f(m-2));if(!w&&f(x+1)!=="(")continue;let N=new Set;for(let u=m+1;u<x;u++){if(u===m+1||f(u-1)===","){while(["const","in","out"].includes(f(u)))u++;if(c[u]?.kind==="word")N.add(f(u))}let D=h.get(u);if(D!==void 0)u=D}let I=l(x+1);if(w&&f(m-2)!=="type")for(let u=x+1;u<c.length;u++){if(f(u)==="{"){I=h.get(u)??I;break}let D=h.get(u);if(D!==void 0)u=D}for(let u=m+1;u<I;u++){let D=f(m-2)==="class"&&u>x&&f(u-1)==="extends";if(N.has(f(u))&&f(u-1)!=="typeof"&&!D)y.add(c[u].start)}}for(let m=0;m<c.length;m++){if(!["namespace","module"].includes(f(m))||c[m+1]?.kind!=="word"||f(m+2)!=="{")continue;let x=h.get(m+2);if(x===void 0)continue;let w=jt(n.slice(c[m+2].end,c[x].start),"bundle-namespace.ts"),N=new Set(w.filter((u)=>["class","interface","type","enum","module","namespace"].includes(u.kind)).map((u)=>u.name)),I=new Set(w.filter((u)=>["class","variable","function","enum","module","namespace"].includes(u.kind)).map((u)=>u.name));for(let u=m+3;u<x;u++)if((f(u-1)==="typeof"?I:N).has(f(u)))y.add(c[u].start)}let R="",a=0,b=n.length,S=`
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 Rn(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,F(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 F(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 Q=new Map,H=[],T=(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=Q.get(e);if(o)return o;let g=a(s);Q.set(e,g);let r=[];for(let[p,E]of L(e)){if(p==="default")continue;let B=T(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 H.push(`declare namespace ${g} {
11
+ `||!/\s/.test(x))S=x;a++}return R}function zn(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=ce(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
- }`),g}let U=[],A=[],Z=new Set;for(let[e,s]of h){for(let r of s.directives)Z.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=T(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=J(r.text);if(p){let E=new Map(o);for(let B of F(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=F(e,r.body,!0),B=new Map(o);if(!p){for(let P of E.declared)B.delete(P);let C=J(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,P]of L(p))B.set(C,T(P,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)U.push(`// From: ${O(i.cwd,e)}
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=lt(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)+lt(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(lt(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)+lt(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(lt(C.emit,B))}}if(g.length>0)Q.push(`// From: ${O(i.cwd,e)}
14
14
  ${g.join(`
15
- `)}`)}let V=L(n),G=[],q=[];for(let[e,s]of V){if(s.kind==="external"){q.push(`export { ${s.imported===e?e:`${s.imported} as ${e}`} } from '${s.source}';`);continue}if(s.kind==="external-namespace"){q.push(`export * as ${e} from '${s.source}';`);continue}let o=T(s,e==="default"?"_default":e);G.push(o===e?e:`${o} as ${e}`)}for(let e of w.get(n)??[])q.push(`export * from '${e}';`);let K=new Map;for(let[e,s]of S){let[o,g]=e.split("\x00"),r=K.get(o)??{named:[],defaults:[],namespaces:[]};if(K.set(o,r),g==="*")r.namespaces.push(s);else if(g==="default")r.defaults.push(s);else r.named.push(g===s?s:`${g} as ${s}`)}let W=[];for(let[e,s]of[...K].sort(([o],[g])=>o.localeCompare(g))){for(let o of s.defaults)W.push(`import ${o} from '${e}';`);for(let o of s.namespaces)W.push(`import * as ${o} from '${e}';`);if(s.named.length>0)W.push(`import { ${s.named.join(", ")} } from '${e}';`)}let j=[];if(Z.size>0)j.push([...Z].join(`
15
+ `)}`)}let V=L(n),Z=[],T=[];for(let[e,s]of V){if(s.kind==="external"){T.push(`export { ${s.imported===e?e:`${s.imported} as ${e}`} } from '${s.source}';`);continue}if(s.kind==="external-namespace"){T.push(`export * as ${e} from '${s.source}';`);continue}let o=z(s,e==="default"?"_default":e);Z.push(o===e?e:`${o} as ${e}`)}for(let e of w.get(n)??[])T.push(`export * from '${e}';`);let G=new Map;for(let[e,s]of S){let[o,g]=e.split("\x00"),r=G.get(o)??{named:[],defaults:[],namespaces:[]};if(G.set(o,r),g==="*")r.namespaces.push(s);else if(g==="default")r.defaults.push(s);else r.named.push(g===s?s:`${g} as ${s}`)}let W=[];for(let[e,s]of[...G].sort(([o],[g])=>o.localeCompare(g))){for(let o of s.defaults)W.push(`import ${o} from '${e}';`);for(let o of s.namespaces)W.push(`import * as ${o} from '${e}';`);if(s.named.length>0)W.push(`import { ${s.named.join(", ")} } from '${e}';`)}let j=[];if(H.size>0)j.push([...H].join(`
16
16
  `));if(j.push(`/**
17
17
  * Bundled TypeScript declarations
18
18
  * Generated from ${h.size} source files
19
19
  */`),W.length>0)j.push(W.join(`
20
- `));if(j.push(...U),H.length>0)j.push(H.join(`
20
+ `));if(j.push(...Q),F.length>0)j.push(F.join(`
21
21
  `));if(A.length>0)j.push(A.join(`
22
- `));let _=[];if(G.length>0)_.push(`export { ${G.join(", ")} };`);if(_.push(...q),_.length===0)_.push("export {};");return j.push(_.join(`
22
+ `));let _=[];if(Z.length>0)_.push(`export { ${Z.join(", ")} };`);if(_.push(...T),_.length===0)_.push("export {};");return j.push(_.join(`
23
23
  `)),{content:`${j.join(`
24
24
 
25
25
  `)}
26
26
  `,files:[...h.keys()],exportCount:V.size,warnings:f}}
27
- export{Io,nt,Rn};
27
+ export{ma,lt,zn};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
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};
3
+ `,n)+1,r=p(e,H,n);if(r!==-1){n=r-1;continue}return n}}function p(e,_,n){if(!e.slice(_,n+1).includes("//"))return-1;return R(e,n).lineCommentStart??-1}function b(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 m(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!=="."&&m(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||b(t))}C++}return{regexAllowed:c,closesControlHeader:!1}}function y(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(b(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 m(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 h=e.indexOf("*/",t+2);if(h===-1)return null;t=h+1;continue}if(y(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,y,g,xe,Ue};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-5tn8854w.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 La=mt;
3
- export{mt,La};
2
+ import{s}from"./chunk-6m4fpfzj.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 Aa=mt;
3
+ export{mt,Aa};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{D}from"./chunk-2qbj76ap.js";import{re}from"./chunk-20jq5v1p.js";import{ne,$e}from"./chunk-hj7gs32r.js";import{Fn}from"./chunk-djbck65n.js";import{spawn as j}from"child_process";var N=new Set(["cwd","root","outdir","entrypoints","include","exclude","autoIncludeReExports","outputStructure","tsconfigPath","moduleSpecifierMode","keepComments","isolatedDeclarations","clean","lineEnding"]);function x(l,f,d,n,u){let s=u.signal;s?.throwIfAborted();let c=u.timeoutMs??30000;if(!Number.isSafeInteger(c)||c<=0||c>2147483647)throw RangeError("Native project timeoutMs must be an integer between 1 and 2147483647");return new Promise((g,r)=>{let o=j(l,f,{cwd:n,stdio:["pipe","pipe","pipe"],windowsHide:!0}),i=[],a=[],e,h,v=!1,p=(t)=>{e??=t,o.kill()},m=()=>p(s?.reason instanceof Error?s.reason:Error("Native declaration project aborted",{cause:s?.reason})),b=setTimeout(()=>p(Error(`Native declaration project exceeded ${c}ms`)),c),E=(t,w)=>{if(v)return;if(v=!0,clearTimeout(b),s?.removeEventListener("abort",m),t)r(t);else g(w)};if(o.once("error",(t)=>E(t)),o.stdout.on("data",(t)=>i.push(Buffer.from(t))),o.stderr.on("data",(t)=>a.push(Buffer.from(t))),o.stdout.once("error",p),o.stderr.once("error",p),o.stdin.once("error",(t)=>{h??=t}),o.once("close",(t,w)=>{if(t!==0&&!e)e=Error(`Native declaration project failed (${w??t}): ${Buffer.concat(a).toString("utf8")}`);E(e??h,Buffer.concat(i).toString("utf8"))}),s?.addEventListener("abort",m,{once:!0}),s?.aborted)m();o.stdin.end(Buffer.from(d,"utf8"))})}async function zi(l,f={},d={}){if(!l||l.includes("\x00"))throw Error("A native zig-dtsx executable is required");for(let i of Object.keys(f))if(!N.has(i))throw Error(`Native declaration project does not support option: ${i}`);d.signal?.throwIfAborted();let n={...D,...f};if(await ne(n),n.isolatedDeclarations===void 0)n.isolatedDeclarations=await re(n);let u=await Fn(n),s=["--batch"];if(!n.keepComments)s.push("--no-comments");if(n.isolatedDeclarations)s.push("--isolated-declarations");let c=JSON.stringify({protocol:"zig-dtsx-project",version:1,files:u.files.map((i)=>({source:i.source,context:i.context}))}),g=await x(l,s,c,n.cwd,d),r;try{r=JSON.parse(g)}catch(i){throw Error("Native executable did not return a valid zig-dtsx project protocol response",{cause:i})}if(!r||typeof r!=="object"||!("protocol"in r)||r.protocol!=="zig-dtsx-project"||!("version"in r)||r.version!==1||!("files"in r)||!Array.isArray(r.files)||r.files.length!==u.files.length)throw Error("Native executable returned an unsupported or incomplete project response");let o=new Map;for(let[i,a]of u.files.entries()){let e=r.files[i];if(!e||typeof e!=="object"||!("sourceFile"in e)||e.sourceFile!==a.sourceFile||!("outputFile"in e)||e.outputFile!==a.outputFile||!("sourceHash"in e)||e.sourceHash!==a.context.sourceHash||!("content"in e)||typeof e.content!=="string")throw Error(`Native executable returned a mismatched project result for ${a.sourceFile}`);o.set(a.outputFile,{content:e.content,lineEnding:n.lineEnding})}return d.signal?.throwIfAborted(),await $e(n,o),Object.freeze({filesGenerated:o.size,outputFiles:Object.freeze([...o.keys()])})}
3
- export{zi};
2
+ import{A}from"./chunk-31t6c3q1.js";import{ie}from"./chunk-w482p1x8.js";import{re,Ee}from"./chunk-93jzvstf.js";import{xn}from"./chunk-s5rja20d.js";import{spawn as j}from"child_process";var N=new Set(["cwd","root","outdir","entrypoints","include","exclude","autoIncludeReExports","outputStructure","tsconfigPath","moduleSpecifierMode","keepComments","isolatedDeclarations","clean","lineEnding"]);function x(l,f,d,n,u){let s=u.signal;s?.throwIfAborted();let c=u.timeoutMs??30000;if(!Number.isSafeInteger(c)||c<=0||c>2147483647)throw RangeError("Native project timeoutMs must be an integer between 1 and 2147483647");return new Promise((g,r)=>{let o=j(l,f,{cwd:n,stdio:["pipe","pipe","pipe"],windowsHide:!0}),i=[],a=[],e,h,v=!1,p=(t)=>{e??=t,o.kill()},m=()=>p(s?.reason instanceof Error?s.reason:Error("Native declaration project aborted",{cause:s?.reason})),b=setTimeout(()=>p(Error(`Native declaration project exceeded ${c}ms`)),c),E=(t,w)=>{if(v)return;if(v=!0,clearTimeout(b),s?.removeEventListener("abort",m),t)r(t);else g(w)};if(o.once("error",(t)=>E(t)),o.stdout.on("data",(t)=>i.push(Buffer.from(t))),o.stderr.on("data",(t)=>a.push(Buffer.from(t))),o.stdout.once("error",p),o.stderr.once("error",p),o.stdin.once("error",(t)=>{h??=t}),o.once("close",(t,w)=>{if(t!==0&&!e)e=Error(`Native declaration project failed (${w??t}): ${Buffer.concat(a).toString("utf8")}`);E(e??h,Buffer.concat(i).toString("utf8"))}),s?.addEventListener("abort",m,{once:!0}),s?.aborted)m();o.stdin.end(Buffer.from(d,"utf8"))})}async function ds(l,f={},d={}){if(!l||l.includes("\x00"))throw Error("A native zig-dtsx executable is required");for(let i of Object.keys(f))if(!N.has(i))throw Error(`Native declaration project does not support option: ${i}`);d.signal?.throwIfAborted();let n={...A,...f};if(await re(n),n.isolatedDeclarations===void 0)n.isolatedDeclarations=await ie(n);let u=await xn(n),s=["--batch"];if(!n.keepComments)s.push("--no-comments");if(n.isolatedDeclarations)s.push("--isolated-declarations");let c=JSON.stringify({protocol:"zig-dtsx-project",version:1,files:u.files.map((i)=>({source:i.source,context:i.context}))}),g=await x(l,s,c,n.cwd,d),r;try{r=JSON.parse(g)}catch(i){throw Error("Native executable did not return a valid zig-dtsx project protocol response",{cause:i})}if(!r||typeof r!=="object"||!("protocol"in r)||r.protocol!=="zig-dtsx-project"||!("version"in r)||r.version!==1||!("files"in r)||!Array.isArray(r.files)||r.files.length!==u.files.length)throw Error("Native executable returned an unsupported or incomplete project response");let o=new Map;for(let[i,a]of u.files.entries()){let e=r.files[i];if(!e||typeof e!=="object"||!("sourceFile"in e)||e.sourceFile!==a.sourceFile||!("outputFile"in e)||e.outputFile!==a.outputFile||!("sourceHash"in e)||e.sourceHash!==a.context.sourceHash||!("content"in e)||typeof e.content!=="string")throw Error(`Native executable returned a mismatched project result for ${a.sourceFile}`);o.set(a.outputFile,{content:e.content,lineEnding:n.lineEnding})}return d.signal?.throwIfAborted(),await Ee(n,o),Object.freeze({filesGenerated:o.size,outputFiles:Object.freeze([...o.keys()])})}
3
+ export{ds};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- function l(t,e){if(e===2)return t===48||t===49;if(e===8)return t>=48&&t<=55;if(e===10)return t>=48&&t<=57;return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function i(t,e,n){let r=!1,a=!1;while(e.at<t.length){let f=t.charCodeAt(e.at);if(l(f,n))r=!0,a=!1,e.at++;else if(f===95&&r&&!a&&e.at+1<t.length&&l(t.charCodeAt(e.at+1),n))a=!0,e.at++;else break}return r&&!a}function u(t,e){if(t.charCodeAt(e)!==48||e+1>=t.length)return 0;let n=t.charCodeAt(e+1)|32;return n===120?16:n===98?2:n===111?8:0}function y(t){if(t.length===0)return!1;let e={at:0};if(t.charCodeAt(0)===45)e.at++;if(e.at>=t.length)return!1;let n=u(t,e.at);if(n)return e.at+=2,i(t,e,n)&&e.at===t.length;let r=i(t,e,10);if(t.charCodeAt(e.at)===46){e.at++;let f=i(t,e,10);if(!r&&!f)return!1}else if(!r)return!1;let a=t.charCodeAt(e.at);if(a===101||a===69){if(e.at++,t.charCodeAt(e.at)===43||t.charCodeAt(e.at)===45)e.at++;if(!i(t,e,10))return!1}return e.at===t.length}function ee(t){if(t.length<2||t.charCodeAt(t.length-1)!==110)return!1;let e=t.slice(0,-1),n={at:0};if(e.charCodeAt(0)===45)n.at++;if(n.at>=e.length)return!1;let r=u(e,n.at);if(r)return n.at+=2,i(e,n,r)&&n.at===e.length;return i(e,n,10)&&n.at===e.length}function K(t){return t.includes("_")?t.replaceAll("_",""):t}
3
- export{y,ee,K};
2
+ function l(t,e){if(e===2)return t===48||t===49;if(e===8)return t>=48&&t<=55;if(e===10)return t>=48&&t<=57;return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function i(t,e,n){let r=!1,a=!1;while(e.at<t.length){let f=t.charCodeAt(e.at);if(l(f,n))r=!0,a=!1,e.at++;else if(f===95&&r&&!a&&e.at+1<t.length&&l(t.charCodeAt(e.at+1),n))a=!0,e.at++;else break}return r&&!a}function u(t,e){if(t.charCodeAt(e)!==48||e+1>=t.length)return 0;let n=t.charCodeAt(e+1)|32;return n===120?16:n===98?2:n===111?8:0}function h(t){if(t.length===0)return!1;let e={at:0};if(t.charCodeAt(0)===45)e.at++;if(e.at>=t.length)return!1;let n=u(t,e.at);if(n)return e.at+=2,i(t,e,n)&&e.at===t.length;let r=i(t,e,10);if(t.charCodeAt(e.at)===46){e.at++;let f=i(t,e,10);if(!r&&!f)return!1}else if(!r)return!1;let a=t.charCodeAt(e.at);if(a===101||a===69){if(e.at++,t.charCodeAt(e.at)===43||t.charCodeAt(e.at)===45)e.at++;if(!i(t,e,10))return!1}return e.at===t.length}function S(t){if(t.length<2||t.charCodeAt(t.length-1)!==110)return!1;let e=t.slice(0,-1),n={at:0};if(e.charCodeAt(0)===45)n.at++;if(n.at>=e.length)return!1;let r=u(e,n.at);if(r)return n.at+=2,i(e,n,r)&&n.at===e.length;return i(e,n,10)&&n.at===e.length}function q(t){return t.includes("_")?t.replaceAll("_",""):t}
3
+ export{h,S,q};