@stacksjs/dtsx 0.9.9 → 0.9.11

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 +150 -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-1bav913n.js +6 -0
  9. package/dist/chunk-2wbhe1k8.js +2 -0
  10. package/dist/chunk-3d18fhrg.js +3 -0
  11. package/dist/chunk-3g2v2ns2.js +2 -0
  12. package/dist/chunk-3j7r0fxz.js +2 -0
  13. package/dist/chunk-4qpg9xnt.js +3 -0
  14. package/dist/chunk-57agx6g8.js +3 -0
  15. package/dist/chunk-5vqtjws2.js +2 -0
  16. package/dist/chunk-6mwq397e.js +2 -0
  17. package/dist/chunk-6qv7p9sg.js +170 -0
  18. package/dist/chunk-6s7n1gt0.js +2 -0
  19. package/dist/chunk-74j5mydx.js +3 -0
  20. package/dist/chunk-7cpp6v8f.js +2 -0
  21. package/dist/chunk-9a6yn7sv.js +75 -0
  22. package/dist/chunk-axb2kjeq.js +2 -0
  23. package/dist/chunk-begk3j01.js +33 -0
  24. package/dist/chunk-cmenkst5.js +3 -0
  25. package/dist/chunk-d0p3jzwb.js +34 -0
  26. package/dist/chunk-f18nyrrb.js +32 -0
  27. package/dist/chunk-fb4c98h2.js +2 -0
  28. package/dist/chunk-ggmn4a8c.js +4 -0
  29. package/dist/chunk-hrmnrn4p.js +3 -0
  30. package/dist/chunk-j0y71ank.js +2 -0
  31. package/dist/chunk-j6aqdbc4.js +2 -0
  32. package/dist/chunk-jm5ywn4e.js +13 -0
  33. package/dist/chunk-knkfbqze.js +2 -0
  34. package/dist/chunk-n28rjf9h.js +3 -0
  35. package/dist/chunk-p1d09y82.js +449 -0
  36. package/dist/chunk-r1m3q3dj.js +2 -0
  37. package/dist/chunk-r1ywapeb.js +6 -0
  38. package/dist/chunk-rnt0wkrk.js +23 -0
  39. package/dist/chunk-rw6j20e2.js +3 -0
  40. package/dist/chunk-v96rjx7x.js +134 -0
  41. package/dist/chunk-w9abhtgg.js +22 -0
  42. package/dist/chunk-wfevdmvd.js +19 -0
  43. package/dist/chunk-ws2dmfvj.js +2 -0
  44. package/dist/chunk-xnq1xw73.js +15 -0
  45. package/dist/chunk-xyctgc6x.js +102 -0
  46. package/dist/chunk-y3q50bn2.js +2 -0
  47. package/dist/chunk-ywd4k4hn.js +3 -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 +124 -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
@@ -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
+ }
package/dist/parser.d.ts CHANGED
@@ -1,38 +1,33 @@
1
1
  /**
2
- * Remove leading comments from a declaration
2
+ * @deprecated Use TypeScript AST-based extraction instead
3
3
  */
4
- /* eslint-disable regexp/no-super-linear-backtracking */
5
4
  export declare function removeLeadingComments(text: string): string;
6
5
  /**
7
- * Extract leading comments from source code before a position
6
+ * @deprecated Use extractJSDocComments from extractor/helpers instead
8
7
  */
9
8
  export declare function extractLeadingComments(source: string, position: number): string[];
10
9
  /**
11
- * Extract trailing comments from a line
10
+ * @deprecated Not commonly used - use inline logic instead
12
11
  */
13
12
  export declare function extractTrailingComment(line: string): string | null;
14
13
  /**
15
- * Format comments for output
16
- */
17
- export declare function formatComments(comments: string[]): string[];
18
- /**
19
- * Extract balanced content between symbols (e.g., <>, (), {})
14
+ * @deprecated Use findMatchingBracket from processor/type-inference instead
20
15
  */
21
16
  export declare function extractBalancedSymbols(text: string, openSymbol: string, closeSymbol: string): { content: string, rest: string } | null;
22
17
  /**
23
- * Parse a function declaration
18
+ * @deprecated Use TypeScript AST-based extraction instead
24
19
  */
25
20
  export declare function parseFunctionDeclaration(text: string): FunctionSignature | null;
26
21
  /**
27
- * Check if a line is an export statement
22
+ * @deprecated Use hasExportModifier from extractor/helpers instead
28
23
  */
29
24
  export declare function isExportStatement(line: string): boolean;
30
25
  /**
31
- * Check if a line is a type-only export
26
+ * @deprecated Not commonly used
32
27
  */
33
28
  export declare function isTypeOnlyExport(line: string): boolean;
34
29
  /**
35
- * Extract variable name and type from declaration
30
+ * @deprecated Use TypeScript AST-based extraction instead
36
31
  */
37
32
  export declare function parseVariableDeclaration(text: string): {
38
33
  name: string
@@ -41,7 +36,7 @@ export declare function parseVariableDeclaration(text: string): {
41
36
  value?: string
42
37
  } | null;
43
38
  /**
44
- * Extract function signature parts
39
+ * @deprecated Interface kept for backward compatibility
45
40
  */
46
41
  export declare interface FunctionSignature {
47
42
  name: string
@@ -49,4 +44,18 @@ export declare interface FunctionSignature {
49
44
  parameters: string
50
45
  returnType: string
51
46
  modifiers: string[]
52
- }
47
+ }
48
+ /**
49
+ * Parser utilities - DEPRECATED
50
+ *
51
+ * This module contains legacy string-based parsing utilities.
52
+ * Most functionality has been superseded by TypeScript AST-based extraction
53
+ * in the extractor module.
54
+ *
55
+ * @deprecated Use extractor module for AST-based extraction and
56
+ * processor/type-inference for type inference utilities.
57
+ */
58
+ export { extractJSDocComments as extractLeadingCommentsFromNode, getNodeText } from './extractor/helpers';
59
+ export { formatComments } from './processor/comments';
60
+ // Re-export commonly used utilities from their new locations
61
+ export { findMatchingBracket } from './processor/type-inference';
@@ -0,0 +1,58 @@
1
+ import type { DtsGenerationConfig, GenerationStats } from '../types';
2
+ /**
3
+ * Create a Bun build plugin for dtsx
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * // build.ts
8
+ * import { dts } from '@stacksjs/dtsx/plugins/bun'
9
+ *
10
+ * await Bun.build({
11
+ * entrypoints: ['./src/index.ts'],
12
+ * outdir: './dist',
13
+ * plugins: [
14
+ * dts({
15
+ * root: './src',
16
+ * outdir: './dist',
17
+ * }),
18
+ * ],
19
+ * })
20
+ * ```
21
+ */
22
+ export declare function dts(options?: BunPluginOptions): BunPlugin;
23
+ /**
24
+ * Alias for dts
25
+ */
26
+ export declare const bunDts: typeof dts;
27
+ /**
28
+ * Bun plugin options
29
+ */
30
+ export declare interface BunPluginOptions extends Partial<DtsGenerationConfig> {
31
+ preBuild?: boolean
32
+ postBuild?: boolean
33
+ onGenerated?: (stats: GenerationStats) => void
34
+ onError?: (error: Error) => void
35
+ }
36
+ /**
37
+ * Bun plugin interface
38
+ */
39
+ declare interface BunPlugin {
40
+ name: string
41
+ setup: (build: BunBuild) => void | Promise<void>
42
+ }
43
+ /**
44
+ * Bun build interface (minimal type)
45
+ */
46
+ declare interface BunBuild {
47
+ onStart: (callback: () => void | Promise<void>) => void
48
+ onLoad: (options: { filter: RegExp }, callback: (args: { path: string }) => unknown) => void
49
+ config: {
50
+ entrypoints: string[]
51
+ outdir?: string
52
+ root?: string
53
+ }
54
+ }
55
+ /**
56
+ * Default export
57
+ */
58
+ export default dts;
@@ -0,0 +1,63 @@
1
+ import type { DtsGenerationConfig, GenerationStats } from '../types';
2
+ /**
3
+ * Create an esbuild plugin for dtsx
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * // build.ts
8
+ * import { dtsx } from '@stacksjs/dtsx/plugins/esbuild'
9
+ * import * as esbuild from 'esbuild'
10
+ *
11
+ * await esbuild.build({
12
+ * entryPoints: ['./src/index.ts'],
13
+ * outdir: './dist',
14
+ * plugins: [
15
+ * dtsx({
16
+ * root: './src',
17
+ * outdir: './dist',
18
+ * }),
19
+ * ],
20
+ * })
21
+ * ```
22
+ */
23
+ export declare function dtsx(options?: EsbuildPluginOptions): EsbuildPlugin;
24
+ /**
25
+ * Alias for dtsx
26
+ */
27
+ export declare const esbuildDts: typeof dtsx;
28
+ /**
29
+ * Alias matching common naming convention
30
+ */
31
+ export declare const dts: typeof dtsx;
32
+ /**
33
+ * esbuild plugin options
34
+ */
35
+ export declare interface EsbuildPluginOptions extends Partial<DtsGenerationConfig> {
36
+ onStart?: boolean
37
+ onEnd?: boolean
38
+ onGenerated?: (stats: GenerationStats) => void
39
+ onError?: (error: Error) => void
40
+ }
41
+ /**
42
+ * esbuild plugin interface
43
+ */
44
+ declare interface EsbuildPlugin {
45
+ name: string
46
+ setup: (build: EsbuildBuild) => void | Promise<void>
47
+ }
48
+ /**
49
+ * esbuild build interface (minimal type)
50
+ */
51
+ declare interface EsbuildBuild {
52
+ onStart: (callback: () => { errors?: Array<{ text: string }> } | Promise<{ errors?: Array<{ text: string }> } | void> | void) => void
53
+ onEnd: (callback: (result: { errors: unknown[] }) => void | Promise<void>) => void
54
+ initialOptions: {
55
+ entryPoints?: string[] | Record<string, string>
56
+ outdir?: string
57
+ outfile?: string
58
+ }
59
+ }
60
+ /**
61
+ * Default export
62
+ */
63
+ export default dtsx;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Build tool plugins for dtsx
3
+ * Re-exports all available build tool integrations
4
+ */
5
+ // Vite
6
+ export { dts as viteDts, dts as vite, type VitePluginOptions } from './vite';
7
+ // Bun
8
+ export { dts as bunDts, dts as bun, type BunPluginOptions } from './bun';
9
+ // esbuild
10
+ export { dtsx as esbuildDts, dtsx as esbuild, dts as esbuildPlugin, type EsbuildPluginOptions } from './esbuild';
11
+ // tsup
12
+ export { dtsxPlugin as tsupDts, dtsxPlugin as tsup, dts as tsupPlugin, type TsupPluginOptions } from './tsup';
13
+ // webpack
14
+ export { DtsxWebpackPlugin, dtsxWebpack as webpackDts, dts as webpackPlugin, type WebpackPluginOptions } from './webpack';
@@ -0,0 +1,53 @@
1
+ import type { DtsGenerationConfig, GenerationStats } from '../types';
2
+ /**
3
+ * Create a tsup plugin for dtsx
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * // tsup.config.ts
8
+ * import { dtsxPlugin } from '@stacksjs/dtsx/plugins/tsup'
9
+ * import { defineConfig } from 'tsup'
10
+ *
11
+ * export default defineConfig({
12
+ * entry: ['./src/index.ts'],
13
+ * outDir: './dist',
14
+ * plugins: [
15
+ * dtsxPlugin({
16
+ * root: './src',
17
+ * outdir: './dist',
18
+ * }),
19
+ * ],
20
+ * })
21
+ * ```
22
+ */
23
+ export declare function dtsxPlugin(options?: TsupPluginOptions): TsupPlugin;
24
+ /**
25
+ * Alias for dtsxPlugin
26
+ */
27
+ export declare const tsupDts: typeof dtsxPlugin;
28
+ /**
29
+ * Alias matching common naming convention
30
+ */
31
+ export declare const dts: typeof dtsxPlugin;
32
+ /**
33
+ * tsup plugin options
34
+ */
35
+ export declare interface TsupPluginOptions extends Partial<DtsGenerationConfig> {
36
+ onBuildStart?: boolean
37
+ onBuildEnd?: boolean
38
+ onGenerated?: (stats: GenerationStats) => void
39
+ onError?: (error: Error) => void
40
+ }
41
+ /**
42
+ * tsup plugin interface
43
+ */
44
+ declare interface TsupPlugin {
45
+ name: string
46
+ buildStart?: () => void | Promise<void>
47
+ buildEnd?: (ctx: { writtenFiles: Array<{ name: string, size: number }> }) => void | Promise<void>
48
+ esbuildOptions?: (options: Record<string, unknown>) => void
49
+ }
50
+ /**
51
+ * Default export
52
+ */
53
+ export default dtsxPlugin;