@stacksjs/dtsx 0.8.0 → 0.8.2
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 +12 -8
- package/dist/cli.js +273 -241
- package/dist/extract.d.ts +31 -35
- package/dist/index.js +39 -42
- package/dist/types.d.ts +1 -0
- package/package.json +26 -15
package/dist/extract.d.ts
CHANGED
|
@@ -2,26 +2,25 @@ import type { FunctionSignature, ImportTrackingState, ProcessedMethod, Processin
|
|
|
2
2
|
|
|
3
3
|
declare function cleanParameterTypes(params: string): string;
|
|
4
4
|
declare function cleanSingleParameter(param: string): string;
|
|
5
|
-
export declare function extractDtsTypes(sourceCode: string): string;
|
|
6
|
-
declare function extractFunctionSignature(declaration: string): FunctionSignature;
|
|
5
|
+
export declare function extractDtsTypes(sourceCode: string, verbose?: boolean | string[]): string;
|
|
6
|
+
declare function extractFunctionSignature(declaration: string, verbose?: boolean | string[]): FunctionSignature;
|
|
7
7
|
declare function extractFunctionName(declaration: string): string;
|
|
8
|
-
declare function extractGenerics(rest: string): void;
|
|
9
|
-
declare function extractParams(rest: string): void;
|
|
8
|
+
declare function extractGenerics(rest: string, verbose?: boolean | string[]): void;
|
|
9
|
+
declare function extractParams(rest: string, verbose?: boolean | string[]): void;
|
|
10
10
|
declare function extractReturnType(rest: string): void;
|
|
11
|
-
declare function extractFunctionType(value: string): string | null;
|
|
11
|
+
declare function extractFunctionType(value: string, verbose?: boolean | string[]): string | null;
|
|
12
12
|
declare function generateOptimizedImports(state: ImportTrackingState): string[];
|
|
13
|
-
declare function extractCompleteObjectContent(value: string): string | null;
|
|
13
|
+
declare function extractCompleteObjectContent(value: string, verbose?: boolean | string[]): string | null;
|
|
14
14
|
declare function formatOutput(state: ProcessingState): string;
|
|
15
15
|
declare function removeLeadingComments(code: string): string;
|
|
16
16
|
declare function createProcessingState(): ProcessingState;
|
|
17
17
|
declare function createImportTrackingState(): ImportTrackingState;
|
|
18
18
|
declare function indentMultilineType(type: string, baseIndent: string, isLast: boolean): string;
|
|
19
19
|
declare function inferValueType(value: string): string;
|
|
20
|
-
declare function inferArrayType(value: string, state?: ProcessingState, preserveLineBreaks): string;
|
|
21
|
-
declare function inferComplexObjectType(value: string, state?: ProcessingState, indentLevel): string;
|
|
22
|
-
declare function inferConstArrayType(value: string, state?: ProcessingState): string;
|
|
23
|
-
declare function inferConstType(value: string, state: ProcessingState): string;
|
|
24
|
-
declare function inferTypeFromDefaultValue(defaultValue: string): string;
|
|
20
|
+
declare function inferArrayType(value: string, state?: ProcessingState, preserveLineBreaks?: boolean, verbose?: boolean | string[]): string;
|
|
21
|
+
declare function inferComplexObjectType(value: string, state?: ProcessingState, indentLevel?: number, verbose?: boolean | string[]): string;
|
|
22
|
+
declare function inferConstArrayType(value: string, state?: ProcessingState, verbose?: boolean | string[]): string;
|
|
23
|
+
declare function inferConstType(value: string, state: ProcessingState, verbose?: boolean | string[]): string;
|
|
25
24
|
declare function isDefaultExport(line: string): boolean;
|
|
26
25
|
declare function isDeclarationStart(line: string): boolean;
|
|
27
26
|
declare function isRegexPattern(line: string): boolean;
|
|
@@ -31,42 +30,39 @@ export declare function isDeclarationComplete(content: string | string[]): boole
|
|
|
31
30
|
declare function isVariableInsideFunction(line: string, state: ProcessingState): boolean;
|
|
32
31
|
declare function needsMultilineFormat(types: string[]): boolean;
|
|
33
32
|
declare function normalizeTypeReference(value: string): string;
|
|
34
|
-
declare function processBlock(lines: string[], comments: string[], state: ProcessingState): void;
|
|
35
|
-
declare function processVariableBlock(cleanDeclaration: string, lines: string[], state: ProcessingState): boolean;
|
|
36
|
-
declare function processFunctionBlock(cleanDeclaration: string, state: ProcessingState): boolean;
|
|
37
|
-
declare function processInterfaceBlock(cleanDeclaration: string, declarationText: string, state: ProcessingState): boolean;
|
|
33
|
+
declare function processBlock(lines: string[], comments: string[], state: ProcessingState, verbose?: boolean | string[]): void;
|
|
34
|
+
declare function processVariableBlock(cleanDeclaration: string, lines: string[], state: ProcessingState, verbose?: boolean | string[]): boolean;
|
|
35
|
+
declare function processFunctionBlock(cleanDeclaration: string, state: ProcessingState, verbose?: boolean | string[]): boolean;
|
|
36
|
+
declare function processInterfaceBlock(cleanDeclaration: string, declarationText: string, state: ProcessingState, verbose?: boolean | string[]): boolean;
|
|
38
37
|
declare function processTypeBlock(cleanDeclaration: string, declarationText: string, state: ProcessingState): boolean;
|
|
39
38
|
declare function processDefaultExportBlock(cleanDeclaration: string, state: ProcessingState): boolean;
|
|
40
39
|
declare function processExportAllBlock(cleanDeclaration: string, state: ProcessingState): boolean;
|
|
41
|
-
declare function processExportBlock(cleanDeclaration: string, declarationText: string, state: ProcessingState): boolean;
|
|
42
|
-
declare function processExport(line: string, state: ProcessingState): void;
|
|
40
|
+
declare function processExportBlock(cleanDeclaration: string, declarationText: string, state: ProcessingState, verbose?: boolean | string[]): boolean;
|
|
41
|
+
declare function processExport(line: string, state: ProcessingState, verbose?: boolean | string[]): void;
|
|
43
42
|
declare function processExportedClass(cleanDeclaration: string, state: ProcessingState): boolean;
|
|
44
43
|
declare function processExportedEnum(cleanDeclaration: string, state: ProcessingState): boolean;
|
|
45
44
|
declare function processExportedNamespace(cleanDeclaration: string, state: ProcessingState): boolean;
|
|
46
45
|
declare function processModuleBlock(cleanDeclaration: string, declarationText: string, state: ProcessingState): boolean;
|
|
47
|
-
|
|
48
|
-
declare function
|
|
49
|
-
declare function
|
|
50
|
-
declare function handleTypeImports(types: string, module: string, state: ImportTrackingState): void;
|
|
46
|
+
declare function processSourceFile(content: string, state: ProcessingState, verbose?: boolean | string[]): void;
|
|
47
|
+
declare function processImports(line: string, state: ImportTrackingState, verbose?: boolean | string[]): void;
|
|
48
|
+
declare function handleTypeImports(types: string, module: string, state: ImportTrackingState, verbose?: boolean | string[]): void;
|
|
51
49
|
declare function handleDefaultImport(defaultImport: string, module: string, state: ImportTrackingState): void;
|
|
52
|
-
declare function handleMixedImports(imports: string, module: string, state: ImportTrackingState): void;
|
|
53
|
-
declare function processType(declaration: string, isExported): string;
|
|
54
|
-
declare function processTypeExport(line: string, state: ProcessingState): void;
|
|
55
|
-
declare function processVariable(declaration: string, isExported: boolean, state: ProcessingState): string;
|
|
56
|
-
declare function processFunction(declaration: string, usedTypes?: Set<string>, isExported): string;
|
|
50
|
+
declare function handleMixedImports(imports: string, module: string, state: ImportTrackingState, verbose?: boolean | string[]): void;
|
|
51
|
+
declare function processType(declaration: string, isExported?: boolean): string;
|
|
52
|
+
declare function processTypeExport(line: string, state: ProcessingState, verbose?: boolean | string[]): void;
|
|
53
|
+
declare function processVariable(declaration: string, isExported: boolean, state: ProcessingState, verbose?: boolean | string[]): string;
|
|
54
|
+
declare function processFunction(declaration: string, usedTypes?: Set<string>, isExported?: boolean, verbose?: boolean | string[]): string;
|
|
57
55
|
declare function formatObjectType(type: string): string;
|
|
58
|
-
declare function formatObjectParams(objectType: string): string;
|
|
59
56
|
declare function getCleanDeclaration(declaration: string): string;
|
|
60
|
-
declare function processGeneratorFunction(declaration: string): string;
|
|
61
|
-
declare function processInterface(declaration: string, isExported): string;
|
|
57
|
+
declare function processGeneratorFunction(declaration: string, verbose?: boolean | string[]): string;
|
|
62
58
|
declare function processModule(declaration: string): string;
|
|
63
|
-
declare function processObjectMethod(declaration: string): ProcessedMethod;
|
|
64
|
-
declare function processObjectProperties(content: string, state?: ProcessingState, indentLevel): Array<{ key: string, value: string }>;
|
|
65
|
-
declare function processPropertyValue(value: string, indentLevel: number, state?: ProcessingState): string;
|
|
59
|
+
declare function processObjectMethod(declaration: string, verbose?: boolean | string[]): ProcessedMethod;
|
|
60
|
+
declare function processObjectProperties(content: string, state?: ProcessingState, indentLevel?: number, verbose?: boolean | string[]): Array<{ key: string, value: string }>;
|
|
61
|
+
declare function processPropertyValue(value: string, indentLevel: number, state?: ProcessingState, verbose?: boolean | string[]): string;
|
|
66
62
|
declare function trackTypeUsage(content: string, state: ImportTrackingState): void;
|
|
67
|
-
declare function trackValueUsage(content: string, state: ImportTrackingState): void;
|
|
68
|
-
declare function debugLog(category: string, message: string): void;
|
|
63
|
+
declare function trackValueUsage(content: string, state: ImportTrackingState, verbose?: boolean | string[]): void;
|
|
64
|
+
declare function debugLog(category: string, message: string, verbose?: boolean | string[]): void;
|
|
69
65
|
declare function normalizeType(type: string): string;
|
|
70
66
|
declare function normalizePropertyKey(key: string): string;
|
|
71
|
-
declare function splitArrayElements(content: string): string[];
|
|
67
|
+
declare function splitArrayElements(content: string, verbose?: boolean | string[]): string[];
|
|
72
68
|
declare function splitFunctionDeclarations(content: string): string[];
|