@dtsx/dtsx 0.0.0-stage → 0.11.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-082w7zvy.js +4 -0
- package/dist/chunk-0k0fhq13.js +19 -0
- package/dist/chunk-0rmbc5zp.js +3 -0
- package/dist/chunk-0yg5mcrf.js +3 -0
- package/dist/chunk-0zfzhn19.js +31 -0
- package/dist/chunk-189nn4fc.js +3 -0
- package/dist/chunk-1j6092xz.js +7 -0
- package/dist/chunk-1qtghb2x.js +3 -0
- package/dist/chunk-2436cnmb.js +3 -0
- package/dist/chunk-2qd3axyx.js +5 -0
- package/dist/chunk-32qexm3w.js +3 -0
- package/dist/chunk-3fbt79hx.js +3 -0
- package/dist/chunk-3t57mzvf.js +3 -0
- package/dist/chunk-42j9cfte.js +3 -0
- package/dist/chunk-4fygcxtb.js +4 -0
- package/dist/chunk-50h54rax.js +177 -0
- package/dist/chunk-5hyv43ps.js +12 -0
- package/dist/chunk-6yvk3q1e.js +3 -0
- package/dist/chunk-73dzve1s.js +3 -0
- package/dist/chunk-7tremqhs.js +14 -0
- package/dist/chunk-83qnrx0m.js +7 -0
- package/dist/chunk-88gwzbew.js +4 -0
- package/dist/chunk-8d3sdkv4.js +24 -0
- package/dist/chunk-8tzd98q8.js +22 -0
- package/dist/chunk-96atbsd3.js +3 -0
- package/dist/chunk-9gts9ymh.js +3 -0
- package/dist/chunk-9menejdz.js +3 -0
- package/dist/chunk-a7nvyxpg.js +6 -0
- package/dist/chunk-ag1b6d30.js +3 -0
- package/dist/chunk-asws39qs.js +31 -0
- package/dist/chunk-bnry23ve.js +4 -0
- package/dist/chunk-bxc2herz.js +9 -0
- package/dist/chunk-cpmqa8kd.js +4 -0
- package/dist/chunk-cv29b4zb.js +7 -0
- package/dist/chunk-cyr45de1.js +8 -0
- package/dist/chunk-d0bazr3p.js +3 -0
- package/dist/chunk-danfamyx.js +3 -0
- package/dist/chunk-davy89dj.js +8 -0
- package/dist/chunk-e29rp5xj.js +7 -0
- package/dist/chunk-eba562w8.js +9 -0
- package/dist/chunk-ebjafajx.js +62 -0
- package/dist/chunk-ft2zk7jx.js +3 -0
- package/dist/chunk-g2120ysy.js +3 -0
- package/dist/chunk-ghfd34r7.js +3 -0
- package/dist/chunk-gspsxc9d.js +34 -0
- package/dist/chunk-h3n6256r.js +3 -0
- package/dist/chunk-hnqm1zb3.js +5 -0
- package/dist/chunk-htgy94y3.js +2 -0
- package/dist/chunk-hv8bx8xx.js +102 -0
- package/dist/chunk-hzn9kmq7.js +3 -0
- package/dist/chunk-ja7bp731.js +3 -0
- package/dist/chunk-jcckwgb9.js +3 -0
- package/dist/chunk-kfk554fj.js +3 -0
- package/dist/chunk-kkshxyex.js +18 -0
- package/dist/chunk-kpbz61yy.js +4 -0
- package/dist/chunk-mkakbjvs.js +3 -0
- package/dist/chunk-mwyjxjqa.js +3 -0
- package/dist/chunk-p023fhce.js +8 -0
- package/dist/chunk-p9vfxn8g.js +3 -0
- package/dist/chunk-pga5m4wm.js +3 -0
- package/dist/chunk-pjqzkgzk.js +6 -0
- package/dist/chunk-qzjzw9p2.js +3 -0
- package/dist/chunk-rbx6q1r0.js +18 -0
- package/dist/chunk-rkstz4w1.js +6 -0
- package/dist/chunk-rz060wxt.js +6 -0
- package/dist/chunk-sd8bywh9.js +21 -0
- package/dist/chunk-sv8h007a.js +3 -0
- package/dist/chunk-t4va49p3.js +10 -0
- package/dist/chunk-tka2m4af.js +7 -0
- package/dist/chunk-v6fwy63g.js +3 -0
- package/dist/chunk-v93389xm.js +3 -0
- package/dist/chunk-vf3ybe5r.js +3 -0
- package/dist/chunk-vkahj2ab.js +10 -0
- package/dist/chunk-wnqg6hem.js +27 -0
- package/dist/chunk-xa6rsd4b.js +29 -0
- package/dist/chunk-xfjfhe9d.js +3 -0
- package/dist/chunk-xwpn40p0.js +6 -0
- package/dist/chunk-y1g6v96c.js +10 -0
- package/dist/chunk-y5k0szq6.js +3 -0
- package/dist/chunk-yay68832.js +3 -0
- package/dist/chunk-yrv6z221.js +3 -0
- package/dist/chunk-yx1jy7fx.js +37 -0
- package/dist/chunk-zgcdx773.js +4 -0
- package/dist/chunk-zk3w5sqv.js +4 -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,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"../chunk-zq93f8ca.js";import"../chunk-1j6092xz.js";import"../chunk-42j9cfte.js";import"../chunk-ag1b6d30.js";import"../chunk-zk3w5sqv.js";import{f}from"../chunk-cv29b4zb.js";import"../chunk-32qexm3w.js";import"../chunk-0rmbc5zp.js";import{n,Ot,ke,oe,et,o,tt,Ae,j}from"../chunk-8d3sdkv4.js";import{ee,h,te,ne,re,ie,On,In,se}from"../chunk-xa6rsd4b.js";import{Wn}from"../chunk-3t57mzvf.js";import{Ln,y}from"../chunk-vf3ybe5r.js";import"../chunk-4fygcxtb.js";import{l}from"../chunk-y1g6v96c.js";export{Wn as clearProcessorCaches,y as extractAllImportedItems,j as extractSatisfiesType,o as findMatchingBracket,f as formatComments,ke as inferArrayType,tt as inferFunctionType,n as inferNarrowType,Ot as inferNarrowTypeInUnion,et as inferObjectType,Ae as isGenericType,oe as parseArrayElements,Ln as parseImportStatement,re as processClassDeclaration,l as processDeclarations,ie as processEnumDeclaration,In as processExportDeclaration,ee as processFunctionDeclaration,On as processImportDeclaration,te as processInterfaceDeclaration,se as processModuleDeclaration,ne as processTypeDeclaration,h as processVariableDeclaration};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { ProfilingConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a new profiler instance
|
|
4
|
+
*/
|
|
5
|
+
export declare function createProfiler(config?: ProfilingConfig): Profiler;
|
|
6
|
+
/**
|
|
7
|
+
* Profile a function execution
|
|
8
|
+
*/
|
|
9
|
+
export declare function profileExecution<T>(fn: () => T | Promise<T>, config?: ProfilingConfig): Promise<{ result: T, profile: ProfilingResults }>;
|
|
10
|
+
/**
|
|
11
|
+
* Create a profiled I/O wrapper
|
|
12
|
+
*/
|
|
13
|
+
export declare function createProfiledIo(profiler: Profiler): {
|
|
14
|
+
read: <T>(path: string, fn: () => Promise<T>) => Promise<T>
|
|
15
|
+
write: (path: string, fn: () => Promise<void>, size: number) => Promise<void>
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Create a simple timer
|
|
19
|
+
*/
|
|
20
|
+
export declare function createTimer(): Timer;
|
|
21
|
+
/**
|
|
22
|
+
* Memory profiling data snapshot
|
|
23
|
+
*/
|
|
24
|
+
export declare interface MemoryProfileSnapshot {
|
|
25
|
+
timestamp: number
|
|
26
|
+
heapUsed: number
|
|
27
|
+
heapTotal: number
|
|
28
|
+
external: number
|
|
29
|
+
arrayBuffers: number
|
|
30
|
+
rss: number
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* CPU profiling data
|
|
34
|
+
*/
|
|
35
|
+
export declare interface CpuProfile {
|
|
36
|
+
timestamp: number
|
|
37
|
+
user: number
|
|
38
|
+
system: number
|
|
39
|
+
total: number
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* I/O operation record
|
|
43
|
+
*/
|
|
44
|
+
export declare interface IoOperation {
|
|
45
|
+
timestamp: number
|
|
46
|
+
operation: 'read' | 'write'
|
|
47
|
+
path: string
|
|
48
|
+
size: number
|
|
49
|
+
durationMs: number
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Profiling results
|
|
53
|
+
*/
|
|
54
|
+
export declare interface ProfilingResults {
|
|
55
|
+
startTime: number
|
|
56
|
+
endTime: number
|
|
57
|
+
durationMs: number
|
|
58
|
+
memory: {
|
|
59
|
+
samples: MemoryProfileSnapshot[]
|
|
60
|
+
peak: MemoryProfileSnapshot
|
|
61
|
+
average: MemoryProfileSnapshot
|
|
62
|
+
warnings: string[]
|
|
63
|
+
}
|
|
64
|
+
cpu: {
|
|
65
|
+
samples: CpuProfile[]
|
|
66
|
+
totalUser: number
|
|
67
|
+
totalSystem: number
|
|
68
|
+
}
|
|
69
|
+
io: {
|
|
70
|
+
operations: IoOperation[]
|
|
71
|
+
totalReads: number
|
|
72
|
+
totalWrites: number
|
|
73
|
+
totalReadBytes: number
|
|
74
|
+
totalWriteBytes: number
|
|
75
|
+
totalReadMs: number
|
|
76
|
+
totalWriteMs: number
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Profiler class for collecting performance data
|
|
81
|
+
*/
|
|
82
|
+
export declare class Profiler {
|
|
83
|
+
private config;
|
|
84
|
+
private memorySamples;
|
|
85
|
+
private cpuSamples;
|
|
86
|
+
private ioOperations;
|
|
87
|
+
private startTime;
|
|
88
|
+
private memoryInterval;
|
|
89
|
+
private cpuInterval;
|
|
90
|
+
private lastCpuUsage;
|
|
91
|
+
private isRunning;
|
|
92
|
+
constructor(config?: ProfilingConfig);
|
|
93
|
+
start(): void;
|
|
94
|
+
stop(): void;
|
|
95
|
+
private sampleMemory;
|
|
96
|
+
private sampleCpu;
|
|
97
|
+
recordIo(operation: 'read' | 'write', path: string, size: number, durationMs: number): void;
|
|
98
|
+
getResults(): ProfilingResults;
|
|
99
|
+
formatResults(): string;
|
|
100
|
+
writeResults(): Promise<void>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Simple timer for manual profiling
|
|
104
|
+
*/
|
|
105
|
+
export declare class Timer {
|
|
106
|
+
private marks;
|
|
107
|
+
private durations;
|
|
108
|
+
mark(name: string): void;
|
|
109
|
+
measure(name: string, fromMark: string): number;
|
|
110
|
+
getDurations(name: string): number[];
|
|
111
|
+
getAverage(name: string): number;
|
|
112
|
+
getSummary(): Map<string, { count: number, total: number, average: number, min: number, max: number }>;
|
|
113
|
+
clear(): void;
|
|
114
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Declaration } from './types.js';
|
|
2
|
+
/** Retain local declaration scope without exporting implementation names. */
|
|
3
|
+
export declare function createReturnTypeScope(body: string, filename: string, freshName: () => string, retain: (declaration: Declaration) => void, generics?: string): { resolve: (type: string, position: number) => string, finish: (signature: string) => string };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{bi}from"../chunk-yx1jy7fx.js";import"../chunk-cyr45de1.js";import"../chunk-xfjfhe9d.js";import"../chunk-xa6rsd4b.js";import"../chunk-ft2zk7jx.js";import"../chunk-vf3ybe5r.js";import"../chunk-3t57mzvf.js";import"../chunk-ag1b6d30.js";import"../chunk-8d3sdkv4.js";import"../chunk-cv29b4zb.js";import"../chunk-32qexm3w.js";import"../chunk-0rmbc5zp.js";import"../chunk-42j9cfte.js";import"../chunk-1qtghb2x.js";import"../chunk-1j6092xz.js";import"../chunk-zq93f8ca.js";export{bi as createReturnTypeScope};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate that a path is safe and within the allowed root directory
|
|
3
|
+
*/
|
|
4
|
+
export declare function validatePath(filePath: string, config?: SecurityConfig): string;
|
|
5
|
+
/**
|
|
6
|
+
* Validate multiple paths
|
|
7
|
+
*/
|
|
8
|
+
export declare function validatePaths(filePaths: string[], config?: SecurityConfig): string[];
|
|
9
|
+
/**
|
|
10
|
+
* Check if a path matches any blocked pattern
|
|
11
|
+
*/
|
|
12
|
+
export declare function isBlockedPath(filePath: string, config?: SecurityConfig): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Validate file size
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateFileSize(filePath: string, config?: SecurityConfig): Promise<number>;
|
|
17
|
+
/**
|
|
18
|
+
* Check if path is a symbolic link
|
|
19
|
+
*/
|
|
20
|
+
export declare function isSymlink(filePath: string): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Validate that a path is not a symlink (or follow it if allowed)
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateSymlink(filePath: string, config?: SecurityConfig): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Full path validation including all security checks
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateFilePath(filePath: string, config?: SecurityConfig): Promise<{ path: string, size: number }>;
|
|
29
|
+
/**
|
|
30
|
+
* Validate a batch of files with total size limit
|
|
31
|
+
*/
|
|
32
|
+
export declare function validateFileBatch(filePaths: string[], config?: SecurityConfig): Promise<{ paths: string[], totalSize: number }>;
|
|
33
|
+
/**
|
|
34
|
+
* Create a timeout wrapper for async operations
|
|
35
|
+
*/
|
|
36
|
+
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, operation?: string): Promise<T>;
|
|
37
|
+
/**
|
|
38
|
+
* Create a secure file processor with all protections
|
|
39
|
+
*/
|
|
40
|
+
export declare function createSecureProcessor<T>(processor: (filePath: string) => Promise<T>, config?: SecurityConfig): (filePath: string) => Promise<T>;
|
|
41
|
+
/**
|
|
42
|
+
* Create a secure batch processor
|
|
43
|
+
*/
|
|
44
|
+
export declare function createSecureBatchProcessor<T>(processor: (filePaths: string[]) => Promise<T>, config?: SecurityConfig): (filePaths: string[]) => Promise<T>;
|
|
45
|
+
/**
|
|
46
|
+
* Sanitize a filename to prevent path traversal
|
|
47
|
+
*/
|
|
48
|
+
export declare function sanitizeFilename(filename: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Check if a path is safe (doesn't contain traversal sequences)
|
|
51
|
+
*/
|
|
52
|
+
export declare function isSafePath(path: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Create security middleware for the generator
|
|
55
|
+
*/
|
|
56
|
+
export declare function createSecurityMiddleware(config?: SecurityConfig): {
|
|
57
|
+
validatePath: (filePath: string) => string
|
|
58
|
+
validatePaths: (filePaths: string[]) => string[]
|
|
59
|
+
validateFile: (filePath: string) => Promise<{ path: string, size: number }>
|
|
60
|
+
validateBatch: (filePaths: string[]) => Promise<{ paths: string[], totalSize: number }>
|
|
61
|
+
withTimeout: <T>(promise: Promise<T>, operation?: string) => Promise<T>
|
|
62
|
+
secureProcessor: <T>(processor: (filePath: string) => Promise<T>) => (filePath: string) => Promise<T>
|
|
63
|
+
isBlocked: (filePath: string) => boolean
|
|
64
|
+
getConfig: () => Required<SecurityConfig>
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Default security configuration
|
|
68
|
+
*/
|
|
69
|
+
export declare const DEFAULT_SECURITY_CONFIG: Required<SecurityConfig>;
|
|
70
|
+
/**
|
|
71
|
+
* Security configuration options
|
|
72
|
+
*/
|
|
73
|
+
export declare interface SecurityConfig {
|
|
74
|
+
rootDir?: string
|
|
75
|
+
maxFileSize?: number
|
|
76
|
+
maxTotalSize?: number
|
|
77
|
+
timeout?: number
|
|
78
|
+
followSymlinks?: boolean
|
|
79
|
+
maxFiles?: number
|
|
80
|
+
blockedPatterns?: string[]
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Security error codes
|
|
84
|
+
*/
|
|
85
|
+
export type SecurityErrorCode = | 'PATH_TRAVERSAL'
|
|
86
|
+
| 'FILE_TOO_LARGE'
|
|
87
|
+
| 'TOTAL_SIZE_EXCEEDED'
|
|
88
|
+
| 'TIMEOUT'
|
|
89
|
+
| 'SYMLINK_NOT_ALLOWED'
|
|
90
|
+
| 'MAX_FILES_EXCEEDED'
|
|
91
|
+
| 'BLOCKED_PATTERN'
|
|
92
|
+
| 'INVALID_PATH';
|
|
93
|
+
/**
|
|
94
|
+
* Security validation error
|
|
95
|
+
*/
|
|
96
|
+
export declare class SecurityError extends Error {
|
|
97
|
+
public readonly code: SecurityErrorCode;
|
|
98
|
+
public readonly path?: string;
|
|
99
|
+
constructor(message: string, code: SecurityErrorCode, path?: string);
|
|
100
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{L,C,Be,Fr,en,Lr,Nr,Br,ut,tn,ft,Wr,Us,zs,Hs,Ks}from"../chunk-h3n6256r.js";export{L as DEFAULT_SECURITY_CONFIG,C as SecurityError,Us as createSecureBatchProcessor,Wr as createSecureProcessor,Ks as createSecurityMiddleware,en as isBlockedPath,Hs as isSafePath,Nr as isSymlink,zs as sanitizeFilename,tn as validateFileBatch,ut as validateFilePath,Lr as validateFileSize,Be as validatePath,Fr as validatePaths,Br as validateSymlink,ft as withTimeout};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare function getSourceFile(filePath: string, sourceCode: string, contentHash?: number | bigint): CachedSourceFile;
|
|
2
|
+
export declare function getSourceFileAsync(filePath: string, sourceCode: string, config?: AsyncParseConfig): Promise<CachedSourceFile>;
|
|
3
|
+
export declare function batchParseSourceFiles(files: Array<{ filePath: string, sourceCode: string }>, config?: AsyncParseConfig & { concurrency?: number }): Promise<Map<string, CachedSourceFile>>;
|
|
4
|
+
export declare function clearSourceFileCache(): void;
|
|
5
|
+
export declare function getSourceFileCacheSize(): number;
|
|
6
|
+
export declare function getPendingParseCount(): number;
|
|
7
|
+
export declare function shouldUseAsyncParsing(sourceCode: string, config?: AsyncParseConfig): boolean;
|
|
8
|
+
export declare interface CachedSourceFile {
|
|
9
|
+
fileName: string
|
|
10
|
+
text: string
|
|
11
|
+
}
|
|
12
|
+
export declare interface AsyncParseConfig {
|
|
13
|
+
asyncThreshold?: number
|
|
14
|
+
chunkSize?: number
|
|
15
|
+
yieldInterval?: number
|
|
16
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{At,Q,kn,Tn,An,Pn,Dn}from"../chunk-3fbt79hx.js";import"../chunk-pga5m4wm.js";import"../chunk-v6fwy63g.js";export{kn as batchParseSourceFiles,Tn as clearSourceFileCache,Pn as getPendingParseCount,At as getSourceFile,Q as getSourceFileAsync,An as getSourceFileCacheSize,Dn as shouldUseAsyncParsing};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create source map for generated .d.ts content
|
|
3
|
+
*/
|
|
4
|
+
export declare function createSourceMap(options: {
|
|
5
|
+
generatedFile: string
|
|
6
|
+
sourceFile: string
|
|
7
|
+
sourceContent?: string
|
|
8
|
+
sourceRoot?: string
|
|
9
|
+
mappings: Array<{
|
|
10
|
+
generatedLine: number
|
|
11
|
+
generatedColumn: number
|
|
12
|
+
originalLine: number
|
|
13
|
+
originalColumn: number
|
|
14
|
+
name?: string
|
|
15
|
+
}>
|
|
16
|
+
}): SourceMapGenerator;
|
|
17
|
+
/**
|
|
18
|
+
* Append source map comment to content
|
|
19
|
+
*/
|
|
20
|
+
export declare function appendSourceMapComment(content: string, mapFileName: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Append inline source map to content
|
|
23
|
+
*/
|
|
24
|
+
export declare function appendInlineSourceMap(content: string, generator: SourceMapGenerator, includeContent?: boolean): string;
|
|
25
|
+
/**
|
|
26
|
+
* Write source map file
|
|
27
|
+
*/
|
|
28
|
+
export declare function writeSourceMap(mapPath: string, generator: SourceMapGenerator, includeContent?: boolean): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Read and parse source map file
|
|
31
|
+
*/
|
|
32
|
+
export declare function readSourceMap(mapPath: string): Promise<SourceMapConsumer>;
|
|
33
|
+
/**
|
|
34
|
+
* Extract source map from content (inline or reference)
|
|
35
|
+
*/
|
|
36
|
+
export declare function extractSourceMap(content: string, filePath: string): Promise<SourceMapConsumer | null>;
|
|
37
|
+
/**
|
|
38
|
+
* Build source mappings from declaration info
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildDeclarationMappings(_generatedContent: string, _declarationInfos: Array<{
|
|
41
|
+
name: string
|
|
42
|
+
generatedStart: number
|
|
43
|
+
originalLine: number
|
|
44
|
+
originalColumn: number
|
|
45
|
+
}>): Array<{
|
|
46
|
+
generatedLine: number
|
|
47
|
+
generatedColumn: number
|
|
48
|
+
originalLine: number
|
|
49
|
+
originalColumn: number
|
|
50
|
+
name: string
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Source map configuration
|
|
54
|
+
*/
|
|
55
|
+
export declare interface SourceMapConfig {
|
|
56
|
+
sourceMap?: boolean
|
|
57
|
+
inlineSourceMap?: boolean
|
|
58
|
+
inlineSources?: boolean
|
|
59
|
+
sourceRoot?: string
|
|
60
|
+
mapExtension?: string
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Source map v3 format
|
|
64
|
+
*/
|
|
65
|
+
export declare interface SourceMapV3 {
|
|
66
|
+
version: 3
|
|
67
|
+
file: string
|
|
68
|
+
sourceRoot?: string
|
|
69
|
+
sources: string[]
|
|
70
|
+
sourcesContent?: (string | null)[]
|
|
71
|
+
names: string[]
|
|
72
|
+
mappings: string
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Source position
|
|
76
|
+
*/
|
|
77
|
+
export declare interface SourcePosition {
|
|
78
|
+
line: number
|
|
79
|
+
column: number
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Mapping entry
|
|
83
|
+
*/
|
|
84
|
+
export declare interface Mapping {
|
|
85
|
+
generated: SourcePosition
|
|
86
|
+
original: SourcePosition
|
|
87
|
+
sourceIndex: number
|
|
88
|
+
nameIndex?: number
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Source map generator
|
|
92
|
+
*/
|
|
93
|
+
export declare class SourceMapGenerator {
|
|
94
|
+
private file;
|
|
95
|
+
private sourceRoot;
|
|
96
|
+
private sources;
|
|
97
|
+
private sourcesContent;
|
|
98
|
+
private names;
|
|
99
|
+
private mappings;
|
|
100
|
+
private sourceIndexMap;
|
|
101
|
+
private nameIndexMap;
|
|
102
|
+
constructor(options: { file: string, sourceRoot?: string });
|
|
103
|
+
addSource(source: string, content?: string): number;
|
|
104
|
+
addName(name: string): number;
|
|
105
|
+
addMapping(mapping: {
|
|
106
|
+
generated: SourcePosition
|
|
107
|
+
original: SourcePosition
|
|
108
|
+
source: string
|
|
109
|
+
name?: string
|
|
110
|
+
}): void;
|
|
111
|
+
generate(includeContent?: boolean): SourceMapV3;
|
|
112
|
+
private encodeMappings;
|
|
113
|
+
toString(includeContent?: boolean): string;
|
|
114
|
+
toDataUrl(includeContent?: boolean): string;
|
|
115
|
+
toComment(includeContent?: boolean): string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Source map consumer for reading source maps
|
|
119
|
+
*/
|
|
120
|
+
export declare class SourceMapConsumer {
|
|
121
|
+
private map;
|
|
122
|
+
private decodedMappings;
|
|
123
|
+
constructor(map: SourceMapV3 | string);
|
|
124
|
+
originalPositionFor(generated: SourcePosition): {
|
|
125
|
+
source: string | null
|
|
126
|
+
line: number | null
|
|
127
|
+
column: number | null
|
|
128
|
+
name: string | null
|
|
129
|
+
};
|
|
130
|
+
generatedPositionFor(original: {
|
|
131
|
+
source: string
|
|
132
|
+
line: number
|
|
133
|
+
column: number
|
|
134
|
+
}): SourcePosition | null;
|
|
135
|
+
private getMappings;
|
|
136
|
+
sourceContentFor(source: string): string | null;
|
|
137
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Xt,lt,Ds,Rs,Ms,Os,Ir,Is,Fs}from"../chunk-pjqzkgzk.js";export{lt as SourceMapConsumer,Xt as SourceMapGenerator,Ms as appendInlineSourceMap,Rs as appendSourceMapComment,Fs as buildDeclarationMappings,Ds as createSourceMap,Is as extractSourceMap,Ir as readSourceMap,Os as writeSourceMap};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Check whether a file path points at an STX component. */
|
|
2
|
+
export declare function isStxFile(filePath: string): boolean;
|
|
3
|
+
/** Collect all declaration-bearing STX blocks in document order. */
|
|
4
|
+
export declare function parseStxScripts(source: string): StxScriptBlock[];
|
|
5
|
+
/**
|
|
6
|
+
* Transform an STX component into a virtual TypeScript module.
|
|
7
|
+
*
|
|
8
|
+
* The output deliberately imports STX's own Vue-compatible `DefineComponent`
|
|
9
|
+
* type. This makes generated declarations consumable without a Vue dependency
|
|
10
|
+
* and exposes `$props` to STX's component utility types and call-site tooling.
|
|
11
|
+
*/
|
|
12
|
+
export declare function transformStxToTs(source: string): string;
|
|
13
|
+
export declare interface StxScriptBlock {
|
|
14
|
+
content: string
|
|
15
|
+
kind: 'script' | 'ts'
|
|
16
|
+
attrs: string
|
|
17
|
+
context: 'server' | 'client' | 'universal'
|
|
18
|
+
lang: string
|
|
19
|
+
start: number
|
|
20
|
+
}
|
package/dist/src/stx.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Declaration, TrackingConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a new tracker instance
|
|
4
|
+
*/
|
|
5
|
+
export declare function createTracker(config?: TrackingConfig): Tracker;
|
|
6
|
+
/**
|
|
7
|
+
* Track declarations from a file
|
|
8
|
+
*/
|
|
9
|
+
export declare function trackDeclarations(declarations: Declaration[], file: string, tracker: Tracker): void;
|
|
10
|
+
/**
|
|
11
|
+
* Analyze imports for a set of files
|
|
12
|
+
*/
|
|
13
|
+
export declare function analyzeImports(fileDeclarations: Map<string, Declaration[]>, config?: TrackingConfig): TrackingResults;
|
|
14
|
+
/**
|
|
15
|
+
* Analyze types for a set of files
|
|
16
|
+
*/
|
|
17
|
+
export declare function analyzeTypes(fileDeclarations: Map<string, Declaration[]>, config?: TrackingConfig): TrackingResults;
|
|
18
|
+
/**
|
|
19
|
+
* Type information tracked during processing
|
|
20
|
+
*/
|
|
21
|
+
export declare interface TrackedType {
|
|
22
|
+
name: string
|
|
23
|
+
kind: 'interface' | 'type' | 'class' | 'enum'
|
|
24
|
+
file: string
|
|
25
|
+
line?: number
|
|
26
|
+
usedBy: Set<string>
|
|
27
|
+
references: Set<string>
|
|
28
|
+
extendsFrom?: string[]
|
|
29
|
+
implementsFrom?: string[]
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Import information tracked during processing
|
|
33
|
+
*/
|
|
34
|
+
export declare interface TrackedImport {
|
|
35
|
+
source: string
|
|
36
|
+
specifiers: string[]
|
|
37
|
+
isTypeOnly: boolean
|
|
38
|
+
file: string
|
|
39
|
+
usedSpecifiers: Set<string>
|
|
40
|
+
unusedSpecifiers: Set<string>
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Type relationship information
|
|
44
|
+
*/
|
|
45
|
+
export declare interface TypeRelationship {
|
|
46
|
+
from: string
|
|
47
|
+
to: string
|
|
48
|
+
kind: 'extends' | 'implements' | 'references' | 'uses'
|
|
49
|
+
file: string
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Tracking results from analysis
|
|
53
|
+
*/
|
|
54
|
+
export declare interface TrackingResults {
|
|
55
|
+
types: Map<string, TrackedType>
|
|
56
|
+
imports: Map<string, TrackedImport[]>
|
|
57
|
+
relationships: TypeRelationship[]
|
|
58
|
+
unusedTypes: string[]
|
|
59
|
+
unusedImports: TrackedImport[]
|
|
60
|
+
circularReferences: string[][]
|
|
61
|
+
statistics: TrackingStatistics
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Tracking statistics
|
|
65
|
+
*/
|
|
66
|
+
export declare interface TrackingStatistics {
|
|
67
|
+
totalTypes: number
|
|
68
|
+
usedTypes: number
|
|
69
|
+
unusedTypes: number
|
|
70
|
+
totalImports: number
|
|
71
|
+
usedImports: number
|
|
72
|
+
unusedImports: number
|
|
73
|
+
totalRelationships: number
|
|
74
|
+
circularDependencies: number
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Tracker class for collecting type and import information
|
|
78
|
+
*/
|
|
79
|
+
export declare class Tracker {
|
|
80
|
+
private config;
|
|
81
|
+
private types;
|
|
82
|
+
private imports;
|
|
83
|
+
private relationships;
|
|
84
|
+
private usageMap;
|
|
85
|
+
constructor(config?: TrackingConfig);
|
|
86
|
+
trackType(decl: Declaration, file: string): void;
|
|
87
|
+
trackTypeUsage(typeName: string, usedBy: string, file: string): void;
|
|
88
|
+
trackImport(source: string, specifiers: string[], isTypeOnly: boolean, file: string): void;
|
|
89
|
+
trackImportUsage(specifier: string, file: string): void;
|
|
90
|
+
trackTypeReference(typeName: string, file: string): void;
|
|
91
|
+
getResults(): TrackingResults;
|
|
92
|
+
private detectCircularReferences;
|
|
93
|
+
clear(): void;
|
|
94
|
+
formatResults(): string;
|
|
95
|
+
}
|