@formspec/cli 0.1.0-alpha.8 → 0.1.0-alpha.9
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/README.md +50 -37
- package/dist/__tests__/analyzer.test.d.ts +4 -1
- package/dist/__tests__/analyzer.test.d.ts.map +1 -1
- package/dist/__tests__/analyzer.test.js +5 -104
- package/dist/__tests__/analyzer.test.js.map +1 -1
- package/dist/__tests__/codegen.test.d.ts +4 -1
- package/dist/__tests__/codegen.test.d.ts.map +1 -1
- package/dist/__tests__/codegen.test.js +30 -484
- package/dist/__tests__/codegen.test.js.map +1 -1
- package/dist/__tests__/edge-cases.test.d.ts +5 -7
- package/dist/__tests__/edge-cases.test.d.ts.map +1 -1
- package/dist/__tests__/edge-cases.test.js +6 -373
- package/dist/__tests__/edge-cases.test.js.map +1 -1
- package/dist/__tests__/fixtures/edge-cases.d.ts.map +1 -1
- package/dist/__tests__/fixtures/edge-cases.js.map +1 -1
- package/dist/__tests__/integration.test.js +29 -18
- package/dist/__tests__/integration.test.js.map +1 -1
- package/dist/index.js +38 -18
- package/dist/index.js.map +1 -1
- package/dist/output/writer.d.ts +5 -5
- package/dist/output/writer.d.ts.map +1 -1
- package/dist/output/writer.js +13 -13
- package/dist/output/writer.js.map +1 -1
- package/dist/runtime/formspec-loader.d.ts.map +1 -1
- package/dist/runtime/formspec-loader.js +1 -3
- package/dist/runtime/formspec-loader.js.map +1 -1
- package/package.json +4 -4
- package/dist/analyzer/class-analyzer.d.ts +0 -75
- package/dist/analyzer/class-analyzer.d.ts.map +0 -1
- package/dist/analyzer/class-analyzer.js +0 -151
- package/dist/analyzer/class-analyzer.js.map +0 -1
- package/dist/analyzer/decorator-extractor.d.ts +0 -87
- package/dist/analyzer/decorator-extractor.d.ts.map +0 -1
- package/dist/analyzer/decorator-extractor.js +0 -193
- package/dist/analyzer/decorator-extractor.js.map +0 -1
- package/dist/analyzer/program.d.ts +0 -37
- package/dist/analyzer/program.d.ts.map +0 -1
- package/dist/analyzer/program.js +0 -89
- package/dist/analyzer/program.js.map +0 -1
- package/dist/analyzer/type-converter.d.ts +0 -97
- package/dist/analyzer/type-converter.d.ts.map +0 -1
- package/dist/analyzer/type-converter.js +0 -360
- package/dist/analyzer/type-converter.js.map +0 -1
- package/dist/codegen/index.d.ts +0 -76
- package/dist/codegen/index.d.ts.map +0 -1
- package/dist/codegen/index.js +0 -558
- package/dist/codegen/index.js.map +0 -1
- package/dist/generators/class-schema.d.ts +0 -43
- package/dist/generators/class-schema.d.ts.map +0 -1
- package/dist/generators/class-schema.js +0 -61
- package/dist/generators/class-schema.js.map +0 -1
- package/dist/generators/method-schema.d.ts +0 -57
- package/dist/generators/method-schema.d.ts.map +0 -1
- package/dist/generators/method-schema.js +0 -108
- package/dist/generators/method-schema.js.map +0 -1
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decorator extractor for parsing decorator AST nodes.
|
|
3
|
-
*
|
|
4
|
-
* Extracts decorator names and arguments from class field decorators,
|
|
5
|
-
* supporting the FormSpec decorator DSL (@Label, @Min, @Max, etc.).
|
|
6
|
-
*/
|
|
7
|
-
import * as ts from "typescript";
|
|
8
|
-
/**
|
|
9
|
-
* Extracted decorator information.
|
|
10
|
-
*/
|
|
11
|
-
export interface DecoratorInfo {
|
|
12
|
-
/** Decorator name (e.g., "Label", "Min") */
|
|
13
|
-
name: string;
|
|
14
|
-
/** Decorator arguments as literal values */
|
|
15
|
-
args: DecoratorArg[];
|
|
16
|
-
/** Raw AST node for the decorator */
|
|
17
|
-
node: ts.Decorator;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* A decorator argument value.
|
|
21
|
-
* Can be a primitive, array, or object literal.
|
|
22
|
-
*/
|
|
23
|
-
export type DecoratorArg = string | number | boolean | null | DecoratorArg[] | {
|
|
24
|
-
[key: string]: DecoratorArg;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Extracts decorators from a class member (property or method).
|
|
28
|
-
*
|
|
29
|
-
* @param member - The class member to extract decorators from
|
|
30
|
-
* @returns Array of extracted decorator info
|
|
31
|
-
*/
|
|
32
|
-
export declare function extractDecorators(member: ts.PropertyDeclaration | ts.MethodDeclaration): DecoratorInfo[];
|
|
33
|
-
/**
|
|
34
|
-
* Known FormSpec decorators and their expected argument types.
|
|
35
|
-
*/
|
|
36
|
-
export declare const FORMSPEC_DECORATORS: {
|
|
37
|
-
readonly Label: {
|
|
38
|
-
readonly argTypes: readonly ["string"];
|
|
39
|
-
};
|
|
40
|
-
readonly Placeholder: {
|
|
41
|
-
readonly argTypes: readonly ["string"];
|
|
42
|
-
};
|
|
43
|
-
readonly Description: {
|
|
44
|
-
readonly argTypes: readonly ["string"];
|
|
45
|
-
};
|
|
46
|
-
readonly Min: {
|
|
47
|
-
readonly argTypes: readonly ["number"];
|
|
48
|
-
};
|
|
49
|
-
readonly Max: {
|
|
50
|
-
readonly argTypes: readonly ["number"];
|
|
51
|
-
};
|
|
52
|
-
readonly Step: {
|
|
53
|
-
readonly argTypes: readonly ["number"];
|
|
54
|
-
};
|
|
55
|
-
readonly MinItems: {
|
|
56
|
-
readonly argTypes: readonly ["number"];
|
|
57
|
-
};
|
|
58
|
-
readonly MaxItems: {
|
|
59
|
-
readonly argTypes: readonly ["number"];
|
|
60
|
-
};
|
|
61
|
-
readonly MinLength: {
|
|
62
|
-
readonly argTypes: readonly ["number"];
|
|
63
|
-
};
|
|
64
|
-
readonly MaxLength: {
|
|
65
|
-
readonly argTypes: readonly ["number"];
|
|
66
|
-
};
|
|
67
|
-
readonly Pattern: {
|
|
68
|
-
readonly argTypes: readonly ["string"];
|
|
69
|
-
};
|
|
70
|
-
readonly EnumOptions: {
|
|
71
|
-
readonly argTypes: readonly ["array"];
|
|
72
|
-
};
|
|
73
|
-
readonly ShowWhen: {
|
|
74
|
-
readonly argTypes: readonly ["object"];
|
|
75
|
-
};
|
|
76
|
-
readonly Group: {
|
|
77
|
-
readonly argTypes: readonly ["string"];
|
|
78
|
-
};
|
|
79
|
-
readonly Boolean: {
|
|
80
|
-
readonly argTypes: readonly [];
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Checks if a decorator name is a known FormSpec decorator.
|
|
85
|
-
*/
|
|
86
|
-
export declare function isFormSpecDecorator(name: string): boolean;
|
|
87
|
-
//# sourceMappingURL=decorator-extractor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorator-extractor.d.ts","sourceRoot":"","sources":["../../src/analyzer/decorator-extractor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,qCAAqC;IACrC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,YAAY,EAAE,GACd;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;CAAE,CAAC;AAEpC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,EAAE,CAAC,mBAAmB,GAAG,EAAE,CAAC,iBAAiB,GACpD,aAAa,EAAE,CAkBjB;AAuJD;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BtB,CAAC;AAEX;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD"}
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decorator extractor for parsing decorator AST nodes.
|
|
3
|
-
*
|
|
4
|
-
* Extracts decorator names and arguments from class field decorators,
|
|
5
|
-
* supporting the FormSpec decorator DSL (@Label, @Min, @Max, etc.).
|
|
6
|
-
*/
|
|
7
|
-
import * as ts from "typescript";
|
|
8
|
-
/**
|
|
9
|
-
* Extracts decorators from a class member (property or method).
|
|
10
|
-
*
|
|
11
|
-
* @param member - The class member to extract decorators from
|
|
12
|
-
* @returns Array of extracted decorator info
|
|
13
|
-
*/
|
|
14
|
-
export function extractDecorators(member) {
|
|
15
|
-
const decorators = [];
|
|
16
|
-
// TC39 decorators are in the modifiers array
|
|
17
|
-
const modifiers = ts.canHaveDecorators(member)
|
|
18
|
-
? ts.getDecorators(member)
|
|
19
|
-
: undefined;
|
|
20
|
-
if (!modifiers)
|
|
21
|
-
return decorators;
|
|
22
|
-
for (const decorator of modifiers) {
|
|
23
|
-
const info = parseDecorator(decorator);
|
|
24
|
-
if (info) {
|
|
25
|
-
decorators.push(info);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return decorators;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Parses a single decorator node.
|
|
32
|
-
*/
|
|
33
|
-
function parseDecorator(decorator) {
|
|
34
|
-
const expr = decorator.expression;
|
|
35
|
-
// Simple decorator: @Decorator
|
|
36
|
-
if (ts.isIdentifier(expr)) {
|
|
37
|
-
return {
|
|
38
|
-
name: expr.text,
|
|
39
|
-
args: [],
|
|
40
|
-
node: decorator,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
// Call expression: @Decorator(args)
|
|
44
|
-
if (ts.isCallExpression(expr)) {
|
|
45
|
-
const callee = expr.expression;
|
|
46
|
-
// Get decorator name
|
|
47
|
-
let name = null;
|
|
48
|
-
if (ts.isIdentifier(callee)) {
|
|
49
|
-
name = callee.text;
|
|
50
|
-
}
|
|
51
|
-
else if (ts.isPropertyAccessExpression(callee)) {
|
|
52
|
-
// For namespaced decorators like @formspec.Label()
|
|
53
|
-
name = callee.name.text;
|
|
54
|
-
}
|
|
55
|
-
if (!name)
|
|
56
|
-
return null;
|
|
57
|
-
// Extract arguments
|
|
58
|
-
const args = expr.arguments.map(extractArgValue);
|
|
59
|
-
return {
|
|
60
|
-
name,
|
|
61
|
-
args,
|
|
62
|
-
node: decorator,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Extracts the value from an expression node.
|
|
69
|
-
* Supports literals, arrays, and object literals.
|
|
70
|
-
*/
|
|
71
|
-
function extractArgValue(node) {
|
|
72
|
-
// String literal
|
|
73
|
-
if (ts.isStringLiteral(node)) {
|
|
74
|
-
return node.text;
|
|
75
|
-
}
|
|
76
|
-
// Numeric literal
|
|
77
|
-
if (ts.isNumericLiteral(node)) {
|
|
78
|
-
return Number(node.text);
|
|
79
|
-
}
|
|
80
|
-
// Boolean literals (true/false are identifiers in TS AST)
|
|
81
|
-
if (node.kind === ts.SyntaxKind.TrueKeyword) {
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
if (node.kind === ts.SyntaxKind.FalseKeyword) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
// Null literal
|
|
88
|
-
if (node.kind === ts.SyntaxKind.NullKeyword) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
// Prefix unary expression (for negative numbers)
|
|
92
|
-
if (ts.isPrefixUnaryExpression(node)) {
|
|
93
|
-
if (node.operator === ts.SyntaxKind.MinusToken &&
|
|
94
|
-
ts.isNumericLiteral(node.operand)) {
|
|
95
|
-
return -Number(node.operand.text);
|
|
96
|
-
}
|
|
97
|
-
if (node.operator === ts.SyntaxKind.PlusToken &&
|
|
98
|
-
ts.isNumericLiteral(node.operand)) {
|
|
99
|
-
return Number(node.operand.text);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
// Array literal
|
|
103
|
-
if (ts.isArrayLiteralExpression(node)) {
|
|
104
|
-
return node.elements.map((el) => {
|
|
105
|
-
if (ts.isSpreadElement(el)) {
|
|
106
|
-
// Can't evaluate spread at compile time
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
return extractArgValue(el);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
// Object literal
|
|
113
|
-
if (ts.isObjectLiteralExpression(node)) {
|
|
114
|
-
const obj = {};
|
|
115
|
-
for (const prop of node.properties) {
|
|
116
|
-
if (ts.isPropertyAssignment(prop)) {
|
|
117
|
-
const key = getPropertyName(prop.name);
|
|
118
|
-
if (key) {
|
|
119
|
-
obj[key] = extractArgValue(prop.initializer);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
else if (ts.isShorthandPropertyAssignment(prop)) {
|
|
123
|
-
// { foo } shorthand - we can't resolve the value
|
|
124
|
-
const key = prop.name.text;
|
|
125
|
-
obj[key] = null;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return obj;
|
|
129
|
-
}
|
|
130
|
-
// Template literal (simple case)
|
|
131
|
-
if (ts.isNoSubstitutionTemplateLiteral(node)) {
|
|
132
|
-
return node.text;
|
|
133
|
-
}
|
|
134
|
-
// Identifier - could be an enum member or constant
|
|
135
|
-
// We return null since we can't resolve it statically
|
|
136
|
-
if (ts.isIdentifier(node)) {
|
|
137
|
-
// Return the identifier name for potential later resolution
|
|
138
|
-
return `__identifier:${node.text}`;
|
|
139
|
-
}
|
|
140
|
-
// For other expressions, return null
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Gets the property name from a property name node.
|
|
145
|
-
*/
|
|
146
|
-
function getPropertyName(name) {
|
|
147
|
-
if (ts.isIdentifier(name)) {
|
|
148
|
-
return name.text;
|
|
149
|
-
}
|
|
150
|
-
if (ts.isStringLiteral(name)) {
|
|
151
|
-
return name.text;
|
|
152
|
-
}
|
|
153
|
-
if (ts.isNumericLiteral(name)) {
|
|
154
|
-
return name.text;
|
|
155
|
-
}
|
|
156
|
-
// Computed property names can't be resolved statically
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Known FormSpec decorators and their expected argument types.
|
|
161
|
-
*/
|
|
162
|
-
export const FORMSPEC_DECORATORS = {
|
|
163
|
-
// Metadata decorators
|
|
164
|
-
Label: { argTypes: ["string"] },
|
|
165
|
-
Placeholder: { argTypes: ["string"] },
|
|
166
|
-
Description: { argTypes: ["string"] },
|
|
167
|
-
// Numeric constraints
|
|
168
|
-
Min: { argTypes: ["number"] },
|
|
169
|
-
Max: { argTypes: ["number"] },
|
|
170
|
-
Step: { argTypes: ["number"] },
|
|
171
|
-
// Array constraints
|
|
172
|
-
MinItems: { argTypes: ["number"] },
|
|
173
|
-
MaxItems: { argTypes: ["number"] },
|
|
174
|
-
// String constraints
|
|
175
|
-
MinLength: { argTypes: ["number"] },
|
|
176
|
-
MaxLength: { argTypes: ["number"] },
|
|
177
|
-
Pattern: { argTypes: ["string"] },
|
|
178
|
-
// Enum options
|
|
179
|
-
EnumOptions: { argTypes: ["array"] },
|
|
180
|
-
// Conditional display
|
|
181
|
-
ShowWhen: { argTypes: ["object"] },
|
|
182
|
-
// Grouping
|
|
183
|
-
Group: { argTypes: ["string"] },
|
|
184
|
-
// Type hints (may be removed once CLI handles type inference)
|
|
185
|
-
Boolean: { argTypes: [] },
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* Checks if a decorator name is a known FormSpec decorator.
|
|
189
|
-
*/
|
|
190
|
-
export function isFormSpecDecorator(name) {
|
|
191
|
-
return name in FORMSPEC_DECORATORS;
|
|
192
|
-
}
|
|
193
|
-
//# sourceMappingURL=decorator-extractor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorator-extractor.js","sourceRoot":"","sources":["../../src/analyzer/decorator-extractor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AA0BjC;;;;;GAKG;AACH,MAAM,UAAU,iB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AE;IAE9B,oBAAoB;IACpB,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE;IAClC,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE;IAElC,qBAAqB;IACrB,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE;IACnC,SAAS,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE;IACnC,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE;IAEjC,eAAe;IACf,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE;IAEpC,sBAAsB;IACtB,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE;IAElC,WAAW;IACX,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE;IAE/B,8DAA8D;IAC9D,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;CACjB,CAAC;AAEX;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI,IAAI,mBAAmB,CAAC;AACrC,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeScript program setup for static analysis.
|
|
3
|
-
*
|
|
4
|
-
* Creates a TypeScript program with type checker from a source file,
|
|
5
|
-
* using the project's tsconfig.json for compiler options.
|
|
6
|
-
*/
|
|
7
|
-
import * as ts from "typescript";
|
|
8
|
-
/**
|
|
9
|
-
* Result of creating a TypeScript program for analysis.
|
|
10
|
-
*/
|
|
11
|
-
export interface ProgramContext {
|
|
12
|
-
/** The TypeScript program */
|
|
13
|
-
program: ts.Program;
|
|
14
|
-
/** Type checker for resolving types */
|
|
15
|
-
checker: ts.TypeChecker;
|
|
16
|
-
/** The source file being analyzed */
|
|
17
|
-
sourceFile: ts.SourceFile;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Creates a TypeScript program for analyzing a source file.
|
|
21
|
-
*
|
|
22
|
-
* Looks for tsconfig.json in the file's directory or parent directories.
|
|
23
|
-
* Falls back to default compiler options if no config is found.
|
|
24
|
-
*
|
|
25
|
-
* @param filePath - Absolute path to the TypeScript source file
|
|
26
|
-
* @returns Program context with checker and source file
|
|
27
|
-
*/
|
|
28
|
-
export declare function createProgramContext(filePath: string): ProgramContext;
|
|
29
|
-
/**
|
|
30
|
-
* Finds a class declaration by name in a source file.
|
|
31
|
-
*
|
|
32
|
-
* @param sourceFile - The source file to search
|
|
33
|
-
* @param className - Name of the class to find
|
|
34
|
-
* @returns The class declaration node, or null if not found
|
|
35
|
-
*/
|
|
36
|
-
export declare function findClassByName(sourceFile: ts.SourceFile, className: string): ts.ClassDeclaration | null;
|
|
37
|
-
//# sourceMappingURL=program.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/analyzer/program.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,6BAA6B;IAC7B,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC;IACpB,uCAAuC;IACvC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC;IACxB,qCAAqC;IACrC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAiErE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,SAAS,EAAE,MAAM,GAChB,EAAE,CAAC,gBAAgB,GAAG,IAAI,CAgB5B"}
|
package/dist/analyzer/program.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeScript program setup for static analysis.
|
|
3
|
-
*
|
|
4
|
-
* Creates a TypeScript program with type checker from a source file,
|
|
5
|
-
* using the project's tsconfig.json for compiler options.
|
|
6
|
-
*/
|
|
7
|
-
import * as ts from "typescript";
|
|
8
|
-
import * as path from "node:path";
|
|
9
|
-
/**
|
|
10
|
-
* Creates a TypeScript program for analyzing a source file.
|
|
11
|
-
*
|
|
12
|
-
* Looks for tsconfig.json in the file's directory or parent directories.
|
|
13
|
-
* Falls back to default compiler options if no config is found.
|
|
14
|
-
*
|
|
15
|
-
* @param filePath - Absolute path to the TypeScript source file
|
|
16
|
-
* @returns Program context with checker and source file
|
|
17
|
-
*/
|
|
18
|
-
export function createProgramContext(filePath) {
|
|
19
|
-
const absolutePath = path.resolve(filePath);
|
|
20
|
-
const fileDir = path.dirname(absolutePath);
|
|
21
|
-
// Find tsconfig.json - using ts.sys.fileExists which has `this: void` requirement
|
|
22
|
-
const configPath = ts.findConfigFile(fileDir, ts.sys.fileExists.bind(ts.sys), "tsconfig.json");
|
|
23
|
-
let compilerOptions;
|
|
24
|
-
let fileNames;
|
|
25
|
-
if (configPath) {
|
|
26
|
-
const configFile = ts.readConfigFile(configPath, ts.sys.readFile.bind(ts.sys));
|
|
27
|
-
if (configFile.error) {
|
|
28
|
-
throw new Error(`Error reading tsconfig.json: ${ts.flattenDiagnosticMessageText(configFile.error.messageText, "\n")}`);
|
|
29
|
-
}
|
|
30
|
-
const parsed = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath));
|
|
31
|
-
if (parsed.errors.length > 0) {
|
|
32
|
-
const errorMessages = parsed.errors
|
|
33
|
-
.map(e => ts.flattenDiagnosticMessageText(e.messageText, "\n"))
|
|
34
|
-
.join("\n");
|
|
35
|
-
throw new Error(`Error parsing tsconfig.json: ${errorMessages}`);
|
|
36
|
-
}
|
|
37
|
-
compilerOptions = parsed.options;
|
|
38
|
-
// Include the target file in the program
|
|
39
|
-
fileNames = parsed.fileNames.includes(absolutePath)
|
|
40
|
-
? parsed.fileNames
|
|
41
|
-
: [...parsed.fileNames, absolutePath];
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
// Fallback to default options
|
|
45
|
-
compilerOptions = {
|
|
46
|
-
target: ts.ScriptTarget.ES2022,
|
|
47
|
-
module: ts.ModuleKind.NodeNext,
|
|
48
|
-
moduleResolution: ts.ModuleResolutionKind.NodeNext,
|
|
49
|
-
strict: true,
|
|
50
|
-
esModuleInterop: true,
|
|
51
|
-
skipLibCheck: true,
|
|
52
|
-
declaration: true,
|
|
53
|
-
experimentalDecorators: true, // Required for legacy TypeScript decorators
|
|
54
|
-
};
|
|
55
|
-
fileNames = [absolutePath];
|
|
56
|
-
}
|
|
57
|
-
const program = ts.createProgram(fileNames, compilerOptions);
|
|
58
|
-
const sourceFile = program.getSourceFile(absolutePath);
|
|
59
|
-
if (!sourceFile) {
|
|
60
|
-
throw new Error(`Could not find source file: ${absolutePath}`);
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
program,
|
|
64
|
-
checker: program.getTypeChecker(),
|
|
65
|
-
sourceFile,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Finds a class declaration by name in a source file.
|
|
70
|
-
*
|
|
71
|
-
* @param sourceFile - The source file to search
|
|
72
|
-
* @param className - Name of the class to find
|
|
73
|
-
* @returns The class declaration node, or null if not found
|
|
74
|
-
*/
|
|
75
|
-
export function findClassByName(sourceFile, className) {
|
|
76
|
-
let result = null;
|
|
77
|
-
function visit(node) {
|
|
78
|
-
if (result)
|
|
79
|
-
return;
|
|
80
|
-
if (ts.isClassDeclaration(node) && node.name?.text === className) {
|
|
81
|
-
result = node;
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
ts.forEachChild(node, visit);
|
|
85
|
-
}
|
|
86
|
-
visit(sourceFile);
|
|
87
|
-
return result;
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=program.js.map
|
|
@@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MG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAyB,EACzB,SAAiB;IAEjB,IAAI,MAAM,GAA+B,IAAI,CAAC;IAE9C,SAAS,KAAK,CAAC,IAAa;QAC1B,IAAI,MAAM;YAAE,OAAO;QAEnB,IAAI,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,KAAK,SAAS,EAAE,CAAC;YACjE,MAAM,GAAG,IAAI,CAAC;YACd,OAAO;QACT,CAAC;QAED,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,CAAC;IAClB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type converter for transforming TypeScript types to JSON Schema and FormSpec.
|
|
3
|
-
*
|
|
4
|
-
* Converts TypeScript types (extracted via type checker) to:
|
|
5
|
-
* - JSON Schema definitions
|
|
6
|
-
* - FormSpec field definitions
|
|
7
|
-
*/
|
|
8
|
-
import * as ts from "typescript";
|
|
9
|
-
import type { DecoratorInfo } from "./decorator-extractor.js";
|
|
10
|
-
/**
|
|
11
|
-
* JSON Schema type definition.
|
|
12
|
-
*/
|
|
13
|
-
export interface JsonSchema {
|
|
14
|
-
type?: string | string[];
|
|
15
|
-
enum?: unknown[];
|
|
16
|
-
const?: unknown;
|
|
17
|
-
items?: JsonSchema;
|
|
18
|
-
properties?: Record<string, JsonSchema>;
|
|
19
|
-
required?: string[];
|
|
20
|
-
additionalProperties?: boolean | JsonSchema;
|
|
21
|
-
minimum?: number;
|
|
22
|
-
maximum?: number;
|
|
23
|
-
minLength?: number;
|
|
24
|
-
maxLength?: number;
|
|
25
|
-
minItems?: number;
|
|
26
|
-
maxItems?: number;
|
|
27
|
-
pattern?: string;
|
|
28
|
-
title?: string;
|
|
29
|
-
description?: string;
|
|
30
|
-
$ref?: string;
|
|
31
|
-
oneOf?: JsonSchema[];
|
|
32
|
-
anyOf?: JsonSchema[];
|
|
33
|
-
allOf?: JsonSchema[];
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* FormSpec field definition (simplified for output).
|
|
37
|
-
*/
|
|
38
|
-
export interface FormSpecField {
|
|
39
|
-
_field: string;
|
|
40
|
-
id: string;
|
|
41
|
-
label?: string;
|
|
42
|
-
placeholder?: string;
|
|
43
|
-
description?: string;
|
|
44
|
-
required?: boolean;
|
|
45
|
-
min?: number;
|
|
46
|
-
max?: number;
|
|
47
|
-
step?: number;
|
|
48
|
-
minLength?: number;
|
|
49
|
-
maxLength?: number;
|
|
50
|
-
minItems?: number;
|
|
51
|
-
maxItems?: number;
|
|
52
|
-
pattern?: string;
|
|
53
|
-
options?: (string | {
|
|
54
|
-
id: string;
|
|
55
|
-
label: string;
|
|
56
|
-
})[];
|
|
57
|
-
showWhen?: object;
|
|
58
|
-
group?: string;
|
|
59
|
-
fields?: FormSpecField[];
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Result of converting a TypeScript type.
|
|
63
|
-
*/
|
|
64
|
-
export interface TypeConversionResult {
|
|
65
|
-
/** JSON Schema representation */
|
|
66
|
-
jsonSchema: JsonSchema;
|
|
67
|
-
/** FormSpec field type */
|
|
68
|
-
formSpecFieldType: string;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Converts a TypeScript type to JSON Schema and FormSpec field type.
|
|
72
|
-
*
|
|
73
|
-
* @param type - The TypeScript type to convert
|
|
74
|
-
* @param checker - TypeScript type checker
|
|
75
|
-
* @returns Conversion result with JSON Schema and FormSpec type
|
|
76
|
-
*/
|
|
77
|
-
export declare function convertType(type: ts.Type, checker: ts.TypeChecker): TypeConversionResult;
|
|
78
|
-
/**
|
|
79
|
-
* Creates a FormSpec field definition from a field's type and decorators.
|
|
80
|
-
*
|
|
81
|
-
* @param fieldName - The field name
|
|
82
|
-
* @param type - The TypeScript type
|
|
83
|
-
* @param decorators - Decorators applied to the field
|
|
84
|
-
* @param optional - Whether the field is optional
|
|
85
|
-
* @param checker - TypeScript type checker
|
|
86
|
-
* @returns FormSpec field definition
|
|
87
|
-
*/
|
|
88
|
-
export declare function createFormSpecField(fieldName: string, type: ts.Type, decorators: DecoratorInfo[], optional: boolean, checker: ts.TypeChecker): FormSpecField;
|
|
89
|
-
/**
|
|
90
|
-
* Applies decorator constraints to a JSON Schema.
|
|
91
|
-
*
|
|
92
|
-
* @param schema - The base JSON Schema
|
|
93
|
-
* @param decorators - Decorators to apply
|
|
94
|
-
* @returns Modified JSON Schema with constraints
|
|
95
|
-
*/
|
|
96
|
-
export declare function applyDecoratorsToSchema(schema: JsonSchema, decorators: DecoratorInfo[]): JsonSchema;
|
|
97
|
-
//# sourceMappingURL=type-converter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-converter.d.ts","sourceRoot":"","sources":["../../src/analyzer/type-converter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,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