jsxpression 0.1.8 → 0.1.12
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/lib/analyze/analyze.test.d.ts +2 -0
- package/lib/analyze/utils.d.ts +20 -0
- package/lib/analyze/validation-context.d.ts +13 -0
- package/lib/compile/compilation-error.d.ts +17 -0
- package/lib/compile/compile.test.d.ts +2 -0
- package/lib/evaluate/evaluate.test.d.ts +2 -0
- package/lib/parse/parse-error.d.ts +10 -0
- package/lib/parse/parse.test.d.ts +2 -0
- package/lib/render.test.d.ts +2 -0
- package/lib/traverse.test.d.ts +2 -0
- package/lib/types.d.ts +12 -0
- package/package.json +8 -7
- package/lib/codegen/builtin-types.d.ts +0 -11
- package/lib/codegen/builtin-types.d.ts.map +0 -1
- package/lib/codegen/builtin-types.js +0 -151
- package/lib/codegen/builtin-types.js.map +0 -1
- package/lib/codegen/declare-types.d.ts +0 -20
- package/lib/codegen/declare-types.d.ts.map +0 -1
- package/lib/codegen/declare-types.js +0 -299
- package/lib/codegen/declare-types.js.map +0 -1
- package/lib/codegen/schema-to-types.d.ts +0 -14
- package/lib/codegen/schema-to-types.d.ts.map +0 -1
- package/lib/codegen/schema-to-types.js +0 -203
- package/lib/codegen/schema-to-types.js.map +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface RangePosition {
|
|
2
|
+
line: number;
|
|
3
|
+
column: number;
|
|
4
|
+
}
|
|
5
|
+
export interface Range {
|
|
6
|
+
start: RangePosition;
|
|
7
|
+
end: RangePosition;
|
|
8
|
+
}
|
|
9
|
+
export declare function getNodeRange(node: any): Range;
|
|
10
|
+
export declare function getElementSimilarityMatchers(invalid: string, available: string[]): SimilarityMatcher[];
|
|
11
|
+
export declare function getAttributeSimilarityMatchers(invalid: string, available: string[]): SimilarityMatcher[];
|
|
12
|
+
export declare function getBestSimilarityMatcherSuggestion(invalid: string, available: string[]): string | null;
|
|
13
|
+
type SimilarityMatcherType = "element" | "attribute" | "property" | "method";
|
|
14
|
+
interface SimilarityMatcher {
|
|
15
|
+
suggestion: string;
|
|
16
|
+
confidence: number;
|
|
17
|
+
type: SimilarityMatcherType;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ValidationContextSnapshot {
|
|
2
|
+
elements: string[];
|
|
3
|
+
currentElement?: string;
|
|
4
|
+
parentElements: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare class ValidationContext {
|
|
7
|
+
#private;
|
|
8
|
+
get currentPath(): string;
|
|
9
|
+
enterElement(element: string): void;
|
|
10
|
+
exitElement(): void;
|
|
11
|
+
getSnapshot(): ValidationContextSnapshot;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=validation-context.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Loc = {
|
|
2
|
+
start: {
|
|
3
|
+
line: number;
|
|
4
|
+
column: number;
|
|
5
|
+
};
|
|
6
|
+
end: {
|
|
7
|
+
line: number;
|
|
8
|
+
column: number;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare class CompilationError extends Error {
|
|
12
|
+
static fromNode(message: string, node: any): CompilationError;
|
|
13
|
+
readonly loc?: Loc;
|
|
14
|
+
constructor(message: string, loc?: Loc);
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=compilation-error.d.ts.map
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type PropsDict = Record<string, unknown>;
|
|
2
|
+
export type DataDict = Record<string, unknown>;
|
|
3
|
+
export type ComponentDict = Record<string, Component>;
|
|
4
|
+
export type CreateElement<T = any> = (type: Component, props?: PropsDict, ...children: any[]) => T;
|
|
5
|
+
export type Node = {
|
|
6
|
+
type: string;
|
|
7
|
+
props: PropsDict;
|
|
8
|
+
children: Node[];
|
|
9
|
+
};
|
|
10
|
+
export type H = (type: string, props?: PropsDict, ...children: Node[]) => Node;
|
|
11
|
+
export type Component = (...args: any[]) => any;
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsxpression",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Validate and safely render JSX expressions",
|
|
5
5
|
"author": "Divid AB <info@divid.se>",
|
|
6
6
|
"repository": "https://github.com/dividab/abstract-visuals/tree/master/packages/jsxpression",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
|
-
"
|
|
9
|
+
"sideEffects": false,
|
|
10
10
|
"type": "module",
|
|
11
|
+
"types": "lib/index",
|
|
11
12
|
"exports": {
|
|
12
13
|
".": "./lib/index.js"
|
|
13
14
|
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "vitest run src/**/*.test.ts"
|
|
17
|
+
},
|
|
14
18
|
"files": [
|
|
15
19
|
"/lib",
|
|
16
20
|
"/src",
|
|
@@ -22,8 +26,5 @@
|
|
|
22
26
|
"acorn-jsx": "5.3.2",
|
|
23
27
|
"acorn-walk": "8.3.4"
|
|
24
28
|
},
|
|
25
|
-
"gitHead": "
|
|
26
|
-
|
|
27
|
-
"test": "vitest run src/**/*.test.ts"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
29
|
+
"gitHead": "be330f96c09738849229f5433b1d59396dc8ba60"
|
|
30
|
+
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generate TypeScript .d.ts declarations for builtin types
|
|
3
|
-
* Pure type generation without Monaco dependencies
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Generate essential builtin type declarations (Math, String, Array)
|
|
7
|
-
* Uses direct declarations (not inside declare global) for better Monaco support
|
|
8
|
-
* Dynamically generated from builtins schema
|
|
9
|
-
*/
|
|
10
|
-
export declare function declareBuiltinTypes(): string;
|
|
11
|
-
//# sourceMappingURL=builtin-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-types.d.ts","sourceRoot":"","sources":["../../src/codegen/builtin-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyJH;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAwB5C"}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Generate TypeScript .d.ts declarations for builtin types
|
|
4
|
-
* Pure type generation without Monaco dependencies
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.declareBuiltinTypes = declareBuiltinTypes;
|
|
8
|
-
const builtins_js_1 = require("../builtins.js");
|
|
9
|
-
/**
|
|
10
|
-
* Generate JSDoc comment from description
|
|
11
|
-
*/
|
|
12
|
-
function generateJSDoc(description, indent = "") {
|
|
13
|
-
if (!description)
|
|
14
|
-
return "";
|
|
15
|
-
return `${indent}/**\n${indent} * ${description}\n${indent} */\n`;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Generate callback signature from callback schema
|
|
19
|
-
*/
|
|
20
|
-
function generateCallbackSignature(callback) {
|
|
21
|
-
const params = callback.params.map((p) => `${p.name}: ${p.type}`).join(", ");
|
|
22
|
-
return `(${params}) => ${callback.returnType}`;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Extract generic type parameters from method
|
|
26
|
-
*/
|
|
27
|
-
function extractGenerics(method) {
|
|
28
|
-
if (!method.callback)
|
|
29
|
-
return "";
|
|
30
|
-
// Check if callback returns or uses U (generic type parameter)
|
|
31
|
-
const usesU = method.callback.returnType === "U" || method.callback.params.some((p) => p.type === "U");
|
|
32
|
-
return usesU ? "<U>" : "";
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Generate parameter signature
|
|
36
|
-
*/
|
|
37
|
-
function generateParam(param, callback) {
|
|
38
|
-
let typeStr;
|
|
39
|
-
// If this is a callback parameter and we have callback schema, generate proper signature
|
|
40
|
-
if (param.types.includes("function") && callback) {
|
|
41
|
-
typeStr = generateCallbackSignature(callback);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
typeStr = param.types.join(" | ");
|
|
45
|
-
}
|
|
46
|
-
const optional = !param.required ? "?" : "";
|
|
47
|
-
const variadic = param.variadic ? "..." : "";
|
|
48
|
-
return `${variadic}${param.name}${optional}: ${typeStr}`;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Generate method signature
|
|
52
|
-
*/
|
|
53
|
-
function generateMethod(methodName, method, indent = " ") {
|
|
54
|
-
let result = "";
|
|
55
|
-
// Add method description as JSDoc
|
|
56
|
-
if (method.description) {
|
|
57
|
-
result += generateJSDoc(method.description, indent);
|
|
58
|
-
}
|
|
59
|
-
// Extract generic type parameters
|
|
60
|
-
const generics = extractGenerics(method);
|
|
61
|
-
// Generate parameters (pass callback schema for function params)
|
|
62
|
-
const params = method.params.map((p) => generateParam(p, method.callback)).join(", ");
|
|
63
|
-
// Generate method signature
|
|
64
|
-
result += `${indent}${methodName}${generics}(${params}): ${method.returnType};`;
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Generate property signature
|
|
69
|
-
*/
|
|
70
|
-
function generateProperty(propertyName, property, indent = " ") {
|
|
71
|
-
let result = "";
|
|
72
|
-
// Add property description as JSDoc
|
|
73
|
-
if (property.description) {
|
|
74
|
-
result += generateJSDoc(property.description, indent);
|
|
75
|
-
}
|
|
76
|
-
// Generate property signature
|
|
77
|
-
const readonly = property.readonly ? "readonly " : "";
|
|
78
|
-
result += `${indent}${readonly}${propertyName}: ${property.type};`;
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Generate declarations for a namespace (Math, Array.prototype, String.prototype)
|
|
83
|
-
*/
|
|
84
|
-
function generateNamespaceDeclaration(namespace, schema) {
|
|
85
|
-
let result = "";
|
|
86
|
-
if (schema.intrinsic) {
|
|
87
|
-
// Generate interface for prototypes (String, Array)
|
|
88
|
-
const interfaceName = namespace.replace(".prototype", "");
|
|
89
|
-
const genericParam = interfaceName === "Array" ? "<T>" : "";
|
|
90
|
-
result += `interface ${interfaceName}${genericParam} {\n`;
|
|
91
|
-
// Add properties
|
|
92
|
-
if (schema.properties) {
|
|
93
|
-
for (const [propName, prop] of Object.entries(schema.properties)) {
|
|
94
|
-
result += generateProperty(propName, prop) + "\n";
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
// Add methods
|
|
98
|
-
if (schema.methods) {
|
|
99
|
-
for (const [methodName, method] of Object.entries(schema.methods)) {
|
|
100
|
-
result += generateMethod(methodName, method) + "\n";
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
result += "}\n";
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
// Generate declare const for global objects (Math)
|
|
107
|
-
result += `declare const ${namespace}: {\n`;
|
|
108
|
-
// Add properties
|
|
109
|
-
if (schema.properties) {
|
|
110
|
-
for (const [propName, prop] of Object.entries(schema.properties)) {
|
|
111
|
-
result += generateProperty(propName, prop) + "\n";
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
// Add methods
|
|
115
|
-
if (schema.methods) {
|
|
116
|
-
for (const [methodName, method] of Object.entries(schema.methods)) {
|
|
117
|
-
result += generateMethod(methodName, method) + "\n";
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
result += "};\n";
|
|
121
|
-
}
|
|
122
|
-
return result;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Generate essential builtin type declarations (Math, String, Array)
|
|
126
|
-
* Uses direct declarations (not inside declare global) for better Monaco support
|
|
127
|
-
* Dynamically generated from builtins schema
|
|
128
|
-
*/
|
|
129
|
-
function declareBuiltinTypes() {
|
|
130
|
-
const builtins = (0, builtins_js_1.getBuiltins)();
|
|
131
|
-
let declarations = `// Essential builtin functions for JSX expressions
|
|
132
|
-
// Dynamically generated from builtins schema
|
|
133
|
-
|
|
134
|
-
// Iterator interfaces for array iteration support
|
|
135
|
-
interface Iterator<T> {
|
|
136
|
-
next(): IteratorResult<T>;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
interface IteratorResult<T> {
|
|
140
|
-
done: boolean;
|
|
141
|
-
value: T;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
`;
|
|
145
|
-
// Generate declarations for each namespace
|
|
146
|
-
for (const [namespace, schema] of Object.entries(builtins)) {
|
|
147
|
-
declarations += generateNamespaceDeclaration(namespace, schema) + "\n";
|
|
148
|
-
}
|
|
149
|
-
return declarations;
|
|
150
|
-
}
|
|
151
|
-
//# sourceMappingURL=builtin-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-types.js","sourceRoot":"","sources":["../../src/codegen/builtin-types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA8JH,kDAwBC;AApLD,gDAA6C;AAS7C;;GAEG;AACH,SAAS,aAAa,CAAC,WAAoB,EAAE,SAAiB,EAAE;IAC9D,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,CAAC;IAC5B,OAAO,GAAG,MAAM,QAAQ,MAAM,MAAM,WAAW,KAAK,MAAM,OAAO,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,SAAS,yBAAyB,CAAC,QAAgE;IACjG,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7E,OAAO,IAAI,MAAM,QAAQ,QAAQ,CAAC,UAAU,EAAE,CAAC;AACjD,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,M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,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;YACtD,CAAC;QACH,CAAC;QAED,MAAM,IAAI,MAAM,CAAC;IACnB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB;IACjC,MAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAE/B,IAAI,YAAY,GAAG;;;;;;;;;;;;;CAapB,CAAC;IAEA,2CAA2C;IAC3C,KAAK,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3D,YAAY,IAAI,4BAA4B,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACzE,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generate TypeScript .d.ts declarations from JSXExpression schema
|
|
3
|
-
* Main public API: declareTypes(schema, options)
|
|
4
|
-
*/
|
|
5
|
-
import type { Schema } from "../schema.js";
|
|
6
|
-
export type JSXExpressionSchema = Schema;
|
|
7
|
-
export interface DeclareTypesOptions {
|
|
8
|
-
includeBuiltins?: boolean;
|
|
9
|
-
namespace?: string;
|
|
10
|
-
componentPrefix?: string;
|
|
11
|
-
allowedStringMethods?: string[];
|
|
12
|
-
allowedArrayMethods?: string[];
|
|
13
|
-
allowedMathMethods?: string[];
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Main public API: Generate complete TypeScript declarations for JSXExpression
|
|
17
|
-
* This is the primary function that should be exported from jsxpression
|
|
18
|
-
*/
|
|
19
|
-
export declare function declareTypes(schema: Schema, options?: DeclareTypesOptions): string;
|
|
20
|
-
//# sourceMappingURL=declare-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"declare-types.d.ts","sourceRoot":"","sources":["../../src/codegen/declare-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC,MAAM,WAAW,mBAAmB;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAqLtF"}
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generate TypeScript .d.ts declarations from JSXExpression schema
|
|
3
|
-
* Main public API: declareTypes(schema, options)
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Main public API: Generate complete TypeScript declarations for JSXExpression
|
|
7
|
-
* This is the primary function that should be exported from jsxpression
|
|
8
|
-
*/
|
|
9
|
-
export function declareTypes(schema, options = {}) {
|
|
10
|
-
const { includeBuiltins = true, namespace, componentPrefix = "", allowedStringMethods = ["trim", "toUpperCase", "toLowerCase", "split", "replace", "includes"], allowedArrayMethods = ["map", "filter", "join", "length", "slice"], allowedMathMethods = ["round", "floor", "ceil", "max", "min", "abs"], } = options;
|
|
11
|
-
let output = `// Auto-generated TypeScript definitions for JSXExpression\n`;
|
|
12
|
-
output += `// Generated at: ${new Date().toISOString()}\n\n`;
|
|
13
|
-
// Add JSX namespace and types (minimal JSX without React dependency)
|
|
14
|
-
output += `declare global {\n`;
|
|
15
|
-
output += ` namespace JSX {\n`;
|
|
16
|
-
output += ` type Element = {\n`;
|
|
17
|
-
output += ` type: any;\n`;
|
|
18
|
-
output += ` props: any;\n`;
|
|
19
|
-
output += ` key?: string | number | null;\n`;
|
|
20
|
-
output += ` };\n`;
|
|
21
|
-
output += ` type Node = Element | string | number | boolean | null | undefined | Node[];\n`;
|
|
22
|
-
output += ` interface IntrinsicElements {\n`;
|
|
23
|
-
output += ` [elemName: string]: any;\n`;
|
|
24
|
-
output += ` }\n`;
|
|
25
|
-
// Add component interfaces INSIDE declare global (this was key in working version!)
|
|
26
|
-
if (schema.elements) {
|
|
27
|
-
Object.entries(schema.elements).forEach(([elementName, element]) => {
|
|
28
|
-
const interfaceName = `${componentPrefix}${elementName}Props`;
|
|
29
|
-
output += generatePropsInterface(interfaceName, element, " ");
|
|
30
|
-
output += "\n";
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
// Add global component declarations for direct usage INSIDE declare global
|
|
34
|
-
if (schema.elements) {
|
|
35
|
-
Object.entries(schema.elements).forEach(([elementName, element]) => {
|
|
36
|
-
const interfaceName = `${componentPrefix}${elementName}Props`;
|
|
37
|
-
// Generate JSDoc comment for the component
|
|
38
|
-
const componentComment = generateComponentComment(elementName, element, " ");
|
|
39
|
-
if (componentComment) {
|
|
40
|
-
output += componentComment;
|
|
41
|
-
}
|
|
42
|
-
output += ` const ${elementName}: (props: ${interfaceName}) => JSX.Element;\n\n`;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
// Add builtin types if requested
|
|
46
|
-
if (includeBuiltins) {
|
|
47
|
-
// Math object
|
|
48
|
-
output += ` const Math: {\n`;
|
|
49
|
-
const allMathMethods = {
|
|
50
|
-
abs: "(x: number): number",
|
|
51
|
-
ceil: "(x: number): number",
|
|
52
|
-
floor: "(x: number): number",
|
|
53
|
-
round: "(x: number): number",
|
|
54
|
-
max: "(...values: number[]): number",
|
|
55
|
-
min: "(...values: number[]): number",
|
|
56
|
-
random: "(): number",
|
|
57
|
-
pow: "(x: number, y: number): number",
|
|
58
|
-
sqrt: "(x: number): number",
|
|
59
|
-
sin: "(x: number): number",
|
|
60
|
-
cos: "(x: number): number",
|
|
61
|
-
tan: "(x: number): number",
|
|
62
|
-
PI: "number",
|
|
63
|
-
E: "number",
|
|
64
|
-
};
|
|
65
|
-
Object.entries(allMathMethods).forEach(([method, signature]) => {
|
|
66
|
-
if (allowedMathMethods.includes(method)) {
|
|
67
|
-
output += ` ${method}: ${signature};\n`;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
output += ` };\n\n`;
|
|
71
|
-
// Utility functions
|
|
72
|
-
output += ` // Utility functions\n`;
|
|
73
|
-
output += ` function formatCurrency(value: number, currency?: string): string;\n`;
|
|
74
|
-
output += ` function formatDate(date: Date | string | number, format?: string): string;\n`;
|
|
75
|
-
output += ` function formatNumber(value: number, decimals?: number): string;\n`;
|
|
76
|
-
output += ` function sum(values: number[]): number;\n`;
|
|
77
|
-
output += ` function average(values: number[]): number;\n`;
|
|
78
|
-
output += ` function count(values: any[]): number;\n`;
|
|
79
|
-
output += ` function conditional(condition: boolean, trueValue: any, falseValue?: any): any;\n`;
|
|
80
|
-
output += ` function coalesce(...values: any[]): any;\n`;
|
|
81
|
-
output += ` function format(template: string, ...args: any[]): string;\n\n`;
|
|
82
|
-
}
|
|
83
|
-
// Add data object declaration if schema has data
|
|
84
|
-
if (schema.data) {
|
|
85
|
-
output += `\n // Data object for JSX expressions\n`;
|
|
86
|
-
output += ` const data: {\n`;
|
|
87
|
-
Object.entries(schema.data).forEach(([dataKey, dataSchema]) => {
|
|
88
|
-
const type = mapSchemaTypeToTypeScript(dataSchema);
|
|
89
|
-
const comment = generatePropComment(dataSchema, " ");
|
|
90
|
-
if (comment) {
|
|
91
|
-
output += comment;
|
|
92
|
-
}
|
|
93
|
-
// Handle multi-line types (nested objects) with proper indentation
|
|
94
|
-
const indentedType = type.includes("\n") ? type.replace(/\n/g, "\n ").replace(/\n {6}$/, "\n ") : type;
|
|
95
|
-
output += ` ${dataKey}: ${indentedType};\n`;
|
|
96
|
-
});
|
|
97
|
-
output += ` };\n`;
|
|
98
|
-
}
|
|
99
|
-
// Add prototype interfaces if builtins are included
|
|
100
|
-
if (includeBuiltins) {
|
|
101
|
-
// String interface with selective methods
|
|
102
|
-
output += ` interface String {\n`;
|
|
103
|
-
const allStringMethods = {
|
|
104
|
-
charAt: "(index: number): string",
|
|
105
|
-
charCodeAt: "(index: number): number",
|
|
106
|
-
concat: "(...strings: string[]): string",
|
|
107
|
-
endsWith: "(searchString: string, length?: number): boolean",
|
|
108
|
-
includes: "(searchString: string, position?: number): boolean",
|
|
109
|
-
indexOf: "(searchString: string, position?: number): number",
|
|
110
|
-
lastIndexOf: "(searchString: string, position?: number): number",
|
|
111
|
-
slice: "(start?: number, end?: number): string",
|
|
112
|
-
split: "(separator?: string | RegExp, limit?: number): string[]",
|
|
113
|
-
startsWith: "(searchString: string, position?: number): boolean",
|
|
114
|
-
substring: "(start: number, end?: number): string",
|
|
115
|
-
toLowerCase: "(): string",
|
|
116
|
-
toUpperCase: "(): string",
|
|
117
|
-
trim: "(): string",
|
|
118
|
-
trimStart: "(): string",
|
|
119
|
-
trimEnd: "(): string",
|
|
120
|
-
replace: "(searchValue: string | RegExp, replaceValue: string): string",
|
|
121
|
-
replaceAll: "(searchValue: string | RegExp, replaceValue: string): string",
|
|
122
|
-
padStart: "(targetLength: number, padString?: string): string",
|
|
123
|
-
padEnd: "(targetLength: number, padString?: string): string",
|
|
124
|
-
repeat: "(count: number): string",
|
|
125
|
-
length: "number",
|
|
126
|
-
};
|
|
127
|
-
Object.entries(allStringMethods).forEach(([method, signature]) => {
|
|
128
|
-
if (allowedStringMethods.includes(method)) {
|
|
129
|
-
output += ` ${method}: ${signature};\n`;
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
output += ` }\n\n`;
|
|
133
|
-
// Array interface with selective methods
|
|
134
|
-
output += ` interface Array<T> {\n`;
|
|
135
|
-
const allArrayMethods = {
|
|
136
|
-
length: "number",
|
|
137
|
-
push: "(...items: T[]): number",
|
|
138
|
-
pop: "(): T | undefined",
|
|
139
|
-
shift: "(): T | undefined",
|
|
140
|
-
unshift: "(...items: T[]): number",
|
|
141
|
-
slice: "(start?: number, end?: number): T[]",
|
|
142
|
-
splice: "(start: number, deleteCount?: number, ...items: T[]): T[]",
|
|
143
|
-
concat: "(...items: (T | T[])[]): T[]",
|
|
144
|
-
join: "(separator?: string): string",
|
|
145
|
-
reverse: "(): T[]",
|
|
146
|
-
sort: "(compareFn?: (a: T, b: T) => number): T[]",
|
|
147
|
-
indexOf: "(searchElement: T, fromIndex?: number): number",
|
|
148
|
-
lastIndexOf: "(searchElement: T, fromIndex?: number): number",
|
|
149
|
-
includes: "(searchElement: T, fromIndex?: number): boolean",
|
|
150
|
-
find: "(predicate: (value: T, index: number, obj: T[]) => boolean): T | undefined",
|
|
151
|
-
findIndex: "(predicate: (value: T, index: number, obj: T[]) => boolean): number",
|
|
152
|
-
filter: "(predicate: (value: T, index: number, array: T[]) => boolean): T[]",
|
|
153
|
-
map: "<U>(callbackfn: (value: T, index: number, array: T[]) => U): U[]",
|
|
154
|
-
forEach: "(callbackfn: (value: T, index: number, array: T[]) => void): void",
|
|
155
|
-
reduce: "<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U",
|
|
156
|
-
some: "(predicate: (value: T, index: number, array: T[]) => boolean): boolean",
|
|
157
|
-
every: "(predicate: (value: T, index: number, array: T[]) => boolean): boolean",
|
|
158
|
-
};
|
|
159
|
-
Object.entries(allArrayMethods).forEach(([method, signature]) => {
|
|
160
|
-
if (allowedArrayMethods.includes(method)) {
|
|
161
|
-
output += ` ${method}: ${signature};\n`;
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
output += ` }\n\n`;
|
|
165
|
-
}
|
|
166
|
-
output += `}\n\n`;
|
|
167
|
-
return output;
|
|
168
|
-
}
|
|
169
|
-
// Helper functions
|
|
170
|
-
function generatePropsInterface(interfaceName, element, indent = "") {
|
|
171
|
-
let output = `${indent}interface ${interfaceName} {\n`;
|
|
172
|
-
// Generate props
|
|
173
|
-
Object.entries(element.props || {}).forEach(([propName, prop]) => {
|
|
174
|
-
const optional = prop.required ? "" : "?";
|
|
175
|
-
const type = mapSchemaTypeToTypeScript(prop);
|
|
176
|
-
const comment = generatePropComment(prop, `${indent} `);
|
|
177
|
-
if (comment) {
|
|
178
|
-
output += comment;
|
|
179
|
-
}
|
|
180
|
-
output += `${indent} ${propName}${optional}: ${type};\n`;
|
|
181
|
-
});
|
|
182
|
-
// Add children prop if element can have content
|
|
183
|
-
if (element.content !== false) {
|
|
184
|
-
output += `${indent} children?: JSX.Node;\n`;
|
|
185
|
-
}
|
|
186
|
-
output += `${indent}}\n`;
|
|
187
|
-
return output;
|
|
188
|
-
}
|
|
189
|
-
function generateComponentComment(elementName, element, indent = "") {
|
|
190
|
-
const comments = [];
|
|
191
|
-
// Add component description if available
|
|
192
|
-
if (element.description) {
|
|
193
|
-
comments.push(element.description);
|
|
194
|
-
}
|
|
195
|
-
else if (element.doc) {
|
|
196
|
-
comments.push(element.doc);
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
// Generate a default description
|
|
200
|
-
comments.push(`${elementName} component`);
|
|
201
|
-
}
|
|
202
|
-
// Add prop information summary
|
|
203
|
-
if (element.props && Object.keys(element.props).length > 0) {
|
|
204
|
-
comments.push("");
|
|
205
|
-
const propCount = Object.keys(element.props).length;
|
|
206
|
-
const requiredProps = Object.entries(element.props).filter(([, prop]) => prop.required !== false).length;
|
|
207
|
-
comments.push(`@props ${propCount} props (${requiredProps} required)`);
|
|
208
|
-
}
|
|
209
|
-
// Add examples if available
|
|
210
|
-
if (element.examples && element.examples.length > 0) {
|
|
211
|
-
comments.push("");
|
|
212
|
-
comments.push("@example");
|
|
213
|
-
element.examples.forEach((example) => {
|
|
214
|
-
comments.push(example);
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
if (comments.length === 0) {
|
|
218
|
-
return "";
|
|
219
|
-
}
|
|
220
|
-
if (comments.length === 1 && comments[0] && !comments[0].includes("\n")) {
|
|
221
|
-
return `${indent}/** ${comments[0]} */\n`;
|
|
222
|
-
}
|
|
223
|
-
let output = `${indent}/**\n`;
|
|
224
|
-
comments.forEach((comment) => {
|
|
225
|
-
if (comment === "") {
|
|
226
|
-
output += `${indent} *\n`;
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
comment.split("\n").forEach((line) => {
|
|
230
|
-
output += `${indent} * ${line}\n`;
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
output += `${indent} */\n`;
|
|
235
|
-
return output;
|
|
236
|
-
}
|
|
237
|
-
function mapSchemaTypeToTypeScript(prop) {
|
|
238
|
-
switch (prop.type) {
|
|
239
|
-
case "string":
|
|
240
|
-
if (prop.enum && Array.isArray(prop.enum)) {
|
|
241
|
-
return prop.enum.map((value) => `"${value}"`).join(" | ");
|
|
242
|
-
}
|
|
243
|
-
return "string";
|
|
244
|
-
case "number":
|
|
245
|
-
if (prop.enum && Array.isArray(prop.enum)) {
|
|
246
|
-
return prop.enum.map((value) => String(value)).join(" | ");
|
|
247
|
-
}
|
|
248
|
-
return "number";
|
|
249
|
-
case "boolean":
|
|
250
|
-
if (prop.enum && Array.isArray(prop.enum)) {
|
|
251
|
-
return prop.enum.map((value) => String(value)).join(" | ");
|
|
252
|
-
}
|
|
253
|
-
return "boolean";
|
|
254
|
-
case "array":
|
|
255
|
-
const itemType = prop.shape ? mapSchemaTypeToTypeScript(prop.shape) : "any";
|
|
256
|
-
return `${itemType}[]`;
|
|
257
|
-
case "object":
|
|
258
|
-
if (prop.shape && typeof prop.shape === "object") {
|
|
259
|
-
let objectType = "{\n";
|
|
260
|
-
Object.entries(prop.shape).forEach(([key, value]) => {
|
|
261
|
-
const nestedType = mapSchemaTypeToTypeScript(value);
|
|
262
|
-
const required = value.required !== false ? "" : "?";
|
|
263
|
-
objectType += ` ${key}${required}: ${nestedType};\n`;
|
|
264
|
-
});
|
|
265
|
-
objectType += " }";
|
|
266
|
-
return objectType;
|
|
267
|
-
}
|
|
268
|
-
return "object";
|
|
269
|
-
case "function":
|
|
270
|
-
return "(...args: any[]) => any";
|
|
271
|
-
default:
|
|
272
|
-
console.warn(`Unknown schema type: ${prop.type}`);
|
|
273
|
-
return "any";
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
function generatePropComment(prop, indent) {
|
|
277
|
-
const comments = [];
|
|
278
|
-
if (prop.description) {
|
|
279
|
-
comments.push(prop.description);
|
|
280
|
-
}
|
|
281
|
-
if (prop.default !== undefined) {
|
|
282
|
-
comments.push(`@default ${JSON.stringify(prop.default)}`);
|
|
283
|
-
}
|
|
284
|
-
if (prop.type === "enum" && prop.values) {
|
|
285
|
-
comments.push(`@values ${prop.values.map((v) => `"${v}"`).join(", ")}`);
|
|
286
|
-
}
|
|
287
|
-
if (comments.length === 0) {
|
|
288
|
-
return "";
|
|
289
|
-
}
|
|
290
|
-
if (comments.length === 1) {
|
|
291
|
-
return `${indent}/** ${comments[0]} */\n`;
|
|
292
|
-
}
|
|
293
|
-
let output = `${indent}/**\n`;
|
|
294
|
-
comments.forEach((comment) => {
|
|
295
|
-
output += `${indent} * ${comment}\n`;
|
|
296
|
-
});
|
|
297
|
-
output += `${indent} */\n`;
|
|
298
|
-
return output;
|
|
299
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"declare-types.js","sourceRoot":"","sources":["../../src/codegen/declare-types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAoBH,oCAqLC;AAzLD;;;GAGG;AACH,SAAgB,YAAY,CAAC,MAAc,EAAE,UAA+B,EAAE;IAC5E,MAAM,EACJ,eAAe,GAAG,IAAI,EACtB,SAAS,EACT,eAAe,GAAG,EAAE,EACpB,oBAAoB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,EAC7F,mBAAmB,GAAG,CAAC,KAAK,EAAE,QAAQ,EA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AAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,GAAG,MAAM,OAAO,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IAC5C,CAAC;IAED,IAAI,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,MAAM,IAAI,GAAG,MAAM,MAAM,OAAO,IAAI,CAAC;IACvC,CAAC,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC;IAE3B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generate TypeScript .d.ts declarations from JSXExpression schema
|
|
3
|
-
* Pure type generation without Monaco dependencies
|
|
4
|
-
*/
|
|
5
|
-
import type { Schema } from "../schema.js";
|
|
6
|
-
export interface TypeGenerationOptions {
|
|
7
|
-
componentPrefix?: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Generate complete TypeScript declarations for JSXExpression schema
|
|
11
|
-
* Includes JSX namespace, component interfaces, component declarations, and data object
|
|
12
|
-
*/
|
|
13
|
-
export declare function declareTypes(schema: Schema, options?: TypeGenerationOptions): string;
|
|
14
|
-
//# sourceMappingURL=schema-to-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-to-types.d.ts","sourceRoot":"","sources":["../../src/codegen/schema-to-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,WAAW,qBAAqB;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,GAAG,MAAM,CA8DxF"}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Generate TypeScript .d.ts declarations from JSXExpression schema
|
|
4
|
-
* Pure type generation without Monaco dependencies
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.declareTypes = declareTypes;
|
|
8
|
-
/**
|
|
9
|
-
* Generate complete TypeScript declarations for JSXExpression schema
|
|
10
|
-
* Includes JSX namespace, component interfaces, component declarations, and data object
|
|
11
|
-
*/
|
|
12
|
-
function declareTypes(schema, options = {}) {
|
|
13
|
-
const { componentPrefix = "" } = options;
|
|
14
|
-
let output = `// Auto-generated TypeScript definitions for JSXExpression\n`;
|
|
15
|
-
output += `// Generated at: ${new Date().toISOString()}\n\n`;
|
|
16
|
-
// Add JSX namespace and types (minimal JSX without React dependency)
|
|
17
|
-
output += `declare global {\n`;
|
|
18
|
-
output += ` namespace JSX {\n`;
|
|
19
|
-
output += ` type Element = {\n`;
|
|
20
|
-
output += ` type: any;\n`;
|
|
21
|
-
output += ` props: any;\n`;
|
|
22
|
-
output += ` key?: string | number | null;\n`;
|
|
23
|
-
output += ` };\n`;
|
|
24
|
-
output += ` type Node = Element | string | number | boolean | null | undefined | Node[];\n`;
|
|
25
|
-
output += ` interface IntrinsicElements {\n`;
|
|
26
|
-
output += ` [elemName: string]: any;\n`;
|
|
27
|
-
output += ` }\n`;
|
|
28
|
-
output += ` }\n\n`;
|
|
29
|
-
// Add component interfaces
|
|
30
|
-
if (schema.elements) {
|
|
31
|
-
Object.entries(schema.elements).forEach(([elementName, element]) => {
|
|
32
|
-
const interfaceName = `${componentPrefix}${elementName}Props`;
|
|
33
|
-
output += generatePropsInterface(interfaceName, element, " ");
|
|
34
|
-
output += "\n";
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
// Add component declarations
|
|
38
|
-
if (schema.elements) {
|
|
39
|
-
Object.entries(schema.elements).forEach(([elementName, element]) => {
|
|
40
|
-
const interfaceName = `${componentPrefix}${elementName}Props`;
|
|
41
|
-
const componentComment = generateComponentComment(elementName, element, " ");
|
|
42
|
-
if (componentComment) {
|
|
43
|
-
output += componentComment;
|
|
44
|
-
}
|
|
45
|
-
output += ` const ${elementName}: (props: ${interfaceName}) => JSX.Element;\n\n`;
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
// Add data object declaration if schema has data
|
|
49
|
-
if (schema.data) {
|
|
50
|
-
output += ` // Data object for JSX expressions\n`;
|
|
51
|
-
output += ` const data: {\n`;
|
|
52
|
-
Object.entries(schema.data).forEach(([dataKey, dataSchema]) => {
|
|
53
|
-
const type = mapSchemaTypeToTypeScript(dataSchema);
|
|
54
|
-
const comment = generatePropComment(dataSchema, " ");
|
|
55
|
-
if (comment) {
|
|
56
|
-
output += comment;
|
|
57
|
-
}
|
|
58
|
-
// Handle multi-line types (nested objects) with proper indentation
|
|
59
|
-
const indentedType = type.includes("\n") ? type.replace(/\n/g, "\n ").replace(/\n {4}$/, "\n ") : type;
|
|
60
|
-
output += ` ${dataKey}: ${indentedType};\n`;
|
|
61
|
-
});
|
|
62
|
-
output += ` };\n`;
|
|
63
|
-
}
|
|
64
|
-
output += `}\n\n`;
|
|
65
|
-
output += `export {};\n`;
|
|
66
|
-
return output;
|
|
67
|
-
}
|
|
68
|
-
// Helper functions
|
|
69
|
-
function generatePropsInterface(interfaceName, element, indent = "") {
|
|
70
|
-
let output = `${indent}interface ${interfaceName} {\n`;
|
|
71
|
-
Object.entries(element.props || {}).forEach(([propName, prop]) => {
|
|
72
|
-
const optional = prop.required ? "" : "?";
|
|
73
|
-
const type = mapSchemaTypeToTypeScript(prop);
|
|
74
|
-
const comment = generatePropComment(prop, `${indent} `);
|
|
75
|
-
if (comment) {
|
|
76
|
-
output += comment;
|
|
77
|
-
}
|
|
78
|
-
output += `${indent} ${propName}${optional}: ${type};\n`;
|
|
79
|
-
});
|
|
80
|
-
if (element.content !== false) {
|
|
81
|
-
output += `${indent} children?: JSX.Node;\n`;
|
|
82
|
-
}
|
|
83
|
-
output += `${indent}}\n`;
|
|
84
|
-
return output;
|
|
85
|
-
}
|
|
86
|
-
function generateComponentComment(elementName, element, indent = "") {
|
|
87
|
-
const comments = [];
|
|
88
|
-
if (element.description) {
|
|
89
|
-
comments.push(element.description);
|
|
90
|
-
}
|
|
91
|
-
else if (element.doc) {
|
|
92
|
-
comments.push(element.doc);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
comments.push(`${elementName} component`);
|
|
96
|
-
}
|
|
97
|
-
if (element.props && Object.keys(element.props).length > 0) {
|
|
98
|
-
comments.push("");
|
|
99
|
-
const propCount = Object.keys(element.props).length;
|
|
100
|
-
const requiredProps = Object.entries(element.props).filter(([, prop]) => prop.required !== false).length;
|
|
101
|
-
comments.push(`@props ${propCount} props (${requiredProps} required)`);
|
|
102
|
-
}
|
|
103
|
-
if (element.examples && element.examples.length > 0) {
|
|
104
|
-
comments.push("");
|
|
105
|
-
comments.push("@example");
|
|
106
|
-
element.examples.forEach((example) => {
|
|
107
|
-
comments.push(example);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
if (comments.length === 0) {
|
|
111
|
-
return "";
|
|
112
|
-
}
|
|
113
|
-
if (comments.length === 1 && comments[0] && !comments[0].includes("\n")) {
|
|
114
|
-
return `${indent}/** ${comments[0]} */\n`;
|
|
115
|
-
}
|
|
116
|
-
let output = `${indent}/**\n`;
|
|
117
|
-
comments.forEach((comment) => {
|
|
118
|
-
if (comment === "") {
|
|
119
|
-
output += `${indent} *\n`;
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
comment.split("\n").forEach((line) => {
|
|
123
|
-
output += `${indent} * ${line}\n`;
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
output += `${indent} */\n`;
|
|
128
|
-
return output;
|
|
129
|
-
}
|
|
130
|
-
function mapSchemaTypeToTypeScript(prop) {
|
|
131
|
-
switch (prop.type) {
|
|
132
|
-
case "string":
|
|
133
|
-
if (prop.enum && Array.isArray(prop.enum)) {
|
|
134
|
-
return prop.enum.map((value) => `"${value}"`).join(" | ");
|
|
135
|
-
}
|
|
136
|
-
return "string";
|
|
137
|
-
case "number":
|
|
138
|
-
if (prop.enum && Array.isArray(prop.enum)) {
|
|
139
|
-
return prop.enum.map((value) => String(value)).join(" | ");
|
|
140
|
-
}
|
|
141
|
-
return "number";
|
|
142
|
-
case "boolean":
|
|
143
|
-
if (prop.enum && Array.isArray(prop.enum)) {
|
|
144
|
-
return prop.enum.map((value) => String(value)).join(" | ");
|
|
145
|
-
}
|
|
146
|
-
return "boolean";
|
|
147
|
-
case "array":
|
|
148
|
-
const itemType = prop.shape ? mapSchemaTypeToTypeScript(prop.shape) : "any";
|
|
149
|
-
return `${itemType}[]`;
|
|
150
|
-
case "object":
|
|
151
|
-
if (prop.shape && typeof prop.shape === "object") {
|
|
152
|
-
let objectType = "{\n";
|
|
153
|
-
Object.entries(prop.shape).forEach(([key, value]) => {
|
|
154
|
-
const nestedType = mapSchemaTypeToTypeScript(value);
|
|
155
|
-
const required = value.required !== false ? "" : "?";
|
|
156
|
-
objectType += ` ${key}${required}: ${nestedType};\n`;
|
|
157
|
-
});
|
|
158
|
-
objectType += " }";
|
|
159
|
-
return objectType;
|
|
160
|
-
}
|
|
161
|
-
if (prop.properties && typeof prop.properties === "object") {
|
|
162
|
-
let objectType = "{\n";
|
|
163
|
-
Object.entries(prop.properties).forEach(([key, value]) => {
|
|
164
|
-
const nestedType = mapSchemaTypeToTypeScript(value);
|
|
165
|
-
const required = value.required !== false ? "" : "?";
|
|
166
|
-
objectType += ` ${key}${required}: ${nestedType};\n`;
|
|
167
|
-
});
|
|
168
|
-
objectType += " }";
|
|
169
|
-
return objectType;
|
|
170
|
-
}
|
|
171
|
-
return "object";
|
|
172
|
-
case "function":
|
|
173
|
-
return "(...args: any[]) => any";
|
|
174
|
-
default:
|
|
175
|
-
console.warn(`Unknown schema type: ${prop.type}`);
|
|
176
|
-
return "any";
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
function generatePropComment(prop, indent) {
|
|
180
|
-
const comments = [];
|
|
181
|
-
if (prop.description) {
|
|
182
|
-
comments.push(prop.description);
|
|
183
|
-
}
|
|
184
|
-
if (prop.default !== undefined) {
|
|
185
|
-
comments.push(`@default ${JSON.stringify(prop.default)}`);
|
|
186
|
-
}
|
|
187
|
-
if (prop.type === "enum" && prop.values) {
|
|
188
|
-
comments.push(`@values ${prop.values.map((v) => `"${v}"`).join(", ")}`);
|
|
189
|
-
}
|
|
190
|
-
if (comments.length === 0) {
|
|
191
|
-
return "";
|
|
192
|
-
}
|
|
193
|
-
if (comments.length === 1) {
|
|
194
|
-
return `${indent}/** ${comments[0]} */\n`;
|
|
195
|
-
}
|
|
196
|
-
let output = `${indent}/**\n`;
|
|
197
|
-
comments.forEach((comment) => {
|
|
198
|
-
output += `${indent} * ${comment}\n`;
|
|
199
|
-
});
|
|
200
|
-
output += `${indent} */\n`;
|
|
201
|
-
return output;
|
|
202
|
-
}
|
|
203
|
-
//# sourceMappingURL=schema-to-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-to-types.js","sourceRoot":"","sources":["../../src/codegen/schema-to-types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAYH,oCA8DC;AAlED;;;GAGG;AACH,SAAgB,YAAY,CAAC,MAAc,EAAE,UAAiC,EAAE;IAC9E,MAAM,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAEzC,IAAI,MAAM,GAAG,8DAA8D,CAAC;IAC5E,MAAM,IAAI,oBAAoB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,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