@dtsx/dtsx 0.11.43 → 0.11.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.md +6 -0
  2. package/dist/bin/cli.js +9 -9
  3. package/dist/{chunk-zgj8xq4x.js → chunk-0cynxv6w.js} +2 -2
  4. package/dist/{chunk-aqcjv2v5.js → chunk-1hz6j7bq.js} +21 -21
  5. package/dist/{chunk-b2j236p3.js → chunk-2d3nbfth.js} +2 -2
  6. package/dist/{chunk-9fz5erbq.js → chunk-2y5b6hdw.js} +6 -6
  7. package/dist/{chunk-vsa6gbmz.js → chunk-3eb0gc0y.js} +1 -1
  8. package/dist/{chunk-vae5wxar.js → chunk-3rwbf45t.js} +2 -2
  9. package/dist/{chunk-9c0k2b8n.js → chunk-3shq1bjr.js} +2 -2
  10. package/dist/{chunk-pebt9j6c.js → chunk-3v0yh5dk.js} +2 -2
  11. package/dist/{chunk-ksc4xgdz.js → chunk-4ece5g8t.js} +2 -2
  12. package/dist/{chunk-a3px4jga.js → chunk-4hkf7dda.js} +4 -4
  13. package/dist/chunk-59jw51gg.js +8 -0
  14. package/dist/{chunk-ygpyce6w.js → chunk-5aqwt0a0.js} +4 -4
  15. package/dist/{chunk-cd26g482.js → chunk-65d3dga1.js} +3 -3
  16. package/dist/{chunk-znd7w376.js → chunk-6mryvpxj.js} +5 -5
  17. package/dist/{chunk-3r9dptyy.js → chunk-6pr23q72.js} +2 -2
  18. package/dist/{chunk-2p8za6vr.js → chunk-7ez7gynw.js} +2 -2
  19. package/dist/{chunk-9mtn8sk3.js → chunk-7krb9b1s.js} +2 -2
  20. package/dist/{chunk-9vj0g89m.js → chunk-7x9tawkf.js} +2 -2
  21. package/dist/{chunk-ettcbmzw.js → chunk-86xvq8km.js} +3 -3
  22. package/dist/{chunk-xgj6rxmd.js → chunk-8v43ne8p.js} +3 -3
  23. package/dist/chunk-90f37xen.js +3 -0
  24. package/dist/{chunk-qqjbaqm6.js → chunk-932kxt70.js} +4 -4
  25. package/dist/{chunk-rwwrrxtc.js → chunk-976r899s.js} +4 -4
  26. package/dist/{chunk-06jp6gah.js → chunk-9etacmfx.js} +3 -3
  27. package/dist/{chunk-btc6zbyj.js → chunk-9hjd6p38.js} +2 -2
  28. package/dist/{chunk-51cdjc3e.js → chunk-9qv34ymq.js} +2 -2
  29. package/dist/{chunk-fhbwwm79.js → chunk-an5ra7tr.js} +4 -4
  30. package/dist/{chunk-1903h3dm.js → chunk-anvhqbw8.js} +2 -2
  31. package/dist/{chunk-pekphr39.js → chunk-btmc3e8d.js} +2 -2
  32. package/dist/{chunk-44zq3xnw.js → chunk-c8s4d7qk.js} +6 -6
  33. package/dist/{chunk-7fytm1ya.js → chunk-cgaw8fsn.js} +3 -3
  34. package/dist/{chunk-b79vtkkt.js → chunk-cjhmmqxd.js} +2 -2
  35. package/dist/{chunk-w4fj9m56.js → chunk-cynfv4dt.js} +3 -3
  36. package/dist/{chunk-n1p62kwx.js → chunk-d0aqaj02.js} +2 -2
  37. package/dist/{chunk-36xenw6z.js → chunk-d68r83t9.js} +2 -2
  38. package/dist/{chunk-b0cdncp3.js → chunk-der2ssgq.js} +2 -2
  39. package/dist/{chunk-1hhk0zm6.js → chunk-dzdwc2fh.js} +2 -2
  40. package/dist/{chunk-w3zqfm8a.js → chunk-ehgnwdn9.js} +2 -2
  41. package/dist/{chunk-0xam980d.js → chunk-eptz3q7r.js} +4 -4
  42. package/dist/{chunk-km03xc8j.js → chunk-erymqkk3.js} +6 -6
  43. package/dist/{chunk-j3egtn0s.js → chunk-g19c3m7s.js} +2 -2
  44. package/dist/{chunk-4n2mpvmb.js → chunk-g4rmn34j.js} +2 -2
  45. package/dist/{chunk-xzw0p4nq.js → chunk-gma09qy6.js} +2 -2
  46. package/dist/{chunk-y78fsxjf.js → chunk-h1xwd278.js} +2 -2
  47. package/dist/{chunk-ah3pwsh5.js → chunk-hnckev96.js} +4 -4
  48. package/dist/{chunk-5v7drjwg.js → chunk-hwgxwgsh.js} +2 -2
  49. package/dist/chunk-hyszyzq2.js +3 -0
  50. package/dist/{chunk-9dkjzqm0.js → chunk-jbxb317g.js} +6 -6
  51. package/dist/{chunk-3s37g6bh.js → chunk-ka22zwye.js} +8 -8
  52. package/dist/chunk-m2kzh519.js +3 -0
  53. package/dist/{chunk-7k0e2h9b.js → chunk-m3y5knzq.js} +5 -5
  54. package/dist/{chunk-0h9dz87w.js → chunk-madfh88z.js} +2 -2
  55. package/dist/{chunk-tvhg9v4f.js → chunk-mfp35a3b.js} +9 -9
  56. package/dist/{chunk-01zsk2q8.js → chunk-mhyqvwcg.js} +3 -3
  57. package/dist/{chunk-m9x72e5j.js → chunk-mhz6xe61.js} +4 -4
  58. package/dist/{chunk-xst4jpr9.js → chunk-mjzee617.js} +11 -11
  59. package/dist/{chunk-e37cbaq7.js → chunk-nek63555.js} +2 -2
  60. package/dist/{chunk-eyc0tk75.js → chunk-njqzhkzy.js} +10 -10
  61. package/dist/{chunk-p3n0wx32.js → chunk-ns44qxdd.js} +4 -4
  62. package/dist/chunk-nxk4h5hy.js +3 -0
  63. package/dist/{chunk-xewmepxp.js → chunk-ptbd3dac.js} +2 -2
  64. package/dist/{chunk-23w57jk5.js → chunk-q45jkpya.js} +2 -2
  65. package/dist/{chunk-bhqpdftq.js → chunk-q4ebd4qe.js} +2 -2
  66. package/dist/{chunk-vv5jdqfj.js → chunk-qevb6d6j.js} +2 -2
  67. package/dist/{chunk-fka5apgq.js → chunk-rka9z03a.js} +4 -4
  68. package/dist/{chunk-ep3575a9.js → chunk-s7k223zx.js} +2 -2
  69. package/dist/{chunk-0zj4xkky.js → chunk-sqnhxtbk.js} +3 -3
  70. package/dist/{chunk-a3apthex.js → chunk-th9tcxga.js} +2 -2
  71. package/dist/{chunk-rz5jszhe.js → chunk-v3n9zzhm.js} +2 -2
  72. package/dist/{chunk-n4hj7rs6.js → chunk-vgyjw95e.js} +4 -4
  73. package/dist/{chunk-m3ysqm3b.js → chunk-vv8e8pa3.js} +2 -2
  74. package/dist/{chunk-jvqczw2k.js → chunk-vxghzchm.js} +3 -3
  75. package/dist/{chunk-pfvjr5bg.js → chunk-vz4fc70e.js} +3 -3
  76. package/dist/{chunk-60wrxcjt.js → chunk-waan03ga.js} +3 -3
  77. package/dist/{chunk-mp86smwc.js → chunk-x1j88x37.js} +20 -20
  78. package/dist/{chunk-1721pyws.js → chunk-xa9vcbjj.js} +2 -2
  79. package/dist/chunk-xb2nr89a.js +3 -0
  80. package/dist/{chunk-bkbsg2bv.js → chunk-xgf6djk3.js} +2 -2
  81. package/dist/chunk-ykrdzatr.js +31 -0
  82. package/dist/{chunk-rmg7jdhj.js → chunk-yqvn592m.js} +2 -2
  83. package/dist/{chunk-62bqxy6j.js → chunk-zp93zcn5.js} +2 -2
  84. package/dist/src/augmentation-graph.js +1 -1
  85. package/dist/src/binding-patterns.js +1 -1
  86. package/dist/src/branded-types.js +1 -1
  87. package/dist/src/bundle-linker.js +1 -1
  88. package/dist/src/bundler.js +1 -1
  89. package/dist/src/cache.js +1 -1
  90. package/dist/src/call-signatures.js +1 -1
  91. package/dist/src/circular.js +1 -1
  92. package/dist/src/compat.js +1 -1
  93. package/dist/src/computed-keys.js +1 -1
  94. package/dist/src/config.js +1 -1
  95. package/dist/src/dangling-refs.js +1 -1
  96. package/dist/src/declaration-project.js +1 -1
  97. package/dist/src/declaration-publication.js +1 -1
  98. package/dist/src/declaration-references.js +1 -1
  99. package/dist/src/diff.js +1 -1
  100. package/dist/src/docs.js +1 -1
  101. package/dist/src/enum-declarations.js +1 -1
  102. package/dist/src/errors.js +1 -1
  103. package/dist/src/extractor/directives.js +1 -1
  104. package/dist/src/extractor/extract.js +1 -1
  105. package/dist/src/extractor/scanner.js +1 -1
  106. package/dist/src/extractor.js +1 -1
  107. package/dist/src/formats.js +1 -1
  108. package/dist/src/formatter.js +1 -1
  109. package/dist/src/function-properties.js +1 -1
  110. package/dist/src/generator.js +1 -1
  111. package/dist/src/global-types.js +1 -1
  112. package/dist/src/import-sorter.js +1 -1
  113. package/dist/src/incremental.js +1 -1
  114. package/dist/src/index.d.ts +2 -1
  115. package/dist/src/index.js +1 -1
  116. package/dist/src/inferred-imports.js +1 -1
  117. package/dist/src/json-config.js +1 -1
  118. package/dist/src/lexical.js +1 -1
  119. package/dist/src/logger.js +1 -1
  120. package/dist/src/lsp.js +1 -1
  121. package/dist/src/memory.js +1 -1
  122. package/dist/src/merger.js +1 -1
  123. package/dist/src/module-graph.js +1 -1
  124. package/dist/src/module-references.js +1 -1
  125. package/dist/src/native-checker.js +1 -1
  126. package/dist/src/native-engine.d.ts +24 -2
  127. package/dist/src/native-engine.js +1 -1
  128. package/dist/src/native-extractor.js +1 -1
  129. package/dist/src/native-generation.js +1 -1
  130. package/dist/src/native-project.js +1 -1
  131. package/dist/src/optimizer.js +1 -1
  132. package/dist/src/output-normalizer.js +1 -1
  133. package/dist/src/parallel-processor.js +1 -1
  134. package/dist/src/parameters.js +1 -1
  135. package/dist/src/parser.js +1 -1
  136. package/dist/src/plugins/bun.js +1 -1
  137. package/dist/src/plugins/esbuild.js +1 -1
  138. package/dist/src/plugins/index.js +1 -1
  139. package/dist/src/plugins/tsdown.js +1 -1
  140. package/dist/src/plugins/tsup.js +1 -1
  141. package/dist/src/plugins/vite.js +1 -1
  142. package/dist/src/plugins/webpack.js +1 -1
  143. package/dist/src/plugins.js +1 -1
  144. package/dist/src/process-source.d.ts +4 -3
  145. package/dist/src/process-source.js +1 -1
  146. package/dist/src/processor/cache.js +1 -1
  147. package/dist/src/processor/comments.js +1 -1
  148. package/dist/src/processor/declarations.js +1 -1
  149. package/dist/src/processor/import-usage.js +1 -1
  150. package/dist/src/processor/imports.js +1 -1
  151. package/dist/src/processor/index.js +1 -1
  152. package/dist/src/processor/type-inference.js +1 -1
  153. package/dist/src/processor.js +1 -1
  154. package/dist/src/profiling.js +1 -1
  155. package/dist/src/return-type-scope.js +1 -1
  156. package/dist/src/security.js +1 -1
  157. package/dist/src/source-cache.js +1 -1
  158. package/dist/src/sourcemap.js +1 -1
  159. package/dist/src/stx.js +1 -1
  160. package/dist/src/syntax-validator.js +1 -1
  161. package/dist/src/tracking.js +1 -1
  162. package/dist/src/transformers.js +1 -1
  163. package/dist/src/tree-shaker.js +1 -1
  164. package/dist/src/tsconfig.js +1 -1
  165. package/dist/src/type-mappings.js +1 -1
  166. package/dist/src/types.d.ts +1 -0
  167. package/dist/src/utils.js +1 -1
  168. package/dist/src/value-inference.js +1 -1
  169. package/dist/src/vue.js +1 -1
  170. package/dist/src/watcher.js +1 -1
  171. package/dist/src/worker-thread.js +1 -1
  172. package/dist/src/worker.js +1 -1
  173. package/dist/src/workspace.js +1 -1
  174. package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
  175. package/native/darwin-x64/libzig-dtsx.dylib +0 -0
  176. package/native/freebsd-x64/libzig-dtsx.so +0 -0
  177. package/native/linux-arm64/libzig-dtsx.so +0 -0
  178. package/native/linux-x64/libzig-dtsx.so +0 -0
  179. package/native/windows-x64/zig-dtsx.dll +0 -0
  180. package/package.json +1 -1
  181. package/dist/chunk-1dqa0tex.js +0 -8
  182. package/dist/chunk-3pcxxgwq.js +0 -3
  183. package/dist/chunk-4q78f5pg.js +0 -3
  184. package/dist/chunk-8pfyd95y.js +0 -3
  185. package/dist/chunk-a2666k9r.js +0 -3
  186. package/dist/chunk-pwdmw567.js +0 -3
  187. package/dist/chunk-y83jhbpr.js +0 -31
@@ -1,10 +1,10 @@
1
1
  // @bun
2
- var ge={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 wn 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 ri 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 ii 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 Cn 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 vn 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 si extends v{cycle;constructor(n){super(`Circular dependency detected: ${n.join(" -> ")}`,"CIRCULAR_DEPENDENCY",{cycle:n});this.name="CircularDependencyError",this.cycle=n}}function fo(n){return n instanceof v}function po(n){return n instanceof wn}function mo(n){return n instanceof Cn}function go(n){return n instanceof vn}function ho(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 yo(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 bo(n,e,t,s){let r=n.split(`
2
+ var ye={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 vn 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 si 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 oi 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 Sn 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 $n 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 ai extends v{cycle;constructor(n){super(`Circular dependency detected: ${n.join(" -> ")}`,"CIRCULAR_DEPENDENCY",{cycle:n});this.name="CircularDependencyError",this.cycle=n}}function go(n){return n instanceof v}function ho(n){return n instanceof vn}function yo(n){return n instanceof Sn}function bo(n){return n instanceof $n}function xo(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 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 Co(n,e,t,s){let r=n.split(`
5
5
  `),i=e.line-1,o=[];if(s)o.push(`${s}:${e.line}:${e.column}`);else o.push(`Line ${e.line}, Column ${e.column}`);o.push(`Error: ${t}`),o.push("");let E=Math.max(0,i-1),c=Math.min(r.length-1,i+1);for(let a=E;a<=c;a++){let R=(a+1).toString().padStart(4," "),u=a===i?">":" ";if(o.push(`${u} ${R} | ${r[a]}`),a===i){let l=" ".repeat(8+e.column-1);o.push(`${l}^`)}}return o.join(`
6
- `)}function He(n,e,t){let s={file:e,message:"Unknown error",code:ge.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=ge.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=ge.SYNTAX_ERROR,s.suggestion="Check for syntax errors in your TypeScript code.";else if(n.message.includes("type")&&n.message.includes("cannot"))s.code=ge.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=ge.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(`
6
+ `)}function qe(n,e,t){let s={file:e,message:"Unknown error",code:ye.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=ye.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=ye.SYNTAX_ERROR,s.suggestion="Check for syntax errors in your TypeScript code.";else if(n.message.includes("type")&&n.message.includes("cannot"))s.code=ye.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=ye.PARSE_ERROR,s.suggestion="The file contains invalid TypeScript syntax."}else if(typeof n==="string")s.message=n;return s}function Ct(n,e){let t=[],s=n.file;if(n.location)s+=`:${n.location.line}:${n.location.column}`;if(n.code)s+=` [${n.code}]`;if(t.push(s),t.push(` Error: ${n.message}`),e&&n.location){t.push("");let r=e.split(`
7
7
  `),i=n.location.line-1;if(i>=0&&i<r.length){let o=Math.max(0,i-1),E=Math.min(r.length-1,i+1);for(let c=o;c<=E;c++){let a=(c+1).toString().padStart(4," "),R=c===i?">":" ";if(t.push(` ${R} ${a} | ${r[c]}`),c===i&&n.location.column>0){let u=" ".repeat(10+n.location.column-1);t.push(` ${u}^`)}}}}if(n.suggestion)t.push(""),t.push(` Suggestion: ${n.suggestion}`);return t.join(`
8
- `)}function xo(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(`
8
+ `)}function vo(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{ge,v,wn,ri,ii,Cn,vn,si,fo,po,mo,go,ho,yo,bo,He,xt,xo};
10
+ export{ye,v,vn,si,oi,Sn,$n,ai,go,ho,yo,bo,xo,wo,Co,qe,Ct,vo};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- var e="@dtsx/dtsx",i="module",n="0.11.43",r=!0,c="A modern, fast .d.ts generation tool, powered by Bun.",u="Chris Breuer <chris@stacksjs.org>",a="MIT",b="https://github.com/stacksjs/dtsx#readme",o={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},p={url:"https://github.com/stacksjs/dtsx/issues"},d=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],m={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},k="./dist/index.js",l="./dist/index.d.ts",x={dtsx:"./dist/cli.js"},g=["dist"],h={benchmark:"bun benchmark/index.ts","benchmark:prepare":"cd packages/zig-dtsx && zig build -Doptimize=ReleaseFast && cd ../.. && bun build benchmark/oxc-emit.ts --compile --splitting --bytecode --minify --format=esm --outfile benchmark/oxc-emit","benchmark:publish":"bun benchmark/index.ts --json benchmark/results.json --runs 3 && bun benchmark/render.ts","benchmark:tsdown":"bun benchmark/tsdown.ts",build:"bun --filter './packages/dtsx' build",test:"find packages -name '*.test.ts' -print | xargs bun test","test:public-sdk":"bun scripts/verify-public-sdk.ts","test:standalone":"bun scripts/verify-standalone.ts","typecheck:public-sdk":"bun x tsc --project tsconfig.public-sdk.json",lint:"bun x --bun pickier .","lint:fix":"bun x --bun pickier . --fix",format:"bun x --bun pickier . --format","format:fix":"bun x --bun pickier . --format --write",changelog:"bun x @stacksjs/logsmith --verbose","changelog:generate":"bun x @stacksjs/logsmith --output CHANGELOG.md",release:"bun x --bun @stacksjs/bumpx prompt --recursive","release:patch":"bun x --bun @stacksjs/bumpx patch --recursive --commit --tag --push --yes","release:minor":"bun x --bun @stacksjs/bumpx minor --recursive --commit --tag --push --yes",typecheck:"bun x tsc --noEmit","dev:docs":"bun --bun bunpress dev docs","build:docs":"bun --bun bunpress build docs","preview:docs":"bun --bun bunpress preview docs"},j={"@stacksjs/bumpx":"^0.2.32","@stacksjs/bunpress":"^0.2.31","@stacksjs/clapp":"^0.2.16",pickier:"^0.1.88","@stacksjs/gitlint":"^0.1.8","@stacksjs/logsmith":"^0.2.14","@types/bun":"^1.4.4","buddy-bot":"^0.10.5","bun-git-hooks":"^0.3.3","@dtsx/bun":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.157.0","oxc-parser":"^0.157.0",tsdown:"^0.23.7",typescript:"^7.0.2"},y=["packages/*"],f={typescript:"^7.0.2"},v={name:e,type:i,version:n,private:r,description:c,author:u,license:a,homepage:b,repository:o,bugs:p,keywords:d,exports:m,module:k,types:l,bin:x,files:g,scripts:h,devDependencies:j,workspaces:y,overrides:f,"git-hooks":{"pre-commit":{"staged-lint":{"*.{js,ts,json,yaml,yml,md}":"bun x --bun pickier lint --fix"}},"commit-msg":"bun x gitlint --edit .git/COMMIT_EDITMSG"}};export{u as author,x as bin,p as bugs,v as default,c as description,j as devDependencies,m as exports,g as files,b as homepage,d as keywords,a as license,k as module,e as name,f as overrides,r as private,o as repository,h as scripts,i as type,l as types,n as version,y as workspaces};
2
+ var e="@dtsx/dtsx",i="module",n="0.11.44",r=!0,c="A modern, fast .d.ts generation tool, powered by Bun.",u="Chris Breuer <chris@stacksjs.org>",a="MIT",b="https://github.com/stacksjs/dtsx#readme",o={type:"git",url:"git+https://github.com/stacksjs/dtsx.git"},p={url:"https://github.com/stacksjs/dtsx/issues"},d=["dts","generation","isolated declarations","development","bun","stacks","typescript","javascript"],m={".":{import:"./dist/index.js"},"./*":{import:"./dist/*"}},k="./dist/index.js",l="./dist/index.d.ts",x={dtsx:"./dist/cli.js"},g=["dist"],h={benchmark:"bun benchmark/index.ts","benchmark:prepare":"cd packages/zig-dtsx && zig build -Doptimize=ReleaseFast && cd ../.. && bun build benchmark/oxc-emit.ts --compile --splitting --bytecode --minify --format=esm --outfile benchmark/oxc-emit","benchmark:publish":"bun benchmark/index.ts --json benchmark/results.json --runs 3 && bun benchmark/render.ts","benchmark:tsdown":"bun benchmark/tsdown.ts",build:"bun --filter './packages/dtsx' build",test:"find packages -name '*.test.ts' -print | xargs bun test","test:public-sdk":"bun scripts/verify-public-sdk.ts","test:standalone":"bun scripts/verify-standalone.ts","typecheck:public-sdk":"bun x tsc --project tsconfig.public-sdk.json",lint:"bun x --bun pickier .","lint:fix":"bun x --bun pickier . --fix",format:"bun x --bun pickier . --format","format:fix":"bun x --bun pickier . --format --write",changelog:"bun x @stacksjs/logsmith --verbose","changelog:generate":"bun x @stacksjs/logsmith --output CHANGELOG.md",release:"bun x --bun @stacksjs/bumpx prompt --recursive","release:patch":"bun x --bun @stacksjs/bumpx patch --recursive --commit --tag --push --yes","release:minor":"bun x --bun @stacksjs/bumpx minor --recursive --commit --tag --push --yes",typecheck:"bun x tsc --noEmit","dev:docs":"bun --bun bunpress dev docs","build:docs":"bun --bun bunpress build docs","preview:docs":"bun --bun bunpress preview docs"},j={"@stacksjs/bumpx":"^0.2.32","@stacksjs/bunpress":"^0.2.31","@stacksjs/clapp":"^0.2.16",pickier:"^0.1.88","@stacksjs/gitlint":"^0.1.8","@stacksjs/logsmith":"^0.2.14","@types/bun":"^1.4.4","buddy-bot":"^0.10.5","bun-git-hooks":"^0.3.3","@dtsx/bun":"workspace:*",mitata:"^1.0.34","oxc-transform":"^0.157.0","oxc-parser":"^0.157.0",tsdown:"^0.23.7",typescript:"^7.0.2"},y=["packages/*"],f={typescript:"^7.0.2"},v={name:e,type:i,version:n,private:r,description:c,author:u,license:a,homepage:b,repository:o,bugs:p,keywords:d,exports:m,module:k,types:l,bin:x,files:g,scripts:h,devDependencies:j,workspaces:y,overrides:f,"git-hooks":{"pre-commit":{"staged-lint":{"*.{js,ts,json,yaml,yml,md}":"bun x --bun pickier lint --fix"}},"commit-msg":"bun x gitlint --edit .git/COMMIT_EDITMSG"}};export{u as author,x as bin,p as bugs,v as default,c as description,j as devDependencies,m as exports,g as files,b as homepage,d as keywords,a as license,k as module,e as name,f as overrides,r as private,o as repository,h as scripts,i as type,l as types,n as version,y as workspaces};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- function d(n,c){let o=1,l=1;for(let i=0;i<c;i++)if(n.charCodeAt(i)===10)o++,l=1;else l++;return{line:o,column:l}}function be(n){let c=[],o=[],l=[],i={")":"(","]":"[","}":"{"},r=0,m=0,f=-1;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e),s=n.charCodeAt(e+1);if(f!==-1){if(t===42&&s===47)o.push({start:f,end:e+2}),f=-1,e++;continue}if(r){if(t===92)e++;else if(t===r)o.push({start:m,end:e+1}),r=0;continue}if(t===47&&s===42){f=e,e++;continue}if(t===47&&s===47){let u=e;while(e<n.length&&n.charCodeAt(e)!==10)e++;o.push({start:u,end:e});continue}if(t===39||t===34||t===96){r=t,m=e;continue}let a=n[e];if(a==="("||a==="["||a==="{")l.push({char:a,offset:e});else if(i[a]){let u=l.pop();if(!u||u.char!==i[a])c.push({...d(n,e),message:`Unexpected closing delimiter ${a}`,code:"DTSX1004"})}}if(r)c.push({...d(n,m),message:"Unterminated string literal",code:"DTSX1002"});if(f!==-1)c.push({...d(n,f),message:"Unterminated block comment",code:"DTSX1003"});for(let e of l)c.push({...d(n,e.offset),message:`Unclosed delimiter ${e.char}`,code:"DTSX1001"});let p=[[/\b(?:interface|class|enum)\s*(?=[{=])/g,"Declaration name expected"],[/\bfunction\s*(?=\()/g,"Function name expected"],[/\(\s*:/g,"Parameter name expected"]];for(let[e,t]of p)for(let s of n.matchAll(e)){if(o.some((a)=>s.index>=a.start&&s.index<a.end))continue;c.push({...d(n,s.index),message:t,code:"DTSX1005"})}for(let e of n.matchAll(/\btype\s*(?=[{=])/g)){if(o.some((s)=>e.index>=s.start&&e.index<s.end))continue;let t=n.slice(0,e.index).trimEnd();if(t.endsWith("import")||t.endsWith("export"))continue;c.push({...d(n,e.index),message:"Declaration name expected",code:"DTSX1005"})}return c.push(...g(n,o)),c.sort((e,t)=>e.line-t.line||e.column-t.column)}var h=String.raw`(?:[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*|'[^']*'|"[^"]*")`,x=new RegExp(`^(?:type\\s+)?${h}(?:\\s+as\\s+${h})?$`,"u");function g(n,c){let o=[],l=(i)=>c.some((r)=>i>=r.start&&i<r.end);for(let i of n.matchAll(/\b(import|export)\s+(?:type\s+)?\{/g)){let r=i.index;if(l(r))continue;let m=r+i[0].length-1,f=-1;for(let t=m+1;t<n.length;t++){if(l(t))continue;let s=n[t];if(s==="{"){f=-2;break}if(s==="}"){f=t;break}}if(f<0)continue;let p=n.slice(m+1,f);if(!p.trim())continue;let e=m+1;for(let t of p.split(",")){let s=t.trim();if(s){let a=e+t.indexOf(s);if(s.includes(";"))o.push({...d(n,a),message:`Unexpected ';' in ${i[1]} clause \u2014 specifiers are separated by ','`,code:"DTSX1006"});else if(!x.test(s))o.push({...d(n,a),message:`Invalid ${i[1]} specifier '${s}'`,code:"DTSX1006"})}e+=t.length+1}}return o}
3
- export{be};
2
+ function d(n,c){let o=1,l=1;for(let i=0;i<c;i++)if(n.charCodeAt(i)===10)o++,l=1;else l++;return{line:o,column:l}}function we(n){let c=[],o=[],l=[],i={")":"(","]":"[","}":"{"},r=0,m=0,f=-1;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e),s=n.charCodeAt(e+1);if(f!==-1){if(t===42&&s===47)o.push({start:f,end:e+2}),f=-1,e++;continue}if(r){if(t===92)e++;else if(t===r)o.push({start:m,end:e+1}),r=0;continue}if(t===47&&s===42){f=e,e++;continue}if(t===47&&s===47){let u=e;while(e<n.length&&n.charCodeAt(e)!==10)e++;o.push({start:u,end:e});continue}if(t===39||t===34||t===96){r=t,m=e;continue}let a=n[e];if(a==="("||a==="["||a==="{")l.push({char:a,offset:e});else if(i[a]){let u=l.pop();if(!u||u.char!==i[a])c.push({...d(n,e),message:`Unexpected closing delimiter ${a}`,code:"DTSX1004"})}}if(r)c.push({...d(n,m),message:"Unterminated string literal",code:"DTSX1002"});if(f!==-1)c.push({...d(n,f),message:"Unterminated block comment",code:"DTSX1003"});for(let e of l)c.push({...d(n,e.offset),message:`Unclosed delimiter ${e.char}`,code:"DTSX1001"});let p=[[/\b(?:interface|class|enum)\s*(?=[{=])/g,"Declaration name expected"],[/\bfunction\s*(?=\()/g,"Function name expected"],[/\(\s*:/g,"Parameter name expected"]];for(let[e,t]of p)for(let s of n.matchAll(e)){if(o.some((a)=>s.index>=a.start&&s.index<a.end))continue;c.push({...d(n,s.index),message:t,code:"DTSX1005"})}for(let e of n.matchAll(/\btype\s*(?=[{=])/g)){if(o.some((s)=>e.index>=s.start&&e.index<s.end))continue;let t=n.slice(0,e.index).trimEnd();if(t.endsWith("import")||t.endsWith("export"))continue;c.push({...d(n,e.index),message:"Declaration name expected",code:"DTSX1005"})}return c.push(...g(n,o)),c.sort((e,t)=>e.line-t.line||e.column-t.column)}var h=String.raw`(?:[\p{ID_Start}$_][\p{ID_Continue}$\u200C\u200D]*|'[^']*'|"[^"]*")`,x=new RegExp(`^(?:type\\s+)?${h}(?:\\s+as\\s+${h})?$`,"u");function g(n,c){let o=[],l=(i)=>c.some((r)=>i>=r.start&&i<r.end);for(let i of n.matchAll(/\b(import|export)\s+(?:type\s+)?\{/g)){let r=i.index;if(l(r))continue;let m=r+i[0].length-1,f=-1;for(let t=m+1;t<n.length;t++){if(l(t))continue;let s=n[t];if(s==="{"){f=-2;break}if(s==="}"){f=t;break}}if(f<0)continue;let p=n.slice(m+1,f);if(!p.trim())continue;let e=m+1;for(let t of p.split(",")){let s=t.trim();if(s){let a=e+t.indexOf(s);if(s.includes(";"))o.push({...d(n,a),message:`Unexpected ';' in ${i[1]} clause \u2014 specifiers are separated by ','`,code:"DTSX1006"});else if(!x.test(s))o.push({...d(n,a),message:`Invalid ${i[1]} specifier '${s}'`,code:"DTSX1006"})}e+=t.length+1}}return o}
3
+ export{we};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- var r=/^\/\/\/\s*<reference\s+(?:path|types|lib|no-default-lib)\s*=\s*["'][^"']+["']\s*\/>/,E=/^\/\/\/\s*<amd-module\s+name\s*=\s*["'][^"']+["']\s*\/>/,f=/^\/\/\/\s*<amd-dependency\s+path\s*=\s*["'][^"']+["']/;function xn(t){let l=[],a=0;for(let e=0;e<=t.length;e++)if(e===t.length||t[e]===`
2
+ var r=/^\/\/\/\s*<reference\s+(?:path|types|lib|no-default-lib)\s*=\s*["'][^"']+["']\s*\/>/,E=/^\/\/\/\s*<amd-module\s+name\s*=\s*["'][^"']+["']\s*\/>/,f=/^\/\/\/\s*<amd-dependency\s+path\s*=\s*["'][^"']+["']/;function Cn(t){let l=[],a=0;for(let e=0;e<=t.length;e++)if(e===t.length||t[e]===`
3
3
  `){let n=a,i=e;while(n<i&&(t[n]===" "||t[n]==="\t"||t[n]==="\r"))n++;while(i>n&&(t[i-1]===" "||t[i-1]==="\t"||t[i-1]==="\r"))i--;let s=t.slice(n,i);if(a=e+1,s.startsWith("///")){if(s.indexOf("<")===-1)continue;if(r.test(s)||E.test(s)||f.test(s))l.push(s)}else if(s===""||s.startsWith("//"))continue;else break}return l}
4
- export{xn};
4
+ export{Cn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{c,i}from"./chunk-rz5jszhe.js";import{t,F}from"./chunk-m9x72e5j.js";import{it,Ft}from"./chunk-23w57jk5.js";import{y}from"./chunk-1721pyws.js";import{n}from"./chunk-mp86smwc.js";function q(g,w){let C=(D)=>t(D).map((b)=>D.slice(b.start,b.end)).join("");return C(g)===C(w)}function de(g){if(["number","string","boolean","bigint","symbol","undefined","null"].includes(g))return g;let w=n(g,!1);return["number","string","boolean","bigint","undefined","null"].includes(w)?w:void 0}function oe(g,w){if(q(g,w))return g;let C=de(w);if(!C)return;let D=t(g),b=0,v=0,B=[];for(let S of D){let k=g.slice(S.start,S.end);if(k==="("||k==="["||k==="{"||k==="<")b++;else if(k===")"||k==="]"||k==="}"||k===">")b--;else if(k==="|"&&b===0)B.push(g.slice(v,S.start).trim()),v=S.end}B.push(g.slice(v).trim());let O=B.find((S)=>q(S,w));if(O)return O;if(B.includes(C))return C==="boolean"&&(w==="true"||w==="false")?w:C;return}function Gn(g,w,C,D=new Set){let b=new Map,v=[],B=new Set;for(let e of[...w,...C.values()]){if(B.has(e))continue;if(B.add(e),v.push(e),e.kind==="import")for(let o of y(e.text))b.set(o,{declared:`typeof ${o}`,flow:`typeof ${o}`,unresolved:!1});else if(["function","class","enum"].includes(e.kind))b.set(e.name,{declared:`typeof ${e.name}`,flow:`typeof ${e.name}`,unresolved:!1});else if(e.kind==="variable")b.set(e.name,{declared:e.typeAnnotation,unresolved:!1})}v.sort((e,o)=>(e.start??0)-(o.start??0));let O=new Set(v.filter((e)=>e.kind==="function"&&!e.generics).map((e)=>e.name));for(let e of D)O.add(e);let S=new Map,k=(e)=>{if(e=e.trimStart(),S.has(e))return S.get(e);if(S.set(e,void 0),!c(e.charCodeAt(0)))return;let o=1;while(i(e.charCodeAt(o)))o++;if(!O.has(e.slice(0,o)))return;let r=t(e);if(r[0]?.kind!=="word"||!r[1]||e.slice(r[1].start,r[1].end)!=="(")return;let d=1;for(let s=2;s<r.length;s++){let a=e.slice(r[s].start,r[s].end);if(a==="(")d++;else if(a===")"&&--d===0){let l=s===r.length-1?e.slice(r[0].start,r[0].end):void 0;return S.set(e,l),l}}return},E=new Set(v.filter((e)=>e.kind==="variable"&&!e.typeAnnotation&&typeof e.value==="string").map((e)=>k(e.value)).filter((e)=>e!==void 0)).size?F(g):void 0,x=new Map;if(E){let e=0;for(let o=0;o<E.length;o++){let r=g.slice(E[o].start,E[o].end);if(e===0&&r==="function"){let d=E[o+1],s=d&&g.slice(d.start,d.end)==="*"?E[o+2]:d;if(s?.kind==="word"){let a=g.slice(s.start,s.end);x.set(a,(x.get(a)??0)+1)}}if(["{","(","["].includes(r))e++;else if(["}",")","]"].includes(r))e--}}let R=new Map;for(let e of v)if(e.kind==="function"&&!e.generics&&x.get(e.name)===1)R.set(e.name,e);for(let e of D){let o=v.find((r)=>r.kind==="import"&&y(r.text).includes(e));if(o)R.set(e,o)}let W="__dtsx_call_result";while(g.includes(W))W+="_";let K=(e)=>`(typeof ${e}) extends (...args: never[]) => infer ${W} ? ${W} : never`,X=new Map,H=!1;for(let e of v){if(e.kind!=="variable"||e.typeAnnotation||typeof e.value!=="string")continue;let o=k(e.value);if(o&&R.has(o))X.set(e,K(o)),b.get(e.name).active=!0,b.get(o).active=!0,H=!0;if(e.modifiers?.[0]!=="const")continue;let r=it(e.value);if(!r||r===e.name||!b.has(r))continue;b.get(r).active=!0,b.get(e.name).active=!0,H=!0}if(!H)return;let u=E??F(g),f=(e)=>u[e]?g.slice(u[e].start,u[e].end):"",m=new Map,_=new Map,G=new Set,L=new Set,J=new Set,Q=new Map,I=[];for(let e=0;e<u.length;e++){let o=f(e),r=I.at(-1);if(r!==void 0)_.set(e,r);if(o==="{"&&["=","(","[",",",":","?","return","yield"].includes(f(e-1)))G.add(e);if(["(","[","{"].includes(o))I.push(e);else if([")","]","}"].includes(o)){let d=I.at(-1);if(d!==void 0&&["()","[]","{}"].includes(f(d)+o))I.pop(),m.set(d,e)}}let Y=new Map;for(let e=0;e<u.length;){if(u[e].kind!=="punctuation"){e++;continue}let r=[">>>=","**=","&&=","||=","??=","<<=",">>=","===","!==",">>>","**","&&","||","??","<<",">>","=>","==","!=","<=",">=","++","--","+=","-=","*=","/=","%=","&=","|=","^=","="].find((s)=>g.startsWith(s,u[e].start))??f(e);Y.set(e,r);let d=u[e].start+r.length;do e++;while(e<u.length&&u[e].start<d)}for(let e=0;e<u.length;e++){let o=ne(e);if(o!==void 0)L.add(o)}for(let e of L)le(e);let h=0;function Z(e){let o=it(e);if(o){let a=b.get(o);return{type:a?.flow,unresolved:a?.unresolved??!1}}let r=k(e),d=r?R.get(r):void 0;if(d)return{type:d.returnType&&de(d.returnType)?d.returnType:K(r),unresolved:!1};let s=n(e,!0);return{type:s==="unknown"?void 0:s,unresolved:!1}}function T(e){return Y.get(e)??""}function N(e){if(u[e]?.kind!=="word"||J.has(e)||f(e-1)==="."||f(e-1)==="#"&&f(e-2)===".")return;let o=b.get(f(e));if(!o?.active)return;let r=T(e+1);if(["=","+=","-=","*=","/=","%=","**=","<<=",">>=",">>>=","&=","|=","^=","&&=","||=","??="].includes(r))return{binding:o,operator:r};if(["++","--"].includes(r)&&!/[\r\n]/.test(g.slice(u[e].end,u[e+1].start)))return{binding:o,operator:r};if(e>=2&&["++","--"].includes(T(e-2))){let d=u[e-3],s=d&&(d.kind==="word"||d.kind==="quoted"||[")","]"].includes(f(e-3)));if(!d||!s||/[\r\n;]/.test(g.slice(d.end,u[e-2].start)))return{binding:o,operator:T(e-2)}}return}function ee(e){let o=N(e);return o?.operator==="="?o.binding:void 0}function ne(e){if(u[e]?.kind!=="word"||f(e)!=="class"||f(e-1)==="."||["(",":","="].includes(f(e+1)))return;let o=e+1,r=0;while(o<u.length){let d=f(o);if(d==="{"&&r===0)return o;if(d==="class"){let s=ne(o);if(s!==void 0){o=(m.get(s)??s)+1;continue}}if(d==="function"){let s=se(o,u.length);if(s){o=s.end;continue}}if(d==="<")r++;else if(d===">"&&T(o-1)!=="=>"&&r>0)r--;if(d===";")break;o=(m.get(o)??o)+1}return}function te(e,o,r){let d=e,s=!1,a=r?["public","protected","private","static","abstract","override","declare","readonly","accessor","async","get","set"]:["async","get","set"];while(a.includes(f(d))&&!["(","<","?","!",":","=",";","}"].includes(f(d+1))){if(f(d)==="static")s=!0;d++}if(f(d)==="*")d++;if(r&&f(d)==="#")d++;if(f(d)==="["){let p=m.get(d);return p===void 0?void 0:{next:p+1,isStatic:s}}if(u[d]?.kind==="word"||u[d]?.kind==="quoted")return{next:d+1,isStatic:s};let l=d+1;while(l<o&&u[l-1].end===u[l].start&&!["(","<","?","!",":","=",";","}","[","{",","].includes(f(l)))l++;if(d<o&&n(g.slice(u[d].start,u[l-1].end),!1)==="number")return{next:l,isStatic:s};return}function P(e,o,r){let d=te(e,o,r);if(!d)return;let s=d.next;if(r&&["?","!"].includes(f(s)))s++;if(f(s)==="<"){let a=1;s++;while(s<o&&a>0){if(f(s)==="<")a++;else if(f(s)===">"&&T(s-1)!=="=>")a--;s=(m.get(s)??s)+1}if(a!==0)return}return s}function ie(e,o,r){return P(e,o,r)===o}function fe(e,o){let r=0,d=-1;for(let s=e;s<o;s=(m.get(s)??s)+1)if(f(s)==="<"&&(r>0||s>e&&(u[s-1].kind==="word"||[")","]"].includes(f(s-1))))){if(r===0)d=s;r++}else if(f(s)===">"&&T(s-1)!=="=>"&&r>0){if(r--,s===o-1&&r===0)return d<s-1}return!1}function ae(e,o){if(f(e)==="static"&&f(e+1)==="{")return!0;let r=P(e,o,!0);return r!==void 0&&(r===o||["(",":","=",";","}"].includes(f(r)))}function U(e,o,r=!1){let d=m.get(o)??u.length,s=e;while(s<d){if(f(s)===";"||r&&T(s)==="=")return s;if(s>e&&_.get(s)===o&&/[\r\n]/.test(g.slice(u[s-1].end,u[s].start))){let a=f(s-1),p=!(a===">"&&fe(e,s)&&ae(s,d))&&["+","-","*","/","%","=","<",">","&","|","^","!","~","?",":",",",".","(","[","{","as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","yield","void"].includes(a),M=[".","?",":",")","]","}",",","+","-","*","/","%","<",">","=","&","|","^","`","(","[","as","satisfies","instanceof","in"].includes(f(s));if(!p&&!M)return s}s=(m.get(s)??s)+1}return d}function V(e,o){for(let r=e;r<o;r++){if(f(r)==="["&&m.has(r)){r=m.get(r);continue}if(u[r].kind==="word")J.add(r)}}function le(e){let o=m.get(e)??u.length,r=e+1;while(r<o){if(f(r)===";"){r++;continue}if(f(r)==="static"&&f(r+1)==="{"){r=(m.get(r+1)??r+1)+1;continue}let d=te(r,o,!0);if(!d){r++;continue}let s=P(r,o,!0);if(s===void 0){r++;continue}if(V(r,s),f(s)==="("){let l=m.get(s),p=l===void 0?void 0:re(l,o);if(p!==void 0){r=(m.get(p)??p)+1;continue}}let a=s;if(f(a)===":")a=U(a+1,e,!0);if(T(a)==="="){V(r,a+1);let l=a+1,p=U(l,e);if(!d.isStatic&&p>l)Q.set(l,p);r=p}else{let l=U(s,e);V(r,l),r=Math.max(r+1,l)}}}function ce(e){let o=_.get(e);if(o===void 0)return!1;let r=L.has(o);if(!r&&!G.has(o))return!1;if(ie(o+1,e,r))return!0;for(let d=o+1;d<e;d++){let s=_.get(d),a=_.get(d)===o&&(f(d)===","||r&&f(d)===";"),l=r&&f(d)==="}"&&s!==void 0&&_.get(s)===o,p=r&&_.get(d+1)===o&&/[\r\n]/.test(g.slice(u[d].end,u[d+1].start));if((a||l||p)&&ie(d+1,e,r))return!0}return!1}function re(e,o){let r=e+1,d=f(r)===":"?r+1:void 0;while(r<o){if(f(r)==="{"&&(d===void 0||!Ft(g.slice(u[d].start,u[r].start))))return r;if(d===void 0)return;r=(m.get(r)??r)+1}return}function se(e,o){let r=-1;if(f(e)==="("){let s=m.get(e);if(s!==void 0&&ce(e))r=re(s,o)??-1;else if(s!==void 0&&T(s+1)==="=>")r=s+3;else if(s!==void 0&&f(s+1)===":"){let a=s+2;while(a<o&&f(a)!==";"){if(T(a)==="=>"){r=a+2;break}a=(m.get(a)??a)+1}}}else if(u[e]?.kind==="word"&&T(e+1)==="=>")r=e+3;else if(f(e)==="function"){let s=e+1;while(s<o&&f(s)!=="(")s=(m.get(s)??s)+1;let a=m.get(s);if(a===void 0)return;r=a+1;let l=f(r)===":"?r+1:void 0;while(r<o){if(f(r)==="{"&&(l===void 0||!Ft(g.slice(u[l].start,u[r].start))))break;r=(m.get(r)??r)+1}}if(r<0||r>=o)return;if(f(r)==="{")return{start:e,end:(m.get(r)??o-1)+1};let d=r;while(d<o&&![",",";",")","]","}"].includes(f(d)))d=(m.get(d)??d)+1;return{start:e,end:d}}function j(e,o,r=!0){for(let d=e;d<o;d++){let s=Q.get(d);if(s!==void 0){d=Math.min(s,o)-1;continue}let a=r?se(d,o):void 0;if(a){let p=a.end;while(f(p)===")")p++;if(f(p)==="("||f(p)==="."&&["call","apply"].includes(f(p+1))&&f(p+2)==="(")j(a.start,a.end,!1);d=a.end-1;continue}let l=N(d);if(l)l.binding.flow=void 0,l.binding.unresolved=!0}}function ue(e){let o=!1;while(h<u.length&&u[h].start<e){let r=f(h);if(["if","else","for","while","do","switch","try","catch","finally","with"].includes(r))o=!0;if(r===";")o=!1;if(r==="("||r==="{"||r==="["){let l=m.get(h)??h+1;while(l<u.length&&u[l].start>=e)l--;if(j(h+1,l),h=l+1,r==="{")o=!1;continue}let d=ee(h);if(d){let a=h+2,l=a,p=[];while(l<u.length&&u[l].start<e){let A=f(l);if(p.length===0&&(A===";"||l>a&&/[\r\n]/.test(g.slice(u[l-1].end,u[l].start))&&(ee(l)||["if","for","while","switch","try","do","return","throw"].includes(A))))break;if(A==="("||A==="{"||A==="[")p.push(A==="("?")":A==="{"?"}":"]");else if(A===p.at(-1))p.pop();l++}let M=l>a?g.slice(u[a].start,u[l-1].end):"";j(a,l);let z=Z(M);d.flow=!o&&z.type?d.declared?oe(d.declared,z.type):z.type:void 0,d.unresolved=o||z.unresolved||!d.flow,h=l;continue}let s=N(h);if(s)s.binding.flow=void 0,s.binding.unresolved=!0;h++}}for(let e of v){ue(e.start??0);let o=h;while(h<u.length&&u[h].start<(e.end??0))h++;if(e.kind!=="variable")continue;if(e.initializerStart!==void 0){let M=o;while(M<h&&u[M].start<e.initializerStart)M++;j(M,h)}let r=b.get(e.name);if(!r.active)continue;let d=typeof e.value==="string"?e.value:"";if(!d){r.flow=r.declared;continue}let s=Z(d),a=it(d),l=a?b.get(a):void 0,p=X.get(e);if(p)e.inferredType=p,e.text=`${e.isExported?"export ":""}declare ${e.modifiers?.[0]??"const"} ${e.name}: ${p};`;else if(!e.typeAnnotation&&e.modifiers?.[0]==="const"&&a&&a!==e.name&&l){if(s.unresolved)e.inferenceError="DTSX_UNSUPPORTED_VALUE_FLOW";else if(s.type)e.inferredType=l.declared&&q(l.declared,s.type)?`typeof ${a}`:s.type,e.text=`${e.isExported?"export ":""}declare const ${e.name}: ${e.inferredType};`}if(e.typeAnnotation)r.flow=s.type?oe(e.typeAnnotation,s.type)??e.typeAnnotation:e.typeAnnotation;else if(e.inferredType)r.declared=e.inferredType,r.flow=e.inferredType;else{let M=e.modifiers?.[0]==="const",z=d.trim().startsWith("{")||d.trim().startsWith("["),A=n(d,M&&!z);r.declared=A==="unknown"?void 0:A,r.flow=r.declared}r.unresolved=s.unresolved}}
3
- export{Gn};
2
+ import{c,i}from"./chunk-v3n9zzhm.js";import{t,F}from"./chunk-mhz6xe61.js";import{ot,Bt}from"./chunk-q45jkpya.js";import{y}from"./chunk-xa9vcbjj.js";import{n}from"./chunk-x1j88x37.js";function q(g,w){let C=(D)=>t(D).map((b)=>D.slice(b.start,b.end)).join("");return C(g)===C(w)}function de(g){if(["number","string","boolean","bigint","symbol","undefined","null"].includes(g))return g;let w=n(g,!1);return["number","string","boolean","bigint","undefined","null"].includes(w)?w:void 0}function oe(g,w){if(q(g,w))return g;let C=de(w);if(!C)return;let D=t(g),b=0,v=0,B=[];for(let S of D){let k=g.slice(S.start,S.end);if(k==="("||k==="["||k==="{"||k==="<")b++;else if(k===")"||k==="]"||k==="}"||k===">")b--;else if(k==="|"&&b===0)B.push(g.slice(v,S.start).trim()),v=S.end}B.push(g.slice(v).trim());let O=B.find((S)=>q(S,w));if(O)return O;if(B.includes(C))return C==="boolean"&&(w==="true"||w==="false")?w:C;return}function Un(g,w,C,D=new Set){let b=new Map,v=[],B=new Set;for(let e of[...w,...C.values()]){if(B.has(e))continue;if(B.add(e),v.push(e),e.kind==="import")for(let o of y(e.text))b.set(o,{declared:`typeof ${o}`,flow:`typeof ${o}`,unresolved:!1});else if(["function","class","enum"].includes(e.kind))b.set(e.name,{declared:`typeof ${e.name}`,flow:`typeof ${e.name}`,unresolved:!1});else if(e.kind==="variable")b.set(e.name,{declared:e.typeAnnotation,unresolved:!1})}v.sort((e,o)=>(e.start??0)-(o.start??0));let O=new Set(v.filter((e)=>e.kind==="function"&&!e.generics).map((e)=>e.name));for(let e of D)O.add(e);let S=new Map,k=(e)=>{if(e=e.trimStart(),S.has(e))return S.get(e);if(S.set(e,void 0),!c(e.charCodeAt(0)))return;let o=1;while(i(e.charCodeAt(o)))o++;if(!O.has(e.slice(0,o)))return;let r=t(e);if(r[0]?.kind!=="word"||!r[1]||e.slice(r[1].start,r[1].end)!=="(")return;let d=1;for(let s=2;s<r.length;s++){let a=e.slice(r[s].start,r[s].end);if(a==="(")d++;else if(a===")"&&--d===0){let l=s===r.length-1?e.slice(r[0].start,r[0].end):void 0;return S.set(e,l),l}}return},E=new Set(v.filter((e)=>e.kind==="variable"&&!e.typeAnnotation&&typeof e.value==="string").map((e)=>k(e.value)).filter((e)=>e!==void 0)).size?F(g):void 0,x=new Map;if(E){let e=0;for(let o=0;o<E.length;o++){let r=g.slice(E[o].start,E[o].end);if(e===0&&r==="function"){let d=E[o+1],s=d&&g.slice(d.start,d.end)==="*"?E[o+2]:d;if(s?.kind==="word"){let a=g.slice(s.start,s.end);x.set(a,(x.get(a)??0)+1)}}if(["{","(","["].includes(r))e++;else if(["}",")","]"].includes(r))e--}}let R=new Map;for(let e of v)if(e.kind==="function"&&!e.generics&&x.get(e.name)===1)R.set(e.name,e);for(let e of D){let o=v.find((r)=>r.kind==="import"&&y(r.text).includes(e));if(o)R.set(e,o)}let W="__dtsx_call_result";while(g.includes(W))W+="_";let K=(e)=>`(typeof ${e}) extends (...args: never[]) => infer ${W} ? ${W} : never`,X=new Map,H=!1;for(let e of v){if(e.kind!=="variable"||e.typeAnnotation||typeof e.value!=="string")continue;let o=k(e.value);if(o&&R.has(o))X.set(e,K(o)),b.get(e.name).active=!0,b.get(o).active=!0,H=!0;if(e.modifiers?.[0]!=="const")continue;let r=ot(e.value);if(!r||r===e.name||!b.has(r))continue;b.get(r).active=!0,b.get(e.name).active=!0,H=!0}if(!H)return;let u=E??F(g),f=(e)=>u[e]?g.slice(u[e].start,u[e].end):"",m=new Map,_=new Map,G=new Set,L=new Set,J=new Set,Q=new Map,I=[];for(let e=0;e<u.length;e++){let o=f(e),r=I.at(-1);if(r!==void 0)_.set(e,r);if(o==="{"&&["=","(","[",",",":","?","return","yield"].includes(f(e-1)))G.add(e);if(["(","[","{"].includes(o))I.push(e);else if([")","]","}"].includes(o)){let d=I.at(-1);if(d!==void 0&&["()","[]","{}"].includes(f(d)+o))I.pop(),m.set(d,e)}}let Y=new Map;for(let e=0;e<u.length;){if(u[e].kind!=="punctuation"){e++;continue}let r=[">>>=","**=","&&=","||=","??=","<<=",">>=","===","!==",">>>","**","&&","||","??","<<",">>","=>","==","!=","<=",">=","++","--","+=","-=","*=","/=","%=","&=","|=","^=","="].find((s)=>g.startsWith(s,u[e].start))??f(e);Y.set(e,r);let d=u[e].start+r.length;do e++;while(e<u.length&&u[e].start<d)}for(let e=0;e<u.length;e++){let o=ne(e);if(o!==void 0)L.add(o)}for(let e of L)le(e);let h=0;function Z(e){let o=ot(e);if(o){let a=b.get(o);return{type:a?.flow,unresolved:a?.unresolved??!1}}let r=k(e),d=r?R.get(r):void 0;if(d)return{type:d.returnType&&de(d.returnType)?d.returnType:K(r),unresolved:!1};let s=n(e,!0);return{type:s==="unknown"?void 0:s,unresolved:!1}}function T(e){return Y.get(e)??""}function N(e){if(u[e]?.kind!=="word"||J.has(e)||f(e-1)==="."||f(e-1)==="#"&&f(e-2)===".")return;let o=b.get(f(e));if(!o?.active)return;let r=T(e+1);if(["=","+=","-=","*=","/=","%=","**=","<<=",">>=",">>>=","&=","|=","^=","&&=","||=","??="].includes(r))return{binding:o,operator:r};if(["++","--"].includes(r)&&!/[\r\n]/.test(g.slice(u[e].end,u[e+1].start)))return{binding:o,operator:r};if(e>=2&&["++","--"].includes(T(e-2))){let d=u[e-3],s=d&&(d.kind==="word"||d.kind==="quoted"||[")","]"].includes(f(e-3)));if(!d||!s||/[\r\n;]/.test(g.slice(d.end,u[e-2].start)))return{binding:o,operator:T(e-2)}}return}function ee(e){let o=N(e);return o?.operator==="="?o.binding:void 0}function ne(e){if(u[e]?.kind!=="word"||f(e)!=="class"||f(e-1)==="."||["(",":","="].includes(f(e+1)))return;let o=e+1,r=0;while(o<u.length){let d=f(o);if(d==="{"&&r===0)return o;if(d==="class"){let s=ne(o);if(s!==void 0){o=(m.get(s)??s)+1;continue}}if(d==="function"){let s=se(o,u.length);if(s){o=s.end;continue}}if(d==="<")r++;else if(d===">"&&T(o-1)!=="=>"&&r>0)r--;if(d===";")break;o=(m.get(o)??o)+1}return}function te(e,o,r){let d=e,s=!1,a=r?["public","protected","private","static","abstract","override","declare","readonly","accessor","async","get","set"]:["async","get","set"];while(a.includes(f(d))&&!["(","<","?","!",":","=",";","}"].includes(f(d+1))){if(f(d)==="static")s=!0;d++}if(f(d)==="*")d++;if(r&&f(d)==="#")d++;if(f(d)==="["){let p=m.get(d);return p===void 0?void 0:{next:p+1,isStatic:s}}if(u[d]?.kind==="word"||u[d]?.kind==="quoted")return{next:d+1,isStatic:s};let l=d+1;while(l<o&&u[l-1].end===u[l].start&&!["(","<","?","!",":","=",";","}","[","{",","].includes(f(l)))l++;if(d<o&&n(g.slice(u[d].start,u[l-1].end),!1)==="number")return{next:l,isStatic:s};return}function P(e,o,r){let d=te(e,o,r);if(!d)return;let s=d.next;if(r&&["?","!"].includes(f(s)))s++;if(f(s)==="<"){let a=1;s++;while(s<o&&a>0){if(f(s)==="<")a++;else if(f(s)===">"&&T(s-1)!=="=>")a--;s=(m.get(s)??s)+1}if(a!==0)return}return s}function ie(e,o,r){return P(e,o,r)===o}function fe(e,o){let r=0,d=-1;for(let s=e;s<o;s=(m.get(s)??s)+1)if(f(s)==="<"&&(r>0||s>e&&(u[s-1].kind==="word"||[")","]"].includes(f(s-1))))){if(r===0)d=s;r++}else if(f(s)===">"&&T(s-1)!=="=>"&&r>0){if(r--,s===o-1&&r===0)return d<s-1}return!1}function ae(e,o){if(f(e)==="static"&&f(e+1)==="{")return!0;let r=P(e,o,!0);return r!==void 0&&(r===o||["(",":","=",";","}"].includes(f(r)))}function U(e,o,r=!1){let d=m.get(o)??u.length,s=e;while(s<d){if(f(s)===";"||r&&T(s)==="=")return s;if(s>e&&_.get(s)===o&&/[\r\n]/.test(g.slice(u[s-1].end,u[s].start))){let a=f(s-1),p=!(a===">"&&fe(e,s)&&ae(s,d))&&["+","-","*","/","%","=","<",">","&","|","^","!","~","?",":",",",".","(","[","{","as","in","of","new","typeof","keyof","extends","instanceof","satisfies","await","yield","void"].includes(a),M=[".","?",":",")","]","}",",","+","-","*","/","%","<",">","=","&","|","^","`","(","[","as","satisfies","instanceof","in"].includes(f(s));if(!p&&!M)return s}s=(m.get(s)??s)+1}return d}function V(e,o){for(let r=e;r<o;r++){if(f(r)==="["&&m.has(r)){r=m.get(r);continue}if(u[r].kind==="word")J.add(r)}}function le(e){let o=m.get(e)??u.length,r=e+1;while(r<o){if(f(r)===";"){r++;continue}if(f(r)==="static"&&f(r+1)==="{"){r=(m.get(r+1)??r+1)+1;continue}let d=te(r,o,!0);if(!d){r++;continue}let s=P(r,o,!0);if(s===void 0){r++;continue}if(V(r,s),f(s)==="("){let l=m.get(s),p=l===void 0?void 0:re(l,o);if(p!==void 0){r=(m.get(p)??p)+1;continue}}let a=s;if(f(a)===":")a=U(a+1,e,!0);if(T(a)==="="){V(r,a+1);let l=a+1,p=U(l,e);if(!d.isStatic&&p>l)Q.set(l,p);r=p}else{let l=U(s,e);V(r,l),r=Math.max(r+1,l)}}}function ce(e){let o=_.get(e);if(o===void 0)return!1;let r=L.has(o);if(!r&&!G.has(o))return!1;if(ie(o+1,e,r))return!0;for(let d=o+1;d<e;d++){let s=_.get(d),a=_.get(d)===o&&(f(d)===","||r&&f(d)===";"),l=r&&f(d)==="}"&&s!==void 0&&_.get(s)===o,p=r&&_.get(d+1)===o&&/[\r\n]/.test(g.slice(u[d].end,u[d+1].start));if((a||l||p)&&ie(d+1,e,r))return!0}return!1}function re(e,o){let r=e+1,d=f(r)===":"?r+1:void 0;while(r<o){if(f(r)==="{"&&(d===void 0||!Bt(g.slice(u[d].start,u[r].start))))return r;if(d===void 0)return;r=(m.get(r)??r)+1}return}function se(e,o){let r=-1;if(f(e)==="("){let s=m.get(e);if(s!==void 0&&ce(e))r=re(s,o)??-1;else if(s!==void 0&&T(s+1)==="=>")r=s+3;else if(s!==void 0&&f(s+1)===":"){let a=s+2;while(a<o&&f(a)!==";"){if(T(a)==="=>"){r=a+2;break}a=(m.get(a)??a)+1}}}else if(u[e]?.kind==="word"&&T(e+1)==="=>")r=e+3;else if(f(e)==="function"){let s=e+1;while(s<o&&f(s)!=="(")s=(m.get(s)??s)+1;let a=m.get(s);if(a===void 0)return;r=a+1;let l=f(r)===":"?r+1:void 0;while(r<o){if(f(r)==="{"&&(l===void 0||!Bt(g.slice(u[l].start,u[r].start))))break;r=(m.get(r)??r)+1}}if(r<0||r>=o)return;if(f(r)==="{")return{start:e,end:(m.get(r)??o-1)+1};let d=r;while(d<o&&![",",";",")","]","}"].includes(f(d)))d=(m.get(d)??d)+1;return{start:e,end:d}}function j(e,o,r=!0){for(let d=e;d<o;d++){let s=Q.get(d);if(s!==void 0){d=Math.min(s,o)-1;continue}let a=r?se(d,o):void 0;if(a){let p=a.end;while(f(p)===")")p++;if(f(p)==="("||f(p)==="."&&["call","apply"].includes(f(p+1))&&f(p+2)==="(")j(a.start,a.end,!1);d=a.end-1;continue}let l=N(d);if(l)l.binding.flow=void 0,l.binding.unresolved=!0}}function ue(e){let o=!1;while(h<u.length&&u[h].start<e){let r=f(h);if(["if","else","for","while","do","switch","try","catch","finally","with"].includes(r))o=!0;if(r===";")o=!1;if(r==="("||r==="{"||r==="["){let l=m.get(h)??h+1;while(l<u.length&&u[l].start>=e)l--;if(j(h+1,l),h=l+1,r==="{")o=!1;continue}let d=ee(h);if(d){let a=h+2,l=a,p=[];while(l<u.length&&u[l].start<e){let A=f(l);if(p.length===0&&(A===";"||l>a&&/[\r\n]/.test(g.slice(u[l-1].end,u[l].start))&&(ee(l)||["if","for","while","switch","try","do","return","throw"].includes(A))))break;if(A==="("||A==="{"||A==="[")p.push(A==="("?")":A==="{"?"}":"]");else if(A===p.at(-1))p.pop();l++}let M=l>a?g.slice(u[a].start,u[l-1].end):"";j(a,l);let z=Z(M);d.flow=!o&&z.type?d.declared?oe(d.declared,z.type):z.type:void 0,d.unresolved=o||z.unresolved||!d.flow,h=l;continue}let s=N(h);if(s)s.binding.flow=void 0,s.binding.unresolved=!0;h++}}for(let e of v){ue(e.start??0);let o=h;while(h<u.length&&u[h].start<(e.end??0))h++;if(e.kind!=="variable")continue;if(e.initializerStart!==void 0){let M=o;while(M<h&&u[M].start<e.initializerStart)M++;j(M,h)}let r=b.get(e.name);if(!r.active)continue;let d=typeof e.value==="string"?e.value:"";if(!d){r.flow=r.declared;continue}let s=Z(d),a=ot(d),l=a?b.get(a):void 0,p=X.get(e);if(p)e.inferredType=p,e.text=`${e.isExported?"export ":""}declare ${e.modifiers?.[0]??"const"} ${e.name}: ${p};`;else if(!e.typeAnnotation&&e.modifiers?.[0]==="const"&&a&&a!==e.name&&l){if(s.unresolved)e.inferenceError="DTSX_UNSUPPORTED_VALUE_FLOW";else if(s.type)e.inferredType=l.declared&&q(l.declared,s.type)?`typeof ${a}`:s.type,e.text=`${e.isExported?"export ":""}declare const ${e.name}: ${e.inferredType};`}if(e.typeAnnotation)r.flow=s.type?oe(e.typeAnnotation,s.type)??e.typeAnnotation:e.typeAnnotation;else if(e.inferredType)r.declared=e.inferredType,r.flow=e.inferredType;else{let M=e.modifiers?.[0]==="const",z=d.trim().startsWith("{")||d.trim().startsWith("["),A=n(d,M&&!z);r.declared=A==="unknown"?void 0:A,r.flow=r.declared}r.unresolved=s.unresolved}}
3
+ export{Un};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{t,d,w}from"./chunk-m9x72e5j.js";import{x}from"./chunk-n1p62kwx.js";function q(n){return typeof n==="string"?w(n,"'"):String(n)}function ma(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=x(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 Wn(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=ma(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=x(e.value,o);if(i!==void 0)o.set(e.name,i)}}
3
- export{ma,Wn};
2
+ import{t,d,w}from"./chunk-mhz6xe61.js";import{x}from"./chunk-d0aqaj02.js";function q(n){return typeof n==="string"?w(n,"'"):String(n)}function ya(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=x(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 jn(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=ya(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=x(e.value,o);if(i!==void 0)o.set(e.name,i)}}
3
+ export{ya,jn};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var Yt=["builtin","external","internal","parent","sibling","index","type","unknown"];function Xt(e){let i=e.match(/^(import\s+)(type\s+)?(.+?)\s+from\s+['"]([^'"]+)['"]/);if(!i){let p=e.match(/^import\s+['"]([^'"]+)['"]/);if(p)return{statement:e,source:p[1],isTypeOnly:!1,group:mt(p[1]),specifiers:[]};return null}let[,,u,l,c]=i,g=!!u,m,h,f=[],n=l.trim(),a=n.match(/^\*\s+as\s+(\w+)$/);if(a)h=a[1];else if(n.includes("{")){let p=n.match(/^(\w+)\s*,/);if(p)m=p[1];let d=n.match(/\{([^}]+)\}/);if(d){let I=d[1].split(",").map((y)=>y.trim()).filter(Boolean);f.push(...I)}}else if(/^\w+$/.test(n))m=n;else{let p=n.match(/\{([^}]+)\}/);if(p){let d=p[1].split(",").map((I)=>I.trim()).filter(Boolean);f.push(...d)}}return{statement:e,source:c,isTypeOnly:g,group:mt(c,g),specifiers:f,defaultImport:m,namespaceImport:h}}function mt(e,i=!1){if(i)return"type";if(e.startsWith("node:")||O(e))return"builtin";if(e.startsWith("./"))return"sibling";if(e.startsWith("../"))return"parent";if(e==="."||e==="./index")return"index";if(e.startsWith("@/")||e.startsWith("~/")||e.startsWith("#"))return"internal";if(e.startsWith("@")||/^[a-z]/.test(e))return"external";return"unknown"}var b=new Set(["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","tty","url","util","v8","vm","wasi","worker_threads","zlib"]);function O(e){return b.has(e)}function Zt(e,i={}){let{order:u=[],groupByType:l=!0,groups:c=Yt,alphabetize:g=!0,caseInsensitive:m=!0,typeImportsLast:h=!1,separateTypeImports:f=!1}=i,n=[];for(let t of e){let r=Xt(t);if(r)n.push(r);else n.push({statement:t,source:"",isTypeOnly:!1,group:"unknown",specifiers:[]})}let a=u.length>0?u.map((t)=>{if(t.startsWith("^"))try{return{regex:new RegExp(t),prefix:t.slice(1)}}catch{return{prefix:t.slice(1)}}return{prefix:t}}):[],p=(t)=>{for(let r=0;r<a.length;r++){let s=a[r];if(s.regex){if(s.regex.test(t))return r}else if(t.startsWith(s.prefix)||t.includes(`/${s.prefix}`))return r}return a.length},d=new Map,I=(t)=>{let r=d.get(t);if(r!==void 0)return r;let s=c.indexOf(t),o=s>=0?s:c.length;return d.set(t,o),o},y=(t,r)=>{if(a.length>0){let s=p(t.source),o=p(r.source);if(s!==o)return s-o}if(l){let s=I(t.group),o=I(r.group);if(s!==o)return s-o}if(h&&t.isTypeOnly!==r.isTypeOnly)return t.isTypeOnly?1:-1;if(g){let s=m?t.source.toLowerCase():t.source,o=m?r.source.toLowerCase():r.source;return s.localeCompare(o)}return 0};if(n.sort(y),l){let t=[],r=null;for(let s of n){if(r!==null&&s.group!==r){let o=c.indexOf(r),x=c.indexOf(s.group);if(o>=0&&x>=0&&o!==x)t.push("")}t.push(s.statement),r=s.group}return t}return n.map((t)=>t.statement)}function Pr(e,i={}){let u=e.split(`
3
- `),l=[],c=[],g=-1;for(let n=0;n<u.length;n++){let a=u[n].trim();if(a.startsWith("import "))l.push(u[n]),c.push(n),g=n;else if(l.length>0&&a==="")continue;else if(l.length>0&&!a.startsWith("import "))break}if(l.length===0)return e;let m=Zt(l,i),h=u.slice(0,c[0]),f=u.slice(g+1);while(f.length>0&&f[0].trim()==="")f.shift();return[...h,...m,"",...f].join(`
4
- `)}function Ps(e={}){return{sort:(i)=>Zt(i,e),sortContent:(i)=>Pr(i,e),parse:Xt,detectGroup:mt}}var Ds={default:{groupByType:!0,groups:Yt,alphabetize:!0,caseInsensitive:!0},node:{order:["node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},bun:{order:["bun","node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},typeSeparated:{groupByType:!0,groups:["builtin","external","internal","parent","sibling","index","type"],separateTypeImports:!0,alphabetize:!0},alphabetical:{groupByType:!1,alphabetize:!0,caseInsensitive:!0},none:{groupByType:!1,alphabetize:!1}};
5
- export{Yt,Xt,mt,Zt,Pr,Ps,Ds};
2
+ var Zt=["builtin","external","internal","parent","sibling","index","type","unknown"];function Qt(e){let i=e.match(/^(import\s+)(type\s+)?(.+?)\s+from\s+['"]([^'"]+)['"]/);if(!i){let p=e.match(/^import\s+['"]([^'"]+)['"]/);if(p)return{statement:e,source:p[1],isTypeOnly:!1,group:ht(p[1]),specifiers:[]};return null}let[,,u,l,c]=i,g=!!u,m,h,f=[],n=l.trim(),a=n.match(/^\*\s+as\s+(\w+)$/);if(a)h=a[1];else if(n.includes("{")){let p=n.match(/^(\w+)\s*,/);if(p)m=p[1];let d=n.match(/\{([^}]+)\}/);if(d){let I=d[1].split(",").map((y)=>y.trim()).filter(Boolean);f.push(...I)}}else if(/^\w+$/.test(n))m=n;else{let p=n.match(/\{([^}]+)\}/);if(p){let d=p[1].split(",").map((I)=>I.trim()).filter(Boolean);f.push(...d)}}return{statement:e,source:c,isTypeOnly:g,group:ht(c,g),specifiers:f,defaultImport:m,namespaceImport:h}}function ht(e,i=!1){if(i)return"type";if(e.startsWith("node:")||O(e))return"builtin";if(e.startsWith("./"))return"sibling";if(e.startsWith("../"))return"parent";if(e==="."||e==="./index")return"index";if(e.startsWith("@/")||e.startsWith("~/")||e.startsWith("#"))return"internal";if(e.startsWith("@")||/^[a-z]/.test(e))return"external";return"unknown"}var b=new Set(["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","perf_hooks","process","punycode","querystring","readline","repl","stream","string_decoder","sys","timers","tls","tty","url","util","v8","vm","wasi","worker_threads","zlib"]);function O(e){return b.has(e)}function en(e,i={}){let{order:u=[],groupByType:l=!0,groups:c=Zt,alphabetize:g=!0,caseInsensitive:m=!0,typeImportsLast:h=!1,separateTypeImports:f=!1}=i,n=[];for(let t of e){let r=Qt(t);if(r)n.push(r);else n.push({statement:t,source:"",isTypeOnly:!1,group:"unknown",specifiers:[]})}let a=u.length>0?u.map((t)=>{if(t.startsWith("^"))try{return{regex:new RegExp(t),prefix:t.slice(1)}}catch{return{prefix:t.slice(1)}}return{prefix:t}}):[],p=(t)=>{for(let r=0;r<a.length;r++){let s=a[r];if(s.regex){if(s.regex.test(t))return r}else if(t.startsWith(s.prefix)||t.includes(`/${s.prefix}`))return r}return a.length},d=new Map,I=(t)=>{let r=d.get(t);if(r!==void 0)return r;let s=c.indexOf(t),o=s>=0?s:c.length;return d.set(t,o),o},y=(t,r)=>{if(a.length>0){let s=p(t.source),o=p(r.source);if(s!==o)return s-o}if(l){let s=I(t.group),o=I(r.group);if(s!==o)return s-o}if(h&&t.isTypeOnly!==r.isTypeOnly)return t.isTypeOnly?1:-1;if(g){let s=m?t.source.toLowerCase():t.source,o=m?r.source.toLowerCase():r.source;return s.localeCompare(o)}return 0};if(n.sort(y),l){let t=[],r=null;for(let s of n){if(r!==null&&s.group!==r){let o=c.indexOf(r),x=c.indexOf(s.group);if(o>=0&&x>=0&&o!==x)t.push("")}t.push(s.statement),r=s.group}return t}return n.map((t)=>t.statement)}function Rr(e,i={}){let u=e.split(`
3
+ `),l=[],c=[],g=-1;for(let n=0;n<u.length;n++){let a=u[n].trim();if(a.startsWith("import "))l.push(u[n]),c.push(n),g=n;else if(l.length>0&&a==="")continue;else if(l.length>0&&!a.startsWith("import "))break}if(l.length===0)return e;let m=en(l,i),h=u.slice(0,c[0]),f=u.slice(g+1);while(f.length>0&&f[0].trim()==="")f.shift();return[...h,...m,"",...f].join(`
4
+ `)}function Ms(e={}){return{sort:(i)=>en(i,e),sortContent:(i)=>Rr(i,e),parse:Qt,detectGroup:ht}}var Os={default:{groupByType:!0,groups:Zt,alphabetize:!0,caseInsensitive:!0},node:{order:["node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},bun:{order:["bun","node:"],groupByType:!0,groups:["builtin","external","internal","parent","sibling","index"],alphabetize:!0},typeSeparated:{groupByType:!0,groups:["builtin","external","internal","parent","sibling","index","type"],separateTypeImports:!0,alphabetize:!0},alphabetical:{groupByType:!1,alphabetize:!0,caseInsensitive:!0},none:{groupByType:!1,alphabetize:!1}};
5
+ export{Zt,Qt,ht,en,Rr,Ms,Os};
@@ -0,0 +1,8 @@
1
+ // @bun
2
+ import{Ee}from"./chunk-nek63555.js";import{e}from"./chunk-9hjd6p38.js";import{Te,H}from"./chunk-m2kzh519.js";import{existsSync as x}from"fs";import{basename as D,dirname as M,extname as R,isAbsolute as v,relative as p,resolve as m}from"path";var{Glob:j}=globalThis.Bun;async function Se(r,o){let s=await F(r);C(r,s);let n=s.slice(),a=await(o?o():Te(r)),t=null;if(r.autoIncludeReExports!==!1&&n.length>0){t=await H(n,{includeImports:!0,resolveSpecifier:a});let l=m(r.cwd,r.root),u=r.exclude||[],f=[];for(let c of t.reachable){if(n.includes(c))continue;if(!b(c))continue;if(c.endsWith(".d.ts"))continue;if(c.includes("node_modules"))continue;let E=r.outputStructure==="flat"&&s.some((O)=>a.isPackageLocal?.(O,c));if(!S(c,l)&&!E){e.warn(`Skipping auto-included source outside root: ${p(r.cwd,c)}`);continue}if(ee(c,u,l))continue;f.push(c)}if(f.length>0)n=[...n,...f],e.debug(`Auto-included ${f.length} file(s) reached via relative re-exports`)}let i=N(n,r),d=t??await H(n,{includeImports:!0,resolveSpecifier:a}),g=await Ee([...d.sources.keys()],a,r.isolatedDeclarations??!1,d.sources),h=new Set(n);for(let[l,u]of g){if(!h.has(l))continue;for(let f of u){let c=a(f,l).resolved;if(c&&!h.has(c))throw Error(`Module augmentation import ${JSON.stringify(f)} from ${l} requires a source not emitted by this package build: ${c}`)}}let y=[...g].map(([l,u])=>[l,[...u].sort()]).sort(([l],[u])=>l.localeCompare(u));return Object.freeze({entryFiles:Object.freeze(s),files:Object.freeze(n),outputBySource:i,resolver:a,reachability:t,augmentationImports:g,getResolutionFingerprint:()=>JSON.stringify({resolution:a.cacheKey?.(n),augmentations:y})})}var P=50,w=new Map;function k(r){let o=w.get(r);if(!o){if(o=new j(r),w.set(r,o),w.size>P){let s=w.keys().next().value;if(s!==void 0)w.delete(s)}}return o}function ee(r,o,s){if(!o||o.length===0)return!1;let n=p(s,r);for(let a of o){let t=k(a);if(t.match(n)||t.match(r))return!0}return!1}var G=/[*?[\]{}!]/;function C(r,o){let s=m(r.cwd,r.root),n=` root: ${s}
3
+ entrypoints: ${r.entrypoints.map((t)=>JSON.stringify(t)).join(", ")||"(none)"}
4
+ `+(r.exclude?.length?` exclude: ${r.exclude.map((t)=>JSON.stringify(t)).join(", ")}
5
+ `:"")+"Entrypoints are resolved relative to --root. Pass several by repeating --entrypoints or separating them with commas.";if(o.length===0){if(r.entrypoints.filter((i)=>v(i)&&x(i)&&!S(i,s)).length===r.entrypoints.length)return;throw Error(`No source files matched. Nothing was generated.
6
+ ${n}`)}let a=r.entrypoints.filter((t)=>{if(G.test(t))return!1;return!x(v(t)?t:m(s,t))});if(a.length>0)throw Error(`Entrypoint${a.length>1?"s":""} not found: ${a.map((t)=>JSON.stringify(t)).join(", ")}
7
+ ${n}`)}async function F(r){let o=[],s=m(r.cwd,r.root),n=r.exclude||[],a=[...r.entrypoints,...r.include??[]];for(let t of a)if(v(t)&&b(t)){if(!t.includes("node_modules")){if(!S(t,s)&&r.outputStructure!=="flat")e.warn(`Skipping entrypoint outside root: ${p(r.cwd,t)}`);else if(!ee(t,n,s))o.push(t)}}else{let i=new j(t);for await(let d of i.scan({cwd:s,absolute:!0,onlyFiles:!0}))if(b(d)&&!d.includes("node_modules")){if(!ee(d,n,s))o.push(d)}}return[...new Set(o.map((t)=>m(t)))].sort()}function S(r,o){let s=p(o,r);return s!==".."&&!s.startsWith(`..${process.platform==="win32"?"\\":"/"}`)&&!v(s)}function N(r,o){let s=new Map,n=new Map;for(let a of r){let t=z(a,o),i=s.get(t);if(i&&i!==a)throw Error(`Output path collision: ${p(o.cwd,i)} and ${p(o.cwd,a)} both emit ${p(o.cwd,t)}`);s.set(t,a),n.set(a,t)}return n}function b(r){return/\.(m?tsx?|cts|jsx?|mjs|cjs|vue|stx)$/.test(r)&&!/\.d\.(?:ts|mts|cts)$/.test(r)}function z(r,o){let s=m(o.cwd,o.root),n=p(s,r),a=/\.d\.(?:ts|mts|cts)$/.test(n)?n:n.replace(/\.(m?tsx?|cts|jsx?|mjs|cjs|vue|stx)$/,(t)=>{if(t===".mts"||t===".mjs")return".d.mts";if(t===".cts"||t===".cjs")return".d.cts";return".d.ts"});if(o.outputStructure==="mirror")return m(o.cwd,o.outdir,a);else{let t=D(a);return m(o.cwd,o.outdir,t)}}function Qo(r,o,s=""){let n=p(M(r),o).replace(/\\/g,"/");if(n=n.replace(/\.d\.mts$/,"").replace(/\.d\.cts$/,"").replace(/\.d\.ts$/,""),s)n+=s;if(!n.startsWith("."))n=`./${n}`;return n}function $e(r,o,s,n){let a=z(r,o);return(t)=>{let i=s(t,r);if(!i.isRelative||!i.resolved)return{kind:"unchanged",reason:i.isRelative?"unresolved":"external",specifier:t,emittedSpecifier:t};if(/\.d\.(?:ts|mts|cts)$/.test(i.resolved)){if(o.moduleSpecifierMode!=="node")return{kind:"unchanged",reason:"preserved-declaration",specifier:t,emittedSpecifier:t};if(n&&!n.has(i.resolved))throw Error(`Local declaration ${JSON.stringify(t)} from ${r} targets an authored declaration not emitted by this package build: ${i.resolved}. Declaration-only dependencies must be delivered with the package before this importer can be emitted.`)}if(i.isAlias&&n&&!n.has(i.resolved))throw Error(`Local alias ${JSON.stringify(t)} from ${r} targets a declaration excluded from this package build: ${i.resolved}`);if(n&&!n.has(i.resolved)&&ee(i.resolved,o.exclude??[],m(o.cwd,o.root)))throw Error(`Local reference ${JSON.stringify(t)} from ${r} targets a source excluded from this package build: ${i.resolved}`);let d=i.isAlias?i.suffix??"":t.match(/[?#].*$/)?.[0]??"",g=d?t.slice(0,-d.length):t,h=R(g),y=/^(?:\.js|\.jsx|\.mjs|\.cjs)$/.test(h)?h:"";if(!y&&o.moduleSpecifierMode==="node"){let u=R(i.resolved);y=u===".mts"||u===".mjs"?".mjs":u===".cts"||u===".cjs"?".cjs":".js"}let l=z(i.resolved,o);return{kind:"local",specifier:t,resolvedSource:i.resolved,declarationOutput:l,emittedSpecifier:Qo(a,l,y)+d}}}
8
+ export{Se,ee,S,z,Qo,$e};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- function Vs(e,i){return e.getText?.()??i.slice(e.pos??0,e.end??i.length)}function Us(e){return e.getFullText?.().match(/\/\*[\s\S]*?\*\/|\/\/[^\n]*/g)??[]}function on(e){let i=e,s=!0;while(s){s=!1;let n=i.trimStart();if(n.startsWith("/*")){let r=n.indexOf("*/",2);if(r!==-1){i=n.slice(r+2),s=!0;continue}}if(n.startsWith("//")){let r=n.indexOf(`
3
- `);if(r!==-1)i=n.slice(r+1),s=!0;else i="",s=!0}}return i.trim()}function zs(e,i){let n=e.substring(0,i).split(`
4
- `),r=[],t=n.length-1,u=!1,a=[];while(t>=0){let l=n[t].trim();if(l.endsWith("*/")&&!u)u=!0,a.unshift(l);else if(l.startsWith("/*")&&u)a.unshift(l),r.unshift(...a),a=[],u=!1;else if(u)a.unshift(l);else if(l.startsWith("//"))r.unshift(l);else if(l.startsWith("*")&&(t>0&&n[t-1].trim().startsWith("/*")))r.unshift(l);else if(l===""&&r.length>0);else if(l!=="")break;t--}return r}function Hs(e){let i=!1,s="",n=!1;for(let r=0;r<e.length;r++){let t=e[r];if(!n&&!i&&(t==='"'||t==="'"||t==="`"))i=!0,s=t;else if(!n&&i&&t===s)i=!1;else if(t==="\\"&&!n){n=!0;continue}else if(!i&&t==="/"&&r<e.length-1){if(e[r+1]==="/")return e.substring(r)}n=!1}return null}function an(e,i,s){let n=0,r=!1,t="",u=!1;if(!e.startsWith(i))return null;for(let a=0;a<e.length;a++){let l=e[a];if(!u&&(l==='"'||l==="'"||l==="`")){if(!r)r=!0,t=l;else if(l===t)r=!1}if(l==="\\"&&!u){u=!0;continue}if(u=!1,!r){if(e.substring(a,a+i.length)===i)n++;else if(e.substring(a,a+s.length)===s){if(n--,n===0)return{content:e.substring(0,a+s.length),rest:e.substring(a+s.length)}}}}return null}function Ks(e){let i=on(e).trim(),s=i.match(/^(export\s+)?(async\s+)?function\s*(\*?)([a-zA-Z_$][\w$]*)/);if(!s)return null;let n=[];if(s[1])n.push("export");if(s[2])n.push("async");if(s[3])n.push("generator");let r=s[4],t=i.substring(s[0].length).trim(),u="";if(t.startsWith("<")){let o=an(t,"<",">");if(o)u=o.content,t=o.rest.trim()}let a="";if(t.startsWith("(")){let o=an(t,"(",")");if(o)a=o.content.slice(1,-1).trim(),t=o.rest.trim()}let l="void";if(t.startsWith(":")){let o=t.match(/^:\s*([^{;]+)/);if(o)l=o[1].trim()}return{name:r,generics:u,parameters:a,returnType:l,modifiers:n}}function qs(e){return/^\s*export\s+/.test(e)}function Js(e){return/^\s*export\s+type\s+/.test(e)}function Ys(e){let i=on(e).trim(),s=i.match(/^(export\s+)?(const|let|var)\s+([a-zA-Z_$][\w$]*)/);if(!s)return null;let n=s[2],r=s[3],t=i.substring(s[0].length).trim(),u;if(t.startsWith(":")){let l=t.indexOf("=");if(l!==-1)u=t.substring(1,l).trim(),t=t.substring(l).trim();else u=t.substring(1).replace(/;?\s*$/,"").trim(),t=""}let a;if(t.startsWith("="))a=t.substring(1).replace(/;?\s*$/,"").trim();return{kind:n,name:r,typeAnnotation:u,value:a}}
5
- export{Vs,Us,on,zs,Hs,an,Ks,qs,Js,Ys};
2
+ function Hs(e,i){return e.getText?.()??i.slice(e.pos??0,e.end??i.length)}function Ks(e){return e.getFullText?.().match(/\/\*[\s\S]*?\*\/|\/\/[^\n]*/g)??[]}function cn(e){let i=e,s=!0;while(s){s=!1;let n=i.trimStart();if(n.startsWith("/*")){let r=n.indexOf("*/",2);if(r!==-1){i=n.slice(r+2),s=!0;continue}}if(n.startsWith("//")){let r=n.indexOf(`
3
+ `);if(r!==-1)i=n.slice(r+1),s=!0;else i="",s=!0}}return i.trim()}function qs(e,i){let n=e.substring(0,i).split(`
4
+ `),r=[],t=n.length-1,u=!1,a=[];while(t>=0){let l=n[t].trim();if(l.endsWith("*/")&&!u)u=!0,a.unshift(l);else if(l.startsWith("/*")&&u)a.unshift(l),r.unshift(...a),a=[],u=!1;else if(u)a.unshift(l);else if(l.startsWith("//"))r.unshift(l);else if(l.startsWith("*")&&(t>0&&n[t-1].trim().startsWith("/*")))r.unshift(l);else if(l===""&&r.length>0);else if(l!=="")break;t--}return r}function Js(e){let i=!1,s="",n=!1;for(let r=0;r<e.length;r++){let t=e[r];if(!n&&!i&&(t==='"'||t==="'"||t==="`"))i=!0,s=t;else if(!n&&i&&t===s)i=!1;else if(t==="\\"&&!n){n=!0;continue}else if(!i&&t==="/"&&r<e.length-1){if(e[r+1]==="/")return e.substring(r)}n=!1}return null}function ln(e,i,s){let n=0,r=!1,t="",u=!1;if(!e.startsWith(i))return null;for(let a=0;a<e.length;a++){let l=e[a];if(!u&&(l==='"'||l==="'"||l==="`")){if(!r)r=!0,t=l;else if(l===t)r=!1}if(l==="\\"&&!u){u=!0;continue}if(u=!1,!r){if(e.substring(a,a+i.length)===i)n++;else if(e.substring(a,a+s.length)===s){if(n--,n===0)return{content:e.substring(0,a+s.length),rest:e.substring(a+s.length)}}}}return null}function Ys(e){let i=cn(e).trim(),s=i.match(/^(export\s+)?(async\s+)?function\s*(\*?)([a-zA-Z_$][\w$]*)/);if(!s)return null;let n=[];if(s[1])n.push("export");if(s[2])n.push("async");if(s[3])n.push("generator");let r=s[4],t=i.substring(s[0].length).trim(),u="";if(t.startsWith("<")){let o=ln(t,"<",">");if(o)u=o.content,t=o.rest.trim()}let a="";if(t.startsWith("(")){let o=ln(t,"(",")");if(o)a=o.content.slice(1,-1).trim(),t=o.rest.trim()}let l="void";if(t.startsWith(":")){let o=t.match(/^:\s*([^{;]+)/);if(o)l=o[1].trim()}return{name:r,generics:u,parameters:a,returnType:l,modifiers:n}}function Xs(e){return/^\s*export\s+/.test(e)}function Zs(e){return/^\s*export\s+type\s+/.test(e)}function Qs(e){let i=cn(e).trim(),s=i.match(/^(export\s+)?(const|let|var)\s+([a-zA-Z_$][\w$]*)/);if(!s)return null;let n=s[2],r=s[3],t=i.substring(s[0].length).trim(),u;if(t.startsWith(":")){let l=t.indexOf("=");if(l!==-1)u=t.substring(1,l).trim(),t=t.substring(l).trim();else u=t.substring(1).replace(/;?\s*$/,"").trim(),t=""}let a;if(t.startsWith("="))a=t.substring(1).replace(/;?\s*$/,"").trim();return{kind:n,name:r,typeAnnotation:u,value:a}}
5
+ export{Hs,Ks,cn,qs,Js,ln,Ys,Xs,Zs,Qs};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{e}from"./chunk-btc6zbyj.js";import{existsSync as h}from"fs";import{cpus as u}from"os";import{resolve as l}from"path";import{fileURLToPath as k}from"url";import{Worker as c}from"worker_threads";var __dirname="/home/runner/work/dtsx/dtsx/packages/dtsx/src",a;function f(){if(a!==void 0)return a;a=null;for(let t of["./worker-thread.js","./worker-thread.ts","./src/worker-thread.js","./src/worker-thread.ts"]){let r=new URL(t,import.meta.url);try{if(h(k(r))){a=r;break}}catch{}}return a}class Ut{workers=[];taskQueue=[];config;stats={totalTasks:0,completedTasks:0,failedTasks:0,averageDuration:0,activeWorkers:0,idleWorkers:0};isShuttingDown=!1;idleCheckInterval=null;constructor(t={}){let r=t.maxWorkers??Math.max(1,u().length-1);this.config={maxWorkers:r,taskTimeout:t.taskTimeout??30000,recycleAfter:t.recycleAfter??100,idleTimeout:t.idleTimeout??1e4,initialWorkers:t.initialWorkers??Math.min(2,r)}}async init(){let t=Math.min(this.config.initialWorkers,this.config.maxWorkers);for(let r=0;r<t;r++)this.createWorker();if(this.config.idleTimeout>0){if(this.idleCheckInterval=setInterval(()=>{this.checkIdleWorkers()},5000),this.idleCheckInterval&&typeof this.idleCheckInterval==="object"&&"unref"in this.idleCheckInterval)this.idleCheckInterval.unref()}}createWorker(){let t=`
2
+ import{e}from"./chunk-9hjd6p38.js";import{existsSync as h}from"fs";import{cpus as u}from"os";import{resolve as l}from"path";import{fileURLToPath as k}from"url";import{Worker as c}from"worker_threads";var __dirname="/home/runner/work/dtsx/dtsx/packages/dtsx/src",a;function f(){if(a!==void 0)return a;a=null;for(let t of["./worker-thread.js","./worker-thread.ts","./src/worker-thread.js","./src/worker-thread.ts"]){let r=new URL(t,import.meta.url);try{if(h(k(r))){a=r;break}}catch{}}return a}class Ht{workers=[];taskQueue=[];config;stats={totalTasks:0,completedTasks:0,failedTasks:0,averageDuration:0,activeWorkers:0,idleWorkers:0};isShuttingDown=!1;idleCheckInterval=null;constructor(t={}){let r=t.maxWorkers??Math.max(1,u().length-1);this.config={maxWorkers:r,taskTimeout:t.taskTimeout??30000,recycleAfter:t.recycleAfter??100,idleTimeout:t.idleTimeout??1e4,initialWorkers:t.initialWorkers??Math.min(2,r)}}async init(){let t=Math.min(this.config.initialWorkers,this.config.maxWorkers);for(let r=0;r<t;r++)this.createWorker();if(this.config.idleTimeout>0){if(this.idleCheckInterval=setInterval(()=>{this.checkIdleWorkers()},5000),this.idleCheckInterval&&typeof this.idleCheckInterval==="object"&&"unref"in this.idleCheckInterval)this.idleCheckInterval.unref()}}createWorker(){let t=`
3
3
  const { parentPort } = require('worker_threads');
4
4
  const bun = typeof Bun !== 'undefined' ? Bun : null;
5
5
  const fs = bun ? null : require('node:fs');
@@ -173,5 +173,5 @@ catch (error) {
173
173
  const result = await processTask(task);
174
174
  parentPort.postMessage(result);
175
175
  });
176
- `,r=f(),o=r?new c(k(r)):new c(t,{eval:!0}),s={worker:o,busy:!1,taskCount:0,lastActive:Date.now(),currentTask:null};return o.on("message",(i)=>{this.handleWorkerResult(s,i)}),o.on("error",(i)=>{e.error("Worker error:",i),this.handleWorkerError(s,i)}),o.on("exit",(i)=>{if(i!==0&&!this.isShuttingDown)e.error(`Worker exited with code ${i}`),this.removeWorker(s)}),this.workers.push(s),this.updateStats(),s}handleWorkerResult(t,r){if(t.busy=!1,t.taskCount++,t.lastActive=Date.now(),t.currentTask&&t.currentTask.id===r.id){clearTimeout(t.currentTask.timeout);let{resolve:s}=t.currentTask;t.currentTask=null,s(r)}if(r.success)this.stats.completedTasks++;else this.stats.failedTasks++;let o=this.stats.averageDuration*(this.stats.completedTasks+this.stats.failedTasks-1)+r.duration;if(this.stats.averageDuration=o/(this.stats.completedTasks+this.stats.failedTasks),this.updateStats(),t.taskCount>=this.config.recycleAfter)this.recycleWorker(t);this.processQueue()}handleWorkerError(t,r){if(t.busy=!1,t.currentTask){clearTimeout(t.currentTask.timeout);let{reject:o}=t.currentTask;t.currentTask=null,o(r)}this.stats.failedTasks++,this.updateStats(),this.recycleWorker(t),this.processQueue()}removeWorker(t){let r=this.workers.indexOf(t);if(r!==-1)this.workers.splice(r,1),t.worker.terminate();this.updateStats()}recycleWorker(t){if(this.removeWorker(t),!this.isShuttingDown&&this.workers.length<this.config.maxWorkers)this.createWorker()}checkIdleWorkers(){let t=Date.now(),r=1;for(let o=this.workers.length-1;o>=0;o--){let s=this.workers[o];if(!s.busy&&t-s.lastActive>this.config.idleTimeout&&this.workers.length>1)this.removeWorker(s)}}processQueue(){while(this.taskQueue.length>0){let t;for(let n=0;n<this.workers.length;n++)if(!this.workers[n].busy){t=this.workers[n];break}if(!t&&this.workers.length<this.config.maxWorkers)t=this.createWorker();if(!t)return;let{task:r,resolve:o,reject:s}=this.taskQueue.shift();t.busy=!0,t.lastActive=Date.now();let i=setTimeout(()=>{if(t.currentTask?.id===r.id)t.currentTask=null;s(Error(`Task ${r.id} timed out`)),this.recycleWorker(t)},this.config.taskTimeout);t.currentTask={id:r.id,resolve:o,reject:s,timeout:i},t.worker.postMessage(r),this.updateStats()}}async submit(t){return this.stats.totalTasks++,new Promise((r,o)=>{this.taskQueue.push({task:t,resolve:r,reject:o}),this.processQueue()})}async processFiles(t,r={}){let o=t.map((s,i)=>({id:`task-${i}-${Date.now()}`,type:"process",filePath:s.path,sourceCode:s.content,config:r}));return Promise.all(o.map((s)=>this.submit(s)))}updateStats(){let t=0;for(let r=0;r<this.workers.length;r++)if(this.workers[r].busy)t++;this.stats.activeWorkers=t,this.stats.idleWorkers=this.workers.length-t}getStats(){return{...this.stats}}async shutdown(){if(this.isShuttingDown=!0,this.idleCheckInterval)clearInterval(this.idleCheckInterval);while(this.taskQueue.length>0||this.workers.some((t)=>t.busy))await new Promise((t)=>setTimeout(t,100));await Promise.all(this.workers.map((t)=>t.worker.terminate())),this.workers=[]}}function hr(t={}){return new Ut(t)}async function ts(t,r={},o={}){let s=hr(o);await s.init();try{return await s.processFiles(t,r)}finally{await s.shutdown()}}function ns(t,r){let o=[];for(let s=0;s<t.length;s+=r)o.push(t.slice(s,s+r));return o}function rs(t,r=u().length){if(t<=r)return 1;let s=r*3;return Math.max(1,Math.ceil(t/s))}
177
- export{Ut,hr,ts,ns,rs};
176
+ `,r=f(),o=r?new c(k(r)):new c(t,{eval:!0}),s={worker:o,busy:!1,taskCount:0,lastActive:Date.now(),currentTask:null};return o.on("message",(i)=>{this.handleWorkerResult(s,i)}),o.on("error",(i)=>{e.error("Worker error:",i),this.handleWorkerError(s,i)}),o.on("exit",(i)=>{if(i!==0&&!this.isShuttingDown)e.error(`Worker exited with code ${i}`),this.removeWorker(s)}),this.workers.push(s),this.updateStats(),s}handleWorkerResult(t,r){if(t.busy=!1,t.taskCount++,t.lastActive=Date.now(),t.currentTask&&t.currentTask.id===r.id){clearTimeout(t.currentTask.timeout);let{resolve:s}=t.currentTask;t.currentTask=null,s(r)}if(r.success)this.stats.completedTasks++;else this.stats.failedTasks++;let o=this.stats.averageDuration*(this.stats.completedTasks+this.stats.failedTasks-1)+r.duration;if(this.stats.averageDuration=o/(this.stats.completedTasks+this.stats.failedTasks),this.updateStats(),t.taskCount>=this.config.recycleAfter)this.recycleWorker(t);this.processQueue()}handleWorkerError(t,r){if(t.busy=!1,t.currentTask){clearTimeout(t.currentTask.timeout);let{reject:o}=t.currentTask;t.currentTask=null,o(r)}this.stats.failedTasks++,this.updateStats(),this.recycleWorker(t),this.processQueue()}removeWorker(t){let r=this.workers.indexOf(t);if(r!==-1)this.workers.splice(r,1),t.worker.terminate();this.updateStats()}recycleWorker(t){if(this.removeWorker(t),!this.isShuttingDown&&this.workers.length<this.config.maxWorkers)this.createWorker()}checkIdleWorkers(){let t=Date.now(),r=1;for(let o=this.workers.length-1;o>=0;o--){let s=this.workers[o];if(!s.busy&&t-s.lastActive>this.config.idleTimeout&&this.workers.length>1)this.removeWorker(s)}}processQueue(){while(this.taskQueue.length>0){let t;for(let n=0;n<this.workers.length;n++)if(!this.workers[n].busy){t=this.workers[n];break}if(!t&&this.workers.length<this.config.maxWorkers)t=this.createWorker();if(!t)return;let{task:r,resolve:o,reject:s}=this.taskQueue.shift();t.busy=!0,t.lastActive=Date.now();let i=setTimeout(()=>{if(t.currentTask?.id===r.id)t.currentTask=null;s(Error(`Task ${r.id} timed out`)),this.recycleWorker(t)},this.config.taskTimeout);t.currentTask={id:r.id,resolve:o,reject:s,timeout:i},t.worker.postMessage(r),this.updateStats()}}async submit(t){return this.stats.totalTasks++,new Promise((r,o)=>{this.taskQueue.push({task:t,resolve:r,reject:o}),this.processQueue()})}async processFiles(t,r={}){let o=t.map((s,i)=>({id:`task-${i}-${Date.now()}`,type:"process",filePath:s.path,sourceCode:s.content,config:r}));return Promise.all(o.map((s)=>this.submit(s)))}updateStats(){let t=0;for(let r=0;r<this.workers.length;r++)if(this.workers[r].busy)t++;this.stats.activeWorkers=t,this.stats.idleWorkers=this.workers.length-t}getStats(){return{...this.stats}}async shutdown(){if(this.isShuttingDown=!0,this.idleCheckInterval)clearInterval(this.idleCheckInterval);while(this.taskQueue.length>0||this.workers.some((t)=>t.busy))await new Promise((t)=>setTimeout(t,100));await Promise.all(this.workers.map((t)=>t.worker.terminate())),this.workers=[]}}function br(t={}){return new Ht(t)}async function is(t,r={},o={}){let s=br(o);await s.init();try{return await s.processFiles(t,r)}finally{await s.shutdown()}}function ss(t,r){let o=[];for(let s=0;s<t.length;s+=r)o.push(t.slice(s,s+r));return o}function os(t,r=u().length){if(t<=r)return 1;let s=r*3;return Math.max(1,Math.ceil(t/s))}
177
+ export{Ht,br,is,ss,os};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{te}from"./chunk-m3ysqm3b.js";function M(n,t){let e=n.length,i=t.length,o=Array.from({length:e+1},()=>Array(i+1).fill(0));for(let s=1;s<=e;s++)for(let r=1;r<=i;r++)if(n[s-1]===t[r-1])o[s][r]=o[s-1][r-1]+1;else o[s][r]=Math.max(o[s-1][r],o[s][r-1]);return o}function S(n,t,e,i,o){let s=[];while(i>0||o>0)if(i>0&&o>0&&t[i-1]===e[o-1])s.unshift({op:"equal",oldIdx:i-1,newIdx:o-1,line:t[i-1]}),i--,o--;else if(o>0&&(i===0||n[i][o-1]>=n[i-1][o]))s.unshift({op:"add",newIdx:o-1,line:e[o-1]}),o--;else if(i>0)s.unshift({op:"remove",oldIdx:i-1,line:t[i-1]}),i--;return s}function k(n,t){let e=n;if(t.ignoreWhitespace)e=e.replace(/\s+/g," ").trim();return e}function dt(n,t,e,i={}){let{context:o=3,ignoreWhitespace:s=!1,ignoreBlankLines:r=!1}=i,f=n.split(`
2
+ import{re}from"./chunk-vv8e8pa3.js";function M(n,t){let e=n.length,i=t.length,o=Array.from({length:e+1},()=>Array(i+1).fill(0));for(let s=1;s<=e;s++)for(let r=1;r<=i;r++)if(n[s-1]===t[r-1])o[s][r]=o[s-1][r-1]+1;else o[s][r]=Math.max(o[s-1][r],o[s][r-1]);return o}function S(n,t,e,i,o){let s=[];while(i>0||o>0)if(i>0&&o>0&&t[i-1]===e[o-1])s.unshift({op:"equal",oldIdx:i-1,newIdx:o-1,line:t[i-1]}),i--,o--;else if(o>0&&(i===0||n[i][o-1]>=n[i-1][o]))s.unshift({op:"add",newIdx:o-1,line:e[o-1]}),o--;else if(i>0)s.unshift({op:"remove",oldIdx:i-1,line:t[i-1]}),i--;return s}function k(n,t){let e=n;if(t.ignoreWhitespace)e=e.replace(/\s+/g," ").trim();return e}function mt(n,t,e,i={}){let{context:o=3,ignoreWhitespace:s=!1,ignoreBlankLines:r=!1}=i,f=n.split(`
3
3
  `),p=t.split(`
4
- `);if(f[f.length-1]==="")f.pop();if(p[p.length-1]==="")p.pop();let d=f.map((l)=>k(l,{ignoreWhitespace:s})),a=p.map((l)=>k(l,{ignoreWhitespace:s})),c=d,g=a,w=f.map((l,x)=>x),m=p.map((l,x)=>x);if(r)c=[],g=[],w=[],m=[],d.forEach((l,x)=>{if(l.trim())c.push(l),w.push(x)}),a.forEach((l,x)=>{if(l.trim())g.push(l),m.push(x)});let F=M(c,g),b=S(F,c,g,c.length,g.length),B=b.every((l)=>l.op==="equal"),D=0,u=0,h=0;for(let l of b)if(l.op==="add")D++;else if(l.op==="remove")u++;else h++;let y=C(b,f,p,w,m,o);return{filePath:e,identical:B,hunks:y,stats:{additions:D,deletions:u,unchanged:h},oldContent:n,newContent:t}}function C(n,t,e,i,o,s){let r=[],f=[];if(n.forEach((a,c)=>{if(a.op!=="equal")f.push(c)}),f.length===0)return r;let p=[],d=[f[0]];for(let a=1;a<f.length;a++)if(f[a]-f[a-1]<=s*2+1)d.push(f[a]);else p.push(d),d=[f[a]];p.push(d);for(let a of p){let c=Math.max(0,a[0]-s),g=Math.min(n.length-1,a[a.length-1]+s),w=n.slice(c,g+1),m=[],F=1,b=1,B=0,D=0;for(let u=0;u<c;u++){let h=n[u];if(h.op==="equal"||h.op==="remove")F++;if(h.op==="equal"||h.op==="add")b++}for(let u of w)if(u.op==="equal")m.push(` ${u.line}`),B++,D++;else if(u.op==="remove")m.push(`-${u.line}`),B++;else if(u.op==="add")m.push(`+${u.line}`),D++;r.push({operation:"equal",lines:m,oldStart:F,oldCount:B,newStart:b,newCount:D})}return r}function qi(n){if(n.identical)return"";let t=[];t.push(`--- a/${n.filePath}`),t.push(`+++ b/${n.filePath}`);for(let e of n.hunks)t.push(`@@ -${e.oldStart},${e.oldCount} +${e.newStart},${e.newCount} @@`),t.push(...e.lines);return t.join(`
5
- `)}function fr(n){if(n.identical)return`\x1B[32m\u2713 ${n.filePath} (unchanged)\x1B[0m`;let t=[],e=`+${n.stats.additions} -${n.stats.deletions}`;t.push(`\x1B[1m${n.filePath}\x1B[0m \x1B[90m(${e})\x1B[0m`),t.push("");for(let i of n.hunks){t.push(`\x1B[36m@@ -${i.oldStart},${i.oldCount} +${i.newStart},${i.newCount} @@\x1B[0m`);for(let o of i.lines)if(o.startsWith("+"))t.push(`\x1B[32m${o}\x1B[0m`);else if(o.startsWith("-"))t.push(`\x1B[31m${o}\x1B[0m`);else t.push(`\x1B[90m${o}\x1B[0m`);t.push("")}return t.join(`
6
- `)}function Ji(n){if(n.identical)return`${n.filePath}: unchanged`;return`${n.filePath}: +${n.stats.additions} -${n.stats.deletions} lines`}async function dr(n,t,e={}){let i="";try{let o=te(n);if(await o.exists())i=await o.text();else if(!e.treatMissingAsEmpty)return dt("",t,n,e)}catch{if(!e.treatMissingAsEmpty)return dt("",t,n,e)}return dt(i,t,n,e)}async function Yi(n,t={}){let e=new Map;for(let[i,o]of n){let s=await dr(i,o,t);e.set(i,s)}return e}function pr(n){let t=0,e=0,i=0,o=0,s=0;for(let r of n.values())if(r.identical)e++;else if(t++,i+=r.stats.additions,o+=r.stats.deletions,!r.oldContent)s++;return{totalFiles:n.size,changedFiles:t,unchangedFiles:e,totalAdditions:i,totalDeletions:o,newFiles:s}}function mr(n){console.log(fr(n))}function Xi(n,t=!1){for(let i of n.values()){if(i.identical&&!t)continue;mr(i)}let e=pr(n);if(console.log(""),console.log(`\x1B[1mSummary:\x1B[0m ${e.totalFiles} files, ${e.changedFiles} changed, ${e.unchangedFiles} unchanged`),e.changedFiles>0)console.log(` \x1B[32m+${e.totalAdditions}\x1B[0m \x1B[31m-${e.totalDeletions}\x1B[0m lines`);if(e.newFiles>0)console.log(` ${e.newFiles} new files`)}
7
- export{dt,qi,fr,Ji,dr,Yi,pr,mr,Xi};
4
+ `);if(f[f.length-1]==="")f.pop();if(p[p.length-1]==="")p.pop();let d=f.map((l)=>k(l,{ignoreWhitespace:s})),a=p.map((l)=>k(l,{ignoreWhitespace:s})),c=d,g=a,w=f.map((l,x)=>x),m=p.map((l,x)=>x);if(r)c=[],g=[],w=[],m=[],d.forEach((l,x)=>{if(l.trim())c.push(l),w.push(x)}),a.forEach((l,x)=>{if(l.trim())g.push(l),m.push(x)});let F=M(c,g),b=S(F,c,g,c.length,g.length),B=b.every((l)=>l.op==="equal"),D=0,u=0,h=0;for(let l of b)if(l.op==="add")D++;else if(l.op==="remove")u++;else h++;let y=C(b,f,p,w,m,o);return{filePath:e,identical:B,hunks:y,stats:{additions:D,deletions:u,unchanged:h},oldContent:n,newContent:t}}function C(n,t,e,i,o,s){let r=[],f=[];if(n.forEach((a,c)=>{if(a.op!=="equal")f.push(c)}),f.length===0)return r;let p=[],d=[f[0]];for(let a=1;a<f.length;a++)if(f[a]-f[a-1]<=s*2+1)d.push(f[a]);else p.push(d),d=[f[a]];p.push(d);for(let a of p){let c=Math.max(0,a[0]-s),g=Math.min(n.length-1,a[a.length-1]+s),w=n.slice(c,g+1),m=[],F=1,b=1,B=0,D=0;for(let u=0;u<c;u++){let h=n[u];if(h.op==="equal"||h.op==="remove")F++;if(h.op==="equal"||h.op==="add")b++}for(let u of w)if(u.op==="equal")m.push(` ${u.line}`),B++,D++;else if(u.op==="remove")m.push(`-${u.line}`),B++;else if(u.op==="add")m.push(`+${u.line}`),D++;r.push({operation:"equal",lines:m,oldStart:F,oldCount:B,newStart:b,newCount:D})}return r}function Xi(n){if(n.identical)return"";let t=[];t.push(`--- a/${n.filePath}`),t.push(`+++ b/${n.filePath}`);for(let e of n.hunks)t.push(`@@ -${e.oldStart},${e.oldCount} +${e.newStart},${e.newCount} @@`),t.push(...e.lines);return t.join(`
5
+ `)}function pr(n){if(n.identical)return`\x1B[32m\u2713 ${n.filePath} (unchanged)\x1B[0m`;let t=[],e=`+${n.stats.additions} -${n.stats.deletions}`;t.push(`\x1B[1m${n.filePath}\x1B[0m \x1B[90m(${e})\x1B[0m`),t.push("");for(let i of n.hunks){t.push(`\x1B[36m@@ -${i.oldStart},${i.oldCount} +${i.newStart},${i.newCount} @@\x1B[0m`);for(let o of i.lines)if(o.startsWith("+"))t.push(`\x1B[32m${o}\x1B[0m`);else if(o.startsWith("-"))t.push(`\x1B[31m${o}\x1B[0m`);else t.push(`\x1B[90m${o}\x1B[0m`);t.push("")}return t.join(`
6
+ `)}function Zi(n){if(n.identical)return`${n.filePath}: unchanged`;return`${n.filePath}: +${n.stats.additions} -${n.stats.deletions} lines`}async function mr(n,t,e={}){let i="";try{let o=re(n);if(await o.exists())i=await o.text();else if(!e.treatMissingAsEmpty)return mt("",t,n,e)}catch{if(!e.treatMissingAsEmpty)return mt("",t,n,e)}return mt(i,t,n,e)}async function Qi(n,t={}){let e=new Map;for(let[i,o]of n){let s=await mr(i,o,t);e.set(i,s)}return e}function gr(n){let t=0,e=0,i=0,o=0,s=0;for(let r of n.values())if(r.identical)e++;else if(t++,i+=r.stats.additions,o+=r.stats.deletions,!r.oldContent)s++;return{totalFiles:n.size,changedFiles:t,unchangedFiles:e,totalAdditions:i,totalDeletions:o,newFiles:s}}function hr(n){console.log(pr(n))}function es(n,t=!1){for(let i of n.values()){if(i.identical&&!t)continue;hr(i)}let e=gr(n);if(console.log(""),console.log(`\x1B[1mSummary:\x1B[0m ${e.totalFiles} files, ${e.changedFiles} changed, ${e.unchangedFiles} unchanged`),e.changedFiles>0)console.log(` \x1B[32m+${e.totalAdditions}\x1B[0m \x1B[31m-${e.totalDeletions}\x1B[0m lines`);if(e.newFiles>0)console.log(` ${e.newFiles} new files`)}
7
+ export{mt,Xi,pr,Zi,mr,Qi,gr,hr,es};
@@ -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 K(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 Xr(r,e={}){let n=new Map;for(let[s,a]of r){let i=await K(a,e,s);n.set(s,i)}return n}function so(r={}){return{format:(e,n)=>K(e,r,n),formatMany:(e)=>Xr(e,r)}}async function oo(r){return(await K(r,{usePrettier:!0,builtIn:{indentSize:2,normalizeWhitespace:!0,sortImports:!0,trailingNewline:!0}})).content}
18
- export{K,Xr,so,oo};
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 J(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 Qr(r,e={}){let n=new Map;for(let[s,a]of r){let i=await J(a,e,s);n.set(s,i)}return n}function co(r={}){return{format:(e,n)=>J(e,r,n),formatMany:(e)=>Qr(e,r)}}async function lo(r){return(await J(r,{usePrettier:!0,builtIn:{indentSize:2,normalizeWhitespace:!0,sortImports:!0,trailingNewline:!0}})).content}
18
+ export{J,Qr,co,lo};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{B}from"./chunk-60wrxcjt.js";import{k}from"./chunk-pwdmw567.js";import{Ce,ve}from"./chunk-1dqa0tex.js";import{createHash as x}from"crypto";import{readFile as d}from"fs/promises";import{resolve as m}from"path";async function Pn(g){let e={...B,...g},n=e.moduleSpecifierMode??"preserve";if(n!=="node"&&n!=="preserve")throw Error("moduleSpecifierMode must be preserve or node");if(e.plugins?.length)throw Error("Native project planning does not support generation plugins");let o=await Ce(e),l=[];for(let r of o.files){let s=await d(r),a=s.toString("utf8");if(!Buffer.from(a,"utf8").equals(s))throw Error(`Native declaration source must be valid UTF-8: ${r}`);let u=o.outputBySource.get(r),v=ve(r,e,o.resolver),i=[],S=new Set(k(a,{includeImports:!0}).map((t)=>t.specifier));for(let t of S){let p=v(t);if(p.kind!=="local")continue;let{resolvedSource:h,declarationOutput:w,emittedSpecifier:y}=p;i.push({specifier:t,resolvedSource:h,declarationOutput:w,emittedSpecifier:y})}let c={version:1,moduleSpecifierMode:n,sourceFile:r,outputFile:u,sourceHash:x("sha256").update(s).digest("hex"),rewrites:i};if(!e.isolatedDeclarations&&i.length)c.inferenceSources=await Promise.all(i.map(async(t)=>({specifier:t.specifier,source:await d(t.resolvedSource,"utf8")})));let f=o.augmentationImports.get(r);if(f?.size)c.augmentationImports=[...f];l.push(Object.freeze({sourceFile:r,outputFile:u,source:a,context:c}))}return Object.freeze({version:1,rootPath:m(e.cwd,e.root),outdirPath:m(e.cwd,e.outdir),files:Object.freeze(l)})}
3
- export{Pn};
2
+ import{B}from"./chunk-waan03ga.js";import{k}from"./chunk-m2kzh519.js";import{Se,$e}from"./chunk-59jw51gg.js";import{createHash as x}from"crypto";import{readFile as d}from"fs/promises";import{resolve as m}from"path";async function Rn(g){let e={...B,...g},n=e.moduleSpecifierMode??"preserve";if(n!=="node"&&n!=="preserve")throw Error("moduleSpecifierMode must be preserve or node");if(e.plugins?.length)throw Error("Native project planning does not support generation plugins");let o=await Se(e),l=[];for(let r of o.files){let s=await d(r),a=s.toString("utf8");if(!Buffer.from(a,"utf8").equals(s))throw Error(`Native declaration source must be valid UTF-8: ${r}`);let u=o.outputBySource.get(r),v=$e(r,e,o.resolver),i=[],S=new Set(k(a,{includeImports:!0}).map((t)=>t.specifier));for(let t of S){let p=v(t);if(p.kind!=="local")continue;let{resolvedSource:h,declarationOutput:w,emittedSpecifier:y}=p;i.push({specifier:t,resolvedSource:h,declarationOutput:w,emittedSpecifier:y})}let c={version:1,moduleSpecifierMode:n,sourceFile:r,outputFile:u,sourceHash:x("sha256").update(s).digest("hex"),rewrites:i};if(!e.isolatedDeclarations&&i.length)c.inferenceSources=await Promise.all(i.map(async(t)=>({specifier:t.specifier,source:await d(t.resolvedSource,"utf8")})));let f=o.augmentationImports.get(r);if(f?.size)c.augmentationImports=[...f];l.push(Object.freeze({sourceFile:r,outputFile:u,source:a,context:c}))}return Object.freeze({version:1,rootPath:m(e.cwd,e.root),outdirPath:m(e.cwd,e.outdir),files:Object.freeze(l)})}
3
+ export{Rn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-y83jhbpr.js";function me(a={}){let{onStart:d=!1,onEnd:l=!0,onGenerated:u,onError:i,...n}=a,e=async()=>{try{let r=await s(n);u?.(r)}catch(r){let t=r instanceof Error?r:Error(String(r));if(i?.(t),!i)console.error("[dtsx] Generation failed:",t.message)}};return{name:"dtsx",setup(r){let t=r.initialOptions;if(!n.entrypoints&&t.entryPoints)if(Array.isArray(t.entryPoints))n.entrypoints=t.entryPoints;else n.entrypoints=Object.values(t.entryPoints);if(!n.outdir){if(t.outdir)n.outdir=t.outdir;else if(t.outfile){let o=t.outfile.lastIndexOf("/");if(o!==-1)n.outdir=t.outfile.substring(0,o)}}if(d)r.onStart(async()=>{await e()});if(l)r.onEnd(async(o)=>{if(o.errors.length===0)await e()})}}}var Aa=me,sr=me,Pa=me;
3
- export{me,Aa,sr,Pa};
2
+ import{s}from"./chunk-ykrdzatr.js";function he(a={}){let{onStart:d=!1,onEnd:l=!0,onGenerated:u,onError:i,...n}=a,e=async()=>{try{let r=await s(n);u?.(r)}catch(r){let t=r instanceof Error?r:Error(String(r));if(i?.(t),!i)console.error("[dtsx] Generation failed:",t.message)}};return{name:"dtsx",setup(r){let t=r.initialOptions;if(!n.entrypoints&&t.entryPoints)if(Array.isArray(t.entryPoints))n.entrypoints=t.entryPoints;else n.entrypoints=Object.values(t.entryPoints);if(!n.outdir){if(t.outdir)n.outdir=t.outdir;else if(t.outfile){let o=t.outfile.lastIndexOf("/");if(o!==-1)n.outdir=t.outfile.substring(0,o)}}if(d)r.onStart(async()=>{await e()});if(l)r.onEnd(async(o)=>{if(o.errors.length===0)await e()})}}}var Ra=he,ar=he,Ma=he;
3
+ export{he,Ra,ar,Ma};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{s}from"./chunk-y83jhbpr.js";import w from"process";import{dirname as x,relative as y,resolve as B,sep as l}from"path";function _e(p={}){let{preBuild:c=!1,postBuild:r=!0,onGenerated:n,onError:o,failOnError:E=!0,...e}=p,v=async(i)=>{try{let t=await s(i);n?.(t)}catch(t){let d=t instanceof Error?t:Error(String(t));if(o?.(d),!o)console.error("[dtsx] Generation failed:",d.message);if(E)throw d}};return{name:"dtsx",async setup(i){if(!c&&!r)return;let t=e.cwd||w.cwd(),u=(i.config.entrypoints||[]).map((a)=>B(t,a)),g=e.root||i.config.root||(u.length>0?y(t,G(u))||".":"./src"),f=B(t,g),m=e.entrypoints||u.filter((a)=>a===f||a.startsWith(`${f}${l}`)).map((a)=>y(f,a));await v({...e,cwd:t,root:g,entrypoints:m.length>0?m:["index.ts"],outdir:e.outdir||i.config.outdir||"./dist",moduleSpecifierMode:e.moduleSpecifierMode??(i.config.target==="node"?"node":"preserve")})}}}function G(p){let c=p.map((n)=>x(n).split(l)),r=c[0];for(let n of c.slice(1)){let o=0;while(o<r.length&&o<n.length&&r[o]===n[o])o++;r=r.slice(0,o)}return r.join(l)||l}var va=_e,Sa=_e;
3
- export{_e,va,Sa};
2
+ import{s}from"./chunk-ykrdzatr.js";import w from"process";import{dirname as x,relative as y,resolve as B,sep as l}from"path";function Ge(p={}){let{preBuild:c=!1,postBuild:r=!0,onGenerated:n,onError:o,failOnError:E=!0,...e}=p,v=async(i)=>{try{let t=await s(i);n?.(t)}catch(t){let d=t instanceof Error?t:Error(String(t));if(o?.(d),!o)console.error("[dtsx] Generation failed:",d.message);if(E)throw d}};return{name:"dtsx",async setup(i){if(!c&&!r)return;let t=e.cwd||w.cwd(),u=(i.config.entrypoints||[]).map((a)=>B(t,a)),g=e.root||i.config.root||(u.length>0?y(t,G(u))||".":"./src"),f=B(t,g),m=e.entrypoints||u.filter((a)=>a===f||a.startsWith(`${f}${l}`)).map((a)=>y(f,a));await v({...e,cwd:t,root:g,entrypoints:m.length>0?m:["index.ts"],outdir:e.outdir||i.config.outdir||"./dist",moduleSpecifierMode:e.moduleSpecifierMode??(i.config.target==="node"?"node":"preserve")})}}}function G(p){let c=p.map((n)=>x(n).split(l)),r=c[0];for(let n of c.slice(1)){let o=0;while(o<r.length&&o<n.length&&r[o]===n[o])o++;r=r.slice(0,o)}return r.join(l)||l}var Ea=Ge,ka=Ge;
3
+ export{Ge,Ea,ka};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{X}from"./chunk-01zsk2q8.js";function gi(n,r,e,t={}){return{kind:n,name:r,text:e,isExported:t.isExported??!1,...t}}function hi(n){if(typeof structuredClone==="function")return structuredClone(n);return JSON.parse(JSON.stringify(n))}function An(n,r,e=null){for(let t of n){r.enter?.(t,e);let o=r[t.kind];if(o)o(t,e);if(t.members&&t.members.length>0)An(t.members,r,t);r.leave?.(t,e)}}function Po(n,r){let e=[];return An(n,{enter:(t)=>{if(r(t))e.push(t)}}),e}async function yi(n,r,e){let t=[],o=n.length;for(let a=0;a<n.length;a++){let i=n[a],s={...e,index:a,total:o,allDeclarations:n},l=await r(i,s);if(l===null)continue;else if(l===void 0)t.push(i);else if(Array.isArray(l))t.push(...l);else t.push(l)}return t}function Do(...n){return async(r,e)=>{let t=r;for(let o of n){if(t===null)return null;if(Array.isArray(t)){let a=[];for(let i of t){let s=await o(i,e);if(s===null)continue;if(s===void 0)a.push(i);else if(Array.isArray(s))a.push(...s);else a.push(s)}t=a.length>0?a:null}else{let a=await o(t,e);if(a===null)t=null;else if(a===void 0);else t=a}}return t}}function xe(n,r){let e=new Set(Array.isArray(n)?n:[n]);return async(t,o)=>{if(e.has(t.kind))return r(t,o);return}}function Ro(n,r){return async(e,t)=>{if(n(e))return r(e,t);return}}function Xe(n){let r={createDeclaration:gi,cloneDeclaration:hi,modifyText:(e,t)=>({...e,text:t}),addModifier:(e,t)=>({...e,modifiers:[...e.modifiers||[],t]}),removeModifier:(e,t)=>({...e,modifiers:(e.modifiers||[]).filter((o)=>o!==t)})};return X({name:n.name,version:n.version,description:n.description,onBeforeFile:n.beforeParse?async(e)=>n.beforeParse(e.content,{filePath:e.filePath,phase:"before"}):void 0,onDeclarations:n.transform?async(e)=>yi(e.declarations,n.transform,{filePath:e.filePath,sourceCode:e.sourceCode,...r}):void 0,onAfterFile:n.afterGenerate?async(e)=>n.afterGenerate(e.content,{filePath:e.filePath,phase:"after"}):void 0})}function Mo(n,r){let e=typeof n==="string"?new RegExp(n):n;return(t)=>{if(e.test(t.name)){let o=typeof r==="function"?r(t.name,t):t.name.replace(e,r),a=t.text.replace(new RegExp(`\\b${f(t.name)}\\b`),o);return{...t,name:o,text:a}}return}}function bi(n,r){return(e)=>{if(e.kind==="import")return;if(r&&!r(e))return;let t=`${n}${e.name}`,o=e.text.replace(new RegExp(`\\b${f(e.name)}\\b`),t);return{...e,name:t,text:o}}}function Oo(n,r){return(e)=>{if(e.kind==="import")return;if(r&&!r(e))return;let t=`${e.name}${n}`,o=e.text.replace(new RegExp(`\\b${f(e.name)}\\b`),t);return{...e,name:t,text:o}}}function xi(n){let r=typeof n==="function"?n:(e)=>(typeof n==="string"?new RegExp(n):n).test(e.name);return(e)=>{if(r(e))return null;return}}function Io(n){return(r)=>{let e=n(r);if(!e)return;let o=(Array.isArray(e)?e:[e]).map((a)=>{if(a.startsWith("/**"))return a;if(a.startsWith("/*"))return a;return`/** ${a} */`});return{...r,leadingComments:[...r.leadingComments||[],...o]}}}function Lo(n){return(r)=>{if(!r.typeAnnotation)return;let e=n(r.typeAnnotation,r);if(e===null)return null;if(e===void 0)return;let t=r.text.replace(new RegExp(`:[ ]*${f(r.typeAnnotation)}`),`: ${e}`);return{...r,typeAnnotation:e,text:t}}}function Fo(n){return xe("function",(r)=>{if(!r.returnType)return;let e=n(r.returnType,r);if(e===null)return null;if(e===void 0)return;let t=r.text.replace(new RegExp(`\\):[ ]*${f(r.returnType)}`),`): ${e}`);return{...r,returnType:e,text:t}})}function No(n){return xe(["function","class"],(r)=>{if(!r.parameters)return;let e=n(r.parameters,r);if(e===null)return null;if(e===void 0)return;let t=e.map((a)=>{let i="";if(a.rest)i+="...";if(i+=a.name,a.optional)i+="?";if(a.type)i+=`: ${a.type}`;if(a.defaultValue)i+=` = ${a.defaultValue}`;return i}).join(", "),o=r.text.replace(/\([^)]*\)/,`(${t})`);return{...r,parameters:e,text:o}})}function wi(n,r){return(e)=>{if(r&&!r(e))return;if(e.modifiers?.includes(n))return;let t=[...e.modifiers||[],n],o=e.text;if(!o.includes(n)){let a=["function","class","interface","type","enum","const","let","var"];for(let i of a){let s=o.indexOf(i);if(s>=0){o=`${o.slice(0,s)}${n} ${o.slice(s)}`;break}}}return{...e,modifiers:t,text:o}}}var Ci=xe(["interface","type"],(n)=>{let r=n.text.replace(/(\n\s*)(\w+)(\??:\s)/g,"$1readonly $2$3");if(r===n.text)return;return{...n,text:r}}),Bo=xe(["interface","type"],(n)=>{let r=n.text.replace(/(\w+)\?:/g,"$1:");if(r===n.text)return;return{...n,text:r}}),Wo=xe(["interface","type"],(n)=>{let r=n.text.replace(/(\w+)(?<!\?):/g,"$1?:");if(r===n.text)return;return{...n,text:r}});function _o(n){let r=new RegExp(`@(${n.join("|")})\\b[^@]*`,"g");return(e)=>{if(!e.leadingComments?.length)return;let t=e.leadingComments.map((a)=>a.replace(r,"").replace(/\n\s*\*\s*\n/g,`
3
- `));if(!t.some((a,i)=>a!==e.leadingComments[i]))return;return{...e,leadingComments:t}}}function jo(n,r){return(e)=>{if(r&&!r(e))return;if(!e.typeAnnotation)return;let t=`${n}<${e.typeAnnotation}>`,o=e.text.replace(e.typeAnnotation,t);return{...e,typeAnnotation:t,text:o}}}var Go=Xe({name:"readonly",version:"1.0.0",description:"Makes all interface properties readonly",transform:Ci}),Vo=Xe({name:"strip-private",version:"1.0.0",description:"Strips @internal, @private, and @hidden declarations",transform:xi((n)=>{if(!n.leadingComments)return!1;return n.leadingComments.some((r)=>/@(internal|private|hidden)\b/.test(r))})}),Uo=Xe({name:"declare",version:"1.0.0",description:"Adds declare keyword to all declarations",transform:wi("declare",(n)=>n.kind!=="import")});function zo(n){return Xe({name:`namespace-prefix-${n}`,version:"1.0.0",description:`Prefixes exported declarations with ${n}`,transform:bi(`${n}_`,(r)=>r.isExported&&r.kind!=="import")})}function f(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}
4
- export{gi,hi,An,Po,yi,Do,xe,Ro,Xe,Mo,bi,Oo,xi,Io,Lo,Fo,No,wi,Ci,Bo,Wo,_o,jo,Go,Vo,Uo,zo};
2
+ import{Q}from"./chunk-mhyqvwcg.js";function bi(n,r,e,t={}){return{kind:n,name:r,text:e,isExported:t.isExported??!1,...t}}function xi(n){if(typeof structuredClone==="function")return structuredClone(n);return JSON.parse(JSON.stringify(n))}function Pn(n,r,e=null){for(let t of n){r.enter?.(t,e);let o=r[t.kind];if(o)o(t,e);if(t.members&&t.members.length>0)Pn(t.members,r,t);r.leave?.(t,e)}}function Mo(n,r){let e=[];return Pn(n,{enter:(t)=>{if(r(t))e.push(t)}}),e}async function wi(n,r,e){let t=[],o=n.length;for(let a=0;a<n.length;a++){let i=n[a],s={...e,index:a,total:o,allDeclarations:n},l=await r(i,s);if(l===null)continue;else if(l===void 0)t.push(i);else if(Array.isArray(l))t.push(...l);else t.push(l)}return t}function Oo(...n){return async(r,e)=>{let t=r;for(let o of n){if(t===null)return null;if(Array.isArray(t)){let a=[];for(let i of t){let s=await o(i,e);if(s===null)continue;if(s===void 0)a.push(i);else if(Array.isArray(s))a.push(...s);else a.push(s)}t=a.length>0?a:null}else{let a=await o(t,e);if(a===null)t=null;else if(a===void 0);else t=a}}return t}}function Ce(n,r){let e=new Set(Array.isArray(n)?n:[n]);return async(t,o)=>{if(e.has(t.kind))return r(t,o);return}}function Io(n,r){return async(e,t)=>{if(n(e))return r(e,t);return}}function Qe(n){let r={createDeclaration:bi,cloneDeclaration:xi,modifyText:(e,t)=>({...e,text:t}),addModifier:(e,t)=>({...e,modifiers:[...e.modifiers||[],t]}),removeModifier:(e,t)=>({...e,modifiers:(e.modifiers||[]).filter((o)=>o!==t)})};return Q({name:n.name,version:n.version,description:n.description,onBeforeFile:n.beforeParse?async(e)=>n.beforeParse(e.content,{filePath:e.filePath,phase:"before"}):void 0,onDeclarations:n.transform?async(e)=>wi(e.declarations,n.transform,{filePath:e.filePath,sourceCode:e.sourceCode,...r}):void 0,onAfterFile:n.afterGenerate?async(e)=>n.afterGenerate(e.content,{filePath:e.filePath,phase:"after"}):void 0})}function Lo(n,r){let e=typeof n==="string"?new RegExp(n):n;return(t)=>{if(e.test(t.name)){let o=typeof r==="function"?r(t.name,t):t.name.replace(e,r),a=t.text.replace(new RegExp(`\\b${f(t.name)}\\b`),o);return{...t,name:o,text:a}}return}}function Ci(n,r){return(e)=>{if(e.kind==="import")return;if(r&&!r(e))return;let t=`${n}${e.name}`,o=e.text.replace(new RegExp(`\\b${f(e.name)}\\b`),t);return{...e,name:t,text:o}}}function Fo(n,r){return(e)=>{if(e.kind==="import")return;if(r&&!r(e))return;let t=`${e.name}${n}`,o=e.text.replace(new RegExp(`\\b${f(e.name)}\\b`),t);return{...e,name:t,text:o}}}function vi(n){let r=typeof n==="function"?n:(e)=>(typeof n==="string"?new RegExp(n):n).test(e.name);return(e)=>{if(r(e))return null;return}}function No(n){return(r)=>{let e=n(r);if(!e)return;let o=(Array.isArray(e)?e:[e]).map((a)=>{if(a.startsWith("/**"))return a;if(a.startsWith("/*"))return a;return`/** ${a} */`});return{...r,leadingComments:[...r.leadingComments||[],...o]}}}function Bo(n){return(r)=>{if(!r.typeAnnotation)return;let e=n(r.typeAnnotation,r);if(e===null)return null;if(e===void 0)return;let t=r.text.replace(new RegExp(`:[ ]*${f(r.typeAnnotation)}`),`: ${e}`);return{...r,typeAnnotation:e,text:t}}}function Wo(n){return Ce("function",(r)=>{if(!r.returnType)return;let e=n(r.returnType,r);if(e===null)return null;if(e===void 0)return;let t=r.text.replace(new RegExp(`\\):[ ]*${f(r.returnType)}`),`): ${e}`);return{...r,returnType:e,text:t}})}function _o(n){return Ce(["function","class"],(r)=>{if(!r.parameters)return;let e=n(r.parameters,r);if(e===null)return null;if(e===void 0)return;let t=e.map((a)=>{let i="";if(a.rest)i+="...";if(i+=a.name,a.optional)i+="?";if(a.type)i+=`: ${a.type}`;if(a.defaultValue)i+=` = ${a.defaultValue}`;return i}).join(", "),o=r.text.replace(/\([^)]*\)/,`(${t})`);return{...r,parameters:e,text:o}})}function Si(n,r){return(e)=>{if(r&&!r(e))return;if(e.modifiers?.includes(n))return;let t=[...e.modifiers||[],n],o=e.text;if(!o.includes(n)){let a=["function","class","interface","type","enum","const","let","var"];for(let i of a){let s=o.indexOf(i);if(s>=0){o=`${o.slice(0,s)}${n} ${o.slice(s)}`;break}}}return{...e,modifiers:t,text:o}}}var $i=Ce(["interface","type"],(n)=>{let r=n.text.replace(/(\n\s*)(\w+)(\??:\s)/g,"$1readonly $2$3");if(r===n.text)return;return{...n,text:r}}),jo=Ce(["interface","type"],(n)=>{let r=n.text.replace(/(\w+)\?:/g,"$1:");if(r===n.text)return;return{...n,text:r}}),Go=Ce(["interface","type"],(n)=>{let r=n.text.replace(/(\w+)(?<!\?):/g,"$1?:");if(r===n.text)return;return{...n,text:r}});function Vo(n){let r=new RegExp(`@(${n.join("|")})\\b[^@]*`,"g");return(e)=>{if(!e.leadingComments?.length)return;let t=e.leadingComments.map((a)=>a.replace(r,"").replace(/\n\s*\*\s*\n/g,`
3
+ `));if(!t.some((a,i)=>a!==e.leadingComments[i]))return;return{...e,leadingComments:t}}}function Uo(n,r){return(e)=>{if(r&&!r(e))return;if(!e.typeAnnotation)return;let t=`${n}<${e.typeAnnotation}>`,o=e.text.replace(e.typeAnnotation,t);return{...e,typeAnnotation:t,text:o}}}var zo=Qe({name:"readonly",version:"1.0.0",description:"Makes all interface properties readonly",transform:$i}),Ho=Qe({name:"strip-private",version:"1.0.0",description:"Strips @internal, @private, and @hidden declarations",transform:vi((n)=>{if(!n.leadingComments)return!1;return n.leadingComments.some((r)=>/@(internal|private|hidden)\b/.test(r))})}),Ko=Qe({name:"declare",version:"1.0.0",description:"Adds declare keyword to all declarations",transform:Si("declare",(n)=>n.kind!=="import")});function qo(n){return Qe({name:`namespace-prefix-${n}`,version:"1.0.0",description:`Prefixes exported declarations with ${n}`,transform:Ci(`${n}_`,(r)=>r.isExported&&r.kind!=="import")})}function f(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}
4
+ export{bi,xi,Pn,Mo,wi,Oo,Ce,Io,Qe,Lo,Ci,Fo,vi,No,Bo,Wo,_o,Si,$i,jo,Go,Vo,Uo,zo,Ho,Ko,qo};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{e,A}from"./chunk-btc6zbyj.js";import{ke}from"./chunk-bkbsg2bv.js";import{s}from"./chunk-y83jhbpr.js";import{existsSync as u,readFileSync as w}from"fs";import{dirname as W,join as d,resolve as v}from"path";async function Kr(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(ke(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 qr(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 un(i){let c=Date.now(),n=qr(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-9hjd6p38.js";import{Ae}from"./chunk-xgf6djk3.js";import{s}from"./chunk-ykrdzatr.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(Ae(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 Yr(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 dn(i){let c=Date.now(),n=Yr(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 to(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 Kr(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`),un({root:i,projects:t,sharedConfig:c})}async function Jr(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 Yr(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 no(i,c){if(c?.logLevel)A(c.logLevel);let n=await Jr(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 Yr(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 un({root:i,projects:a,sharedConfig:c})}
6
- export{Kr,qr,un,to,Jr,Yr,no};
5
+ `),{success:a,projects:t,durationMs:f}}async function io(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`),dn({root:i,projects:t,sharedConfig:c})}async function Xr(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 Zr(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 so(i,c){if(c?.logLevel)A(c.logLevel);let n=await Xr(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 Zr(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 dn({root:i,projects:a,sharedConfig:c})}
6
+ export{Jr,Yr,dn,io,Xr,Zr,so};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{W}from"./chunk-k5wz43yh.js";import{De,In}from"./chunk-nxk4h5hy.js";import{ie,Fn}from"./chunk-zp93zcn5.js";function ki(){Fn(),In()}function r(e,t,c=!0,n=!1,o){return De(e,t,c,n,o)}async function On(e,t,c=!0,n={}){return await ie(t,e,n),r(e,t,c)}async function Ti(e,t={}){let c=W(t.concurrency,4),n=new Map;for(let o=0;o<e.length;o+=c){let s=e.slice(o,o+c),i=await Promise.all(s.map(async(a)=>({path:a.filePath,declarations:await On(a.sourceCode,a.filePath,a.keepComments,t)})));for(let a of i)n.set(a.path,a.declarations)}return n}
3
+ export{ki,r,On,Ti};
@@ -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 Ti(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 ba(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=Ti({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 Ai(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 Pi(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 Ca(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=Pi({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 Ri(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 xa(){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(Ai(e))},onError:(e)=>{console.error(`Error: ${e.message}`)}}}
6
- export{Ti,ba,Ai,xa};
4
+ `)}`}function va(){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(Ri(e))},onError:(e)=>{console.error(`Error: ${e.message}`)}}}
6
+ export{Pi,Ca,Ri,va};
@@ -1,10 +1,10 @@
1
1
  // @bun
2
- import{_,Kn,qn}from"./chunk-23w57jk5.js";import{xn}from"./chunk-9c0k2b8n.js";import{f}from"./chunk-a3apthex.js";import{re,h,ie,se,oe,ae,ce}from"./chunk-9dkjzqm0.js";import{Pe,b}from"./chunk-1721pyws.js";import{$e}from"./chunk-5v7drjwg.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=xn(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=[],W=[],F=[],C=[],T=[];for(let e of k){let i=e.kind;switch(i){case"import":w.push(e);break;case"function":N.push(e);break;case"variable":M.push(e);break;case"interface":P.push(e);break;case"type":U.push(e);break;case"class":W.push(e);break;case"enum":F.push(e);break;case"module":C.push(e);break;case"export":T.push(e);break;case"namespace":C.push(e);break;case"unknown":break;default:V(i,`Unhandled declaration kind: ${i}`)}}let S=[],v=[],A=[],K=new Set;for(let e of T){let i=f(e.leadingComments,d);if(e.text.startsWith("export default")){let r=e.text.endsWith(";")?e.text:`${e.text};`;A.push(i+r)}else{let r=e.text.trim();if(!r.endsWith(";"))r+=";";let a=i+r;if(!K.has(a))if(K.add(a),a.includes("export type"))S.push(a);else v.push(a)}}let u=[];if(w.length>0){let{usedItems:e}=$e(k);for(let r of w){if(r.isSideEffect){let t=r.text.trim(),p=t.endsWith(";")?t:`${t};`;u.push(p);continue}let a=b(r.text);if(!a)continue;let{defaultName:s,namedItems:n,isTypeOnly:g,namespaceName:c}=a,D=s?e.has(s):!1,L=c?e.has(c):!1;if(a.isImportEquals){if(D){let t=r.text.trim();u.push(t.endsWith(";")?t:`${t};`)}else if(x.augmentationImports?.has(a.source)){let t=Pe(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}continue}let I="",E=0;for(let t=0;t<n.length;t++){let p=n[t];if(e.has(p.name)){if(E>0)I+=", ";if(!g&&p.isTypeOnly)I+="type ";I+=p.originalName===p.name?p.name:`${p.originalName} as ${p.name}`,E++}}if(D||L||E>0){let t=g?"import type ":"import ";if(L&&c){if(D&&s)t+=`${s}, `;t+=`* as ${c}`}else if(D&&s)t+=E>0?`${s}, { ${I} }`:s;else if(E>0)t+=`{ ${I} }`;let p=Pe(r.text);if(!p)throw Error("Cannot locate a grammatical module literal in the import declaration");t+=` from ${p};`,u.push(t)}else if(x.augmentationImports?.has(a.source)){let t=Pe(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}}let i=y.length;if(u.length>1){if(j!==y)j=y,q=y.map((n)=>`from '${n}`),z=y.map((n)=>`from "${n}`);let r=q,a=z,s=new Map;for(let n of u){let g=i;for(let c=0;c<y.length;c++)if(n.includes(r[c])||n.includes(a[c])){g=c;break}s.set(n,g)}u.sort((n,g)=>{let c=s.get(n),D=s.get(g);return c!==D?c-D:n.localeCompare(g)})}}for(let e=0;e<u.length;e++){if(o)o+=`
2
+ import{_,Jn,Yn}from"./chunk-q45jkpya.js";import{Cn}from"./chunk-3shq1bjr.js";import{f}from"./chunk-th9tcxga.js";import{se,h,oe,ae,ce,le,ue}from"./chunk-jbxb317g.js";import{Re,b}from"./chunk-xa9vcbjj.js";import{ke}from"./chunk-hwgxwgsh.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=Cn(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=[],W=[],F=[],C=[],T=[];for(let e of k){let i=e.kind;switch(i){case"import":w.push(e);break;case"function":N.push(e);break;case"variable":M.push(e);break;case"interface":P.push(e);break;case"type":U.push(e);break;case"class":W.push(e);break;case"enum":F.push(e);break;case"module":C.push(e);break;case"export":T.push(e);break;case"namespace":C.push(e);break;case"unknown":break;default:V(i,`Unhandled declaration kind: ${i}`)}}let S=[],v=[],A=[],K=new Set;for(let e of T){let i=f(e.leadingComments,d);if(e.text.startsWith("export default")){let r=e.text.endsWith(";")?e.text:`${e.text};`;A.push(i+r)}else{let r=e.text.trim();if(!r.endsWith(";"))r+=";";let a=i+r;if(!K.has(a))if(K.add(a),a.includes("export type"))S.push(a);else v.push(a)}}let u=[];if(w.length>0){let{usedItems:e}=ke(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=Re(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=Re(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=Re(r.text);if(!t)throw Error("Cannot locate an augmentation import module literal");u.push(`import ${t};`)}}let i=y.length;if(u.length>1){if(j!==y)j=y,q=y.map((n)=>`from '${n}`),z=y.map((n)=>`from "${n}`);let r=q,a=z,s=new Map;for(let n of u){let g=i;for(let c=0;c<y.length;c++)if(n.includes(r[c])||n.includes(a[c])){g=c;break}s.set(n,g)}u.sort((n,g)=>{let c=s.get(n),D=s.get(g);return c!==D?c-D:n.localeCompare(g)})}}for(let e=0;e<u.length;e++){if(o)o+=`
4
4
  `;o+=u[e]}for(let e=0;e<S.length;e++){if(o)o+=`
5
- `;o+=S[e]}let G=[N,M,P,U,W,F,C];for(let e=0;e<G.length;e++){let i=G[e];for(let r=0;r<i.length;r++){let a=i[r],s="",n=a.kind;switch(n){case"function":s=re(a,d);break;case"variable":s=h(a,d);break;case"interface":s=ie(a,d);break;case"type":s=se(a,d);break;case"class":s=oe(a,d);break;case"enum":s=ae(a,d);break;case"module":case"namespace":s=ce(a,d);break;case"import":case"export":case"unknown":break;default:V(n,`Unhandled declaration kind in processor: ${n}`)}if(s){if(o)o+=`
5
+ `;o+=S[e]}let G=[N,M,P,U,W,F,C];for(let e=0;e<G.length;e++){let i=G[e];for(let r=0;r<i.length;r++){let a=i[r],s="",n=a.kind;switch(n){case"function":s=se(a,d);break;case"variable":s=h(a,d);break;case"interface":s=oe(a,d);break;case"type":s=ae(a,d);break;case"class":s=ce(a,d);break;case"enum":s=le(a,d);break;case"module":case"namespace":s=ue(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
6
  `;o+=s}}}for(let e=0;e<v.length;e++){if(o)o+=`
7
7
  `;o+=v[e]}for(let e=0;e<A.length;e++){if(o)o+=`
8
- `;o+=A[e]}if(T.length===0&&_(x.sourceCode)&&(k.some(qn)||!Kn(o)))o+=`${o?`
8
+ `;o+=A[e]}if(T.length===0&&_(x.sourceCode)&&(k.some(Yn)||!Jn(o)))o+=`${o?`
9
9
  `:""}export {};`;return o}
10
10
  export{l};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{p}from"./chunk-v6fwy63g.js";import{createHash as g}from"crypto";import{mkdir as y,readFile as l,stat as m,writeFile as v}from"fs/promises";import{dirname as C,join as o}from"path";var c="1.0.0",b=".dtsx-cache",d="manifest.json";class ai{config;manifest=null;dirty=!1;stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0};constructor(t={}){this.config={enabled:t.enabled??!0,cacheDir:t.cacheDir??b,format:t.format??"json",maxAge:t.maxAge??86400000,force:t.force??!1,validateCache:t.validateCache??!0}}async init(){if(!this.config.enabled)return;try{await y(this.config.cacheDir,{recursive:!0}),await this.loadManifest()}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async loadManifest(){let t=o(this.config.cacheDir,d);try{let e=await l(t,"utf-8");if(this.manifest=JSON.parse(e),this.manifest.version!==c){await this.clear();return}this.stats.totalEntries=Object.keys(this.manifest.entries).length}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async save(){if(!this.config.enabled||!this.manifest||!this.dirty)return;let t=o(this.config.cacheDir,d);this.manifest.updatedAt=Date.now(),await v(t,JSON.stringify(this.manifest,null,2)),this.dirty=!1}async get(t,e){if(!this.config.enabled||!this.manifest||this.config.force)return this.stats.misses++,null;let s=this.manifest.entries[t];if(!s)return this.stats.misses++,null;if(s.configHash!==e)return this.stats.misses++,null;if(Date.now()-s.cachedAt>this.config.maxAge)return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null;if(this.config.validateCache)try{let a=(await m(t)).mtimeMs;if(a!==s.mtime){let i=await l(t,"utf-8");if(this.hashContent(i)!==s.hash)return this.stats.misses++,null;s.mtime=a,this.dirty=!0}}catch{return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null}if(s.dependencies.length>0){if((await Promise.all(s.dependencies.map(async(a)=>{let i=this.manifest.entries[a];if(!i)return!0;try{return(await m(a)).mtimeMs===i.mtime}catch{return!1}}))).some((a)=>!a))return this.stats.misses++,null}return this.stats.hits++,this.stats.timeSavedMs+=50,this.updateHitRatio(),s}async set(t,e,s,r,a,i){if(!this.config.enabled||!this.manifest)return;let n=Date.now();try{n=(await m(t)).mtimeMs}catch{}let h={filePath:t,hash:this.hashContent(e),mtime:n,declarations:s,dtsContent:r,dependencies:a,cachedAt:Date.now(),configHash:i};if(!(t in this.manifest.entries))this.stats.totalEntries++;this.manifest.entries[t]=h,this.dirty=!0}invalidate(t){if(!this.manifest)return;delete this.manifest.entries[t],this.dirty=!0;for(let[e,s]of Object.entries(this.manifest.entries))if(s.dependencies.includes(t))delete this.manifest.entries[e]}async clear(){this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()},this.stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0},this.dirty=!0,await this.save()}getStats(){return{...this.stats}}hashContent(t){return String(p(t))}updateHitRatio(){let t=this.stats.hits+this.stats.misses;this.stats.hitRatio=t>0?this.stats.hits/t:0}static hashConfig(t){let e={outdir:t.outdir,clean:t.clean,tsconfigPath:t.tsconfigPath};return g("sha256").update(JSON.stringify(e)).digest("hex").slice(0,16)}}function wo(t,e){let s=[],r=[],a=[];return{async needsRebuild(i){return await t.get(i,e)===null},async getCachedDeclarations(i){let n=await t.get(i,e);if(n)return r.push(i),n.declarations;return null},async getCachedDts(i){let n=await t.get(i,e);if(n)return n.dtsContent;return null},async cacheResult(i,n,h,u,f=[]){await t.set(i,n,h,u,f,e),s.push(i)},skip(i){a.push(i)},getResult(){return{rebuilt:s,cached:r,skipped:a,stats:t.getStats()}},async save(){await t.save()}}}async function Co(t,e=604800000){let s=t.getStats();if(s.totalEntries>1000)return await t.clear(),s.totalEntries;return 0}function vo(t){let e=[];return e.push("Incremental Build Results:"),e.push(` Rebuilt: ${t.rebuilt.length} files`),e.push(` From cache: ${t.cached.length} files`),e.push(` Skipped: ${t.skipped.length} files`),e.push(""),e.push("Cache Statistics:"),e.push(` Total entries: ${t.stats.totalEntries}`),e.push(` Hit ratio: ${(t.stats.hitRatio*100).toFixed(1)}%`),e.push(` Time saved: ~${t.stats.timeSavedMs}ms`),e.join(`
3
- `)}function So(t,e){let s=[],r=/import\s+(?:type\s+)?(?:.+(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])from\s+)?['"]([^'"]+)['"]/g,a;while((a=r.exec(t))!==null){let i=a[1];if(i.startsWith(".")){let n=o(C(e),i);s.push(n),s.push(`${n}.ts`),s.push(`${n}.tsx`),s.push(o(n,"index.ts")),s.push(o(n,"index.tsx"))}}return s}
4
- export{ai,wo,Co,vo,So};
2
+ import{p}from"./chunk-v6fwy63g.js";import{createHash as g}from"crypto";import{mkdir as y,readFile as l,stat as m,writeFile as v}from"fs/promises";import{dirname as C,join as o}from"path";var c="1.0.0",b=".dtsx-cache",d="manifest.json";class li{config;manifest=null;dirty=!1;stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0};constructor(t={}){this.config={enabled:t.enabled??!0,cacheDir:t.cacheDir??b,format:t.format??"json",maxAge:t.maxAge??86400000,force:t.force??!1,validateCache:t.validateCache??!0}}async init(){if(!this.config.enabled)return;try{await y(this.config.cacheDir,{recursive:!0}),await this.loadManifest()}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async loadManifest(){let t=o(this.config.cacheDir,d);try{let e=await l(t,"utf-8");if(this.manifest=JSON.parse(e),this.manifest.version!==c){await this.clear();return}this.stats.totalEntries=Object.keys(this.manifest.entries).length}catch{this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()}}}async save(){if(!this.config.enabled||!this.manifest||!this.dirty)return;let t=o(this.config.cacheDir,d);this.manifest.updatedAt=Date.now(),await v(t,JSON.stringify(this.manifest,null,2)),this.dirty=!1}async get(t,e){if(!this.config.enabled||!this.manifest||this.config.force)return this.stats.misses++,null;let s=this.manifest.entries[t];if(!s)return this.stats.misses++,null;if(s.configHash!==e)return this.stats.misses++,null;if(Date.now()-s.cachedAt>this.config.maxAge)return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null;if(this.config.validateCache)try{let a=(await m(t)).mtimeMs;if(a!==s.mtime){let i=await l(t,"utf-8");if(this.hashContent(i)!==s.hash)return this.stats.misses++,null;s.mtime=a,this.dirty=!0}}catch{return this.stats.misses++,delete this.manifest.entries[t],this.dirty=!0,null}if(s.dependencies.length>0){if((await Promise.all(s.dependencies.map(async(a)=>{let i=this.manifest.entries[a];if(!i)return!0;try{return(await m(a)).mtimeMs===i.mtime}catch{return!1}}))).some((a)=>!a))return this.stats.misses++,null}return this.stats.hits++,this.stats.timeSavedMs+=50,this.updateHitRatio(),s}async set(t,e,s,r,a,i){if(!this.config.enabled||!this.manifest)return;let n=Date.now();try{n=(await m(t)).mtimeMs}catch{}let h={filePath:t,hash:this.hashContent(e),mtime:n,declarations:s,dtsContent:r,dependencies:a,cachedAt:Date.now(),configHash:i};if(!(t in this.manifest.entries))this.stats.totalEntries++;this.manifest.entries[t]=h,this.dirty=!0}invalidate(t){if(!this.manifest)return;delete this.manifest.entries[t],this.dirty=!0;for(let[e,s]of Object.entries(this.manifest.entries))if(s.dependencies.includes(t))delete this.manifest.entries[e]}async clear(){this.manifest={version:c,entries:{},createdAt:Date.now(),updatedAt:Date.now()},this.stats={totalEntries:0,hits:0,misses:0,hitRatio:0,sizeBytes:0,timeSavedMs:0},this.dirty=!0,await this.save()}getStats(){return{...this.stats}}hashContent(t){return String(p(t))}updateHitRatio(){let t=this.stats.hits+this.stats.misses;this.stats.hitRatio=t>0?this.stats.hits/t:0}static hashConfig(t){let e={outdir:t.outdir,clean:t.clean,tsconfigPath:t.tsconfigPath};return g("sha256").update(JSON.stringify(e)).digest("hex").slice(0,16)}}function So(t,e){let s=[],r=[],a=[];return{async needsRebuild(i){return await t.get(i,e)===null},async getCachedDeclarations(i){let n=await t.get(i,e);if(n)return r.push(i),n.declarations;return null},async getCachedDts(i){let n=await t.get(i,e);if(n)return n.dtsContent;return null},async cacheResult(i,n,h,u,f=[]){await t.set(i,n,h,u,f,e),s.push(i)},skip(i){a.push(i)},getResult(){return{rebuilt:s,cached:r,skipped:a,stats:t.getStats()}},async save(){await t.save()}}}async function $o(t,e=604800000){let s=t.getStats();if(s.totalEntries>1000)return await t.clear(),s.totalEntries;return 0}function Eo(t){let e=[];return e.push("Incremental Build Results:"),e.push(` Rebuilt: ${t.rebuilt.length} files`),e.push(` From cache: ${t.cached.length} files`),e.push(` Skipped: ${t.skipped.length} files`),e.push(""),e.push("Cache Statistics:"),e.push(` Total entries: ${t.stats.totalEntries}`),e.push(` Hit ratio: ${(t.stats.hitRatio*100).toFixed(1)}%`),e.push(` Time saved: ~${t.stats.timeSavedMs}ms`),e.join(`
3
+ `)}function ko(t,e){let s=[],r=/import\s+(?:type\s+)?(?:.+(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF])from\s+)?['"]([^'"]+)['"]/g,a;while((a=r.exec(t))!==null){let i=a[1];if(i.startsWith(".")){let n=o(C(e),i);s.push(n),s.push(`${n}.ts`),s.push(`${n}.tsx`),s.push(o(n,"index.ts")),s.push(o(n,"index.tsx"))}}return s}
4
+ export{li,So,$o,Eo,ko};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var a={debug:0,info:1,warn:2,error:3,silent:4},i="info",u="[dtsx]",L=!1,l=null;function t(o){return a[o]>=a[i]}function d(){if(!L)return"";return`[${new Date().toISOString().slice(11,23)}] `}function v(o,s){let n=d();if(o||n)return[`${n}${o}`,...s];return s}function g(o,s,n){let r=v(s,n);if(l){l(o,...r);return}switch(o){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break}}function c(o){return{debug:(...n)=>{if(t("debug"))g("debug",o,n)},info:(...n)=>{if(t("info"))g("info",o,n)},warn:(...n)=>{if(t("warn"))g("warn",o,n)},error:(...n)=>{if(t("error"))g("error",o,n)},setLevel:(n)=>{i=n},getLevel:()=>i,child:(n)=>{let r=o?`${o}:${n}`:`[${n}]`;return c(r)},time:(n)=>{let r=performance.now();return()=>{let f=performance.now()-r;if(t("debug"))g("debug",o,[`${n}: ${f.toFixed(2)}ms`])}},progress:(n)=>{if(t("info"))if(typeof process<"u"&&process.stdout?.isTTY)process.stdout.write(`\r${o} ${n}`);else g("info",o,[n])}}}function aa(o={}){if(o.level)i=o.level;if(o.prefix!==void 0)u=o.prefix;if(o.timestamps!==void 0)L=o.timestamps;if(o.output)l=o.output;return c(u)}var e=c(u);function ca(o){return e.child(o)}function A(o){i=o}function la(){return i}function ua(o){u=o}function fa(o){L=o}var vi={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},setLevel:()=>{},getLevel:()=>"silent",child:()=>vi,time:()=>()=>{},progress:()=>{}};
3
- export{aa,e,ca,A,la,ua,fa,vi};
2
+ var a={debug:0,info:1,warn:2,error:3,silent:4},i="info",u="[dtsx]",L=!1,l=null;function t(o){return a[o]>=a[i]}function d(){if(!L)return"";return`[${new Date().toISOString().slice(11,23)}] `}function v(o,s){let n=d();if(o||n)return[`${n}${o}`,...s];return s}function g(o,s,n){let r=v(s,n);if(l){l(o,...r);return}switch(o){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break}}function c(o){return{debug:(...n)=>{if(t("debug"))g("debug",o,n)},info:(...n)=>{if(t("info"))g("info",o,n)},warn:(...n)=>{if(t("warn"))g("warn",o,n)},error:(...n)=>{if(t("error"))g("error",o,n)},setLevel:(n)=>{i=n},getLevel:()=>i,child:(n)=>{let r=o?`${o}:${n}`:`[${n}]`;return c(r)},time:(n)=>{let r=performance.now();return()=>{let f=performance.now()-r;if(t("debug"))g("debug",o,[`${n}: ${f.toFixed(2)}ms`])}},progress:(n)=>{if(t("info"))if(typeof process<"u"&&process.stdout?.isTTY)process.stdout.write(`\r${o} ${n}`);else g("info",o,[n])}}}function ua(o={}){if(o.level)i=o.level;if(o.prefix!==void 0)u=o.prefix;if(o.timestamps!==void 0)L=o.timestamps;if(o.output)l=o.output;return c(u)}var e=c(u);function fa(o){return e.child(o)}function A(o){i=o}function da(){return i}function pa(o){u=o}function ma(o){L=o}var Ei={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},setLevel:()=>{},getLevel:()=>"silent",child:()=>Ei,time:()=>()=>{},progress:()=>{}};
3
+ export{ua,e,fa,A,da,pa,ma,Ei};