@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.
- package/LICENSE.md +21 -0
- package/README.md +243 -15
- package/dist/bin/cli.js +10 -22
- package/dist/branded-types.d.ts +150 -0
- package/dist/bundler.d.ts +55 -0
- package/dist/cache.d.ts +43 -0
- package/dist/checker.d.ts +107 -0
- package/dist/chunk-1bav913n.js +6 -0
- package/dist/chunk-2wbhe1k8.js +2 -0
- package/dist/chunk-3d18fhrg.js +3 -0
- package/dist/chunk-3g2v2ns2.js +2 -0
- package/dist/chunk-3j7r0fxz.js +2 -0
- package/dist/chunk-4qpg9xnt.js +3 -0
- package/dist/chunk-57agx6g8.js +3 -0
- package/dist/chunk-5vqtjws2.js +2 -0
- package/dist/chunk-6mwq397e.js +2 -0
- package/dist/chunk-6qv7p9sg.js +170 -0
- package/dist/chunk-6s7n1gt0.js +2 -0
- package/dist/chunk-74j5mydx.js +3 -0
- package/dist/chunk-7cpp6v8f.js +2 -0
- package/dist/chunk-9a6yn7sv.js +75 -0
- package/dist/chunk-axb2kjeq.js +2 -0
- package/dist/chunk-begk3j01.js +33 -0
- package/dist/chunk-cmenkst5.js +3 -0
- package/dist/chunk-d0p3jzwb.js +34 -0
- package/dist/chunk-f18nyrrb.js +32 -0
- package/dist/chunk-fb4c98h2.js +2 -0
- package/dist/chunk-ggmn4a8c.js +4 -0
- package/dist/chunk-hrmnrn4p.js +3 -0
- package/dist/chunk-j0y71ank.js +2 -0
- package/dist/chunk-j6aqdbc4.js +2 -0
- package/dist/chunk-jm5ywn4e.js +13 -0
- package/dist/chunk-knkfbqze.js +2 -0
- package/dist/chunk-n28rjf9h.js +3 -0
- package/dist/chunk-p1d09y82.js +449 -0
- package/dist/chunk-r1m3q3dj.js +2 -0
- package/dist/chunk-r1ywapeb.js +6 -0
- package/dist/chunk-rnt0wkrk.js +23 -0
- package/dist/chunk-rw6j20e2.js +3 -0
- package/dist/chunk-v96rjx7x.js +134 -0
- package/dist/chunk-w9abhtgg.js +22 -0
- package/dist/chunk-wfevdmvd.js +19 -0
- package/dist/chunk-ws2dmfvj.js +2 -0
- package/dist/chunk-xnq1xw73.js +15 -0
- package/dist/chunk-xyctgc6x.js +102 -0
- package/dist/chunk-y3q50bn2.js +2 -0
- package/dist/chunk-ywd4k4hn.js +3 -0
- package/dist/circular.d.ts +82 -0
- package/dist/compat.d.ts +108 -0
- package/dist/config.d.ts +33 -3
- package/dist/diff.d.ts +82 -0
- package/dist/docs.d.ts +97 -0
- package/dist/errors.d.ts +113 -0
- package/dist/extractor/builders.d.ts +38 -0
- package/dist/extractor/cache.d.ts +47 -0
- package/dist/extractor/declarations.d.ts +50 -0
- package/dist/extractor/directives.d.ts +9 -0
- package/dist/extractor/extract.d.ts +10 -0
- package/dist/extractor/hash.d.ts +1 -0
- package/dist/extractor/helpers.d.ts +39 -0
- package/dist/extractor/index.d.ts +70 -0
- package/dist/extractor/scanner.d.ts +6 -0
- package/dist/extractor.d.ts +3 -4
- package/dist/formats.d.ts +50 -0
- package/dist/formatter.d.ts +61 -0
- package/dist/generator.d.ts +12 -3
- package/dist/import-sorter.d.ts +99 -0
- package/dist/incremental.d.ts +84 -0
- package/dist/index.d.ts +54 -1
- package/dist/logger.d.ts +57 -0
- package/dist/lsp.d.ts +317 -0
- package/dist/memory.d.ts +110 -0
- package/dist/merger.d.ts +38 -0
- package/dist/optimizer.d.ts +52 -0
- package/dist/output-normalizer.d.ts +123 -0
- package/dist/parallel-processor.d.ts +63 -0
- package/dist/parser.d.ts +24 -15
- package/dist/plugins/bun.d.ts +58 -0
- package/dist/plugins/esbuild.d.ts +63 -0
- package/dist/plugins/index.d.ts +14 -0
- package/dist/plugins/tsup.d.ts +53 -0
- package/dist/plugins/vite.d.ts +49 -0
- package/dist/plugins/webpack.d.ts +66 -0
- package/dist/plugins.d.ts +83 -0
- package/dist/process-source.d.ts +11 -0
- package/dist/processor/cache.d.ts +16 -0
- package/dist/processor/comments.d.ts +7 -0
- package/dist/processor/declarations.d.ts +37 -0
- package/dist/processor/imports.d.ts +65 -0
- package/dist/processor/index.d.ts +34 -0
- package/dist/processor/type-inference.d.ts +106 -0
- package/dist/processor.d.ts +3 -43
- package/dist/profiling.d.ts +101 -0
- package/dist/security.d.ts +100 -0
- package/dist/sourcemap.d.ts +125 -0
- package/dist/src/index.js +55 -2
- package/dist/src/plugins/bun.js +2 -0
- package/dist/src/plugins/esbuild.js +2 -0
- package/dist/src/plugins/index.js +2 -0
- package/dist/src/plugins/tsup.js +2 -0
- package/dist/src/plugins/vite.js +2 -0
- package/dist/src/plugins/webpack.js +2 -0
- package/dist/tracking.d.ts +89 -0
- package/dist/transformers.d.ts +173 -0
- package/dist/tree-shaker.d.ts +69 -0
- package/dist/type-mappings.d.ts +124 -0
- package/dist/types.d.ts +137 -7
- package/dist/utils.d.ts +53 -1
- package/dist/watcher.d.ts +64 -0
- package/dist/worker.d.ts +84 -0
- package/dist/workspace.d.ts +62 -0
- package/package.json +49 -11
- package/dist/chunk-qsyn1k3w.js +0 -504
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Declaration, DtsGenerationConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Create a worker pool with default configuration
|
|
4
|
+
*/
|
|
5
|
+
export declare function createWorkerPool(config?: WorkerPoolConfig): WorkerPool;
|
|
6
|
+
/**
|
|
7
|
+
* Process files in parallel using a temporary worker pool
|
|
8
|
+
*/
|
|
9
|
+
export declare function parallelProcess(files: Array<{ path: string, content: string }>, config?: Partial<DtsGenerationConfig>, poolConfig?: WorkerPoolConfig): Promise<WorkerResult[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Batch files into chunks for processing
|
|
12
|
+
*/
|
|
13
|
+
export declare function batchFiles<T>(files: T[], batchSize: number): T[][];
|
|
14
|
+
/**
|
|
15
|
+
* Calculate optimal batch size based on file count and CPU cores
|
|
16
|
+
*/
|
|
17
|
+
export declare function calculateOptimalBatchSize(fileCount: number, cpuCount?: number): number;
|
|
18
|
+
/**
|
|
19
|
+
* Worker pool configuration
|
|
20
|
+
*/
|
|
21
|
+
export declare interface WorkerPoolConfig {
|
|
22
|
+
maxWorkers?: number
|
|
23
|
+
taskTimeout?: number
|
|
24
|
+
recycleAfter?: number
|
|
25
|
+
idleTimeout?: number
|
|
26
|
+
initialWorkers?: number
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Task to be processed by a worker
|
|
30
|
+
*/
|
|
31
|
+
export declare interface WorkerTask {
|
|
32
|
+
id: string
|
|
33
|
+
type: 'process' | 'extract' | 'transform' | 'process-batch'
|
|
34
|
+
filePath: string
|
|
35
|
+
sourceCode?: string
|
|
36
|
+
files?: Array<{ filePath: string, sourceCode?: string, outPath?: string }>
|
|
37
|
+
filePaths?: string[]
|
|
38
|
+
sources?: string[]
|
|
39
|
+
outPaths?: string[]
|
|
40
|
+
config: Partial<DtsGenerationConfig>
|
|
41
|
+
writeOutput?: boolean
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Result from a worker task
|
|
45
|
+
*/
|
|
46
|
+
export declare interface WorkerBatchResult {
|
|
47
|
+
filePath: string
|
|
48
|
+
success: boolean
|
|
49
|
+
content?: string
|
|
50
|
+
declarations?: Declaration[]
|
|
51
|
+
error?: string
|
|
52
|
+
}
|
|
53
|
+
export declare interface WorkerResult {
|
|
54
|
+
id: string
|
|
55
|
+
success: boolean
|
|
56
|
+
filePath: string
|
|
57
|
+
content?: string
|
|
58
|
+
declarations?: Declaration[]
|
|
59
|
+
batchResults?: WorkerBatchResult[]
|
|
60
|
+
error?: string
|
|
61
|
+
duration: number
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Worker statistics
|
|
65
|
+
*/
|
|
66
|
+
export declare interface WorkerStats {
|
|
67
|
+
totalTasks: number
|
|
68
|
+
completedTasks: number
|
|
69
|
+
failedTasks: number
|
|
70
|
+
averageDuration: number
|
|
71
|
+
activeWorkers: number
|
|
72
|
+
idleWorkers: number
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Worker pool for parallel processing
|
|
76
|
+
*/
|
|
77
|
+
export declare class WorkerPool {
|
|
78
|
+
constructor(config?: WorkerPoolConfig);
|
|
79
|
+
init(): Promise<void>;
|
|
80
|
+
submit(task: WorkerTask): Promise<WorkerResult>;
|
|
81
|
+
processFiles(files: Array<{ path: string, content: string }>, config?: Partial<DtsGenerationConfig>): Promise<WorkerResult[]>;
|
|
82
|
+
getStats(): WorkerStats;
|
|
83
|
+
shutdown(): Promise<void>;
|
|
84
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { DtsGenerationConfig, GenerationStats } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Discover workspace projects from TypeScript project references
|
|
4
|
+
*/
|
|
5
|
+
export declare function discoverWorkspaceProjects(rootTsConfig: string): Promise<WorkspaceProject[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Sort projects by their dependencies (topological sort)
|
|
8
|
+
* Projects with no dependencies come first
|
|
9
|
+
*/
|
|
10
|
+
export declare function sortProjectsByDependencies(projects: WorkspaceProject[]): WorkspaceProject[];
|
|
11
|
+
/**
|
|
12
|
+
* Generate declarations for all projects in a workspace
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateWorkspace(config: WorkspaceConfig): Promise<WorkspaceGenerationResult>;
|
|
15
|
+
/**
|
|
16
|
+
* Discover and generate declarations for a monorepo
|
|
17
|
+
* Automatically discovers projects from TypeScript project references
|
|
18
|
+
*/
|
|
19
|
+
export declare function generateMonorepo(rootPath: string, options?: Partial<DtsGenerationConfig>): Promise<WorkspaceGenerationResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Parse workspace patterns from package.json workspaces field
|
|
22
|
+
*/
|
|
23
|
+
export declare function discoverWorkspaceFromPackageJson(rootPath: string): Promise<string[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Resolve workspace patterns to actual project paths
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveWorkspacePatterns(rootPath: string, patterns: string[]): Promise<string[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Generate declarations for a workspace defined in package.json
|
|
30
|
+
*/
|
|
31
|
+
export declare function generateFromPackageWorkspaces(rootPath: string, options?: Partial<DtsGenerationConfig>): Promise<WorkspaceGenerationResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Workspace project configuration
|
|
34
|
+
*/
|
|
35
|
+
export declare interface WorkspaceProject {
|
|
36
|
+
name: string
|
|
37
|
+
root: string
|
|
38
|
+
tsconfigPath: string
|
|
39
|
+
references: string[]
|
|
40
|
+
config?: Partial<DtsGenerationConfig>
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Workspace configuration
|
|
44
|
+
*/
|
|
45
|
+
export declare interface WorkspaceConfig {
|
|
46
|
+
root: string
|
|
47
|
+
projects: WorkspaceProject[]
|
|
48
|
+
sharedConfig?: Partial<DtsGenerationConfig>
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Result of workspace generation
|
|
52
|
+
*/
|
|
53
|
+
export declare interface WorkspaceGenerationResult {
|
|
54
|
+
success: boolean
|
|
55
|
+
projects: Array<{
|
|
56
|
+
name: string
|
|
57
|
+
stats: GenerationStats
|
|
58
|
+
success: boolean
|
|
59
|
+
error?: string
|
|
60
|
+
}>
|
|
61
|
+
durationMs: number
|
|
62
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/dtsx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.11",
|
|
5
5
|
"description": "A modern, fast .d.ts generation tool, powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -25,9 +25,35 @@
|
|
|
25
25
|
],
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
28
29
|
"import": "./dist/src/index.js"
|
|
29
30
|
},
|
|
31
|
+
"./vite": {
|
|
32
|
+
"types": "./dist/plugins/vite.d.ts",
|
|
33
|
+
"import": "./dist/src/plugins/vite.js"
|
|
34
|
+
},
|
|
35
|
+
"./bun": {
|
|
36
|
+
"types": "./dist/plugins/bun.d.ts",
|
|
37
|
+
"import": "./dist/src/plugins/bun.js"
|
|
38
|
+
},
|
|
39
|
+
"./esbuild": {
|
|
40
|
+
"types": "./dist/plugins/esbuild.d.ts",
|
|
41
|
+
"import": "./dist/src/plugins/esbuild.js"
|
|
42
|
+
},
|
|
43
|
+
"./tsup": {
|
|
44
|
+
"types": "./dist/plugins/tsup.d.ts",
|
|
45
|
+
"import": "./dist/src/plugins/tsup.js"
|
|
46
|
+
},
|
|
47
|
+
"./webpack": {
|
|
48
|
+
"types": "./dist/plugins/webpack.d.ts",
|
|
49
|
+
"import": "./dist/src/plugins/webpack.js"
|
|
50
|
+
},
|
|
51
|
+
"./plugins": {
|
|
52
|
+
"types": "./dist/plugins/index.d.ts",
|
|
53
|
+
"import": "./dist/src/plugins/index.js"
|
|
54
|
+
},
|
|
30
55
|
"./*": {
|
|
56
|
+
"types": "./dist/*.d.ts",
|
|
31
57
|
"import": "./dist/*"
|
|
32
58
|
}
|
|
33
59
|
},
|
|
@@ -40,16 +66,19 @@
|
|
|
40
66
|
"dist"
|
|
41
67
|
],
|
|
42
68
|
"scripts": {
|
|
69
|
+
"benchmark": "bun run benchmark.ts",
|
|
70
|
+
"benchmark:ci": "bun run benchmark.ts --ci --json",
|
|
71
|
+
"benchmark:quick": "bun run benchmark.ts --quick",
|
|
43
72
|
"build": "bun build.ts && bun run compile",
|
|
44
|
-
"compile": "bun build ./bin/cli.ts --compile --minify --outfile bin/dtsx",
|
|
73
|
+
"compile": "bun build ./bin/cli.ts --compile --minify --format=esm --outfile bin/dtsx",
|
|
45
74
|
"compile:all": "bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:windows-x64 && bun run compile:darwin-x64 && bun run compile:darwin-arm64",
|
|
46
|
-
"compile:linux-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64 --outfile bin/dtsx-linux-x64",
|
|
47
|
-
"compile:linux-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64 --outfile bin/dtsx-linux-arm64",
|
|
48
|
-
"compile:windows-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-windows-x64 --outfile bin/dtsx-windows-x64.exe",
|
|
49
|
-
"compile:darwin-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-x64 --outfile bin/dtsx-darwin-x64",
|
|
50
|
-
"compile:darwin-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile bin/dtsx-darwin-arm64",
|
|
51
|
-
"lint": "bunx --bun
|
|
52
|
-
"lint:fix": "bunx --bun
|
|
75
|
+
"compile:linux-x64": "bun build ./bin/cli.ts --compile --minify --format=esm --target=bun-linux-x64 --outfile bin/dtsx-linux-x64",
|
|
76
|
+
"compile:linux-arm64": "bun build ./bin/cli.ts --compile --minify --format=esm --target=bun-linux-arm64 --outfile bin/dtsx-linux-arm64",
|
|
77
|
+
"compile:windows-x64": "bun build ./bin/cli.ts --compile --minify --format=esm --target=bun-windows-x64 --outfile bin/dtsx-windows-x64.exe",
|
|
78
|
+
"compile:darwin-x64": "bun build ./bin/cli.ts --compile --minify --format=esm --target=bun-darwin-x64 --outfile bin/dtsx-darwin-x64",
|
|
79
|
+
"compile:darwin-arm64": "bun build ./bin/cli.ts --compile --minify --format=esm --target=bun-darwin-arm64 --outfile bin/dtsx-darwin-arm64",
|
|
80
|
+
"lint": "bunx --bun pickier run . --mode lint",
|
|
81
|
+
"lint:fix": "bunx --bun pickier run . --mode lint --fix",
|
|
53
82
|
"fresh": "bunx rimraf node_modules/ bun.lock && bun i",
|
|
54
83
|
"changelog": "bunx changelogen --output CHANGELOG.md",
|
|
55
84
|
"prepublishOnly": "bun --bun run build && bun run compile:all && bun run zip",
|
|
@@ -64,17 +93,26 @@
|
|
|
64
93
|
"zip:darwin-x64": "zip -j bin/dtsx-darwin-x64.zip bin/dtsx-darwin-x64",
|
|
65
94
|
"zip:darwin-arm64": "zip -j bin/dtsx-darwin-arm64.zip bin/dtsx-darwin-arm64"
|
|
66
95
|
},
|
|
96
|
+
"peerDependencies": {
|
|
97
|
+
"typescript": ">=5.9.3"
|
|
98
|
+
},
|
|
99
|
+
"peerDependenciesMeta": {
|
|
100
|
+
"typescript": {
|
|
101
|
+
"optional": false
|
|
102
|
+
}
|
|
103
|
+
},
|
|
67
104
|
"dependencies": {
|
|
68
105
|
"@stacksjs/clapp": "^0.2.0"
|
|
69
106
|
},
|
|
70
107
|
"devDependencies": {
|
|
71
108
|
"bunfig": "^0.15.6",
|
|
72
|
-
"
|
|
109
|
+
"oxc-parser": "^0.112.0",
|
|
110
|
+
"typescript": "^5.9.3"
|
|
73
111
|
},
|
|
74
112
|
"git-hooks": {
|
|
75
113
|
"pre-commit": {
|
|
76
114
|
"staged-lint": {
|
|
77
|
-
"*.{js,ts,json,yaml,yml,md}": "bunx --bun
|
|
115
|
+
"*.{js,ts,json,yaml,yml,md}": "bunx --bun pickier run . --mode lint --fix"
|
|
78
116
|
}
|
|
79
117
|
}
|
|
80
118
|
}
|