@dtsx/dtsx 0.11.37 → 0.11.38

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 (179) hide show
  1. package/dist/bin/cli.js +3 -3
  2. package/dist/{chunk-wrnz0e76.js → chunk-082w7zvy.js} +3 -3
  3. package/dist/{chunk-psrgw9f8.js → chunk-0k0fhq13.js} +7 -7
  4. package/dist/{chunk-69dbf6de.js → chunk-0rmbc5zp.js} +2 -2
  5. package/dist/{chunk-nn9tpxx3.js → chunk-0yg5mcrf.js} +2 -2
  6. package/dist/chunk-0zfzhn19.js +31 -0
  7. package/dist/chunk-189nn4fc.js +3 -0
  8. package/dist/{chunk-cen2t56g.js → chunk-1qtghb2x.js} +2 -2
  9. package/dist/{chunk-r4zkf9ag.js → chunk-2436cnmb.js} +2 -2
  10. package/dist/{chunk-py7pj8aj.js → chunk-2qd3axyx.js} +4 -4
  11. package/dist/{chunk-n2nyd0ck.js → chunk-32qexm3w.js} +2 -2
  12. package/dist/{chunk-1pz7zxhc.js → chunk-3fbt79hx.js} +2 -2
  13. package/dist/{chunk-gpq2kggq.js → chunk-3t57mzvf.js} +2 -2
  14. package/dist/{chunk-2kwjbk55.js → chunk-42j9cfte.js} +2 -2
  15. package/dist/{chunk-vtskg4r2.js → chunk-4fygcxtb.js} +2 -2
  16. package/dist/{chunk-437g8zz6.js → chunk-50h54rax.js} +3 -3
  17. package/dist/{chunk-aw48mk3t.js → chunk-6yvk3q1e.js} +2 -2
  18. package/dist/chunk-73dzve1s.js +3 -0
  19. package/dist/chunk-7tremqhs.js +14 -0
  20. package/dist/{chunk-mt9219xc.js → chunk-83qnrx0m.js} +5 -5
  21. package/dist/{chunk-ckq8g1ck.js → chunk-88gwzbew.js} +3 -3
  22. package/dist/{chunk-90aptjh6.js → chunk-8d3sdkv4.js} +19 -19
  23. package/dist/{chunk-srg5qhch.js → chunk-8tzd98q8.js} +4 -4
  24. package/dist/{chunk-fy97syc2.js → chunk-96atbsd3.js} +2 -2
  25. package/dist/{chunk-h7k9wamx.js → chunk-9gts9ymh.js} +2 -2
  26. package/dist/{chunk-sq34kkhy.js → chunk-9menejdz.js} +2 -2
  27. package/dist/{chunk-1h6ycqza.js → chunk-a7nvyxpg.js} +4 -4
  28. package/dist/{chunk-j6pfxvy8.js → chunk-ag1b6d30.js} +2 -2
  29. package/dist/{chunk-0ke9xh7t.js → chunk-bnry23ve.js} +3 -3
  30. package/dist/{chunk-wzcwctba.js → chunk-bxc2herz.js} +3 -3
  31. package/dist/{chunk-pzedkn7z.js → chunk-cpmqa8kd.js} +2 -2
  32. package/dist/{chunk-rdzfdjkb.js → chunk-cv29b4zb.js} +3 -3
  33. package/dist/{chunk-xr1h3tv2.js → chunk-cyr45de1.js} +2 -2
  34. package/dist/{chunk-m1khpcqb.js → chunk-d0bazr3p.js} +1 -1
  35. package/dist/{chunk-vae5wxar.js → chunk-danfamyx.js} +2 -2
  36. package/dist/{chunk-853ftm92.js → chunk-davy89dj.js} +5 -5
  37. package/dist/{chunk-n6nw7sn2.js → chunk-e29rp5xj.js} +5 -5
  38. package/dist/{chunk-p7w9ydhe.js → chunk-eba562w8.js} +2 -2
  39. package/dist/{chunk-v44crx69.js → chunk-ebjafajx.js} +11 -11
  40. package/dist/{chunk-g9d5r6a8.js → chunk-ft2zk7jx.js} +2 -2
  41. package/dist/chunk-g2120ysy.js +3 -0
  42. package/dist/chunk-ghfd34r7.js +3 -0
  43. package/dist/{chunk-sjneg7p7.js → chunk-gspsxc9d.js} +8 -8
  44. package/dist/{chunk-n3p7wedp.js → chunk-h3n6256r.js} +2 -2
  45. package/dist/{chunk-4f2mwn7p.js → chunk-hnqm1zb3.js} +4 -4
  46. package/dist/{chunk-gs7wfk8b.js → chunk-htgy94y3.js} +1 -1
  47. package/dist/{chunk-knrtwppp.js → chunk-hv8bx8xx.js} +6 -6
  48. package/dist/chunk-hzn9kmq7.js +3 -0
  49. package/dist/{chunk-nchp0pqa.js → chunk-ja7bp731.js} +2 -2
  50. package/dist/chunk-jcckwgb9.js +3 -0
  51. package/dist/{chunk-s0mvstt0.js → chunk-kfk554fj.js} +2 -2
  52. package/dist/{chunk-1e10w914.js → chunk-kkshxyex.js} +3 -3
  53. package/dist/{chunk-bdxq6500.js → chunk-kpbz61yy.js} +3 -3
  54. package/dist/{chunk-w9av39jy.js → chunk-mkakbjvs.js} +2 -2
  55. package/dist/{chunk-xsf941gw.js → chunk-mwyjxjqa.js} +2 -2
  56. package/dist/{chunk-n37yj3xv.js → chunk-p023fhce.js} +3 -3
  57. package/dist/chunk-p9vfxn8g.js +3 -0
  58. package/dist/{chunk-q0hn0ymb.js → chunk-pjqzkgzk.js} +4 -4
  59. package/dist/chunk-qzjzw9p2.js +3 -0
  60. package/dist/{chunk-acyj1dev.js → chunk-rbx6q1r0.js} +2 -2
  61. package/dist/{chunk-fgbdm1y6.js → chunk-rkstz4w1.js} +4 -4
  62. package/dist/{chunk-gsv5yc32.js → chunk-rz060wxt.js} +4 -4
  63. package/dist/{chunk-z4mvkazp.js → chunk-sd8bywh9.js} +11 -11
  64. package/dist/{chunk-dv5hhg1a.js → chunk-sv8h007a.js} +2 -2
  65. package/dist/{chunk-1bpv3tck.js → chunk-t4va49p3.js} +4 -4
  66. package/dist/{chunk-bqabznps.js → chunk-tka2m4af.js} +2 -2
  67. package/dist/{chunk-7610h2tf.js → chunk-v93389xm.js} +1 -1
  68. package/dist/{chunk-wnk9yjw2.js → chunk-vf3ybe5r.js} +2 -2
  69. package/dist/{chunk-ezbp8tss.js → chunk-vkahj2ab.js} +8 -8
  70. package/dist/chunk-wnqg6hem.js +27 -0
  71. package/dist/chunk-xa6rsd4b.js +29 -0
  72. package/dist/{chunk-gsb3ty07.js → chunk-xfjfhe9d.js} +2 -2
  73. package/dist/{chunk-5n0tfrpc.js → chunk-xwpn40p0.js} +3 -3
  74. package/dist/chunk-y1g6v96c.js +10 -0
  75. package/dist/{chunk-r4s18nn5.js → chunk-y5k0szq6.js} +2 -2
  76. package/dist/{chunk-km8t8gqg.js → chunk-yay68832.js} +2 -2
  77. package/dist/{chunk-strqhcqs.js → chunk-yrv6z221.js} +2 -2
  78. package/dist/chunk-yx1jy7fx.js +37 -0
  79. package/dist/{chunk-ggbahdr2.js → chunk-zgcdx773.js} +3 -3
  80. package/dist/{chunk-60ssvwc8.js → chunk-zk3w5sqv.js} +2 -2
  81. package/dist/src/augmentation-graph.js +1 -1
  82. package/dist/src/binding-patterns.js +1 -1
  83. package/dist/src/branded-types.js +1 -1
  84. package/dist/src/bundle-linker.js +1 -1
  85. package/dist/src/bundler.js +1 -1
  86. package/dist/src/cache.js +1 -1
  87. package/dist/src/call-signatures.js +1 -1
  88. package/dist/src/circular.js +1 -1
  89. package/dist/src/compat.js +1 -1
  90. package/dist/src/computed-keys.js +1 -1
  91. package/dist/src/config.js +1 -1
  92. package/dist/src/dangling-refs.js +1 -1
  93. package/dist/src/declaration-project.js +1 -1
  94. package/dist/src/declaration-publication.js +1 -1
  95. package/dist/src/declaration-references.js +1 -1
  96. package/dist/src/diff.js +1 -1
  97. package/dist/src/docs.js +1 -1
  98. package/dist/src/enum-declarations.js +1 -1
  99. package/dist/src/errors.js +1 -1
  100. package/dist/src/extractor/directives.js +1 -1
  101. package/dist/src/extractor/extract.js +1 -1
  102. package/dist/src/extractor/scanner.js +1 -1
  103. package/dist/src/extractor.js +1 -1
  104. package/dist/src/formats.js +1 -1
  105. package/dist/src/formatter.js +1 -1
  106. package/dist/src/function-properties.js +1 -1
  107. package/dist/src/generator.js +1 -1
  108. package/dist/src/global-types.js +1 -1
  109. package/dist/src/import-sorter.js +1 -1
  110. package/dist/src/incremental.js +1 -1
  111. package/dist/src/index.js +1 -1
  112. package/dist/src/inferred-imports.js +1 -1
  113. package/dist/src/json-config.js +1 -1
  114. package/dist/src/logger.js +1 -1
  115. package/dist/src/lsp.js +1 -1
  116. package/dist/src/memory.js +1 -1
  117. package/dist/src/merger.js +1 -1
  118. package/dist/src/module-graph.js +1 -1
  119. package/dist/src/native-checker.js +1 -1
  120. package/dist/src/native-engine.js +1 -1
  121. package/dist/src/native-extractor.js +1 -1
  122. package/dist/src/native-generation.js +1 -1
  123. package/dist/src/native-project.js +1 -1
  124. package/dist/src/optimizer.js +1 -1
  125. package/dist/src/output-normalizer.js +1 -1
  126. package/dist/src/parallel-processor.js +1 -1
  127. package/dist/src/parameters.js +1 -1
  128. package/dist/src/parser.js +1 -1
  129. package/dist/src/plugins/bun.js +1 -1
  130. package/dist/src/plugins/esbuild.js +1 -1
  131. package/dist/src/plugins/index.js +1 -1
  132. package/dist/src/plugins/tsdown.js +1 -1
  133. package/dist/src/plugins/tsup.js +1 -1
  134. package/dist/src/plugins/vite.js +1 -1
  135. package/dist/src/plugins/webpack.js +1 -1
  136. package/dist/src/plugins.js +1 -1
  137. package/dist/src/process-source.js +1 -1
  138. package/dist/src/processor/cache.js +1 -1
  139. package/dist/src/processor/comments.js +1 -1
  140. package/dist/src/processor/declarations.js +1 -1
  141. package/dist/src/processor/import-usage.js +1 -1
  142. package/dist/src/processor/imports.js +1 -1
  143. package/dist/src/processor/index.js +1 -1
  144. package/dist/src/processor/type-inference.js +1 -1
  145. package/dist/src/processor.js +1 -1
  146. package/dist/src/profiling.js +1 -1
  147. package/dist/src/return-type-scope.js +1 -1
  148. package/dist/src/security.js +1 -1
  149. package/dist/src/source-cache.js +1 -1
  150. package/dist/src/sourcemap.js +1 -1
  151. package/dist/src/stx.js +1 -1
  152. package/dist/src/syntax-validator.js +1 -1
  153. package/dist/src/tracking.js +1 -1
  154. package/dist/src/transformers.js +1 -1
  155. package/dist/src/tree-shaker.js +1 -1
  156. package/dist/src/tsconfig.js +1 -1
  157. package/dist/src/type-mappings.js +1 -1
  158. package/dist/src/utils.js +1 -1
  159. package/dist/src/value-inference.js +1 -1
  160. package/dist/src/vue.js +1 -1
  161. package/dist/src/watcher.js +1 -1
  162. package/dist/src/worker-thread.js +1 -1
  163. package/dist/src/worker.js +1 -1
  164. package/dist/src/workspace.js +1 -1
  165. package/package.json +1 -1
  166. package/dist/chunk-0azm93j9.js +0 -31
  167. package/dist/chunk-25vyhfzh.js +0 -3
  168. package/dist/chunk-79nv7twc.js +0 -14
  169. package/dist/chunk-cs4gwz1k.js +0 -27
  170. package/dist/chunk-d43bpfk6.js +0 -3
  171. package/dist/chunk-dfye109x.js +0 -3
  172. package/dist/chunk-n94729d9.js +0 -3
  173. package/dist/chunk-p2qz2nk2.js +0 -3
  174. package/dist/chunk-qnf4byak.js +0 -3
  175. package/dist/chunk-rmdwvzgn.js +0 -3
  176. package/dist/chunk-s6c98nad.js +0 -29
  177. package/dist/chunk-t1jtn2r0.js +0 -10
  178. package/dist/chunk-ttc5pr8y.js +0 -37
  179. package/dist/chunk-xb92nrsm.js +0 -3
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{readFile as M,writeFile as S}from"fs/promises";import{basename as x,dirname as d,relative as b,resolve as C}from"path";function f(e){return`${String.fromCharCode(47,47,35)} sourceMappingURL=${e}`}class Zt{file;sourceRoot;sources=[];sourcesContent=[];names=[];mappings=[];sourceIndexMap=new Map;nameIndexMap=new Map;constructor(e){this.file=e.file,this.sourceRoot=e.sourceRoot}addSource(e,n){let r=this.sourceIndexMap.get(e);if(r===void 0)r=this.sources.length,this.sources.push(e),this.sourcesContent.push(n??null),this.sourceIndexMap.set(e,r);else if(n&&!this.sourcesContent[r])this.sourcesContent[r]=n;return r}addName(e){let n=this.nameIndexMap.get(e);if(n===void 0)n=this.names.length,this.names.push(e),this.nameIndexMap.set(e,n);return n}addMapping(e){let n=this.addSource(e.source),r;if(e.name)r=this.addName(e.name);this.mappings.push({generated:e.generated,original:e.original,sourceIndex:n,nameIndex:r})}generate(e=!1){this.mappings.sort((r,t)=>{if(r.generated.line!==t.generated.line)return r.generated.line-t.generated.line;return r.generated.column-t.generated.column});let n={version:3,file:this.file,sources:this.sources,names:this.names,mappings:this.encodeMappings()};if(this.sourceRoot)n.sourceRoot=this.sourceRoot;if(e)n.sourcesContent=this.sourcesContent;return n}encodeMappings(){let e=[],n=0,r=0,t=0,i=0,o=0,s=0,u=[];for(let a of this.mappings){while(n<a.generated.line)e.push(u.join(",")),u=[],n++,r=0;let l=[];if(l.push(a.generated.column-r),r=a.generated.column,l.push(a.sourceIndex-t),t=a.sourceIndex,l.push(a.original.line-i),i=a.original.line,l.push(a.original.column-o),o=a.original.column,a.nameIndex!==void 0)l.push(a.nameIndex-s),s=a.nameIndex;u.push(I(l))}return e.push(u.join(",")),e.join(";")}toString(e=!1){return JSON.stringify(this.generate(e))}toDataUrl(e=!1){let n=this.toString(e);return`data:application/json;charset=utf-8;base64,${Buffer.from(n).toString("base64")}`}toComment(e=!1){return f(this.toDataUrl(e))}}class ft{map;decodedMappings=null;constructor(e){this.map=typeof e==="string"?JSON.parse(e):e}originalPositionFor(e){let n=this.getMappings(),r=0,t=n.length-1,i=null;while(r<=t){let o=Math.floor((r+t)/2),s=n[o];if(s.generated.line===e.line)if(s.generated.column===e.column){i=s;break}else if(s.generated.column<e.column)i=s,r=o+1;else t=o-1;else if(s.generated.line<e.line)r=o+1;else t=o-1}if(!i)return{source:null,line:null,column:null,name:null};return{source:this.map.sources[i.sourceIndex]||null,line:i.original.line,column:i.original.column,name:i.nameIndex!==void 0?this.map.names[i.nameIndex]:null}}generatedPositionFor(e){let n=this.map.sources.indexOf(e.source);if(n===-1)return null;let r=this.getMappings();for(let t of r)if(t.sourceIndex===n&&t.original.line===e.line&&t.original.column<=e.column)return t.generated;return null}getMappings(){if(!this.decodedMappings)this.decodedMappings=v(this.map.mappings);return this.decodedMappings}sourceContentFor(e){let n=this.map.sources.indexOf(e);if(n===-1||!this.map.sourcesContent)return null;return this.map.sourcesContent[n]}}function I(e){return e.map(L).join("")}function L(e){let o="",s=e<0?-e<<1|1:e<<1;do{let u=s&31;if(s>>>=5,s>0)u|=32;o+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[u]}while(s>0);return o}function v(e){let n=[],r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,i=0,o=0,s=0,u=0,a=0,l=e.split(";");for(let g of l){if(i=0,g){let h=g.split(",");for(let p of h){if(!p)continue;let c=N(p,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");if(c.length>=1)i+=c[0];if(c.length>=4){o+=c[1],s+=c[2],u+=c[3];let m={generated:{line:t,column:i},original:{line:s,column:u},sourceIndex:o};if(c.length>=5)a+=c[4],m.nameIndex=a;n.push(m)}}}t++}return n}function N(e,n){let t=[],i=0,o=0;for(let s of e){let u=n.indexOf(s);if(u===-1)continue;let a=u&32;if(o+=(u&31)<<i,a)i+=5;else{let l=o&1;o>>=1,t.push(l?-o:o),o=0,i=0}}return t}function Js(e){let n=new Zt({file:x(e.generatedFile),sourceRoot:e.sourceRoot}),r=b(d(e.generatedFile),e.sourceFile);n.addSource(r,e.sourceContent);for(let t of e.mappings)n.addMapping({generated:{line:t.generatedLine,column:t.generatedColumn},original:{line:t.originalLine,column:t.originalColumn},source:r,name:t.name});return n}function Ys(e,n){return`${e}
3
- ${f(n)}`}function Xs(e,n,r=!1){return`${e}
4
- ${n.toComment(r)}`}async function Zs(e,n,r=!1){await S(e,n.toString(r))}async function Gr(e){let n=await M(e,"utf-8");return new ft(n)}async function Qs(e,n){let r=e.match(/\/\/# sourceMappingURL=data:application\/json[^,]+,(\S+)/);if(r){let i=r[1],o=Buffer.from(i,"base64").toString("utf-8");return new ft(o)}let t=e.match(/\/\/# sourceMappingURL=(.+)$/);if(t){let i=C(d(n),t[1].trim());try{return await Gr(i)}catch{return null}}return null}function eo(e,n){let r=e,t=n,i=r.split(`
2
+ import{readFile as M,writeFile as S}from"fs/promises";import{basename as x,dirname as d,relative as b,resolve as C}from"path";function f(e){return`${String.fromCharCode(47,47,35)} sourceMappingURL=${e}`}class Xt{file;sourceRoot;sources=[];sourcesContent=[];names=[];mappings=[];sourceIndexMap=new Map;nameIndexMap=new Map;constructor(e){this.file=e.file,this.sourceRoot=e.sourceRoot}addSource(e,n){let r=this.sourceIndexMap.get(e);if(r===void 0)r=this.sources.length,this.sources.push(e),this.sourcesContent.push(n??null),this.sourceIndexMap.set(e,r);else if(n&&!this.sourcesContent[r])this.sourcesContent[r]=n;return r}addName(e){let n=this.nameIndexMap.get(e);if(n===void 0)n=this.names.length,this.names.push(e),this.nameIndexMap.set(e,n);return n}addMapping(e){let n=this.addSource(e.source),r;if(e.name)r=this.addName(e.name);this.mappings.push({generated:e.generated,original:e.original,sourceIndex:n,nameIndex:r})}generate(e=!1){this.mappings.sort((r,t)=>{if(r.generated.line!==t.generated.line)return r.generated.line-t.generated.line;return r.generated.column-t.generated.column});let n={version:3,file:this.file,sources:this.sources,names:this.names,mappings:this.encodeMappings()};if(this.sourceRoot)n.sourceRoot=this.sourceRoot;if(e)n.sourcesContent=this.sourcesContent;return n}encodeMappings(){let e=[],n=0,r=0,t=0,i=0,o=0,s=0,u=[];for(let a of this.mappings){while(n<a.generated.line)e.push(u.join(",")),u=[],n++,r=0;let l=[];if(l.push(a.generated.column-r),r=a.generated.column,l.push(a.sourceIndex-t),t=a.sourceIndex,l.push(a.original.line-i),i=a.original.line,l.push(a.original.column-o),o=a.original.column,a.nameIndex!==void 0)l.push(a.nameIndex-s),s=a.nameIndex;u.push(I(l))}return e.push(u.join(",")),e.join(";")}toString(e=!1){return JSON.stringify(this.generate(e))}toDataUrl(e=!1){let n=this.toString(e);return`data:application/json;charset=utf-8;base64,${Buffer.from(n).toString("base64")}`}toComment(e=!1){return f(this.toDataUrl(e))}}class lt{map;decodedMappings=null;constructor(e){this.map=typeof e==="string"?JSON.parse(e):e}originalPositionFor(e){let n=this.getMappings(),r=0,t=n.length-1,i=null;while(r<=t){let o=Math.floor((r+t)/2),s=n[o];if(s.generated.line===e.line)if(s.generated.column===e.column){i=s;break}else if(s.generated.column<e.column)i=s,r=o+1;else t=o-1;else if(s.generated.line<e.line)r=o+1;else t=o-1}if(!i)return{source:null,line:null,column:null,name:null};return{source:this.map.sources[i.sourceIndex]||null,line:i.original.line,column:i.original.column,name:i.nameIndex!==void 0?this.map.names[i.nameIndex]:null}}generatedPositionFor(e){let n=this.map.sources.indexOf(e.source);if(n===-1)return null;let r=this.getMappings();for(let t of r)if(t.sourceIndex===n&&t.original.line===e.line&&t.original.column<=e.column)return t.generated;return null}getMappings(){if(!this.decodedMappings)this.decodedMappings=v(this.map.mappings);return this.decodedMappings}sourceContentFor(e){let n=this.map.sources.indexOf(e);if(n===-1||!this.map.sourcesContent)return null;return this.map.sourcesContent[n]}}function I(e){return e.map(L).join("")}function L(e){let o="",s=e<0?-e<<1|1:e<<1;do{let u=s&31;if(s>>>=5,s>0)u|=32;o+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[u]}while(s>0);return o}function v(e){let n=[],r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,i=0,o=0,s=0,u=0,a=0,l=e.split(";");for(let g of l){if(i=0,g){let h=g.split(",");for(let p of h){if(!p)continue;let c=N(p,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");if(c.length>=1)i+=c[0];if(c.length>=4){o+=c[1],s+=c[2],u+=c[3];let m={generated:{line:t,column:i},original:{line:s,column:u},sourceIndex:o};if(c.length>=5)a+=c[4],m.nameIndex=a;n.push(m)}}}t++}return n}function N(e,n){let t=[],i=0,o=0;for(let s of e){let u=n.indexOf(s);if(u===-1)continue;let a=u&32;if(o+=(u&31)<<i,a)i+=5;else{let l=o&1;o>>=1,t.push(l?-o:o),o=0,i=0}}return t}function Ds(e){let n=new Xt({file:x(e.generatedFile),sourceRoot:e.sourceRoot}),r=b(d(e.generatedFile),e.sourceFile);n.addSource(r,e.sourceContent);for(let t of e.mappings)n.addMapping({generated:{line:t.generatedLine,column:t.generatedColumn},original:{line:t.originalLine,column:t.originalColumn},source:r,name:t.name});return n}function Rs(e,n){return`${e}
3
+ ${f(n)}`}function Ms(e,n,r=!1){return`${e}
4
+ ${n.toComment(r)}`}async function Os(e,n,r=!1){await S(e,n.toString(r))}async function Ir(e){let n=await M(e,"utf-8");return new lt(n)}async function Is(e,n){let r=e.match(/\/\/# sourceMappingURL=data:application\/json[^,]+,(\S+)/);if(r){let i=r[1],o=Buffer.from(i,"base64").toString("utf-8");return new lt(o)}let t=e.match(/\/\/# sourceMappingURL=(.+)$/);if(t){let i=C(d(n),t[1].trim());try{return await Ir(i)}catch{return null}}return null}function Fs(e,n){let r=e,t=n,i=r.split(`
5
5
  `),o=[],s=0,u=0;for(let a of t){while(s+i[u].length+1<=a.generatedStart&&u<i.length-1)s+=i[u].length+1,u++;let l=a.generatedStart-s;o.push({generatedLine:u,generatedColumn:Math.max(0,l),originalLine:a.originalLine,originalColumn:a.originalColumn,name:a.name})}return o}
6
- export{Zt,ft,Js,Ys,Xs,Zs,Gr,Qs,eo};
6
+ export{Xt,lt,Ds,Rs,Ms,Os,Ir,Is,Fs};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{ve}from"./chunk-cpmqa8kd.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 X(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(ve(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 X(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{X};
@@ -14,5 +14,5 @@ var d=null,m=null;async function P(){if(d!==null)return d;try{return m=await imp
14
14
  `),s=[],a=[],i=!1,u=0;for(let o=0;o<n.length;o++){let t=n[o],p=t.match(/^(import\s+(?:type\s+)?.*from\s+['"])([^'"]+)(['"].*)$/);if(p){i=!0,u=o;let c=p[1];s.push({line:t,source:p[2],isType:c.startsWith("import type ")||c.startsWith("import type\t")})}else if(i&&t.trim()==="")continue;else{if(i)i=!1;a.push(t)}}if(s.length===0)return r;if(e.sort)s.sort((o,t)=>{if(o.isType!==t.isType)return o.isType?1:-1;return M(o.source,t.source)});let l;if(e.group){let o=[],t=[],p=[],c=[],b=[];for(let f=0;f<s.length;f++){let g=s[f],h=g.source;if(h.charCodeAt(0)===46)b.push(g);else if(h.startsWith("node:"))o.push(g);else if(h.charCodeAt(0)===64)c.push(g);else if(h.includes("/"))p.push(g);else t.push(g)}l=[...o.map((f)=>f.line),...o.length>0&&t.length>0?[""]:[],...t.map((f)=>f.line),...(o.length>0||t.length>0)&&p.length>0?[""]:[],...p.map((f)=>f.line),...c.length>0&&(o.length>0||t.length>0||p.length>0)?[""]:[],...c.map((f)=>f.line),...b.length>0?[""]:[],...b.map((f)=>f.line)]}else l=s.map((o)=>o.line);return[...l,"",...a].join(`
15
15
  `)}function M(r,e){let n=r.startsWith("node:"),s=e.startsWith("node:");if(n!==s)return n?-1:1;let a=r.startsWith("."),i=e.startsWith(".");if(a!==i)return a?1:-1;return r.localeCompare(e)}function W(r,e,n){let s=r.split(`
16
16
  `),a=[];for(let i of s){if(i.length<=e){a.push(i);continue}if(i.trimStart().startsWith("import ")){a.push(i);continue}let u=i.match(/^(\s*)/)?.[1]||"",l=u+n,o=O(i,u,l);if(o){a.push(...o);continue}if(i.includes("{")&&i.includes("}")){let t=v(i,e,u,l);a.push(...t);continue}if(i.includes(" | ")){let t=R(i,e,u,l);a.push(...t);continue}a.push(i)}return a.join(`
17
- `)}var F=/^\s*(export|import)(\s+type)?\s*\{([^{}]*)\}\s*(from\s*(?:'[^']*'|"[^"]*")(?:\s*(?:with|assert)\s*\{[^{}]*\})?)?\s*;?\s*$/;function O(r,e,n){let s=r.match(F);if(!s)return null;let[,a,i,u,l]=s,o=u.split(",").map((c)=>c.trim()).filter(Boolean);if(o.length<=1)return[r];let t=`${e}${a}${i??""} {`,p=l?`${e}} ${l};`:`${e}};`;return[t,...o.map((c)=>`${n}${c},`),p]}function v(r,e,n,s){let a=r.match(/^(\s*)(.*?)(\{)(.+)(\}.*)$/);if(!a)return[r];let[,,i,u,l,o]=a,t=l.split(/;\s*|,\s*/).filter((c)=>c.trim());if(t.length<=1)return[r];return[`${n}${i}${u}`,...t.map((c)=>`${s}${c.trim()};`),`${n}${o.trim()}`]}function R(r,e,n,s){let a=r.match(/^(\s*)(.*?=\s*)(.+)$/);if(!a)return[r];let[,,i,u]=a,l=u.split(/\s*\|\s*/).filter((t)=>t.trim());if(l.length<=2)return[r];return[`${n}${i}`,...l.map((t,p)=>`${s}${p>0?"| ":" "}${t.trim()}`)]}async function z(r,e={},n){let s=[];if(e.usePrettier!==!1){if(await P())try{let l={...await y(e.prettierConfigPath,n),...e.prettierOptions,parser:"typescript"};return{content:await w(r,l),usedPrettier:!0}}catch(u){s.push(`Prettier formatting failed: ${u}. Using built-in formatter.`)}else if(e.usePrettier===!0)s.push("Prettier requested but not available. Using built-in formatter.")}return{content:C(r,e.builtIn),usedPrettier:!1,warnings:s.length>0?s:void 0}}async function ri(r,e={}){let n=new Map;for(let[s,a]of r){let i=await z(a,e,s);n.set(s,i)}return n}function bo(r={}){return{format:(e,n)=>z(e,r,n),formatMany:(e)=>ri(e,r)}}async function wo(r){return(await z(r,{usePrettier:!0,builtIn:{indentSize:2,normalizeWhitespace:!0,sortImports:!0,trailingNewline:!0}})).content}
18
- export{z,ri,bo,wo};
17
+ `)}var F=/^\s*(export|import)(\s+type)?\s*\{([^{}]*)\}\s*(from\s*(?:'[^']*'|"[^"]*")(?:\s*(?:with|assert)\s*\{[^{}]*\})?)?\s*;?\s*$/;function O(r,e,n){let s=r.match(F);if(!s)return null;let[,a,i,u,l]=s,o=u.split(",").map((c)=>c.trim()).filter(Boolean);if(o.length<=1)return[r];let t=`${e}${a}${i??""} {`,p=l?`${e}} ${l};`:`${e}};`;return[t,...o.map((c)=>`${n}${c},`),p]}function v(r,e,n,s){let a=r.match(/^(\s*)(.*?)(\{)(.+)(\}.*)$/);if(!a)return[r];let[,,i,u,l,o]=a,t=l.split(/;\s*|,\s*/).filter((c)=>c.trim());if(t.length<=1)return[r];return[`${n}${i}${u}`,...t.map((c)=>`${s}${c.trim()};`),`${n}${o.trim()}`]}function R(r,e,n,s){let a=r.match(/^(\s*)(.*?=\s*)(.+)$/);if(!a)return[r];let[,,i,u]=a,l=u.split(/\s*\|\s*/).filter((t)=>t.trim());if(l.length<=2)return[r];return[`${n}${i}`,...l.map((t,p)=>`${s}${p>0?"| ":" "}${t.trim()}`)]}async function U(r,e={},n){let s=[];if(e.usePrettier!==!1){if(await P())try{let l={...await y(e.prettierConfigPath,n),...e.prettierOptions,parser:"typescript"};return{content:await w(r,l),usedPrettier:!0}}catch(u){s.push(`Prettier formatting failed: ${u}. Using built-in formatter.`)}else if(e.usePrettier===!0)s.push("Prettier requested but not available. Using built-in formatter.")}return{content:C(r,e.builtIn),usedPrettier:!1,warnings:s.length>0?s:void 0}}async function Ur(r,e={}){let n=new Map;for(let[s,a]of r){let i=await U(a,e,s);n.set(s,i)}return n}function Zs(r={}){return{format:(e,n)=>U(e,r,n),formatMany:(e)=>Ur(e,r)}}async function Qs(r){return(await U(r,{usePrettier:!0,builtIn:{indentSize:2,normalizeWhitespace:!0,sortImports:!0,trailingNewline:!0}})).content}
18
+ export{U,Ur,Zs,Qs};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{r}from"./chunk-qnf4byak.js";import{readFile as D}from"fs/promises";import{dirname as x,relative as g,resolve as C}from"path";async function kr(s,i={}){let e=new Map,n=i.rootDir||process.cwd(),t=[];for(let o of s){if(i.ignore?.some((p)=>M(o,p)))continue;if(!i.includeNodeModules&&o.includes("node_modules"))continue;t.push(o)}let c=await Promise.all(t.map((o)=>b(o,n)));for(let o=0;o<t.length;o++){let p=c[o];if(p)e.set(t[o],p)}for(let[o,p]of e)for(let a of p.dependencies){let d=e.get(a);if(d)d.dependents.add(o)}return e}async function b(s,i){try{let e=await D(s,"utf-8"),n={path:s,exports:new Set,imports:new Map,dependencies:new Set,dependents:new Set};for(let t of r(e,s,!1)){if(t.isExported&&t.name)n.exports.add(t.isTypeOnly||t.kind==="type"||t.kind==="interface"?"type":t.name);if(!t.source)continue;let c=w(t.source,s,i);if(!c)continue;if(n.dependencies.add(c),t.kind==="import")for(let o of t.specifiers??[])n.imports.set(t.isTypeOnly||o.isType?`type ${o.alias??o.name}`:o.alias??o.name,c)}return n}catch{return null}}function w(s,i,e){if(!s.startsWith(".")&&!s.startsWith("/"))return null;let n=x(i),t=C(n,s);if(t.includes("node_modules"))return null;if(t.endsWith(".ts")||t.endsWith(".tsx"))return t.replace(/\.tsx?$/,".ts");return`${t}.ts`}function M(s,i){let e=i.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(e).test(s)}function Tr(s,i={}){let e=[],n=new Set,t=new Set,c=[],o=new Map,p=i.maxDepth||100;function a(d,y){if(y>p)return;if(t.has(d)){let u=o.get(d)??c.indexOf(d),l=c.slice(u);l.push(d);let h=S(l,s),f=z(l,s);if(!i.typesOnly||f)e.push({chain:l,symbols:h,severity:f?"error":"warning",reason:f?"Type-level circular dependency can cause compilation issues":"Value-level circular dependency may cause runtime issues"});return}if(n.has(d))return;let m=s.get(d);if(!m)return;t.add(d),o.set(d,c.length),c.push(d);for(let u of m.dependencies)a(u,y+1);t.delete(d),c.pop(),o.delete(d),n.add(d)}for(let d of s.keys())if(!n.has(d))a(d,0);return N(e)}function S(s,i){let e=[];for(let n=0;n<s.length-1;n++){let t=i.get(s[n]),c=s[n+1];if(t){for(let[o,p]of t.imports)if(p===c)e.push(o)}}return[...new Set(e)]}function z(s,i){return s.some((e)=>e.endsWith(".d.ts")||i.get(e)?.exports.has("type")||[...i.get(e)?.imports.keys()||[]].some((n)=>n.startsWith("type ")||n==="type"))}function N(s){let i=new Set,e=[];for(let n of s){let t=v(n.chain),c=t.join(" -> ");if(!i.has(c))i.add(c),e.push({...n,chain:t})}return e}function v(s){if(s.length<=1)return s;let i=s.slice(0,-1),e=i;for(let n=1;n<i.length;n++){let t=[...i.slice(n),...i.slice(0,n)];if(t.join("")<e.join(""))e=t}return[...e,e[0]]}async function as(s,i={}){let e=Date.now(),n=await kr(s,i),t=Tr(n,i);return{hasCircular:t.length>0,cycles:t,graph:n,filesAnalyzed:s,durationMs:Date.now()-e}}function cs(s,i){let e=[];if(!s.hasCircular)return e.push(`\u2713 No circular dependencies found (${s.filesAnalyzed.length} files analyzed in ${s.durationMs}ms)`),e.join(`
2
+ import{r}from"./chunk-jcckwgb9.js";import{readFile as D}from"fs/promises";import{dirname as x,relative as g,resolve as C}from"path";async function mr(s,i={}){let e=new Map,n=i.rootDir||process.cwd(),t=[];for(let o of s){if(i.ignore?.some((p)=>M(o,p)))continue;if(!i.includeNodeModules&&o.includes("node_modules"))continue;t.push(o)}let c=await Promise.all(t.map((o)=>b(o,n)));for(let o=0;o<t.length;o++){let p=c[o];if(p)e.set(t[o],p)}for(let[o,p]of e)for(let a of p.dependencies){let d=e.get(a);if(d)d.dependents.add(o)}return e}async function b(s,i){try{let e=await D(s,"utf-8"),n={path:s,exports:new Set,imports:new Map,dependencies:new Set,dependents:new Set};for(let t of r(e,s,!1)){if(t.isExported&&t.name)n.exports.add(t.isTypeOnly||t.kind==="type"||t.kind==="interface"?"type":t.name);if(!t.source)continue;let c=w(t.source,s,i);if(!c)continue;if(n.dependencies.add(c),t.kind==="import")for(let o of t.specifiers??[])n.imports.set(t.isTypeOnly||o.isType?`type ${o.alias??o.name}`:o.alias??o.name,c)}return n}catch{return null}}function w(s,i,e){if(!s.startsWith(".")&&!s.startsWith("/"))return null;let n=x(i),t=C(n,s);if(t.includes("node_modules"))return null;if(t.endsWith(".ts")||t.endsWith(".tsx"))return t.replace(/\.tsx?$/,".ts");return`${t}.ts`}function M(s,i){let e=i.replace(/\./g,"\\.").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp(e).test(s)}function gr(s,i={}){let e=[],n=new Set,t=new Set,c=[],o=new Map,p=i.maxDepth||100;function a(d,y){if(y>p)return;if(t.has(d)){let u=o.get(d)??c.indexOf(d),l=c.slice(u);l.push(d);let h=S(l,s),f=z(l,s);if(!i.typesOnly||f)e.push({chain:l,symbols:h,severity:f?"error":"warning",reason:f?"Type-level circular dependency can cause compilation issues":"Value-level circular dependency may cause runtime issues"});return}if(n.has(d))return;let m=s.get(d);if(!m)return;t.add(d),o.set(d,c.length),c.push(d);for(let u of m.dependencies)a(u,y+1);t.delete(d),c.pop(),o.delete(d),n.add(d)}for(let d of s.keys())if(!n.has(d))a(d,0);return N(e)}function S(s,i){let e=[];for(let n=0;n<s.length-1;n++){let t=i.get(s[n]),c=s[n+1];if(t){for(let[o,p]of t.imports)if(p===c)e.push(o)}}return[...new Set(e)]}function z(s,i){return s.some((e)=>e.endsWith(".d.ts")||i.get(e)?.exports.has("type")||[...i.get(e)?.imports.keys()||[]].some((n)=>n.startsWith("type ")||n==="type"))}function N(s){let i=new Set,e=[];for(let n of s){let t=v(n.chain),c=t.join(" -> ");if(!i.has(c))i.add(c),e.push({...n,chain:t})}return e}function v(s){if(s.length<=1)return s;let i=s.slice(0,-1),e=i;for(let n=1;n<i.length;n++){let t=[...i.slice(n),...i.slice(0,n)];if(t.join("")<e.join(""))e=t}return[...e,e[0]]}async function ss(s,i={}){let e=Date.now(),n=await mr(s,i),t=gr(n,i);return{hasCircular:t.length>0,cycles:t,graph:n,filesAnalyzed:s,durationMs:Date.now()-e}}function os(s,i){let e=[];if(!s.hasCircular)return e.push(`\u2713 No circular dependencies found (${s.filesAnalyzed.length} files analyzed in ${s.durationMs}ms)`),e.join(`
3
3
  `);e.push(`\u2717 Found ${s.cycles.length} circular dependency chain(s)`),e.push("");for(let n of s.cycles){let t=n.severity==="error"?"\uD83D\uDD34":"\uD83D\uDFE1";e.push(`${t} ${n.severity.toUpperCase()}: Circular dependency`);let c=n.chain.map((o)=>i?g(i,o):o);if(e.push(` ${c.join(" \u2192 ")}`),n.symbols.length>0)e.push(` Symbols: ${n.symbols.join(", ")}`);e.push(` ${n.reason}`),e.push("")}return e.push(`Analyzed ${s.filesAnalyzed.length} files in ${s.durationMs}ms`),e.join(`
4
- `)}function ls(s){let i=0,e={file:"",count:0},n={file:"",count:0},t=[];for(let[c,o]of s){let p=o.dependencies.size;if(i+=p,p>e.count)e={file:c,count:p};if(p===0&&o.dependents.size===0)t.push(c);if(o.dependents.size>n.count)n={file:c,count:o.dependents.size}}return{totalFiles:s.size,totalDependencies:i,avgDependencies:s.size>0?i/s.size:0,maxDependencies:e,isolatedFiles:t,mostDepended:n}}function us(s,i){let e=new Set,n=[s];while(n.length>0){let t=n.shift(),c=i.get(t);if(c){for(let o of c.dependents)if(!e.has(o))e.add(o),n.push(o)}}return e}function fs(s,i){let e=new Set,n=[s];while(n.length>0){let t=n.shift(),c=i.get(t);if(c){for(let o of c.dependencies)if(!e.has(o))e.add(o),n.push(o)}}return e}function ds(s,i){let e=["digraph dependencies {"," rankdir=LR;"," node [shape=box];",""];for(let[n,t]of s){let c=i?g(i,n):n,o=n.replace(/[^a-z0-9]/gi,"_");e.push(` ${o} [label="${c}"];`);for(let p of t.dependencies){let a=p.replace(/[^a-z0-9]/gi,"_");e.push(` ${o} -> ${a};`)}}return e.push("}"),e.join(`
5
- `)}function ps(s,i){let e=[];for(let[n,t]of s){let c=i?g(i,n):n;e.push({id:n,path:c,exports:[...t.exports],imports:Object.fromEntries(t.imports),dependencies:[...t.dependencies],dependents:[...t.dependents]})}return JSON.stringify({nodes:e},null,2)}
6
- export{kr,Tr,as,cs,ls,us,fs,ds,ps};
4
+ `)}function as(s){let i=0,e={file:"",count:0},n={file:"",count:0},t=[];for(let[c,o]of s){let p=o.dependencies.size;if(i+=p,p>e.count)e={file:c,count:p};if(p===0&&o.dependents.size===0)t.push(c);if(o.dependents.size>n.count)n={file:c,count:o.dependents.size}}return{totalFiles:s.size,totalDependencies:i,avgDependencies:s.size>0?i/s.size:0,maxDependencies:e,isolatedFiles:t,mostDepended:n}}function cs(s,i){let e=new Set,n=[s];while(n.length>0){let t=n.shift(),c=i.get(t);if(c){for(let o of c.dependents)if(!e.has(o))e.add(o),n.push(o)}}return e}function ls(s,i){let e=new Set,n=[s];while(n.length>0){let t=n.shift(),c=i.get(t);if(c){for(let o of c.dependencies)if(!e.has(o))e.add(o),n.push(o)}}return e}function us(s,i){let e=["digraph dependencies {"," rankdir=LR;"," node [shape=box];",""];for(let[n,t]of s){let c=i?g(i,n):n,o=n.replace(/[^a-z0-9]/gi,"_");e.push(` ${o} [label="${c}"];`);for(let p of t.dependencies){let a=p.replace(/[^a-z0-9]/gi,"_");e.push(` ${o} -> ${a};`)}}return e.push("}"),e.join(`
5
+ `)}function fs(s,i){let e=[];for(let[n,t]of s){let c=i?g(i,n):n;e.push({id:n,path:c,exports:[...t.exports],imports:Object.fromEntries(t.imports),dependencies:[...t.dependencies],dependents:[...t.dependents]})}return JSON.stringify({nodes:e},null,2)}
6
+ export{mr,gr,ss,os,as,cs,ls,us,fs};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{watch as z}from"fs";import{readdir as O,stat as U}from"fs/promises";import{join as S,relative as E}from"path";function di(e,i){let{root:s,include:u=["**/*.ts","**/*.tsx","**/*.vue","**/*.stx"],exclude:v=["**/node_modules/**","**/*.d.ts","**/dist/**"],debounce:f=100,initialBuild:a=!0,clearScreen:D=!1,onChange:T,onBuildStart:w,onBuildComplete:B,onError:W}=e,P=[],g=new Set,h=!1,d=new Map,c=null,y=!1;function A(o){let r=E(s,o);for(let n of v)if(p(r,n))return!1;for(let n of u)if(p(r,n))return!0;return!1}function p(o,r){let n=r.replace(/\./g,"\\.").replace(/\*\*/g,"{{DOUBLESTAR}}").replace(/\*/g,"[^/]*").replace(/\{\{DOUBLESTAR\}\}/g,".*").replace(/\?/g,".");return new RegExp(`^${n}$`).test(o.replace(/\\/g,"/"))}async function F(){if(y||d.size===0)return;y=!0;let o=Array.from(d.values());d.clear();try{for(let t of o)await T?.(t);if(D)console.clear();await w?.();let r=o.filter((t)=>t.type!=="unlink").map((t)=>t.path),n=await i(r.length>0?r:void 0);await B?.(n)}catch(r){await W?.(r)}finally{if(y=!1,d.size>0)C()}}function C(){if(c)clearTimeout(c);c=setTimeout(()=>{c=null,F()},f)}function k(o,r,n){if(!r||!h)return;let t=S(n,r);if(!A(t))return;let l={type:o==="rename"?"add":"change",path:t,relativePath:E(s,t)};U(t).then(()=>{g.add(t)}).catch(()=>{l.type="unlink",g.delete(t)}).finally(()=>{d.set(t,l),C()})}async function b(o){let r=[o];try{let n=await O(o,{withFileTypes:!0});for(let t of n)if(t.isDirectory()){let l=S(o,t.name),x=E(s,l),R=!1;for(let m of v)if(p(x,m)||p(`${x}/`,m)){R=!0;break}if(!R){let m=await b(l);r.push(...m)}}}catch{}return r}async function G(){if(h)return;h=!0;let o=await b(s);for(let r of o)try{let n=z(r,{persistent:!0},(t,l)=>{k(t,l,r)});n.on("error",(t)=>{W?.(t)}),P.push(n)}catch(n){await W?.(n)}if(a){await w?.();let r=await i();await B?.(r)}}function L(){if(h=!1,c)clearTimeout(c),c=null;for(let o of P)o.close();P.length=0,g.clear(),d.clear()}async function j(){await w?.();let o=await i();return await B?.(o),o}return{start:G,stop:L,rebuild:j,isWatching:()=>h,getWatchedFiles:()=>Array.from(g)}}async function Mo(e,i){let s=async(v)=>{let f=Date.now();try{let a=await i(e);return{success:a.errors.length===0,duration:Date.now()-f,filesProcessed:a.filesProcessed,errors:a.errors}}catch(a){return{success:!1,duration:Date.now()-f,filesProcessed:0,errors:[a.message]}}},u=di({root:e.root||e.cwd||process.cwd(),include:e.include,exclude:e.exclude,debounce:e.debounce,initialBuild:e.initialBuild,clearScreen:e.clearScreen,onChange:e.onChange,onBuildStart:e.onBuildStart,onBuildComplete:e.onBuildComplete,onError:e.onError},s);return await u.start(),u}function pi(e){let i=e.success?"\u2713":"\u2717",s=`${e.duration}ms`;if(e.success)return`${i} Built ${e.filesProcessed} file(s) in ${s}`;else return`${i} Build failed in ${s}
2
+ import{watch as z}from"fs";import{readdir as O,stat as U}from"fs/promises";import{join as S,relative as E}from"path";function xi(e,i){let{root:s,include:u=["**/*.ts","**/*.tsx","**/*.vue","**/*.stx"],exclude:v=["**/node_modules/**","**/*.d.ts","**/dist/**"],debounce:f=100,initialBuild:a=!0,clearScreen:D=!1,onChange:T,onBuildStart:w,onBuildComplete:B,onError:W}=e,P=[],g=new Set,h=!1,d=new Map,c=null,y=!1;function A(o){let r=E(s,o);for(let n of v)if(p(r,n))return!1;for(let n of u)if(p(r,n))return!0;return!1}function p(o,r){let n=r.replace(/\./g,"\\.").replace(/\*\*/g,"{{DOUBLESTAR}}").replace(/\*/g,"[^/]*").replace(/\{\{DOUBLESTAR\}\}/g,".*").replace(/\?/g,".");return new RegExp(`^${n}$`).test(o.replace(/\\/g,"/"))}async function F(){if(y||d.size===0)return;y=!0;let o=Array.from(d.values());d.clear();try{for(let t of o)await T?.(t);if(D)console.clear();await w?.();let r=o.filter((t)=>t.type!=="unlink").map((t)=>t.path),n=await i(r.length>0?r:void 0);await B?.(n)}catch(r){await W?.(r)}finally{if(y=!1,d.size>0)C()}}function C(){if(c)clearTimeout(c);c=setTimeout(()=>{c=null,F()},f)}function k(o,r,n){if(!r||!h)return;let t=S(n,r);if(!A(t))return;let l={type:o==="rename"?"add":"change",path:t,relativePath:E(s,t)};U(t).then(()=>{g.add(t)}).catch(()=>{l.type="unlink",g.delete(t)}).finally(()=>{d.set(t,l),C()})}async function b(o){let r=[o];try{let n=await O(o,{withFileTypes:!0});for(let t of n)if(t.isDirectory()){let l=S(o,t.name),x=E(s,l),R=!1;for(let m of v)if(p(x,m)||p(`${x}/`,m)){R=!0;break}if(!R){let m=await b(l);r.push(...m)}}}catch{}return r}async function G(){if(h)return;h=!0;let o=await b(s);for(let r of o)try{let n=z(r,{persistent:!0},(t,l)=>{k(t,l,r)});n.on("error",(t)=>{W?.(t)}),P.push(n)}catch(n){await W?.(n)}if(a){await w?.();let r=await i();await B?.(r)}}function L(){if(h=!1,c)clearTimeout(c),c=null;for(let o of P)o.close();P.length=0,g.clear(),d.clear()}async function j(){await w?.();let o=await i();return await B?.(o),o}return{start:G,stop:L,rebuild:j,isWatching:()=>h,getWatchedFiles:()=>Array.from(g)}}async function la(e,i){let s=async(v)=>{let f=Date.now();try{let a=await i(e);return{success:a.errors.length===0,duration:Date.now()-f,filesProcessed:a.filesProcessed,errors:a.errors}}catch(a){return{success:!1,duration:Date.now()-f,filesProcessed:0,errors:[a.message]}}},u=xi({root:e.root||e.cwd||process.cwd(),include:e.include,exclude:e.exclude,debounce:e.debounce,initialBuild:e.initialBuild,clearScreen:e.clearScreen,onChange:e.onChange,onBuildStart:e.onBuildStart,onBuildComplete:e.onBuildComplete,onError:e.onError},s);return await u.start(),u}function Ci(e){let i=e.success?"\u2713":"\u2717",s=`${e.duration}ms`;if(e.success)return`${i} Built ${e.filesProcessed} file(s) in ${s}`;else return`${i} Build failed in ${s}
3
3
  ${e.errors.map((u)=>` - ${u}`).join(`
4
- `)}`}function Oo(){return{onChange:(e)=>{let i=e.type==="add"?"+":e.type==="unlink"?"-":"~";console.log(`[${i}] ${e.relativePath}`)},onBuildStart:()=>{console.log(`
5
- Rebuilding...`)},onBuildComplete:(e)=>{console.log(pi(e))},onError:(e)=>{console.error(`Error: ${e.message}`)}}}
6
- export{di,Mo,pi,Oo};
4
+ `)}`}function ua(){return{onChange:(e)=>{let i=e.type==="add"?"+":e.type==="unlink"?"-":"~";console.log(`[${i}] ${e.relativePath}`)},onBuildStart:()=>{console.log(`
5
+ Rebuilding...`)},onBuildComplete:(e)=>{console.log(Ci(e))},onError:(e)=>{console.error(`Error: ${e.message}`)}}}
6
+ export{xi,la,Ci,ua};
@@ -1,21 +1,21 @@
1
1
  // @bun
2
- function R(n){return n.endsWith(".vue")}function Yo(n){let i={script:null,scriptSetup:null},e=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,s;while((s=e.exec(n))!==null){let t=s[1]||"",r=/lang\s*=\s*["']([^"']+)["']/i.exec(t)?.[1]?.toLowerCase()??"js",l={content:s[2]??"",attrs:t,setup:/\bsetup\b/.test(t),lang:r};if(l.setup)i.scriptSetup=l;else i.script=l}return i}function h(n,i){let e=n[i];i++;while(i<n.length){let s=n[i];if(s==="\\"){i+=2;continue}if(s===e)return i+1;i++}return i}function d(n,i){i++;let e=0;while(i<n.length){let s=n[i];if(s==="\\"){i+=2;continue}if(s==="`"&&e===0)return i+1;if(s==="$"&&n[i+1]==="{"){e++,i+=2;continue}if(s==="}"){if(e>0)e--;i++;continue}i++}return i}function b(n,i){if(n[i+1]==="/"){let e=n.indexOf(`
3
- `,i+2);return e===-1?n.length:e+1}if(n[i+1]==="*"){let e=n.indexOf("*/",i+2);return e===-1?n.length:e+2}return i+1}function vt(n,i){let e=n[i];if(e==='"'||e==="'")return h(n,i);if(e==="`")return d(n,i);if(e==="/"&&(n[i+1]==="/"||n[i+1]==="*"))return b(n,i);return i}function St(n){let i=n.split(""),e=0;while(e<n.length){let s=vt(n,e);if(s>e){for(let t=e;t<s;t++)if(i[t]!==`
4
- `&&i[t]!=="\r")i[t]=" ";e=s;continue}e++}return i.join("")}function a(n,i,e,s){let t=0,r=i;while(r<n.length){let l=n[r];if(l==='"'||l==="'"){r=h(n,r);continue}if(l==="`"){r=d(n,r);continue}if(l==="/"&&(n[r+1]==="/"||n[r+1]==="*")){r=b(n,r);continue}if(l===e)t++;else if(l===s){if(t--,t===0)return r}r++}return-1}function W(n,i){let e=0,s=i;while(s<n.length){let t=n[s];if(t==='"'||t==="'"){s=h(n,s);continue}if(t==="`"){s=d(n,s);continue}if(t==="/"&&(n[s+1]==="/"||n[s+1]==="*")){s=b(n,s);continue}if(t==="="&&n[s+1]===">"){s+=2;continue}if(t==="<")e++;else if(t===">"){if(e--,e===0)return s}s++}return-1}function S(n,i=","){let e=[],s=0,t="",r=0;while(r<n.length){let l=n[r];if(l==='"'||l==="'"){let u=h(n,r);t+=n.slice(r,u),r=u;continue}if(l==="`"){let u=d(n,r);t+=n.slice(r,u),r=u;continue}if(l==="/"&&(n[r+1]==="/"||n[r+1]==="*")){r=b(n,r);continue}if(l==="{"||l==="["||l==="("||l==="<")s++;else if(l==="}"||l==="]"||l===")"||l===">")s--;if(l===i&&s===0){e.push(t),t="",r++;continue}t+=l,r++}if(t.trim()!=="")e.push(t);return e}function O(n){let i=n.trim();if(!i.startsWith("{"))return[];let e=a(i,0,"{","}");if(e===-1)return[];let s=i.slice(1,e),t=[];for(let r of S(s)){let l=-1,u=0;for(let p=0;p<r.length;p++){let c=r[p];if(c==='"'||c==="'"){p=h(r,p)-1;continue}if(c==="`"){p=d(r,p)-1;continue}if(c==="{"||c==="["||c==="("||c==="<")u++;else if(c==="}"||c==="]"||c===")"||c===">")u--;else if(c===":"&&u===0){l=p;break}}if(l!==-1){t.push({key:E(r.slice(0,l).trim()),value:r.slice(l+1).trim(),isMethod:!1});continue}let o=/^([A-Za-z_$][\w$]*|['"][^'"]+['"])\s*\(/.exec(r.trim());if(o){t.push({key:E(o[1]),value:r.trim(),isMethod:!0});continue}let f=r.trim();if(f)t.push({key:E(f),value:"",isMethod:!1})}return t}function E(n){if(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))return n.slice(1,-1);return n}function k(n){return/^[A-Za-z_$][\w$]*$/.test(n)?n:JSON.stringify(n)}function ve(n,i){let e=new RegExp(`\\b${i}\\b`,"g"),s;while((s=e.exec(n))!==null){let t=s.index+s[0].length;while(t<n.length&&/\s/.test(n[t]))t++;let r=null;if(n[t]==="<"){let o=W(n,t);if(o===-1)return null;r=n.slice(t+1,o).trim(),t=o+1;while(t<n.length&&/\s/.test(n[t]))t++}if(n[t]!=="(")continue;let l=a(n,t,"(",")");if(l===-1)return null;let u=S(n.slice(t+1,l));return{generic:r,arg:u.length>0?u[0].trim():null}}return null}function x(n,i){let e=L(n,i);if(!e)return null;return e.kind==="interface"?n.slice(e.bodyStart,e.end):n.slice(e.bodyStart,e.end).trim()}function L(n,i){let s=new RegExp(`\\binterface\\s+${i}\\b[^{]*\\{`,"m").exec(n);if(s){let l=s.index+s[0].length-1,u=a(n,l,"{","}");if(u!==-1)return{kind:"interface",start:s.index,end:u+1,bodyStart:l}}let r=new RegExp(`\\btype\\s+${i}\\b[^=]*=`,"m").exec(n);if(r){let l=r.index+r[0].length,u=0,o=l;while(l<n.length){let f=n[l];if(f==='"'||f==="'"){l=h(n,l);continue}if(f==="`"){l=d(n,l);continue}if(f==="{"||f==="["||f==="("||f==="<")u++;else if(f==="}"||f==="]"||f===")"||f===">")u--;else if((f===";"||f===`
5
- `)&&u===0)break;l++}return{kind:"type",start:r.index,end:l,bodyStart:o}}return null}var C={String:"string",Number:"number",Boolean:"boolean",Array:"unknown[]",Object:"Record<string, unknown>",Function:"(...args: any[]) => any",Symbol:"symbol",Promise:"Promise<unknown>",Date:"Date",BigInt:"bigint"};function V(n){let i=n.search(/\bas\s+PropType\s*</);if(i===-1)return null;let e=n.indexOf("<",i),s=W(n,e);if(s===-1)return null;if(n.slice(s+1).trim()!=="")return null;return n.slice(e+1,s).trim()}function T(n){let i=n.trim(),e=V(i);if(e!==null)return{type:e,optional:!0};if(i==="null")return{type:"unknown",optional:!0};if(i.startsWith("[")){let s=a(i,0,"[","]");if(s!==-1){let t=S(i.slice(1,s)).map((r)=>T(r).type).filter((r)=>r!=="unknown");return{type:t.length>0?[...new Set(t)].join(" | "):"unknown",optional:!0}}}if(i.startsWith("{")){let s=O(i),t=s.find((o)=>o.key==="type"),r=s.find((o)=>o.key==="required"),l=t?T(t.value).type:"unknown",u=!(r&&r.value.trim()==="true");return{type:l,optional:u}}if(C[i])return{type:C[i],optional:!0};if(/^[A-Za-z_$][\w$.]*$/.test(i))return{type:i,optional:!0};return{type:"unknown",optional:!0}}function Ke(n){let i=n.trim();if(i.startsWith("{")){let e=O(i);if(e.length===0)return"{}";return`{ ${e.map((t)=>{if(t.isMethod||t.value==="")return`${k(t.key)}?: unknown`;let r=T(t.value);return`${k(t.key)}${r.optional?"?":""}: ${r.type}`}).join(", ")} }`}if(i.startsWith("[")){let e=a(i,0,"[","]");if(e===-1)return null;let s=S(i.slice(1,e)).map((t)=>E(t.trim())).filter((t)=>t!=="");if(s.length===0)return"{}";return`{ ${s.map((t)=>`${k(t)}?: unknown`).join(", ")} }`}return null}function A(n){let i=n.trim();if(!i.startsWith("["))return null;let e=a(i,0,"[","]");if(e===-1)return null;let s=S(i.slice(1,e)).map((t)=>t.trim());if(s.length===0)return"{}";if(!s.every((t)=>t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')))return"string[]";return`[${s.map((t)=>JSON.stringify(E(t))).join(", ")}]`}function D(n){let i=n.trim();if(!i.startsWith("{"))return null;let e=O(i);if(e.length===0)return"{}";return`{ ${e.map((t)=>`${JSON.stringify(t.key)}: (...args: any[]) => void`).join(", ")} }`}function P(n){return A(n)??D(n)}function I(n){let i=[],e=0,s="",t=0;while(t<n.length){let r=n[t];if(r==='"'||r==="'"){let l=h(n,t);s+=n.slice(t,l),t=l;continue}if(r==="`"){let l=d(n,t);s+=n.slice(t,l),t=l;continue}if(r==="/"&&(n[t+1]==="/"||n[t+1]==="*")){let l=b(n,t);s+=n.slice(t,l),t=l;continue}if(r==="="&&n[t+1]===">"){s+="=>",t+=2;continue}if(r==="{"||r==="["||r==="("||r==="<")e++;else if(r==="}"||r==="]"||r===")"||r===">")e--;if((r===";"||r===","||r===`
6
- `)&&e===0){if(s.trim()!=="")i.push(s.trim());s="",t++;continue}s+=r,t++}if(s.trim()!=="")i.push(s.trim());return i}function N(n){let i=n.trim();if(!i.startsWith("{"))return null;let e=a(i,0,"{","}");if(e===-1||i.slice(e+1).trim()!=="")return null;let s=I(i.slice(1,e));if(s.length===0)return"{}";let t=[];for(let r of s){let l=/^\(\s*\w+\s*:\s*/.exec(r);if(!l)return null;let u=l[0].length,o=r[u];if(o!=="'"&&o!=='"'&&o!=="`")return null;let f=h(r,u),p=r.slice(u+1,f-1),c=a(r,r.indexOf("(",0),"(",")");if(c===-1)return null;let m=r.slice(u,c),w=S(m).slice(1),g=r.slice(c+1).trim();if(g.startsWith(":"))g=g.slice(1).trim();if(g==="")g="void";t.push(`${JSON.stringify(p)}: (${w.map((v)=>v.trim()).join(", ")}) => ${g}`)}return`{ ${t.join(", ")} }`}function $t(n){let i=n;for(let e of["defineProps","defineEmits","defineExpose","defineSlots","defineOptions"])i=z(i,e);return i}function z(n,i){let e=new RegExp(`\\b${i}\\b`,"g"),s=[],t=n,r;while((r=e.exec(n))!==null){let l=n.lastIndexOf(`
2
+ function R(n){return n.endsWith(".vue")}function oa(n){let i={script:null,scriptSetup:null},e=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,s;while((s=e.exec(n))!==null){let t=s[1]||"",r=/lang\s*=\s*["']([^"']+)["']/i.exec(t)?.[1]?.toLowerCase()??"js",l={content:s[2]??"",attrs:t,setup:/\bsetup\b/.test(t),lang:r};if(l.setup)i.scriptSetup=l;else i.script=l}return i}function h(n,i){let e=n[i];i++;while(i<n.length){let s=n[i];if(s==="\\"){i+=2;continue}if(s===e)return i+1;i++}return i}function d(n,i){i++;let e=0;while(i<n.length){let s=n[i];if(s==="\\"){i+=2;continue}if(s==="`"&&e===0)return i+1;if(s==="$"&&n[i+1]==="{"){e++,i+=2;continue}if(s==="}"){if(e>0)e--;i++;continue}i++}return i}function b(n,i){if(n[i+1]==="/"){let e=n.indexOf(`
3
+ `,i+2);return e===-1?n.length:e+1}if(n[i+1]==="*"){let e=n.indexOf("*/",i+2);return e===-1?n.length:e+2}return i+1}function Ct(n,i){let e=n[i];if(e==='"'||e==="'")return h(n,i);if(e==="`")return d(n,i);if(e==="/"&&(n[i+1]==="/"||n[i+1]==="*"))return b(n,i);return i}function vt(n){let i=n.split(""),e=0;while(e<n.length){let s=Ct(n,e);if(s>e){for(let t=e;t<s;t++)if(i[t]!==`
4
+ `&&i[t]!=="\r")i[t]=" ";e=s;continue}e++}return i.join("")}function a(n,i,e,s){let t=0,r=i;while(r<n.length){let l=n[r];if(l==='"'||l==="'"){r=h(n,r);continue}if(l==="`"){r=d(n,r);continue}if(l==="/"&&(n[r+1]==="/"||n[r+1]==="*")){r=b(n,r);continue}if(l===e)t++;else if(l===s){if(t--,t===0)return r}r++}return-1}function W(n,i){let e=0,s=i;while(s<n.length){let t=n[s];if(t==='"'||t==="'"){s=h(n,s);continue}if(t==="`"){s=d(n,s);continue}if(t==="/"&&(n[s+1]==="/"||n[s+1]==="*")){s=b(n,s);continue}if(t==="="&&n[s+1]===">"){s+=2;continue}if(t==="<")e++;else if(t===">"){if(e--,e===0)return s}s++}return-1}function S(n,i=","){let e=[],s=0,t="",r=0;while(r<n.length){let l=n[r];if(l==='"'||l==="'"){let u=h(n,r);t+=n.slice(r,u),r=u;continue}if(l==="`"){let u=d(n,r);t+=n.slice(r,u),r=u;continue}if(l==="/"&&(n[r+1]==="/"||n[r+1]==="*")){r=b(n,r);continue}if(l==="{"||l==="["||l==="("||l==="<")s++;else if(l==="}"||l==="]"||l===")"||l===">")s--;if(l===i&&s===0){e.push(t),t="",r++;continue}t+=l,r++}if(t.trim()!=="")e.push(t);return e}function O(n){let i=n.trim();if(!i.startsWith("{"))return[];let e=a(i,0,"{","}");if(e===-1)return[];let s=i.slice(1,e),t=[];for(let r of S(s)){let l=-1,u=0;for(let p=0;p<r.length;p++){let c=r[p];if(c==='"'||c==="'"){p=h(r,p)-1;continue}if(c==="`"){p=d(r,p)-1;continue}if(c==="{"||c==="["||c==="("||c==="<")u++;else if(c==="}"||c==="]"||c===")"||c===">")u--;else if(c===":"&&u===0){l=p;break}}if(l!==-1){t.push({key:E(r.slice(0,l).trim()),value:r.slice(l+1).trim(),isMethod:!1});continue}let o=/^([A-Za-z_$][\w$]*|['"][^'"]+['"])\s*\(/.exec(r.trim());if(o){t.push({key:E(o[1]),value:r.trim(),isMethod:!0});continue}let f=r.trim();if(f)t.push({key:E(f),value:"",isMethod:!1})}return t}function E(n){if(n.startsWith("'")&&n.endsWith("'")||n.startsWith('"')&&n.endsWith('"'))return n.slice(1,-1);return n}function k(n){return/^[A-Za-z_$][\w$]*$/.test(n)?n:JSON.stringify(n)}function $e(n,i){let e=new RegExp(`\\b${i}\\b`,"g"),s;while((s=e.exec(n))!==null){let t=s.index+s[0].length;while(t<n.length&&/\s/.test(n[t]))t++;let r=null;if(n[t]==="<"){let o=W(n,t);if(o===-1)return null;r=n.slice(t+1,o).trim(),t=o+1;while(t<n.length&&/\s/.test(n[t]))t++}if(n[t]!=="(")continue;let l=a(n,t,"(",")");if(l===-1)return null;let u=S(n.slice(t+1,l));return{generic:r,arg:u.length>0?u[0].trim():null}}return null}function x(n,i){let e=L(n,i);if(!e)return null;return e.kind==="interface"?n.slice(e.bodyStart,e.end):n.slice(e.bodyStart,e.end).trim()}function L(n,i){let s=new RegExp(`\\binterface\\s+${i}\\b[^{]*\\{`,"m").exec(n);if(s){let l=s.index+s[0].length-1,u=a(n,l,"{","}");if(u!==-1)return{kind:"interface",start:s.index,end:u+1,bodyStart:l}}let r=new RegExp(`\\btype\\s+${i}\\b[^=]*=`,"m").exec(n);if(r){let l=r.index+r[0].length,u=0,o=l;while(l<n.length){let f=n[l];if(f==='"'||f==="'"){l=h(n,l);continue}if(f==="`"){l=d(n,l);continue}if(f==="{"||f==="["||f==="("||f==="<")u++;else if(f==="}"||f==="]"||f===")"||f===">")u--;else if((f===";"||f===`
5
+ `)&&u===0)break;l++}return{kind:"type",start:r.index,end:l,bodyStart:o}}return null}var C={String:"string",Number:"number",Boolean:"boolean",Array:"unknown[]",Object:"Record<string, unknown>",Function:"(...args: any[]) => any",Symbol:"symbol",Promise:"Promise<unknown>",Date:"Date",BigInt:"bigint"};function V(n){let i=n.search(/\bas\s+PropType\s*</);if(i===-1)return null;let e=n.indexOf("<",i),s=W(n,e);if(s===-1)return null;if(n.slice(s+1).trim()!=="")return null;return n.slice(e+1,s).trim()}function T(n){let i=n.trim(),e=V(i);if(e!==null)return{type:e,optional:!0};if(i==="null")return{type:"unknown",optional:!0};if(i.startsWith("[")){let s=a(i,0,"[","]");if(s!==-1){let t=S(i.slice(1,s)).map((r)=>T(r).type).filter((r)=>r!=="unknown");return{type:t.length>0?[...new Set(t)].join(" | "):"unknown",optional:!0}}}if(i.startsWith("{")){let s=O(i),t=s.find((o)=>o.key==="type"),r=s.find((o)=>o.key==="required"),l=t?T(t.value).type:"unknown",u=!(r&&r.value.trim()==="true");return{type:l,optional:u}}if(C[i])return{type:C[i],optional:!0};if(/^[A-Za-z_$][\w$.]*$/.test(i))return{type:i,optional:!0};return{type:"unknown",optional:!0}}function qe(n){let i=n.trim();if(i.startsWith("{")){let e=O(i);if(e.length===0)return"{}";return`{ ${e.map((t)=>{if(t.isMethod||t.value==="")return`${k(t.key)}?: unknown`;let r=T(t.value);return`${k(t.key)}${r.optional?"?":""}: ${r.type}`}).join(", ")} }`}if(i.startsWith("[")){let e=a(i,0,"[","]");if(e===-1)return null;let s=S(i.slice(1,e)).map((t)=>E(t.trim())).filter((t)=>t!=="");if(s.length===0)return"{}";return`{ ${s.map((t)=>`${k(t)}?: unknown`).join(", ")} }`}return null}function A(n){let i=n.trim();if(!i.startsWith("["))return null;let e=a(i,0,"[","]");if(e===-1)return null;let s=S(i.slice(1,e)).map((t)=>t.trim());if(s.length===0)return"{}";if(!s.every((t)=>t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')))return"string[]";return`[${s.map((t)=>JSON.stringify(E(t))).join(", ")}]`}function D(n){let i=n.trim();if(!i.startsWith("{"))return null;let e=O(i);if(e.length===0)return"{}";return`{ ${e.map((t)=>`${JSON.stringify(t.key)}: (...args: any[]) => void`).join(", ")} }`}function P(n){return A(n)??D(n)}function I(n){let i=[],e=0,s="",t=0;while(t<n.length){let r=n[t];if(r==='"'||r==="'"){let l=h(n,t);s+=n.slice(t,l),t=l;continue}if(r==="`"){let l=d(n,t);s+=n.slice(t,l),t=l;continue}if(r==="/"&&(n[t+1]==="/"||n[t+1]==="*")){let l=b(n,t);s+=n.slice(t,l),t=l;continue}if(r==="="&&n[t+1]===">"){s+="=>",t+=2;continue}if(r==="{"||r==="["||r==="("||r==="<")e++;else if(r==="}"||r==="]"||r===")"||r===">")e--;if((r===";"||r===","||r===`
6
+ `)&&e===0){if(s.trim()!=="")i.push(s.trim());s="",t++;continue}s+=r,t++}if(s.trim()!=="")i.push(s.trim());return i}function N(n){let i=n.trim();if(!i.startsWith("{"))return null;let e=a(i,0,"{","}");if(e===-1||i.slice(e+1).trim()!=="")return null;let s=I(i.slice(1,e));if(s.length===0)return"{}";let t=[];for(let r of s){let l=/^\(\s*\w+\s*:\s*/.exec(r);if(!l)return null;let u=l[0].length,o=r[u];if(o!=="'"&&o!=='"'&&o!=="`")return null;let f=h(r,u),p=r.slice(u+1,f-1),c=a(r,r.indexOf("(",0),"(",")");if(c===-1)return null;let m=r.slice(u,c),w=S(m).slice(1),g=r.slice(c+1).trim();if(g.startsWith(":"))g=g.slice(1).trim();if(g==="")g="void";t.push(`${JSON.stringify(p)}: (${w.map((v)=>v.trim()).join(", ")}) => ${g}`)}return`{ ${t.join(", ")} }`}function St(n){let i=n;for(let e of["defineProps","defineEmits","defineExpose","defineSlots","defineOptions"])i=z(i,e);return i}function z(n,i){let e=new RegExp(`\\b${i}\\b`,"g"),s=[],t=n,r;while((r=e.exec(n))!==null){let l=n.lastIndexOf(`
7
7
  `,r.index)+1,u=n.slice(l,r.index),o=/^\s*(?:(?:const|let|var)\s+[A-Za-z_$][\w$]*\s*(?::[^=]+)?=\s*)?(withDefaults\s*\(\s*)?$/.exec(u);if(!o)continue;let f=r.index+r[0].length;while(f<n.length&&/\s/.test(n[f]))f++;if(n[f]==="<"){let m=W(n,f);if(m===-1)continue;f=m+1;while(f<n.length&&/\s/.test(n[f]))f++}if(n[f]!=="(")continue;let p=a(n,f,"(",")");if(p===-1)continue;if(o[1]){let m=l+u.length-o[1].length,w=n.indexOf("(",m);if(w!==-1){let g=a(n,w,"(",")");if(g!==-1)p=g}}let c=p+1;while(c<n.length&&n[c]!==`
8
8
  `&&/\s|;/.test(n[c]))c++;if(n[c]===`
9
- `)c++;s.push([l,c])}for(let l=s.length-1;l>=0;l--)t=t.slice(0,s[l][0])+t.slice(s[l][1]);return t}function Et(n){let i=Z(n);if(i!==-1){let e=/^export\s+default\b/.exec(n.slice(i))?.[0];if(!e)return{options:null,script:n,passthrough:!1};let s=i+e.length;while(s<n.length&&/\s/.test(n[s]))s++;let t=-1,r=-1,l=-1;if(n[s]==="{")t=s,r=a(n,s,"{","}"),l=r;else if(n.startsWith("defineComponent",s)){let f=n.indexOf("(",s);if(f!==-1){let p=f+1;while(p<n.length&&/\s/.test(n[p]))p++;if(n[p]==="{")t=p,r=a(n,p,"{","}"),l=a(n,f,"(",")")}}if(t===-1||r===-1||l===-1)return{options:null,script:n,passthrough:!0};let u=l+1;if(n[u]===";")u++;let o=(n.slice(0,i)+n.slice(u)).trim();return{options:n.slice(t,r+1),script:o,passthrough:!1}}return{options:null,script:n,passthrough:!1}}function Z(n){let i=0,e=0;while(e<n.length){let s=n[e];if(s==='"'||s==="'"){e=h(n,e);continue}if(s==="`"){e=d(n,e);continue}if(s==="/"&&(n[e+1]==="/"||n[e+1]==="*")){e=b(n,e);continue}if(s==="{"||s==="["||s==="(")i++;else if(s==="}"||s==="]"||s===")")i=Math.max(0,i-1);else if(i===0&&n.startsWith("export",e)){let t=e===0?"":n[e-1],r=n[e+6]??"";if(!/[\w$]/.test(t)&&!/[\w$]/.test(r)){if(/^export\s+default\b/.exec(n.slice(e)))return e}}e++}return-1}function qe(n,i){let e=O(n).find((s)=>s.key===i);return e&&e.value!==""?e.value:null}function Je(n,i){let e=q(n),s=n;for(let t=e.length-1;t>=0;t--){let r=e[t],l=s.slice(0,r.start)+s.slice(r.end);if(B(l,r.name))continue;if(new RegExp(`\\btypeof\\s+${r.name}\\b`).test(i))continue;s=l}return s}function B(n,i){let e=0;while(e<n.length){let s=n[e];if(s==='"'||s==="'"){e=h(n,e);continue}if(s==="`"){e=d(n,e);continue}if(s==="/"&&(n[e+1]==="/"||n[e+1]==="*")){e=b(n,e);continue}if(/[A-Za-z_$]/.test(s)){let t=e+1;while(t<n.length&&/[\w$]/.test(n[t]))t++;if(n.slice(e,t)===i)return!0;e=t;continue}e++}return!1}function q(n){let i=[],e=J(n),s=/^[ \t]*(const|let|var|(?:async[ \t]+)?function)[ \t]+([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=?/gm,t;while((t=s.exec(n))!==null){let r=n.lastIndexOf(`
9
+ `)c++;s.push([l,c])}for(let l=s.length-1;l>=0;l--)t=t.slice(0,s[l][0])+t.slice(s[l][1]);return t}function $t(n){let i=Z(n);if(i!==-1){let e=/^export\s+default\b/.exec(n.slice(i))?.[0];if(!e)return{options:null,script:n,passthrough:!1};let s=i+e.length;while(s<n.length&&/\s/.test(n[s]))s++;let t=-1,r=-1,l=-1;if(n[s]==="{")t=s,r=a(n,s,"{","}"),l=r;else if(n.startsWith("defineComponent",s)){let f=n.indexOf("(",s);if(f!==-1){let p=f+1;while(p<n.length&&/\s/.test(n[p]))p++;if(n[p]==="{")t=p,r=a(n,p,"{","}"),l=a(n,f,"(",")")}}if(t===-1||r===-1||l===-1)return{options:null,script:n,passthrough:!0};let u=l+1;if(n[u]===";")u++;let o=(n.slice(0,i)+n.slice(u)).trim();return{options:n.slice(t,r+1),script:o,passthrough:!1}}return{options:null,script:n,passthrough:!1}}function Z(n){let i=0,e=0;while(e<n.length){let s=n[e];if(s==='"'||s==="'"){e=h(n,e);continue}if(s==="`"){e=d(n,e);continue}if(s==="/"&&(n[e+1]==="/"||n[e+1]==="*")){e=b(n,e);continue}if(s==="{"||s==="["||s==="(")i++;else if(s==="}"||s==="]"||s===")")i=Math.max(0,i-1);else if(i===0&&n.startsWith("export",e)){let t=e===0?"":n[e-1],r=n[e+6]??"";if(!/[\w$]/.test(t)&&!/[\w$]/.test(r)){if(/^export\s+default\b/.exec(n.slice(e)))return e}}e++}return-1}function Je(n,i){let e=O(n).find((s)=>s.key===i);return e&&e.value!==""?e.value:null}function Ye(n,i){let e=q(n),s=n;for(let t=e.length-1;t>=0;t--){let r=e[t],l=s.slice(0,r.start)+s.slice(r.end);if(B(l,r.name))continue;if(new RegExp(`\\btypeof\\s+${r.name}\\b`).test(i))continue;s=l}return s}function B(n,i){let e=0;while(e<n.length){let s=n[e];if(s==='"'||s==="'"){e=h(n,e);continue}if(s==="`"){e=d(n,e);continue}if(s==="/"&&(n[e+1]==="/"||n[e+1]==="*")){e=b(n,e);continue}if(/[A-Za-z_$]/.test(s)){let t=e+1;while(t<n.length&&/[\w$]/.test(n[t]))t++;if(n.slice(e,t)===i)return!0;e=t;continue}e++}return!1}function q(n){let i=[],e=J(n),s=/^[ \t]*(const|let|var|(?:async[ \t]+)?function)[ \t]+([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=?/gm,t;while((t=s.exec(n))!==null){let r=n.lastIndexOf(`
10
10
  `,t.index)+1;if(!e.has(r))continue;if(/\bexport\b/.test(n.slice(r,t.index)))continue;let l=t[1],u=t[2],o=t.index+t[0].length,f=-1;if(l.endsWith("function")){let p=n.indexOf("(",o);if(p===-1)continue;let c=a(n,p,"(",")");if(c===-1)continue;o=c+1;while(o<n.length&&/\s/.test(n[o]))o++;if(n[o]===":")while(o<n.length&&n[o]!=="{"&&n[o]!==`
11
11
  `)o++;while(o<n.length&&/\s/.test(n[o])&&n[o]!==`
12
12
  `)o++;if(n[o]!=="{")continue;let m=a(n,o,"{","}");if(m===-1)continue;f=m+1}else{let p=0;while(o<n.length){let c=n[o];if(c==='"'||c==="'"){o=h(n,o);continue}if(c==="`"){o=d(n,o);continue}if(c==="/"&&(n[o+1]==="/"||n[o+1]==="*")){o=b(n,o);continue}if(c==="{"||c==="["||c==="(")p++;else if(c==="}"||c==="]"||c===")")p--;else if(c===";"&&p===0){f=o+1;break}else if(c===`
13
13
  `&&p===0){f=o;break}o++}if(f===-1)f=n.length}if(n[f]===`
14
14
  `)f++;i.push({name:u,start:t.index,end:f})}return i}function J(n){let i=new Set([0]),e=0,s=0;while(s<n.length){let t=n[s];if(t==='"'||t==="'"){s=h(n,s);continue}if(t==="`"){s=d(n,s);continue}if(t==="/"&&(n[s+1]==="/"||n[s+1]==="*")){s=b(n,s);continue}if(t==="{"||t==="["||t==="(")e++;else if(t==="}"||t==="]"||t===")")e=Math.max(0,e-1);if(t===`
15
- `&&e===0)i.add(s+1);s++}return i}function Ye(n,i,e){let s=n.indexOf(e);if(s===-1)return n;let t=n.lastIndexOf(`
16
- `,s)+1;if(/\bexport\b/.test(n.slice(t,s)))return n;let r=n.slice(0,s)+n.slice(s+e.length);if(new RegExp(`\\b${i}\\b`).test(r))return n;return r}function kt(n){let i="",e=0,s=()=>{for(let r=i.length-1;r>=0;r--)if(!/\s/.test(i[r]))return i[r];return""},t=(r)=>{for(let l=r;l<n.length;l++)if(!/\s/.test(n[l]))return n[l];return""};while(e<n.length){let r=n[e];if(r==='"'||r==="'"){let l=h(n,e);i+=n.slice(e,l),e=l;continue}if(r==="`"){let l=d(n,e);i+=n.slice(e,l),e=l;continue}if(r==="/"&&n[e+1]==="*"){let l=b(n,e);i+=n.slice(e,l).replace(/\s*\n\s*/g," "),e=l;continue}if(r==="/"&&n[e+1]==="/"){let l=e+2;while(l<n.length&&n[l]!==`
15
+ `&&e===0)i.add(s+1);s++}return i}function Xe(n,i,e){let s=n.indexOf(e);if(s===-1)return n;let t=n.lastIndexOf(`
16
+ `,s)+1;if(/\bexport\b/.test(n.slice(t,s)))return n;let r=n.slice(0,s)+n.slice(s+e.length);if(new RegExp(`\\b${i}\\b`).test(r))return n;return r}function Et(n){let i="",e=0,s=()=>{for(let r=i.length-1;r>=0;r--)if(!/\s/.test(i[r]))return i[r];return""},t=(r)=>{for(let l=r;l<n.length;l++)if(!/\s/.test(n[l]))return n[l];return""};while(e<n.length){let r=n[e];if(r==='"'||r==="'"){let l=h(n,e);i+=n.slice(e,l),e=l;continue}if(r==="`"){let l=d(n,e);i+=n.slice(e,l),e=l;continue}if(r==="/"&&n[e+1]==="*"){let l=b(n,e);i+=n.slice(e,l).replace(/\s*\n\s*/g," "),e=l;continue}if(r==="/"&&n[e+1]==="/"){let l=e+2;while(l<n.length&&n[l]!==`
17
17
  `)l++;let u=n.slice(e+2,l).trim();if(u!==""&&!u.includes("*/"))i+=`/* ${u} */`;e=l;continue}if(r===`
18
- `){let l=s(),u=t(e+1);if(l===""||u===""){e++;continue}let o=F(i);if(!o&&("{;,(<:=[".includes(l)||"}),]>;|&".includes(u))){if(!i.endsWith(" ")&&!i.endsWith(";"))i+=" "}else if(o){if(!i.endsWith(" "))i+=" "}else{if(i.endsWith(" "))i=i.slice(0,-1);i+="; "}e++;while(e<n.length&&(n[e]===" "||n[e]==="\t"))e++;continue}i+=r,e++}return i}function F(n){let i=n.length-1;while(i>=0&&/\s/.test(n[i]))i--;if(i<1||n[i]!=="/"||n[i-1]!=="*")return!1;let e=n.lastIndexOf("/*",i);if(e===-1)return!1;for(let s=e-1;s>=0;s--){let t=n[s];if(/\s/.test(t))continue;return"{;,(<:".includes(t)}return!0}function Xe(n,i){let e=[n,i].filter((s)=>s!==null);for(let s of e){let t=ve(s,"defineProps");if(!t)continue;if(t.generic){let r=t.generic;if(r.startsWith("{"))return{type:r};if(/^[A-Za-z_$][\w$]*$/.test(r)){for(let l of e){let u=L(l,r);if(!u)continue;let o=x(l,r);if(o===null)continue;return{type:o,inlinedLocal:{name:r,declText:l.slice(u.start,u.end)}}}return{type:r}}return{type:r}}if(t.arg){let r=Ke(t.arg);if(r!==null)return{type:r}}}return null}function Tt(n,i){let e=[n,i].filter((s)=>s!==null);for(let s of e){let t=ve(s,"defineEmits");if(!t)continue;if(t.generic)return N(t.generic)??t.generic;if(t.arg){let r=P(t.arg);if(r!==null)return r}}return null}function At(n,i){let e=[n,i].filter((s)=>s!==null);for(let s of e){let t=ve(s,"defineExpose");if(!t||!t.arg||!t.arg.startsWith("{"))continue;let r=O(t.arg);if(r.length===0)return null;return`{ ${r.map((u)=>{if(u.value===""&&/^[A-Za-z_$][\w$]*$/.test(u.key))return`${k(u.key)}: typeof ${u.key}`;let o=u.isMethod||/=>|^\s*function\b/.test(u.value);return`${k(u.key)}: ${o?"(...args: any[]) => any":"unknown"}`}).join(", ")} }`}return null}function M(n){let i=Yo(n),e="",s=null,t=null;if(i.script){let y=Et(i.script.content);if(y.passthrough)return i.scriptSetup?`${i.script.content}
19
- ${i.scriptSetup.content}`:i.script.content;if(e=y.script,y.options){let _=qe(y.options,"props");if(_)s=Ke(_);let j=qe(y.options,"emits");if(j)t=P(j)}}let r=i.scriptSetup?.content??null,l=r!==null?$t(r):null,u=Xe(r,r!==null?null:e),o=u?.type??s??"{}",f=Tt(r,null)??t,p=At(r,null),c=u?.inlinedLocal;if(c){if(e=Ye(e,c.name,c.declText),l!==null)l=Ye(l,c.name,c.declText)}let m=[o,p??"{}"];if(f)m.push("{}","{}","{}","{}","{}",f);let w=kt(`DefineComponent<${m.join(", ")}>`),g=[],v=Je(e,w);if(v.trim()!=="")g.push(v);if(l&&l.trim()!==""){let y=Je(l,w);if(y.trim()!=="")g.push(y)}return g.push("import type { DefineComponent } from 'vue'"),g.push(`type __DtsxComponentType = ${w}`),g.push("const __dtsx_component__: __DtsxComponentType = null as unknown as __DtsxComponentType"),g.push("export default __dtsx_component__"),g.join(`
18
+ `){let l=s(),u=t(e+1);if(l===""||u===""){e++;continue}let o=F(i);if(!o&&("{;,(<:=[".includes(l)||"}),]>;|&".includes(u))){if(!i.endsWith(" ")&&!i.endsWith(";"))i+=" "}else if(o){if(!i.endsWith(" "))i+=" "}else{if(i.endsWith(" "))i=i.slice(0,-1);i+="; "}e++;while(e<n.length&&(n[e]===" "||n[e]==="\t"))e++;continue}i+=r,e++}return i}function F(n){let i=n.length-1;while(i>=0&&/\s/.test(n[i]))i--;if(i<1||n[i]!=="/"||n[i-1]!=="*")return!1;let e=n.lastIndexOf("/*",i);if(e===-1)return!1;for(let s=e-1;s>=0;s--){let t=n[s];if(/\s/.test(t))continue;return"{;,(<:".includes(t)}return!0}function Ze(n,i){let e=[n,i].filter((s)=>s!==null);for(let s of e){let t=$e(s,"defineProps");if(!t)continue;if(t.generic){let r=t.generic;if(r.startsWith("{"))return{type:r};if(/^[A-Za-z_$][\w$]*$/.test(r)){for(let l of e){let u=L(l,r);if(!u)continue;let o=x(l,r);if(o===null)continue;return{type:o,inlinedLocal:{name:r,declText:l.slice(u.start,u.end)}}}return{type:r}}return{type:r}}if(t.arg){let r=qe(t.arg);if(r!==null)return{type:r}}}return null}function kt(n,i){let e=[n,i].filter((s)=>s!==null);for(let s of e){let t=$e(s,"defineEmits");if(!t)continue;if(t.generic)return N(t.generic)??t.generic;if(t.arg){let r=P(t.arg);if(r!==null)return r}}return null}function Tt(n,i){let e=[n,i].filter((s)=>s!==null);for(let s of e){let t=$e(s,"defineExpose");if(!t||!t.arg||!t.arg.startsWith("{"))continue;let r=O(t.arg);if(r.length===0)return null;return`{ ${r.map((u)=>{if(u.value===""&&/^[A-Za-z_$][\w$]*$/.test(u.key))return`${k(u.key)}: typeof ${u.key}`;let o=u.isMethod||/=>|^\s*function\b/.test(u.value);return`${k(u.key)}: ${o?"(...args: any[]) => any":"unknown"}`}).join(", ")} }`}return null}function M(n){let i=oa(n),e="",s=null,t=null;if(i.script){let y=$t(i.script.content);if(y.passthrough)return i.scriptSetup?`${i.script.content}
19
+ ${i.scriptSetup.content}`:i.script.content;if(e=y.script,y.options){let _=Je(y.options,"props");if(_)s=qe(_);let j=Je(y.options,"emits");if(j)t=P(j)}}let r=i.scriptSetup?.content??null,l=r!==null?St(r):null,u=Ze(r,r!==null?null:e),o=u?.type??s??"{}",f=kt(r,null)??t,p=Tt(r,null),c=u?.inlinedLocal;if(c){if(e=Xe(e,c.name,c.declText),l!==null)l=Xe(l,c.name,c.declText)}let m=[o,p??"{}"];if(f)m.push("{}","{}","{}","{}","{}",f);let w=Et(`DefineComponent<${m.join(", ")}>`),g=[],v=Ye(e,w);if(v.trim()!=="")g.push(v);if(l&&l.trim()!==""){let y=Ye(l,w);if(y.trim()!=="")g.push(y)}return g.push("import type { DefineComponent } from 'vue'"),g.push(`type __DtsxComponentType = ${w}`),g.push("const __dtsx_component__: __DtsxComponentType = null as unknown as __DtsxComponentType"),g.push("export default __dtsx_component__"),g.join(`
20
20
  `)}
21
- export{R,Yo,vt,St,a,ve,Ke,$t,Et,qe,Je,Ye,kt,Xe,Tt,At,M};
21
+ export{R,oa,Ct,vt,a,$e,qe,St,$t,Je,Ye,Xe,Et,Ze,kt,Tt,M};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{r}from"./chunk-qnf4byak.js";import{l}from"./chunk-t1jtn2r0.js";import{existsSync as v}from"fs";import{readFile as D}from"fs/promises";import{dirname as N,join as k,resolve as S}from"path";async function Vr(e,o=process.cwd()){let i=new Map;for(let t of e){let n=S(o,t),s=await F(n,o);i.set(n,{path:n,dependencies:s,dependents:new Set,state:"pending"})}for(let[t,n]of i)for(let s of n.dependencies){let c=i.get(s);if(c)c.dependents.add(t)}return i}async function F(e,o){let i=new Set;try{let t=await D(e,"utf-8"),n=N(e);for(let s of r(t,e,!1)){let c=s.source;if(!c||!c.startsWith(".")&&!c.startsWith("/"))continue;let a=z(c,n,o);if(a)i.add(a)}}catch{}return i}function z(e,o,i){let t=S(o,e);if(/\.(?:ts|tsx|mts|cts)$/.test(e))return t.includes("node_modules")?null:t;let n=[".ts",".tsx",".mts",".cts"];for(let c of n){let a=`${t}${c}`;if(v(a))return a}for(let c of n){let a=k(t,`index${c}`);if(v(a))return a}let s=`${t}.ts`;return s.includes("node_modules")?null:s}function G(e){let o=[];for(let[i,t]of e){if(t.state!=="pending")continue;let n=!0;for(let s of t.dependencies){let c=e.get(s);if(c&&c.state!=="completed"){n=!1;break}}if(n)o.push(i)}return o}async function I(e,o={}){let i=await D(e,"utf-8"),t=o.keepComments??!0,n=r(i,e,t,o.isolatedDeclarations??!1);return l(n,{filePath:e,sourceCode:i,declarations:n},t,o.importOrder)}async function ro(e,o={}){let i=performance.now(),{maxConcurrency:t=4,rootDir:n=process.cwd(),config:s={},onProgress:c,onError:a}=o,g=await Vr(e,n),w=new Map,P=new Map,h=[],x=0,u=0,m=0,b=g.size;while(m<b){let y=G(g);if(y.length===0){let f=[...g.values()].filter((d)=>d.state==="pending");if(f.length>0)for(let d of f)d.state="failed",d.error=Error("Circular dependency detected or dependency failed"),P.set(d.path,d.error),m++;break}let C=y.slice(0,t-u);for(let f of C){let d=g.get(f);d.state="processing",u++}x=Math.max(x,u);let E=C.map(async(f)=>{let d=g.get(f),M=performance.now();try{let p=await I(f,s);d.state="completed",d.result=p,d.duration=performance.now()-M,w.set(f,p),h.push(f)}catch(p){if(d.state="failed",d.error=p instanceof Error?p:Error(String(p)),d.duration=performance.now()-M,P.set(f,d.error),a&&!a(f,d.error))throw Error("Processing aborted by error handler")}finally{u--,m++,c?.(m,b,f)}});await Promise.all(E)}return{success:w,failed:P,totalTimeMs:performance.now()-i,maxConcurrent:x,processingOrder:h}}function io(e){let o=[],i=new Set,t=new Set;function n(s){if(i.has(s))return;if(t.has(s))return;t.add(s);let c=e.get(s);if(c){for(let a of c.dependencies)if(e.has(a))n(a)}t.delete(s),i.add(s),o.push(s)}for(let s of e.keys())n(s);return o}function Ur(e){let o=[];for(let[i,t]of e){let n=!1;for(let s of t.dependencies)if(e.has(s)){n=!0;break}if(!n)o.push(i)}return o}function zr(e){let o=[],i=new Set;while(i.size<e.size){let t=[];for(let[n,s]of e){if(i.has(n))continue;let c=!0;for(let a of s.dependencies)if(e.has(a)&&!i.has(a)){c=!1;break}if(c)t.push(n)}if(t.length===0){for(let n of e.keys())if(!i.has(n))t.push(n)}for(let n of t)i.add(n);o.push(t)}return o}function so(e){let o=zr(e),i=Ur(e),t=Math.max(...o.map((s)=>s.length)),n=e.size/o.length;return{totalFiles:e.size,independentFiles:i.length,maxParallelism:t,levels:o.length,estimatedSpeedup:n}}
3
- export{Vr,ro,io,Ur,zr,so};
2
+ import{r}from"./chunk-jcckwgb9.js";import{l}from"./chunk-y1g6v96c.js";import{existsSync as v}from"fs";import{readFile as D}from"fs/promises";import{dirname as N,join as k,resolve as S}from"path";async function ur(e,o=process.cwd()){let i=new Map;for(let t of e){let n=S(o,t),s=await F(n,o);i.set(n,{path:n,dependencies:s,dependents:new Set,state:"pending"})}for(let[t,n]of i)for(let s of n.dependencies){let c=i.get(s);if(c)c.dependents.add(t)}return i}async function F(e,o){let i=new Set;try{let t=await D(e,"utf-8"),n=N(e);for(let s of r(t,e,!1)){let c=s.source;if(!c||!c.startsWith(".")&&!c.startsWith("/"))continue;let a=z(c,n,o);if(a)i.add(a)}}catch{}return i}function z(e,o,i){let t=S(o,e);if(/\.(?:ts|tsx|mts|cts)$/.test(e))return t.includes("node_modules")?null:t;let n=[".ts",".tsx",".mts",".cts"];for(let c of n){let a=`${t}${c}`;if(v(a))return a}for(let c of n){let a=k(t,`index${c}`);if(v(a))return a}let s=`${t}.ts`;return s.includes("node_modules")?null:s}function G(e){let o=[];for(let[i,t]of e){if(t.state!=="pending")continue;let n=!0;for(let s of t.dependencies){let c=e.get(s);if(c&&c.state!=="completed"){n=!1;break}}if(n)o.push(i)}return o}async function I(e,o={}){let i=await D(e,"utf-8"),t=o.keepComments??!0,n=r(i,e,t,o.isolatedDeclarations??!1);return l(n,{filePath:e,sourceCode:i,declarations:n},t,o.importOrder)}async function Xi(e,o={}){let i=performance.now(),{maxConcurrency:t=4,rootDir:n=process.cwd(),config:s={},onProgress:c,onError:a}=o,g=await ur(e,n),w=new Map,P=new Map,h=[],x=0,u=0,m=0,b=g.size;while(m<b){let y=G(g);if(y.length===0){let f=[...g.values()].filter((d)=>d.state==="pending");if(f.length>0)for(let d of f)d.state="failed",d.error=Error("Circular dependency detected or dependency failed"),P.set(d.path,d.error),m++;break}let C=y.slice(0,t-u);for(let f of C){let d=g.get(f);d.state="processing",u++}x=Math.max(x,u);let E=C.map(async(f)=>{let d=g.get(f),M=performance.now();try{let p=await I(f,s);d.state="completed",d.result=p,d.duration=performance.now()-M,w.set(f,p),h.push(f)}catch(p){if(d.state="failed",d.error=p instanceof Error?p:Error(String(p)),d.duration=performance.now()-M,P.set(f,d.error),a&&!a(f,d.error))throw Error("Processing aborted by error handler")}finally{u--,m++,c?.(m,b,f)}});await Promise.all(E)}return{success:w,failed:P,totalTimeMs:performance.now()-i,maxConcurrent:x,processingOrder:h}}function Zi(e){let o=[],i=new Set,t=new Set;function n(s){if(i.has(s))return;if(t.has(s))return;t.add(s);let c=e.get(s);if(c){for(let a of c.dependencies)if(e.has(a))n(a)}t.delete(s),i.add(s),o.push(s)}for(let s of e.keys())n(s);return o}function fr(e){let o=[];for(let[i,t]of e){let n=!1;for(let s of t.dependencies)if(e.has(s)){n=!0;break}if(!n)o.push(i)}return o}function dr(e){let o=[],i=new Set;while(i.size<e.size){let t=[];for(let[n,s]of e){if(i.has(n))continue;let c=!0;for(let a of s.dependencies)if(e.has(a)&&!i.has(a)){c=!1;break}if(c)t.push(n)}if(t.length===0){for(let n of e.keys())if(!i.has(n))t.push(n)}for(let n of t)i.add(n);o.push(t)}return o}function Qi(e){let o=dr(e),i=fr(e),t=Math.max(...o.map((s)=>s.length)),n=e.size/o.length;return{totalFiles:e.size,independentFiles:i.length,maxParallelism:t,levels:o.length,estimatedSpeedup:n}}
3
+ export{ur,Xi,Zi,fr,dr,Qi};
@@ -1,10 +1,10 @@
1
1
  // @bun
2
- import{r}from"./chunk-qnf4byak.js";import{existsSync as j,mkdirSync as N,readFileSync as z,writeFileSync as G}from"fs";import{dirname as K,relative as L,resolve as _}from"path";async function vi(t,e,n){let u=new Map,f=[],x=new Set,D=0,w=0,S=0,C=[];for(let i of t){let o=e.get(i);if(!o)continue;C.push({file:i,decls:r(o,i,n.keepComments)})}for(let{file:i,decls:o}of C){D+=o.length;for(let s of o)if(s.kind==="import"){w++;let c=s.source||"";if(c.startsWith("."))continue;if(!u.has(c))u.set(c,{source:c,specifiers:new Map,isTypeOnly:s.isTypeOnly||!1,isSideEffect:s.isSideEffect||!1});let l=u.get(c);if(s.specifiers)for(let h of s.specifiers){let W=h.alias||h.name;if(!l.specifiers.has(W))l.specifiers.set(W,{name:h.name,alias:h.alias,isType:h.isType||!1})}if(!s.isTypeOnly)l.isTypeOnly=!1}else if(s.isExported||s.kind==="export"){if(S++,s.kind==="export"&&s.source&&(s.source.startsWith(".")||s.source.startsWith("/")))continue;if(s.name&&x.has(s.name))continue;if(s.name)x.add(s.name);f.push({declaration:s,file:i})}}let a=[];a.push("/**"),a.push(" * Bundled TypeScript declarations"),a.push(` * Generated from ${t.length} source files`),a.push(" */"),a.push("");let T=n.importOrder||["bun"],y=Array.from(u.values()),p=Array(y.length);for(let i=0;i<y.length;i++){let o=y[i].source,s=T.length;for(let c=0;c<T.length;c++)if(o.startsWith(T[c])){s=c;break}p[i]=s}let g=y.map((i,o)=>o);g.sort((i,o)=>{let s=p[i],c=p[o];if(s!==c)return s-c;return y[i].source.localeCompare(y[o].source)});let b=g.map((i)=>y[i]);for(let i of b)if(i.isSideEffect)a.push(`import '${i.source}';`);else if(i.specifiers.size>0){let s=Array.from(i.specifiers.values()).map((l)=>{let h=l.isType?"type ":"";return l.alias?`${h}${l.name} as ${l.alias}`:`${h}${l.name}`}),c=i.isTypeOnly?"type ":"";a.push(`import ${c}{ ${s.join(", ")} } from '${i.source}';`)}if(b.length>0)a.push("");let m=new Map;for(let{declaration:i,file:o}of f){if(!m.has(o))m.set(o,[]);m.get(o).push(i)}for(let[i,o]of m){let s=L(n.cwd,i);a.push(`// From: ${s}`);for(let c of o){if(n.keepComments&&c.leadingComments)for(let l of c.leadingComments)a.push(l);a.push(F(c))}a.push("")}let d=a.join(`
2
+ import{r}from"./chunk-jcckwgb9.js";import{existsSync as j,mkdirSync as N,readFileSync as z,writeFileSync as G}from"fs";import{dirname as K,relative as L,resolve as _}from"path";async function ns(t,e,n){let u=new Map,f=[],x=new Set,D=0,w=0,S=0,C=[];for(let i of t){let o=e.get(i);if(!o)continue;C.push({file:i,decls:r(o,i,n.keepComments)})}for(let{file:i,decls:o}of C){D+=o.length;for(let s of o)if(s.kind==="import"){w++;let c=s.source||"";if(c.startsWith("."))continue;if(!u.has(c))u.set(c,{source:c,specifiers:new Map,isTypeOnly:s.isTypeOnly||!1,isSideEffect:s.isSideEffect||!1});let l=u.get(c);if(s.specifiers)for(let h of s.specifiers){let W=h.alias||h.name;if(!l.specifiers.has(W))l.specifiers.set(W,{name:h.name,alias:h.alias,isType:h.isType||!1})}if(!s.isTypeOnly)l.isTypeOnly=!1}else if(s.isExported||s.kind==="export"){if(S++,s.kind==="export"&&s.source&&(s.source.startsWith(".")||s.source.startsWith("/")))continue;if(s.name&&x.has(s.name))continue;if(s.name)x.add(s.name);f.push({declaration:s,file:i})}}let a=[];a.push("/**"),a.push(" * Bundled TypeScript declarations"),a.push(` * Generated from ${t.length} source files`),a.push(" */"),a.push("");let T=n.importOrder||["bun"],y=Array.from(u.values()),p=Array(y.length);for(let i=0;i<y.length;i++){let o=y[i].source,s=T.length;for(let c=0;c<T.length;c++)if(o.startsWith(T[c])){s=c;break}p[i]=s}let g=y.map((i,o)=>o);g.sort((i,o)=>{let s=p[i],c=p[o];if(s!==c)return s-c;return y[i].source.localeCompare(y[o].source)});let b=g.map((i)=>y[i]);for(let i of b)if(i.isSideEffect)a.push(`import '${i.source}';`);else if(i.specifiers.size>0){let s=Array.from(i.specifiers.values()).map((l)=>{let h=l.isType?"type ":"";return l.alias?`${h}${l.name} as ${l.alias}`:`${h}${l.name}`}),c=i.isTypeOnly?"type ":"";a.push(`import ${c}{ ${s.join(", ")} } from '${i.source}';`)}if(b.length>0)a.push("");let m=new Map;for(let{declaration:i,file:o}of f){if(!m.has(o))m.set(o,[]);m.get(o).push(i)}for(let[i,o]of m){let s=L(n.cwd,i);a.push(`// From: ${s}`);for(let c of o){if(n.keepComments&&c.leadingComments)for(let l of c.leadingComments)a.push(l);a.push(F(c))}a.push("")}let d=a.join(`
3
3
  `);return{content:d,files:t,declarationCount:D,importCount:w,exportCount:S,size:Buffer.byteLength(d,"utf8"),warnings:[]}}function F(t){if(t.text){let n=t.text.trim();if(t.isExported&&!n.startsWith("export"))n=`export ${n}`;if(!n.endsWith(";")&&!n.endsWith("}"))n+=";";return n}let e=[];if(t.isExported)e.push("export");if(t.isDefault)e.push("default");switch(t.kind){case"function":if(e.push("declare function"),e.push(t.name),t.generics)e.push(t.generics);if(e.push(`(${V(t.parameters)})`),t.returnType)e.push(`: ${t.returnType}`);break;case"variable":if(e.push("declare const"),e.push(t.name),t.typeAnnotation)e.push(`: ${t.typeAnnotation}`);break;case"interface":if(e.push("interface"),e.push(t.name),t.generics)e.push(t.generics);if(t.extends)e.push(`extends ${t.extends}`);if(e.push("{"),t.members)for(let n of t.members)e.push(` ${n.name}${n.typeAnnotation?`: ${n.typeAnnotation}`:""};`);e.push("}");break;case"type":if(e.push("type"),e.push(t.name),t.generics)e.push(t.generics);e.push("="),e.push(t.typeAnnotation||"unknown");break;case"class":if(e.push("declare class"),e.push(t.name),t.generics)e.push(t.generics);if(t.extends)e.push(`extends ${t.extends}`);if(t.implements&&t.implements.length>0)e.push(`implements ${t.implements.join(", ")}`);if(e.push("{"),t.members)for(let n of t.members)e.push(` ${F(n)}`);e.push("}");break;case"enum":if(e.push("declare enum"),e.push(t.name),e.push("{"),t.members){let n=t.members.map((u)=>u.value!==void 0?`${u.name} = ${u.value}`:u.name);e.push(` ${n.join(`,
4
- `)}`)}e.push("}");break;default:return t.text||""}return e.join(" ")}function V(t){if(!t||t.length===0)return"";return t.map((e)=>{let n="";if(e.rest)n+="...";if(n+=e.name,e.optional)n+="?";if(e.type)n+=`: ${e.type}`;if(e.defaultValue)n+=` = ${e.defaultValue}`;return n}).join(", ")}async function Ft(t,e={}){let n=[],u=new Map,f=[],x=[],D=new Set,w=0,S=0,C=0;for(let p of t){if(!j(p)){n.push(`File not found: ${p}`);continue}let g=z(p,"utf-8");x.push(p);let b=g.split(`
4
+ `)}`)}e.push("}");break;default:return t.text||""}return e.join(" ")}function V(t){if(!t||t.length===0)return"";return t.map((e)=>{let n="";if(e.rest)n+="...";if(n+=e.name,e.optional)n+="?";if(e.type)n+=`: ${e.type}`;if(e.defaultValue)n+=` = ${e.defaultValue}`;return n}).join(", ")}async function _t(t,e={}){let n=[],u=new Map,f=[],x=[],D=new Set,w=0,S=0,C=0;for(let p of t){if(!j(p)){n.push(`File not found: ${p}`);continue}let g=z(p,"utf-8");x.push(p);let b=g.split(`
5
5
  `),m=[],d=0,i=!1;for(let o of b){let s=o.trim();if(!s&&!i)continue;if(s.startsWith("import ")){S++;let l=s.match(/import\s+(type\s+)?(?:\{([^}]+)\}|(\w+)|\*\s+as\s+(\w+))\s+from\s+['"]([^'"]+)['"]/);if(l){let[,h,W,q,H,A]=l;if(e.externals?.some((P)=>A.startsWith(P))){f.push(s);continue}if(A.startsWith("."))continue;if(!u.has(A))u.set(A,{source:A,specifiers:new Map,isTypeOnly:!!h,isSideEffect:!1});let E=u.get(A);if(W){let P=W.split(",").map((k)=>k.trim());for(let k of P){let[I,v]=k.split(/\s+as\s+/).map((M)=>M.trim()),R=I.startsWith("type "),O=R?I.replace("type ",""):I;E.specifiers.set(v||O,{name:O,alias:v!==O?v:void 0,isType:R})}}if(!h)E.isTypeOnly=!1}continue}if(/^(export\s+)?(declare\s+)?(interface|type|class|function|const|let|var|enum|namespace|module)\s/.test(s)){if(i=!0,m=[o],d=(o.match(/\{/g)||[]).length-(o.match(/\}/g)||[]).length,d===0&&(s.endsWith(";")||!s.includes("{"))){let l=B(s);if(!D.has(l)||!e.mergeDuplicates){if(D.add(l),f.push(o),w++,s.startsWith("export"))C++}i=!1,m=[]}}else if(i){if(m.push(o),d+=(o.match(/\{/g)||[]).length-(o.match(/\}/g)||[]).length,d<=0){let l=m.join(`
6
6
  `),h=B(m[0]);if(!D.has(h)||!e.mergeDuplicates){if(D.add(h),f.push(l),w++,m[0].trim().startsWith("export"))C++}i=!1,m=[]}}else if(s.startsWith("export ")&&!s.includes("declare"))f.push(o),C++}}let a=[];if(e.banner)a.push(e.banner),a.push("");if(e.includeReferences&&e.references){for(let p of e.references)a.push(`/// <reference types="${p}" />`);a.push("")}let T=Array.from(u.values()).sort((p,g)=>p.source.localeCompare(g.source));for(let p of T)if(p.specifiers.size>0){let b=Array.from(p.specifiers.values()).map((d)=>{let i=d.isType?"type ":"";return d.alias?`${i}${d.name} as ${d.alias}`:`${i}${d.name}`}),m=p.isTypeOnly?"type ":"";a.push(`import ${m}{ ${b.join(", ")} } from '${p.source}';`)}if(T.length>0)a.push("");if(e.ambient&&e.moduleName){a.push(`declare module '${e.moduleName}' {`);for(let p of f){let g=p.split(`
7
7
  `).map((b)=>` ${b.replace(/^(\s*)(export\s+)?declare\s+/,"$1$2")}`).join(`
8
8
  `);a.push(g)}a.push("}")}else{if(e.sortDeclarations)f.sort((p,g)=>{let b=B(p),m=B(g);return b.localeCompare(m)});for(let p of f)a.push(p)}if(e.footer)a.push(""),a.push(e.footer);let y=a.join(`
9
- `);return{content:y,files:x,declarationCount:w,importCount:S,exportCount:C,size:Buffer.byteLength(y,"utf-8"),warnings:n}}function B(t){let e=t.match(/(interface|type|class|function|const|let|var|enum|namespace|module)\s+(\w+)/);return e?`${e[1]}:${e[2]}`:t.trim()}async function Qn(t,e,n={}){let u=await Ft(t,n),f=K(e);if(!j(f))N(f,{recursive:!0});return G(e,u.content),u}function Si(t={}){return{bundle:(e)=>Ft(e,t),bundleAndWrite:(e,n)=>Qn(e,n,{...t,output:n})}}async function $i(t,e=process.cwd()){let n=Array.isArray(t)?t:[t],u=[];for(let f of n){if(f.includes("*"))continue;let x=_(e,f);if(j(x))u.push(x)}return u}
10
- export{vi,Ft,Qn,Si,$i};
9
+ `);return{content:y,files:x,declarationCount:w,importCount:S,exportCount:C,size:Buffer.byteLength(y,"utf-8"),warnings:n}}function B(t){let e=t.match(/(interface|type|class|function|const|let|var|enum|namespace|module)\s+(\w+)/);return e?`${e[1]}:${e[2]}`:t.trim()}async function pr(t,e,n={}){let u=await _t(t,n),f=K(e);if(!j(f))N(f,{recursive:!0});return G(e,u.content),u}function rs(t={}){return{bundle:(e)=>_t(e,t),bundleAndWrite:(e,n)=>pr(e,n,{...t,output:n})}}async function is(t,e=process.cwd()){let n=Array.isArray(t)?t:[t],u=[];for(let f of n){if(f.includes("*"))continue;let x=_(e,f);if(j(x))u.push(x)}return u}
10
+ export{ns,_t,pr,rs,is};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{p}from"./chunk-v6fwy63g.js";import{existsSync as u,mkdirSync as H,readFileSync as l,renameSync as b,rmdirSync as D,rmSync as C,statSync as g,writeFileSync as S}from"fs";import{join as d,relative as h,resolve as y}from"path";var f=24,m=".dtsx-cache",v="manifest.json";function ii(t){try{C(d(t,v),{force:!0});try{D(t)}catch{}}catch{}}class Ge{cacheDir;manifestPath;manifest=null;configHash;constructor(t,n){this.cacheDir=y(t.cwd,t.cacheDir??m),this.manifestPath=d(this.cacheDir,v),this.configHash=this.hashConfig(t,n)}hashConfig(t,n){let s={resolutionContext:n,keepComments:t.keepComments,importOrder:t.importOrder,outputStructure:t.outputStructure,moduleSpecifierMode:t.moduleSpecifierMode??"preserve",root:y(t.cwd,t.root),exclude:t.exclude??[],isolatedDeclarations:t.isolatedDeclarations,declarationMap:t.declarationMap,indentStyle:t.indentStyle,indentSize:t.indentSize,prettier:t.prettier,typeMappings:t.typeMappings?{includeDefaults:t.typeMappings.includeDefaults,presets:t.typeMappings.presets,cacheKey:t.typeMappings.cacheKey,rules:t.typeMappings.rules.map((e)=>({pattern:typeof e.pattern==="string"?{kind:"string",value:e.pattern}:{kind:"regex",source:e.pattern.source,flags:e.pattern.flags},replacement:e.replacement,global:e.global,priority:e.priority,hasCondition:Boolean(e.condition)}))}:void 0,lineEnding:t.lineEnding,normalizeOutput:t.normalizeOutput,declarationOrder:t.declarationOrder,plugins:t.plugins?.map((e)=>({name:e.name,version:e.version,cacheKey:e.cacheKey}))};return String(p(JSON.stringify(s)))}hashString(t){return String(p(t))}load(){try{if(!u(this.manifestPath))return!1;let t=l(this.manifestPath,"utf-8"),n=JSON.parse(t);if(n.version!==f)return!1;if(n.configHash!==this.configHash)return!1;if(!n.entries||typeof n.entries!=="object"||Array.isArray(n.entries))return!1;return this.manifest=n,!0}catch{return!1}}save(){if(!this.manifest)this.manifest={version:f,configHash:this.configHash,entries:{},createdAt:Date.now(),updatedAt:Date.now()};if(this.manifest.updatedAt=Date.now(),!u(this.cacheDir))H(this.cacheDir,{recursive:!0});let t=`${this.manifestPath}.${process.pid}.tmp`;try{S(t,JSON.stringify(this.manifest,null,2)),b(t,this.manifestPath)}finally{if(u(t))C(t,{force:!0})}}needsRegeneration(t,n){return this.getCachedIfValid(t,n)===null}getCached(t,n){return this.getCachedIfValid(t,n)}getCachedIfValid(t,n){if(!this.manifest)return null;let s=h(n,t),e=this.manifest.entries[s];if(!e)return null;if(typeof e.dtsContent!=="string"||typeof e.dtsHash!=="string"||e.configHash!==this.configHash||this.hashString(e.dtsContent)!==e.dtsHash)return null;try{let i=g(t),{mtimeMs:r,ctimeMs:a}=i;if(i.size!==e.sourceSize)return null;if(r!==e.sourceMtime||a!==e.sourceCtime){let o=l(t,"utf-8");if(this.hashString(o)!==e.sourceHash)return null;e.sourceMtime=r,e.sourceCtime=a}return e.dtsContent}catch{return null}}update(t,n,s,e){if(!this.manifest)this.manifest={version:f,configHash:this.configHash,entries:{},createdAt:Date.now(),updatedAt:Date.now()};let i=h(e,t),r,a,o;try{let c=g(t);r=c.mtimeMs,a=c.ctimeMs,o=c.size}catch{r=Date.now(),a=r,o=Buffer.byteLength(n)}this.manifest.entries[i]={sourcePath:i,sourceHash:this.hashString(n),sourceMtime:r,sourceCtime:a,sourceSize:o,dtsContent:s,dtsHash:this.hashString(s),generatedAt:Date.now(),configHash:this.configHash}}remove(t,n){if(!this.manifest)return;let s=h(n,t);delete this.manifest.entries[s]}clear(){this.manifest=null,ii(this.cacheDir)}getStats(){if(!this.manifest)return{entries:0,size:0};let t=Object.keys(this.manifest.entries).length,n=0;for(let s of Object.values(this.manifest.entries))n+=s.dtsContent.length;return{entries:t,size:n}}prune(t,n){if(!this.manifest)return 0;let s=0,e=new Set(Array.from(t).map((i)=>h(n,i)));for(let i of Object.keys(this.manifest.entries))if(!e.has(i))delete this.manifest.entries[i],s++;return s}}function pt(t){let n=d(t,".gitignore");try{let s="";if(u(n))s=l(n,"utf-8");if(!s.split(/\r?\n/).some((i)=>i.trim()===m||i.trim()===`${m}/`)){let i=s.trimEnd(),r=`${i}${i?`
2
+ import{p}from"./chunk-v6fwy63g.js";import{existsSync as u,mkdirSync as H,readFileSync as l,renameSync as b,rmdirSync as D,rmSync as C,statSync as g,writeFileSync as S}from"fs";import{join as d,relative as h,resolve as y}from"path";var f=24,m=".dtsx-cache",v="manifest.json";function Qr(t){try{C(d(t,v),{force:!0});try{D(t)}catch{}}catch{}}class Ge{cacheDir;manifestPath;manifest=null;configHash;constructor(t,n){this.cacheDir=y(t.cwd,t.cacheDir??m),this.manifestPath=d(this.cacheDir,v),this.configHash=this.hashConfig(t,n)}hashConfig(t,n){let s={resolutionContext:n,keepComments:t.keepComments,importOrder:t.importOrder,outputStructure:t.outputStructure,moduleSpecifierMode:t.moduleSpecifierMode??"preserve",root:y(t.cwd,t.root),exclude:t.exclude??[],isolatedDeclarations:t.isolatedDeclarations,declarationMap:t.declarationMap,indentStyle:t.indentStyle,indentSize:t.indentSize,prettier:t.prettier,typeMappings:t.typeMappings?{includeDefaults:t.typeMappings.includeDefaults,presets:t.typeMappings.presets,cacheKey:t.typeMappings.cacheKey,rules:t.typeMappings.rules.map((e)=>({pattern:typeof e.pattern==="string"?{kind:"string",value:e.pattern}:{kind:"regex",source:e.pattern.source,flags:e.pattern.flags},replacement:e.replacement,global:e.global,priority:e.priority,hasCondition:Boolean(e.condition)}))}:void 0,lineEnding:t.lineEnding,normalizeOutput:t.normalizeOutput,declarationOrder:t.declarationOrder,plugins:t.plugins?.map((e)=>({name:e.name,version:e.version,cacheKey:e.cacheKey}))};return String(p(JSON.stringify(s)))}hashString(t){return String(p(t))}load(){try{if(!u(this.manifestPath))return!1;let t=l(this.manifestPath,"utf-8"),n=JSON.parse(t);if(n.version!==f)return!1;if(n.configHash!==this.configHash)return!1;if(!n.entries||typeof n.entries!=="object"||Array.isArray(n.entries))return!1;return this.manifest=n,!0}catch{return!1}}save(){if(!this.manifest)this.manifest={version:f,configHash:this.configHash,entries:{},createdAt:Date.now(),updatedAt:Date.now()};if(this.manifest.updatedAt=Date.now(),!u(this.cacheDir))H(this.cacheDir,{recursive:!0});let t=`${this.manifestPath}.${process.pid}.tmp`;try{S(t,JSON.stringify(this.manifest,null,2)),b(t,this.manifestPath)}finally{if(u(t))C(t,{force:!0})}}needsRegeneration(t,n){return this.getCachedIfValid(t,n)===null}getCached(t,n){return this.getCachedIfValid(t,n)}getCachedIfValid(t,n){if(!this.manifest)return null;let s=h(n,t),e=this.manifest.entries[s];if(!e)return null;if(typeof e.dtsContent!=="string"||typeof e.dtsHash!=="string"||e.configHash!==this.configHash||this.hashString(e.dtsContent)!==e.dtsHash)return null;try{let i=g(t),{mtimeMs:r,ctimeMs:a}=i;if(i.size!==e.sourceSize)return null;if(r!==e.sourceMtime||a!==e.sourceCtime){let o=l(t,"utf-8");if(this.hashString(o)!==e.sourceHash)return null;e.sourceMtime=r,e.sourceCtime=a}return e.dtsContent}catch{return null}}update(t,n,s,e){if(!this.manifest)this.manifest={version:f,configHash:this.configHash,entries:{},createdAt:Date.now(),updatedAt:Date.now()};let i=h(e,t),r,a,o;try{let c=g(t);r=c.mtimeMs,a=c.ctimeMs,o=c.size}catch{r=Date.now(),a=r,o=Buffer.byteLength(n)}this.manifest.entries[i]={sourcePath:i,sourceHash:this.hashString(n),sourceMtime:r,sourceCtime:a,sourceSize:o,dtsContent:s,dtsHash:this.hashString(s),generatedAt:Date.now(),configHash:this.configHash}}remove(t,n){if(!this.manifest)return;let s=h(n,t);delete this.manifest.entries[s]}clear(){this.manifest=null,Qr(this.cacheDir)}getStats(){if(!this.manifest)return{entries:0,size:0};let t=Object.keys(this.manifest.entries).length,n=0;for(let s of Object.values(this.manifest.entries))n+=s.dtsContent.length;return{entries:t,size:n}}prune(t,n){if(!this.manifest)return 0;let s=0,e=new Set(Array.from(t).map((i)=>h(n,i)));for(let i of Object.keys(this.manifest.entries))if(!e.has(i))delete this.manifest.entries[i],s++;return s}}function mt(t){let n=d(t,".gitignore");try{let s="";if(u(n))s=l(n,"utf-8");if(!s.split(/\r?\n/).some((i)=>i.trim()===m||i.trim()===`${m}/`)){let i=s.trimEnd(),r=`${i}${i?`
3
3
 
4
4
  `:""}# dtsx cache
5
5
  ${m}/
6
6
  `;S(n,r)}}catch{}}
7
- export{ii,Ge,pt};
7
+ export{Qr,Ge,mt};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-0azm93j9.js";class Le{options;generateOptions;constructor(t={}){let{onCompile:r=!1,afterEmit:e=!0,onWatchRun:n=!1,onGenerated:o,onError:i,...a}=t;this.options={onCompile:r,afterEmit:e,onWatchRun:n,onGenerated:o,onError:i},this.generateOptions=a}apply(t){if(!this.generateOptions.outdir&&t.options.output?.path)this.generateOptions.outdir=t.options.output.path;if(!this.generateOptions.cwd&&t.options.context)this.generateOptions.cwd=t.options.context;if(!this.generateOptions.entrypoints&&t.options.entry){let e=t.options.entry;if(typeof e==="string")this.generateOptions.entrypoints=[e];else if(Array.isArray(e))this.generateOptions.entrypoints=e;else if(typeof e==="object"&&e!==null){let n=[];for(let o of Object.values(e))if(typeof o==="string")n.push(o);else if(Array.isArray(o))n.push(...o.filter((i)=>typeof i==="string"));else if(typeof o==="object"&&o!==null&&"import"in o){let i=o.import;if(typeof i==="string")n.push(i);else if(Array.isArray(i))n.push(...i)}if(n.length>0)this.generateOptions.entrypoints=n}}if(this.options.onCompile)t.hooks.compile.tap("DtsxWebpackPlugin",()=>{this.runGenerate()});if(this.options.afterEmit)t.hooks.afterEmit.tapAsync("DtsxWebpackPlugin",async(e,n)=>{await this.runGenerate(),n()});if(this.options.onWatchRun)t.hooks.watchRun.tapAsync("DtsxWebpackPlugin",async(e,n)=>{await this.runGenerate(),n()})}async runGenerate(){try{let t=await s(this.generateOptions);this.options.onGenerated?.(t)}catch(t){let r=t instanceof Error?t:Error(String(t));if(this.options.onError?.(r),!this.options.onError)console.error("[dtsx] Generation failed:",r.message)}}}function It(t={}){return new Le(t)}var Xn=It,ba=Le;
2
+ import{s}from"./chunk-0zfzhn19.js";class Le{options;generateOptions;constructor(t={}){let{onCompile:r=!1,afterEmit:e=!0,onWatchRun:n=!1,onGenerated:o,onError:i,...a}=t;this.options={onCompile:r,afterEmit:e,onWatchRun:n,onGenerated:o,onError:i},this.generateOptions=a}apply(t){if(!this.generateOptions.outdir&&t.options.output?.path)this.generateOptions.outdir=t.options.output.path;if(!this.generateOptions.cwd&&t.options.context)this.generateOptions.cwd=t.options.context;if(!this.generateOptions.entrypoints&&t.options.entry){let e=t.options.entry;if(typeof e==="string")this.generateOptions.entrypoints=[e];else if(Array.isArray(e))this.generateOptions.entrypoints=e;else if(typeof e==="object"&&e!==null){let n=[];for(let o of Object.values(e))if(typeof o==="string")n.push(o);else if(Array.isArray(o))n.push(...o.filter((i)=>typeof i==="string"));else if(typeof o==="object"&&o!==null&&"import"in o){let i=o.import;if(typeof i==="string")n.push(i);else if(Array.isArray(i))n.push(...i)}if(n.length>0)this.generateOptions.entrypoints=n}}if(this.options.onCompile)t.hooks.compile.tap("DtsxWebpackPlugin",()=>{this.runGenerate()});if(this.options.afterEmit)t.hooks.afterEmit.tapAsync("DtsxWebpackPlugin",async(e,n)=>{await this.runGenerate(),n()});if(this.options.onWatchRun)t.hooks.watchRun.tapAsync("DtsxWebpackPlugin",async(e,n)=>{await this.runGenerate(),n()})}async runGenerate(){try{let t=await s(this.generateOptions);this.options.onGenerated?.(t)}catch(t){let r=t instanceof Error?t:Error(String(t));if(this.options.onError?.(r),!this.options.onError)console.error("[dtsx] Generation failed:",r.message)}}}function It(t={}){return new Le(t)}var Xn=It,ba=Le;
3
3
  export{Le,It,Xn,ba};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{t,x,Me,m}from"./chunk-1j6092xz.js";import{Ln,Nn}from"./chunk-gpq2kggq.js";function D(n){return m(n).find((e)=>e.category==="static-import")}function W(n){return t(n).map((e)=>n.slice(e.start,e.end)).join(" ")}function w(n){let e=D(n);return e?n.lastIndexOf(" from ",e.start):-1}function Se(n){let e=D(n);return e?x(e.specifier,"'"):void 0}function Fn(n){let e=y(n);if(!e)return null;return{defaultName:e.defaultName??e.namespaceName,namedItems:e.namedItems.map((r)=>`${!e.isTypeOnly&&r.isTypeOnly?"type ":""}${r.originalName===r.name?r.name:`${r.originalName} as ${r.name}`}`),source:e.source,isTypeOnly:e.isTypeOnly,isNamespace:e.isNamespace,namespaceName:e.namespaceName,isImportEquals:e.isImportEquals}}function h(n){let e=Ln(n);if(e)return e;let r=y(n),f=r?[r.defaultName,r.namespaceName,...r.namedItems.map((a)=>a.name)].filter((a)=>a!==null):[];return Nn(n,f),f}function j(n){let e=[],r=0;for(let a of t(n)){if(a.kind!=="punctuation"||n.slice(a.start,a.end)!==",")continue;let s=n.slice(r,a.start).trim();if(s)e.push(s);r=a.end}let f=n.slice(r).trim();if(f)e.push(f);return e}function y(n){n=W(n);let e=Me(n);if(e)return{defaultName:e.name,namedItems:[],source:e.source,isTypeOnly:e.isTypeOnly,isNamespace:!1,namespaceName:null,isImportEquals:!0};let r=w(n);if(r===-1)return null;let f=D(n);if(!f)return null;let a=f.specifier,s=n.slice(0,r).trim(),d=f.isTypeOnly;if(s.startsWith("import "))s=s.slice(7).trim();if(d&&s.startsWith("type "))s=s.slice(5).trim();let p=null,o=[],i=!1,c=null,u=s.includes("{")?-1:s.indexOf("* as ");if(u!==-1)return i=!0,c=s.slice(u+5).trim(),p=s.slice(0,u).trim().replace(/,$/,"").trim()||null,{defaultName:p,namedItems:[],source:a,isTypeOnly:d,isNamespace:i,namespaceName:c};let l=s.indexOf("{"),g=s.lastIndexOf("}");if(l!==-1&&g!==-1){let I=s.slice(0,l).trim();if(I.endsWith(","))p=I.slice(0,-1).trim()||null;let N=s.slice(l+1,g),S=j(N);for(let b of S){let C=xi(b),O=C?b.slice(5).trim():b,E=O.lastIndexOf(" as "),q,T;if(E!==-1)T=O.slice(0,E).trim(),q=O.slice(E+4).trim();else q=O,T=O;o.push({name:q,originalName:T,isTypeOnly:d||C,isDefault:!1})}}else p=s.trim()||null;return{defaultName:p,namedItems:o,source:a,isTypeOnly:d,isNamespace:i,namespaceName:c}}function Sa(n){let e=n.trim();if(e.startsWith("export default "))return{namedItems:[],source:null,isTypeOnly:!1,isNamespace:!1,isDefault:!0};let r=e.startsWith("export type ");if(e.startsWith("export "))e=e.slice(7).trim();if(r&&e.startsWith("type "))e=e.slice(5).trim();if(e.startsWith("* from ")||e.startsWith("* as ")){let c=e.indexOf(" from "),u=null;if(c!==-1){let l=e.slice(c+6).trim(),g=l[0];if(g==='"'||g==="'"){let I=l.indexOf(g,1);if(I!==-1)u=l.slice(1,I)}}return{namedItems:[],source:u,isTypeOnly:r,isNamespace:!0,isDefault:!1}}let f=e.indexOf("{"),a=e.lastIndexOf("}");if(f===-1||a===-1)return null;let s=null,d=e.indexOf(" from ",a);if(d!==-1){let c=e.slice(d+6).trim(),u=c[0];if(u==='"'||u==="'"){let l=c.indexOf(u,1);if(l!==-1)s=c.slice(1,l)}}let p=[],o=e.slice(f+1,a),i=[];{let c=0;for(let u=0;u<=o.length;u++)if(u===o.length||o.charCodeAt(u)===44){let l=c,g=u;while(l<g&&o.charCodeAt(l)<=32)l++;while(g>l&&o.charCodeAt(g-1)<=32)g--;if(l<g)i.push(o.slice(l,g));c=u+1}}for(let c of i){let u=xi(c),l=u?c.slice(5).trim():c,g=l.lastIndexOf(" as "),I,N;if(g!==-1)N=l.slice(0,g).trim(),I=l.slice(g+4).trim();else I=l,N=l;p.push({name:I,originalName:N,isTypeOnly:r||u,isDefault:!1})}return{namedItems:p,source:s,isTypeOnly:r,isNamespace:!1,isDefault:!1}}function xi(n){let e=t(n),r=e[0];if(!r||r.kind!=="word"||n.slice(r.start,r.end)!=="type"||e.length<2)return!1;return!(e.length===3&&n.slice(e[1].start,e[1].end)==="as")}function $a(n){let e=y(n);if(!e||e.isTypeOnly||e.isImportEquals)return n;if(e.namedItems.every((r)=>r.isTypeOnly))return n.replace(/^import\s+/,"import type ");return n}function Ea(n){let e=new Map,r=[];for(let a of n){let s=y(a);if(!s)continue;if(s.isImportEquals||s.isNamespace){r.push(a);continue}let d=Se(a);if(!d)throw Error("Cannot locate a grammatical module literal in the import declaration");let p=e.get(s.source)||{types:[],values:[],defaultName:null,sourceLiteral:d};if(s.defaultName)p.defaultName=s.defaultName;for(let o of s.namedItems)if(o.isTypeOnly)p.types.push(o);else p.values.push(o);e.set(s.source,p)}let f=r;for(let{types:a,values:s,defaultName:d,sourceLiteral:p}of e.values())if(a.length===0&&s.length===0&&d)f.push(`import ${d} from ${p};`);else if(a.length>0&&s.length===0&&!d){let o=a.map((i)=>i.originalName===i.name?i.name:`${i.originalName} as ${i.name}`);f.push(`import type { ${o.join(", ")} } from ${p};`)}else if(s.length>0&&a.length===0&&!d){let o=s.map((i)=>i.originalName===i.name?i.name:`${i.originalName} as ${i.name}`);f.push(`import { ${o.join(", ")} } from ${p};`)}else{let o=[];for(let i of a){let c=i.originalName===i.name?i.name:`${i.originalName} as ${i.name}`;o.push(`type ${c}`)}for(let i of s){let c=i.originalName===i.name?i.name:`${i.originalName} as ${i.name}`;o.push(c)}if(d)f.push(`import ${d}, { ${o.join(", ")} } from ${p};`);else f.push(`import { ${o.join(", ")} } from ${p};`)}return f}
3
- export{Se,Fn,h,y,Sa,xi,$a,Ea};
2
+ import{t,x,Me,m}from"./chunk-1j6092xz.js";import{Nn,Bn}from"./chunk-3t57mzvf.js";function D(n){return m(n).find((e)=>e.category==="static-import")}function W(n){return t(n).map((e)=>n.slice(e.start,e.end)).join(" ")}function w(n){let e=D(n);return e?n.lastIndexOf(" from ",e.start):-1}function Ee(n){let e=D(n);return e?x(e.specifier,"'"):void 0}function Ln(n){let e=b(n);if(!e)return null;return{defaultName:e.defaultName??e.namespaceName,namedItems:e.namedItems.map((r)=>`${!e.isTypeOnly&&r.isTypeOnly?"type ":""}${r.originalName===r.name?r.name:`${r.originalName} as ${r.name}`}`),source:e.source,isTypeOnly:e.isTypeOnly,isNamespace:e.isNamespace,namespaceName:e.namespaceName,isImportEquals:e.isImportEquals}}function y(n){let e=Nn(n);if(e)return e;let r=b(n),f=r?[r.defaultName,r.namespaceName,...r.namedItems.map((a)=>a.name)].filter((a)=>a!==null):[];return Bn(n,f),f}function j(n){let e=[],r=0;for(let a of t(n)){if(a.kind!=="punctuation"||n.slice(a.start,a.end)!==",")continue;let s=n.slice(r,a.start).trim();if(s)e.push(s);r=a.end}let f=n.slice(r).trim();if(f)e.push(f);return e}function b(n){n=W(n);let e=Me(n);if(e)return{defaultName:e.name,namedItems:[],source:e.source,isTypeOnly:e.isTypeOnly,isNamespace:!1,namespaceName:null,isImportEquals:!0};let r=w(n);if(r===-1)return null;let f=D(n);if(!f)return null;let a=f.specifier,s=n.slice(0,r).trim(),d=f.isTypeOnly;if(s.startsWith("import "))s=s.slice(7).trim();if(d&&s.startsWith("type "))s=s.slice(5).trim();let p=null,o=[],i=!1,c=null,u=s.includes("{")?-1:s.indexOf("* as ");if(u!==-1)return i=!0,c=s.slice(u+5).trim(),p=s.slice(0,u).trim().replace(/,$/,"").trim()||null,{defaultName:p,namedItems:[],source:a,isTypeOnly:d,isNamespace:i,namespaceName:c};let l=s.indexOf("{"),g=s.lastIndexOf("}");if(l!==-1&&g!==-1){let I=s.slice(0,l).trim();if(I.endsWith(","))p=I.slice(0,-1).trim()||null;let h=s.slice(l+1,g),S=j(h);for(let O of S){let C=wi(O),N=C?O.slice(5).trim():O,E=N.lastIndexOf(" as "),q,T;if(E!==-1)T=N.slice(0,E).trim(),q=N.slice(E+4).trim();else q=N,T=N;o.push({name:q,originalName:T,isTypeOnly:d||C,isDefault:!1})}}else p=s.trim()||null;return{defaultName:p,namedItems:o,source:a,isTypeOnly:d,isNamespace:i,namespaceName:c}}function Sa(n){let e=n.trim();if(e.startsWith("export default "))return{namedItems:[],source:null,isTypeOnly:!1,isNamespace:!1,isDefault:!0};let r=e.startsWith("export type ");if(e.startsWith("export "))e=e.slice(7).trim();if(r&&e.startsWith("type "))e=e.slice(5).trim();if(e.startsWith("* from ")||e.startsWith("* as ")){let c=e.indexOf(" from "),u=null;if(c!==-1){let l=e.slice(c+6).trim(),g=l[0];if(g==='"'||g==="'"){let I=l.indexOf(g,1);if(I!==-1)u=l.slice(1,I)}}return{namedItems:[],source:u,isTypeOnly:r,isNamespace:!0,isDefault:!1}}let f=e.indexOf("{"),a=e.lastIndexOf("}");if(f===-1||a===-1)return null;let s=null,d=e.indexOf(" from ",a);if(d!==-1){let c=e.slice(d+6).trim(),u=c[0];if(u==='"'||u==="'"){let l=c.indexOf(u,1);if(l!==-1)s=c.slice(1,l)}}let p=[],o=e.slice(f+1,a),i=[];{let c=0;for(let u=0;u<=o.length;u++)if(u===o.length||o.charCodeAt(u)===44){let l=c,g=u;while(l<g&&o.charCodeAt(l)<=32)l++;while(g>l&&o.charCodeAt(g-1)<=32)g--;if(l<g)i.push(o.slice(l,g));c=u+1}}for(let c of i){let u=wi(c),l=u?c.slice(5).trim():c,g=l.lastIndexOf(" as "),I,h;if(g!==-1)h=l.slice(0,g).trim(),I=l.slice(g+4).trim();else I=l,h=l;p.push({name:I,originalName:h,isTypeOnly:r||u,isDefault:!1})}return{namedItems:p,source:s,isTypeOnly:r,isNamespace:!1,isDefault:!1}}function wi(n){let e=t(n),r=e[0];if(!r||r.kind!=="word"||n.slice(r.start,r.end)!=="type"||e.length<2)return!1;return!(e.length===3&&n.slice(e[1].start,e[1].end)==="as")}function $a(n){let e=b(n);if(!e||e.isTypeOnly||e.isImportEquals)return n;if(e.namedItems.every((r)=>r.isTypeOnly))return n.replace(/^import\s+/,"import type ");return n}function Ea(n){let e=new Map,r=[];for(let a of n){let s=b(a);if(!s)continue;if(s.isImportEquals||s.isNamespace){r.push(a);continue}let d=Ee(a);if(!d)throw Error("Cannot locate a grammatical module literal in the import declaration");let p=e.get(s.source)||{types:[],values:[],defaultName:null,sourceLiteral:d};if(s.defaultName)p.defaultName=s.defaultName;for(let o of s.namedItems)if(o.isTypeOnly)p.types.push(o);else p.values.push(o);e.set(s.source,p)}let f=r;for(let{types:a,values:s,defaultName:d,sourceLiteral:p}of e.values())if(a.length===0&&s.length===0&&d)f.push(`import ${d} from ${p};`);else if(a.length>0&&s.length===0&&!d){let o=a.map((i)=>i.originalName===i.name?i.name:`${i.originalName} as ${i.name}`);f.push(`import type { ${o.join(", ")} } from ${p};`)}else if(s.length>0&&a.length===0&&!d){let o=s.map((i)=>i.originalName===i.name?i.name:`${i.originalName} as ${i.name}`);f.push(`import { ${o.join(", ")} } from ${p};`)}else{let o=[];for(let i of a){let c=i.originalName===i.name?i.name:`${i.originalName} as ${i.name}`;o.push(`type ${c}`)}for(let i of s){let c=i.originalName===i.name?i.name:`${i.originalName} as ${i.name}`;o.push(c)}if(d)f.push(`import ${d}, { ${o.join(", ")} } from ${p};`);else f.push(`import { ${o.join(", ")} } from ${p};`)}return f}
3
+ export{Ee,Ln,y,b,Sa,wi,$a,Ea};
@@ -1,10 +1,10 @@
1
1
  // @bun
2
- var Ce={PARSE_ERROR:"PARSE_ERROR",SYNTAX_ERROR:"SYNTAX_ERROR",FILE_NOT_FOUND:"FILE_NOT_FOUND",FILE_READ_ERROR:"FILE_READ_ERROR",FILE_WRITE_ERROR:"FILE_WRITE_ERROR",TYPE_INFERENCE_ERROR:"TYPE_INFERENCE_ERROR",UNRESOLVED_TYPE:"UNRESOLVED_TYPE",EXTRACTION_ERROR:"EXTRACTION_ERROR",PROCESSING_ERROR:"PROCESSING_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",INVALID_DECLARATION:"INVALID_DECLARATION",CONFIG_ERROR:"CONFIG_ERROR",INVALID_ENTRYPOINT:"INVALID_ENTRYPOINT",CIRCULAR_DEPENDENCY:"CIRCULAR_DEPENDENCY",TIMEOUT_ERROR:"TIMEOUT_ERROR",NOT_SUPPORTED:"NOT_SUPPORTED",UNKNOWN_ERROR:"UNKNOWN_ERROR"};class E extends Error{code;context;constructor(n,e="UNKNOWN_ERROR",t){super(n);if(this.name="DtsxError",this.code=e,this.context=t,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toString(){let n=`${this.name} [${this.code}]: ${this.message}`;if(this.context)n+=`
3
- Context: ${JSON.stringify(this.context,null,2)}`;return n}toJSON(){return{name:this.name,code:this.code,message:this.message,context:this.context,stack:this.stack}}}class $n extends E{filePath;line;column;constructor(n,e,t){super(n,"PARSE_ERROR",{filePath:e,line:t?.line,column:t?.column});if(this.name="ParseError",this.filePath=e,this.line=t?.line,this.column=t?.column,t?.cause)this.cause=t.cause}get locationString(){if(this.line!==void 0&&this.column!==void 0)return`${this.filePath}:${this.line}:${this.column}`;return this.line!==void 0?`${this.filePath}:${this.line}`:this.filePath}}class mi extends E{filePath;declarationKind;constructor(n,e,t,s){super(n,"EXTRACTION_ERROR",{filePath:e,declarationKind:t});if(this.name="ExtractionError",this.filePath=e,this.declarationKind=t,s)this.cause=s}}class gi extends E{declarationName;constructor(n,e,t){super(n,"PROCESSING_ERROR",{declarationName:e});if(this.name="ProcessingError",this.declarationName=e,t)this.cause=t}}class En extends E{filePath;operation;constructor(n,e,t,s){super(n,t==="read"?"FILE_READ_ERROR":"FILE_WRITE_ERROR",{filePath:e,operation:t});if(this.name="FileError",this.filePath=e,this.operation=t,s)this.cause=s}}class kn extends E{configPath;invalidKey;constructor(n,e){super(n,"CONFIG_ERROR",{configPath:e?.configPath,invalidKey:e?.invalidKey});if(this.name="ConfigError",this.configPath=e?.configPath,this.invalidKey=e?.invalidKey,e?.cause)this.cause=e.cause}}class hi extends E{cycle;constructor(n){super(`Circular dependency detected: ${n.join(" -> ")}`,"CIRCULAR_DEPENDENCY",{cycle:n});this.name="CircularDependencyError",this.cycle=n}}function Io(n){return n instanceof E}function Fo(n){return n instanceof $n}function Lo(n){return n instanceof En}function No(n){return n instanceof kn}function Bo(n,e="UNKNOWN_ERROR",t){if(n instanceof E)return n;let s=t||(n instanceof Error?n.message:String(n)),r=new E(s,e);if(n instanceof Error)r.cause=n;return r}function Wo(n,e){let t=1,s=1,r=0;for(let i of n){if(r>=e)break;if(i===`
4
- `)t++,s=1;else s++;r++}return{line:t,column:s,offset:e}}function jo(n,e,t,s){let r=n.split(`
5
- `),i=e.line-1,o=[];if(s)o.push(`${s}:${e.line}:${e.column}`);else o.push(`Line ${e.line}, Column ${e.column}`);o.push(`Error: ${t}`),o.push("");let R=Math.max(0,i-1),c=Math.min(r.length-1,i+1);for(let a=R;a<=c;a++){let u=(a+1).toString().padStart(4," "),l=a===i?">":" ";if(o.push(`${l} ${u} | ${r[a]}`),a===i){let g=" ".repeat(8+e.column-1);o.push(`${g}^`)}}return o.join(`
6
- `)}function ze(n,e,t){let s={file:e,message:"Unknown error",code:Ce.UNKNOWN_ERROR};if(n instanceof Error){s.message=n.message,s.stack=n.stack;let r=n.message.match(/\((\d+),(\d+)\)/);if(r)s.location={line:Number.parseInt(r[1],10),column:Number.parseInt(r[2],10)};if(n.message.includes("Cannot find")||n.message.includes("not found"))s.code=Ce.FILE_NOT_FOUND,s.suggestion="Check that the file path is correct and the file exists.";else if(n.message.includes("syntax")||n.message.includes("Unexpected token"))s.code=Ce.SYNTAX_ERROR,s.suggestion="Check for syntax errors in your TypeScript code.";else if(n.message.includes("type")&&n.message.includes("cannot"))s.code=Ce.TYPE_INFERENCE_ERROR,s.suggestion="Add explicit type annotations to help with type inference.";else if(n.message.includes("parse")||n.message.includes("Parse"))s.code=Ce.PARSE_ERROR,s.suggestion="The file contains invalid TypeScript syntax."}else if(typeof n==="string")s.message=n;return s}function xt(n,e){let t=[],s=n.file;if(n.location)s+=`:${n.location.line}:${n.location.column}`;if(n.code)s+=` [${n.code}]`;if(t.push(s),t.push(` Error: ${n.message}`),e&&n.location){t.push("");let r=e.split(`
7
- `),i=n.location.line-1;if(i>=0&&i<r.length){let o=Math.max(0,i-1),R=Math.min(r.length-1,i+1);for(let c=o;c<=R;c++){let a=(c+1).toString().padStart(4," "),u=c===i?">":" ";if(t.push(` ${u} ${a} | ${r[c]}`),c===i&&n.location.column>0){let l=" ".repeat(10+n.location.column-1);t.push(` ${l}^`)}}}}if(n.suggestion)t.push(""),t.push(` Suggestion: ${n.suggestion}`);return t.join(`
8
- `)}function _o(n){if(n.length===0)return"No errors";let e=new Map;for(let s of n){let r=s.code||"UNKNOWN";e.set(r,(e.get(r)||0)+1)}let t=[`${n.length} error(s) found:`];for(let[s,r]of e.entries())t.push(` - ${s}: ${r}`);return t.join(`
2
+ var fe={PARSE_ERROR:"PARSE_ERROR",SYNTAX_ERROR:"SYNTAX_ERROR",FILE_NOT_FOUND:"FILE_NOT_FOUND",FILE_READ_ERROR:"FILE_READ_ERROR",FILE_WRITE_ERROR:"FILE_WRITE_ERROR",TYPE_INFERENCE_ERROR:"TYPE_INFERENCE_ERROR",UNRESOLVED_TYPE:"UNRESOLVED_TYPE",EXTRACTION_ERROR:"EXTRACTION_ERROR",PROCESSING_ERROR:"PROCESSING_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",INVALID_DECLARATION:"INVALID_DECLARATION",CONFIG_ERROR:"CONFIG_ERROR",INVALID_ENTRYPOINT:"INVALID_ENTRYPOINT",CIRCULAR_DEPENDENCY:"CIRCULAR_DEPENDENCY",TIMEOUT_ERROR:"TIMEOUT_ERROR",NOT_SUPPORTED:"NOT_SUPPORTED",UNKNOWN_ERROR:"UNKNOWN_ERROR"};class v extends Error{code;context;constructor(n,e="UNKNOWN_ERROR",t){super(n);if(this.name="DtsxError",this.code=e,this.context=t,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toString(){let n=`${this.name} [${this.code}]: ${this.message}`;if(this.context)n+=`
3
+ Context: ${JSON.stringify(this.context,null,2)}`;return n}toJSON(){return{name:this.name,code:this.code,message:this.message,context:this.context,stack:this.stack}}}class pn extends v{filePath;line;column;constructor(n,e,t){super(n,"PARSE_ERROR",{filePath:e,line:t?.line,column:t?.column});if(this.name="ParseError",this.filePath=e,this.line=t?.line,this.column=t?.column,t?.cause)this.cause=t.cause}get locationString(){if(this.line!==void 0&&this.column!==void 0)return`${this.filePath}:${this.line}:${this.column}`;return this.line!==void 0?`${this.filePath}:${this.line}`:this.filePath}}class Yr extends v{filePath;declarationKind;constructor(n,e,t,s){super(n,"EXTRACTION_ERROR",{filePath:e,declarationKind:t});if(this.name="ExtractionError",this.filePath=e,this.declarationKind=t,s)this.cause=s}}class Xr extends v{declarationName;constructor(n,e,t){super(n,"PROCESSING_ERROR",{declarationName:e});if(this.name="ProcessingError",this.declarationName=e,t)this.cause=t}}class mn extends v{filePath;operation;constructor(n,e,t,s){super(n,t==="read"?"FILE_READ_ERROR":"FILE_WRITE_ERROR",{filePath:e,operation:t});if(this.name="FileError",this.filePath=e,this.operation=t,s)this.cause=s}}class gn extends v{configPath;invalidKey;constructor(n,e){super(n,"CONFIG_ERROR",{configPath:e?.configPath,invalidKey:e?.invalidKey});if(this.name="ConfigError",this.configPath=e?.configPath,this.invalidKey=e?.invalidKey,e?.cause)this.cause=e.cause}}class Zr extends v{cycle;constructor(n){super(`Circular dependency detected: ${n.join(" -> ")}`,"CIRCULAR_DEPENDENCY",{cycle:n});this.name="CircularDependencyError",this.cycle=n}}function io(n){return n instanceof v}function so(n){return n instanceof pn}function oo(n){return n instanceof mn}function ao(n){return n instanceof gn}function co(n,e="UNKNOWN_ERROR",t){if(n instanceof v)return n;let s=t||(n instanceof Error?n.message:String(n)),r=new v(s,e);if(n instanceof Error)r.cause=n;return r}function lo(n,e){let t=1,s=1,r=0;for(let i of n){if(r>=e)break;if(i===`
4
+ `)t++,s=1;else s++;r++}return{line:t,column:s,offset:e}}function uo(n,e,t,s){let r=n.split(`
5
+ `),i=e.line-1,o=[];if(s)o.push(`${s}:${e.line}:${e.column}`);else o.push(`Line ${e.line}, Column ${e.column}`);o.push(`Error: ${t}`),o.push("");let E=Math.max(0,i-1),c=Math.min(r.length-1,i+1);for(let a=E;a<=c;a++){let R=(a+1).toString().padStart(4," "),u=a===i?">":" ";if(o.push(`${u} ${R} | ${r[a]}`),a===i){let l=" ".repeat(8+e.column-1);o.push(`${l}^`)}}return o.join(`
6
+ `)}function _e(n,e,t){let s={file:e,message:"Unknown error",code:fe.UNKNOWN_ERROR};if(n instanceof Error){s.message=n.message,s.stack=n.stack;let r=n.message.match(/\((\d+),(\d+)\)/);if(r)s.location={line:Number.parseInt(r[1],10),column:Number.parseInt(r[2],10)};if(n.message.includes("Cannot find")||n.message.includes("not found"))s.code=fe.FILE_NOT_FOUND,s.suggestion="Check that the file path is correct and the file exists.";else if(n.message.includes("syntax")||n.message.includes("Unexpected token"))s.code=fe.SYNTAX_ERROR,s.suggestion="Check for syntax errors in your TypeScript code.";else if(n.message.includes("type")&&n.message.includes("cannot"))s.code=fe.TYPE_INFERENCE_ERROR,s.suggestion="Add explicit type annotations to help with type inference.";else if(n.message.includes("parse")||n.message.includes("Parse"))s.code=fe.PARSE_ERROR,s.suggestion="The file contains invalid TypeScript syntax."}else if(typeof n==="string")s.message=n;return s}function pt(n,e){let t=[],s=n.file;if(n.location)s+=`:${n.location.line}:${n.location.column}`;if(n.code)s+=` [${n.code}]`;if(t.push(s),t.push(` Error: ${n.message}`),e&&n.location){t.push("");let r=e.split(`
7
+ `),i=n.location.line-1;if(i>=0&&i<r.length){let o=Math.max(0,i-1),E=Math.min(r.length-1,i+1);for(let c=o;c<=E;c++){let a=(c+1).toString().padStart(4," "),R=c===i?">":" ";if(t.push(` ${R} ${a} | ${r[c]}`),c===i&&n.location.column>0){let u=" ".repeat(10+n.location.column-1);t.push(` ${u}^`)}}}}if(n.suggestion)t.push(""),t.push(` Suggestion: ${n.suggestion}`);return t.join(`
8
+ `)}function fo(n){if(n.length===0)return"No errors";let e=new Map;for(let s of n){let r=s.code||"UNKNOWN";e.set(r,(e.get(r)||0)+1)}let t=[`${n.length} error(s) found:`];for(let[s,r]of e.entries())t.push(` - ${s}: ${r}`);return t.join(`
9
9
  `)}
10
- export{Ce,E,$n,mi,gi,En,kn,hi,Io,Fo,Lo,No,Bo,Wo,jo,ze,xt,_o};
10
+ export{fe,v,pn,Yr,Xr,mn,gn,Zr,io,so,oo,ao,co,lo,uo,_e,pt,fo};
@@ -0,0 +1,27 @@
1
+ // @bun
2
+ import{t,d}from"./chunk-1j6092xz.js";import{W}from"./chunk-ag1b6d30.js";import{Pt}from"./chunk-yx1jy7fx.js";import{b}from"./chunk-vf3ybe5r.js";import{Y}from"./chunk-p9vfxn8g.js";import{relative as O}from"path";function J(n){let y=t(n),c=(l)=>y[l]?n.slice(y[l].start,y[l].end):"",i=c(0)==="export"?1:0;if(c(i++)!=="declare")return;let f;if(c(i)==="module"&&y[i+1]?.kind==="quoted"){if(f=d(c(i+1)),f===void 0)return;i+=2}else if(c(i++)!=="global")return;if(c(i)!=="{")return;let h=y[i].end,S=1;for(i++;i<y.length;i++)if(c(i)==="{")S++;else if(c(i)==="}"&&--S===0)return{specifier:f,body:n.slice(h,y[i].start),start:h,end:y[i].start};return}var ne=/^[A-Z_$][\w$]*$/i;function bo(n){let y=[],c=[],i=0,f=0,h=[],S=!1,l=0,E=n.length,R=(a)=>{let w=n.slice(i,a).trim();if(i=a,!w)return;if(se(w)){c.push(w);return}y.push({text:w,comments:c}),c=[]};while(l<E){let a=n[l];if(S){if(a==="\\"){l+=2;continue}if(a==="`"){S=!1,l++;continue}if(a==="$"&&n[l+1]==="{"){h.push(f),f++,S=!1,l+=2;continue}l++;continue}if(a==="/"&&n[l+1]==="*"){let w=n.indexOf("*/",l+2);l=w===-1?E:w+2;continue}if(a==="/"&&n[l+1]==="/"){let w=n.indexOf(`
3
+ `,l);l=w===-1?E:w;continue}if(a==="'"||a==='"'){l++;while(l<E&&n[l]!==a&&n[l]!==`
4
+ `){if(n[l]==="\\")l++;l++}l++;continue}if(a==="`"){S=!0,l++;continue}if(a==="("||a==="["||a==="{"){f++,l++;continue}if(a===")"||a==="]"||a==="}"){if(f--,h.length>0&&a==="}"&&f===h[h.length-1])h.pop(),S=!0;l++;continue}if(f===0&&a===";"){R(l+1),l++;continue}if(f===0&&a===`
5
+ `){let w=n[l+1];if(w!==void 0&&/[\w$@/]/.test(w))R(l+1);l++;continue}l++}return R(E),y}function se(n){let y=0;while(y<n.length){while(y<n.length&&/\s/.test(n[y]))y++;if(y>=n.length)return!0;if(n.startsWith("//",y)){let c=n.indexOf(`
6
+ `,y);y=c===-1?n.length:c;continue}if(n.startsWith("/*",y)){let c=n.indexOf("*/",y+2);if(c===-1)return!0;y=c+2;continue}return!1}return!0}function X(n){let y=[];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;y.push({local:f[1],exported:f[2]??f[1]})}return y}var ie=/^(?: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 oe(n,y){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()} ${y}`);if(/^(?:interface|type)\b/.test(c)||/^declare\b/.test(c))return c;return`declare ${c}`}function F(n,y,c=!1){let i={file:n,declarations:[],declared:new Set,imports:new Map,localExports:new Map,namedReExports:[],starReExports:[],namespaceReExports:[],verbatim:[],augmentations:[],directives:[]},f=c?Pt(y,n).map((h)=>({text:h.text,comments:[...h.leadingComments??[]]})):bo(y);for(let h of f){h.comments=h.comments.filter((w)=>{if(/^\/\/\/\s*</.test(w))return i.directives.push(...w.split(`
7
+ `).map((v)=>v.trim()).filter((v)=>v.startsWith("///"))),!1;return!0});let S=h.text.replace(/;\s*$/,"").trim(),l=S.startsWith("import")?b(S):null;if(l&&!l.isImportEquals){let w=l.source;if(l.defaultName)i.imports.set(l.defaultName,{specifier:w,imported:"default"});if(l.namespaceName)i.imports.set(l.namespaceName,{specifier:w,imported:"*"});for(let v of l.namedItems)i.imports.set(v.name,{specifier:w,imported:/^['"]/.test(v.originalName)?d(v.originalName):v.originalName});continue}if(/^import\s+['"]/.test(S)){i.verbatim.push(h);continue}let E=S.match(/^export\s+(?:type\s+)?\*\s+as\s+([\w$]+)\s+from\s+(['"])([^'"]+)\2/);if(E){i.namespaceReExports.push({specifier:E[3],exported:E[1]});continue}if(E=S.match(/^export\s+(?:type\s+)?\*\s+from\s+(['"])([^'"]+)\1/),E){i.starReExports.push(E[2]);continue}if(E=S.match(/^export\s+(?:type\s+)?\{([\s\S]*)\}\s+from\s+(['"])([^'"]+)\2/),E){for(let w of X(E[1]))i.namedReExports.push({specifier:E[3],imported:w.local,exported:w.exported});continue}if(E=S.match(/^export\s+(?:type\s+)?\{([\s\S]*)\}$/),E){for(let w of X(E[1]))i.localExports.set(w.exported,w.local);continue}if(E=S.match(/^export\s+default\s+([\w$]+)$/),E&&ne.test(E[1])){i.localExports.set("default",E[1]);continue}let R=J(S);if(R?.specifier!==void 0&&W(y)){i.augmentations.push({statement:h,specifier:R.specifier,body:R.body});continue}if(/^export\s+as\s+namespace\b/.test(S)||R){i.verbatim.push(h);continue}let a=S.match(ie);if(a){let w=!!a[1],v=a[4]??(w?"_default":null);if(v){if(i.declared.add(v),/^export\s/.test(S))i.localExports.set(w?"default":v,v);i.declarations.push({statement:h,name:v,emit:oe(h.text,v)});continue}}i.declarations.push({statement:h,name:null,emit:h.text})}return i}function Ue(n,y){if(y.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,S=[];for(let m=0;m<c.length;m++){let x=f(m);if(["(","[","{","<"].includes(x))S.push(m);else if([")","]","}",">"].includes(x)&&!(x===">"&&f(m-1)==="=")){let k=S.at(-1);if(k!==void 0&&["()","[]","{}","<>"].includes(f(k)+x))S.pop(),h.set(k,m)}}let l=(m)=>{for(let x=m;x<c.length;x++){if([";",",",")","]","}"].includes(f(x))||f(x)===">"&&f(x-1)!=="=")return x;let k=h.get(x);if(k!==void 0)x=k}return c.length},E=new Set;for(let m=0;m<c.length;m++){let x=h.get(m);if(f(m)!=="<"||x===void 0)continue;let k=["class","interface","type"].includes(f(m-2));if(!k&&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(k&&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)E.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 k=Pt(n.slice(c[m+2].end,c[x].start),"bundle-namespace.ts"),N=new Set(k.filter((u)=>["class","interface","type","enum","module","namespace"].includes(u.kind)).map((u)=>u.name)),I=new Set(k.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)))E.add(c[u].start)}let R="",a=0,w=n.length,v=`
8
+ `;while(a<w){let m=i.get(a);if(m!==void 0){R+=n.slice(a,m),a=m,v="`";continue}let x=n[a];if(x==="/"&&n[a+1]==="*"){let k=n.indexOf("*/",a+2),N=k===-1?w:k+2;R+=n.slice(a,N),a=N;continue}if(x==="/"&&n[a+1]==="/"){let k=n.indexOf(`
9
+ `,a),N=k===-1?w:k;R+=n.slice(a,N),a=N;continue}if(x==="'"||x==='"'){let k=a+1;while(k<w&&n[k]!==x&&n[k]!==`
10
+ `){if(n[k]==="\\")k++;k++}R+=n.slice(a,k+1),a=k+1,v=x;continue}if(/[A-Z_$]/i.test(x)){let k=a+1;while(k<w&&/[\w$]/.test(n[k]))k++;let N=n.slice(a,k),I=y.get(N);if(I!==void 0&&v!=="."&&!E.has(a)){let u=k;while(u<w&&(n[u]===" "||n[u]==="\t"))u++;let D=(n[u]===":"||n[u]==="?"&&n[u+1]===":")&&/[{;,(\n]/.test(v);R+=D?N:I}else R+=N;v="a",a=k;continue}if(R+=x,x===`
11
+ `||!/\s/.test(x))v=x;a++}return R}function hn(n,y,c,i){let f=[],h=new Map,S=[n,...y.filter((e)=>e!==n)];for(let e of S){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=Y(e,s).resolved;return o&&h.has(o)?o:null},E=(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},w=new Map;for(let[e,s]of h){let o=new Map;for(let g of s.declared)o.set(g,a(g));w.set(e,o)}let v=new Map,m=(e,s,o)=>{let g=`${e}\x00${s}`,r=v.get(g);if(!r)r=a(o),v.set(g,r);return r},x=new Map,k=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(E(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}},ee=(e,s)=>{if(e.declared.has(s))return{kind:"local",name:w.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,M]of g.localExports){let B=ee(g,M);if(B)o.set(p,B)}for(let p of g.namedReExports){let M=D(g,p.specifier,p.imported);if(M)o.set(p.exported,M)}for(let p of g.namespaceReExports){let M=D(g,p.specifier,"*");if(M)o.set(p.exported,M)}for(let p of g.starReExports){let M=l(p,e);if(M){for(let[B,C]of L(M))if(B!=="default"&&!o.has(B))o.set(B,C);for(let B of k.get(M)??[])r.add(B)}else if(E(p))f.push(`${O(i.cwd,e)}: '${p}' is not part of the bundle`);else r.add(p)}for(let[p,M]of I.get(e)??[])o.set(p,M);return N.delete(e),x.set(e,o),k.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(),k.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 te(e.file,s)}};function te(e,s){let o=Q.get(e);if(o)return o;let g=a(s);Q.set(e,g);let r=[];for(let[p,M]of L(e)){if(p==="default")continue;let B=T(M,p);r.push(B===p?p:`${B} as ${p}`)}if(k.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} {
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 w.get(e))if(r!==p)o.set(r,p);for(let[r,p]of s.imports){if(s.declared.has(r))continue;let M=D(s,p.specifier,p.imported);if(!M)continue;let B=T(M,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=Ue(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 M=new Map(o);for(let B of F(e,p.body,!0).declared)M.delete(B);A.push(r.text.slice(0,p.start)+Ue(p.body,M)+r.text.slice(p.end))}else{let M=t(r.text),B=M[1]?.kind==="quoted"?d(r.text.slice(M[1].start,M[1].end)):void 0;if(B===void 0||!l(B,e))A.push(Ue(r.text,o))}}for(let r of s.augmentations){let p=l(r.specifier,e),M=F(e,r.body,!0),B=new Map(o);if(!p){for(let P of M.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)+Ue(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 M.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(Ue(C.emit,B))}}if(g.length>0)U.push(`// From: ${O(i.cwd,e)}
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 k.get(n)??[])q.push(`export * from '${e}';`);let K=new Map;for(let[e,s]of v){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 _=[];for(let[e,s]of[...K].sort(([o],[g])=>o.localeCompare(g))){for(let o of s.defaults)_.push(`import ${o} from '${e}';`);for(let o of s.namespaces)_.push(`import * as ${o} from '${e}';`);if(s.named.length>0)_.push(`import { ${s.named.join(", ")} } from '${e}';`)}let j=[];if(Z.size>0)j.push([...Z].join(`
16
+ `));if(j.push(`/**
17
+ * Bundled TypeScript declarations
18
+ * Generated from ${h.size} source files
19
+ */`),_.length>0)j.push(_.join(`
20
+ `));if(j.push(...U),H.length>0)j.push(H.join(`
21
+ `));if(A.length>0)j.push(A.join(`
22
+ `));let z=[];if(G.length>0)z.push(`export { ${G.join(", ")} };`);if(z.push(...q),z.length===0)z.push("export {};");return j.push(z.join(`
23
+ `)),{content:`${j.join(`
24
+
25
+ `)}
26
+ `,files:[...h.keys()],exportCount:V.size,warnings:f}}
27
+ export{bo,Ue,hn};
@@ -0,0 +1,29 @@
1
+ // @bun
2
+ import{f,Pe}from"./chunk-cv29b4zb.js";import{Rt,Mt,n,Ae,j}from"./chunk-8d3sdkv4.js";function g(t){if(t.includes(`
3
+ `))return`/**
4
+ * ${t}
5
+ */
6
+ `;return`/** ${t} */
7
+ `}function D(t){let o=t.indexOf("{");if(o===-1)return-1;let s=t.indexOf("<");if(s===-1||s>o)return o;let e=0,r=!1,a="";for(let i=0;i<t.length;i++){let l=t[i],u=i>0?t[i-1]:"";if(!r&&(l==='"'||l==="'"||l==="`"))r=!0,a=l;else if(r&&l===a&&u!=="\\")r=!1;if(!r){if(l==="<")e++;else if(l===">")e--;else if(l==="{"&&e===0)return i}}return-1}function ee(t,o=!0){return f(t.leadingComments,o)+t.text}function h(t,o=!0){if(t.inferenceError)throw Object.assign(Error(`Cannot infer alias '${t.name}': unsupported source value flow`),{code:t.inferenceError});let s=f(t.leadingComments,o);if(!t.typeAnnotation&&t.inferredType)return s+t.text;if(t.typeAnnotation&&!t.value)return s+t.text;let e="";if(t.isExported)e+="export ";e+="declare ";let r=t.modifiers?.[0]||"const";e+=`${r} `,e+=t.name;let{typeAnnotation:a,value:i}=t,l=!a&&i?j(i):null;if(l)a=l;else if(!a&&i&&i.trim().endsWith("as const"))a=n(i,!0,!1,0,t.computedKeyConstants);else if(!a&&i&&r==="const"){let c=i.trim(),m=c.startsWith("{")||c.startsWith("[");if(m)Rt();a=n(i,!m,!1,0,t.computedKeyConstants)}else if(!a&&i)a=n(i,r==="const",!1,0,t.computedKeyConstants);if(!a)a="unknown";let u="";if(o&&i&&!t.typeAnnotation&&!i.trim().endsWith("as const")){let c=i.trim();if(r!=="const"){if((a==="string"||a==="number"||a==="boolean")&&c.length>0)u=`@defaultValue ${c}`}else if(c.startsWith("{")||c.startsWith("[")){let m=Mt();if(m)if(m.includes(`
8
+ `))u=`@defaultValue
9
+ * \`\`\`ts
10
+ ${m.split(`
11
+ `).map((p)=>` * ${p}`).join(`
12
+ `)}
13
+ * \`\`\``;else u=`@defaultValue \`${m}\``}}else if(o&&i&&t.typeAnnotation&&Ae(t.typeAnnotation)){Rt();let c=i.trim(),m=c.endsWith("as const")?c.slice(0,-8).trim():c;n(m,!1,!1,0,t.computedKeyConstants);let x=Mt();if(x)if(x.includes(`
14
+ `))u=`@defaultValue
15
+ * \`\`\`ts
16
+ ${x.split(`
17
+ `).map((d)=>` * ${d}`).join(`
18
+ `)}
19
+ * \`\`\``;else u=`@defaultValue \`${x}\``}if(u=Pe(u),e+=`: ${a};`,u&&s&&s.includes("@defaultValue"))u="";if(u&&s){let c=s.trimEnd(),m=c.lastIndexOf("*/");if(m!==-1){let p=c.slice(0,m).trimEnd();if(p.startsWith("/** ")&&!p.includes(`
20
+ `))p=`/**
21
+ * ${p.slice(4)}`;return`${p}
22
+ * ${u}
23
+ */
24
+ `+e}return`/**
25
+ * ${c.replace(/^\/\/\s*/,"")}
26
+ * ${u}
27
+ */
28
+ ${e}`}if(u)return`${g(u)}${e}`;return s+e}function te(t,o=!0){let s=f(t.leadingComments,o),e=t.text;if(e.startsWith("export declare interface")||e.startsWith("declare interface"))return s+e;let r="";if(t.isExported)r+="export ";if(r+="declare interface ",r+=t.name,t.generics)r+=t.generics;if(t.extends)r+=` extends ${t.extends}`;let a=D(t.text);if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}function ne(t,o=!0){let s=f(t.leadingComments,o);if(t.text.includes("{")&&t.text.includes("}")&&t.text.includes("from"))return s+t.text;let e="";if(t.isExported)e+="export ";if(!t.isExported&&!t.text.includes(" from "))e+="declare ";let r=t.text.indexOf("type ");if(r!==-1){let i=t.text.slice(r),l=i.length;while(l>0&&(i.charCodeAt(l-1)===59||i.charCodeAt(l-1)===32||i.charCodeAt(l-1)===10||i.charCodeAt(l-1)===13))l--;if(l<i.length)i=i.slice(0,l);e+=i}else{if(e+=`type ${t.name}`,t.generics)e+=t.generics;e+=" = any"}let a=e.trimEnd();if(!a.endsWith(";")&&!a.endsWith("}"))e+=";";return s+e}function re(t,o=!0){return f(t.leadingComments,o)+t.text}function ie(t,o=!0){let s=f(t.leadingComments,o),e="";if(t.isExported)e+="export ";if(e+="declare ",t.modifiers?.includes("const"))e+="const ";e+="enum ",e+=t.name;let r=t.text.indexOf("{");if(r!==-1)e+=` ${t.text.slice(r)}`;else e+=" {}";return s+e}function On(t){let o=t.text.trim(),s=o.length;while(s>0&&o.charCodeAt(s-1)===59)s--;if(s<o.length)o=o.slice(0,s);return o+=";",o}function In(t,o=!0){return f(t.leadingComments,o)+t.text.trim()}function se(t,o=!0){let s=f(t.leadingComments,o);if(t.text.startsWith("declare global"))return s+t.text;if(t.source||(t.name.startsWith('"')||t.name.startsWith("'")||t.name.startsWith("`"))){let i="declare module ";i+=t.name;let l=t.text.indexOf("{");if(l!==-1)i+=` ${t.text.slice(l)}`;else i+=" {}";return s+i}let r="";if(t.isExported)r+="export ";if(!t.modifiers?.includes("declare"))r+="declare ";r+="namespace ",r+=t.name;let a=t.text.indexOf("{");if(a!==-1)r+=` ${t.text.slice(a)}`;else r+=" {}";return s+r}
29
+ export{ee,h,te,ne,re,ie,On,In,se};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{t,d,x}from"./chunk-1j6092xz.js";import{w}from"./chunk-n2nyd0ck.js";function q(n){return typeof n==="string"?x(n,"'"):String(n)}function Jo(n,k,m=new Map){let o=t(n),e=new Map(m),i=new Map,f=[],c=1,p=0,A=0;for(let r=1;r<o.length;r++){let v=o[r],h=n.slice(v.start,v.end);if(v.kind==="punctuation"&&p===0&&(h===","||h==="}")){let l=o.slice(c,r),a=l[0];if(a){let u=a.kind==="quoted"?d(n.slice(a.start,a.end)):n.slice(a.start,a.end),M=l.findIndex((g)=>g.kind==="punctuation"&&n[g.start]==="="),s=A;if(M>=0){let g=l.slice(M+1),b="",S=l[M].end;for(let y=0;y+2<g.length;y++){let[B,E,C]=g.slice(y,y+3);if(B.kind!=="word"||C.kind!=="word"||n.slice(E.start,E.end)!==".")continue;let D=e.get(`${n.slice(B.start,B.end)}.${n.slice(C.start,C.end)}`);if(D===void 0||typeof D==="object")continue;b+=n.slice(S,B.start)+q(D),S=C.end,y+=2}b+=n.slice(S,l.at(-1).end),s=w(b,e),f.push({start:l[M].start,end:l.at(-1).end,text:s===void 0?"":`= ${q(s)}`})}else if(s!==void 0)f.push({start:a.end,end:a.end,text:` = ${q(s)}`});if(A=typeof s==="number"?s+1:void 0,u!==void 0){if(e.delete(u),e.delete(`${k}.${u}`),s!==void 0)i.set(u,s),e.set(u,s),e.set(`${k}.${u}`,s)}}c=r+1}else if(v.kind==="punctuation"){if("([{".includes(h))p++;else if(")]}".includes(h))p--}}let K=n;for(let r of f.reverse())K=K.slice(0,r.start)+r.text+K.slice(r.end);return{body:K,members:i}}function Pn(n,k){let m=[...new Set([...n,...k.values()])];if(!m.some((e)=>e.kind==="enum"))return;m.sort((e,i)=>(e.start??0)-(i.start??0));let o=new Map;for(let e of m)if(e.kind==="enum"){let i=e.text.indexOf("{");if(i<0)continue;if(t(e.text.slice(0,i)).some((c)=>e.text.slice(c.start,c.end)==="declare"))continue;let f=Jo(e.text.slice(i),e.name,o);e.text=e.text.slice(0,i)+f.body;for(let[c,p]of f.members)o.set(`${e.name}.${c}`,p)}else if(e.kind==="variable"&&e.modifiers?.[0]==="const"&&!e.typeAnnotation&&!e.modifiers.includes("const assertion")&&typeof e.value==="string"){let i=w(e.value,o);if(i!==void 0)o.set(e.name,i)}}
3
- export{Jo,Pn};
2
+ import{t,d,x}from"./chunk-1j6092xz.js";import{w}from"./chunk-32qexm3w.js";function q(n){return typeof n==="string"?x(n,"'"):String(n)}function aa(n,k,m=new Map){let o=t(n),e=new Map(m),i=new Map,f=[],c=1,p=0,A=0;for(let r=1;r<o.length;r++){let v=o[r],h=n.slice(v.start,v.end);if(v.kind==="punctuation"&&p===0&&(h===","||h==="}")){let l=o.slice(c,r),a=l[0];if(a){let u=a.kind==="quoted"?d(n.slice(a.start,a.end)):n.slice(a.start,a.end),M=l.findIndex((g)=>g.kind==="punctuation"&&n[g.start]==="="),s=A;if(M>=0){let g=l.slice(M+1),b="",S=l[M].end;for(let y=0;y+2<g.length;y++){let[B,E,C]=g.slice(y,y+3);if(B.kind!=="word"||C.kind!=="word"||n.slice(E.start,E.end)!==".")continue;let D=e.get(`${n.slice(B.start,B.end)}.${n.slice(C.start,C.end)}`);if(D===void 0||typeof D==="object")continue;b+=n.slice(S,B.start)+q(D),S=C.end,y+=2}b+=n.slice(S,l.at(-1).end),s=w(b,e),f.push({start:l[M].start,end:l.at(-1).end,text:s===void 0?"":`= ${q(s)}`})}else if(s!==void 0)f.push({start:a.end,end:a.end,text:` = ${q(s)}`});if(A=typeof s==="number"?s+1:void 0,u!==void 0){if(e.delete(u),e.delete(`${k}.${u}`),s!==void 0)i.set(u,s),e.set(u,s),e.set(`${k}.${u}`,s)}}c=r+1}else if(v.kind==="punctuation"){if("([{".includes(h))p++;else if(")]}".includes(h))p--}}let K=n;for(let r of f.reverse())K=K.slice(0,r.start)+r.text+K.slice(r.end);return{body:K,members:i}}function Mn(n,k){let m=[...new Set([...n,...k.values()])];if(!m.some((e)=>e.kind==="enum"))return;m.sort((e,i)=>(e.start??0)-(i.start??0));let o=new Map;for(let e of m)if(e.kind==="enum"){let i=e.text.indexOf("{");if(i<0)continue;if(t(e.text.slice(0,i)).some((c)=>e.text.slice(c.start,c.end)==="declare"))continue;let f=aa(e.text.slice(i),e.name,o);e.text=e.text.slice(0,i)+f.body;for(let[c,p]of f.members)o.set(`${e.name}.${c}`,p)}else if(e.kind==="variable"&&e.modifiers?.[0]==="const"&&!e.typeAnnotation&&!e.modifiers.includes("const assertion")&&typeof e.value==="string"){let i=w(e.value,o);if(i!==void 0)o.set(e.name,i)}}
3
+ export{aa,Mn};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{e,I}from"./chunk-km8t8gqg.js";import{Re}from"./chunk-pzedkn7z.js";import{s}from"./chunk-0azm93j9.js";import{existsSync as u,readFileSync as w}from"fs";import{dirname as W,join as d,resolve as v}from"path";async function Hr(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(Re(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 Kr(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 nn(i){let c=Date.now(),n=Kr(i.projects);e.info(`Generating declarations for ${n.length} projects...`);let t=[],a=!0;for(let r of n){e.info(`
2
+ import{e,A}from"./chunk-yay68832.js";import{ve}from"./chunk-cpmqa8kd.js";import{s}from"./chunk-0zfzhn19.js";import{existsSync as u,readFileSync as w}from"fs";import{dirname as W,join as d,resolve as v}from"path";async function jr(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(ve(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 _r(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 nn(i){let c=Date.now(),n=_r(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 oo(i,c){if(c?.logLevel)I(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 Hr(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`),nn({root:i,projects:t,sharedConfig:c})}async function qr(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 Jr(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 ao(i,c){if(c?.logLevel)I(c.logLevel);let n=await qr(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 Jr(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 nn({root:i,projects:a,sharedConfig:c})}
6
- export{Hr,Kr,nn,oo,qr,Jr,ao};
5
+ `),{success:a,projects:t,durationMs:f}}async function qs(i,c){if(c?.logLevel)A(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 jr(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`),nn({root:i,projects:t,sharedConfig:c})}async function Gr(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 Vr(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 Js(i,c){if(c?.logLevel)A(c.logLevel);let n=await Gr(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 Vr(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 nn({root:i,projects:a,sharedConfig:c})}
6
+ export{jr,_r,nn,qs,Gr,Vr,Js};
@@ -0,0 +1,10 @@
1
+ // @bun
2
+ import{W,jn,_n}from"./chunk-ag1b6d30.js";import{dn}from"./chunk-zk3w5sqv.js";import{f}from"./chunk-cv29b4zb.js";import{ee,h,te,ne,re,ie,se}from"./chunk-xa6rsd4b.js";import{Ee,b}from"./chunk-vf3ybe5r.js";import{xe}from"./chunk-4fygcxtb.js";function V(k,x){throw Error(x||`Unexpected value: ${k}`)}var j=null,q=[],z=[];function l(k,x,d=!0,y=["bun"]){let o="",m=x.sourceCode;if(m){let e=0;while(e<m.length&&(m.charCodeAt(e)===32||m.charCodeAt(e)===9||m.charCodeAt(e)===10||m.charCodeAt(e)===13))e++;if(e<m.length-2&&m.charCodeAt(e)===47&&m.charCodeAt(e+1)===47&&m.charCodeAt(e+2)===47){let i=dn(m);if(i.length>0)for(let r=0;r<i.length;r++){if(o)o+=`
3
+ `;o+=i[r]}}}let w=[],N=[],M=[],P=[],U=[],_=[],F=[],C=[],T=[];for(let e of k){let i=e.kind;switch(i){case"import":w.push(e);break;case"function":N.push(e);break;case"variable":M.push(e);break;case"interface":P.push(e);break;case"type":U.push(e);break;case"class":_.push(e);break;case"enum":F.push(e);break;case"module":C.push(e);break;case"export":T.push(e);break;case"namespace":C.push(e);break;case"unknown":break;default:V(i,`Unhandled declaration kind: ${i}`)}}let S=[],v=[],A=[],K=new Set;for(let e of T){let i=f(e.leadingComments,d);if(e.text.startsWith("export default")){let r=e.text.endsWith(";")?e.text:`${e.text};`;A.push(i+r)}else{let r=e.text.trim();if(!r.endsWith(";"))r+=";";let a=i+r;if(!K.has(a))if(K.add(a),a.includes("export type"))S.push(a);else v.push(a)}}let u=[];if(w.length>0){let{usedItems:e}=xe(k);for(let r of w){if(r.isSideEffect){let t=r.text.trim(),p=t.endsWith(";")?t:`${t};`;u.push(p);continue}let a=b(r.text);if(!a)continue;let{defaultName:s,namedItems:n,isTypeOnly:g,namespaceName:c}=a,D=s?e.has(s):!1,L=c?e.has(c):!1;if(a.isImportEquals){if(D){let t=r.text.trim();u.push(t.endsWith(";")?t:`${t};`)}else if(x.augmentationImports?.has(a.source)){let t=Ee(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}continue}let I="",E=0;for(let t=0;t<n.length;t++){let p=n[t];if(e.has(p.name)){if(E>0)I+=", ";if(!g&&p.isTypeOnly)I+="type ";I+=p.originalName===p.name?p.name:`${p.originalName} as ${p.name}`,E++}}if(D||L||E>0){let t=g?"import type ":"import ";if(L&&c){if(D&&s)t+=`${s}, `;t+=`* as ${c}`}else if(D&&s)t+=E>0?`${s}, { ${I} }`:s;else if(E>0)t+=`{ ${I} }`;let p=Ee(r.text);if(!p)throw Error("Cannot locate a grammatical module literal in the import declaration");t+=` from ${p};`,u.push(t)}else if(x.augmentationImports?.has(a.source)){let t=Ee(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}}let i=y.length;if(u.length>1){if(j!==y)j=y,q=y.map((n)=>`from '${n}`),z=y.map((n)=>`from "${n}`);let r=q,a=z,s=new Map;for(let n of u){let g=i;for(let c=0;c<y.length;c++)if(n.includes(r[c])||n.includes(a[c])){g=c;break}s.set(n,g)}u.sort((n,g)=>{let c=s.get(n),D=s.get(g);return c!==D?c-D:n.localeCompare(g)})}}for(let e=0;e<u.length;e++){if(o)o+=`
4
+ `;o+=u[e]}for(let e=0;e<S.length;e++){if(o)o+=`
5
+ `;o+=S[e]}let G=[N,M,P,U,_,F,C];for(let e=0;e<G.length;e++){let i=G[e];for(let r=0;r<i.length;r++){let a=i[r],s="",n=a.kind;switch(n){case"function":s=ee(a,d);break;case"variable":s=h(a,d);break;case"interface":s=te(a,d);break;case"type":s=ne(a,d);break;case"class":s=re(a,d);break;case"enum":s=ie(a,d);break;case"module":case"namespace":s=se(a,d);break;case"import":case"export":case"unknown":break;default:V(n,`Unhandled declaration kind in processor: ${n}`)}if(s){if(o)o+=`
6
+ `;o+=s}}}for(let e=0;e<v.length;e++){if(o)o+=`
7
+ `;o+=v[e]}for(let e=0;e<A.length;e++){if(o)o+=`
8
+ `;o+=A[e]}if(T.length===0&&W(x.sourceCode)&&(k.some(_n)||!jn(o)))o+=`${o?`
9
+ `:""}export {};`;return o}
10
+ export{l};