@powerlines/plugin-alloy 0.16.0 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtin-file-CXkreb3b.mjs +43 -0
- package/dist/builtin-file-D0xcKRt6.cjs +49 -0
- package/dist/builtin-file-Detj4VKO.d.cts +34 -0
- package/dist/builtin-file-Df3B4vGB.d.mts +34 -0
- package/dist/capnp-6EjloHj4.mjs +265 -0
- package/dist/capnp-BHeTs4Ea.d.mts +86 -0
- package/dist/capnp-CirEkAHB.d.cts +86 -0
- package/dist/capnp-DOzEf2mj.cjs +362 -0
- package/dist/{_virtual/rolldown_runtime.cjs → chunk-BwyOHTjC.cjs} +12 -2
- package/dist/components-BrkXdHq-.d.mts +141 -0
- package/dist/components-CH68f_ve.mjs +1 -0
- package/dist/components-CO0xjM8H.mjs +1 -0
- package/dist/components-CnI3Y57d.mjs +1 -0
- package/dist/components-Cvpo9IEL.cjs +0 -0
- package/dist/components-DTkri-mp.cjs +0 -0
- package/dist/components-DkVeQ5Yn.d.cts +141 -0
- package/dist/components-Gg416Czx.cjs +0 -0
- package/dist/components-ZbItRNLr.cjs +0 -0
- package/dist/components-vTvc6Xgc.mjs +1 -0
- package/dist/context-B1Z2ZRAI.d.cts +32 -0
- package/dist/context-BwQLwanm.d.mts +1680 -0
- package/dist/context-CWt70HA3.d.cts +1680 -0
- package/dist/context-DkLnFNZm.cjs +60 -0
- package/dist/context-eP3fitqj.mjs +36 -0
- package/dist/context-x-0aNytc.d.mts +32 -0
- package/dist/contexts-BtxvYUPj.cjs +0 -0
- package/dist/contexts-Dy4nfIoL.mjs +1 -0
- package/dist/contexts-DzdhIC7G.cjs +0 -0
- package/dist/contexts-Q1YIygoz.mjs +1 -0
- package/dist/core/components/index.cjs +8 -6
- package/dist/core/components/index.d.cts +6 -3
- package/dist/core/components/index.d.mts +6 -3
- package/dist/core/components/index.mjs +5 -3
- package/dist/core/components/output.cjs +3 -39
- package/dist/core/components/output.d.cts +2 -17
- package/dist/core/components/output.d.mts +2 -17
- package/dist/core/components/output.mjs +2 -37
- package/dist/core/components/single-line-comment.cjs +2 -21
- package/dist/core/components/single-line-comment.d.cts +3 -21
- package/dist/core/components/single-line-comment.d.mts +3 -21
- package/dist/core/components/single-line-comment.mjs +1 -19
- package/dist/core/components/source-file.cjs +2 -57
- package/dist/core/components/source-file.d.cts +3 -30
- package/dist/core/components/source-file.d.mts +3 -30
- package/dist/core/components/source-file.mjs +1 -54
- package/dist/core/contexts/context.cjs +5 -39
- package/dist/core/contexts/context.d.cts +2 -31
- package/dist/core/contexts/context.d.mts +2 -31
- package/dist/core/contexts/context.mjs +1 -34
- package/dist/core/contexts/index.cjs +15 -14
- package/dist/core/contexts/index.d.cts +5 -2
- package/dist/core/contexts/index.d.mts +5 -2
- package/dist/core/contexts/index.mjs +3 -2
- package/dist/core/contexts/reflection.cjs +9 -67
- package/dist/core/contexts/reflection.d.cts +3 -50
- package/dist/core/contexts/reflection.d.mts +3 -50
- package/dist/core/contexts/reflection.mjs +1 -58
- package/dist/core/index.cjs +22 -22
- package/dist/core/index.d.cts +9 -7
- package/dist/core/index.d.mts +9 -7
- package/dist/core/index.mjs +7 -7
- package/dist/create-builtin-CtBhQRxS.d.mts +15 -0
- package/dist/create-builtin-DgYGwEYD.cjs +24 -0
- package/dist/create-builtin-Dug1rcMQ.mjs +18 -0
- package/dist/create-builtin-SArMbh0-.d.cts +15 -0
- package/dist/dynamic-import-statement-AUDLZGFa.d.cts +32 -0
- package/dist/dynamic-import-statement-BFl4j9Ex.cjs +30 -0
- package/dist/dynamic-import-statement-BjiwPuJ3.d.mts +32 -0
- package/dist/dynamic-import-statement-DYl1f5Mj.mjs +24 -0
- package/dist/entry-file-CQwIaayx.d.mts +27 -0
- package/dist/entry-file-CTYBU7Lg.mjs +37 -0
- package/dist/entry-file-Cq3bZzix.d.cts +27 -0
- package/dist/entry-file-l3ZhaFTI.cjs +44 -0
- package/dist/helpers/capnp.cjs +19 -274
- package/dist/helpers/capnp.d.cts +2 -85
- package/dist/helpers/capnp.d.mts +2 -85
- package/dist/helpers/capnp.mjs +2 -255
- package/dist/helpers/create-builtin.cjs +2 -18
- package/dist/helpers/create-builtin.d.cts +1 -14
- package/dist/helpers/create-builtin.d.mts +1 -14
- package/dist/helpers/create-builtin.mjs +1 -16
- package/dist/helpers/index.cjs +24 -23
- package/dist/helpers/index.d.cts +5 -4
- package/dist/helpers/index.d.mts +5 -4
- package/dist/helpers/index.mjs +5 -4
- package/dist/helpers/refkey.cjs +2 -15
- package/dist/helpers/refkey.d.cts +1 -12
- package/dist/helpers/refkey.d.mts +1 -12
- package/dist/helpers/refkey.mjs +1 -13
- package/dist/helpers/typescript.cjs +3 -45
- package/dist/helpers/typescript.d.cts +1 -22
- package/dist/helpers/typescript.d.mts +1 -22
- package/dist/helpers/typescript.mjs +2 -43
- package/dist/index-Blaks7l8.d.cts +1 -0
- package/dist/index-CuheJfs-.d.mts +1 -0
- package/dist/index-CwSIy_W-.d.cts +1 -0
- package/dist/index-D7UbuJwP.d.mts +1 -0
- package/dist/index-D9XihFV1.d.mts +1 -0
- package/dist/index-DdxxIAKU.d.cts +1 -0
- package/dist/index-DrK1_jKY.d.mts +1 -0
- package/dist/index-DrZ2Dh-H.d.cts +1 -0
- package/dist/index-DztUdPP_.d.mts +1 -0
- package/dist/index-lQ_hGQ08.d.cts +1 -0
- package/dist/index.cjs +22 -10
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +44 -3
- package/dist/markdown/components/index.cjs +12 -7
- package/dist/markdown/components/index.d.cts +7 -2
- package/dist/markdown/components/index.d.mts +7 -2
- package/dist/markdown/components/index.mjs +7 -2
- package/dist/markdown/components/markdown-file.cjs +6 -117
- package/dist/markdown/components/markdown-file.d.cts +4 -22
- package/dist/markdown/components/markdown-file.d.mts +4 -22
- package/dist/markdown/components/markdown-file.mjs +4 -114
- package/dist/markdown/components/markdown-table.cjs +5 -100
- package/dist/markdown/components/markdown-table.d.cts +4 -26
- package/dist/markdown/components/markdown-table.d.mts +4 -26
- package/dist/markdown/components/markdown-table.mjs +2 -96
- package/dist/markdown/contexts/index.cjs +6 -5
- package/dist/markdown/contexts/index.d.cts +2 -1
- package/dist/markdown/contexts/index.d.mts +2 -1
- package/dist/markdown/contexts/index.mjs +2 -1
- package/dist/markdown/contexts/markdown-table.cjs +5 -36
- package/dist/markdown/contexts/markdown-table.d.cts +1 -36
- package/dist/markdown/contexts/markdown-table.d.mts +1 -36
- package/dist/markdown/contexts/markdown-table.mjs +1 -31
- package/dist/markdown/index.cjs +17 -14
- package/dist/markdown/index.d.cts +8 -5
- package/dist/markdown/index.d.mts +8 -5
- package/dist/markdown/index.mjs +8 -5
- package/dist/markdown-file-CTMTrgdr.mjs +116 -0
- package/dist/markdown-file-CuMvfKbi.d.cts +23 -0
- package/dist/markdown-file-DBpOheYg.d.mts +23 -0
- package/dist/markdown-file-GXj9nWQs.cjs +128 -0
- package/dist/markdown-table-AO9Jtw-o.mjs +98 -0
- package/dist/markdown-table-Biapn9k9.cjs +57 -0
- package/dist/markdown-table-CpnCpTp1.d.cts +27 -0
- package/dist/markdown-table-DFnnh_px.d.cts +37 -0
- package/dist/markdown-table-DKL6g91k.d.mts +37 -0
- package/dist/markdown-table-DaYAMMk6.mjs +33 -0
- package/dist/markdown-table-DcG6ScWX.d.mts +27 -0
- package/dist/markdown-table-d1cy0JP3.cjs +116 -0
- package/dist/output-BC2u6xsn.d.cts +18 -0
- package/dist/output-C_BQEAMU.d.mts +18 -0
- package/dist/output-CiQCsyui.cjs +45 -0
- package/dist/output-eQ8RcTrP.mjs +39 -0
- package/dist/plugin-85Hf9k78.mjs +1 -0
- package/dist/plugin-CofWgH_d.cjs +0 -0
- package/dist/plugin-DcrJBDQ2.d.mts +39 -0
- package/dist/plugin-K4ViA72J.d.cts +39 -0
- package/dist/record-expression-B0NGcmBj.mjs +11 -0
- package/dist/record-expression-P1BTu_7B.d.mts +12 -0
- package/dist/record-expression-j-3eBufn.cjs +17 -0
- package/dist/record-expression-rZuoLQWG.d.cts +12 -0
- package/dist/refkey-BRtVxqGW.d.mts +13 -0
- package/dist/refkey-BUzulmmj.cjs +21 -0
- package/dist/refkey-CSq-Ftvf.mjs +15 -0
- package/dist/refkey-DpAkQ3Cu.d.cts +13 -0
- package/dist/reflection-B9zOZEdi.d.mts +51 -0
- package/dist/reflection-BYeP2t8p.d.cts +51 -0
- package/dist/reflection-CKhynTvI.cjs +108 -0
- package/dist/reflection-srixNcX2.mjs +60 -0
- package/dist/single-line-comment-C9Fz5mkM.mjs +21 -0
- package/dist/single-line-comment-DSAVQ0tl.d.cts +22 -0
- package/dist/single-line-comment-DSz_BbMx.d.mts +22 -0
- package/dist/single-line-comment-_ZglDv1k.cjs +27 -0
- package/dist/source-file-B8OyOWg8.d.mts +31 -0
- package/dist/source-file-DKnFKRGJ.cjs +63 -0
- package/dist/source-file-Db1Wu_yq.mjs +56 -0
- package/dist/source-file-Dr2h8MVw.d.cts +31 -0
- package/dist/tsdoc-BT-2pTD3.d.mts +152 -0
- package/dist/tsdoc-BpykLfnB.cjs +576 -0
- package/dist/tsdoc-CWCdJ1Uj.mjs +456 -0
- package/dist/tsdoc-C_2VzSk_.d.cts +152 -0
- package/dist/tsdoc-reflection-BIWxEkBI.mjs +170 -0
- package/dist/tsdoc-reflection-D4QfeAYE.d.cts +18 -0
- package/dist/tsdoc-reflection-Dr_Nf1ht.cjs +188 -0
- package/dist/tsdoc-reflection-qXh3a1WV.d.mts +18 -0
- package/dist/types/components.cjs +1 -0
- package/dist/types/components.d.cts +2 -141
- package/dist/types/components.d.mts +2 -141
- package/dist/types/components.mjs +2 -0
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.d.cts +3 -2
- package/dist/types/index.d.mts +3 -2
- package/dist/types/index.mjs +3 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +2 -40
- package/dist/types/plugin.d.mts +2 -40
- package/dist/types/plugin.mjs +2 -0
- package/dist/typescript/components/builtin-file.cjs +8 -43
- package/dist/typescript/components/builtin-file.d.cts +6 -33
- package/dist/typescript/components/builtin-file.d.mts +6 -33
- package/dist/typescript/components/builtin-file.mjs +7 -41
- package/dist/typescript/components/dynamic-import-statement.cjs +2 -24
- package/dist/typescript/components/dynamic-import-statement.d.cts +1 -31
- package/dist/typescript/components/dynamic-import-statement.d.mts +1 -31
- package/dist/typescript/components/dynamic-import-statement.mjs +1 -22
- package/dist/typescript/components/entry-file.cjs +6 -38
- package/dist/typescript/components/entry-file.d.cts +5 -26
- package/dist/typescript/components/entry-file.d.mts +5 -26
- package/dist/typescript/components/entry-file.mjs +5 -35
- package/dist/typescript/components/index.cjs +49 -43
- package/dist/typescript/components/index.d.cts +13 -9
- package/dist/typescript/components/index.d.mts +13 -9
- package/dist/typescript/components/index.mjs +15 -9
- package/dist/typescript/components/record-expression.cjs +2 -11
- package/dist/typescript/components/record-expression.d.cts +1 -11
- package/dist/typescript/components/record-expression.d.mts +1 -11
- package/dist/typescript/components/record-expression.mjs +1 -9
- package/dist/typescript/components/tsdoc-reflection.cjs +8 -172
- package/dist/typescript/components/tsdoc-reflection.d.cts +4 -17
- package/dist/typescript/components/tsdoc-reflection.d.mts +4 -17
- package/dist/typescript/components/tsdoc-reflection.mjs +5 -168
- package/dist/typescript/components/tsdoc.cjs +23 -475
- package/dist/typescript/components/tsdoc.d.cts +3 -151
- package/dist/typescript/components/tsdoc.d.mts +3 -151
- package/dist/typescript/components/tsdoc.mjs +3 -454
- package/dist/typescript/components/typescript-file.cjs +7 -192
- package/dist/typescript/components/typescript-file.d.cts +4 -46
- package/dist/typescript/components/typescript-file.d.mts +4 -46
- package/dist/typescript/components/typescript-file.mjs +4 -188
- package/dist/typescript/components/typescript-interface.cjs +8 -67
- package/dist/typescript/components/typescript-interface.d.cts +3 -23
- package/dist/typescript/components/typescript-interface.d.mts +3 -23
- package/dist/typescript/components/typescript-interface.mjs +6 -64
- package/dist/typescript/components/typescript-object.cjs +8 -124
- package/dist/typescript/components/typescript-object.d.cts +3 -24
- package/dist/typescript/components/typescript-object.d.mts +3 -24
- package/dist/typescript/components/typescript-object.mjs +6 -121
- package/dist/typescript/index.cjs +49 -44
- package/dist/typescript/index.d.cts +13 -10
- package/dist/typescript/index.d.mts +13 -10
- package/dist/typescript/index.mjs +15 -10
- package/dist/typescript-BIiCTw8m.d.mts +23 -0
- package/dist/typescript-NNuOlVjo.mjs +45 -0
- package/dist/typescript-VTSR_IQG.cjs +51 -0
- package/dist/typescript-YczHz9BQ.d.cts +23 -0
- package/dist/typescript-file-B2iQamR6.d.cts +47 -0
- package/dist/typescript-file-CCNXO3vl.d.mts +47 -0
- package/dist/typescript-file-DLbLtnFd.cjs +208 -0
- package/dist/typescript-file-hcvsHaDV.mjs +190 -0
- package/dist/typescript-interface-BM02EN5E.mjs +66 -0
- package/dist/typescript-interface-Cu5yH1iH.d.mts +24 -0
- package/dist/typescript-interface-cuXGu4c4.cjs +78 -0
- package/dist/typescript-interface-vmxe6DFQ.d.cts +24 -0
- package/dist/typescript-object-Bk0AnSSQ.mjs +123 -0
- package/dist/typescript-object-Bsfy6ZF0.cjs +135 -0
- package/dist/typescript-object-CYLHqec2.d.cts +25 -0
- package/dist/typescript-object-DlbiBCmI.d.mts +25 -0
- package/dist/{deepkit/src/utilities.mjs → utilities-C6eipB1q.mjs} +1 -1
- package/dist/{deepkit/src/utilities.cjs → utilities-CiKb35hs.cjs} +25 -5
- package/dist/vendor/index.cjs +630 -15
- package/package.json +5 -5
- package/dist/_virtual/rolldown_runtime.mjs +0 -29
- package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -13
- package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -12
- package/dist/powerlines/src/types/babel.d.mts +0 -2
- package/dist/powerlines/src/types/build.d.cts +0 -145
- package/dist/powerlines/src/types/build.d.mts +0 -145
- package/dist/powerlines/src/types/commands.d.cts +0 -8
- package/dist/powerlines/src/types/commands.d.mts +0 -9
- package/dist/powerlines/src/types/config.d.cts +0 -369
- package/dist/powerlines/src/types/config.d.mts +0 -369
- package/dist/powerlines/src/types/context.d.cts +0 -362
- package/dist/powerlines/src/types/context.d.mts +0 -364
- package/dist/powerlines/src/types/fs.d.cts +0 -458
- package/dist/powerlines/src/types/fs.d.mts +0 -458
- package/dist/powerlines/src/types/hooks.d.mts +0 -2
- package/dist/powerlines/src/types/plugin.d.cts +0 -231
- package/dist/powerlines/src/types/plugin.d.mts +0 -231
- package/dist/powerlines/src/types/resolved.d.cts +0 -81
- package/dist/powerlines/src/types/resolved.d.mts +0 -81
- package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
- package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
- package/dist/vendor/index.mjs +0 -11
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-BwyOHTjC.cjs');
|
|
2
|
+
const require_context = require('./context-DkLnFNZm.cjs');
|
|
3
|
+
const require_single_line_comment = require('./single-line-comment-_ZglDv1k.cjs');
|
|
4
|
+
const require_source_file = require('./source-file-DKnFKRGJ.cjs');
|
|
5
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
+
let __powerlines_plugin_alloy_vendor = require("@powerlines/plugin-alloy/vendor");
|
|
7
|
+
let __stryke_path_append = require("@stryke/path/append");
|
|
8
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
9
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
10
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
11
|
+
let __stryke_type_checks_is_boolean = require("@stryke/type-checks/is-boolean");
|
|
12
|
+
|
|
13
|
+
//#region src/typescript/components/typescript-file.tsx
|
|
14
|
+
/**
|
|
15
|
+
* A base component representing a Powerlines generated Typescript source file.
|
|
16
|
+
*
|
|
17
|
+
* @param props - The properties for the source file.
|
|
18
|
+
* @returns The rendered source file component.
|
|
19
|
+
*/
|
|
20
|
+
function TypescriptFile(props) {
|
|
21
|
+
const [{ children, path, imports, tsx, header, hashbang }, rest] = (0, __powerlines_plugin_alloy_vendor.splitProps)(props, [
|
|
22
|
+
"children",
|
|
23
|
+
"path",
|
|
24
|
+
"imports",
|
|
25
|
+
"tsx",
|
|
26
|
+
"header",
|
|
27
|
+
"hashbang"
|
|
28
|
+
]);
|
|
29
|
+
const directoryContext = (0, __powerlines_plugin_alloy_vendor.useContext)(__powerlines_plugin_alloy_vendor.SourceDirectoryContext);
|
|
30
|
+
const sdData = (0, __alloy_js_typescript.getSourceDirectoryData)(directoryContext);
|
|
31
|
+
const modulePath = (0, __stryke_path_append.appendPath)(path, directoryContext.path);
|
|
32
|
+
const scope = new __alloy_js_typescript.TSModuleScope(modulePath, (0, __powerlines_plugin_alloy_vendor.useScope)());
|
|
33
|
+
sdData.modules.add(scope);
|
|
34
|
+
const pkg = (0, __powerlines_plugin_alloy_vendor.useContext)(__alloy_js_typescript.PackageContext);
|
|
35
|
+
if (pkg) pkg.scope.addModule(scope);
|
|
36
|
+
if (props.export) {
|
|
37
|
+
if (pkg) if ((0, __stryke_type_checks_is_boolean.isBoolean)(props.export)) pkg.scope.addExport(modulePath, scope);
|
|
38
|
+
else pkg.scope.addExport(props.export, scope);
|
|
39
|
+
}
|
|
40
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.SourceFileContext.Provider, {
|
|
41
|
+
value: { scope },
|
|
42
|
+
get children() {
|
|
43
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Scope, {
|
|
44
|
+
value: scope,
|
|
45
|
+
get children() {
|
|
46
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_source_file.SourceFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
47
|
+
path: modulePath,
|
|
48
|
+
get header() {
|
|
49
|
+
return header ?? (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptFileHeader, {
|
|
50
|
+
hashbang,
|
|
51
|
+
get children() {
|
|
52
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptFileHeaderImports, {
|
|
53
|
+
imports,
|
|
54
|
+
scope
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
filetype: tsx ? "tsx" : "typescript",
|
|
60
|
+
children
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Renders the header for a Powerlines Typescript source file.
|
|
69
|
+
*
|
|
70
|
+
* @param props - The properties for the source file header.
|
|
71
|
+
* @returns The rendered source file header.
|
|
72
|
+
*/
|
|
73
|
+
function TypescriptFileHeader(props) {
|
|
74
|
+
const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
|
|
75
|
+
const context = require_context.usePowerlines();
|
|
76
|
+
return [
|
|
77
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
78
|
+
get when() {
|
|
79
|
+
return Boolean(hashbang);
|
|
80
|
+
},
|
|
81
|
+
get children() {
|
|
82
|
+
return [(0, __alloy_js_core_jsx_runtime.memo)(() => hashbang === true ? __powerlines_plugin_alloy_vendor.code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
83
|
+
}
|
|
84
|
+
}),
|
|
85
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
86
|
+
get when() {
|
|
87
|
+
return Boolean(header);
|
|
88
|
+
},
|
|
89
|
+
get children() {
|
|
90
|
+
return [header, (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
91
|
+
}
|
|
92
|
+
}),
|
|
93
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
94
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
95
|
+
get when() {
|
|
96
|
+
return Boolean(disableEslint);
|
|
97
|
+
},
|
|
98
|
+
get children() {
|
|
99
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_single_line_comment.SingleLineComment, {
|
|
100
|
+
variant: "slash-star",
|
|
101
|
+
children: "eslint-disable"
|
|
102
|
+
}), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
106
|
+
get when() {
|
|
107
|
+
return Boolean(disablePrettier);
|
|
108
|
+
},
|
|
109
|
+
get children() {
|
|
110
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_single_line_comment.SingleLineComment, {
|
|
111
|
+
variant: "slash-star",
|
|
112
|
+
children: "prettier-ignore"
|
|
113
|
+
}), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
114
|
+
}
|
|
115
|
+
}),
|
|
116
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
117
|
+
get when() {
|
|
118
|
+
return Boolean(disableBiome);
|
|
119
|
+
},
|
|
120
|
+
get children() {
|
|
121
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_single_line_comment.SingleLineComment, { children: "biome-ignore lint: disable" }), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
122
|
+
}
|
|
123
|
+
}),
|
|
124
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
125
|
+
get when() {
|
|
126
|
+
return Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome);
|
|
127
|
+
},
|
|
128
|
+
get children() {
|
|
129
|
+
return (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {});
|
|
130
|
+
}
|
|
131
|
+
}),
|
|
132
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
133
|
+
get when() {
|
|
134
|
+
return Boolean(children);
|
|
135
|
+
},
|
|
136
|
+
get children() {
|
|
137
|
+
return [children, (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
138
|
+
}
|
|
139
|
+
}),
|
|
140
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_single_line_comment.SingleLineComment, { get children() {
|
|
141
|
+
return __powerlines_plugin_alloy_vendor.code`Generated by ${(0, __stryke_string_format_title_case.titleCase)(context?.config.framework) || "Powerlines"}`;
|
|
142
|
+
} }),
|
|
143
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
144
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_single_line_comment.SingleLineComment, { children: __powerlines_plugin_alloy_vendor.code`NOTE: Do not edit this file manually - it will be overwritten automatically by the "prepare" command` }),
|
|
145
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Renders the header for a Powerlines Typescript source file.
|
|
150
|
+
*
|
|
151
|
+
* @param props - The properties for the source file header.
|
|
152
|
+
* @returns The rendered source file header.
|
|
153
|
+
*/
|
|
154
|
+
function TypescriptFileHeaderImports(props) {
|
|
155
|
+
const { imports } = props;
|
|
156
|
+
const sourceFile = (0, __alloy_js_typescript.useSourceFile)();
|
|
157
|
+
const scope = props.scope ?? sourceFile.scope;
|
|
158
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
159
|
+
get when() {
|
|
160
|
+
return scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0;
|
|
161
|
+
},
|
|
162
|
+
get children() {
|
|
163
|
+
return [
|
|
164
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
165
|
+
get when() {
|
|
166
|
+
return !!imports && Object.keys(imports).length > 0;
|
|
167
|
+
},
|
|
168
|
+
get children() {
|
|
169
|
+
return Object.entries(imports ?? {}).map(([module$1, imported]) => {
|
|
170
|
+
return __powerlines_plugin_alloy_vendor.code`import ${imported === null ? "" : imported.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (imported.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && imported.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (imported.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${imported.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} from "${module$1}";`;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}),
|
|
174
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.Show, {
|
|
175
|
+
get when() {
|
|
176
|
+
return scope.importedModules.size > 0;
|
|
177
|
+
},
|
|
178
|
+
get children() {
|
|
179
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ImportStatements, { get records() {
|
|
180
|
+
return scope.importedModules;
|
|
181
|
+
} });
|
|
182
|
+
}
|
|
183
|
+
}),
|
|
184
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
185
|
+
];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
//#endregion
|
|
191
|
+
Object.defineProperty(exports, 'TypescriptFile', {
|
|
192
|
+
enumerable: true,
|
|
193
|
+
get: function () {
|
|
194
|
+
return TypescriptFile;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
Object.defineProperty(exports, 'TypescriptFileHeader', {
|
|
198
|
+
enumerable: true,
|
|
199
|
+
get: function () {
|
|
200
|
+
return TypescriptFileHeader;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
Object.defineProperty(exports, 'TypescriptFileHeaderImports', {
|
|
204
|
+
enumerable: true,
|
|
205
|
+
get: function () {
|
|
206
|
+
return TypescriptFileHeaderImports;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { n as usePowerlines } from "./context-eP3fitqj.mjs";
|
|
2
|
+
import { t as SingleLineComment } from "./single-line-comment-C9Fz5mkM.mjs";
|
|
3
|
+
import { t as SourceFile } from "./source-file-Db1Wu_yq.mjs";
|
|
4
|
+
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
|
+
import { Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@powerlines/plugin-alloy/vendor";
|
|
6
|
+
import { appendPath } from "@stryke/path/append";
|
|
7
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
8
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
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 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 sourceFile = useSourceFile();
|
|
156
|
+
const scope = props.scope ?? sourceFile.scope;
|
|
157
|
+
return createComponent(Show, {
|
|
158
|
+
get when() {
|
|
159
|
+
return scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0;
|
|
160
|
+
},
|
|
161
|
+
get children() {
|
|
162
|
+
return [
|
|
163
|
+
createComponent(Show, {
|
|
164
|
+
get when() {
|
|
165
|
+
return !!imports && Object.keys(imports).length > 0;
|
|
166
|
+
},
|
|
167
|
+
get children() {
|
|
168
|
+
return Object.entries(imports ?? {}).map(([module, imported]) => {
|
|
169
|
+
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}";`;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}),
|
|
173
|
+
createComponent(Show, {
|
|
174
|
+
get when() {
|
|
175
|
+
return scope.importedModules.size > 0;
|
|
176
|
+
},
|
|
177
|
+
get children() {
|
|
178
|
+
return createComponent(ImportStatements, { get records() {
|
|
179
|
+
return scope.importedModules;
|
|
180
|
+
} });
|
|
181
|
+
}
|
|
182
|
+
}),
|
|
183
|
+
createIntrinsic("hbr", {})
|
|
184
|
+
];
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
//#endregion
|
|
190
|
+
export { TypescriptFileHeader as n, TypescriptFileHeaderImports as r, TypescriptFile as t };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { i as ReflectionPropertyContext, t as ReflectionClassContext } from "./reflection-srixNcX2.mjs";
|
|
2
|
+
import { r as TSDocReflectionProperty, t as TSDocReflectionClass } from "./tsdoc-reflection-BIWxEkBI.mjs";
|
|
3
|
+
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
|
+
import { For, computed, splitProps } from "@powerlines/plugin-alloy/vendor";
|
|
5
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
6
|
+
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
7
|
+
import { InterfaceDeclaration, InterfaceMember } from "@alloy-js/typescript";
|
|
8
|
+
|
|
9
|
+
//#region src/typescript/components/typescript-interface.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Generates a TypeScript interface for the given reflection class.
|
|
12
|
+
*/
|
|
13
|
+
function TypeScriptInterface(props) {
|
|
14
|
+
const [{ name, reflection }, rest] = splitProps(props, ["name", "reflection"]);
|
|
15
|
+
const interfaceName = computed(() => pascalCase((isString(name) ? name : name.toString()) || reflection.getName()));
|
|
16
|
+
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);
|
|
17
|
+
return createComponent(ReflectionClassContext.Provider, {
|
|
18
|
+
value: { reflection },
|
|
19
|
+
get children() {
|
|
20
|
+
return [createComponent(TSDocReflectionClass, {}), createComponent(InterfaceDeclaration, mergeProps({
|
|
21
|
+
"export": true,
|
|
22
|
+
get name() {
|
|
23
|
+
return interfaceName.value;
|
|
24
|
+
}
|
|
25
|
+
}, rest, { get children() {
|
|
26
|
+
return createComponent(For, {
|
|
27
|
+
each: properties,
|
|
28
|
+
doubleHardline: true,
|
|
29
|
+
semicolon: true,
|
|
30
|
+
children: (prop) => createComponent(TypescriptInterfaceProperty, { property: prop })
|
|
31
|
+
});
|
|
32
|
+
} }))];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Generates a TypeScript interface property for the given reflection class.
|
|
38
|
+
*/
|
|
39
|
+
function TypescriptInterfaceProperty(props) {
|
|
40
|
+
const [{ property }, rest] = splitProps(props, ["property"]);
|
|
41
|
+
return createComponent(ReflectionPropertyContext.Provider, {
|
|
42
|
+
value: property,
|
|
43
|
+
get children() {
|
|
44
|
+
return [createComponent(TSDocReflectionProperty, {}), createComponent(InterfaceMember, mergeProps({
|
|
45
|
+
get name() {
|
|
46
|
+
return property.getNameAsString();
|
|
47
|
+
},
|
|
48
|
+
get readonly() {
|
|
49
|
+
return property.isReadonly();
|
|
50
|
+
},
|
|
51
|
+
get optional() {
|
|
52
|
+
return property.isOptional();
|
|
53
|
+
},
|
|
54
|
+
get nullish() {
|
|
55
|
+
return property.isNullable();
|
|
56
|
+
},
|
|
57
|
+
get type() {
|
|
58
|
+
return stringifyType(property.getType());
|
|
59
|
+
}
|
|
60
|
+
}, rest))];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { TypescriptInterfaceProperty as n, TypeScriptInterface as t };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { n as ComponentProps } from "./components-BrkXdHq-.mjs";
|
|
2
|
+
import * as _alloy_js_core9 from "@alloy-js/core";
|
|
3
|
+
import { InterfaceDeclarationProps, InterfaceMemberProps } from "@alloy-js/typescript";
|
|
4
|
+
|
|
5
|
+
//#region src/typescript/components/typescript-interface.d.ts
|
|
6
|
+
interface TypeScriptInterfaceProps<T extends Record<string, any> = Record<string, any>> extends InterfaceDeclarationProps, ComponentProps {
|
|
7
|
+
reflection: ReflectionClass<T>;
|
|
8
|
+
defaultValue?: Partial<T>;
|
|
9
|
+
}
|
|
10
|
+
interface TypescriptInterfacePropertyProps extends Omit<InterfaceMemberProps, "name">, ComponentProps {
|
|
11
|
+
property: ReflectionProperty;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generates a TypeScript interface for the given reflection class.
|
|
15
|
+
*/
|
|
16
|
+
declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core9.Children;
|
|
17
|
+
/**
|
|
18
|
+
* Generates a TypeScript interface property for the given reflection class.
|
|
19
|
+
*/
|
|
20
|
+
declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core9.Children;
|
|
21
|
+
declare type __ΩTypeScriptInterfaceProps = any[];
|
|
22
|
+
declare type __ΩTypescriptInterfacePropertyProps = any[];
|
|
23
|
+
//#endregion
|
|
24
|
+
export { __ΩTypeScriptInterfaceProps as a, TypescriptInterfacePropertyProps as i, TypeScriptInterfaceProps as n, __ΩTypescriptInterfacePropertyProps as o, TypescriptInterfaceProperty as r, TypeScriptInterface as t };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-BwyOHTjC.cjs');
|
|
2
|
+
const require_reflection = require('./reflection-CKhynTvI.cjs');
|
|
3
|
+
const require_tsdoc_reflection = require('./tsdoc-reflection-Dr_Nf1ht.cjs');
|
|
4
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
+
let __powerlines_plugin_alloy_vendor = require("@powerlines/plugin-alloy/vendor");
|
|
6
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
7
|
+
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
8
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
9
|
+
|
|
10
|
+
//#region 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] = (0, __powerlines_plugin_alloy_vendor.splitProps)(props, ["name", "reflection"]);
|
|
16
|
+
const interfaceName = (0, __powerlines_plugin_alloy_vendor.computed)(() => (0, __stryke_string_format_pascal_case.pascalCase)(((0, __stryke_type_checks_is_string.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 (0, __alloy_js_core_jsx_runtime.createComponent)(require_reflection.ReflectionClassContext.Provider, {
|
|
19
|
+
value: { reflection },
|
|
20
|
+
get children() {
|
|
21
|
+
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)({
|
|
22
|
+
"export": true,
|
|
23
|
+
get name() {
|
|
24
|
+
return interfaceName.value;
|
|
25
|
+
}
|
|
26
|
+
}, rest, { get children() {
|
|
27
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_vendor.For, {
|
|
28
|
+
each: properties,
|
|
29
|
+
doubleHardline: true,
|
|
30
|
+
semicolon: true,
|
|
31
|
+
children: (prop) => (0, __alloy_js_core_jsx_runtime.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] = (0, __powerlines_plugin_alloy_vendor.splitProps)(props, ["property"]);
|
|
42
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_reflection.ReflectionPropertyContext.Provider, {
|
|
43
|
+
value: property,
|
|
44
|
+
get children() {
|
|
45
|
+
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)({
|
|
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
|
+
Object.defineProperty(exports, 'TypeScriptInterface', {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return TypeScriptInterface;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, 'TypescriptInterfaceProperty', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return TypescriptInterfaceProperty;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { n as ComponentProps } from "./components-DkVeQ5Yn.cjs";
|
|
2
|
+
import * as _alloy_js_core5 from "@alloy-js/core";
|
|
3
|
+
import { InterfaceDeclarationProps, InterfaceMemberProps } from "@alloy-js/typescript";
|
|
4
|
+
|
|
5
|
+
//#region src/typescript/components/typescript-interface.d.ts
|
|
6
|
+
interface TypeScriptInterfaceProps<T extends Record<string, any> = Record<string, any>> extends InterfaceDeclarationProps, ComponentProps {
|
|
7
|
+
reflection: ReflectionClass<T>;
|
|
8
|
+
defaultValue?: Partial<T>;
|
|
9
|
+
}
|
|
10
|
+
interface TypescriptInterfacePropertyProps extends Omit<InterfaceMemberProps, "name">, ComponentProps {
|
|
11
|
+
property: ReflectionProperty;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generates a TypeScript interface for the given reflection class.
|
|
15
|
+
*/
|
|
16
|
+
declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core5.Children;
|
|
17
|
+
/**
|
|
18
|
+
* Generates a TypeScript interface property for the given reflection class.
|
|
19
|
+
*/
|
|
20
|
+
declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core5.Children;
|
|
21
|
+
declare type __ΩTypeScriptInterfaceProps = any[];
|
|
22
|
+
declare type __ΩTypescriptInterfacePropertyProps = any[];
|
|
23
|
+
//#endregion
|
|
24
|
+
export { __ΩTypeScriptInterfaceProps as a, TypescriptInterfacePropertyProps as i, TypeScriptInterfaceProps as n, __ΩTypescriptInterfacePropertyProps as o, TypescriptInterfaceProperty as r, TypeScriptInterface as t };
|