@powerlines/plugin-alloy 0.15.5 → 0.15.6
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/dist/_virtual/rolldown_runtime.cjs +0 -8
- package/dist/core/components/output.d.cts +2 -2
- package/dist/core/components/output.d.mts +2 -2
- package/dist/core/components/single-line-comment.d.cts +2 -2
- package/dist/core/components/source-file.d.cts +2 -2
- package/dist/core/components/source-file.d.mts +2 -2
- package/dist/core/contexts/reflection.d.cts +7 -8
- package/dist/core/contexts/reflection.d.mts +7 -8
- package/dist/deepkit/src/utilities.cjs +41 -42
- package/dist/deepkit/src/utilities.mjs +41 -42
- package/dist/helpers/capnp.cjs +18 -20
- package/dist/helpers/capnp.d.cts +13 -14
- package/dist/helpers/capnp.d.mts +13 -14
- package/dist/helpers/capnp.mjs +18 -20
- package/dist/helpers/typescript.d.cts +1 -3
- package/dist/helpers/typescript.d.mts +1 -3
- package/dist/markdown/components/markdown-file.d.cts +3 -3
- package/dist/markdown/components/markdown-file.d.mts +3 -3
- package/dist/markdown/components/markdown-table.d.cts +4 -4
- package/dist/markdown/components/markdown-table.d.mts +4 -4
- package/dist/typescript/components/dynamic-import-statement.d.cts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.mts +2 -2
- package/dist/typescript/components/entry-file.d.mts +2 -2
- package/dist/typescript/components/tsdoc-reflection.d.cts +4 -4
- package/dist/typescript/components/typescript-interface.cjs +1 -2
- package/dist/typescript/components/typescript-interface.d.cts +5 -6
- package/dist/typescript/components/typescript-interface.d.mts +2 -3
- package/dist/typescript/components/typescript-interface.mjs +1 -2
- package/dist/typescript/components/typescript-object.d.cts +5 -6
- package/dist/typescript/components/typescript-object.d.mts +5 -6
- package/package.json +5 -5
- package/dist/_virtual/rolldown_runtime.mjs +0 -29
- package/dist/deepkit/src/vendor/core.cjs +0 -20
- package/dist/deepkit/src/vendor/core.mjs +0 -11
- package/dist/deepkit/src/vendor/type.cjs +0 -20
- package/dist/deepkit/src/vendor/type.d.cts +0 -7
- package/dist/deepkit/src/vendor/type.d.mts +0 -7
- package/dist/deepkit/src/vendor/type.mjs +0 -11
package/dist/helpers/capnp.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Context, PluginContext } from "../powerlines/src/types/context.cjs";
|
|
2
|
-
import { type_d_exports } from "../deepkit/src/vendor/type.cjs";
|
|
3
2
|
import { CapnpcOptions, CapnpcResult } from "@stryke/capnp/types";
|
|
4
3
|
|
|
5
4
|
//#region src/helpers/capnp.d.ts
|
|
@@ -19,7 +18,7 @@ declare function compile(context: Context, options?: Partial<CapnpcOptions>): Pr
|
|
|
19
18
|
* @param value - The value to stringify.
|
|
20
19
|
* @returns A string representation of the value.
|
|
21
20
|
*/
|
|
22
|
-
declare function stringifyCapnpDefaultValue(property:
|
|
21
|
+
declare function stringifyCapnpDefaultValue(property: ReflectionProperty | ReflectionParameter, value?: any): string;
|
|
23
22
|
/**
|
|
24
23
|
* Converts any {@link Type}'s actual value to string representation.
|
|
25
24
|
*
|
|
@@ -27,35 +26,35 @@ declare function stringifyCapnpDefaultValue(property: type_d_exports.ReflectionP
|
|
|
27
26
|
* @param value - The value to stringify.
|
|
28
27
|
* @returns A string representation of the value.
|
|
29
28
|
*/
|
|
30
|
-
declare function stringifyCapnpValue(type:
|
|
29
|
+
declare function stringifyCapnpValue(type: Type, value: any): string;
|
|
31
30
|
/**
|
|
32
31
|
* Converts a ReflectionProperty's default value to a Cap'n Proto schema string representation.
|
|
33
32
|
*
|
|
34
33
|
* @param type - The TypeEnum to evaluate.
|
|
35
34
|
* @returns A string representation of the property.
|
|
36
35
|
*/
|
|
37
|
-
declare function getCapnpEnumTypes(type:
|
|
36
|
+
declare function getCapnpEnumTypes(type: Type): "Text" | "Float32" | null;
|
|
38
37
|
/**
|
|
39
38
|
* Determines if a Type is a `Void` type in a Cap'n Proto schema.
|
|
40
39
|
*
|
|
41
40
|
* @param type - The Type to check.
|
|
42
41
|
* @returns True if the Type is a `Void` type, false otherwise.
|
|
43
42
|
*/
|
|
44
|
-
declare function isVoidType(type:
|
|
43
|
+
declare function isVoidType(type: Type): boolean;
|
|
45
44
|
/**
|
|
46
45
|
* Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.
|
|
47
46
|
*
|
|
48
47
|
* @param type - The {@link TypeUnion} to convert.
|
|
49
48
|
* @returns A string representation of the Cap'n Proto primitive type.
|
|
50
49
|
*/
|
|
51
|
-
declare function getCapnpUnionTypes(type:
|
|
50
|
+
declare function getCapnpUnionTypes(type: Type): Type[];
|
|
52
51
|
/**
|
|
53
52
|
* Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.
|
|
54
53
|
*
|
|
55
54
|
* @param type - The {@link TypeUnion} to convert.
|
|
56
55
|
* @returns An array of Cap'n Proto primitive types.
|
|
57
56
|
*/
|
|
58
|
-
declare function isCapnpStringUnion(type:
|
|
57
|
+
declare function isCapnpStringUnion(type: Type): boolean;
|
|
59
58
|
declare const LARGE_BUFFER: number;
|
|
60
59
|
type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
|
|
61
60
|
type StdioOptions = IOType | Array<IOType | "ipc" | number | null | undefined>;
|
|
@@ -63,22 +62,22 @@ declare function generateCapnpId(): Promise<string>;
|
|
|
63
62
|
interface GenerateCapnpOptions {
|
|
64
63
|
name?: string;
|
|
65
64
|
}
|
|
66
|
-
declare function generateCapnp(context: PluginContext, reflection:
|
|
65
|
+
declare function generateCapnp(context: PluginContext, reflection: ReflectionClass<any>, options: GenerateCapnpOptions): Promise<string>;
|
|
67
66
|
interface GenerateCapnpStructOptions extends GenerateCapnpOptions {
|
|
68
67
|
indexCounter?: () => number;
|
|
69
68
|
}
|
|
70
|
-
declare function generateCapnpStruct(reflection:
|
|
71
|
-
declare function generateCapnpInterface(reflection:
|
|
72
|
-
declare function generateCapnpSchema(reflection:
|
|
73
|
-
declare function generateCapnpMethodSchema(reflection:
|
|
74
|
-
declare function generateCapnpEnumSchema(type:
|
|
69
|
+
declare function generateCapnpStruct(reflection: ReflectionClass<any>, options?: GenerateCapnpStructOptions): string;
|
|
70
|
+
declare function generateCapnpInterface(reflection: ReflectionClass<any>, options?: GenerateCapnpStructOptions): string;
|
|
71
|
+
declare function generateCapnpSchema(reflection: ReflectionClass<any>, options?: GenerateCapnpStructOptions): string;
|
|
72
|
+
declare function generateCapnpMethodSchema(reflection: ReflectionMethod, indexCounter: () => number): string;
|
|
73
|
+
declare function generateCapnpEnumSchema(type: TypeEnum | TypeUnion, name: string): string;
|
|
75
74
|
/**
|
|
76
75
|
* Generates a string representation of Cap'n Proto primitive types from a Deepkit Type.
|
|
77
76
|
*
|
|
78
77
|
* @param type - The Deepkit Type to convert.
|
|
79
78
|
* @returns A string representation of the Cap'n Proto primitive type.
|
|
80
79
|
*/
|
|
81
|
-
declare function generateCapnpPrimitive(type:
|
|
80
|
+
declare function generateCapnpPrimitive(type: Type): string;
|
|
82
81
|
declare type __ΩIOType = any[];
|
|
83
82
|
declare type __ΩStdioOptions = any[];
|
|
84
83
|
declare type __ΩGenerateCapnpOptions = any[];
|
package/dist/helpers/capnp.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Context, PluginContext } from "../powerlines/src/types/context.mjs";
|
|
2
|
-
import { type_d_exports } from "../deepkit/src/vendor/type.mjs";
|
|
3
2
|
import { CapnpcOptions, CapnpcResult } from "@stryke/capnp/types";
|
|
4
3
|
|
|
5
4
|
//#region src/helpers/capnp.d.ts
|
|
@@ -19,7 +18,7 @@ declare function compile(context: Context, options?: Partial<CapnpcOptions>): Pr
|
|
|
19
18
|
* @param value - The value to stringify.
|
|
20
19
|
* @returns A string representation of the value.
|
|
21
20
|
*/
|
|
22
|
-
declare function stringifyCapnpDefaultValue(property:
|
|
21
|
+
declare function stringifyCapnpDefaultValue(property: ReflectionProperty | ReflectionParameter, value?: any): string;
|
|
23
22
|
/**
|
|
24
23
|
* Converts any {@link Type}'s actual value to string representation.
|
|
25
24
|
*
|
|
@@ -27,35 +26,35 @@ declare function stringifyCapnpDefaultValue(property: type_d_exports.ReflectionP
|
|
|
27
26
|
* @param value - The value to stringify.
|
|
28
27
|
* @returns A string representation of the value.
|
|
29
28
|
*/
|
|
30
|
-
declare function stringifyCapnpValue(type:
|
|
29
|
+
declare function stringifyCapnpValue(type: Type, value: any): string;
|
|
31
30
|
/**
|
|
32
31
|
* Converts a ReflectionProperty's default value to a Cap'n Proto schema string representation.
|
|
33
32
|
*
|
|
34
33
|
* @param type - The TypeEnum to evaluate.
|
|
35
34
|
* @returns A string representation of the property.
|
|
36
35
|
*/
|
|
37
|
-
declare function getCapnpEnumTypes(type:
|
|
36
|
+
declare function getCapnpEnumTypes(type: Type): "Text" | "Float32" | null;
|
|
38
37
|
/**
|
|
39
38
|
* Determines if a Type is a `Void` type in a Cap'n Proto schema.
|
|
40
39
|
*
|
|
41
40
|
* @param type - The Type to check.
|
|
42
41
|
* @returns True if the Type is a `Void` type, false otherwise.
|
|
43
42
|
*/
|
|
44
|
-
declare function isVoidType(type:
|
|
43
|
+
declare function isVoidType(type: Type): boolean;
|
|
45
44
|
/**
|
|
46
45
|
* Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.
|
|
47
46
|
*
|
|
48
47
|
* @param type - The {@link TypeUnion} to convert.
|
|
49
48
|
* @returns A string representation of the Cap'n Proto primitive type.
|
|
50
49
|
*/
|
|
51
|
-
declare function getCapnpUnionTypes(type:
|
|
50
|
+
declare function getCapnpUnionTypes(type: Type): Type[];
|
|
52
51
|
/**
|
|
53
52
|
* Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.
|
|
54
53
|
*
|
|
55
54
|
* @param type - The {@link TypeUnion} to convert.
|
|
56
55
|
* @returns An array of Cap'n Proto primitive types.
|
|
57
56
|
*/
|
|
58
|
-
declare function isCapnpStringUnion(type:
|
|
57
|
+
declare function isCapnpStringUnion(type: Type): boolean;
|
|
59
58
|
declare const LARGE_BUFFER: number;
|
|
60
59
|
type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
|
|
61
60
|
type StdioOptions = IOType | Array<IOType | "ipc" | number | null | undefined>;
|
|
@@ -63,22 +62,22 @@ declare function generateCapnpId(): Promise<string>;
|
|
|
63
62
|
interface GenerateCapnpOptions {
|
|
64
63
|
name?: string;
|
|
65
64
|
}
|
|
66
|
-
declare function generateCapnp(context: PluginContext, reflection:
|
|
65
|
+
declare function generateCapnp(context: PluginContext, reflection: ReflectionClass<any>, options: GenerateCapnpOptions): Promise<string>;
|
|
67
66
|
interface GenerateCapnpStructOptions extends GenerateCapnpOptions {
|
|
68
67
|
indexCounter?: () => number;
|
|
69
68
|
}
|
|
70
|
-
declare function generateCapnpStruct(reflection:
|
|
71
|
-
declare function generateCapnpInterface(reflection:
|
|
72
|
-
declare function generateCapnpSchema(reflection:
|
|
73
|
-
declare function generateCapnpMethodSchema(reflection:
|
|
74
|
-
declare function generateCapnpEnumSchema(type:
|
|
69
|
+
declare function generateCapnpStruct(reflection: ReflectionClass<any>, options?: GenerateCapnpStructOptions): string;
|
|
70
|
+
declare function generateCapnpInterface(reflection: ReflectionClass<any>, options?: GenerateCapnpStructOptions): string;
|
|
71
|
+
declare function generateCapnpSchema(reflection: ReflectionClass<any>, options?: GenerateCapnpStructOptions): string;
|
|
72
|
+
declare function generateCapnpMethodSchema(reflection: ReflectionMethod, indexCounter: () => number): string;
|
|
73
|
+
declare function generateCapnpEnumSchema(type: TypeEnum | TypeUnion, name: string): string;
|
|
75
74
|
/**
|
|
76
75
|
* Generates a string representation of Cap'n Proto primitive types from a Deepkit Type.
|
|
77
76
|
*
|
|
78
77
|
* @param type - The Deepkit Type to convert.
|
|
79
78
|
* @returns A string representation of the Cap'n Proto primitive type.
|
|
80
79
|
*/
|
|
81
|
-
declare function generateCapnpPrimitive(type:
|
|
80
|
+
declare function generateCapnpPrimitive(type: Type): string;
|
|
82
81
|
declare type __ΩIOType = any[];
|
|
83
82
|
declare type __ΩStdioOptions = any[];
|
|
84
83
|
declare type __ΩGenerateCapnpOptions = any[];
|
package/dist/helpers/capnp.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { type_exports } from "../deepkit/src/vendor/type.mjs";
|
|
2
1
|
import { getUnionTypes, kindToName } from "../deepkit/src/utilities.mjs";
|
|
3
|
-
import { core_exports } from "../deepkit/src/vendor/core.mjs";
|
|
4
2
|
import { getBaseFileHeader } from "../powerlines/src/lib/utilities/file-header.mjs";
|
|
5
3
|
import defu from "defu";
|
|
6
4
|
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
@@ -63,7 +61,7 @@ function stringifyCapnpDefaultValue(property, value) {
|
|
|
63
61
|
* @returns A string representation of the value.
|
|
64
62
|
*/
|
|
65
63
|
function stringifyCapnpValue(type, value) {
|
|
66
|
-
return type.kind ===
|
|
64
|
+
return type.kind === ReflectionKind.string || type.kind === ReflectionKind.literal && isString(type.literal) ? `"${String(value)}"` : type.kind === ReflectionKind.enum ? `${camelCase(String(value))}` : type.kind === ReflectionKind.array ? StormJSON.stringify(value) : type.kind === ReflectionKind.object || type.kind === ReflectionKind.objectLiteral ? StormJSON.stringify(value).replaceAll("{", "(").replaceAll("}", ")") : String(value);
|
|
67
65
|
}
|
|
68
66
|
/**
|
|
69
67
|
* Converts a ReflectionProperty's default value to a Cap'n Proto schema string representation.
|
|
@@ -72,7 +70,7 @@ function stringifyCapnpValue(type, value) {
|
|
|
72
70
|
* @returns A string representation of the property.
|
|
73
71
|
*/
|
|
74
72
|
function getCapnpEnumTypes(type) {
|
|
75
|
-
if (type.kind !==
|
|
73
|
+
if (type.kind !== ReflectionKind.enum) return null;
|
|
76
74
|
const unique = getUniqueBy(type.values.filter((value) => !isUndefined(value) && !isNull(value)), (enumMember) => isString(enumMember) ? "Text" : "Float32");
|
|
77
75
|
if (unique.length === 0) return null;
|
|
78
76
|
return unique[0] && isString(unique[0]) ? "Text" : "Float32";
|
|
@@ -84,7 +82,7 @@ function getCapnpEnumTypes(type) {
|
|
|
84
82
|
* @returns True if the Type is a `Void` type, false otherwise.
|
|
85
83
|
*/
|
|
86
84
|
function isVoidType(type) {
|
|
87
|
-
return type.kind ===
|
|
85
|
+
return type.kind === ReflectionKind.void || type.kind === ReflectionKind.never || type.kind === ReflectionKind.null || type.kind === ReflectionKind.undefined || type.kind === ReflectionKind.symbol;
|
|
88
86
|
}
|
|
89
87
|
/**
|
|
90
88
|
* Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.
|
|
@@ -102,7 +100,7 @@ function getCapnpUnionTypes(type) {
|
|
|
102
100
|
* @returns An array of Cap'n Proto primitive types.
|
|
103
101
|
*/
|
|
104
102
|
function isCapnpStringUnion(type) {
|
|
105
|
-
return getCapnpUnionTypes(type).some((member) => member.kind ===
|
|
103
|
+
return getCapnpUnionTypes(type).some((member) => member.kind === ReflectionKind.string);
|
|
106
104
|
}
|
|
107
105
|
const LARGE_BUFFER = 1024 * 1e6;
|
|
108
106
|
const execAsync = promisify(exec);
|
|
@@ -142,7 +140,7 @@ function formatEnumName(name) {
|
|
|
142
140
|
return pascalCase(`${name}_Type`);
|
|
143
141
|
}
|
|
144
142
|
function generateCapnpEnums(reflection) {
|
|
145
|
-
const enums = reflection.getProperties().filter((prop) => !prop.isIgnored() && (prop.type.kind ===
|
|
143
|
+
const enums = reflection.getProperties().filter((prop) => !prop.isIgnored() && (prop.type.kind === ReflectionKind.enum || prop.type.kind === ReflectionKind.union && getCapnpUnionTypes(prop.type).filter((type) => type.kind === ReflectionKind.literal && (isString(type.literal) || isNumber(type.literal))).length === 1)).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? b.getNameAsString().localeCompare(a.getNameAsString()) : a.isReadonly() ? 1 : -1);
|
|
146
144
|
if (enums.length === 0) return "";
|
|
147
145
|
return `${enums.map((enumeration) => generateCapnpEnumSchema(enumeration.type, formatEnumName(enumeration.getNameAsString()))).join("\n\n")}
|
|
148
146
|
|
|
@@ -151,7 +149,7 @@ function generateCapnpEnums(reflection) {
|
|
|
151
149
|
function generateCapnpSchema(reflection, options = {}) {
|
|
152
150
|
let index = 0;
|
|
153
151
|
const indexCounter = options?.indexCounter ?? (() => index++);
|
|
154
|
-
return `${reflection.getProperties().filter((prop) => !prop.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? b.getNameAsString().localeCompare(a.getNameAsString()) : a.isReadonly() ? 1 : -1).map((prop) => generateCapnpPropertySchema(prop, indexCounter)).join(" \n\n ")}${reflection.getMethods().filter((methods) => !methods.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? String(b.getName()).localeCompare(String(a.getName())) : a.isReadonly() ? 1 : -1).map((methods) => generateCapnpMethodSchema(methods, indexCounter)).join(" \n\n ")}${reflection.getProperties().some((prop) => prop.type.kind ===
|
|
152
|
+
return `${reflection.getProperties().filter((prop) => !prop.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? b.getNameAsString().localeCompare(a.getNameAsString()) : a.isReadonly() ? 1 : -1).map((prop) => generateCapnpPropertySchema(prop, indexCounter)).join(" \n\n ")}${reflection.getMethods().filter((methods) => !methods.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? String(b.getName()).localeCompare(String(a.getName())) : a.isReadonly() ? 1 : -1).map((methods) => generateCapnpMethodSchema(methods, indexCounter)).join(" \n\n ")}${reflection.getProperties().some((prop) => prop.type.kind === ReflectionKind.class && prop.type.classType === Map) ? `
|
|
155
153
|
struct Map(Key, Value) {
|
|
156
154
|
entries @0 :List(Entry);
|
|
157
155
|
|
|
@@ -159,7 +157,7 @@ function generateCapnpSchema(reflection, options = {}) {
|
|
|
159
157
|
key @0 :Key;
|
|
160
158
|
value @1 :Value;
|
|
161
159
|
}
|
|
162
|
-
}` : ""}${reflection.getProperties().some((prop) => prop.type.kind ===
|
|
160
|
+
}` : ""}${reflection.getProperties().some((prop) => prop.type.kind === ReflectionKind.class && prop.type.classType === Date) ? `
|
|
163
161
|
struct Date {
|
|
164
162
|
# A standard Gregorian calendar date.
|
|
165
163
|
|
|
@@ -200,17 +198,17 @@ function generateCapnpPropertyComment(reflection) {
|
|
|
200
198
|
return "";
|
|
201
199
|
}
|
|
202
200
|
function generateCapnpPropertySchema(reflection, indexCounter) {
|
|
203
|
-
if (reflection.type.kind ===
|
|
201
|
+
if (reflection.type.kind === ReflectionKind.union) if (getCapnpUnionTypes(reflection.type).length === 0) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Void;
|
|
204
202
|
${generateCapnpPropertyComment(reflection)}`;
|
|
205
|
-
else if (getCapnpUnionTypes(reflection.type).filter((type) => type.kind ===
|
|
203
|
+
else if (getCapnpUnionTypes(reflection.type).filter((type) => type.kind === ReflectionKind.literal && (isString(type.literal) || isNumber(type.literal))).length === 1) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${formatEnumName(reflection.getNameAsString())}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
|
|
206
204
|
${generateCapnpPropertyComment(reflection)}`;
|
|
207
205
|
else return `${camelCase(reflection.getNameAsString())} :union {
|
|
208
206
|
${getCapnpUnionTypes(reflection.type).map((type) => ` ${kindToName(type.kind)} @${indexCounter()} :${generateCapnpPrimitive(type)};`).join("\n")}
|
|
209
207
|
}
|
|
210
208
|
${generateCapnpPropertyComment(reflection)}`;
|
|
211
|
-
else if (reflection.type.kind ===
|
|
209
|
+
else if (reflection.type.kind === ReflectionKind.array) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :List(${generateCapnpPrimitive(reflection.getSubType())})${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
|
|
212
210
|
${generateCapnpPropertyComment(reflection)}`;
|
|
213
|
-
else if (reflection.type.kind ===
|
|
211
|
+
else if (reflection.type.kind === ReflectionKind.class) if (reflection.type.classType === Map) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Map(${!reflection.type.typeArguments || reflection.type.typeArguments.length === 0 || !reflection.type.typeArguments[0] ? "Data" : generateCapnpPrimitive(reflection.type.typeArguments[0])}, ${!reflection.type.typeArguments || reflection.type.typeArguments.length < 2 || !reflection.type.typeArguments[1] ? "Data" : generateCapnpPrimitive(reflection.type.typeArguments[1])})${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
|
|
214
212
|
${generateCapnpPropertyComment(reflection)}`;
|
|
215
213
|
else if (reflection.type.classType === Date) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Data${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
|
|
216
214
|
${generateCapnpPropertyComment(reflection)}`;
|
|
@@ -218,24 +216,24 @@ ${generateCapnpPropertyComment(reflection)}`;
|
|
|
218
216
|
${generateCapnpPropertyComment(reflection)}`;
|
|
219
217
|
else if (reflection.type.classType === ArrayBuffer) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Data${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
|
|
220
218
|
${generateCapnpPropertyComment(reflection)}`;
|
|
221
|
-
else return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(reflection.type.typeName ||
|
|
219
|
+
else return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(reflection.type.typeName || getClassName(reflection.type.classType))}${generateCapnpStruct(reflection.reflectionClass, { name: pascalCase(reflection.type.typeName || getClassName(reflection.type.classType)) })}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
|
|
222
220
|
${generateCapnpPropertyComment(reflection)}`;
|
|
223
|
-
else if (reflection.type.kind ===
|
|
221
|
+
else if (reflection.type.kind === ReflectionKind.objectLiteral) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(reflection.type.typeName || memberNameToString(reflection.getNameAsString()))}${generateCapnpStruct(reflection.reflectionClass, { name: pascalCase(reflection.type.typeName || memberNameToString(reflection.getNameAsString())) })}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
|
|
224
222
|
${generateCapnpPropertyComment(reflection)}`;
|
|
225
|
-
else if (reflection.type.kind ===
|
|
223
|
+
else if (reflection.type.kind === ReflectionKind.enum) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(reflection.getNameAsString())}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
|
|
226
224
|
${generateCapnpPropertyComment(reflection)}`;
|
|
227
225
|
return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${generateCapnpPrimitive(reflection.getType())}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
|
|
228
226
|
${generateCapnpPropertyComment(reflection)}`;
|
|
229
227
|
}
|
|
230
228
|
function generateCapnpEnumSchema(type, name) {
|
|
231
|
-
if (type.kind ===
|
|
232
|
-
kind:
|
|
229
|
+
if (type.kind === ReflectionKind.union) return generateCapnpEnumSchema({
|
|
230
|
+
kind: ReflectionKind.enum,
|
|
233
231
|
indexType: type,
|
|
234
232
|
enum: type.types.reduce((ret, type$1) => {
|
|
235
233
|
if (isString(type$1.literal) || isNumber(type$1.literal)) ret[camelCase(String(type$1.literal))] = type$1.literal;
|
|
236
234
|
return ret;
|
|
237
235
|
}, {}),
|
|
238
|
-
values: getCapnpUnionTypes(type).filter((type$1) => type$1.kind ===
|
|
236
|
+
values: getCapnpUnionTypes(type).filter((type$1) => type$1.kind === ReflectionKind.literal && (isString(type$1.literal) || isNumber(type$1.literal))).map((type$1) => type$1.literal)
|
|
239
237
|
}, name);
|
|
240
238
|
let index = 0;
|
|
241
239
|
const indexCounter = () => index++;
|
|
@@ -252,7 +250,7 @@ ${type.enum && Object.entries(type.enum).length > 0 ? Object.entries(type.enum).
|
|
|
252
250
|
* @returns A string representation of the Cap'n Proto primitive type.
|
|
253
251
|
*/
|
|
254
252
|
function generateCapnpPrimitive(type) {
|
|
255
|
-
return type.kind ===
|
|
253
|
+
return type.kind === ReflectionKind.never || type.kind === ReflectionKind.void || type.kind === ReflectionKind.null || type.kind === ReflectionKind.undefined || type.kind === ReflectionKind.symbol ? "Void" : type.kind === ReflectionKind.class && type.classType === Date ? "Date" : type.kind === ReflectionKind.class && type.classType === Set ? `List(${type.typeArguments && type.typeArguments[0] ? generateCapnpPrimitive(type.typeArguments[0]) : "Data"})` : type.kind === ReflectionKind.bigint ? "UInt64" : type.kind === ReflectionKind.number ? "Float64" : type.kind === ReflectionKind.string || type.kind === ReflectionKind.regexp ? "Text" : type.kind === ReflectionKind.boolean ? "Bool" : type.kind === ReflectionKind.literal ? isNumber(type.literal) ? "Float64" : isBigInt(type.literal) ? "UInt64" : isString(type.literal) ? "Text" : typeof type.literal === "boolean" ? "Bool" : "Data" : "Data";
|
|
256
254
|
}
|
|
257
255
|
|
|
258
256
|
//#endregion
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { type_d_exports } from "../deepkit/src/vendor/type.cjs";
|
|
2
|
-
|
|
3
1
|
//#region src/helpers/typescript.d.ts
|
|
4
2
|
interface GenerateTypeScriptInterfaceOptions<T> {
|
|
5
3
|
overrideName?: string;
|
|
@@ -18,7 +16,7 @@ interface GenerateTypeScriptObjectOptions<T> {
|
|
|
18
16
|
* @param options - Options for generating the object.
|
|
19
17
|
* @returns A string containing the TypeScript object definition.
|
|
20
18
|
*/
|
|
21
|
-
declare function generateTypeScriptObject<T extends Record<string, any>>(reflection:
|
|
19
|
+
declare function generateTypeScriptObject<T extends Record<string, any>>(reflection: ReflectionClass<T>, options?: GenerateTypeScriptObjectOptions<T>): string;
|
|
22
20
|
declare type __ΩGenerateTypeScriptInterfaceOptions = any[];
|
|
23
21
|
declare type __ΩGenerateTypeScriptObjectOptions = any[];
|
|
24
22
|
//#endregion
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { type_d_exports } from "../deepkit/src/vendor/type.mjs";
|
|
2
|
-
|
|
3
1
|
//#region src/helpers/typescript.d.ts
|
|
4
2
|
interface GenerateTypeScriptInterfaceOptions<T> {
|
|
5
3
|
overrideName?: string;
|
|
@@ -18,7 +16,7 @@ interface GenerateTypeScriptObjectOptions<T> {
|
|
|
18
16
|
* @param options - Options for generating the object.
|
|
19
17
|
* @returns A string containing the TypeScript object definition.
|
|
20
18
|
*/
|
|
21
|
-
declare function generateTypeScriptObject<T extends Record<string, any>>(reflection:
|
|
19
|
+
declare function generateTypeScriptObject<T extends Record<string, any>>(reflection: ReflectionClass<T>, options?: GenerateTypeScriptObjectOptions<T>): string;
|
|
22
20
|
declare type __ΩGenerateTypeScriptInterfaceOptions = any[];
|
|
23
21
|
declare type __ΩGenerateTypeScriptObjectOptions = any[];
|
|
24
22
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps, SourceFileHeaderProps } from "../../types/components.cjs";
|
|
2
2
|
import { SourceFileProps as SourceFileProps$1 } from "../../core/components/source-file.cjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core4 from "@alloy-js/core";
|
|
4
4
|
|
|
5
5
|
//#region src/markdown/components/markdown-file.d.ts
|
|
6
6
|
type MarkdownFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps;
|
|
@@ -10,14 +10,14 @@ type MarkdownFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps;
|
|
|
10
10
|
* @param props - The properties for the source file.
|
|
11
11
|
* @returns The rendered source file component.
|
|
12
12
|
*/
|
|
13
|
-
declare function MarkdownFile(props: MarkdownFileProps):
|
|
13
|
+
declare function MarkdownFile(props: MarkdownFileProps): _alloy_js_core4.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Renders the header for a Powerlines Typescript source file.
|
|
16
16
|
*
|
|
17
17
|
* @param props - The properties for the source file header.
|
|
18
18
|
* @returns The rendered source file header.
|
|
19
19
|
*/
|
|
20
|
-
declare function MarkdownFileHeader(props: SourceFileHeaderProps):
|
|
20
|
+
declare function MarkdownFileHeader(props: SourceFileHeaderProps): _alloy_js_core4.Children;
|
|
21
21
|
declare type __ΩMarkdownFileProps = any[];
|
|
22
22
|
//#endregion
|
|
23
23
|
export { MarkdownFile, MarkdownFileHeader, MarkdownFileProps, __ΩMarkdownFileProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps, SourceFileHeaderProps } from "../../types/components.mjs";
|
|
2
2
|
import { SourceFileProps as SourceFileProps$1 } from "../../core/components/source-file.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core7 from "@alloy-js/core";
|
|
4
4
|
|
|
5
5
|
//#region src/markdown/components/markdown-file.d.ts
|
|
6
6
|
type MarkdownFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps;
|
|
@@ -10,14 +10,14 @@ type MarkdownFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps;
|
|
|
10
10
|
* @param props - The properties for the source file.
|
|
11
11
|
* @returns The rendered source file component.
|
|
12
12
|
*/
|
|
13
|
-
declare function MarkdownFile(props: MarkdownFileProps):
|
|
13
|
+
declare function MarkdownFile(props: MarkdownFileProps): _alloy_js_core7.Children;
|
|
14
14
|
/**
|
|
15
15
|
* Renders the header for a Powerlines Typescript source file.
|
|
16
16
|
*
|
|
17
17
|
* @param props - The properties for the source file header.
|
|
18
18
|
* @returns The rendered source file header.
|
|
19
19
|
*/
|
|
20
|
-
declare function MarkdownFileHeader(props: SourceFileHeaderProps):
|
|
20
|
+
declare function MarkdownFileHeader(props: SourceFileHeaderProps): _alloy_js_core7.Children;
|
|
21
21
|
declare type __ΩMarkdownFileProps = any[];
|
|
22
22
|
//#endregion
|
|
23
23
|
export { MarkdownFile, MarkdownFileHeader, MarkdownFileProps, __ΩMarkdownFileProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
2
|
import { MarkdownTableColumnContextInterface } from "../contexts/markdown-table.cjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core6 from "@alloy-js/core";
|
|
4
4
|
|
|
5
5
|
//#region src/markdown/components/markdown-table.d.ts
|
|
6
6
|
interface MarkdownTableProps<T extends Record<string, any> = Record<string, any>> extends ComponentProps {
|
|
@@ -9,18 +9,18 @@ interface MarkdownTableProps<T extends Record<string, any> = Record<string, any>
|
|
|
9
9
|
/**
|
|
10
10
|
* Component that provides a context for rendering markdown tables.
|
|
11
11
|
*/
|
|
12
|
-
declare function MarkdownTable<T extends Record<string, any> = Record<string, any>>(props: MarkdownTableProps<T>):
|
|
12
|
+
declare function MarkdownTable<T extends Record<string, any> = Record<string, any>>(props: MarkdownTableProps<T>): _alloy_js_core6.Children;
|
|
13
13
|
type MarkdownTableColumnProps = ComponentProps & Partial<Pick<MarkdownTableColumnContextInterface, "align">> & Required<Pick<MarkdownTableColumnContextInterface, "name">> & {
|
|
14
14
|
width?: number;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* Component that provides a context for rendering markdown tables.
|
|
18
18
|
*/
|
|
19
|
-
declare function MarkdownTableColumn(props: MarkdownTableColumnProps):
|
|
19
|
+
declare function MarkdownTableColumn(props: MarkdownTableColumnProps): _alloy_js_core6.Children;
|
|
20
20
|
/**
|
|
21
21
|
* Component that provides a context for rendering markdown tables.
|
|
22
22
|
*/
|
|
23
|
-
declare function MarkdownTableColumnHeader(props: MarkdownTableColumnProps):
|
|
23
|
+
declare function MarkdownTableColumnHeader(props: MarkdownTableColumnProps): _alloy_js_core6.Children;
|
|
24
24
|
declare type __ΩMarkdownTableProps = any[];
|
|
25
25
|
declare type __ΩMarkdownTableColumnProps = any[];
|
|
26
26
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.mjs";
|
|
2
2
|
import { MarkdownTableColumnContextInterface } from "../contexts/markdown-table.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
4
4
|
|
|
5
5
|
//#region src/markdown/components/markdown-table.d.ts
|
|
6
6
|
interface MarkdownTableProps<T extends Record<string, any> = Record<string, any>> extends ComponentProps {
|
|
@@ -9,18 +9,18 @@ interface MarkdownTableProps<T extends Record<string, any> = Record<string, any>
|
|
|
9
9
|
/**
|
|
10
10
|
* Component that provides a context for rendering markdown tables.
|
|
11
11
|
*/
|
|
12
|
-
declare function MarkdownTable<T extends Record<string, any> = Record<string, any>>(props: MarkdownTableProps<T>):
|
|
12
|
+
declare function MarkdownTable<T extends Record<string, any> = Record<string, any>>(props: MarkdownTableProps<T>): _alloy_js_core0.Children;
|
|
13
13
|
type MarkdownTableColumnProps = ComponentProps & Partial<Pick<MarkdownTableColumnContextInterface, "align">> & Required<Pick<MarkdownTableColumnContextInterface, "name">> & {
|
|
14
14
|
width?: number;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* Component that provides a context for rendering markdown tables.
|
|
18
18
|
*/
|
|
19
|
-
declare function MarkdownTableColumn(props: MarkdownTableColumnProps):
|
|
19
|
+
declare function MarkdownTableColumn(props: MarkdownTableColumnProps): _alloy_js_core0.Children;
|
|
20
20
|
/**
|
|
21
21
|
* Component that provides a context for rendering markdown tables.
|
|
22
22
|
*/
|
|
23
|
-
declare function MarkdownTableColumnHeader(props: MarkdownTableColumnProps):
|
|
23
|
+
declare function MarkdownTableColumnHeader(props: MarkdownTableColumnProps): _alloy_js_core0.Children;
|
|
24
24
|
declare type __ΩMarkdownTableProps = any[];
|
|
25
25
|
declare type __ΩMarkdownTableColumnProps = any[];
|
|
26
26
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core12 from "@alloy-js/core";
|
|
2
2
|
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
3
3
|
|
|
4
4
|
//#region src/typescript/components/dynamic-import-statement.d.ts
|
|
@@ -26,7 +26,7 @@ interface DynamicImportStatementProps extends Omit<VarDeclarationProps, "initial
|
|
|
26
26
|
* @param props - The properties for the dynamic import statement.
|
|
27
27
|
* @returns A `VarDeclaration` component representing the dynamic import statement.
|
|
28
28
|
*/
|
|
29
|
-
declare function DynamicImportStatement(props: DynamicImportStatementProps):
|
|
29
|
+
declare function DynamicImportStatement(props: DynamicImportStatementProps): _alloy_js_core12.Children;
|
|
30
30
|
declare type __ΩDynamicImportStatementProps = any[];
|
|
31
31
|
//#endregion
|
|
32
32
|
export { DynamicImportStatement, DynamicImportStatementProps, __ΩDynamicImportStatementProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core14 from "@alloy-js/core";
|
|
2
2
|
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
3
3
|
|
|
4
4
|
//#region src/typescript/components/dynamic-import-statement.d.ts
|
|
@@ -26,7 +26,7 @@ interface DynamicImportStatementProps extends Omit<VarDeclarationProps, "initial
|
|
|
26
26
|
* @param props - The properties for the dynamic import statement.
|
|
27
27
|
* @returns A `VarDeclaration` component representing the dynamic import statement.
|
|
28
28
|
*/
|
|
29
|
-
declare function DynamicImportStatement(props: DynamicImportStatementProps):
|
|
29
|
+
declare function DynamicImportStatement(props: DynamicImportStatementProps): _alloy_js_core14.Children;
|
|
30
30
|
declare type __ΩDynamicImportStatementProps = any[];
|
|
31
31
|
//#endregion
|
|
32
32
|
export { DynamicImportStatement, DynamicImportStatementProps, __ΩDynamicImportStatementProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResolvedEntryTypeDefinition } from "../../powerlines/src/types/resolved.mjs";
|
|
2
2
|
import { TypescriptFileProps } from "./typescript-file.mjs";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alloy_js_core15 from "@alloy-js/core";
|
|
4
4
|
|
|
5
5
|
//#region src/typescript/components/entry-file.d.ts
|
|
6
6
|
type EntryFileProps = TypescriptFileProps & {
|
|
@@ -21,7 +21,7 @@ type EntryFileProps = TypescriptFileProps & {
|
|
|
21
21
|
* @param props - The properties for the source file.
|
|
22
22
|
* @returns The rendered source file component.
|
|
23
23
|
*/
|
|
24
|
-
declare function EntryFile(props: EntryFileProps):
|
|
24
|
+
declare function EntryFile(props: EntryFileProps): _alloy_js_core15.Children;
|
|
25
25
|
declare type __ΩEntryFileProps = any[];
|
|
26
26
|
//#endregion
|
|
27
27
|
export { EntryFile, EntryFileProps, __ΩEntryFileProps };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { TSDocProps } from "./tsdoc.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _alloy_js_core9 from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/typescript/components/tsdoc-reflection.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Generates a TypeScript interface property for the given reflection class.
|
|
7
7
|
*/
|
|
8
|
-
declare function TSDocReflectionClass<T extends Record<string, any> = Record<string, any>>(props: TSDocProps):
|
|
8
|
+
declare function TSDocReflectionClass<T extends Record<string, any> = Record<string, any>>(props: TSDocProps): _alloy_js_core9.Children;
|
|
9
9
|
/**
|
|
10
10
|
* Generates a TypeScript interface property for the given reflection class.
|
|
11
11
|
*/
|
|
12
|
-
declare function TSDocReflectionProperty(props: TSDocProps):
|
|
12
|
+
declare function TSDocReflectionProperty(props: TSDocProps): _alloy_js_core9.Children;
|
|
13
13
|
/**
|
|
14
14
|
* Generates a TypeScript interface property for the given reflection class.
|
|
15
15
|
*/
|
|
16
|
-
declare function TSDocReflectionMethod(props: TSDocProps):
|
|
16
|
+
declare function TSDocReflectionMethod(props: TSDocProps): _alloy_js_core9.Children;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_core_contexts_reflection = require('../../core/contexts/reflection.cjs');
|
|
3
|
-
const require_type = require('../../deepkit/src/vendor/type.cjs');
|
|
4
3
|
const require_typescript_components_tsdoc_reflection = require('./tsdoc-reflection.cjs');
|
|
5
4
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
5
|
let __alloy_js_core = require("@alloy-js/core");
|
|
@@ -57,7 +56,7 @@ function TypescriptInterfaceProperty(props) {
|
|
|
57
56
|
return property.isNullable();
|
|
58
57
|
},
|
|
59
58
|
get type() {
|
|
60
|
-
return
|
|
59
|
+
return stringifyType(property.getType());
|
|
61
60
|
}
|
|
62
61
|
}, rest))];
|
|
63
62
|
}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.cjs";
|
|
2
|
-
import
|
|
3
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import * as _alloy_js_core15 from "@alloy-js/core";
|
|
4
3
|
import { InterfaceDeclarationProps, InterfaceMemberProps } from "@alloy-js/typescript";
|
|
5
4
|
|
|
6
5
|
//#region src/typescript/components/typescript-interface.d.ts
|
|
7
6
|
interface TypeScriptInterfaceProps<T extends Record<string, any> = Record<string, any>> extends InterfaceDeclarationProps, ComponentProps {
|
|
8
|
-
reflection:
|
|
7
|
+
reflection: ReflectionClass<T>;
|
|
9
8
|
defaultValue?: Partial<T>;
|
|
10
9
|
}
|
|
11
10
|
interface TypescriptInterfacePropertyProps extends Omit<InterfaceMemberProps, "name">, ComponentProps {
|
|
12
|
-
property:
|
|
11
|
+
property: ReflectionProperty;
|
|
13
12
|
}
|
|
14
13
|
/**
|
|
15
14
|
* Generates a TypeScript interface for the given reflection class.
|
|
16
15
|
*/
|
|
17
|
-
declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>):
|
|
16
|
+
declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core15.Children;
|
|
18
17
|
/**
|
|
19
18
|
* Generates a TypeScript interface property for the given reflection class.
|
|
20
19
|
*/
|
|
21
|
-
declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps):
|
|
20
|
+
declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core15.Children;
|
|
22
21
|
declare type __ΩTypeScriptInterfaceProps = any[];
|
|
23
22
|
declare type __ΩTypescriptInterfacePropertyProps = any[];
|
|
24
23
|
//#endregion
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { ComponentProps } from "../../types/components.mjs";
|
|
2
|
-
import { type_d_exports } from "../../deepkit/src/vendor/type.mjs";
|
|
3
2
|
import * as _alloy_js_core9 from "@alloy-js/core";
|
|
4
3
|
import { InterfaceDeclarationProps, InterfaceMemberProps } from "@alloy-js/typescript";
|
|
5
4
|
|
|
6
5
|
//#region src/typescript/components/typescript-interface.d.ts
|
|
7
6
|
interface TypeScriptInterfaceProps<T extends Record<string, any> = Record<string, any>> extends InterfaceDeclarationProps, ComponentProps {
|
|
8
|
-
reflection:
|
|
7
|
+
reflection: ReflectionClass<T>;
|
|
9
8
|
defaultValue?: Partial<T>;
|
|
10
9
|
}
|
|
11
10
|
interface TypescriptInterfacePropertyProps extends Omit<InterfaceMemberProps, "name">, ComponentProps {
|
|
12
|
-
property:
|
|
11
|
+
property: ReflectionProperty;
|
|
13
12
|
}
|
|
14
13
|
/**
|
|
15
14
|
* Generates a TypeScript interface for the given reflection class.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
|
|
2
|
-
import { type_exports } from "../../deepkit/src/vendor/type.mjs";
|
|
3
2
|
import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
|
|
4
3
|
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
4
|
import { For, computed, splitProps } from "@alloy-js/core";
|
|
@@ -56,7 +55,7 @@ function TypescriptInterfaceProperty(props) {
|
|
|
56
55
|
return property.isNullable();
|
|
57
56
|
},
|
|
58
57
|
get type() {
|
|
59
|
-
return
|
|
58
|
+
return stringifyType(property.getType());
|
|
60
59
|
}
|
|
61
60
|
}, rest))];
|
|
62
61
|
}
|