@stacksjs/dtsx 0.9.8 → 0.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +243 -15
- package/dist/bin/cli.js +10 -22
- package/dist/branded-types.d.ts +168 -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-09zp67d8.js +6 -0
- package/dist/chunk-0kmfaaz6.js +2 -0
- package/dist/chunk-1mm3t0nr.js +3 -0
- package/dist/chunk-2f046tgr.js +2 -0
- package/dist/chunk-3g2v2ns2.js +2 -0
- package/dist/chunk-3j7r0fxz.js +2 -0
- package/dist/chunk-3mxzfgcv.js +75 -0
- package/dist/chunk-4ev1n7r7.js +3 -0
- package/dist/chunk-57agx6g8.js +3 -0
- package/dist/chunk-6ppqaypd.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-9a3jfxnc.js +3 -0
- package/dist/chunk-9mjc7ddv.js +19 -0
- package/dist/chunk-axb2kjeq.js +2 -0
- package/dist/chunk-bn29kee5.js +102 -0
- package/dist/chunk-c18vx9sq.js +2 -0
- package/dist/chunk-d0p3jzwb.js +34 -0
- package/dist/chunk-dk2vv0np.js +15 -0
- package/dist/chunk-e3j9tecw.js +3 -0
- package/dist/chunk-f18nyrrb.js +32 -0
- package/dist/chunk-fbqcsr60.js +22 -0
- package/dist/chunk-ffqpf34b.js +3 -0
- package/dist/chunk-fw6wcdfd.js +4 -0
- package/dist/chunk-h12gdfk9.js +2 -0
- package/dist/chunk-j22v8wfe.js +33 -0
- package/dist/chunk-jm5ywn4e.js +13 -0
- package/dist/chunk-jvz9t6pq.js +2 -0
- package/dist/chunk-k5h5ppp5.js +2 -0
- package/dist/chunk-p1d09y82.js +449 -0
- package/dist/chunk-pyxbb193.js +2 -0
- package/dist/chunk-q75q4w1s.js +3 -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-rrkq4k1n.js +2 -0
- package/dist/chunk-rw6j20e2.js +3 -0
- package/dist/chunk-v96rjx7x.js +134 -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 +148 -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
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enable clean default collection for the next type inference pass.
|
|
3
|
+
* Must be called before inferNarrowType when you need a @defaultValue.
|
|
4
|
+
*/
|
|
5
|
+
export declare function enableCleanDefaultCollection(): void;
|
|
6
|
+
/**
|
|
7
|
+
* Consume the computed clean default (also disables collection).
|
|
8
|
+
* Returns null if no clean default was computed.
|
|
9
|
+
*/
|
|
10
|
+
export declare function consumeCleanDefault(): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Infer and narrow types from values
|
|
13
|
+
* @param inUnion - When true, widens number/boolean literals to their base types (used in array union contexts)
|
|
14
|
+
* @param _depth - Internal recursion depth counter (do not set manually)
|
|
15
|
+
*/
|
|
16
|
+
export declare function inferNarrowType(value: unknown, isConst?: boolean, inUnion?: boolean, _depth?: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* Infer and narrow types from values in union context (for arrays)
|
|
19
|
+
* Widens number/boolean literals to base types unless const
|
|
20
|
+
*/
|
|
21
|
+
export declare function inferNarrowTypeInUnion(value: unknown, isConst?: boolean, _depth?: number): string;
|
|
22
|
+
/**
|
|
23
|
+
* Infer array type from array literal
|
|
24
|
+
*/
|
|
25
|
+
export declare function inferArrayType(value: string, isConst: boolean, _depth?: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* Parse array elements handling nested structures
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseArrayElements(content: string): string[];
|
|
30
|
+
/**
|
|
31
|
+
* Infer object type from object literal
|
|
32
|
+
*/
|
|
33
|
+
export declare function inferObjectType(value: string, isConst: boolean, _depth?: number): string;
|
|
34
|
+
/**
|
|
35
|
+
* Clean parameter defaults from function parameters
|
|
36
|
+
*/
|
|
37
|
+
export declare function cleanParameterDefaults(params: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Find matching bracket for nested structures
|
|
40
|
+
*/
|
|
41
|
+
export declare function findMatchingBracket(str: string, start: number, openChar: string, closeChar: string): number;
|
|
42
|
+
/**
|
|
43
|
+
* Infer function type from function expression
|
|
44
|
+
*/
|
|
45
|
+
export declare function inferFunctionType(value: string, inUnion?: boolean, _depth?: number, isConst?: boolean): string;
|
|
46
|
+
/**
|
|
47
|
+
* Check if a type annotation is a generic/broad type that should be replaced with narrow inference
|
|
48
|
+
*/
|
|
49
|
+
export declare function isGenericType(typeAnnotation: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Extract type from 'satisfies' operator
|
|
52
|
+
* e.g., "{ port: 3000 } satisfies { port: number }" returns "{ port: number }"
|
|
53
|
+
*/
|
|
54
|
+
export declare function extractSatisfiesType(value: string): string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Infer mapped type from type expression
|
|
57
|
+
* Handles patterns like { [K in keyof T]: V }
|
|
58
|
+
*/
|
|
59
|
+
export declare function inferMappedType(typeStr: string): string | null;
|
|
60
|
+
/**
|
|
61
|
+
* Infer conditional type from type expression
|
|
62
|
+
* Handles patterns like T extends U ? X : Y
|
|
63
|
+
*/
|
|
64
|
+
export declare function inferConditionalType(typeStr: string): string | null;
|
|
65
|
+
/**
|
|
66
|
+
* Infer template literal type from type expression
|
|
67
|
+
* Handles patterns like `${string}-${number}`
|
|
68
|
+
*/
|
|
69
|
+
export declare function inferTemplateLiteralTypeAdvanced(typeStr: string): string | null;
|
|
70
|
+
/**
|
|
71
|
+
* Infer infer keyword usage in conditional types
|
|
72
|
+
* Handles patterns like T extends (infer U)[] ? U : never
|
|
73
|
+
*/
|
|
74
|
+
export declare function extractInferTypes(typeStr: string): string[];
|
|
75
|
+
/**
|
|
76
|
+
* Check if a type uses advanced TypeScript features
|
|
77
|
+
*/
|
|
78
|
+
export declare function isComplexType(_typeStr: string): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Simplify complex type for declaration output
|
|
81
|
+
* Returns simplified version if too complex
|
|
82
|
+
*/
|
|
83
|
+
export declare function simplifyComplexType(typeStr: string, maxDepth?: number): string;
|
|
84
|
+
/**
|
|
85
|
+
* Parse utility type and extract its parameters
|
|
86
|
+
* Handles Partial<T>, Required<T>, Pick<T, K>, Omit<T, K>, etc.
|
|
87
|
+
*/
|
|
88
|
+
export declare function parseUtilityType(typeStr: string): { name: string, params: string[] } | null;
|
|
89
|
+
/**
|
|
90
|
+
* Parse type parameters from a comma-separated string
|
|
91
|
+
* Handles nested types properly
|
|
92
|
+
*/
|
|
93
|
+
export declare function parseTypeParameters(paramsStr: string): string[];
|
|
94
|
+
/**
|
|
95
|
+
* Infer keyof type
|
|
96
|
+
*/
|
|
97
|
+
export declare function inferKeyofType(typeStr: string): string | null;
|
|
98
|
+
/**
|
|
99
|
+
* Infer typeof type
|
|
100
|
+
*/
|
|
101
|
+
export declare function inferTypeofType(typeStr: string): string | null;
|
|
102
|
+
/**
|
|
103
|
+
* Check if type is an indexed access type
|
|
104
|
+
* e.g., T[K], Person['name']
|
|
105
|
+
*/
|
|
106
|
+
export declare function isIndexedAccessType(typeStr: string): boolean;
|
package/dist/processor.d.ts
CHANGED
|
@@ -1,45 +1,5 @@
|
|
|
1
|
-
import type { Declaration, ProcessingContext } from './types';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* Processor module - re-exports from modular structure
|
|
3
|
+
* @deprecated Import from './processor/index' directly for better tree-shaking
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
/**
|
|
7
|
-
* Process function declaration to DTS format
|
|
8
|
-
*/
|
|
9
|
-
export declare function processFunctionDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
10
|
-
/**
|
|
11
|
-
* Process variable declaration to DTS format
|
|
12
|
-
*/
|
|
13
|
-
export declare function processVariableDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
14
|
-
/**
|
|
15
|
-
* Process interface declaration to DTS format
|
|
16
|
-
*/
|
|
17
|
-
export declare function processInterfaceDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
18
|
-
/**
|
|
19
|
-
* Process type alias declaration to DTS format
|
|
20
|
-
*/
|
|
21
|
-
export declare function processTypeDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
22
|
-
/**
|
|
23
|
-
* Process class declaration to DTS format
|
|
24
|
-
*/
|
|
25
|
-
export declare function processClassDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
26
|
-
/**
|
|
27
|
-
* Process enum declaration to DTS format
|
|
28
|
-
*/
|
|
29
|
-
export declare function processEnumDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
30
|
-
/**
|
|
31
|
-
* Process import statement
|
|
32
|
-
*/
|
|
33
|
-
export declare function processImportDeclaration(decl: Declaration): string;
|
|
34
|
-
/**
|
|
35
|
-
* Process export statement
|
|
36
|
-
*/
|
|
37
|
-
export declare function processExportDeclaration(decl: Declaration): string;
|
|
38
|
-
/**
|
|
39
|
-
* Process module/namespace declaration to DTS format
|
|
40
|
-
*/
|
|
41
|
-
export declare function processModuleDeclaration(decl: Declaration, keepComments?: boolean): string;
|
|
42
|
-
/**
|
|
43
|
-
* Infer and narrow types from values
|
|
44
|
-
*/
|
|
45
|
-
export declare function inferNarrowType(value: any, isConst?: boolean): string;
|
|
5
|
+
export * from './processor/index';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { ProfilingConfig } from './types';
|
|
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
|
+
constructor(config?: ProfilingConfig);
|
|
84
|
+
start(): void;
|
|
85
|
+
stop(): void;
|
|
86
|
+
recordIo(operation: 'read' | 'write', path: string, size: number, durationMs: number): void;
|
|
87
|
+
getResults(): ProfilingResults;
|
|
88
|
+
formatResults(): string;
|
|
89
|
+
writeResults(): Promise<void>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Simple timer for manual profiling
|
|
93
|
+
*/
|
|
94
|
+
export declare class Timer {
|
|
95
|
+
mark(name: string): void;
|
|
96
|
+
measure(name: string, fromMark: string): number;
|
|
97
|
+
getDurations(name: string): number[];
|
|
98
|
+
getAverage(name: string): number;
|
|
99
|
+
getSummary(): Map<string, { count: number, total: number, average: number, min: number, max: number }>;
|
|
100
|
+
clear(): void;
|
|
101
|
+
}
|
|
@@ -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,125 @@
|
|
|
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
|
+
constructor(options: { file: string, sourceRoot?: string });
|
|
95
|
+
addSource(source: string, content?: string): number;
|
|
96
|
+
addName(name: string): number;
|
|
97
|
+
addMapping(mapping: {
|
|
98
|
+
generated: SourcePosition
|
|
99
|
+
original: SourcePosition
|
|
100
|
+
source: string
|
|
101
|
+
name?: string
|
|
102
|
+
}): void;
|
|
103
|
+
generate(includeContent?: boolean): SourceMapV3;
|
|
104
|
+
toString(includeContent?: boolean): string;
|
|
105
|
+
toDataUrl(includeContent?: boolean): string;
|
|
106
|
+
toComment(includeContent?: boolean): string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Source map consumer for reading source maps
|
|
110
|
+
*/
|
|
111
|
+
export declare class SourceMapConsumer {
|
|
112
|
+
constructor(map: SourceMapV3 | string);
|
|
113
|
+
originalPositionFor(generated: SourcePosition): {
|
|
114
|
+
source: string | null
|
|
115
|
+
line: number | null
|
|
116
|
+
column: number | null
|
|
117
|
+
name: string | null
|
|
118
|
+
};
|
|
119
|
+
generatedPositionFor(original: {
|
|
120
|
+
source: string
|
|
121
|
+
line: number
|
|
122
|
+
column: number
|
|
123
|
+
}): SourcePosition | null;
|
|
124
|
+
sourceContentFor(source: string): string | null;
|
|
125
|
+
}
|