@dtsx/dtsx 0.0.0-stage → 0.11.37
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 +442 -2
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +12 -0
- package/dist/chunk-0azm93j9.js +31 -0
- package/dist/chunk-0ke9xh7t.js +4 -0
- package/dist/chunk-1bpv3tck.js +10 -0
- package/dist/chunk-1e10w914.js +18 -0
- package/dist/chunk-1h6ycqza.js +6 -0
- package/dist/chunk-1j6092xz.js +7 -0
- package/dist/chunk-1pz7zxhc.js +3 -0
- package/dist/chunk-25vyhfzh.js +3 -0
- package/dist/chunk-2kwjbk55.js +3 -0
- package/dist/chunk-437g8zz6.js +177 -0
- package/dist/chunk-4f2mwn7p.js +5 -0
- package/dist/chunk-5hyv43ps.js +12 -0
- package/dist/chunk-5n0tfrpc.js +6 -0
- package/dist/chunk-60ssvwc8.js +4 -0
- package/dist/chunk-69dbf6de.js +3 -0
- package/dist/chunk-7610h2tf.js +3 -0
- package/dist/chunk-79nv7twc.js +14 -0
- package/dist/chunk-853ftm92.js +8 -0
- package/dist/chunk-90aptjh6.js +24 -0
- package/dist/chunk-acyj1dev.js +18 -0
- package/dist/chunk-asws39qs.js +31 -0
- package/dist/chunk-aw48mk3t.js +3 -0
- package/dist/chunk-bdxq6500.js +4 -0
- package/dist/chunk-bqabznps.js +7 -0
- package/dist/chunk-cen2t56g.js +3 -0
- package/dist/chunk-ckq8g1ck.js +4 -0
- package/dist/chunk-cs4gwz1k.js +27 -0
- package/dist/chunk-d43bpfk6.js +3 -0
- package/dist/chunk-dfye109x.js +3 -0
- package/dist/chunk-dv5hhg1a.js +3 -0
- package/dist/chunk-ezbp8tss.js +10 -0
- package/dist/chunk-fgbdm1y6.js +6 -0
- package/dist/chunk-fy97syc2.js +3 -0
- package/dist/chunk-g9d5r6a8.js +3 -0
- package/dist/chunk-ggbahdr2.js +4 -0
- package/dist/chunk-gpq2kggq.js +3 -0
- package/dist/chunk-gs7wfk8b.js +2 -0
- package/dist/chunk-gsb3ty07.js +3 -0
- package/dist/chunk-gsv5yc32.js +6 -0
- package/dist/chunk-h7k9wamx.js +3 -0
- package/dist/chunk-j6pfxvy8.js +3 -0
- package/dist/chunk-km8t8gqg.js +3 -0
- package/dist/chunk-knrtwppp.js +102 -0
- package/dist/chunk-m1khpcqb.js +3 -0
- package/dist/chunk-mt9219xc.js +7 -0
- package/dist/chunk-n2nyd0ck.js +3 -0
- package/dist/chunk-n37yj3xv.js +8 -0
- package/dist/chunk-n3p7wedp.js +3 -0
- package/dist/chunk-n6nw7sn2.js +7 -0
- package/dist/chunk-n94729d9.js +3 -0
- package/dist/chunk-nchp0pqa.js +3 -0
- package/dist/chunk-nn9tpxx3.js +3 -0
- package/dist/chunk-p2qz2nk2.js +3 -0
- package/dist/chunk-p7w9ydhe.js +9 -0
- package/dist/chunk-pga5m4wm.js +3 -0
- package/dist/chunk-psrgw9f8.js +19 -0
- package/dist/chunk-py7pj8aj.js +5 -0
- package/dist/chunk-pzedkn7z.js +4 -0
- package/dist/chunk-q0hn0ymb.js +6 -0
- package/dist/chunk-qnf4byak.js +3 -0
- package/dist/chunk-r4s18nn5.js +3 -0
- package/dist/chunk-r4zkf9ag.js +3 -0
- package/dist/chunk-rdzfdjkb.js +7 -0
- package/dist/chunk-rmdwvzgn.js +3 -0
- package/dist/chunk-s0mvstt0.js +3 -0
- package/dist/chunk-s6c98nad.js +29 -0
- package/dist/chunk-sjneg7p7.js +34 -0
- package/dist/chunk-sq34kkhy.js +3 -0
- package/dist/chunk-srg5qhch.js +22 -0
- package/dist/chunk-strqhcqs.js +3 -0
- package/dist/chunk-t1jtn2r0.js +10 -0
- package/dist/chunk-ttc5pr8y.js +37 -0
- package/dist/chunk-v44crx69.js +62 -0
- package/dist/chunk-v6fwy63g.js +3 -0
- package/dist/chunk-vae5wxar.js +3 -0
- package/dist/chunk-vtskg4r2.js +4 -0
- package/dist/chunk-w9av39jy.js +3 -0
- package/dist/chunk-wnk9yjw2.js +3 -0
- package/dist/chunk-wrnz0e76.js +4 -0
- package/dist/chunk-wzcwctba.js +9 -0
- package/dist/chunk-xb92nrsm.js +3 -0
- package/dist/chunk-xr1h3tv2.js +8 -0
- package/dist/chunk-xsf941gw.js +3 -0
- package/dist/chunk-z4mvkazp.js +21 -0
- package/dist/chunk-zq93f8ca.js +5 -0
- package/dist/src/augmentation-graph.d.ts +11 -0
- package/dist/src/augmentation-graph.js +2 -0
- package/dist/src/binding-patterns.d.ts +18 -0
- package/dist/src/binding-patterns.js +2 -0
- package/dist/src/branded-types.d.ts +159 -0
- package/dist/src/branded-types.js +2 -0
- package/dist/src/bundle-linker.d.ts +38 -0
- package/dist/src/bundle-linker.js +2 -0
- package/dist/src/bundler.d.ts +55 -0
- package/dist/src/bundler.js +2 -0
- package/dist/src/cache.d.ts +53 -0
- package/dist/src/cache.js +2 -0
- package/dist/src/call-signatures.d.ts +1 -0
- package/dist/src/call-signatures.js +2 -0
- package/dist/src/checker.d.ts +107 -0
- package/dist/src/circular.d.ts +82 -0
- package/dist/src/circular.js +2 -0
- package/dist/src/compat.d.ts +114 -0
- package/dist/src/compat.js +2 -0
- package/dist/src/computed-keys.d.ts +12 -0
- package/dist/src/computed-keys.js +2 -0
- package/dist/src/concurrency.d.ts +4 -0
- package/dist/src/concurrency.js +2 -0
- package/dist/src/config.d.ts +35 -0
- package/dist/src/config.js +2 -0
- package/dist/src/dangling-refs.d.ts +11 -0
- package/dist/src/dangling-refs.js +2 -0
- package/dist/src/declaration-project.d.ts +33 -0
- package/dist/src/declaration-project.js +2 -0
- package/dist/src/declaration-publication.d.ts +15 -0
- package/dist/src/declaration-publication.js +2 -0
- package/dist/src/declaration-references.d.ts +19 -0
- package/dist/src/declaration-references.js +2 -0
- package/dist/src/diff.d.ts +82 -0
- package/dist/src/diff.js +2 -0
- package/dist/src/docs.d.ts +97 -0
- package/dist/src/docs.js +2 -0
- package/dist/src/enum-declarations.d.ts +6 -0
- package/dist/src/enum-declarations.js +2 -0
- package/dist/src/errors.d.ts +113 -0
- package/dist/src/errors.js +2 -0
- package/dist/src/extractor/directives.d.ts +5 -0
- package/dist/src/extractor/directives.js +2 -0
- package/dist/src/extractor/extract.d.ts +10 -0
- package/dist/src/extractor/extract.js +2 -0
- package/dist/src/extractor/hash.d.ts +1 -0
- package/dist/src/extractor/hash.js +2 -0
- package/dist/src/extractor/scanner.d.ts +32 -0
- package/dist/src/extractor/scanner.js +2 -0
- package/dist/src/extractor.d.ts +5 -0
- package/dist/src/extractor.js +2 -0
- package/dist/src/formats.d.ts +50 -0
- package/dist/src/formats.js +2 -0
- package/dist/src/formatter.d.ts +61 -0
- package/dist/src/formatter.js +2 -0
- package/dist/src/function-properties.d.ts +3 -0
- package/dist/src/function-properties.js +2 -0
- package/dist/src/generator.d.ts +18 -0
- package/dist/src/generator.js +2 -0
- package/dist/src/global-types.d.ts +17 -0
- package/dist/src/global-types.js +2 -0
- package/dist/src/import-sorter.d.ts +99 -0
- package/dist/src/import-sorter.js +2 -0
- package/dist/src/incremental.d.ts +103 -0
- package/dist/src/incremental.js +2 -0
- package/dist/src/index.d.ts +62 -0
- package/dist/src/index.js +2 -0
- package/dist/src/inferred-imports.d.ts +4 -0
- package/dist/src/inferred-imports.js +2 -0
- package/dist/src/json-config.d.ts +2 -0
- package/dist/src/json-config.js +2 -0
- package/dist/src/lexical.d.ts +6 -0
- package/dist/src/lexical.js +2 -0
- package/dist/src/logger.d.ts +57 -0
- package/dist/src/logger.js +2 -0
- package/dist/src/lsp.d.ts +333 -0
- package/dist/src/lsp.js +2 -0
- package/dist/src/memory.d.ts +127 -0
- package/dist/src/memory.js +2 -0
- package/dist/src/merger.d.ts +38 -0
- package/dist/src/merger.js +2 -0
- package/dist/src/module-graph.d.ts +70 -0
- package/dist/src/module-graph.js +2 -0
- package/dist/src/module-references.d.ts +30 -0
- package/dist/src/module-references.js +2 -0
- package/dist/src/native-checker.d.ts +55 -0
- package/dist/src/native-checker.js +2 -0
- package/dist/src/native-engine.d.ts +16 -0
- package/dist/src/native-engine.js +2 -0
- package/dist/src/native-extractor.d.ts +9 -0
- package/dist/src/native-extractor.js +2 -0
- package/dist/src/native-generation.d.ts +20 -0
- package/dist/src/native-generation.js +2 -0
- package/dist/src/native-project.d.ts +35 -0
- package/dist/src/native-project.js +2 -0
- package/dist/src/optimizer.d.ts +56 -0
- package/dist/src/optimizer.js +2 -0
- package/dist/src/output-normalizer.d.ts +123 -0
- package/dist/src/output-normalizer.js +2 -0
- package/dist/src/parallel-processor.d.ts +63 -0
- package/dist/src/parallel-processor.js +2 -0
- package/dist/src/parameters.d.ts +5 -0
- package/dist/src/parameters.js +2 -0
- package/dist/src/parser.d.ts +68 -0
- package/dist/src/parser.js +2 -0
- package/dist/src/plugins/bun.d.ts +58 -0
- package/dist/src/plugins/bun.js +2 -0
- package/dist/src/plugins/esbuild.d.ts +63 -0
- package/dist/src/plugins/esbuild.js +2 -0
- package/dist/src/plugins/index.d.ts +16 -0
- package/dist/src/plugins/index.js +2 -0
- package/dist/src/plugins/tsdown.d.ts +30 -0
- package/dist/src/plugins/tsdown.js +2 -0
- package/dist/src/plugins/tsup.d.ts +53 -0
- package/dist/src/plugins/tsup.js +2 -0
- package/dist/src/plugins/vite.d.ts +49 -0
- package/dist/src/plugins/vite.js +2 -0
- package/dist/src/plugins/webpack.d.ts +69 -0
- package/dist/src/plugins/webpack.js +2 -0
- package/dist/src/plugins.d.ts +88 -0
- package/dist/src/plugins.js +2 -0
- package/dist/src/process-source.d.ts +28 -0
- package/dist/src/process-source.js +2 -0
- package/dist/src/processor/cache.d.ts +18 -0
- package/dist/src/processor/cache.js +2 -0
- package/dist/src/processor/comments.d.ts +9 -0
- package/dist/src/processor/comments.js +2 -0
- package/dist/src/processor/declarations.d.ts +37 -0
- package/dist/src/processor/declarations.js +2 -0
- package/dist/src/processor/import-usage.d.ts +6 -0
- package/dist/src/processor/import-usage.js +2 -0
- package/dist/src/processor/imports.d.ts +68 -0
- package/dist/src/processor/imports.js +2 -0
- package/dist/src/processor/index.d.ts +33 -0
- package/dist/src/processor/index.js +2 -0
- package/dist/src/processor/type-inference.d.ts +116 -0
- package/dist/src/processor/type-inference.js +2 -0
- package/dist/src/processor.d.ts +5 -0
- package/dist/src/processor.js +2 -0
- package/dist/src/profiling.d.ts +114 -0
- package/dist/src/profiling.js +2 -0
- package/dist/src/return-type-scope.d.ts +3 -0
- package/dist/src/return-type-scope.js +2 -0
- package/dist/src/security.d.ts +100 -0
- package/dist/src/security.js +2 -0
- package/dist/src/source-cache.d.ts +16 -0
- package/dist/src/source-cache.js +2 -0
- package/dist/src/sourcemap.d.ts +137 -0
- package/dist/src/sourcemap.js +2 -0
- package/dist/src/stx.d.ts +20 -0
- package/dist/src/stx.js +2 -0
- package/dist/src/syntax-validator.d.ts +7 -0
- package/dist/src/syntax-validator.js +2 -0
- package/dist/src/tracking.d.ts +95 -0
- package/dist/src/tracking.js +2 -0
- package/dist/src/transformers.d.ts +188 -0
- package/dist/src/transformers.js +2 -0
- package/dist/src/tree-shaker.d.ts +69 -0
- package/dist/src/tree-shaker.js +2 -0
- package/dist/src/tsconfig.d.ts +8 -0
- package/dist/src/tsconfig.js +2 -0
- package/dist/src/type-mappings.d.ts +145 -0
- package/dist/src/type-mappings.js +2 -0
- package/dist/src/types.d.ts +230 -0
- package/dist/src/types.js +1 -0
- package/dist/src/utils.d.ts +63 -0
- package/dist/src/utils.js +2 -0
- package/dist/src/value-inference.d.ts +6 -0
- package/dist/src/value-inference.js +2 -0
- package/dist/src/vue.d.ts +108 -0
- package/dist/src/vue.js +2 -0
- package/dist/src/watcher.d.ts +64 -0
- package/dist/src/watcher.js +2 -0
- package/dist/src/worker-thread.d.ts +1 -0
- package/dist/src/worker-thread.js +2 -0
- package/dist/src/worker.d.ts +98 -0
- package/dist/src/worker.js +2 -0
- package/dist/src/workspace.d.ts +62 -0
- package/dist/src/workspace.js +2 -0
- package/native/README.md +6 -0
- package/native/darwin-arm64/libzig-dtsx.dylib +0 -0
- package/native/darwin-x64/libzig-dtsx.dylib +0 -0
- package/native/freebsd-x64/libzig-dtsx.so +0 -0
- package/native/linux-arm64/libzig-dtsx.so +0 -0
- package/native/linux-x64/libzig-dtsx.so +0 -0
- package/native/windows-x64/zig-dtsx.dll +0 -0
- package/package.json +120 -4
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { DtsGenerationConfig, GenerationStats } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a tsup plugin for dtsx
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* // tsup.config.ts
|
|
8
|
+
* import { dtsxPlugin } from '@dtsx/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;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{le,ma,Yn,ga}from"../../chunk-sq34kkhy.js";import"../../chunk-0azm93j9.js";import"../../chunk-psrgw9f8.js";import"../../chunk-nn9tpxx3.js";import"../../chunk-acyj1dev.js";import"../../chunk-wzcwctba.js";import"../../chunk-p2qz2nk2.js";import"../../chunk-bqabznps.js";import"../../chunk-s0mvstt0.js";import"../../chunk-79nv7twc.js";import"../../chunk-n37yj3xv.js";import"../../chunk-aw48mk3t.js";import"../../chunk-853ftm92.js";import"../../chunk-xb92nrsm.js";import"../../chunk-v44crx69.js";import"../../chunk-n94729d9.js";import"../../chunk-w9av39jy.js";import"../../chunk-vae5wxar.js";import"../../chunk-t1jtn2r0.js";import"../../chunk-60ssvwc8.js";import"../../chunk-vtskg4r2.js";import"../../chunk-qnf4byak.js";import"../../chunk-1pz7zxhc.js";import"../../chunk-pga5m4wm.js";import"../../chunk-25vyhfzh.js";import"../../chunk-mt9219xc.js";import"../../chunk-ezbp8tss.js";import"../../chunk-v6fwy63g.js";import"../../chunk-cs4gwz1k.js";import"../../chunk-ttc5pr8y.js";import"../../chunk-xr1h3tv2.js";import"../../chunk-gsb3ty07.js";import"../../chunk-s6c98nad.js";import"../../chunk-z4mvkazp.js";import"../../chunk-g9d5r6a8.js";import"../../chunk-wnk9yjw2.js";import"../../chunk-gpq2kggq.js";import"../../chunk-90aptjh6.js";import"../../chunk-rdzfdjkb.js";import"../../chunk-n2nyd0ck.js";import"../../chunk-j6pfxvy8.js";import"../../chunk-2kwjbk55.js";import"../../chunk-69dbf6de.js";import"../../chunk-cen2t56g.js";import"../../chunk-d43bpfk6.js";import"../../chunk-rmdwvzgn.js";import"../../chunk-pzedkn7z.js";import"../../chunk-km8t8gqg.js";import"../../chunk-dfye109x.js";import"../../chunk-1j6092xz.js";import"../../chunk-zq93f8ca.js";export{ga as default,Yn as dts,le as dtsxPlugin,ma as tsupDts};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DtsGenerationConfig, GenerationStats } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a Vite plugin for dtsx
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* // vite.config.ts
|
|
8
|
+
* import { dts } from '@dtsx/dtsx/plugins/vite'
|
|
9
|
+
*
|
|
10
|
+
* export default {
|
|
11
|
+
* plugins: [
|
|
12
|
+
* dts({
|
|
13
|
+
* root: './src',
|
|
14
|
+
* outdir: './dist',
|
|
15
|
+
* }),
|
|
16
|
+
* ],
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function dts(options?: VitePluginOptions): VitePlugin;
|
|
21
|
+
/**
|
|
22
|
+
* Alias for dts
|
|
23
|
+
*/
|
|
24
|
+
export declare const viteDts: typeof dts;
|
|
25
|
+
/**
|
|
26
|
+
* Vite plugin options
|
|
27
|
+
*/
|
|
28
|
+
export declare interface VitePluginOptions extends Partial<DtsGenerationConfig> {
|
|
29
|
+
buildStart?: boolean
|
|
30
|
+
buildEnd?: boolean
|
|
31
|
+
writeBundle?: boolean
|
|
32
|
+
modes?: string[]
|
|
33
|
+
onGenerated?: (stats: GenerationStats) => void
|
|
34
|
+
onError?: (error: Error) => void
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Vite plugin interface (minimal type for compatibility)
|
|
38
|
+
*/
|
|
39
|
+
declare interface VitePlugin {
|
|
40
|
+
name: string
|
|
41
|
+
apply?: 'build' | 'serve' | ((_config: { mode: string }) => boolean)
|
|
42
|
+
buildStart?: () => Promise<void> | void
|
|
43
|
+
buildEnd?: () => Promise<void> | void
|
|
44
|
+
writeBundle?: () => Promise<void> | void
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Default export
|
|
48
|
+
*/
|
|
49
|
+
export default dts;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ie,da,pa}from"../../chunk-xsf941gw.js";import"../../chunk-0azm93j9.js";import"../../chunk-psrgw9f8.js";import"../../chunk-nn9tpxx3.js";import"../../chunk-acyj1dev.js";import"../../chunk-wzcwctba.js";import"../../chunk-p2qz2nk2.js";import"../../chunk-bqabznps.js";import"../../chunk-s0mvstt0.js";import"../../chunk-79nv7twc.js";import"../../chunk-n37yj3xv.js";import"../../chunk-aw48mk3t.js";import"../../chunk-853ftm92.js";import"../../chunk-xb92nrsm.js";import"../../chunk-v44crx69.js";import"../../chunk-n94729d9.js";import"../../chunk-w9av39jy.js";import"../../chunk-vae5wxar.js";import"../../chunk-t1jtn2r0.js";import"../../chunk-60ssvwc8.js";import"../../chunk-vtskg4r2.js";import"../../chunk-qnf4byak.js";import"../../chunk-1pz7zxhc.js";import"../../chunk-pga5m4wm.js";import"../../chunk-25vyhfzh.js";import"../../chunk-mt9219xc.js";import"../../chunk-ezbp8tss.js";import"../../chunk-v6fwy63g.js";import"../../chunk-cs4gwz1k.js";import"../../chunk-ttc5pr8y.js";import"../../chunk-xr1h3tv2.js";import"../../chunk-gsb3ty07.js";import"../../chunk-s6c98nad.js";import"../../chunk-z4mvkazp.js";import"../../chunk-g9d5r6a8.js";import"../../chunk-wnk9yjw2.js";import"../../chunk-gpq2kggq.js";import"../../chunk-90aptjh6.js";import"../../chunk-rdzfdjkb.js";import"../../chunk-n2nyd0ck.js";import"../../chunk-j6pfxvy8.js";import"../../chunk-2kwjbk55.js";import"../../chunk-69dbf6de.js";import"../../chunk-cen2t56g.js";import"../../chunk-d43bpfk6.js";import"../../chunk-rmdwvzgn.js";import"../../chunk-pzedkn7z.js";import"../../chunk-km8t8gqg.js";import"../../chunk-dfye109x.js";import"../../chunk-1j6092xz.js";import"../../chunk-zq93f8ca.js";export{pa as default,Ie as dts,da as viteDts};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { DtsGenerationConfig, GenerationStats } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Factory function for creating webpack plugin
|
|
4
|
+
*/
|
|
5
|
+
export declare function dtsxWebpack(options?: WebpackPluginOptions): DtsxWebpackPlugin;
|
|
6
|
+
/**
|
|
7
|
+
* Alias matching common naming convention
|
|
8
|
+
*/
|
|
9
|
+
export declare const dts: typeof dtsxWebpack;
|
|
10
|
+
/**
|
|
11
|
+
* webpack plugin options
|
|
12
|
+
*/
|
|
13
|
+
export declare interface WebpackPluginOptions extends Partial<DtsGenerationConfig> {
|
|
14
|
+
onCompile?: boolean
|
|
15
|
+
afterEmit?: boolean
|
|
16
|
+
onWatchRun?: boolean
|
|
17
|
+
onGenerated?: (stats: GenerationStats) => void
|
|
18
|
+
onError?: (error: Error) => void
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* webpack compiler interface (minimal type)
|
|
22
|
+
*/
|
|
23
|
+
declare interface WebpackCompiler {
|
|
24
|
+
hooks: {
|
|
25
|
+
compile: { tap: (name: string, callback: () => void) => void }
|
|
26
|
+
afterEmit: { tapAsync: (name: string, callback: (compilation: unknown, done: () => void) => void) => void }
|
|
27
|
+
watchRun: { tapAsync: (name: string, callback: (compiler: unknown, done: () => void) => void) => void }
|
|
28
|
+
}
|
|
29
|
+
options: {
|
|
30
|
+
entry?: unknown
|
|
31
|
+
output?: {
|
|
32
|
+
path?: string
|
|
33
|
+
}
|
|
34
|
+
context?: string
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* webpack plugin for dtsx
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* // webpack.config.js
|
|
43
|
+
* const { DtsxWebpackPlugin } = require('@dtsx/dtsx/plugins/webpack')
|
|
44
|
+
*
|
|
45
|
+
* module.exports = {
|
|
46
|
+
* entry: './src/index.ts',
|
|
47
|
+
* output: {
|
|
48
|
+
* path: path.resolve(__dirname, 'dist'),
|
|
49
|
+
* },
|
|
50
|
+
* plugins: [
|
|
51
|
+
* new DtsxWebpackPlugin({
|
|
52
|
+
* root: './src',
|
|
53
|
+
* outdir: './dist',
|
|
54
|
+
* }),
|
|
55
|
+
* ],
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare class DtsxWebpackPlugin {
|
|
60
|
+
private options;
|
|
61
|
+
private generateOptions;
|
|
62
|
+
constructor(options?: WebpackPluginOptions);
|
|
63
|
+
apply(compiler: WebpackCompiler): void;
|
|
64
|
+
private runGenerate;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Default export
|
|
68
|
+
*/
|
|
69
|
+
export default DtsxWebpackPlugin;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Le,It,Xn,ba}from"../../chunk-7610h2tf.js";import"../../chunk-0azm93j9.js";import"../../chunk-psrgw9f8.js";import"../../chunk-nn9tpxx3.js";import"../../chunk-acyj1dev.js";import"../../chunk-wzcwctba.js";import"../../chunk-p2qz2nk2.js";import"../../chunk-bqabznps.js";import"../../chunk-s0mvstt0.js";import"../../chunk-79nv7twc.js";import"../../chunk-n37yj3xv.js";import"../../chunk-aw48mk3t.js";import"../../chunk-853ftm92.js";import"../../chunk-xb92nrsm.js";import"../../chunk-v44crx69.js";import"../../chunk-n94729d9.js";import"../../chunk-w9av39jy.js";import"../../chunk-vae5wxar.js";import"../../chunk-t1jtn2r0.js";import"../../chunk-60ssvwc8.js";import"../../chunk-vtskg4r2.js";import"../../chunk-qnf4byak.js";import"../../chunk-1pz7zxhc.js";import"../../chunk-pga5m4wm.js";import"../../chunk-25vyhfzh.js";import"../../chunk-mt9219xc.js";import"../../chunk-ezbp8tss.js";import"../../chunk-v6fwy63g.js";import"../../chunk-cs4gwz1k.js";import"../../chunk-ttc5pr8y.js";import"../../chunk-xr1h3tv2.js";import"../../chunk-gsb3ty07.js";import"../../chunk-s6c98nad.js";import"../../chunk-z4mvkazp.js";import"../../chunk-g9d5r6a8.js";import"../../chunk-wnk9yjw2.js";import"../../chunk-gpq2kggq.js";import"../../chunk-90aptjh6.js";import"../../chunk-rdzfdjkb.js";import"../../chunk-n2nyd0ck.js";import"../../chunk-j6pfxvy8.js";import"../../chunk-2kwjbk55.js";import"../../chunk-69dbf6de.js";import"../../chunk-cen2t56g.js";import"../../chunk-d43bpfk6.js";import"../../chunk-rmdwvzgn.js";import"../../chunk-pzedkn7z.js";import"../../chunk-km8t8gqg.js";import"../../chunk-dfye109x.js";import"../../chunk-1j6092xz.js";import"../../chunk-zq93f8ca.js";export{Le as DtsxWebpackPlugin,ba as default,Xn as dts,It as dtsxWebpack};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Declaration, DtsGenerationConfig, GenerationStats } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Helper to create a plugin
|
|
4
|
+
*/
|
|
5
|
+
export declare function definePlugin(plugin: Plugin): Plugin;
|
|
6
|
+
/**
|
|
7
|
+
* Built-in plugin: Add banner comment
|
|
8
|
+
* Adds a banner comment to the top of generated files
|
|
9
|
+
*/
|
|
10
|
+
export declare function createBannerPlugin(banner: string): Plugin;
|
|
11
|
+
/**
|
|
12
|
+
* Built-in plugin: Filter exports
|
|
13
|
+
* Only include declarations matching the filter
|
|
14
|
+
*/
|
|
15
|
+
export declare function createFilterPlugin(filter: (name: string) => boolean): Plugin;
|
|
16
|
+
/**
|
|
17
|
+
* Global plugin manager instance
|
|
18
|
+
*/
|
|
19
|
+
export declare const pluginManager: PluginManager;
|
|
20
|
+
/**
|
|
21
|
+
* Built-in plugin: Strip internal declarations
|
|
22
|
+
* Removes declarations marked with @internal in JSDoc
|
|
23
|
+
*/
|
|
24
|
+
export declare const stripInternalPlugin: Plugin;
|
|
25
|
+
/**
|
|
26
|
+
* Context passed to plugin hooks
|
|
27
|
+
*/
|
|
28
|
+
export declare interface PluginContext {
|
|
29
|
+
filePath: string
|
|
30
|
+
sourceCode: string
|
|
31
|
+
config: DtsGenerationConfig
|
|
32
|
+
log: {
|
|
33
|
+
debug: (message: string) => void
|
|
34
|
+
info: (message: string) => void
|
|
35
|
+
warn: (message: string) => void
|
|
36
|
+
error: (message: string) => void
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Transform context with mutable content
|
|
41
|
+
*/
|
|
42
|
+
export declare interface TransformContext extends PluginContext {
|
|
43
|
+
content: string
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Declaration context for declaration hooks
|
|
47
|
+
*/
|
|
48
|
+
export declare interface DeclarationContext extends PluginContext {
|
|
49
|
+
declarations: Declaration[]
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Plugin hook definitions
|
|
53
|
+
*/
|
|
54
|
+
export declare interface PluginHooks {
|
|
55
|
+
onStart?: (config: DtsGenerationConfig) => DtsGenerationConfig | void | Promise<DtsGenerationConfig | void>
|
|
56
|
+
onBeforeFile?: (ctx: TransformContext) => string | void | Promise<string | void>
|
|
57
|
+
onDeclarations?: (ctx: DeclarationContext) => Declaration[] | void | Promise<Declaration[] | void>
|
|
58
|
+
onAfterFile?: (ctx: TransformContext) => string | void | Promise<string | void>
|
|
59
|
+
onEnd?: (stats: GenerationStats) => void | Promise<void>
|
|
60
|
+
onError?: (error: Error, ctx: PluginContext) => void | Promise<void>
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Plugin definition
|
|
64
|
+
*/
|
|
65
|
+
export declare interface Plugin extends PluginHooks {
|
|
66
|
+
name: string
|
|
67
|
+
version?: string
|
|
68
|
+
cacheKey?: string
|
|
69
|
+
description?: string
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Plugin manager for handling multiple plugins
|
|
73
|
+
*/
|
|
74
|
+
export declare class PluginManager {
|
|
75
|
+
private plugins;
|
|
76
|
+
private config;
|
|
77
|
+
register(plugin: Plugin): void;
|
|
78
|
+
hasDeclarationHooks(): boolean;
|
|
79
|
+
unregister(name: string): boolean;
|
|
80
|
+
getPlugins(): readonly Plugin[];
|
|
81
|
+
private createLogger;
|
|
82
|
+
runOnStart(config: DtsGenerationConfig): Promise<DtsGenerationConfig>;
|
|
83
|
+
runOnBeforeFile(filePath: string, sourceCode: string): Promise<string>;
|
|
84
|
+
runOnDeclarations(filePath: string, sourceCode: string, declarations: Declaration[]): Promise<Declaration[]>;
|
|
85
|
+
runOnAfterFile(filePath: string, sourceCode: string, dtsContent: string): Promise<string>;
|
|
86
|
+
runOnEnd(stats: GenerationStats): Promise<void>;
|
|
87
|
+
runOnError(error: Error, filePath: string, sourceCode: string): Promise<void>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emit through the native engine when it can produce this output: the engine
|
|
3
|
+
* is loaded and the import order is the default one it implements. Returns
|
|
4
|
+
* null otherwise, or when the native emitter rejects the input, and the
|
|
5
|
+
* TypeScript engine runs instead.
|
|
6
|
+
*/
|
|
7
|
+
export declare function emitNatively(sourceCode: string, filename: string, keepComments: boolean, importOrder: readonly string[], isolatedDeclarations: boolean): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Process TypeScript source code from a string (for stdin support)
|
|
10
|
+
* This is a lightweight module that avoids pulling in heavy dependencies
|
|
11
|
+
* like bun Glob, fs/promises, bundler, cache, config, etc.
|
|
12
|
+
*/
|
|
13
|
+
export declare function processSource(sourceCode: string, filename?: string, keepComments?: boolean, importOrder?: string[], isolatedDeclarations?: boolean): string;
|
|
14
|
+
/** Generate declarations through the annotation-first isolated fast path. */
|
|
15
|
+
export declare function processSourceIsolated(sourceCode: string, filename?: string, keepComments?: boolean, importOrder?: string[]): string;
|
|
16
|
+
/** Generate declarations through the value-aware semantic inference path. */
|
|
17
|
+
export declare function processSourceSemantic(sourceCode: string, filename?: string, keepComments?: boolean, importOrder?: string[]): string;
|
|
18
|
+
export declare function clearResultCache(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Fast path for project mode — skips cache lookup/store.
|
|
21
|
+
* Use when processing many files once (no cache benefit).
|
|
22
|
+
*/
|
|
23
|
+
export declare function processSourceDirect(sourceCode: string, filename?: string, keepComments?: boolean, importOrder?: string[], isolatedDeclarations?: boolean): string;
|
|
24
|
+
/**
|
|
25
|
+
* Emit through the TypeScript engine only, without the native engine or the
|
|
26
|
+
* result cache: the reference the native engine is held to.
|
|
27
|
+
*/
|
|
28
|
+
export declare function processSourceWithTypeScriptEngine(sourceCode: string, filename?: string, keepComments?: boolean, importOrder?: string[], isolatedDeclarations?: boolean): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ue,bt,oi,ai,ci,Ca,gn}from"../chunk-n94729d9.js";import"../chunk-w9av39jy.js";import"../chunk-t1jtn2r0.js";import"../chunk-60ssvwc8.js";import"../chunk-vtskg4r2.js";import"../chunk-25vyhfzh.js";import"../chunk-mt9219xc.js";import"../chunk-v6fwy63g.js";import"../chunk-ttc5pr8y.js";import"../chunk-xr1h3tv2.js";import"../chunk-gsb3ty07.js";import"../chunk-s6c98nad.js";import"../chunk-z4mvkazp.js";import"../chunk-g9d5r6a8.js";import"../chunk-wnk9yjw2.js";import"../chunk-gpq2kggq.js";import"../chunk-90aptjh6.js";import"../chunk-rdzfdjkb.js";import"../chunk-n2nyd0ck.js";import"../chunk-j6pfxvy8.js";import"../chunk-2kwjbk55.js";import"../chunk-69dbf6de.js";import"../chunk-cen2t56g.js";import"../chunk-1j6092xz.js";import"../chunk-zq93f8ca.js";export{ci as clearResultCache,Ue as emitNatively,bt as processSource,Ca as processSourceDirect,oi as processSourceIsolated,ai as processSourceSemantic,gn as processSourceWithTypeScriptEngine};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get or create a cached RegExp for word boundary matching.
|
|
3
|
+
* Promotes the entry on a hit so the FIFO eviction approximates LRU.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getCachedRegex(pattern: string): RegExp;
|
|
6
|
+
/**
|
|
7
|
+
* Get cached import items or null if not cached.
|
|
8
|
+
* Promotes on hit for LRU-like semantics.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getImportItemsFromCache(importText: string): string[] | null;
|
|
11
|
+
/**
|
|
12
|
+
* Store import items in cache with eviction
|
|
13
|
+
*/
|
|
14
|
+
export declare function setImportItemsCache(importText: string, items: string[]): void;
|
|
15
|
+
/**
|
|
16
|
+
* Clear processor caches (useful for testing or memory management)
|
|
17
|
+
*/
|
|
18
|
+
export declare function clearProcessorCaches(): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comment formatting utilities for DTS output
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Format comments for DTS output
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatComments(comments: string[] | undefined, keepComments?: boolean): string;
|
|
8
|
+
/** Keep data embedded in generated JSDoc from ending the comment. */
|
|
9
|
+
export declare function escapeJsdocContent(value: string): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Declaration } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Process function declaration to DTS format
|
|
4
|
+
*/
|
|
5
|
+
export declare function processFunctionDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
6
|
+
/**
|
|
7
|
+
* Process variable declaration to DTS format
|
|
8
|
+
*/
|
|
9
|
+
export declare function processVariableDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
10
|
+
/**
|
|
11
|
+
* Process interface declaration to DTS format
|
|
12
|
+
*/
|
|
13
|
+
export declare function processInterfaceDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
14
|
+
/**
|
|
15
|
+
* Process type alias declaration to DTS format
|
|
16
|
+
*/
|
|
17
|
+
export declare function processTypeDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
18
|
+
/**
|
|
19
|
+
* Process class declaration to DTS format
|
|
20
|
+
*/
|
|
21
|
+
export declare function processClassDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
22
|
+
/**
|
|
23
|
+
* Process enum declaration to DTS format
|
|
24
|
+
*/
|
|
25
|
+
export declare function processEnumDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
26
|
+
/**
|
|
27
|
+
* Process import statement
|
|
28
|
+
*/
|
|
29
|
+
export declare function processImportDeclaration(decl: Declaration): string;
|
|
30
|
+
/**
|
|
31
|
+
* Process export statement
|
|
32
|
+
*/
|
|
33
|
+
export declare function processExportDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
34
|
+
/**
|
|
35
|
+
* Process module/namespace declaration to DTS format
|
|
36
|
+
*/
|
|
37
|
+
export declare function processModuleDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{X,g,Z,Q,ee,te,Dn,Rn,ne}from"../../chunk-s6c98nad.js";import"../../chunk-90aptjh6.js";import"../../chunk-rdzfdjkb.js";import"../../chunk-n2nyd0ck.js";import"../../chunk-69dbf6de.js";import"../../chunk-1j6092xz.js";import"../../chunk-zq93f8ca.js";export{ee as processClassDeclaration,te as processEnumDeclaration,Rn as processExportDeclaration,X as processFunctionDeclaration,Dn as processImportDeclaration,Z as processInterfaceDeclaration,ne as processModuleDeclaration,Q as processTypeDeclaration,g as processVariableDeclaration};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Declaration } from '../types.js';
|
|
2
|
+
/** The same declaration reference analysis serves import pruning and graph planning. */
|
|
3
|
+
export declare function analyzeDeclarationImportUsage(declarations: readonly Declaration[]): {
|
|
4
|
+
usedItems: Set<string>
|
|
5
|
+
referenceText: string
|
|
6
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{we}from"../../chunk-vtskg4r2.js";import"../../chunk-s6c98nad.js";import"../../chunk-wnk9yjw2.js";import"../../chunk-gpq2kggq.js";import"../../chunk-90aptjh6.js";import"../../chunk-rdzfdjkb.js";import"../../chunk-n2nyd0ck.js";import"../../chunk-69dbf6de.js";import"../../chunk-1j6092xz.js";import"../../chunk-zq93f8ca.js";export{we as analyzeDeclarationImportUsage};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** Canonically quote the decoded value of a grammatical module literal. */
|
|
2
|
+
export declare function getImportSourceLiteral(importText: string): string | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* Parse an import statement into its components using string operations
|
|
5
|
+
* Avoids regex backtracking issues
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseImportStatement(importText: string): {
|
|
8
|
+
defaultName: string | null
|
|
9
|
+
namedItems: string[]
|
|
10
|
+
source: string
|
|
11
|
+
isTypeOnly: boolean
|
|
12
|
+
isNamespace: boolean
|
|
13
|
+
namespaceName?: string | null
|
|
14
|
+
isImportEquals?: boolean
|
|
15
|
+
} | null;
|
|
16
|
+
/** Imported local names, sharing the same binding grammar as emission. */
|
|
17
|
+
export declare function extractAllImportedItems(importText: string): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Parse an import statement with detailed type-only information for each item
|
|
20
|
+
* Handles: import type { X }, import { type X, Y }, import * as X, etc.
|
|
21
|
+
*/
|
|
22
|
+
export declare function parseImportDetailed(importText: string): ParsedImport | null;
|
|
23
|
+
/**
|
|
24
|
+
* Parse an export statement with detailed type-only information
|
|
25
|
+
* Handles: export type { X }, export { type X, Y }, export * from, etc.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseExportDetailed(exportText: string): {
|
|
28
|
+
namedItems: ImportItem[]
|
|
29
|
+
source: string | null
|
|
30
|
+
isTypeOnly: boolean
|
|
31
|
+
isNamespace: boolean
|
|
32
|
+
isDefault: boolean
|
|
33
|
+
} | null;
|
|
34
|
+
/**
|
|
35
|
+
* Check if an import item is type-only
|
|
36
|
+
*/
|
|
37
|
+
export declare function isTypeOnlyImportItem(itemText: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Convert import items to type-only format
|
|
40
|
+
* E.g., "{ X, Y }" becomes "{ type X, type Y }"
|
|
41
|
+
*/
|
|
42
|
+
export declare function convertToTypeOnlyImport(importText: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Merge value and type imports from the same module
|
|
45
|
+
* Combines separate import statements into one where possible
|
|
46
|
+
*/
|
|
47
|
+
export declare function mergeImports(imports: string[]): string[];
|
|
48
|
+
/**
|
|
49
|
+
* Represents a single imported item with its type-only status
|
|
50
|
+
*/
|
|
51
|
+
export declare interface ImportItem {
|
|
52
|
+
name: string
|
|
53
|
+
originalName: string
|
|
54
|
+
isTypeOnly: boolean
|
|
55
|
+
isDefault: boolean
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Detailed import statement parse result
|
|
59
|
+
*/
|
|
60
|
+
export declare interface ParsedImport {
|
|
61
|
+
defaultName: string | null
|
|
62
|
+
namedItems: ImportItem[]
|
|
63
|
+
source: string
|
|
64
|
+
isTypeOnly: boolean
|
|
65
|
+
isNamespace: boolean
|
|
66
|
+
namespaceName: string | null
|
|
67
|
+
isImportEquals?: boolean
|
|
68
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Se,Fn,h,y,Sa,xi,$a,Ea}from"../../chunk-wnk9yjw2.js";import"../../chunk-gpq2kggq.js";import"../../chunk-1j6092xz.js";import"../../chunk-zq93f8ca.js";export{$a as convertToTypeOnlyImport,h as extractAllImportedItems,Se as getImportSourceLiteral,xi as isTypeOnlyImportItem,Ea as mergeImports,Sa as parseExportDetailed,y as parseImportDetailed,Fn as parseImportStatement};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { formatComments } from './comments.js';
|
|
2
|
+
import { processClassDeclaration, processEnumDeclaration, processFunctionDeclaration, processInterfaceDeclaration, processModuleDeclaration, processTypeDeclaration, processVariableDeclaration } from './declarations.js';
|
|
3
|
+
import type { Declaration, ProcessingContext } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Process declarations and convert them to narrow DTS format
|
|
6
|
+
*/
|
|
7
|
+
export declare function processDeclarations(declarations: Declaration[], context: ProcessingContext, keepComments?: boolean, importOrder?: string[]): string;
|
|
8
|
+
// Re-export all public APIs
|
|
9
|
+
export { clearProcessorCaches } from './cache.js';
|
|
10
|
+
export { formatComments } from './comments.js';
|
|
11
|
+
export {
|
|
12
|
+
processClassDeclaration,
|
|
13
|
+
processEnumDeclaration,
|
|
14
|
+
processExportDeclaration,
|
|
15
|
+
processFunctionDeclaration,
|
|
16
|
+
processImportDeclaration,
|
|
17
|
+
processInterfaceDeclaration,
|
|
18
|
+
processModuleDeclaration,
|
|
19
|
+
processTypeDeclaration,
|
|
20
|
+
processVariableDeclaration,
|
|
21
|
+
} from './declarations.js';
|
|
22
|
+
export { extractAllImportedItems, parseImportStatement } from './imports.js';
|
|
23
|
+
export {
|
|
24
|
+
extractSatisfiesType,
|
|
25
|
+
findMatchingBracket,
|
|
26
|
+
inferArrayType,
|
|
27
|
+
inferFunctionType,
|
|
28
|
+
inferNarrowType,
|
|
29
|
+
inferNarrowTypeInUnion,
|
|
30
|
+
inferObjectType,
|
|
31
|
+
isGenericType,
|
|
32
|
+
parseArrayElements,
|
|
33
|
+
} from './type-inference.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{l}from"../../chunk-t1jtn2r0.js";import"../../chunk-60ssvwc8.js";import"../../chunk-vtskg4r2.js";import{X,g,Z,Q,ee,te,Dn,Rn,ne}from"../../chunk-s6c98nad.js";import{Fn,h}from"../../chunk-wnk9yjw2.js";import{Bn}from"../../chunk-gpq2kggq.js";import{n,Rt,$e,re,Ze,o,Qe,ke,W}from"../../chunk-90aptjh6.js";import{u}from"../../chunk-rdzfdjkb.js";import"../../chunk-n2nyd0ck.js";import"../../chunk-j6pfxvy8.js";import"../../chunk-2kwjbk55.js";import"../../chunk-69dbf6de.js";import"../../chunk-1j6092xz.js";import"../../chunk-zq93f8ca.js";export{Bn as clearProcessorCaches,h as extractAllImportedItems,W as extractSatisfiesType,o as findMatchingBracket,u as formatComments,$e as inferArrayType,Qe as inferFunctionType,n as inferNarrowType,Rt as inferNarrowTypeInUnion,Ze as inferObjectType,ke as isGenericType,re as parseArrayElements,Fn as parseImportStatement,ee as processClassDeclaration,l as processDeclarations,te as processEnumDeclaration,Rn as processExportDeclaration,X as processFunctionDeclaration,Dn as processImportDeclaration,Z as processInterfaceDeclaration,ne as processModuleDeclaration,Q as processTypeDeclaration,g as processVariableDeclaration};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { KeyConstants } from '../computed-keys.js';
|
|
2
|
+
/**
|
|
3
|
+
* Enable clean default collection for the next type inference pass.
|
|
4
|
+
* Must be called before inferNarrowType when you need a @defaultValue.
|
|
5
|
+
*/
|
|
6
|
+
export declare function enableCleanDefaultCollection(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Consume the computed clean default (also disables collection).
|
|
9
|
+
* Returns null if no clean default was computed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function consumeCleanDefault(): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Infer and narrow types from values
|
|
14
|
+
* @param inUnion - When true, widens number/boolean literals to their base types (used in array union contexts)
|
|
15
|
+
* @param _depth - Internal recursion depth counter (do not set manually)
|
|
16
|
+
*/
|
|
17
|
+
export declare function inferNarrowType(value: unknown, isConst?: boolean, inUnion?: boolean, _depth?: number, keyConstants?: KeyConstants): string;
|
|
18
|
+
/**
|
|
19
|
+
* Infer and narrow types from values in union context (for arrays)
|
|
20
|
+
* Widens number/boolean literals to base types unless const
|
|
21
|
+
*/
|
|
22
|
+
export declare function inferNarrowTypeInUnion(value: unknown, isConst?: boolean, _depth?: number, keyConstants?: KeyConstants): string;
|
|
23
|
+
/**
|
|
24
|
+
* Infer the public return type of a function body without building a TypeScript AST.
|
|
25
|
+
*
|
|
26
|
+
* This is intentionally used only by the semantic generation path. Isolated
|
|
27
|
+
* declarations remain annotation-first and never scan implementation bodies.
|
|
28
|
+
*/
|
|
29
|
+
export declare function inferFunctionBodyReturnType(body: string, isAsync?: boolean, parameters?: string, classExpression?: (value: string) => string | undefined, assertedType?: (type: string, position: number) => string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Infer array type from array literal
|
|
32
|
+
*/
|
|
33
|
+
export declare function inferArrayType(value: string, isConst: boolean, _depth?: number, keyConstants?: KeyConstants): string;
|
|
34
|
+
/**
|
|
35
|
+
* Parse array elements handling nested structures
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseArrayElements(content: string): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Infer object type from object literal
|
|
40
|
+
*/
|
|
41
|
+
export declare function inferObjectType(value: string, isConst: boolean, _depth?: number, keyConstants?: KeyConstants, resolve?: (value: string) => string): string;
|
|
42
|
+
/** Infer calls whose callee can be referenced safely from declaration syntax. */
|
|
43
|
+
export declare function inferCallType(value: string): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Clean parameter defaults from function parameters
|
|
46
|
+
*/
|
|
47
|
+
export declare function cleanParameterDefaults(params: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Find matching bracket for nested structures
|
|
50
|
+
*/
|
|
51
|
+
export declare function findMatchingBracket(str: string, start: number, openChar: string, closeChar: string): number;
|
|
52
|
+
/**
|
|
53
|
+
* Infer function type from function expression
|
|
54
|
+
*/
|
|
55
|
+
export declare function inferFunctionType(value: string, inUnion?: boolean, _depth?: number, isConst?: boolean): string;
|
|
56
|
+
/**
|
|
57
|
+
* Check if a type annotation is a generic/broad type that should be replaced with narrow inference
|
|
58
|
+
*/
|
|
59
|
+
export declare function isGenericType(typeAnnotation: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Extract type from 'satisfies' operator
|
|
62
|
+
* e.g., "{ port: 3000 } satisfies { port: number }" returns "{ port: number }"
|
|
63
|
+
*/
|
|
64
|
+
export declare function extractSatisfiesType(value: string): string | null;
|
|
65
|
+
/**
|
|
66
|
+
* Infer mapped type from type expression
|
|
67
|
+
* Handles patterns like { [K in keyof T]: V }
|
|
68
|
+
*/
|
|
69
|
+
export declare function inferMappedType(typeStr: string): string | null;
|
|
70
|
+
/**
|
|
71
|
+
* Infer conditional type from type expression
|
|
72
|
+
* Handles patterns like T extends U ? X : Y
|
|
73
|
+
*/
|
|
74
|
+
export declare function inferConditionalType(typeStr: string): string | null;
|
|
75
|
+
/**
|
|
76
|
+
* Infer template literal type from type expression
|
|
77
|
+
* Handles patterns like `${string}-${number}`
|
|
78
|
+
*/
|
|
79
|
+
export declare function inferTemplateLiteralTypeAdvanced(typeStr: string): string | null;
|
|
80
|
+
/**
|
|
81
|
+
* Infer infer keyword usage in conditional types
|
|
82
|
+
* Handles patterns like T extends (infer U)[] ? U : never
|
|
83
|
+
*/
|
|
84
|
+
export declare function extractInferTypes(typeStr: string): string[];
|
|
85
|
+
/**
|
|
86
|
+
* Check if a type uses advanced TypeScript features
|
|
87
|
+
*/
|
|
88
|
+
export declare function isComplexType(_typeStr: string): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Simplify complex type for declaration output
|
|
91
|
+
* Returns simplified version if too complex
|
|
92
|
+
*/
|
|
93
|
+
export declare function simplifyComplexType(typeStr: string, maxDepth?: number): string;
|
|
94
|
+
/**
|
|
95
|
+
* Parse utility type and extract its parameters
|
|
96
|
+
* Handles Partial<T>, Required<T>, Pick<T, K>, Omit<T, K>, etc.
|
|
97
|
+
*/
|
|
98
|
+
export declare function parseUtilityType(typeStr: string): { name: string, params: string[] } | null;
|
|
99
|
+
/**
|
|
100
|
+
* Parse type parameters from a comma-separated string
|
|
101
|
+
* Handles nested types properly
|
|
102
|
+
*/
|
|
103
|
+
export declare function parseTypeParameters(paramsStr: string): string[];
|
|
104
|
+
/**
|
|
105
|
+
* Infer keyof type
|
|
106
|
+
*/
|
|
107
|
+
export declare function inferKeyofType(typeStr: string): string | null;
|
|
108
|
+
/**
|
|
109
|
+
* Infer typeof type
|
|
110
|
+
*/
|
|
111
|
+
export declare function inferTypeofType(typeStr: string): string | null;
|
|
112
|
+
/**
|
|
113
|
+
* Check if type is an indexed access type
|
|
114
|
+
* e.g., T[K], Person['name']
|
|
115
|
+
*/
|
|
116
|
+
export declare function isIndexedAccessType(typeStr: string): boolean;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Pt,Dt,n,Rt,O,$e,re,Ze,Ee,ie,o,Qe,ke,W,Ta,Aa,Pa,Da,Ra,Ma,Oa,ea,Ia,Fa,La}from"../../chunk-90aptjh6.js";import"../../chunk-rdzfdjkb.js";import"../../chunk-n2nyd0ck.js";import"../../chunk-69dbf6de.js";import"../../chunk-1j6092xz.js";import"../../chunk-zq93f8ca.js";export{ie as cleanParameterDefaults,Dt as consumeCleanDefault,Pt as enableCleanDefaultCollection,Da as extractInferTypes,W as extractSatisfiesType,o as findMatchingBracket,$e as inferArrayType,Ee as inferCallType,Aa as inferConditionalType,O as inferFunctionBodyReturnType,Qe as inferFunctionType,Ia as inferKeyofType,Ta as inferMappedType,n as inferNarrowType,Rt as inferNarrowTypeInUnion,Ze as inferObjectType,Pa as inferTemplateLiteralTypeAdvanced,Fa as inferTypeofType,Ra as isComplexType,ke as isGenericType,La as isIndexedAccessType,re as parseArrayElements,ea as parseTypeParameters,Oa as parseUtilityType,Ma as simplifyComplexType};
|