@stacksjs/dtsx 0.9.9 → 0.9.10

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 (113) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +243 -15
  3. package/dist/bin/cli.js +10 -22
  4. package/dist/branded-types.d.ts +168 -0
  5. package/dist/bundler.d.ts +55 -0
  6. package/dist/cache.d.ts +43 -0
  7. package/dist/checker.d.ts +107 -0
  8. package/dist/chunk-09zp67d8.js +6 -0
  9. package/dist/chunk-0kmfaaz6.js +2 -0
  10. package/dist/chunk-1mm3t0nr.js +3 -0
  11. package/dist/chunk-2f046tgr.js +2 -0
  12. package/dist/chunk-3g2v2ns2.js +2 -0
  13. package/dist/chunk-3j7r0fxz.js +2 -0
  14. package/dist/chunk-3mxzfgcv.js +75 -0
  15. package/dist/chunk-4ev1n7r7.js +3 -0
  16. package/dist/chunk-57agx6g8.js +3 -0
  17. package/dist/chunk-6ppqaypd.js +2 -0
  18. package/dist/chunk-6qv7p9sg.js +170 -0
  19. package/dist/chunk-6s7n1gt0.js +2 -0
  20. package/dist/chunk-74j5mydx.js +3 -0
  21. package/dist/chunk-7cpp6v8f.js +2 -0
  22. package/dist/chunk-9a3jfxnc.js +3 -0
  23. package/dist/chunk-9mjc7ddv.js +19 -0
  24. package/dist/chunk-axb2kjeq.js +2 -0
  25. package/dist/chunk-bn29kee5.js +102 -0
  26. package/dist/chunk-c18vx9sq.js +2 -0
  27. package/dist/chunk-d0p3jzwb.js +34 -0
  28. package/dist/chunk-dk2vv0np.js +15 -0
  29. package/dist/chunk-e3j9tecw.js +3 -0
  30. package/dist/chunk-f18nyrrb.js +32 -0
  31. package/dist/chunk-fbqcsr60.js +22 -0
  32. package/dist/chunk-ffqpf34b.js +3 -0
  33. package/dist/chunk-fw6wcdfd.js +4 -0
  34. package/dist/chunk-h12gdfk9.js +2 -0
  35. package/dist/chunk-j22v8wfe.js +33 -0
  36. package/dist/chunk-jm5ywn4e.js +13 -0
  37. package/dist/chunk-jvz9t6pq.js +2 -0
  38. package/dist/chunk-k5h5ppp5.js +2 -0
  39. package/dist/chunk-p1d09y82.js +449 -0
  40. package/dist/chunk-pyxbb193.js +2 -0
  41. package/dist/chunk-q75q4w1s.js +3 -0
  42. package/dist/chunk-r1m3q3dj.js +2 -0
  43. package/dist/chunk-r1ywapeb.js +6 -0
  44. package/dist/chunk-rnt0wkrk.js +23 -0
  45. package/dist/chunk-rrkq4k1n.js +2 -0
  46. package/dist/chunk-rw6j20e2.js +3 -0
  47. package/dist/chunk-v96rjx7x.js +134 -0
  48. package/dist/circular.d.ts +82 -0
  49. package/dist/compat.d.ts +108 -0
  50. package/dist/config.d.ts +33 -3
  51. package/dist/diff.d.ts +82 -0
  52. package/dist/docs.d.ts +97 -0
  53. package/dist/errors.d.ts +113 -0
  54. package/dist/extractor/builders.d.ts +38 -0
  55. package/dist/extractor/cache.d.ts +47 -0
  56. package/dist/extractor/declarations.d.ts +50 -0
  57. package/dist/extractor/directives.d.ts +9 -0
  58. package/dist/extractor/extract.d.ts +10 -0
  59. package/dist/extractor/hash.d.ts +1 -0
  60. package/dist/extractor/helpers.d.ts +39 -0
  61. package/dist/extractor/index.d.ts +70 -0
  62. package/dist/extractor/scanner.d.ts +6 -0
  63. package/dist/extractor.d.ts +3 -4
  64. package/dist/formats.d.ts +50 -0
  65. package/dist/formatter.d.ts +61 -0
  66. package/dist/generator.d.ts +12 -3
  67. package/dist/import-sorter.d.ts +99 -0
  68. package/dist/incremental.d.ts +84 -0
  69. package/dist/index.d.ts +54 -1
  70. package/dist/logger.d.ts +57 -0
  71. package/dist/lsp.d.ts +317 -0
  72. package/dist/memory.d.ts +110 -0
  73. package/dist/merger.d.ts +38 -0
  74. package/dist/optimizer.d.ts +52 -0
  75. package/dist/output-normalizer.d.ts +123 -0
  76. package/dist/parallel-processor.d.ts +63 -0
  77. package/dist/parser.d.ts +24 -15
  78. package/dist/plugins/bun.d.ts +58 -0
  79. package/dist/plugins/esbuild.d.ts +63 -0
  80. package/dist/plugins/index.d.ts +14 -0
  81. package/dist/plugins/tsup.d.ts +53 -0
  82. package/dist/plugins/vite.d.ts +49 -0
  83. package/dist/plugins/webpack.d.ts +66 -0
  84. package/dist/plugins.d.ts +83 -0
  85. package/dist/process-source.d.ts +11 -0
  86. package/dist/processor/cache.d.ts +16 -0
  87. package/dist/processor/comments.d.ts +7 -0
  88. package/dist/processor/declarations.d.ts +37 -0
  89. package/dist/processor/imports.d.ts +65 -0
  90. package/dist/processor/index.d.ts +34 -0
  91. package/dist/processor/type-inference.d.ts +106 -0
  92. package/dist/processor.d.ts +3 -43
  93. package/dist/profiling.d.ts +101 -0
  94. package/dist/security.d.ts +100 -0
  95. package/dist/sourcemap.d.ts +125 -0
  96. package/dist/src/index.js +55 -2
  97. package/dist/src/plugins/bun.js +2 -0
  98. package/dist/src/plugins/esbuild.js +2 -0
  99. package/dist/src/plugins/index.js +2 -0
  100. package/dist/src/plugins/tsup.js +2 -0
  101. package/dist/src/plugins/vite.js +2 -0
  102. package/dist/src/plugins/webpack.js +2 -0
  103. package/dist/tracking.d.ts +89 -0
  104. package/dist/transformers.d.ts +173 -0
  105. package/dist/tree-shaker.d.ts +69 -0
  106. package/dist/type-mappings.d.ts +148 -0
  107. package/dist/types.d.ts +137 -7
  108. package/dist/utils.d.ts +53 -1
  109. package/dist/watcher.d.ts +64 -0
  110. package/dist/worker.d.ts +84 -0
  111. package/dist/workspace.d.ts +62 -0
  112. package/package.json +49 -11
  113. package/dist/chunk-qsyn1k3w.js +0 -504
package/dist/lsp.d.ts ADDED
@@ -0,0 +1,317 @@
1
+ /**
2
+ * Start LSP server on stdio
3
+ */
4
+ export declare function startLSPServer(): void;
5
+ /**
6
+ * Create a simple file watcher that emits diagnostics
7
+ */
8
+ export declare function createFileWatcher(server: DtsxLanguageServer, onDiagnostics: (uri: string, diagnostics: Diagnostic[]) => void): (filePath: string) => void;
9
+ /**
10
+ * LSP message types
11
+ */
12
+ export declare interface LSPMessage {
13
+ jsonrpc: '2.0'
14
+ id?: number | string
15
+ method?: string
16
+ params?: unknown
17
+ result?: unknown
18
+ error?: LSPError
19
+ }
20
+ export declare interface LSPError {
21
+ code: number
22
+ message: string
23
+ data?: unknown
24
+ }
25
+ /**
26
+ * LSP initialization params
27
+ */
28
+ export declare interface InitializeParams {
29
+ processId: number | null
30
+ rootUri: string | null
31
+ capabilities: ClientCapabilities
32
+ }
33
+ export declare interface ClientCapabilities {
34
+ textDocument?: {
35
+ synchronization?: {
36
+ dynamicRegistration?: boolean
37
+ willSave?: boolean
38
+ didSave?: boolean
39
+ }
40
+ hover?: {
41
+ dynamicRegistration?: boolean
42
+ contentFormat?: string[]
43
+ }
44
+ completion?: {
45
+ dynamicRegistration?: boolean
46
+ completionItem?: {
47
+ snippetSupport?: boolean
48
+ documentationFormat?: string[]
49
+ }
50
+ }
51
+ definition?: {
52
+ dynamicRegistration?: boolean
53
+ }
54
+ diagnostic?: {
55
+ dynamicRegistration?: boolean
56
+ }
57
+ }
58
+ workspace?: {
59
+ workspaceFolders?: boolean
60
+ configuration?: boolean
61
+ }
62
+ }
63
+ export declare interface ServerCapabilities {
64
+ textDocumentSync?: number
65
+ hoverProvider?: boolean
66
+ completionProvider?: {
67
+ triggerCharacters?: string[]
68
+ resolveProvider?: boolean
69
+ }
70
+ definitionProvider?: boolean
71
+ referencesProvider?: boolean
72
+ renameProvider?: boolean | { prepareProvider?: boolean }
73
+ documentSymbolProvider?: boolean
74
+ workspaceSymbolProvider?: boolean
75
+ codeActionProvider?: boolean | { codeActionKinds?: string[] }
76
+ signatureHelpProvider?: {
77
+ triggerCharacters?: string[]
78
+ retriggerCharacters?: string[]
79
+ }
80
+ documentHighlightProvider?: boolean
81
+ documentFormattingProvider?: boolean
82
+ diagnosticProvider?: {
83
+ interFileDependencies: boolean
84
+ workspaceDiagnostics: boolean
85
+ }
86
+ }
87
+ /**
88
+ * Text document item
89
+ */
90
+ export declare interface TextDocumentItem {
91
+ uri: string
92
+ languageId: string
93
+ version: number
94
+ text: string
95
+ }
96
+ /**
97
+ * Position in a text document
98
+ */
99
+ export declare interface Position {
100
+ line: number
101
+ character: number
102
+ }
103
+ /**
104
+ * Range in a text document
105
+ */
106
+ export declare interface Range {
107
+ start: Position
108
+ end: Position
109
+ }
110
+ /**
111
+ * Diagnostic message
112
+ */
113
+ export declare interface Diagnostic {
114
+ range: Range
115
+ severity?: LspDiagnosticSeverity
116
+ code?: string | number
117
+ source?: string
118
+ message: string
119
+ }
120
+ /**
121
+ * Hover response
122
+ */
123
+ export declare interface Hover {
124
+ contents: string | { kind: string, value: string }
125
+ range?: Range
126
+ }
127
+ /**
128
+ * Location for go-to-definition
129
+ */
130
+ export declare interface Location {
131
+ uri: string
132
+ range: Range
133
+ }
134
+ /**
135
+ * Document symbol
136
+ */
137
+ export declare interface DocumentSymbol {
138
+ name: string
139
+ detail?: string
140
+ kind: SymbolKind
141
+ range: Range
142
+ selectionRange: Range
143
+ children?: DocumentSymbol[]
144
+ }
145
+ /**
146
+ * Workspace symbol
147
+ */
148
+ export declare interface WorkspaceSymbol {
149
+ name: string
150
+ kind: SymbolKind
151
+ location: Location
152
+ containerName?: string
153
+ }
154
+ /**
155
+ * Code action
156
+ */
157
+ export declare interface CodeAction {
158
+ title: string
159
+ kind?: string
160
+ diagnostics?: Diagnostic[]
161
+ isPreferred?: boolean
162
+ edit?: WorkspaceEdit
163
+ command?: Command
164
+ }
165
+ /**
166
+ * Workspace edit
167
+ */
168
+ export declare interface WorkspaceEdit {
169
+ changes?: Record<string, TextEdit[]>
170
+ }
171
+ /**
172
+ * Text edit
173
+ */
174
+ export declare interface TextEdit {
175
+ range: Range
176
+ newText: string
177
+ }
178
+ /**
179
+ * Command
180
+ */
181
+ export declare interface Command {
182
+ title: string
183
+ command: string
184
+ arguments?: unknown[]
185
+ }
186
+ /**
187
+ * Signature help
188
+ */
189
+ export declare interface SignatureHelp {
190
+ signatures: SignatureInformation[]
191
+ activeSignature?: number
192
+ activeParameter?: number
193
+ }
194
+ /**
195
+ * Signature information
196
+ */
197
+ export declare interface SignatureInformation {
198
+ label: string
199
+ documentation?: string | { kind: string, value: string }
200
+ parameters?: ParameterInformation[]
201
+ }
202
+ /**
203
+ * Parameter information
204
+ */
205
+ export declare interface ParameterInformation {
206
+ label: string | [number, number]
207
+ documentation?: string | { kind: string, value: string }
208
+ }
209
+ /**
210
+ * Document highlight
211
+ */
212
+ export declare interface DocumentHighlight {
213
+ range: Range
214
+ kind?: DocumentHighlightKind
215
+ }
216
+ /**
217
+ * LSP Server for dtsx
218
+ */
219
+ export declare class DtsxLanguageServer {
220
+ initialize(params: InitializeParams): { capabilities: ServerCapabilities };
221
+ didOpen(params: { textDocument: TextDocumentItem }): void;
222
+ didChange(params: { textDocument: { uri: string, version: number }, contentChanges: Array<{ text: string }> }): void;
223
+ didClose(params: { textDocument: { uri: string } }): void;
224
+ getDiagnostics(uri: string): Diagnostic[];
225
+ hover(params: { textDocument: { uri: string }, position: Position }): Hover | null;
226
+ completion(params: { textDocument: { uri: string }, position: Position }): Array<{ label: string, kind: number, detail?: string, documentation?: string }>;
227
+ definition(params: { textDocument: { uri: string }, position: Position }): Location | null;
228
+ references(params: { textDocument: { uri: string }, position: Position, context: { includeDeclaration: boolean } }): Location[];
229
+ prepareRename(params: { textDocument: { uri: string }, position: Position }): { range: Range, placeholder: string } | null;
230
+ rename(params: { textDocument: { uri: string }, position: Position, newName: string }): WorkspaceEdit | null;
231
+ documentSymbols(params: { textDocument: { uri: string } }): DocumentSymbol[];
232
+ workspaceSymbols(params: { query: string }): WorkspaceSymbol[];
233
+ codeActions(params: { textDocument: { uri: string }, range: Range, context: { diagnostics: Diagnostic[] } }): CodeAction[];
234
+ signatureHelp(params: { textDocument: { uri: string }, position: Position }): SignatureHelp | null;
235
+ documentHighlight(params: { textDocument: { uri: string }, position: Position }): DocumentHighlight[];
236
+ formatting(params: { textDocument: { uri: string }, options: { tabSize: number, insertSpaces: boolean } }): Promise<TextEdit[]>;
237
+ generateDts(uri: string): string | null;
238
+ handleMessage(message: LSPMessage): LSPMessage | null;
239
+ }
240
+ /**
241
+ * LSP Diagnostic severity (matches LSP specification)
242
+ */
243
+ export declare enum LspDiagnosticSeverity {
244
+ Error = 1,
245
+ Warning = 2,
246
+ Information = 3,
247
+ Hint = 4,
248
+ }
249
+ /**
250
+ * Symbol kind enum (LSP spec)
251
+ */
252
+ export declare enum SymbolKind {
253
+ File = 1,
254
+ Module = 2,
255
+ Namespace = 3,
256
+ Package = 4,
257
+ Class = 5,
258
+ Method = 6,
259
+ Property = 7,
260
+ Field = 8,
261
+ Constructor = 9,
262
+ Enum = 10,
263
+ Interface = 11,
264
+ Function = 12,
265
+ Variable = 13,
266
+ Constant = 14,
267
+ String = 15,
268
+ Number = 16,
269
+ Boolean = 17,
270
+ Array = 18,
271
+ Object = 19,
272
+ Key = 20,
273
+ Null = 21,
274
+ EnumMember = 22,
275
+ Struct = 23,
276
+ Event = 24,
277
+ Operator = 25,
278
+ TypeParameter = 26,
279
+ }
280
+ /**
281
+ * Completion item kind enum
282
+ */
283
+ export declare enum CompletionItemKind {
284
+ Text = 1,
285
+ Method = 2,
286
+ Function = 3,
287
+ Constructor = 4,
288
+ Field = 5,
289
+ Variable = 6,
290
+ Class = 7,
291
+ Interface = 8,
292
+ Module = 9,
293
+ Property = 10,
294
+ Unit = 11,
295
+ Value = 12,
296
+ Enum = 13,
297
+ Keyword = 14,
298
+ Snippet = 15,
299
+ Color = 16,
300
+ File = 17,
301
+ Reference = 18,
302
+ Folder = 19,
303
+ EnumMember = 20,
304
+ Constant = 21,
305
+ Struct = 22,
306
+ Event = 23,
307
+ Operator = 24,
308
+ TypeParameter = 25,
309
+ }
310
+ /**
311
+ * Document highlight kind
312
+ */
313
+ export declare enum DocumentHighlightKind {
314
+ Text = 1,
315
+ Read = 2,
316
+ Write = 3,
317
+ }
@@ -0,0 +1,110 @@
1
+ import type { Declaration, DtsGenerationConfig } from './types';
2
+ /**
3
+ * Create memory-optimized configuration
4
+ */
5
+ export declare function createMemoryOptimizedConfig(baseConfig: DtsGenerationConfig, memoryConfig?: MemoryConfig): DtsGenerationConfig & { memory: Required<MemoryConfig> };
6
+ /**
7
+ * Estimate memory usage for a file
8
+ */
9
+ export declare function estimateMemoryUsage(filePath: string): {
10
+ fileSizeMB: number
11
+ estimatedMemoryMB: number
12
+ recommendedChunkSize: number
13
+ };
14
+ /**
15
+ * Format memory stats for display
16
+ */
17
+ export declare function formatMemoryStats(stats: MemoryStats): string;
18
+ /**
19
+ * Create a streaming processor with default config
20
+ */
21
+ export declare function createStreamingProcessor(config?: MemoryConfig): StreamingProcessor;
22
+ /**
23
+ * Memory configuration options
24
+ */
25
+ export declare interface MemoryConfig {
26
+ maxMemoryMB?: number
27
+ chunkSize?: number
28
+ aggressiveGC?: boolean
29
+ maxDeclarationsInMemory?: number
30
+ profile?: boolean
31
+ cleanupInterval?: number
32
+ }
33
+ /**
34
+ * Memory usage statistics
35
+ */
36
+ export declare interface MemoryStats {
37
+ heapUsed: number
38
+ heapTotal: number
39
+ external: number
40
+ arrayBuffers: number
41
+ rss: number
42
+ heapUsedMB: number
43
+ percentUsed: number
44
+ }
45
+ /**
46
+ * Memory profiling entry
47
+ */
48
+ export declare interface MemoryProfile {
49
+ timestamp: number
50
+ operation: string
51
+ memoryBefore: MemoryStats
52
+ memoryAfter: MemoryStats
53
+ duration: number
54
+ }
55
+ /**
56
+ * Streaming file processor for large files
57
+ */
58
+ export declare class StreamingProcessor {
59
+ constructor(config?: MemoryConfig);
60
+ startMonitoring(): void;
61
+ stopMonitoring(): void;
62
+ triggerCleanup(): void;
63
+ getMemoryStats(): MemoryStats;
64
+ profile<T>(operation: string, fn: () => Promise<T>): Promise<T>;
65
+ getProfiles(): MemoryProfile[];
66
+ clearProfiles(): void;
67
+ *streamFile(filePath: string): AsyncGenerator<string, void, unknown>;
68
+ processFileInChunks<T>(filePath: string, processor: (chunk: string[]) => Promise<T[]>, chunkLines?: number): Promise<T[]>;
69
+ streamWrite(filePath: string, contentGenerator: AsyncGenerator<string>): Promise<void>;
70
+ }
71
+ /**
72
+ * Declaration pool for memory-efficient declaration management
73
+ */
74
+ export declare class DeclarationPool {
75
+ constructor(maxSize?: number);
76
+ add(key: string, declaration: Declaration): void;
77
+ get(key: string): Declaration | undefined;
78
+ has(key: string): boolean;
79
+ delete(key: string): void;
80
+ clear(): void;
81
+ get size(): number;
82
+ }
83
+ /**
84
+ * Lazy loading wrapper for large objects
85
+ */
86
+ export declare class LazyLoader<T> {
87
+ constructor(loader: () => T | Promise<T>);
88
+ get(): Promise<T>;
89
+ isLoaded(): boolean;
90
+ unload(): void;
91
+ }
92
+ /**
93
+ * String interning for memory efficiency
94
+ */
95
+ export declare class StringInterner {
96
+ constructor(maxSize?: number);
97
+ intern(str: string): string;
98
+ get size(): number;
99
+ clear(): void;
100
+ }
101
+ /**
102
+ * Object pool for reusing declaration objects
103
+ */
104
+ export declare class ObjectPool<T> {
105
+ constructor(factory: () => T, reset: (obj: T) => void, maxSize?: number);
106
+ acquire(): T;
107
+ release(obj: T): void;
108
+ get size(): number;
109
+ clear(): void;
110
+ }
@@ -0,0 +1,38 @@
1
+ import type { Declaration } from './types';
2
+ /**
3
+ * Merge declarations with the same name
4
+ */
5
+ export declare function mergeDeclarations(declarations: Declaration[], config?: MergeConfig): MergeResult;
6
+ /**
7
+ * Merge declarations in content string
8
+ */
9
+ export declare function mergeDeclarationsInContent(content: string, _config?: MergeConfig): string;
10
+ /**
11
+ * Merge configuration
12
+ */
13
+ export declare interface MergeConfig {
14
+ mergeInterfaces?: boolean
15
+ mergeNamespaces?: boolean
16
+ mergeTypes?: boolean
17
+ mergeEnums?: boolean
18
+ deduplicateIdentical?: boolean
19
+ conflictStrategy?: 'first' | 'last' | 'error'
20
+ preserveAllComments?: boolean
21
+ }
22
+ /**
23
+ * Result of merge operation
24
+ */
25
+ export declare interface MergeResult {
26
+ declarations: Declaration[]
27
+ mergedCount: number
28
+ merges: MergeDetail[]
29
+ }
30
+ /**
31
+ * Details of a single merge
32
+ */
33
+ export declare interface MergeDetail {
34
+ name: string
35
+ kind: string
36
+ sourceCount: number
37
+ memberCount: number
38
+ }
@@ -0,0 +1,52 @@
1
+ import type { Declaration } from './types';
2
+ /**
3
+ * Optimize declarations
4
+ */
5
+ export declare function optimizeDeclarations(declarations: Declaration[], config?: OptimizerConfig): { declarations: Declaration[], result: OptimizationResult };
6
+ /**
7
+ * Optimize a .d.ts file
8
+ */
9
+ export declare function optimizeFile(filePath: string, config?: OptimizerConfig): Promise<OptimizationResult>;
10
+ /**
11
+ * Minify .d.ts content
12
+ */
13
+ export declare function minifyDts(content: string): string;
14
+ /**
15
+ * Optimizer configuration
16
+ */
17
+ export declare interface OptimizerConfig {
18
+ removeUnusedImports?: boolean
19
+ deduplicateDeclarations?: boolean
20
+ inlineSimpleTypes?: boolean
21
+ removeEmptyInterfaces?: boolean
22
+ mergeInterfaces?: boolean
23
+ sortDeclarations?: boolean
24
+ sortImports?: boolean
25
+ removeComments?: boolean
26
+ minify?: boolean
27
+ treeShake?: boolean
28
+ entryPoints?: string[]
29
+ }
30
+ /**
31
+ * Optimization result
32
+ */
33
+ export declare interface OptimizationResult {
34
+ originalSize: number
35
+ optimizedSize: number
36
+ savings: number
37
+ savingsPercent: number
38
+ removedImports: number
39
+ removedDeclarations: number
40
+ mergedInterfaces: number
41
+ inlinedTypes: number
42
+ }
43
+ /**
44
+ * Type usage tracker for tree shaking
45
+ */
46
+ declare class _TypeUsageTracker {
47
+ addDeclaration(decl: Declaration): void;
48
+ addUsage(typeName: string): void;
49
+ addReference(fromType: string, toType: string): void;
50
+ getReachableTypes(): Set<string>;
51
+ isUsed(typeName: string): boolean;
52
+ }
@@ -0,0 +1,123 @@
1
+ import type { DeclarationKind } from './types';
2
+ /**
3
+ * Normalize output content
4
+ */
5
+ export declare function normalizeOutput(content: string, config?: OutputNormalizerConfig): string;
6
+ /**
7
+ * Normalize line endings
8
+ */
9
+ export declare function normalizeLineEndings(content: string, style: LineEnding): string;
10
+ /**
11
+ * Detect current line ending style
12
+ */
13
+ export declare function detectLineEnding(content: string): LineEnding;
14
+ /**
15
+ * Remove trailing whitespace from all lines
16
+ */
17
+ export declare function removeTrailingWhitespace(content: string): string;
18
+ /**
19
+ * Normalize blank lines (limit consecutive blank lines)
20
+ */
21
+ export declare function normalizeBlankLines(content: string, max: number): string;
22
+ /**
23
+ * Ensure content ends with exactly one newline
24
+ */
25
+ export declare function ensureTrailingNewline(content: string): string;
26
+ /**
27
+ * Normalize indentation
28
+ */
29
+ export declare function normalizeIndent(content: string, config: { style?: 'spaces' | 'tabs', size?: number }): string;
30
+ /**
31
+ * Process and organize imports
32
+ */
33
+ export declare function processImports(content: string, config: ImportGrouping): string;
34
+ /**
35
+ * Order declarations by kind
36
+ */
37
+ export declare function orderDeclarations(content: string, config: DeclarationOrder): string;
38
+ /**
39
+ * Preserve and format comments
40
+ */
41
+ export declare function preserveCommentFormatting(content: string): string;
42
+ /**
43
+ * Create a configured normalizer
44
+ */
45
+ export declare function createOutputNormalizer(config?: OutputNormalizerConfig): {
46
+ normalize: (content: string) => string
47
+ normalizeLineEndings: (content: string) => string
48
+ removeTrailingWhitespace: typeof removeTrailingWhitespace
49
+ normalizeBlankLines: (content: string) => string
50
+ ensureTrailingNewline: typeof ensureTrailingNewline
51
+ processImports: (content: string) => string
52
+ orderDeclarations: (content: string) => string
53
+ };
54
+ /**
55
+ * Default declaration order
56
+ */
57
+ export declare const DEFAULT_DECLARATION_ORDER: DeclarationKind[];
58
+ /**
59
+ * Default import group order
60
+ */
61
+ export declare const DEFAULT_IMPORT_GROUP_ORDER: ImportGroupType[];
62
+ /**
63
+ * Preset configurations
64
+ */
65
+ export declare const normalizerPresets: {
66
+ /** Default preset - LF, trailing newline, basic cleanup */
67
+ default: unknown;
68
+ /** Minimal preset - just line endings and trailing newline */
69
+ minimal: unknown;
70
+ /** Strict preset - all normalization enabled */
71
+ strict: unknown;
72
+ /** Windows preset - CRLF line endings */
73
+ windows: unknown;
74
+ /** Tabs preset - use tabs for indentation */
75
+ tabs: unknown
76
+ };
77
+ /**
78
+ * Declaration ordering configuration
79
+ */
80
+ export declare interface DeclarationOrder {
81
+ kinds?: DeclarationKind[]
82
+ alphabetize?: boolean
83
+ groupExports?: boolean
84
+ }
85
+ /**
86
+ * Import grouping configuration
87
+ */
88
+ export declare interface ImportGrouping {
89
+ enabled?: boolean
90
+ groups?: ImportGroupType[]
91
+ separateGroups?: boolean
92
+ alphabetize?: boolean
93
+ }
94
+ /**
95
+ * Output normalizer configuration
96
+ */
97
+ export declare interface OutputNormalizerConfig {
98
+ lineEnding?: LineEnding
99
+ trailingNewline?: boolean
100
+ maxBlankLines?: number
101
+ trimTrailingWhitespace?: boolean
102
+ normalizeIndentation?: boolean
103
+ indent?: {
104
+ style?: 'spaces' | 'tabs'
105
+ size?: number
106
+ }
107
+ declarationOrder?: DeclarationOrder
108
+ importGrouping?: ImportGrouping
109
+ preserveComments?: boolean
110
+ insertFinalNewline?: boolean
111
+ }
112
+ /**
113
+ * Line ending style
114
+ */
115
+ export type LineEnding = 'lf' | 'crlf' | 'auto';
116
+ export type ImportGroupType = | 'builtin' // node:* modules
117
+ | 'external' // npm packages
118
+ | 'scoped' // @org/* packages
119
+ | 'internal' // @/* or ~/* aliases
120
+ | 'parent' // ../* imports
121
+ | 'sibling' // ./* imports
122
+ | 'index' // . or ./index
123
+ | 'type' // import type;
@@ -0,0 +1,63 @@
1
+ import type { DtsGenerationConfig } from './types';
2
+ /**
3
+ * Build dependency graph from source files
4
+ */
5
+ export declare function buildProcessingGraph(files: string[], rootDir?: string): Promise<Map<string, ProcessingNode>>;
6
+ /**
7
+ * Process files in parallel respecting dependencies
8
+ */
9
+ export declare function processInParallel(files: string[], options?: ParallelProcessorConfig): Promise<ParallelProcessingResult>;
10
+ /**
11
+ * Get topological processing order (respects dependencies)
12
+ */
13
+ export declare function getTopologicalOrder(graph: Map<string, ProcessingNode>): string[];
14
+ /**
15
+ * Find files that can be processed independently (no dependencies on other files in the set)
16
+ */
17
+ export declare function findIndependentFiles(graph: Map<string, ProcessingNode>): string[];
18
+ /**
19
+ * Get processing levels (files at same level can be processed in parallel)
20
+ */
21
+ export declare function getProcessingLevels(graph: Map<string, ProcessingNode>): string[][];
22
+ /**
23
+ * Analyze graph for parallelization potential
24
+ */
25
+ export declare function analyzeParallelizationPotential(graph: Map<string, ProcessingNode>): {
26
+ totalFiles: number
27
+ independentFiles: number
28
+ maxParallelism: number
29
+ levels: number
30
+ estimatedSpeedup: number
31
+ };
32
+ /**
33
+ * Node in the processing dependency graph
34
+ */
35
+ export declare interface ProcessingNode {
36
+ path: string
37
+ dependencies: Set<string>
38
+ dependents: Set<string>
39
+ state: 'pending' | 'processing' | 'completed' | 'failed'
40
+ result?: string
41
+ error?: Error
42
+ duration?: number
43
+ }
44
+ /**
45
+ * Configuration for parallel processing
46
+ */
47
+ export declare interface ParallelProcessorConfig {
48
+ maxConcurrency?: number
49
+ rootDir?: string
50
+ config?: Partial<DtsGenerationConfig>
51
+ onProgress?: (completed: number, total: number, current: string) => void
52
+ onError?: (path: string, error: Error) => boolean
53
+ }
54
+ /**
55
+ * Result of parallel processing
56
+ */
57
+ export declare interface ParallelProcessingResult {
58
+ success: Map<string, string>
59
+ failed: Map<string, Error>
60
+ totalTimeMs: number
61
+ maxConcurrent: number
62
+ processingOrder: string[]
63
+ }