@powerlines/plugin-nodejs 0.1.0 → 0.1.1
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 +29 -0
- package/dist/components/env.cjs +188 -2
- package/dist/components/env.d.cts +9 -2
- package/dist/components/env.d.mts +9 -2
- package/dist/components/env.mjs +185 -1
- package/dist/components/index.cjs +2 -3
- package/dist/components/index.d.cts +1 -3
- package/dist/components/index.d.mts +1 -3
- package/dist/components/index.mjs +1 -2
- package/dist/deepkit/schemas/reflection.cjs +3940 -0
- package/dist/{plugin-D7kBf19k.d.cts → deepkit/schemas/reflection.d.cts} +1 -1078
- package/dist/{plugin-JL1BtFku.d.mts → deepkit/schemas/reflection.d.mts} +59 -1136
- package/dist/deepkit/schemas/reflection.mjs +3938 -0
- package/dist/deepkit/schemas/reflection2.cjs +4112 -0
- package/dist/deepkit/schemas/reflection2.mjs +4110 -0
- package/dist/deepkit/src/capnp.cjs +913 -0
- package/dist/deepkit/src/capnp.mjs +911 -0
- package/dist/deepkit/src/esbuild-plugin.cjs +47 -0
- package/dist/deepkit/src/esbuild-plugin.mjs +46 -0
- package/dist/deepkit/src/reflect-type.cjs +22 -0
- package/dist/deepkit/src/reflect-type.mjs +20 -0
- package/dist/deepkit/src/resolve-reflections.cjs +16 -0
- package/dist/deepkit/src/resolve-reflections.mjs +15 -0
- package/dist/deepkit/src/transformer.cjs +52 -0
- package/dist/deepkit/src/transformer.mjs +49 -0
- package/dist/deepkit/src/transpile.cjs +29 -0
- package/dist/deepkit/src/transpile.mjs +27 -0
- package/dist/deepkit/src/types.d.cts +10 -0
- package/dist/deepkit/src/types.d.mts +10 -0
- package/dist/deepkit/src/utilities.cjs +66 -0
- package/dist/deepkit/src/utilities.mjs +65 -0
- package/dist/index.cjs +14 -813
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +11 -803
- package/dist/plugin-alloy/src/core/components/output.cjs +45 -0
- package/dist/plugin-alloy/src/core/components/output.mjs +44 -0
- package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +22 -0
- package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +21 -0
- package/dist/plugin-alloy/src/core/components/source-file.cjs +64 -0
- package/dist/plugin-alloy/src/core/components/source-file.d.cts +23 -0
- package/dist/plugin-alloy/src/core/components/source-file.d.mts +23 -0
- package/dist/plugin-alloy/src/core/components/source-file.mjs +62 -0
- package/dist/plugin-alloy/src/core/contexts/context.cjs +60 -0
- package/dist/plugin-alloy/src/core/contexts/context.mjs +54 -0
- package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
- package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
- package/dist/plugin-alloy/src/core/contexts/reflection.cjs +46 -0
- package/dist/plugin-alloy/src/core/contexts/reflection.mjs +42 -0
- package/dist/plugin-alloy/src/helpers/refkey.cjs +16 -0
- package/dist/plugin-alloy/src/helpers/refkey.mjs +15 -0
- package/dist/plugin-alloy/src/index.cjs +93 -0
- package/dist/plugin-alloy/src/index.mjs +91 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +7 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +9 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +5 -0
- package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +7 -0
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +17 -0
- package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +17 -0
- package/dist/plugin-alloy/src/types/components.d.cts +22 -0
- package/dist/plugin-alloy/src/types/components.d.mts +24 -0
- package/dist/plugin-alloy/src/types/index.d.mts +2 -0
- package/dist/plugin-alloy/src/types/plugin.d.cts +37 -0
- package/dist/plugin-alloy/src/types/plugin.d.mts +37 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +57 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +25 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +26 -0
- package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +56 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +126 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +124 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +442 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +27 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +28 -0
- package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +433 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +194 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +14 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +15 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +191 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +68 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +1 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +4 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +67 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +124 -0
- package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +123 -0
- package/dist/plugin-automd/src/index.cjs +101 -0
- package/dist/plugin-automd/src/index.mjs +98 -0
- package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
- package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
- package/dist/plugin-automd/src/types/toc.d.cts +33 -0
- package/dist/plugin-automd/src/types/toc.d.mts +33 -0
- package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -0
- package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -0
- package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -0
- package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -0
- package/dist/plugin-babel/src/helpers/filters.cjs +23 -0
- package/dist/plugin-babel/src/helpers/filters.mjs +21 -0
- package/dist/plugin-babel/src/helpers/index.cjs +5 -0
- package/dist/plugin-babel/src/helpers/index.mjs +7 -0
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -0
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -0
- package/dist/plugin-babel/src/helpers/options.cjs +50 -0
- package/dist/plugin-babel/src/helpers/options.mjs +47 -0
- package/dist/plugin-babel/src/index.cjs +91 -0
- package/dist/plugin-babel/src/index.mjs +89 -0
- package/dist/plugin-babel/src/types/index.d.mts +1 -0
- package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
- package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
- package/dist/plugin-env/src/babel/index.cjs +1 -0
- package/dist/plugin-env/src/babel/index.mjs +3 -0
- package/dist/plugin-env/src/babel/plugin.cjs +121 -0
- package/dist/plugin-env/src/babel/plugin.mjs +119 -0
- package/dist/plugin-env/src/components/docs.cjs +9 -0
- package/dist/plugin-env/src/components/docs.mjs +11 -0
- package/dist/plugin-env/src/components/env.cjs +575 -0
- package/dist/plugin-env/src/components/env.d.cts +11 -0
- package/dist/plugin-env/src/components/env.d.mts +11 -0
- package/dist/plugin-env/src/components/env.mjs +572 -0
- package/dist/plugin-env/src/components/index.cjs +2 -0
- package/dist/plugin-env/src/components/index.mjs +4 -0
- package/dist/plugin-env/src/helpers/automd-generator.cjs +22 -0
- package/dist/plugin-env/src/helpers/automd-generator.mjs +21 -0
- package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +55 -0
- package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +54 -0
- package/dist/plugin-env/src/helpers/index.cjs +6 -0
- package/dist/plugin-env/src/helpers/index.mjs +8 -0
- package/dist/plugin-env/src/helpers/load.cjs +83 -0
- package/dist/plugin-env/src/helpers/load.mjs +80 -0
- package/dist/plugin-env/src/helpers/persistence.cjs +199 -0
- package/dist/plugin-env/src/helpers/persistence.mjs +188 -0
- package/dist/plugin-env/src/helpers/reflect.cjs +111 -0
- package/dist/plugin-env/src/helpers/reflect.mjs +103 -0
- package/dist/plugin-env/src/helpers/source-file-env.cjs +24 -0
- package/dist/plugin-env/src/helpers/source-file-env.mjs +23 -0
- package/dist/plugin-env/src/helpers/template-helpers.cjs +2 -0
- package/dist/plugin-env/src/helpers/template-helpers.mjs +4 -0
- package/dist/plugin-env/src/index.cjs +175 -0
- package/dist/plugin-env/src/index.mjs +173 -0
- package/dist/plugin-env/src/types/plugin.d.cts +151 -0
- package/dist/plugin-env/src/types/plugin.d.mts +153 -0
- package/dist/plugin-env/src/types/runtime.d.cts +792 -0
- package/dist/plugin-env/src/types/runtime.d.mts +792 -0
- package/dist/powerlines/src/lib/build/esbuild.cjs +102 -0
- package/dist/powerlines/src/lib/build/esbuild.mjs +100 -0
- package/dist/powerlines/src/lib/entry.cjs +12 -0
- package/dist/powerlines/src/lib/entry.mjs +14 -0
- package/dist/powerlines/src/lib/logger.cjs +41 -0
- package/dist/powerlines/src/lib/logger.mjs +39 -0
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +38 -0
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +35 -0
- package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -0
- package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -0
- package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -0
- package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -0
- package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
- package/dist/powerlines/src/plugin-utils/paths.mjs +3 -0
- package/dist/powerlines/src/types/babel.d.cts +22 -0
- package/dist/powerlines/src/types/babel.d.mts +22 -0
- package/dist/powerlines/src/types/build.d.cts +145 -0
- package/dist/powerlines/src/types/build.d.mts +145 -0
- package/dist/powerlines/src/types/commands.d.cts +8 -0
- package/dist/powerlines/src/types/commands.d.mts +9 -0
- package/dist/powerlines/src/types/config.d.cts +387 -0
- package/dist/powerlines/src/types/config.d.mts +388 -0
- package/dist/powerlines/src/types/context.d.cts +414 -0
- package/dist/powerlines/src/types/context.d.mts +416 -0
- package/dist/powerlines/src/types/fs.d.cts +486 -0
- package/dist/powerlines/src/types/fs.d.mts +486 -0
- package/dist/powerlines/src/types/hooks.d.mts +2 -0
- package/dist/powerlines/src/types/plugin.d.cts +231 -0
- package/dist/powerlines/src/types/plugin.d.mts +231 -0
- package/dist/powerlines/src/types/resolved.d.cts +82 -0
- package/dist/powerlines/src/types/resolved.d.mts +82 -0
- package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
- package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
- package/dist/types/index.cjs +0 -2
- package/dist/types/index.d.cts +1 -3
- package/dist/types/index.d.mts +1 -3
- package/dist/types/index.mjs +0 -3
- package/dist/types/plugin.cjs +0 -1
- package/dist/types/plugin.d.cts +22 -2
- package/dist/types/plugin.d.mts +22 -2
- package/dist/types/plugin.mjs +0 -2
- package/package.json +6 -6
- package/dist/components-BWLXb7a2.cjs +0 -0
- package/dist/components-CXZYcH4q.d.mts +0 -1816
- package/dist/components-kh0CpIG2.mjs +0 -1
- package/dist/env-CAhIy_H3.cjs +0 -11713
- package/dist/env-CUyFiniR.d.cts +0 -107
- package/dist/env-IF4XhMjG.mjs +0 -11570
- package/dist/env-sRb-Y8mJ.d.mts +0 -89
- package/dist/index-CUbWeWHc.d.mts +0 -1
- package/dist/index-D6CnpA_r.d.cts +0 -1
- package/dist/index-DL0uimUT.d.mts +0 -1
- package/dist/index-DWPDThxu.d.cts +0 -1
- package/dist/plugin-ifZVa20V.mjs +0 -1
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/resolved-zsx09G03.d.cts +0 -1795
- package/dist/types-U3zd8PTP.mjs +0 -1
- package/dist/types-o3zWarRp.cjs +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { usePowerlines } from "../../core/contexts/context.mjs";
|
|
2
|
+
import { SingleLineComment } from "../../core/components/single-line-comment.mjs";
|
|
3
|
+
import { SourceFile } from "../../core/components/source-file.mjs";
|
|
4
|
+
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
6
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
7
|
+
import { Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
|
|
8
|
+
import { appendPath } from "@stryke/path/append";
|
|
9
|
+
import { ImportStatements, PackageContext, SourceFileContext as SourceFileContext$1, TSModuleScope, getSourceDirectoryData, useSourceFile } from "@alloy-js/typescript";
|
|
10
|
+
import { isBoolean } from "@stryke/type-checks/is-boolean";
|
|
11
|
+
|
|
12
|
+
//#region ../plugin-alloy/src/typescript/components/typescript-file.tsx
|
|
13
|
+
/**
|
|
14
|
+
* A base component representing a Powerlines generated Typescript source file.
|
|
15
|
+
*
|
|
16
|
+
* @param props - The properties for the source file.
|
|
17
|
+
* @returns The rendered source file component.
|
|
18
|
+
*/
|
|
19
|
+
function TypescriptFile(props) {
|
|
20
|
+
const [{ children, path, imports, tsx, header, hashbang }, rest] = splitProps(props, [
|
|
21
|
+
"children",
|
|
22
|
+
"path",
|
|
23
|
+
"imports",
|
|
24
|
+
"tsx",
|
|
25
|
+
"header",
|
|
26
|
+
"hashbang"
|
|
27
|
+
]);
|
|
28
|
+
const directoryContext = useContext(SourceDirectoryContext);
|
|
29
|
+
const sdData = getSourceDirectoryData(directoryContext);
|
|
30
|
+
const modulePath = appendPath(path, directoryContext.path);
|
|
31
|
+
const scope = new TSModuleScope(modulePath, useScope());
|
|
32
|
+
sdData.modules.add(scope);
|
|
33
|
+
const pkg = useContext(PackageContext);
|
|
34
|
+
if (pkg) pkg.scope.addModule(scope);
|
|
35
|
+
if (props.export) {
|
|
36
|
+
if (pkg) if (isBoolean(props.export)) pkg.scope.addExport(modulePath, scope);
|
|
37
|
+
else pkg.scope.addExport(props.export, scope);
|
|
38
|
+
}
|
|
39
|
+
return createComponent(SourceFileContext$1.Provider, {
|
|
40
|
+
value: { scope },
|
|
41
|
+
get children() {
|
|
42
|
+
return createComponent(Scope, {
|
|
43
|
+
value: scope,
|
|
44
|
+
get children() {
|
|
45
|
+
return createComponent(SourceFile, mergeProps(rest, {
|
|
46
|
+
path: modulePath,
|
|
47
|
+
get header() {
|
|
48
|
+
return header ?? createComponent(TypescriptFileHeader, {
|
|
49
|
+
hashbang,
|
|
50
|
+
get children() {
|
|
51
|
+
return createComponent(TypescriptFileHeaderImports, {
|
|
52
|
+
imports,
|
|
53
|
+
scope
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
filetype: tsx ? "tsx" : "typescript",
|
|
59
|
+
children
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Renders the header for a Powerlines Typescript source file.
|
|
68
|
+
*
|
|
69
|
+
* @param props - The properties for the source file header.
|
|
70
|
+
* @returns The rendered source file header.
|
|
71
|
+
*/
|
|
72
|
+
function TypescriptFileHeader(props) {
|
|
73
|
+
const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
|
|
74
|
+
const context = usePowerlines();
|
|
75
|
+
return [
|
|
76
|
+
createComponent(Show, {
|
|
77
|
+
get when() {
|
|
78
|
+
return Boolean(hashbang);
|
|
79
|
+
},
|
|
80
|
+
get children() {
|
|
81
|
+
return [memo(() => hashbang === true ? code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang), createIntrinsic("hbr", {})];
|
|
82
|
+
}
|
|
83
|
+
}),
|
|
84
|
+
createComponent(Show, {
|
|
85
|
+
get when() {
|
|
86
|
+
return Boolean(header);
|
|
87
|
+
},
|
|
88
|
+
get children() {
|
|
89
|
+
return [header, createIntrinsic("hbr", {})];
|
|
90
|
+
}
|
|
91
|
+
}),
|
|
92
|
+
createIntrinsic("hbr", {}),
|
|
93
|
+
createComponent(Show, {
|
|
94
|
+
get when() {
|
|
95
|
+
return Boolean(disableEslint);
|
|
96
|
+
},
|
|
97
|
+
get children() {
|
|
98
|
+
return [createComponent(SingleLineComment, {
|
|
99
|
+
variant: "slash-star",
|
|
100
|
+
children: "eslint-disable"
|
|
101
|
+
}), createIntrinsic("hbr", {})];
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
createComponent(Show, {
|
|
105
|
+
get when() {
|
|
106
|
+
return Boolean(disablePrettier);
|
|
107
|
+
},
|
|
108
|
+
get children() {
|
|
109
|
+
return [createComponent(SingleLineComment, {
|
|
110
|
+
variant: "slash-star",
|
|
111
|
+
children: "prettier-ignore"
|
|
112
|
+
}), createIntrinsic("hbr", {})];
|
|
113
|
+
}
|
|
114
|
+
}),
|
|
115
|
+
createComponent(Show, {
|
|
116
|
+
get when() {
|
|
117
|
+
return Boolean(disableBiome);
|
|
118
|
+
},
|
|
119
|
+
get children() {
|
|
120
|
+
return [createComponent(SingleLineComment, { children: "biome-ignore lint: disable" }), createIntrinsic("hbr", {})];
|
|
121
|
+
}
|
|
122
|
+
}),
|
|
123
|
+
createComponent(Show, {
|
|
124
|
+
get when() {
|
|
125
|
+
return Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome);
|
|
126
|
+
},
|
|
127
|
+
get children() {
|
|
128
|
+
return createIntrinsic("hbr", {});
|
|
129
|
+
}
|
|
130
|
+
}),
|
|
131
|
+
createComponent(Show, {
|
|
132
|
+
get when() {
|
|
133
|
+
return Boolean(children);
|
|
134
|
+
},
|
|
135
|
+
get children() {
|
|
136
|
+
return [children, createIntrinsic("hbr", {})];
|
|
137
|
+
}
|
|
138
|
+
}),
|
|
139
|
+
createComponent(SingleLineComment, { get children() {
|
|
140
|
+
return code`Generated by ${titleCase(context?.config.framework) || "Powerlines"}`;
|
|
141
|
+
} }),
|
|
142
|
+
createIntrinsic("hbr", {}),
|
|
143
|
+
createComponent(SingleLineComment, { children: code`NOTE: Do not edit this file manually - it will be overwritten automatically by the "prepare" command` }),
|
|
144
|
+
createIntrinsic("hbr", {})
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Renders the header for a Powerlines Typescript source file.
|
|
149
|
+
*
|
|
150
|
+
* @param props - The properties for the source file header.
|
|
151
|
+
* @returns The rendered source file header.
|
|
152
|
+
*/
|
|
153
|
+
function TypescriptFileHeaderImports(props) {
|
|
154
|
+
const { imports } = props;
|
|
155
|
+
const context = usePowerlines();
|
|
156
|
+
const sourceFile = useSourceFile();
|
|
157
|
+
const scope = props.scope ?? sourceFile.scope;
|
|
158
|
+
return createComponent(Show, {
|
|
159
|
+
get when() {
|
|
160
|
+
return scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0;
|
|
161
|
+
},
|
|
162
|
+
get children() {
|
|
163
|
+
return [
|
|
164
|
+
createComponent(Show, {
|
|
165
|
+
get when() {
|
|
166
|
+
return !!imports && Object.keys(imports).length > 0;
|
|
167
|
+
},
|
|
168
|
+
get children() {
|
|
169
|
+
return Object.entries(imports ?? {}).filter(([key]) => key !== "$builtins").concat(imports && imports.$builtins ? Object.entries(imports.$builtins).map(([key, entry]) => [key.includes(":") ? key : `${context.config.output.builtinPrefix}:${key}`, entry]) : []).map(([module, imported]) => {
|
|
170
|
+
return code`import ${imported === null ? "" : imported.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (imported.filter((i) => !isString(i) && i.default).length > 0 && imported.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (imported.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${imported.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} from "${module}";`;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}),
|
|
174
|
+
createComponent(Show, {
|
|
175
|
+
get when() {
|
|
176
|
+
return scope.importedModules.size > 0;
|
|
177
|
+
},
|
|
178
|
+
get children() {
|
|
179
|
+
return createComponent(ImportStatements, { get records() {
|
|
180
|
+
return scope.importedModules;
|
|
181
|
+
} });
|
|
182
|
+
}
|
|
183
|
+
}),
|
|
184
|
+
createIntrinsic("hbr", {})
|
|
185
|
+
];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
//#endregion
|
|
191
|
+
export { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_reflection = require('../../core/contexts/reflection.cjs');
|
|
3
|
+
const require_tsdoc_reflection = require('./tsdoc-reflection.cjs');
|
|
4
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
6
|
+
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
7
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
8
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
9
|
+
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
10
|
+
|
|
11
|
+
//#region ../plugin-alloy/src/typescript/components/typescript-interface.tsx
|
|
12
|
+
/**
|
|
13
|
+
* Generates a TypeScript interface for the given reflection class.
|
|
14
|
+
*/
|
|
15
|
+
function TypeScriptInterface(props) {
|
|
16
|
+
const [{ name, reflection }, rest] = (0, __alloy_js_core.splitProps)(props, ["name", "reflection"]);
|
|
17
|
+
const interfaceName = (0, __alloy_js_core.computed)(() => (0, __stryke_string_format_pascal_case.pascalCase)(((0, __stryke_type_checks_is_string.isString)(name) ? name : name.toString()) || reflection.getName()));
|
|
18
|
+
const properties = reflection.getProperties().filter((item) => !item.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1);
|
|
19
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_reflection.ReflectionClassContext.Provider, {
|
|
20
|
+
value: { reflection },
|
|
21
|
+
get children() {
|
|
22
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc_reflection.TSDocReflectionClass, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceDeclaration, (0, __alloy_js_core_jsx_runtime.mergeProps)({
|
|
23
|
+
"export": true,
|
|
24
|
+
get name() {
|
|
25
|
+
return interfaceName.value;
|
|
26
|
+
}
|
|
27
|
+
}, rest, { get children() {
|
|
28
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
29
|
+
each: properties,
|
|
30
|
+
doubleHardline: true,
|
|
31
|
+
semicolon: true,
|
|
32
|
+
children: (prop) => (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptInterfaceProperty, { property: prop })
|
|
33
|
+
});
|
|
34
|
+
} }))];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Generates a TypeScript interface property for the given reflection class.
|
|
40
|
+
*/
|
|
41
|
+
function TypescriptInterfaceProperty(props) {
|
|
42
|
+
const [{ property }, rest] = (0, __alloy_js_core.splitProps)(props, ["property"]);
|
|
43
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_reflection.ReflectionPropertyContext.Provider, {
|
|
44
|
+
value: property,
|
|
45
|
+
get children() {
|
|
46
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc_reflection.TSDocReflectionProperty, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceMember, (0, __alloy_js_core_jsx_runtime.mergeProps)({
|
|
47
|
+
get name() {
|
|
48
|
+
return property.getNameAsString();
|
|
49
|
+
},
|
|
50
|
+
get readonly() {
|
|
51
|
+
return property.isReadonly();
|
|
52
|
+
},
|
|
53
|
+
get optional() {
|
|
54
|
+
return property.isOptional();
|
|
55
|
+
},
|
|
56
|
+
get nullish() {
|
|
57
|
+
return property.isNullable();
|
|
58
|
+
},
|
|
59
|
+
get type() {
|
|
60
|
+
return (0, __powerlines_deepkit_vendor_type.stringifyType)(property.getType());
|
|
61
|
+
}
|
|
62
|
+
}, rest))];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
exports.TypeScriptInterface = TypeScriptInterface;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
|
|
2
|
+
import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
|
|
3
|
+
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
5
|
+
import { stringifyType } from "@powerlines/deepkit/vendor/type";
|
|
6
|
+
import { For, computed, splitProps } from "@alloy-js/core";
|
|
7
|
+
import { InterfaceDeclaration, InterfaceMember } from "@alloy-js/typescript";
|
|
8
|
+
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
9
|
+
|
|
10
|
+
//#region ../plugin-alloy/src/typescript/components/typescript-interface.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Generates a TypeScript interface for the given reflection class.
|
|
13
|
+
*/
|
|
14
|
+
function TypeScriptInterface(props) {
|
|
15
|
+
const [{ name, reflection }, rest] = splitProps(props, ["name", "reflection"]);
|
|
16
|
+
const interfaceName = computed(() => pascalCase((isString(name) ? name : name.toString()) || reflection.getName()));
|
|
17
|
+
const properties = reflection.getProperties().filter((item) => !item.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1);
|
|
18
|
+
return createComponent(ReflectionClassContext.Provider, {
|
|
19
|
+
value: { reflection },
|
|
20
|
+
get children() {
|
|
21
|
+
return [createComponent(TSDocReflectionClass, {}), createComponent(InterfaceDeclaration, mergeProps({
|
|
22
|
+
"export": true,
|
|
23
|
+
get name() {
|
|
24
|
+
return interfaceName.value;
|
|
25
|
+
}
|
|
26
|
+
}, rest, { get children() {
|
|
27
|
+
return createComponent(For, {
|
|
28
|
+
each: properties,
|
|
29
|
+
doubleHardline: true,
|
|
30
|
+
semicolon: true,
|
|
31
|
+
children: (prop) => createComponent(TypescriptInterfaceProperty, { property: prop })
|
|
32
|
+
});
|
|
33
|
+
} }))];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Generates a TypeScript interface property for the given reflection class.
|
|
39
|
+
*/
|
|
40
|
+
function TypescriptInterfaceProperty(props) {
|
|
41
|
+
const [{ property }, rest] = splitProps(props, ["property"]);
|
|
42
|
+
return createComponent(ReflectionPropertyContext.Provider, {
|
|
43
|
+
value: property,
|
|
44
|
+
get children() {
|
|
45
|
+
return [createComponent(TSDocReflectionProperty, {}), createComponent(InterfaceMember, mergeProps({
|
|
46
|
+
get name() {
|
|
47
|
+
return property.getNameAsString();
|
|
48
|
+
},
|
|
49
|
+
get readonly() {
|
|
50
|
+
return property.isReadonly();
|
|
51
|
+
},
|
|
52
|
+
get optional() {
|
|
53
|
+
return property.isOptional();
|
|
54
|
+
},
|
|
55
|
+
get nullish() {
|
|
56
|
+
return property.isNullable();
|
|
57
|
+
},
|
|
58
|
+
get type() {
|
|
59
|
+
return stringifyType(property.getType());
|
|
60
|
+
}
|
|
61
|
+
}, rest))];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
export { TypeScriptInterface };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_utilities = require('../../../../deepkit/src/utilities.cjs');
|
|
3
|
+
const require_reflection = require('../../core/contexts/reflection.cjs');
|
|
4
|
+
const require_tsdoc_reflection = require('./tsdoc-reflection.cjs');
|
|
5
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
7
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
8
|
+
let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
9
|
+
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
10
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
11
|
+
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
12
|
+
|
|
13
|
+
//#region ../plugin-alloy/src/typescript/components/typescript-object.tsx
|
|
14
|
+
/**
|
|
15
|
+
* Generates a TypeScript object for the given reflection class.
|
|
16
|
+
*/
|
|
17
|
+
function TypescriptObject(props) {
|
|
18
|
+
if (!props.reflection?.value) return null;
|
|
19
|
+
const objectName = (0, __alloy_js_core.computed)(() => (0, __stryke_string_format_camel_case.camelCase)(((0, __stryke_type_checks_is_string.isString)(props.name) ? props.name : props.name.toString()) || props.reflection.value.getName()));
|
|
20
|
+
const objectType = (0, __alloy_js_core.computed)(() => props.type || (0, __stryke_string_format_pascal_case.pascalCase)(props.reflection.value.getName()));
|
|
21
|
+
const properties = (0, __alloy_js_core.computed)(() => props.reflection.value.getProperties().filter((item) => !item.isIgnored() && !(0, __stryke_type_checks_is_undefined.isUndefined)(props.defaultValue?.value?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
|
|
22
|
+
if ((0, __stryke_type_checks_is_undefined.isUndefined)(ret) && !(0, __stryke_type_checks_is_undefined.isUndefined)(props.defaultValue?.value?.[alias])) return props.defaultValue?.value?.[alias];
|
|
23
|
+
return ret;
|
|
24
|
+
}, void 0) ?? item.getDefaultValue())).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1));
|
|
25
|
+
const TypeSymbolSlot = (0, __alloy_js_core.createSymbolSlot)();
|
|
26
|
+
const ValueTypeSymbolSlot = (0, __alloy_js_core.createSymbolSlot)();
|
|
27
|
+
const sym = (0, __alloy_js_typescript.createValueSymbol)(props.name, {
|
|
28
|
+
refkeys: props.refkey,
|
|
29
|
+
default: props.default,
|
|
30
|
+
export: props.export,
|
|
31
|
+
metadata: props.metadata,
|
|
32
|
+
tsFlags: props.nullish ? __alloy_js_typescript.TSSymbolFlags.Nullish : __alloy_js_typescript.TSSymbolFlags.None,
|
|
33
|
+
type: props.type ? TypeSymbolSlot.firstSymbol : void 0,
|
|
34
|
+
namePolicy: (0, __alloy_js_typescript.useTSNamePolicy)().for("variable")
|
|
35
|
+
});
|
|
36
|
+
if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
|
|
37
|
+
const keyword = props.var ? "var" : props.let ? "let" : "const";
|
|
38
|
+
const type = props.type ? (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.TypeRefContext, { get children() {
|
|
39
|
+
return [": ", (0, __alloy_js_core_jsx_runtime.createComponent)(TypeSymbolSlot, { get children() {
|
|
40
|
+
return props.type;
|
|
41
|
+
} })];
|
|
42
|
+
} }) : void 0;
|
|
43
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
44
|
+
get when() {
|
|
45
|
+
return !!props.reflection.value;
|
|
46
|
+
},
|
|
47
|
+
get children() {
|
|
48
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_reflection.ReflectionClassContext.Provider, {
|
|
49
|
+
get value() {
|
|
50
|
+
return {
|
|
51
|
+
reflection: props.reflection.value,
|
|
52
|
+
override: {
|
|
53
|
+
name: objectName.value,
|
|
54
|
+
type: objectType.value,
|
|
55
|
+
defaultValue: props.defaultValue?.value
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
get children() {
|
|
60
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
61
|
+
get when() {
|
|
62
|
+
return !!objectName.value && !!objectType.value;
|
|
63
|
+
},
|
|
64
|
+
get children() {
|
|
65
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc_reflection.TSDocReflectionClass, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Declaration, {
|
|
66
|
+
symbol: sym,
|
|
67
|
+
get children() {
|
|
68
|
+
return [
|
|
69
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => props.export ? "export " : ""),
|
|
70
|
+
(0, __alloy_js_core_jsx_runtime.memo)(() => props.default ? "default " : ""),
|
|
71
|
+
keyword,
|
|
72
|
+
" ",
|
|
73
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Name, {}),
|
|
74
|
+
type,
|
|
75
|
+
" =",
|
|
76
|
+
" ",
|
|
77
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(ValueTypeSymbolSlot, { get children() {
|
|
78
|
+
return props.initializer ?? props.children ?? (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ObjectExpression, { get children() {
|
|
79
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
80
|
+
get each() {
|
|
81
|
+
return properties.value ?? [];
|
|
82
|
+
},
|
|
83
|
+
comma: true,
|
|
84
|
+
doubleHardline: true,
|
|
85
|
+
children: (prop) => (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptObjectProperty, { property: prop })
|
|
86
|
+
});
|
|
87
|
+
} });
|
|
88
|
+
} })
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
})];
|
|
92
|
+
}
|
|
93
|
+
}), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Generates a TypeScript object property for the given reflection class.
|
|
101
|
+
*/
|
|
102
|
+
function TypescriptObjectProperty(props) {
|
|
103
|
+
const [{ property }] = (0, __alloy_js_core.splitProps)(props, ["property"]);
|
|
104
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_reflection.ReflectionPropertyContext.Provider, {
|
|
105
|
+
value: property,
|
|
106
|
+
get children() {
|
|
107
|
+
return [
|
|
108
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc_reflection.TSDocReflectionProperty, {}),
|
|
109
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ObjectProperty, {
|
|
110
|
+
get name() {
|
|
111
|
+
return property.getNameAsString();
|
|
112
|
+
},
|
|
113
|
+
get value() {
|
|
114
|
+
return require_utilities.stringifyDefaultValue(property);
|
|
115
|
+
}
|
|
116
|
+
}),
|
|
117
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
//#endregion
|
|
124
|
+
exports.TypescriptObject = TypescriptObject;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { stringifyDefaultValue } from "../../../../deepkit/src/utilities.mjs";
|
|
2
|
+
import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
|
|
3
|
+
import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
|
|
4
|
+
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
5
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
6
|
+
import { Declaration, For, Name, Show, computed, createSymbolSlot, splitProps } from "@alloy-js/core";
|
|
7
|
+
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
8
|
+
import { camelCase } from "@stryke/string-format/camel-case";
|
|
9
|
+
import { ObjectExpression, ObjectProperty, TSSymbolFlags, TypeRefContext, createValueSymbol, useTSNamePolicy } from "@alloy-js/typescript";
|
|
10
|
+
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
11
|
+
|
|
12
|
+
//#region ../plugin-alloy/src/typescript/components/typescript-object.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Generates a TypeScript object for the given reflection class.
|
|
15
|
+
*/
|
|
16
|
+
function TypescriptObject(props) {
|
|
17
|
+
if (!props.reflection?.value) return null;
|
|
18
|
+
const objectName = computed(() => camelCase((isString(props.name) ? props.name : props.name.toString()) || props.reflection.value.getName()));
|
|
19
|
+
const objectType = computed(() => props.type || pascalCase(props.reflection.value.getName()));
|
|
20
|
+
const properties = computed(() => props.reflection.value.getProperties().filter((item) => !item.isIgnored() && !isUndefined(props.defaultValue?.value?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
|
|
21
|
+
if (isUndefined(ret) && !isUndefined(props.defaultValue?.value?.[alias])) return props.defaultValue?.value?.[alias];
|
|
22
|
+
return ret;
|
|
23
|
+
}, void 0) ?? item.getDefaultValue())).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1));
|
|
24
|
+
const TypeSymbolSlot = createSymbolSlot();
|
|
25
|
+
const ValueTypeSymbolSlot = createSymbolSlot();
|
|
26
|
+
const sym = createValueSymbol(props.name, {
|
|
27
|
+
refkeys: props.refkey,
|
|
28
|
+
default: props.default,
|
|
29
|
+
export: props.export,
|
|
30
|
+
metadata: props.metadata,
|
|
31
|
+
tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,
|
|
32
|
+
type: props.type ? TypeSymbolSlot.firstSymbol : void 0,
|
|
33
|
+
namePolicy: useTSNamePolicy().for("variable")
|
|
34
|
+
});
|
|
35
|
+
if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
|
|
36
|
+
const keyword = props.var ? "var" : props.let ? "let" : "const";
|
|
37
|
+
const type = props.type ? createComponent(TypeRefContext, { get children() {
|
|
38
|
+
return [": ", createComponent(TypeSymbolSlot, { get children() {
|
|
39
|
+
return props.type;
|
|
40
|
+
} })];
|
|
41
|
+
} }) : void 0;
|
|
42
|
+
return createComponent(Show, {
|
|
43
|
+
get when() {
|
|
44
|
+
return !!props.reflection.value;
|
|
45
|
+
},
|
|
46
|
+
get children() {
|
|
47
|
+
return createComponent(ReflectionClassContext.Provider, {
|
|
48
|
+
get value() {
|
|
49
|
+
return {
|
|
50
|
+
reflection: props.reflection.value,
|
|
51
|
+
override: {
|
|
52
|
+
name: objectName.value,
|
|
53
|
+
type: objectType.value,
|
|
54
|
+
defaultValue: props.defaultValue?.value
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
get children() {
|
|
59
|
+
return [createComponent(Show, {
|
|
60
|
+
get when() {
|
|
61
|
+
return !!objectName.value && !!objectType.value;
|
|
62
|
+
},
|
|
63
|
+
get children() {
|
|
64
|
+
return [createComponent(TSDocReflectionClass, {}), createComponent(Declaration, {
|
|
65
|
+
symbol: sym,
|
|
66
|
+
get children() {
|
|
67
|
+
return [
|
|
68
|
+
memo(() => props.export ? "export " : ""),
|
|
69
|
+
memo(() => props.default ? "default " : ""),
|
|
70
|
+
keyword,
|
|
71
|
+
" ",
|
|
72
|
+
createComponent(Name, {}),
|
|
73
|
+
type,
|
|
74
|
+
" =",
|
|
75
|
+
" ",
|
|
76
|
+
createComponent(ValueTypeSymbolSlot, { get children() {
|
|
77
|
+
return props.initializer ?? props.children ?? createComponent(ObjectExpression, { get children() {
|
|
78
|
+
return createComponent(For, {
|
|
79
|
+
get each() {
|
|
80
|
+
return properties.value ?? [];
|
|
81
|
+
},
|
|
82
|
+
comma: true,
|
|
83
|
+
doubleHardline: true,
|
|
84
|
+
children: (prop) => createComponent(TypescriptObjectProperty, { property: prop })
|
|
85
|
+
});
|
|
86
|
+
} });
|
|
87
|
+
} })
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
})];
|
|
91
|
+
}
|
|
92
|
+
}), createIntrinsic("hbr", {})];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Generates a TypeScript object property for the given reflection class.
|
|
100
|
+
*/
|
|
101
|
+
function TypescriptObjectProperty(props) {
|
|
102
|
+
const [{ property }] = splitProps(props, ["property"]);
|
|
103
|
+
return createComponent(ReflectionPropertyContext.Provider, {
|
|
104
|
+
value: property,
|
|
105
|
+
get children() {
|
|
106
|
+
return [
|
|
107
|
+
createComponent(TSDocReflectionProperty, {}),
|
|
108
|
+
createComponent(ObjectProperty, {
|
|
109
|
+
get name() {
|
|
110
|
+
return property.getNameAsString();
|
|
111
|
+
},
|
|
112
|
+
get value() {
|
|
113
|
+
return stringifyDefaultValue(property);
|
|
114
|
+
}
|
|
115
|
+
}),
|
|
116
|
+
createIntrinsic("hbr", {})
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
//#endregion
|
|
123
|
+
export { TypescriptObject };
|