@powerlines/plugin-alloy 0.14.0
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/LICENSE +201 -0
- package/README.md +304 -0
- package/dist/builtin-file-BU93ve2k.d.cts +34 -0
- package/dist/builtin-file-CG53y-09.d.mts +34 -0
- package/dist/builtin-file-CkwxD4el.mjs +37 -0
- package/dist/builtin-file-DLVCgiye.cjs +43 -0
- package/dist/capnp-8yVLwAox.cjs +364 -0
- package/dist/capnp-CKLYTfgy.d.mts +87 -0
- package/dist/capnp-CNythuSw.mjs +267 -0
- package/dist/capnp-wJ2_HpAN.d.cts +87 -0
- package/dist/chunk-CbDLau6x.cjs +34 -0
- package/dist/components-B0A7LpQD.d.cts +142 -0
- package/dist/components-B2kXCrty.d.mts +142 -0
- package/dist/components-BOkkDhM9.cjs +0 -0
- package/dist/components-BXrpeD8J.cjs +0 -0
- package/dist/components-C3qpgLKV.mjs +1 -0
- package/dist/components-CBtEhH9k.mjs +1 -0
- package/dist/components-Cj5gaIV0.cjs +0 -0
- package/dist/components-HMVhsFQl.mjs +1 -0
- package/dist/components-I0ydtjfW.cjs +0 -0
- package/dist/components-ajocJcib.mjs +1 -0
- package/dist/context-BIduC1bB.cjs +44 -0
- package/dist/context-BO25KgR_.d.cts +1668 -0
- package/dist/context-CBG6Pv09.d.cts +26 -0
- package/dist/context-Cx38_mgI.mjs +26 -0
- package/dist/context-DzaJOnXh.d.mts +26 -0
- package/dist/context-GtZoIVx8.d.mts +1670 -0
- package/dist/contexts-BSRk0whx.cjs +0 -0
- package/dist/contexts-X44bRyOp.mjs +1 -0
- package/dist/contexts-XuEdvZdE.mjs +1 -0
- package/dist/contexts-uXFW3CIa.cjs +0 -0
- package/dist/core/components/index.cjs +9 -0
- package/dist/core/components/index.d.cts +7 -0
- package/dist/core/components/index.d.mts +7 -0
- package/dist/core/components/index.mjs +7 -0
- package/dist/core/components/output.cjs +4 -0
- package/dist/core/components/output.d.cts +3 -0
- package/dist/core/components/output.d.mts +3 -0
- package/dist/core/components/output.mjs +4 -0
- package/dist/core/components/single-line-comment.cjs +3 -0
- package/dist/core/components/single-line-comment.d.cts +4 -0
- package/dist/core/components/single-line-comment.d.mts +4 -0
- package/dist/core/components/single-line-comment.mjs +3 -0
- package/dist/core/components/source-file.cjs +3 -0
- package/dist/core/components/source-file.d.cts +4 -0
- package/dist/core/components/source-file.d.mts +4 -0
- package/dist/core/components/source-file.mjs +3 -0
- package/dist/core/contexts/context.cjs +5 -0
- package/dist/core/contexts/context.d.cts +3 -0
- package/dist/core/contexts/context.d.mts +3 -0
- package/dist/core/contexts/context.mjs +3 -0
- package/dist/core/contexts/index.cjs +15 -0
- package/dist/core/contexts/index.d.cts +6 -0
- package/dist/core/contexts/index.d.mts +6 -0
- package/dist/core/contexts/index.mjs +5 -0
- package/dist/core/contexts/reflection.cjs +10 -0
- package/dist/core/contexts/reflection.d.cts +4 -0
- package/dist/core/contexts/reflection.d.mts +4 -0
- package/dist/core/contexts/reflection.mjs +3 -0
- package/dist/core/index.cjs +23 -0
- package/dist/core/index.d.cts +11 -0
- package/dist/core/index.d.mts +11 -0
- package/dist/core/index.mjs +10 -0
- package/dist/core-B57eQAue.mjs +1 -0
- package/dist/core-DzEmU6tL.cjs +0 -0
- package/dist/create-builtin-Bpswa0ZT.d.cts +15 -0
- package/dist/create-builtin-CP9mN5P-.mjs +18 -0
- package/dist/create-builtin-_3GNADDt.cjs +24 -0
- package/dist/create-builtin-wEbNOWNw.d.mts +15 -0
- package/dist/dynamic-import-statement-BhY2a13r.d.cts +32 -0
- package/dist/dynamic-import-statement-DoTHSt57.mjs +28 -0
- package/dist/dynamic-import-statement-DyVWBclX.d.mts +32 -0
- package/dist/dynamic-import-statement-JVLyMPXr.cjs +34 -0
- package/dist/entry-file-B159R5XY.d.cts +27 -0
- package/dist/entry-file-BA75rAwb.cjs +41 -0
- package/dist/entry-file-Bw1mgMP3.mjs +34 -0
- package/dist/entry-file-DfFhEkLi.d.mts +27 -0
- package/dist/helpers/capnp.cjs +19 -0
- package/dist/helpers/capnp.d.cts +3 -0
- package/dist/helpers/capnp.d.mts +3 -0
- package/dist/helpers/capnp.mjs +4 -0
- package/dist/helpers/create-builtin.cjs +3 -0
- package/dist/helpers/create-builtin.d.cts +2 -0
- package/dist/helpers/create-builtin.d.mts +2 -0
- package/dist/helpers/create-builtin.mjs +3 -0
- package/dist/helpers/index.cjs +26 -0
- package/dist/helpers/index.d.cts +7 -0
- package/dist/helpers/index.d.mts +7 -0
- package/dist/helpers/index.mjs +8 -0
- package/dist/helpers/refkey.cjs +3 -0
- package/dist/helpers/refkey.d.cts +2 -0
- package/dist/helpers/refkey.d.mts +2 -0
- package/dist/helpers/refkey.mjs +3 -0
- package/dist/helpers/typescript.cjs +4 -0
- package/dist/helpers/typescript.d.cts +2 -0
- package/dist/helpers/typescript.d.mts +2 -0
- package/dist/helpers/typescript.mjs +4 -0
- package/dist/helpers-BrA1Dy07.mjs +1 -0
- package/dist/helpers-Cten3PJk.cjs +0 -0
- package/dist/index-BINnViIh.d.mts +1 -0
- package/dist/index-BJ8-FA6N.d.cts +1 -0
- package/dist/index-BRJ_6A42.d.mts +1 -0
- package/dist/index-BXpMZvwA.d.cts +1 -0
- package/dist/index-Bi0Yc4v2.d.cts +1 -0
- package/dist/index-BrGZHEgX.d.mts +1 -0
- package/dist/index-BwFl_eS0.d.mts +1 -0
- package/dist/index-C1ihAKnV.d.cts +1 -0
- package/dist/index-CLTQPxoD.d.mts +1 -0
- package/dist/index-CoUVmp_Q.d.mts +1 -0
- package/dist/index-D1aKd2tO.d.cts +1 -0
- package/dist/index-D4d_pZLu.d.cts +1 -0
- package/dist/index-DBGd4WeR.d.mts +1 -0
- package/dist/index-DdxxIAKU.d.cts +1 -0
- package/dist/index-Deol7ZWO.d.mts +1 -0
- package/dist/index-DpEKQcoR.d.cts +1 -0
- package/dist/index-DrZ2Dh-H.d.cts +1 -0
- package/dist/index-MEuojd-r.d.cts +1 -0
- package/dist/index-bHnO4ZKt.d.mts +1 -0
- package/dist/index-lIMqGGJz.d.mts +1 -0
- package/dist/index.cjs +446 -0
- package/dist/index.d.cts +45 -0
- package/dist/index.d.mts +45 -0
- package/dist/index.mjs +361 -0
- package/dist/markdown/components/index.cjs +13 -0
- package/dist/markdown/components/index.d.cts +8 -0
- package/dist/markdown/components/index.d.mts +8 -0
- package/dist/markdown/components/index.mjs +9 -0
- package/dist/markdown/components/markdown-file.cjs +7 -0
- package/dist/markdown/components/markdown-file.d.cts +5 -0
- package/dist/markdown/components/markdown-file.d.mts +5 -0
- package/dist/markdown/components/markdown-file.mjs +6 -0
- package/dist/markdown/components/markdown-table.cjs +6 -0
- package/dist/markdown/components/markdown-table.d.cts +5 -0
- package/dist/markdown/components/markdown-table.d.mts +5 -0
- package/dist/markdown/components/markdown-table.mjs +4 -0
- package/dist/markdown/contexts/index.cjs +7 -0
- package/dist/markdown/contexts/index.d.cts +3 -0
- package/dist/markdown/contexts/index.d.mts +3 -0
- package/dist/markdown/contexts/index.mjs +4 -0
- package/dist/markdown/contexts/markdown-table.cjs +6 -0
- package/dist/markdown/contexts/markdown-table.d.cts +2 -0
- package/dist/markdown/contexts/markdown-table.d.mts +2 -0
- package/dist/markdown/contexts/markdown-table.mjs +3 -0
- package/dist/markdown/index.cjs +19 -0
- package/dist/markdown/index.d.cts +10 -0
- package/dist/markdown/index.d.mts +10 -0
- package/dist/markdown/index.mjs +11 -0
- package/dist/markdown-BTQE0AI9.cjs +0 -0
- package/dist/markdown-DMddlO1y.mjs +1 -0
- package/dist/markdown-file-BFbbzD59.mjs +90 -0
- package/dist/markdown-file-Bsuu9aIk.d.cts +23 -0
- package/dist/markdown-file-CB6u4Cp1.d.mts +23 -0
- package/dist/markdown-file-CzGNj_Ex.cjs +102 -0
- package/dist/markdown-table-2qP_4eLk.mjs +33 -0
- package/dist/markdown-table-BOWM26Kb.cjs +57 -0
- package/dist/markdown-table-BUxH6aRh.mjs +77 -0
- package/dist/markdown-table-CMaQVkwJ.d.mts +27 -0
- package/dist/markdown-table-CZMEY6IR.d.cts +37 -0
- package/dist/markdown-table-DFaNSBRn.cjs +95 -0
- package/dist/markdown-table-SvbpUdq-.d.cts +27 -0
- package/dist/markdown-table-kFQoqKQt.d.mts +37 -0
- package/dist/output-ChpN7bQM.d.cts +18 -0
- package/dist/output-CnofBsl0.cjs +38 -0
- package/dist/output-D9RlZeCO.d.mts +18 -0
- package/dist/output-DEdXZ94G.mjs +32 -0
- package/dist/plugin-C0DspKAF.d.mts +34 -0
- package/dist/plugin-DU0K2-Om.mjs +1 -0
- package/dist/plugin-DYBdUgTF.d.cts +34 -0
- package/dist/plugin-Fx-uJ4It.cjs +0 -0
- package/dist/record-expression-BOCZ9iqR.d.mts +12 -0
- package/dist/record-expression-DM_zSqE_.d.cts +12 -0
- package/dist/record-expression-DNVzCKgo.cjs +17 -0
- package/dist/record-expression-DxS_DiPc.mjs +11 -0
- package/dist/refkey-B0XSqdGY.d.mts +13 -0
- package/dist/refkey-B6A9kh_u.cjs +21 -0
- package/dist/refkey-CP7MJMac.d.cts +13 -0
- package/dist/refkey-CV0mIj0Y.mjs +15 -0
- package/dist/reflection-BSbFFYZO.cjs +108 -0
- package/dist/reflection-Bka9prwJ.d.mts +52 -0
- package/dist/reflection-CBMQ1FQo.mjs +60 -0
- package/dist/reflection-CkVyW69y.d.cts +52 -0
- package/dist/single-line-comment-BMPq6OR0.cjs +25 -0
- package/dist/single-line-comment-BjL_Z4Qn.d.cts +22 -0
- package/dist/single-line-comment-C5CtHQhi.mjs +19 -0
- package/dist/single-line-comment-DZAmp_BZ.d.mts +22 -0
- package/dist/source-file-4J1OvLed.d.cts +31 -0
- package/dist/source-file-BBbuhOKz.d.mts +31 -0
- package/dist/source-file-CCYwl5pI.mjs +52 -0
- package/dist/source-file-DTd1KgD5.cjs +59 -0
- package/dist/tsdoc-BFPYF-Fh.cjs +487 -0
- package/dist/tsdoc-BmyOQBxT.mjs +367 -0
- package/dist/tsdoc-C39LB5Mn.d.cts +152 -0
- package/dist/tsdoc-OE37Ht2l.d.mts +152 -0
- package/dist/tsdoc-reflection-3ZoV_Mjz.d.cts +18 -0
- package/dist/tsdoc-reflection-3hSdGY1e.mjs +97 -0
- package/dist/tsdoc-reflection-BQN8iUG1.cjs +115 -0
- package/dist/tsdoc-reflection-BtEk3cDW.d.mts +18 -0
- package/dist/types/components.cjs +1 -0
- package/dist/types/components.d.cts +3 -0
- package/dist/types/components.d.mts +3 -0
- package/dist/types/components.mjs +3 -0
- package/dist/types/index.cjs +3 -0
- package/dist/types/index.d.cts +5 -0
- package/dist/types/index.d.mts +5 -0
- package/dist/types/index.mjs +5 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +3 -0
- package/dist/types/plugin.d.mts +3 -0
- package/dist/types/plugin.mjs +3 -0
- package/dist/types-BBEDEYnP.cjs +0 -0
- package/dist/types-BWlfXHs2.mjs +1 -0
- package/dist/typescript/components/builtin-file.cjs +9 -0
- package/dist/typescript/components/builtin-file.d.cts +7 -0
- package/dist/typescript/components/builtin-file.d.mts +7 -0
- package/dist/typescript/components/builtin-file.mjs +9 -0
- package/dist/typescript/components/dynamic-import-statement.cjs +3 -0
- package/dist/typescript/components/dynamic-import-statement.d.cts +2 -0
- package/dist/typescript/components/dynamic-import-statement.d.mts +2 -0
- package/dist/typescript/components/dynamic-import-statement.mjs +3 -0
- package/dist/typescript/components/entry-file.cjs +7 -0
- package/dist/typescript/components/entry-file.d.cts +6 -0
- package/dist/typescript/components/entry-file.d.mts +6 -0
- package/dist/typescript/components/entry-file.mjs +7 -0
- package/dist/typescript/components/index.cjs +50 -0
- package/dist/typescript/components/index.d.cts +14 -0
- package/dist/typescript/components/index.d.mts +14 -0
- package/dist/typescript/components/index.mjs +17 -0
- package/dist/typescript/components/record-expression.cjs +3 -0
- package/dist/typescript/components/record-expression.d.cts +2 -0
- package/dist/typescript/components/record-expression.d.mts +2 -0
- package/dist/typescript/components/record-expression.mjs +3 -0
- package/dist/typescript/components/tsdoc-reflection.cjs +9 -0
- package/dist/typescript/components/tsdoc-reflection.d.cts +5 -0
- package/dist/typescript/components/tsdoc-reflection.d.mts +5 -0
- package/dist/typescript/components/tsdoc-reflection.mjs +7 -0
- package/dist/typescript/components/tsdoc.cjs +24 -0
- package/dist/typescript/components/tsdoc.d.cts +4 -0
- package/dist/typescript/components/tsdoc.d.mts +4 -0
- package/dist/typescript/components/tsdoc.mjs +5 -0
- package/dist/typescript/components/typescript-file.cjs +8 -0
- package/dist/typescript/components/typescript-file.d.cts +5 -0
- package/dist/typescript/components/typescript-file.d.mts +5 -0
- package/dist/typescript/components/typescript-file.mjs +6 -0
- package/dist/typescript/components/typescript-interface.cjs +9 -0
- package/dist/typescript/components/typescript-interface.d.cts +4 -0
- package/dist/typescript/components/typescript-interface.d.mts +4 -0
- package/dist/typescript/components/typescript-interface.mjs +8 -0
- package/dist/typescript/components/typescript-object.cjs +9 -0
- package/dist/typescript/components/typescript-object.d.cts +4 -0
- package/dist/typescript/components/typescript-object.d.mts +4 -0
- package/dist/typescript/components/typescript-object.mjs +8 -0
- package/dist/typescript/index.cjs +51 -0
- package/dist/typescript/index.d.cts +15 -0
- package/dist/typescript/index.d.mts +15 -0
- package/dist/typescript/index.mjs +18 -0
- package/dist/typescript-45caIUPa.mjs +1 -0
- package/dist/typescript-BrZsJqvc.mjs +45 -0
- package/dist/typescript-CXP7Oa6_.d.cts +25 -0
- package/dist/typescript-DG1-qdBQ.d.mts +25 -0
- package/dist/typescript-DV5akLQO.cjs +0 -0
- package/dist/typescript-DcqKlMoH.cjs +51 -0
- package/dist/typescript-file-6Y81yLyB.cjs +157 -0
- package/dist/typescript-file-BR9I7R1v.d.cts +47 -0
- package/dist/typescript-file-BWq9GIUt.d.mts +47 -0
- package/dist/typescript-file-y6oF016h.mjs +139 -0
- package/dist/typescript-interface-AydoCmGY.mjs +52 -0
- package/dist/typescript-interface-CKjljRFu.d.mts +25 -0
- package/dist/typescript-interface-Codd49Sl.cjs +64 -0
- package/dist/typescript-interface-fGS4VBnW.d.cts +25 -0
- package/dist/typescript-object-C-BmpHfk.mjs +93 -0
- package/dist/typescript-object-CxC5Qo5P.d.cts +26 -0
- package/dist/typescript-object-DOrJkpcM.cjs +105 -0
- package/dist/typescript-object-I6Huh12F.d.mts +26 -0
- package/dist/utilities-CnaPrauh.mjs +109 -0
- package/dist/utilities-llRqOC4l.cjs +133 -0
- package/package.json +411 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { h as TypescriptFileImports, n as ComponentProps, p as SourceFileHeaderProps } from "./components-B2kXCrty.mjs";
|
|
2
|
+
import { n as SourceFileProps$1 } from "./source-file-BBbuhOKz.mjs";
|
|
3
|
+
import { Children } from "@alloy-js/core";
|
|
4
|
+
import { TSModuleScope } from "@alloy-js/typescript";
|
|
5
|
+
|
|
6
|
+
//#region src/typescript/components/typescript-file.d.ts
|
|
7
|
+
type TypescriptFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps & {
|
|
8
|
+
hashbang?: Children | true;
|
|
9
|
+
header?: Children;
|
|
10
|
+
imports?: TypescriptFileImports;
|
|
11
|
+
export?: boolean | string;
|
|
12
|
+
tsx?: boolean;
|
|
13
|
+
};
|
|
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
|
+
declare function TypescriptFile(props: TypescriptFileProps): Children;
|
|
21
|
+
interface TypescriptFileHeaderProps extends SourceFileHeaderProps {
|
|
22
|
+
header?: Children;
|
|
23
|
+
hashbang?: Children | true;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Renders the header for a Powerlines Typescript source file.
|
|
27
|
+
*
|
|
28
|
+
* @param props - The properties for the source file header.
|
|
29
|
+
* @returns The rendered source file header.
|
|
30
|
+
*/
|
|
31
|
+
declare function TypescriptFileHeader(props: TypescriptFileHeaderProps): Children;
|
|
32
|
+
interface TypescriptFileHeaderImportsProps extends SourceFileHeaderProps {
|
|
33
|
+
imports?: TypescriptFileImports;
|
|
34
|
+
scope?: TSModuleScope;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Renders the header for a Powerlines Typescript source file.
|
|
38
|
+
*
|
|
39
|
+
* @param props - The properties for the source file header.
|
|
40
|
+
* @returns The rendered source file header.
|
|
41
|
+
*/
|
|
42
|
+
declare function TypescriptFileHeaderImports(props: TypescriptFileHeaderImportsProps): Children;
|
|
43
|
+
declare type __ΩTypescriptFileProps = any[];
|
|
44
|
+
declare type __ΩTypescriptFileHeaderProps = any[];
|
|
45
|
+
declare type __ΩTypescriptFileHeaderImportsProps = any[];
|
|
46
|
+
//#endregion
|
|
47
|
+
export { TypescriptFileHeaderProps as a, __ΩTypescriptFileHeaderProps as c, TypescriptFileHeaderImportsProps as i, __ΩTypescriptFileProps as l, TypescriptFileHeader as n, TypescriptFileProps as o, TypescriptFileHeaderImports as r, __ΩTypescriptFileHeaderImportsProps as s, TypescriptFile as t };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { n as usePowerlines } from "./context-Cx38_mgI.mjs";
|
|
2
|
+
import { t as SingleLineComment } from "./single-line-comment-C5CtHQhi.mjs";
|
|
3
|
+
import { t as SourceFile } from "./source-file-CCYwl5pI.mjs";
|
|
4
|
+
import { Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
|
|
5
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
7
|
+
import { ImportStatements, PackageContext, SourceFileContext as SourceFileContext$1, TSModuleScope, getSourceDirectoryData, useSourceFile } from "@alloy-js/typescript";
|
|
8
|
+
import { appendPath } from "@stryke/path/append";
|
|
9
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
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 /* @__PURE__ */ jsx(SourceFileContext$1.Provider, {
|
|
40
|
+
value: { scope },
|
|
41
|
+
children: /* @__PURE__ */ jsx(Scope, {
|
|
42
|
+
value: scope,
|
|
43
|
+
children: /* @__PURE__ */ jsx(SourceFile, {
|
|
44
|
+
...rest,
|
|
45
|
+
path: modulePath,
|
|
46
|
+
header: header ?? /* @__PURE__ */ jsx(TypescriptFileHeader, {
|
|
47
|
+
hashbang,
|
|
48
|
+
children: /* @__PURE__ */ jsx(TypescriptFileHeaderImports, {
|
|
49
|
+
imports,
|
|
50
|
+
scope
|
|
51
|
+
})
|
|
52
|
+
}),
|
|
53
|
+
filetype: tsx ? "tsx" : "typescript",
|
|
54
|
+
children
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Renders the header for a Powerlines Typescript source file.
|
|
61
|
+
*
|
|
62
|
+
* @param props - The properties for the source file header.
|
|
63
|
+
* @returns The rendered source file header.
|
|
64
|
+
*/
|
|
65
|
+
function TypescriptFileHeader(props) {
|
|
66
|
+
const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
|
|
67
|
+
const context = usePowerlines();
|
|
68
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
70
|
+
when: Boolean(hashbang),
|
|
71
|
+
children: [hashbang === true ? code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang, /* @__PURE__ */ jsx("hbr", {})]
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
74
|
+
when: Boolean(header),
|
|
75
|
+
children: [header, /* @__PURE__ */ jsx("hbr", {})]
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ jsx("hbr", {}),
|
|
78
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
79
|
+
when: Boolean(disableEslint),
|
|
80
|
+
children: [/* @__PURE__ */ jsx(SingleLineComment, {
|
|
81
|
+
variant: "slash-star",
|
|
82
|
+
children: "eslint-disable"
|
|
83
|
+
}), /* @__PURE__ */ jsx("hbr", {})]
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
86
|
+
when: Boolean(disablePrettier),
|
|
87
|
+
children: [/* @__PURE__ */ jsx(SingleLineComment, {
|
|
88
|
+
variant: "slash-star",
|
|
89
|
+
children: "prettier-ignore"
|
|
90
|
+
}), /* @__PURE__ */ jsx("hbr", {})]
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ jsxs(Show, {
|
|
93
|
+
when: Boolean(disableBiome),
|
|
94
|
+
children: [/* @__PURE__ */ jsx(SingleLineComment, { children: "biome-ignore lint: disable" }), /* @__PURE__ */ jsx("hbr", {})]
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ jsx(Show, {
|
|
97
|
+
when: Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome),
|
|
98
|
+
children: /* @__PURE__ */ jsx("hbr", {})
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ jsx(Show, {
|
|
101
|
+
when: Boolean(children),
|
|
102
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [children, /* @__PURE__ */ jsx("hbr", {})] })
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ jsx(SingleLineComment, { children: code`Generated by ${titleCase(context?.config.framework) || "Powerlines"}` }),
|
|
105
|
+
/* @__PURE__ */ jsx("hbr", {}),
|
|
106
|
+
/* @__PURE__ */ jsx(SingleLineComment, { children: code`NOTE: Do not edit this file manually - it will be overwritten automatically by the "prepare" command` }),
|
|
107
|
+
/* @__PURE__ */ jsx("hbr", {})
|
|
108
|
+
] });
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Renders the header for a Powerlines Typescript source file.
|
|
112
|
+
*
|
|
113
|
+
* @param props - The properties for the source file header.
|
|
114
|
+
* @returns The rendered source file header.
|
|
115
|
+
*/
|
|
116
|
+
function TypescriptFileHeaderImports(props) {
|
|
117
|
+
const { imports } = props;
|
|
118
|
+
const sourceFile = useSourceFile();
|
|
119
|
+
const scope = props.scope ?? sourceFile.scope;
|
|
120
|
+
return /* @__PURE__ */ jsxs(Show, {
|
|
121
|
+
when: scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0,
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ jsx(Show, {
|
|
124
|
+
when: !!imports && Object.keys(imports).length > 0,
|
|
125
|
+
children: Object.entries(imports ?? {}).map(([module, imported]) => {
|
|
126
|
+
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}";`;
|
|
127
|
+
})
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ jsx(Show, {
|
|
130
|
+
when: scope.importedModules.size > 0,
|
|
131
|
+
children: /* @__PURE__ */ jsx(ImportStatements, { records: scope.importedModules })
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ jsx("hbr", {})
|
|
134
|
+
]
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
export { TypescriptFileHeader as n, TypescriptFileHeaderImports as r, TypescriptFile as t };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { i as ReflectionPropertyContext, t as ReflectionClassContext } from "./reflection-CBMQ1FQo.mjs";
|
|
2
|
+
import { r as TSDocReflectionProperty, t as TSDocReflectionClass } from "./tsdoc-reflection-3hSdGY1e.mjs";
|
|
3
|
+
import { For, computed, splitProps } from "@alloy-js/core";
|
|
4
|
+
import { stringifyType } from "@powerlines/deepkit/vendor/type";
|
|
5
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
6
|
+
import { jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
7
|
+
import { InterfaceDeclaration, InterfaceMember } from "@alloy-js/typescript";
|
|
8
|
+
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
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] = 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 /* @__PURE__ */ jsxs(ReflectionClassContext.Provider, {
|
|
19
|
+
value: { reflection },
|
|
20
|
+
children: [/* @__PURE__ */ jsx(TSDocReflectionClass, {}), /* @__PURE__ */ jsx(InterfaceDeclaration, {
|
|
21
|
+
export: true,
|
|
22
|
+
name: interfaceName.value,
|
|
23
|
+
...rest,
|
|
24
|
+
children: /* @__PURE__ */ jsx(For, {
|
|
25
|
+
each: properties,
|
|
26
|
+
doubleHardline: true,
|
|
27
|
+
semicolon: true,
|
|
28
|
+
children: (prop) => /* @__PURE__ */ jsx(TypescriptInterfaceProperty, { property: prop })
|
|
29
|
+
})
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Generates a TypeScript interface property for the given reflection class.
|
|
35
|
+
*/
|
|
36
|
+
function TypescriptInterfaceProperty(props) {
|
|
37
|
+
const [{ property }, rest] = splitProps(props, ["property"]);
|
|
38
|
+
return /* @__PURE__ */ jsxs(ReflectionPropertyContext.Provider, {
|
|
39
|
+
value: property,
|
|
40
|
+
children: [/* @__PURE__ */ jsx(TSDocReflectionProperty, {}), /* @__PURE__ */ jsx(InterfaceMember, {
|
|
41
|
+
name: property.getNameAsString(),
|
|
42
|
+
readonly: property.isReadonly(),
|
|
43
|
+
optional: property.isOptional(),
|
|
44
|
+
nullish: property.isNullable(),
|
|
45
|
+
type: stringifyType(property.getType()),
|
|
46
|
+
...rest
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { TypescriptInterfaceProperty as n, TypeScriptInterface as t };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { n as ComponentProps } from "./components-B2kXCrty.mjs";
|
|
2
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
3
|
+
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
4
|
+
import { InterfaceDeclarationProps, InterfaceMemberProps } from "@alloy-js/typescript";
|
|
5
|
+
|
|
6
|
+
//#region src/typescript/components/typescript-interface.d.ts
|
|
7
|
+
interface TypeScriptInterfaceProps<T extends Record<string, any> = Record<string, any>> extends InterfaceDeclarationProps, ComponentProps {
|
|
8
|
+
reflection: ReflectionClass<T>;
|
|
9
|
+
defaultValue?: Partial<T>;
|
|
10
|
+
}
|
|
11
|
+
interface TypescriptInterfacePropertyProps extends Omit<InterfaceMemberProps, "name">, ComponentProps {
|
|
12
|
+
property: ReflectionProperty;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generates a TypeScript interface for the given reflection class.
|
|
16
|
+
*/
|
|
17
|
+
declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core1.Children;
|
|
18
|
+
/**
|
|
19
|
+
* Generates a TypeScript interface property for the given reflection class.
|
|
20
|
+
*/
|
|
21
|
+
declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core1.Children;
|
|
22
|
+
declare type __ΩTypeScriptInterfaceProps = any[];
|
|
23
|
+
declare type __ΩTypescriptInterfacePropertyProps = any[];
|
|
24
|
+
//#endregion
|
|
25
|
+
export { __ΩTypeScriptInterfaceProps as a, TypescriptInterfacePropertyProps as i, TypeScriptInterfaceProps as n, __ΩTypescriptInterfacePropertyProps as o, TypescriptInterfaceProperty as r, TypeScriptInterface as t };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
+
const require_reflection = require('./reflection-BSbFFYZO.cjs');
|
|
3
|
+
const require_tsdoc_reflection = require('./tsdoc-reflection-BQN8iUG1.cjs');
|
|
4
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
5
|
+
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
6
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
7
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
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 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 /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(require_reflection.ReflectionClassContext.Provider, {
|
|
20
|
+
value: { reflection },
|
|
21
|
+
children: [/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionClass, {}), /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_typescript.InterfaceDeclaration, {
|
|
22
|
+
export: true,
|
|
23
|
+
name: interfaceName.value,
|
|
24
|
+
...rest,
|
|
25
|
+
children: /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_core.For, {
|
|
26
|
+
each: properties,
|
|
27
|
+
doubleHardline: true,
|
|
28
|
+
semicolon: true,
|
|
29
|
+
children: (prop) => /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(TypescriptInterfaceProperty, { property: prop })
|
|
30
|
+
})
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Generates a TypeScript interface property for the given reflection class.
|
|
36
|
+
*/
|
|
37
|
+
function TypescriptInterfaceProperty(props) {
|
|
38
|
+
const [{ property }, rest] = (0, __alloy_js_core.splitProps)(props, ["property"]);
|
|
39
|
+
return /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(require_reflection.ReflectionPropertyContext.Provider, {
|
|
40
|
+
value: property,
|
|
41
|
+
children: [/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionProperty, {}), /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_typescript.InterfaceMember, {
|
|
42
|
+
name: property.getNameAsString(),
|
|
43
|
+
readonly: property.isReadonly(),
|
|
44
|
+
optional: property.isOptional(),
|
|
45
|
+
nullish: property.isNullable(),
|
|
46
|
+
type: (0, __powerlines_deepkit_vendor_type.stringifyType)(property.getType()),
|
|
47
|
+
...rest
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
Object.defineProperty(exports, 'TypeScriptInterface', {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () {
|
|
56
|
+
return TypeScriptInterface;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, 'TypescriptInterfaceProperty', {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function () {
|
|
62
|
+
return TypescriptInterfaceProperty;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { n as ComponentProps } from "./components-B0A7LpQD.cjs";
|
|
2
|
+
import * as _alloy_js_core1 from "@alloy-js/core";
|
|
3
|
+
import { InterfaceDeclarationProps, InterfaceMemberProps } from "@alloy-js/typescript";
|
|
4
|
+
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
5
|
+
|
|
6
|
+
//#region src/typescript/components/typescript-interface.d.ts
|
|
7
|
+
interface TypeScriptInterfaceProps<T extends Record<string, any> = Record<string, any>> extends InterfaceDeclarationProps, ComponentProps {
|
|
8
|
+
reflection: ReflectionClass<T>;
|
|
9
|
+
defaultValue?: Partial<T>;
|
|
10
|
+
}
|
|
11
|
+
interface TypescriptInterfacePropertyProps extends Omit<InterfaceMemberProps, "name">, ComponentProps {
|
|
12
|
+
property: ReflectionProperty;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generates a TypeScript interface for the given reflection class.
|
|
16
|
+
*/
|
|
17
|
+
declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core1.Children;
|
|
18
|
+
/**
|
|
19
|
+
* Generates a TypeScript interface property for the given reflection class.
|
|
20
|
+
*/
|
|
21
|
+
declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core1.Children;
|
|
22
|
+
declare type __ΩTypeScriptInterfaceProps = any[];
|
|
23
|
+
declare type __ΩTypescriptInterfacePropertyProps = any[];
|
|
24
|
+
//#endregion
|
|
25
|
+
export { __ΩTypeScriptInterfaceProps as a, TypescriptInterfacePropertyProps as i, TypeScriptInterfaceProps as n, __ΩTypescriptInterfacePropertyProps as o, TypescriptInterfaceProperty as r, TypeScriptInterface as t };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { r as stringifyDefaultValue } from "./utilities-CnaPrauh.mjs";
|
|
2
|
+
import { i as ReflectionPropertyContext, t as ReflectionClassContext } from "./reflection-CBMQ1FQo.mjs";
|
|
3
|
+
import { r as TSDocReflectionProperty, t as TSDocReflectionClass } from "./tsdoc-reflection-3hSdGY1e.mjs";
|
|
4
|
+
import { Declaration, For, Name, Show, computed, createSymbolSlot, splitProps } from "@alloy-js/core";
|
|
5
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
6
|
+
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
7
|
+
import { jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
8
|
+
import { ObjectExpression, ObjectProperty, TSSymbolFlags, TypeRefContext, createValueSymbol, useTSNamePolicy } from "@alloy-js/typescript";
|
|
9
|
+
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
10
|
+
import { camelCase } from "@stryke/string-format/camel-case";
|
|
11
|
+
|
|
12
|
+
//#region 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 ? /* @__PURE__ */ jsxs(TypeRefContext, { children: [": ", /* @__PURE__ */ jsx(TypeSymbolSlot, { children: props.type })] }) : void 0;
|
|
38
|
+
return /* @__PURE__ */ jsx(Show, {
|
|
39
|
+
when: !!props.reflection.value,
|
|
40
|
+
children: /* @__PURE__ */ jsxs(ReflectionClassContext.Provider, {
|
|
41
|
+
value: {
|
|
42
|
+
reflection: props.reflection.value,
|
|
43
|
+
override: {
|
|
44
|
+
name: objectName.value,
|
|
45
|
+
type: objectType.value,
|
|
46
|
+
defaultValue: props.defaultValue?.value
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
children: [/* @__PURE__ */ jsxs(Show, {
|
|
50
|
+
when: !!objectName.value && !!objectType.value,
|
|
51
|
+
children: [/* @__PURE__ */ jsx(TSDocReflectionClass, {}), /* @__PURE__ */ jsxs(Declaration, {
|
|
52
|
+
symbol: sym,
|
|
53
|
+
children: [
|
|
54
|
+
props.export ? "export " : "",
|
|
55
|
+
props.default ? "default " : "",
|
|
56
|
+
keyword,
|
|
57
|
+
" ",
|
|
58
|
+
/* @__PURE__ */ jsx(Name, {}),
|
|
59
|
+
type,
|
|
60
|
+
" =",
|
|
61
|
+
" ",
|
|
62
|
+
/* @__PURE__ */ jsx(ValueTypeSymbolSlot, { children: props.initializer ?? props.children ?? /* @__PURE__ */ jsx(ObjectExpression, { children: /* @__PURE__ */ jsx(For, {
|
|
63
|
+
each: properties.value ?? [],
|
|
64
|
+
comma: true,
|
|
65
|
+
doubleHardline: true,
|
|
66
|
+
children: (prop) => /* @__PURE__ */ jsx(TypescriptObjectProperty, { property: prop })
|
|
67
|
+
}) }) })
|
|
68
|
+
]
|
|
69
|
+
})]
|
|
70
|
+
}), /* @__PURE__ */ jsx("hbr", {})]
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Generates a TypeScript object property for the given reflection class.
|
|
76
|
+
*/
|
|
77
|
+
function TypescriptObjectProperty(props) {
|
|
78
|
+
const [{ property }] = splitProps(props, ["property"]);
|
|
79
|
+
return /* @__PURE__ */ jsxs(ReflectionPropertyContext.Provider, {
|
|
80
|
+
value: property,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ jsx(TSDocReflectionProperty, {}),
|
|
83
|
+
/* @__PURE__ */ jsx(ObjectProperty, {
|
|
84
|
+
name: property.getNameAsString(),
|
|
85
|
+
value: stringifyDefaultValue(property)
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ jsx("hbr", {})
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
export { TypescriptObjectProperty as n, TypescriptObject as t };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { n as ComponentProps } from "./components-B0A7LpQD.cjs";
|
|
2
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
|
+
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
4
|
+
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
5
|
+
import { ComputedRef } from "@vue/reactivity";
|
|
6
|
+
|
|
7
|
+
//#region src/typescript/components/typescript-object.d.ts
|
|
8
|
+
interface TypescriptObjectProps<T extends Record<string, any> = Record<string, any>> extends VarDeclarationProps {
|
|
9
|
+
reflection?: ComputedRef<ReflectionClass<T>>;
|
|
10
|
+
defaultValue?: ComputedRef<Partial<T> | undefined>;
|
|
11
|
+
}
|
|
12
|
+
interface TypescriptObjectPropertyProps extends ComponentProps {
|
|
13
|
+
property: ReflectionProperty;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Generates a TypeScript object for the given reflection class.
|
|
17
|
+
*/
|
|
18
|
+
declare function TypescriptObject<T extends Record<string, any> = Record<string, any>>(props: TypescriptObjectProps<T>): _alloy_js_core0.Children;
|
|
19
|
+
/**
|
|
20
|
+
* Generates a TypeScript object property for the given reflection class.
|
|
21
|
+
*/
|
|
22
|
+
declare function TypescriptObjectProperty(props: TypescriptObjectPropertyProps): _alloy_js_core0.Children;
|
|
23
|
+
declare type __ΩTypescriptObjectProps = any[];
|
|
24
|
+
declare type __ΩTypescriptObjectPropertyProps = any[];
|
|
25
|
+
//#endregion
|
|
26
|
+
export { __ΩTypescriptObjectPropertyProps as a, TypescriptObjectProps as i, TypescriptObjectProperty as n, __ΩTypescriptObjectProps as o, TypescriptObjectPropertyProps as r, TypescriptObject as t };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
+
const require_utilities = require('./utilities-llRqOC4l.cjs');
|
|
3
|
+
const require_reflection = require('./reflection-BSbFFYZO.cjs');
|
|
4
|
+
const require_tsdoc_reflection = require('./tsdoc-reflection-BQN8iUG1.cjs');
|
|
5
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
+
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
7
|
+
let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
8
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
9
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
10
|
+
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
11
|
+
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
12
|
+
|
|
13
|
+
//#region 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 ? /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(__alloy_js_typescript.TypeRefContext, { children: [": ", /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(TypeSymbolSlot, { children: props.type })] }) : void 0;
|
|
39
|
+
return /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_core.Show, {
|
|
40
|
+
when: !!props.reflection.value,
|
|
41
|
+
children: /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(require_reflection.ReflectionClassContext.Provider, {
|
|
42
|
+
value: {
|
|
43
|
+
reflection: props.reflection.value,
|
|
44
|
+
override: {
|
|
45
|
+
name: objectName.value,
|
|
46
|
+
type: objectType.value,
|
|
47
|
+
defaultValue: props.defaultValue?.value
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
children: [/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(__alloy_js_core.Show, {
|
|
51
|
+
when: !!objectName.value && !!objectType.value,
|
|
52
|
+
children: [/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionClass, {}), /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(__alloy_js_core.Declaration, {
|
|
53
|
+
symbol: sym,
|
|
54
|
+
children: [
|
|
55
|
+
props.export ? "export " : "",
|
|
56
|
+
props.default ? "default " : "",
|
|
57
|
+
keyword,
|
|
58
|
+
" ",
|
|
59
|
+
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_core.Name, {}),
|
|
60
|
+
type,
|
|
61
|
+
" =",
|
|
62
|
+
" ",
|
|
63
|
+
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(ValueTypeSymbolSlot, { children: props.initializer ?? props.children ?? /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_typescript.ObjectExpression, { children: /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_core.For, {
|
|
64
|
+
each: properties.value ?? [],
|
|
65
|
+
comma: true,
|
|
66
|
+
doubleHardline: true,
|
|
67
|
+
children: (prop) => /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(TypescriptObjectProperty, { property: prop })
|
|
68
|
+
}) }) })
|
|
69
|
+
]
|
|
70
|
+
})]
|
|
71
|
+
}), /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {})]
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Generates a TypeScript object property for the given reflection class.
|
|
77
|
+
*/
|
|
78
|
+
function TypescriptObjectProperty(props) {
|
|
79
|
+
const [{ property }] = (0, __alloy_js_core.splitProps)(props, ["property"]);
|
|
80
|
+
return /* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsxs)(require_reflection.ReflectionPropertyContext.Provider, {
|
|
81
|
+
value: property,
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionProperty, {}),
|
|
84
|
+
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)(__alloy_js_typescript.ObjectProperty, {
|
|
85
|
+
name: property.getNameAsString(),
|
|
86
|
+
value: require_utilities.stringifyDefaultValue(property)
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ (0, __alloy_js_core_jsx_runtime.jsx)("hbr", {})
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
Object.defineProperty(exports, 'TypescriptObject', {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function () {
|
|
97
|
+
return TypescriptObject;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(exports, 'TypescriptObjectProperty', {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function () {
|
|
103
|
+
return TypescriptObjectProperty;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { n as ComponentProps } from "./components-B2kXCrty.mjs";
|
|
2
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
|
+
import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
|
|
4
|
+
import { VarDeclarationProps } from "@alloy-js/typescript";
|
|
5
|
+
import { ComputedRef } from "@vue/reactivity";
|
|
6
|
+
|
|
7
|
+
//#region src/typescript/components/typescript-object.d.ts
|
|
8
|
+
interface TypescriptObjectProps<T extends Record<string, any> = Record<string, any>> extends VarDeclarationProps {
|
|
9
|
+
reflection?: ComputedRef<ReflectionClass<T>>;
|
|
10
|
+
defaultValue?: ComputedRef<Partial<T> | undefined>;
|
|
11
|
+
}
|
|
12
|
+
interface TypescriptObjectPropertyProps extends ComponentProps {
|
|
13
|
+
property: ReflectionProperty;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Generates a TypeScript object for the given reflection class.
|
|
17
|
+
*/
|
|
18
|
+
declare function TypescriptObject<T extends Record<string, any> = Record<string, any>>(props: TypescriptObjectProps<T>): _alloy_js_core0.Children;
|
|
19
|
+
/**
|
|
20
|
+
* Generates a TypeScript object property for the given reflection class.
|
|
21
|
+
*/
|
|
22
|
+
declare function TypescriptObjectProperty(props: TypescriptObjectPropertyProps): _alloy_js_core0.Children;
|
|
23
|
+
declare type __ΩTypescriptObjectProps = any[];
|
|
24
|
+
declare type __ΩTypescriptObjectPropertyProps = any[];
|
|
25
|
+
//#endregion
|
|
26
|
+
export { __ΩTypescriptObjectPropertyProps as a, TypescriptObjectProps as i, TypescriptObjectProperty as n, __ΩTypescriptObjectProps as o, TypescriptObjectPropertyProps as r, TypescriptObject as t };
|