@dtsx/dtsx 0.0.0-stage → 0.11.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +442 -2
  3. package/dist/bin/cli.d.ts +1 -0
  4. package/dist/bin/cli.js +12 -0
  5. package/dist/chunk-082w7zvy.js +4 -0
  6. package/dist/chunk-0k0fhq13.js +19 -0
  7. package/dist/chunk-0rmbc5zp.js +3 -0
  8. package/dist/chunk-0yg5mcrf.js +3 -0
  9. package/dist/chunk-0zfzhn19.js +31 -0
  10. package/dist/chunk-189nn4fc.js +3 -0
  11. package/dist/chunk-1j6092xz.js +7 -0
  12. package/dist/chunk-1qtghb2x.js +3 -0
  13. package/dist/chunk-2436cnmb.js +3 -0
  14. package/dist/chunk-2qd3axyx.js +5 -0
  15. package/dist/chunk-32qexm3w.js +3 -0
  16. package/dist/chunk-3fbt79hx.js +3 -0
  17. package/dist/chunk-3t57mzvf.js +3 -0
  18. package/dist/chunk-42j9cfte.js +3 -0
  19. package/dist/chunk-4fygcxtb.js +4 -0
  20. package/dist/chunk-50h54rax.js +177 -0
  21. package/dist/chunk-5hyv43ps.js +12 -0
  22. package/dist/chunk-6yvk3q1e.js +3 -0
  23. package/dist/chunk-73dzve1s.js +3 -0
  24. package/dist/chunk-7tremqhs.js +14 -0
  25. package/dist/chunk-83qnrx0m.js +7 -0
  26. package/dist/chunk-88gwzbew.js +4 -0
  27. package/dist/chunk-8d3sdkv4.js +24 -0
  28. package/dist/chunk-8tzd98q8.js +22 -0
  29. package/dist/chunk-96atbsd3.js +3 -0
  30. package/dist/chunk-9gts9ymh.js +3 -0
  31. package/dist/chunk-9menejdz.js +3 -0
  32. package/dist/chunk-a7nvyxpg.js +6 -0
  33. package/dist/chunk-ag1b6d30.js +3 -0
  34. package/dist/chunk-asws39qs.js +31 -0
  35. package/dist/chunk-bnry23ve.js +4 -0
  36. package/dist/chunk-bxc2herz.js +9 -0
  37. package/dist/chunk-cpmqa8kd.js +4 -0
  38. package/dist/chunk-cv29b4zb.js +7 -0
  39. package/dist/chunk-cyr45de1.js +8 -0
  40. package/dist/chunk-d0bazr3p.js +3 -0
  41. package/dist/chunk-danfamyx.js +3 -0
  42. package/dist/chunk-davy89dj.js +8 -0
  43. package/dist/chunk-e29rp5xj.js +7 -0
  44. package/dist/chunk-eba562w8.js +9 -0
  45. package/dist/chunk-ebjafajx.js +62 -0
  46. package/dist/chunk-ft2zk7jx.js +3 -0
  47. package/dist/chunk-g2120ysy.js +3 -0
  48. package/dist/chunk-ghfd34r7.js +3 -0
  49. package/dist/chunk-gspsxc9d.js +34 -0
  50. package/dist/chunk-h3n6256r.js +3 -0
  51. package/dist/chunk-hnqm1zb3.js +5 -0
  52. package/dist/chunk-htgy94y3.js +2 -0
  53. package/dist/chunk-hv8bx8xx.js +102 -0
  54. package/dist/chunk-hzn9kmq7.js +3 -0
  55. package/dist/chunk-ja7bp731.js +3 -0
  56. package/dist/chunk-jcckwgb9.js +3 -0
  57. package/dist/chunk-kfk554fj.js +3 -0
  58. package/dist/chunk-kkshxyex.js +18 -0
  59. package/dist/chunk-kpbz61yy.js +4 -0
  60. package/dist/chunk-mkakbjvs.js +3 -0
  61. package/dist/chunk-mwyjxjqa.js +3 -0
  62. package/dist/chunk-p023fhce.js +8 -0
  63. package/dist/chunk-p9vfxn8g.js +3 -0
  64. package/dist/chunk-pga5m4wm.js +3 -0
  65. package/dist/chunk-pjqzkgzk.js +6 -0
  66. package/dist/chunk-qzjzw9p2.js +3 -0
  67. package/dist/chunk-rbx6q1r0.js +18 -0
  68. package/dist/chunk-rkstz4w1.js +6 -0
  69. package/dist/chunk-rz060wxt.js +6 -0
  70. package/dist/chunk-sd8bywh9.js +21 -0
  71. package/dist/chunk-sv8h007a.js +3 -0
  72. package/dist/chunk-t4va49p3.js +10 -0
  73. package/dist/chunk-tka2m4af.js +7 -0
  74. package/dist/chunk-v6fwy63g.js +3 -0
  75. package/dist/chunk-v93389xm.js +3 -0
  76. package/dist/chunk-vf3ybe5r.js +3 -0
  77. package/dist/chunk-vkahj2ab.js +10 -0
  78. package/dist/chunk-wnqg6hem.js +27 -0
  79. package/dist/chunk-xa6rsd4b.js +29 -0
  80. package/dist/chunk-xfjfhe9d.js +3 -0
  81. package/dist/chunk-xwpn40p0.js +6 -0
  82. package/dist/chunk-y1g6v96c.js +10 -0
  83. package/dist/chunk-y5k0szq6.js +3 -0
  84. package/dist/chunk-yay68832.js +3 -0
  85. package/dist/chunk-yrv6z221.js +3 -0
  86. package/dist/chunk-yx1jy7fx.js +37 -0
  87. package/dist/chunk-zgcdx773.js +4 -0
  88. package/dist/chunk-zk3w5sqv.js +4 -0
  89. package/dist/chunk-zq93f8ca.js +5 -0
  90. package/dist/src/augmentation-graph.d.ts +11 -0
  91. package/dist/src/augmentation-graph.js +2 -0
  92. package/dist/src/binding-patterns.d.ts +18 -0
  93. package/dist/src/binding-patterns.js +2 -0
  94. package/dist/src/branded-types.d.ts +159 -0
  95. package/dist/src/branded-types.js +2 -0
  96. package/dist/src/bundle-linker.d.ts +38 -0
  97. package/dist/src/bundle-linker.js +2 -0
  98. package/dist/src/bundler.d.ts +55 -0
  99. package/dist/src/bundler.js +2 -0
  100. package/dist/src/cache.d.ts +53 -0
  101. package/dist/src/cache.js +2 -0
  102. package/dist/src/call-signatures.d.ts +1 -0
  103. package/dist/src/call-signatures.js +2 -0
  104. package/dist/src/checker.d.ts +107 -0
  105. package/dist/src/circular.d.ts +82 -0
  106. package/dist/src/circular.js +2 -0
  107. package/dist/src/compat.d.ts +114 -0
  108. package/dist/src/compat.js +2 -0
  109. package/dist/src/computed-keys.d.ts +12 -0
  110. package/dist/src/computed-keys.js +2 -0
  111. package/dist/src/concurrency.d.ts +4 -0
  112. package/dist/src/concurrency.js +2 -0
  113. package/dist/src/config.d.ts +35 -0
  114. package/dist/src/config.js +2 -0
  115. package/dist/src/dangling-refs.d.ts +11 -0
  116. package/dist/src/dangling-refs.js +2 -0
  117. package/dist/src/declaration-project.d.ts +33 -0
  118. package/dist/src/declaration-project.js +2 -0
  119. package/dist/src/declaration-publication.d.ts +15 -0
  120. package/dist/src/declaration-publication.js +2 -0
  121. package/dist/src/declaration-references.d.ts +19 -0
  122. package/dist/src/declaration-references.js +2 -0
  123. package/dist/src/diff.d.ts +82 -0
  124. package/dist/src/diff.js +2 -0
  125. package/dist/src/docs.d.ts +97 -0
  126. package/dist/src/docs.js +2 -0
  127. package/dist/src/enum-declarations.d.ts +6 -0
  128. package/dist/src/enum-declarations.js +2 -0
  129. package/dist/src/errors.d.ts +113 -0
  130. package/dist/src/errors.js +2 -0
  131. package/dist/src/extractor/directives.d.ts +5 -0
  132. package/dist/src/extractor/directives.js +2 -0
  133. package/dist/src/extractor/extract.d.ts +10 -0
  134. package/dist/src/extractor/extract.js +2 -0
  135. package/dist/src/extractor/hash.d.ts +1 -0
  136. package/dist/src/extractor/hash.js +2 -0
  137. package/dist/src/extractor/scanner.d.ts +32 -0
  138. package/dist/src/extractor/scanner.js +2 -0
  139. package/dist/src/extractor.d.ts +5 -0
  140. package/dist/src/extractor.js +2 -0
  141. package/dist/src/formats.d.ts +50 -0
  142. package/dist/src/formats.js +2 -0
  143. package/dist/src/formatter.d.ts +61 -0
  144. package/dist/src/formatter.js +2 -0
  145. package/dist/src/function-properties.d.ts +3 -0
  146. package/dist/src/function-properties.js +2 -0
  147. package/dist/src/generator.d.ts +18 -0
  148. package/dist/src/generator.js +2 -0
  149. package/dist/src/global-types.d.ts +17 -0
  150. package/dist/src/global-types.js +2 -0
  151. package/dist/src/import-sorter.d.ts +99 -0
  152. package/dist/src/import-sorter.js +2 -0
  153. package/dist/src/incremental.d.ts +103 -0
  154. package/dist/src/incremental.js +2 -0
  155. package/dist/src/index.d.ts +62 -0
  156. package/dist/src/index.js +2 -0
  157. package/dist/src/inferred-imports.d.ts +4 -0
  158. package/dist/src/inferred-imports.js +2 -0
  159. package/dist/src/json-config.d.ts +2 -0
  160. package/dist/src/json-config.js +2 -0
  161. package/dist/src/lexical.d.ts +6 -0
  162. package/dist/src/lexical.js +2 -0
  163. package/dist/src/logger.d.ts +57 -0
  164. package/dist/src/logger.js +2 -0
  165. package/dist/src/lsp.d.ts +333 -0
  166. package/dist/src/lsp.js +2 -0
  167. package/dist/src/memory.d.ts +127 -0
  168. package/dist/src/memory.js +2 -0
  169. package/dist/src/merger.d.ts +38 -0
  170. package/dist/src/merger.js +2 -0
  171. package/dist/src/module-graph.d.ts +70 -0
  172. package/dist/src/module-graph.js +2 -0
  173. package/dist/src/module-references.d.ts +30 -0
  174. package/dist/src/module-references.js +2 -0
  175. package/dist/src/native-checker.d.ts +55 -0
  176. package/dist/src/native-checker.js +2 -0
  177. package/dist/src/native-engine.d.ts +16 -0
  178. package/dist/src/native-engine.js +2 -0
  179. package/dist/src/native-extractor.d.ts +9 -0
  180. package/dist/src/native-extractor.js +2 -0
  181. package/dist/src/native-generation.d.ts +20 -0
  182. package/dist/src/native-generation.js +2 -0
  183. package/dist/src/native-project.d.ts +35 -0
  184. package/dist/src/native-project.js +2 -0
  185. package/dist/src/optimizer.d.ts +56 -0
  186. package/dist/src/optimizer.js +2 -0
  187. package/dist/src/output-normalizer.d.ts +123 -0
  188. package/dist/src/output-normalizer.js +2 -0
  189. package/dist/src/parallel-processor.d.ts +63 -0
  190. package/dist/src/parallel-processor.js +2 -0
  191. package/dist/src/parameters.d.ts +5 -0
  192. package/dist/src/parameters.js +2 -0
  193. package/dist/src/parser.d.ts +68 -0
  194. package/dist/src/parser.js +2 -0
  195. package/dist/src/plugins/bun.d.ts +58 -0
  196. package/dist/src/plugins/bun.js +2 -0
  197. package/dist/src/plugins/esbuild.d.ts +63 -0
  198. package/dist/src/plugins/esbuild.js +2 -0
  199. package/dist/src/plugins/index.d.ts +16 -0
  200. package/dist/src/plugins/index.js +2 -0
  201. package/dist/src/plugins/tsdown.d.ts +30 -0
  202. package/dist/src/plugins/tsdown.js +2 -0
  203. package/dist/src/plugins/tsup.d.ts +53 -0
  204. package/dist/src/plugins/tsup.js +2 -0
  205. package/dist/src/plugins/vite.d.ts +49 -0
  206. package/dist/src/plugins/vite.js +2 -0
  207. package/dist/src/plugins/webpack.d.ts +69 -0
  208. package/dist/src/plugins/webpack.js +2 -0
  209. package/dist/src/plugins.d.ts +88 -0
  210. package/dist/src/plugins.js +2 -0
  211. package/dist/src/process-source.d.ts +28 -0
  212. package/dist/src/process-source.js +2 -0
  213. package/dist/src/processor/cache.d.ts +18 -0
  214. package/dist/src/processor/cache.js +2 -0
  215. package/dist/src/processor/comments.d.ts +9 -0
  216. package/dist/src/processor/comments.js +2 -0
  217. package/dist/src/processor/declarations.d.ts +37 -0
  218. package/dist/src/processor/declarations.js +2 -0
  219. package/dist/src/processor/import-usage.d.ts +6 -0
  220. package/dist/src/processor/import-usage.js +2 -0
  221. package/dist/src/processor/imports.d.ts +68 -0
  222. package/dist/src/processor/imports.js +2 -0
  223. package/dist/src/processor/index.d.ts +33 -0
  224. package/dist/src/processor/index.js +2 -0
  225. package/dist/src/processor/type-inference.d.ts +116 -0
  226. package/dist/src/processor/type-inference.js +2 -0
  227. package/dist/src/processor.d.ts +5 -0
  228. package/dist/src/processor.js +2 -0
  229. package/dist/src/profiling.d.ts +114 -0
  230. package/dist/src/profiling.js +2 -0
  231. package/dist/src/return-type-scope.d.ts +3 -0
  232. package/dist/src/return-type-scope.js +2 -0
  233. package/dist/src/security.d.ts +100 -0
  234. package/dist/src/security.js +2 -0
  235. package/dist/src/source-cache.d.ts +16 -0
  236. package/dist/src/source-cache.js +2 -0
  237. package/dist/src/sourcemap.d.ts +137 -0
  238. package/dist/src/sourcemap.js +2 -0
  239. package/dist/src/stx.d.ts +20 -0
  240. package/dist/src/stx.js +2 -0
  241. package/dist/src/syntax-validator.d.ts +7 -0
  242. package/dist/src/syntax-validator.js +2 -0
  243. package/dist/src/tracking.d.ts +95 -0
  244. package/dist/src/tracking.js +2 -0
  245. package/dist/src/transformers.d.ts +188 -0
  246. package/dist/src/transformers.js +2 -0
  247. package/dist/src/tree-shaker.d.ts +69 -0
  248. package/dist/src/tree-shaker.js +2 -0
  249. package/dist/src/tsconfig.d.ts +8 -0
  250. package/dist/src/tsconfig.js +2 -0
  251. package/dist/src/type-mappings.d.ts +145 -0
  252. package/dist/src/type-mappings.js +2 -0
  253. package/dist/src/types.d.ts +230 -0
  254. package/dist/src/types.js +1 -0
  255. package/dist/src/utils.d.ts +63 -0
  256. package/dist/src/utils.js +2 -0
  257. package/dist/src/value-inference.d.ts +6 -0
  258. package/dist/src/value-inference.js +2 -0
  259. package/dist/src/vue.d.ts +108 -0
  260. package/dist/src/vue.js +2 -0
  261. package/dist/src/watcher.d.ts +64 -0
  262. package/dist/src/watcher.js +2 -0
  263. package/dist/src/worker-thread.d.ts +1 -0
  264. package/dist/src/worker-thread.js +2 -0
  265. package/dist/src/worker.d.ts +98 -0
  266. package/dist/src/worker.js +2 -0
  267. package/dist/src/workspace.d.ts +62 -0
  268. package/dist/src/workspace.js +2 -0
  269. package/native/README.md +6 -0
  270. package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
  271. package/native/darwin-x64/libzig-dtsx.dylib +0 -0
  272. package/native/freebsd-x64/libzig-dtsx.so +0 -0
  273. package/native/linux-arm64/libzig-dtsx.so +0 -0
  274. package/native/linux-x64/libzig-dtsx.so +0 -0
  275. package/native/windows-x64/zig-dtsx.dll +0 -0
  276. package/package.json +120 -4
@@ -0,0 +1,188 @@
1
+ import type { Declaration, DeclarationKind, ParameterDeclaration } from './types.js';
2
+ import type { Plugin } from './plugins.js';
3
+ /**
4
+ * Create a new declaration with defaults
5
+ */
6
+ export declare function createDeclaration(kind: DeclarationKind, name: string, text: string, options?: Partial<Omit<Declaration, 'kind' | 'name' | 'text'>>): Declaration;
7
+ /**
8
+ * Clone a declaration (deep copy).
9
+ * Uses the structured-clone algorithm where available — typically 3-5× faster
10
+ * than the JSON round-trip and correctly preserves nested arrays / Sets.
11
+ * Falls back to JSON for environments without structuredClone.
12
+ */
13
+ export declare function cloneDeclaration(decl: Declaration): Declaration;
14
+ /**
15
+ * Walk declarations with a visitor
16
+ */
17
+ export declare function walkDeclarations(declarations: Declaration[], visitor: DeclarationVisitor, parent?: Declaration | null): void;
18
+ /**
19
+ * Find declarations matching a predicate
20
+ */
21
+ export declare function findDeclarations(declarations: Declaration[], predicate: (decl: Declaration) => boolean): Declaration[];
22
+ /**
23
+ * Map declarations with a transformer
24
+ */
25
+ export declare function mapDeclarations(declarations: Declaration[], transformer: Transformer, context: Omit<TransformerContext, 'index' | 'total' | 'allDeclarations'>): Promise<Declaration[]>;
26
+ /**
27
+ * Compose multiple transformers into one
28
+ */
29
+ export declare function composeTransformers(...transformers: Transformer[]): Transformer;
30
+ /**
31
+ * Create a transformer that only applies to specific declaration kinds
32
+ */
33
+ export declare function filterByKind(kinds: DeclarationKind | DeclarationKind[], transformer: Transformer): Transformer;
34
+ /**
35
+ * Create a transformer that only applies when a predicate is true
36
+ */
37
+ export declare function filterByPredicate(predicate: (decl: Declaration) => boolean, transformer: Transformer): Transformer;
38
+ /**
39
+ * Create a transformer plugin from transformers
40
+ */
41
+ export declare function createTransformerPlugin(options: {
42
+ name: string
43
+ version?: string
44
+ description?: string
45
+
46
+ beforeParse?: TextTransformer
47
+
48
+ transform?: Transformer
49
+
50
+ afterGenerate?: TextTransformer
51
+ }): Plugin;
52
+ /**
53
+ * Rename declarations matching a pattern
54
+ */
55
+ export declare function createRenameTransformer(pattern: string | RegExp, replacement: string | ((_match: string, _decl: Declaration) => string)): Transformer;
56
+ /**
57
+ * Add a prefix to declaration names
58
+ */
59
+ export declare function createPrefixTransformer(prefix: string, filter?: (decl: Declaration) => boolean): Transformer;
60
+ /**
61
+ * Add a suffix to declaration names
62
+ */
63
+ export declare function createSuffixTransformer(suffix: string, filter?: (decl: Declaration) => boolean): Transformer;
64
+ /**
65
+ * Remove declarations by name pattern
66
+ */
67
+ export declare function createRemoveTransformer(pattern: string | RegExp | ((_decl: Declaration) => boolean)): Transformer;
68
+ /**
69
+ * Add JSDoc comments to declarations
70
+ */
71
+ export declare function createJSDocTransformer(getJSDoc: (decl: Declaration) => string | string[] | null | undefined): Transformer;
72
+ /**
73
+ * Modify type annotations
74
+ */
75
+ export declare function createTypeTransformer(transformer: (type: string, decl: Declaration) => string | null | undefined): Transformer;
76
+ /**
77
+ * Modify return types of functions
78
+ */
79
+ export declare function createReturnTypeTransformer(transformer: (returnType: string, decl: Declaration) => string | null | undefined): Transformer;
80
+ /**
81
+ * Transform function parameters
82
+ */
83
+ export declare function createParameterTransformer(transformer: (
84
+ params: ParameterDeclaration[],
85
+ decl: Declaration,
86
+ ) => ParameterDeclaration[] | null | undefined): Transformer;
87
+ /**
88
+ * Add modifiers (export, declare, etc.)
89
+ */
90
+ export declare function createModifierTransformer(modifier: string, filter?: (decl: Declaration) => boolean): Transformer;
91
+ /**
92
+ * Strip specific JSDoc tags
93
+ */
94
+ export declare function createStripTagsTransformer(tags: string[]): Transformer;
95
+ /**
96
+ * Wrap types in a utility type
97
+ */
98
+ export declare function createWrapTypeTransformer(utilityType: string, filter?: (decl: Declaration) => boolean): Transformer;
99
+ /**
100
+ * Plugin that prefixes all exported types with a namespace
101
+ */
102
+ export declare function createNamespacePrefixPlugin(namespace: string): Plugin;
103
+ /**
104
+ * Make all declarations readonly (for interfaces/types)
105
+ */
106
+ export declare const readonlyTransformer: Transformer;
107
+ /**
108
+ * Make all optional properties required
109
+ */
110
+ export declare const requiredTransformer: Transformer;
111
+ /**
112
+ * Make all required properties optional
113
+ */
114
+ export declare const optionalTransformer: Transformer;
115
+ /**
116
+ * Plugin that makes all interface properties readonly
117
+ */
118
+ export declare const readonlyPlugin: Plugin;
119
+ /**
120
+ * Plugin that strips @internal, @private, and @hidden tags
121
+ */
122
+ export declare const stripPrivatePlugin: Plugin;
123
+ /**
124
+ * Plugin that adds 'declare' keyword to all declarations
125
+ */
126
+ export declare const declarePlugin: Plugin;
127
+ /**
128
+ * Context available to transformers
129
+ */
130
+ export declare interface TransformerContext {
131
+ filePath: string
132
+ sourceCode: string
133
+ index: number
134
+ total: number
135
+ allDeclarations: readonly Declaration[]
136
+ createDeclaration: typeof createDeclaration
137
+ cloneDeclaration: typeof cloneDeclaration
138
+ modifyText: (decl: Declaration, text: string) => Declaration
139
+ addModifier: (decl: Declaration, modifier: string) => Declaration
140
+ removeModifier: (decl: Declaration, modifier: string) => Declaration
141
+ }
142
+ /**
143
+ * Context for text transformers
144
+ */
145
+ export declare interface TextTransformerContext {
146
+ filePath: string
147
+ phase: 'before' | 'after'
148
+ }
149
+ /**
150
+ * Visitor pattern for walking declaration trees
151
+ */
152
+ export declare interface DeclarationVisitor {
153
+ enter?: (decl: Declaration, parent: Declaration | null) => void
154
+ leave?: (decl: Declaration, parent: Declaration | null) => void
155
+ function?: (_decl: Declaration, _parent: Declaration | null) => void
156
+ variable?: (decl: Declaration, parent: Declaration | null) => void
157
+ interface?: (decl: Declaration, parent: Declaration | null) => void
158
+ type?: (decl: Declaration, parent: Declaration | null) => void
159
+ class?: (decl: Declaration, parent: Declaration | null) => void
160
+ enum?: (decl: Declaration, parent: Declaration | null) => void
161
+ import?: (decl: Declaration, parent: Declaration | null) => void
162
+ export?: (decl: Declaration, parent: Declaration | null) => void
163
+ module?: (decl: Declaration, parent: Declaration | null) => void
164
+ namespace?: (decl: Declaration, parent: Declaration | null) => void
165
+ unknown?: (decl: Declaration, parent: Declaration | null) => void
166
+ }
167
+ /**
168
+ * Result of a transformer, can be:
169
+ * - Declaration: replaced declaration
170
+ * - Declaration[]: multiple declarations (split)
171
+ * - null: remove the declaration
172
+ * - undefined: no change
173
+ */
174
+ export type TransformResult = Declaration | Declaration[] | null | undefined;
175
+ /**
176
+ * Transformer function that operates on a single declaration
177
+ */
178
+ export type Transformer = (
179
+ declaration: Declaration,
180
+ context: TransformerContext,
181
+ ) => TransformResult | Promise<TransformResult>;
182
+ /**
183
+ * Text transformer operates on the raw text before/after processing
184
+ */
185
+ export type TextTransformer = (
186
+ content: string,
187
+ context: TextTransformerContext,
188
+ ) => string | Promise<string>;
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ci,li,Cn,vo,ui,So,ge,$o,He,Eo,fi,ko,di,To,Ao,Po,Do,pi,mi,Ro,Mo,Oo,Io,Fo,Lo,No,Bo}from"../chunk-kpbz61yy.js";import"../chunk-bxc2herz.js";export{li as cloneDeclaration,So as composeTransformers,ci as createDeclaration,To as createJSDocTransformer,pi as createModifierTransformer,Bo as createNamespacePrefixPlugin,Do as createParameterTransformer,fi as createPrefixTransformer,di as createRemoveTransformer,Eo as createRenameTransformer,Po as createReturnTypeTransformer,Oo as createStripTagsTransformer,ko as createSuffixTransformer,He as createTransformerPlugin,Ao as createTypeTransformer,Io as createWrapTypeTransformer,No as declarePlugin,ge as filterByKind,$o as filterByPredicate,vo as findDeclarations,ui as mapDeclarations,Mo as optionalTransformer,Fo as readonlyPlugin,mi as readonlyTransformer,Ro as requiredTransformer,Lo as stripPrivatePlugin,Cn as walkDeclarations};
@@ -0,0 +1,69 @@
1
+ import type { Declaration, DeclarationKind } from './types.js';
2
+ /**
3
+ * Shake unused declarations from the tree
4
+ */
5
+ export declare function treeShake(declarations: Declaration[], config?: TreeShakeConfig): TreeShakeResult;
6
+ /**
7
+ * Build a declaration dependency graph for tree shaking
8
+ */
9
+ export declare function buildDeclarationDependencyGraph(declarations: Declaration[]): Map<string, Set<string>>;
10
+ /**
11
+ * Extract type references from a declaration
12
+ */
13
+ export declare function extractTypeReferences(decl: Declaration): Set<string>;
14
+ /**
15
+ * Tree shake content string
16
+ */
17
+ export declare function treeShakeContent(content: string, config?: TreeShakeConfig): { content: string, removed: string[] };
18
+ /**
19
+ * Get unused declarations (those that could be removed)
20
+ */
21
+ export declare function findUnusedDeclarations(declarations: Declaration[], config?: Omit<TreeShakeConfig, 'debug'>): string[];
22
+ /**
23
+ * Analyze dependencies for a declaration
24
+ */
25
+ export declare function analyzeDependencies(declarationName: string, declarations: Declaration[]): {
26
+ directDependencies: string[]
27
+ transitiveDependencies: string[]
28
+ dependents: string[]
29
+ };
30
+ /**
31
+ * Create a tree shaker with preset configuration
32
+ */
33
+ export declare function createTreeShaker(config?: TreeShakeConfig): {
34
+ shake: (declarations: Declaration[]) => TreeShakeResult
35
+ shakeContent: (content: string) => { content: string, removed: string[] }
36
+ findUnused: (declarations: Declaration[]) => string[]
37
+ analyzeDependencies: (name: string, declarations: Declaration[]) => { directDependencies: string[], transitiveDependencies: string[], dependents: string[] }
38
+ buildGraph: typeof buildDeclarationDependencyGraph
39
+ extractRefs: typeof extractTypeReferences
40
+ };
41
+ /**
42
+ * Tree shaking configuration
43
+ */
44
+ export declare interface TreeShakeConfig {
45
+ entryPoints?: string[]
46
+ keepExported?: boolean
47
+ keep?: (string | RegExp)[]
48
+ remove?: (string | RegExp)[]
49
+ shakableKinds?: DeclarationKind[]
50
+ debug?: boolean
51
+ }
52
+ /**
53
+ * Result of tree shaking
54
+ */
55
+ export declare interface TreeShakeResult {
56
+ declarations: Declaration[]
57
+ removed: string[]
58
+ dependencyGraph: Map<string, Set<string>>
59
+ stats: TreeShakeStats
60
+ }
61
+ /**
62
+ * Tree shaking statistics
63
+ */
64
+ export declare interface TreeShakeStats {
65
+ totalBefore: number
66
+ totalAfter: number
67
+ removedCount: number
68
+ reductionPercent: number
69
+ }
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{rt,it,st,tr,nr,rr,ji}from"../chunk-eba562w8.js";export{rr as analyzeDependencies,it as buildDeclarationDependencyGraph,ji as createTreeShaker,st as extractTypeReferences,nr as findUnusedDeclarations,rt as treeShake,tr as treeShakeContent};
@@ -0,0 +1,8 @@
1
+ /** Read the shared generation options across a JSONC tsconfig hierarchy. */
2
+ export declare function readEffectiveTsconfig(path: string, readOptions?: { allowCircular?: boolean }, ancestors?: Set<string>): Promise<EffectiveTsconfig | undefined>;
3
+ export declare interface EffectiveTsconfig {
4
+ isolatedDeclarations?: boolean
5
+ baseUrl?: string
6
+ paths?: Record<string, string[]>
7
+ pathsBasePath?: string
8
+ }
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{X}from"../chunk-qzjzw9p2.js";import"../chunk-cpmqa8kd.js";export{X as readEffectiveTsconfig};
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Get preset mappings
3
+ */
4
+ export declare function getPresetMappings(preset: TypeMappingPreset): TypeMappingRule[];
5
+ /**
6
+ * Create a type mapper with configuration
7
+ */
8
+ export declare function createTypeMapper(config?: TypeMappingConfig): TypeMapper;
9
+ /**
10
+ * Apply type mappings to declaration text
11
+ */
12
+ export declare function applyTypeMappings(declarationText: string, mapper: TypeMapper, context?: Partial<TypeMappingContext>): string;
13
+ /**
14
+ * Default type mappings for common patterns
15
+ */
16
+ export declare const defaultTypeMappings: TypeMappingRule[];
17
+ /**
18
+ * Strict mode mappings - converts unsafe types
19
+ */
20
+ export declare const strictTypeMappings: TypeMappingRule[];
21
+ /**
22
+ * Readonly mappings - adds immutability
23
+ */
24
+ export declare const readonlyTypeMappings: TypeMappingRule[];
25
+ /**
26
+ * Simplified mappings - reduces complexity
27
+ */
28
+ export declare const simplifiedTypeMappings: TypeMappingRule[];
29
+ /**
30
+ * Default type mapper instance
31
+ */
32
+ export declare const defaultTypeMapper: TypeMapper;
33
+ /**
34
+ * Strict type mapper instance
35
+ */
36
+ export declare const strictTypeMapper: TypeMapper;
37
+ /**
38
+ * Built-in type transformers
39
+ * @defaultValue
40
+ * ```ts
41
+ * {
42
+ * makeReadonly: (type: string) => string,
43
+ * makeNullable: (type: string) => string,
44
+ * makeOptional: (type: string) => string,
45
+ * makeRequired: (type: string) => string,
46
+ * promisify: (type: string) => string,
47
+ * unpromisify: (type: string) => string,
48
+ * arrayify: (type: string) => string,
49
+ * unarrayify: (type: string) => string
50
+ * }
51
+ * ```
52
+ */
53
+ export declare const TypeTransformers: {
54
+ /**
55
+ * Make all types readonly
56
+ */
57
+ makeReadonly: (type: string) => string;
58
+ /**
59
+ * Make type nullable
60
+ */
61
+ makeNullable: (type: string) => string;
62
+ /**
63
+ * Make type optional (add undefined)
64
+ */
65
+ makeOptional: (type: string) => string;
66
+ /**
67
+ * Remove null/undefined from type
68
+ */
69
+ makeRequired: (type: string) => string;
70
+ /**
71
+ * Wrap in Promise
72
+ */
73
+ promisify: (type: string) => string;
74
+ /**
75
+ * Unwrap Promise
76
+ */
77
+ unpromisify: (type: string) => string;
78
+ /**
79
+ * Convert to array type
80
+ */
81
+ arrayify: (type: string) => string;
82
+ /**
83
+ * Unwrap array type
84
+ */
85
+ unarrayify: (type: string) => string
86
+ };
87
+ /**
88
+ * Custom type mappings for DTS generation
89
+ * Allows users to specify type replacements and transformations
90
+ */
91
+ /**
92
+ * Type mapping rule
93
+ */
94
+ export declare interface TypeMappingRule {
95
+ pattern: string | RegExp
96
+ replacement: string
97
+ condition?: (context: TypeMappingContext) => boolean
98
+ global?: boolean
99
+ priority?: number
100
+ }
101
+ /**
102
+ * Context passed to type mapping functions
103
+ */
104
+ export declare interface TypeMappingContext {
105
+ type: string
106
+ declarationName?: string
107
+ declarationKind?: string
108
+ filePath?: string
109
+ isReturnType?: boolean
110
+ isParameterType?: boolean
111
+ isPropertyType?: boolean
112
+ }
113
+ /**
114
+ * Type mapping configuration
115
+ */
116
+ export declare interface TypeMappingConfig {
117
+ rules: TypeMappingRule[]
118
+ presets?: TypeMappingPreset[]
119
+ includeDefaults?: boolean
120
+ cacheKey?: string
121
+ }
122
+ /**
123
+ * Available type mapping presets
124
+ */
125
+ export type TypeMappingPreset = | 'strict' // Convert 'any' to 'unknown'
126
+ | 'readonly' // Add readonly to array types
127
+ | 'nullable' // Convert undefined unions to optional
128
+ | 'branded' // Use branded types for primitives
129
+ | 'simplified' // Simplify complex utility types;
130
+ /**
131
+ * Type mapper class for applying transformations
132
+ */
133
+ export declare class TypeMapper {
134
+ private rules;
135
+ private compiled;
136
+ private cache;
137
+ constructor(config?: TypeMappingConfig);
138
+ private recompile;
139
+ map(type: string, context?: Partial<TypeMappingContext>): string;
140
+ mapAll(types: string[], context?: Partial<TypeMappingContext>): string[];
141
+ addRule(rule: TypeMappingRule): void;
142
+ removeRules(pattern: string | RegExp): number;
143
+ clearCache(): void;
144
+ getRules(): readonly TypeMappingRule[];
145
+ }
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ri,ii,si,oi,ai,yn,K,wo,xo,wt,Co}from"../chunk-0yg5mcrf.js";export{yn as TypeMapper,Co as TypeTransformers,wt as applyTypeMappings,K as createTypeMapper,wo as defaultTypeMapper,ri as defaultTypeMappings,ai as getPresetMappings,si as readonlyTypeMappings,oi as simplifiedTypeMappings,xo as strictTypeMapper,ii as strictTypeMappings};
@@ -0,0 +1,230 @@
1
+ /**
2
+ * DtsGenerationConfig
3
+ *
4
+ * This is the configuration object for the DTS generation process.
5
+ */
6
+ export declare interface DtsGenerationConfig {
7
+ cwd: string
8
+ root: string
9
+ entrypoints: string[]
10
+ outdir: string
11
+ keepComments: boolean
12
+ clean: boolean
13
+ tsconfigPath: string
14
+ verbose: boolean | string[]
15
+ outputStructure?: 'mirror' | 'flat'
16
+ moduleSpecifierMode?: 'preserve' | 'node'
17
+ importOrder?: string[]
18
+ dryRun?: boolean
19
+ stats?: boolean
20
+ continueOnError?: boolean
21
+ logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent'
22
+ exclude?: string[]
23
+ outputFormat?: 'text' | 'json'
24
+ progress?: boolean
25
+ diff?: boolean
26
+ validate?: boolean
27
+ watch?: boolean
28
+ parallel?: boolean
29
+ concurrency?: number
30
+ declarationMap?: boolean
31
+ plugins?: import('./plugins.js').Plugin[]
32
+ bundle?: boolean
33
+ bundleOutput?: string
34
+ autoIncludeReExports?: boolean
35
+ failOnUnresolvedReExport?: boolean
36
+ incremental?: boolean
37
+ cacheDir?: string
38
+ clearCache?: boolean
39
+ indentStyle?: 'spaces' | 'tabs'
40
+ indentSize?: number
41
+ prettier?: boolean
42
+ include?: string[]
43
+ isolatedDeclarations?: boolean
44
+ typeMappings?: import('./type-mappings.js').TypeMappingConfig
45
+ lineEnding?: 'lf' | 'crlf' | 'auto'
46
+ normalizeOutput?: boolean
47
+ declarationOrder?: {
48
+ kinds?: import('./types.js').DeclarationKind[]
49
+ alphabetize?: boolean
50
+ groupExports?: boolean
51
+ }
52
+ tracking?: TrackingConfig
53
+ profiling?: ProfilingConfig
54
+ typeInference?: TypeInferenceConfig
55
+ typeChecking?: TypeCheckingConfig
56
+ typeValidation?: TypeValidationConfig
57
+ }
58
+ /**
59
+ * Tracking configuration for debugging type and import usage
60
+ */
61
+ export declare interface TrackingConfig {
62
+ types?: boolean
63
+ relationships?: boolean
64
+ usage?: boolean
65
+ imports?: boolean
66
+ importUsage?: boolean
67
+ importRelationships?: boolean
68
+ }
69
+ /**
70
+ * Profiling configuration for performance analysis
71
+ */
72
+ export declare interface ProfilingConfig {
73
+ memory?: boolean
74
+ memoryLimit?: number
75
+ cpu?: boolean
76
+ samplingInterval?: number
77
+ io?: boolean
78
+ trackOperations?: ('read' | 'write')[]
79
+ outputFile?: string
80
+ }
81
+ /**
82
+ * Type inference configuration
83
+ */
84
+ export declare interface TypeInferenceConfig {
85
+ enabled?: boolean
86
+ strictness?: 'loose' | 'normal' | 'strict'
87
+ inferReturnTypes?: boolean
88
+ inferConstTypes?: boolean
89
+ }
90
+ /**
91
+ * Type checking configuration
92
+ */
93
+ export declare interface TypeCheckingConfig {
94
+ enabled?: boolean
95
+ strictness?: 'loose' | 'normal' | 'strict'
96
+ warningsAsErrors?: boolean
97
+ maxErrors?: number
98
+ }
99
+ /**
100
+ * Type validation configuration
101
+ */
102
+ export declare interface TypeValidationConfig {
103
+ enabled?: boolean
104
+ rules?: {
105
+ noAny?: boolean
106
+ noUnknown?: boolean
107
+ noImplicitAny?: boolean
108
+ explicitReturnTypes?: boolean
109
+ explicitParameterTypes?: boolean
110
+ }
111
+ }
112
+ /**
113
+ * Source location for error reporting
114
+ */
115
+ export declare interface SourceLocation {
116
+ line: number
117
+ column: number
118
+ offset?: number
119
+ }
120
+ /**
121
+ * Detailed error information with source location
122
+ */
123
+ export declare interface DtsError {
124
+ file: string
125
+ message: string
126
+ code?: string
127
+ location?: SourceLocation
128
+ stack?: string
129
+ suggestion?: string
130
+ }
131
+ /**
132
+ * Generation statistics
133
+ */
134
+ export declare interface GenerationStats {
135
+ generationMode: 'isolated' | 'semantic'
136
+ filesProcessed: number
137
+ filesGenerated: number
138
+ filesFailed: number
139
+ filesValidated: number
140
+ validationErrors: number
141
+ declarationsFound: number
142
+ importsProcessed: number
143
+ exportsProcessed: number
144
+ durationMs: number
145
+ errors: DtsError[]
146
+ }
147
+ /**
148
+ * Declaration
149
+ *
150
+ * Represents a parsed declaration from TypeScript source
151
+ */
152
+ export declare interface Declaration {
153
+ kind: DeclarationKind
154
+ name: string
155
+ text: string
156
+ leadingComments?: string[]
157
+ isExported: boolean
158
+ isDefault?: boolean
159
+ typeAnnotation?: string
160
+ inferredType?: string
161
+ computedKeyConstants?: import('./computed-keys.js').KeyConstants
162
+ inferenceError?: 'DTSX_UNSUPPORTED_VALUE_FLOW'
163
+ moduleForm?: 'namespace' | 'identifier' | 'quoted' | 'global'
164
+ modifiers?: string[]
165
+ generics?: string
166
+ extends?: string
167
+ implements?: string[]
168
+ members?: Declaration[]
169
+ parameters?: ParameterDeclaration[]
170
+ returnType?: string
171
+ value?: unknown
172
+ initializerStart?: number
173
+ source?: string
174
+ specifiers?: ImportSpecifier[]
175
+ isTypeOnly?: boolean
176
+ isSideEffect?: boolean
177
+ isAsync?: boolean
178
+ isGenerator?: boolean
179
+ overloads?: string[]
180
+ start?: number
181
+ end?: number
182
+ }
183
+ /**
184
+ * ParameterDeclaration
185
+ */
186
+ export declare interface ParameterDeclaration {
187
+ name: string
188
+ type?: string
189
+ optional?: boolean
190
+ rest?: boolean
191
+ defaultValue?: string
192
+ }
193
+ /**
194
+ * ImportSpecifier
195
+ */
196
+ export declare interface ImportSpecifier {
197
+ name: string
198
+ alias?: string
199
+ isType?: boolean
200
+ }
201
+ /**
202
+ * ProcessingContext
203
+ *
204
+ * Context passed through processing pipeline
205
+ */
206
+ export declare interface ProcessingContext {
207
+ filePath: string
208
+ sourceCode: string
209
+ declarations: Declaration[]
210
+ imports?: Map<string, Set<string>>
211
+ exports?: Set<string>
212
+ usedTypes?: Set<string>
213
+ augmentationImports?: ReadonlySet<string>
214
+ }
215
+ /**
216
+ * DtsGenerationOption
217
+ *
218
+ * This is the configuration object for the DTS generation process.
219
+ */
220
+ export type DtsGenerationOption = Partial<DtsGenerationConfig>;
221
+ /**
222
+ * DtsGenerationOptions
223
+ *
224
+ * This is the configuration object for the DTS generation process.
225
+ */
226
+ export type DtsGenerationOptions = DtsGenerationOption | DtsGenerationOption[];
227
+ /**
228
+ * Declaration kind - all possible declaration types
229
+ */
230
+ export type DeclarationKind = 'function' | 'variable' | 'interface' | 'type' | 'class' | 'enum' | 'import' | 'export' | 'module' | 'namespace' | 'unknown';
@@ -0,0 +1 @@
1
+ // @bun