@powerlines/plugin-alloy 0.25.27 → 0.25.29
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/core/components/output.cjs +7 -19
- package/dist/core/components/output.mjs +7 -19
- package/dist/core/components/output.mjs.map +1 -1
- package/dist/core/components/single-line-comment.cjs +8 -7
- package/dist/core/components/single-line-comment.mjs +8 -7
- package/dist/core/components/single-line-comment.mjs.map +1 -1
- package/dist/core/components/source-file.cjs +7 -12
- package/dist/core/components/source-file.mjs +7 -12
- package/dist/core/components/source-file.mjs.map +1 -1
- package/dist/core/components/spacing.cjs +6 -7
- package/dist/core/components/spacing.mjs +6 -7
- package/dist/core/components/spacing.mjs.map +1 -1
- package/dist/core/contexts/context.mjs.map +1 -1
- package/dist/core/contexts/meta.mjs.map +1 -1
- package/dist/core/contexts/reflection.mjs.map +1 -1
- package/dist/core/helpers/code.mjs.map +1 -1
- package/dist/helpers/capnp.mjs.map +1 -1
- package/dist/helpers/create-builtin.mjs.map +1 -1
- package/dist/helpers/refkey.mjs.map +1 -1
- package/dist/helpers/typescript.mjs.map +1 -1
- package/dist/index.cjs +6 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +6 -3
- package/dist/index.mjs.map +1 -1
- package/dist/markdown/components/front-matter.cjs +9 -14
- package/dist/markdown/components/front-matter.mjs +9 -14
- package/dist/markdown/components/front-matter.mjs.map +1 -1
- package/dist/markdown/components/markdown-file.cjs +41 -89
- package/dist/markdown/components/markdown-file.mjs +41 -89
- package/dist/markdown/components/markdown-file.mjs.map +1 -1
- package/dist/markdown/components/markdown-table.cjs +20 -52
- package/dist/markdown/components/markdown-table.mjs +20 -52
- package/dist/markdown/components/markdown-table.mjs.map +1 -1
- package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
- package/dist/render.cjs +4 -10
- package/dist/render.mjs +4 -10
- package/dist/render.mjs.map +1 -1
- package/dist/typescript/components/builtin-file.cjs +9 -31
- package/dist/typescript/components/builtin-file.mjs +9 -31
- package/dist/typescript/components/builtin-file.mjs.map +1 -1
- package/dist/typescript/components/class-declaration.cjs +80 -193
- package/dist/typescript/components/class-declaration.mjs +80 -193
- package/dist/typescript/components/class-declaration.mjs.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.cjs +1 -2
- package/dist/typescript/components/dynamic-import-statement.mjs +1 -2
- package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
- package/dist/typescript/components/entry-file.cjs +3 -10
- package/dist/typescript/components/entry-file.mjs +3 -10
- package/dist/typescript/components/entry-file.mjs.map +1 -1
- package/dist/typescript/components/infrastructure-file.cjs +3 -10
- package/dist/typescript/components/infrastructure-file.mjs +3 -10
- package/dist/typescript/components/infrastructure-file.mjs.map +1 -1
- package/dist/typescript/components/interface-declaration.cjs +47 -134
- package/dist/typescript/components/interface-declaration.mjs +47 -134
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +35 -79
- package/dist/typescript/components/object-declaration.mjs +35 -79
- package/dist/typescript/components/object-declaration.mjs.map +1 -1
- package/dist/typescript/components/property-name.cjs +3 -3
- package/dist/typescript/components/property-name.mjs +3 -3
- package/dist/typescript/components/property-name.mjs.map +1 -1
- package/dist/typescript/components/record-expression.mjs.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.cjs +53 -232
- package/dist/typescript/components/tsdoc-reflection.mjs +53 -232
- package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +140 -306
- package/dist/typescript/components/tsdoc.mjs +140 -306
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/components/type-declaration.cjs +9 -22
- package/dist/typescript/components/type-declaration.mjs +9 -22
- package/dist/typescript/components/type-declaration.mjs.map +1 -1
- package/dist/typescript/components/type-parameters.cjs +33 -60
- package/dist/typescript/components/type-parameters.mjs +33 -60
- package/dist/typescript/components/type-parameters.mjs.map +1 -1
- package/dist/typescript/components/typescript-file.cjs +65 -155
- package/dist/typescript/components/typescript-file.mjs +65 -155
- package/dist/typescript/components/typescript-file.mjs.map +1 -1
- package/dist/typescript/contexts/lexical-scope.cjs +1 -7
- package/dist/typescript/contexts/lexical-scope.mjs +1 -7
- package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
- package/dist/typescript/contexts/member-scope.cjs +2 -7
- package/dist/typescript/contexts/member-scope.mjs +2 -7
- package/dist/typescript/contexts/member-scope.mjs.map +1 -1
- package/dist/typescript/helpers/get-call-signature-props.mjs.map +1 -1
- package/dist/typescript/helpers/utilities.mjs.map +1 -1
- package/dist/yaml/components/yaml-file.cjs +48 -103
- package/dist/yaml/components/yaml-file.mjs +48 -103
- package/dist/yaml/components/yaml-file.mjs.map +1 -1
- package/package.json +7 -7
- package/dist/_virtual/_rolldown/runtime.mjs +0 -3
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_markdown_contexts_markdown_table = require('../contexts/markdown-table.cjs');
|
|
4
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
4
|
let _alloy_js_core = require("@alloy-js/core");
|
|
6
5
|
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
7
6
|
let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
@@ -18,22 +17,12 @@ function MarkdownTable(props) {
|
|
|
18
17
|
align: "left",
|
|
19
18
|
width: 20
|
|
20
19
|
})));
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
get children() {
|
|
29
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
30
|
-
get when() {
|
|
31
|
-
return Boolean(children);
|
|
32
|
-
},
|
|
33
|
-
children
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
20
|
+
return <require_markdown_contexts_markdown_table.MarkdownTableContext.Provider value={{
|
|
21
|
+
columns: columns.value,
|
|
22
|
+
data
|
|
23
|
+
}}>
|
|
24
|
+
<_alloy_js_core.Show when={Boolean(children)}>{children}</_alloy_js_core.Show>
|
|
25
|
+
</require_markdown_contexts_markdown_table.MarkdownTableContext.Provider>;
|
|
37
26
|
}
|
|
38
27
|
/**
|
|
39
28
|
* Component that provides a context for rendering markdown tables.
|
|
@@ -53,47 +42,26 @@ function MarkdownTableColumn(props) {
|
|
|
53
42
|
const textLength = (0, _alloy_js_core.computed)(() => {
|
|
54
43
|
return (children ? children.toString() : "").length;
|
|
55
44
|
});
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}),
|
|
64
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
65
|
-
get when() {
|
|
66
|
-
return Boolean(children);
|
|
67
|
-
},
|
|
68
|
-
get children() {
|
|
69
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Prose, { get children() {
|
|
70
|
-
return _alloy_js_core.code`${alignRef.value === "left" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}${children}${alignRef.value === "right" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}`;
|
|
71
|
-
} });
|
|
72
|
-
}
|
|
73
|
-
}),
|
|
74
|
-
"|"
|
|
75
|
-
];
|
|
76
|
-
} });
|
|
45
|
+
return <_alloy_js_core.Prose>
|
|
46
|
+
<_alloy_js_core.Show when={indexRef.value === 0}>{"|"}</_alloy_js_core.Show>
|
|
47
|
+
<_alloy_js_core.Show when={Boolean(children)}>
|
|
48
|
+
<_alloy_js_core.Prose>{_alloy_js_core.code`${alignRef.value === "left" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}${children}${alignRef.value === "right" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}`}</_alloy_js_core.Prose>
|
|
49
|
+
</_alloy_js_core.Show>
|
|
50
|
+
{"|"}
|
|
51
|
+
</_alloy_js_core.Prose>;
|
|
77
52
|
}
|
|
78
53
|
/**
|
|
79
54
|
* Component that provides a context for rendering markdown tables.
|
|
80
55
|
*/
|
|
81
56
|
function MarkdownTableColumnHeader(props) {
|
|
82
57
|
const [{ children, name }, rest] = (0, _alloy_js_core.splitProps)(props, ["children", "name"]);
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
get when() {
|
|
91
|
-
return !(0, _stryke_type_checks_is_undefined.isUndefined)(children);
|
|
92
|
-
},
|
|
93
|
-
children
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}))];
|
|
58
|
+
return <>
|
|
59
|
+
<MarkdownTableColumn {...rest} name={name}>
|
|
60
|
+
<_alloy_js_core.Show fallback={(0, _stryke_string_format_title_case.titleCase)(name, { useDescriptions: false })} when={!(0, _stryke_type_checks_is_undefined.isUndefined)(children)}>
|
|
61
|
+
{children}
|
|
62
|
+
</_alloy_js_core.Show>
|
|
63
|
+
</MarkdownTableColumn>
|
|
64
|
+
</>;
|
|
97
65
|
}
|
|
98
66
|
|
|
99
67
|
//#endregion
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MarkdownTableContext, useMarkdownTable } from "../contexts/markdown-table.mjs";
|
|
2
|
-
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
2
|
import { Prose, Show, code, computed, splitProps } from "@alloy-js/core";
|
|
4
3
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
5
4
|
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
@@ -16,22 +15,12 @@ function MarkdownTable(props) {
|
|
|
16
15
|
align: "left",
|
|
17
16
|
width: 20
|
|
18
17
|
})));
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
get children() {
|
|
27
|
-
return createComponent(Show, {
|
|
28
|
-
get when() {
|
|
29
|
-
return Boolean(children);
|
|
30
|
-
},
|
|
31
|
-
children
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
});
|
|
18
|
+
return <MarkdownTableContext.Provider value={{
|
|
19
|
+
columns: columns.value,
|
|
20
|
+
data
|
|
21
|
+
}}>
|
|
22
|
+
<Show when={Boolean(children)}>{children}</Show>
|
|
23
|
+
</MarkdownTableContext.Provider>;
|
|
35
24
|
}
|
|
36
25
|
/**
|
|
37
26
|
* Component that provides a context for rendering markdown tables.
|
|
@@ -51,47 +40,26 @@ function MarkdownTableColumn(props) {
|
|
|
51
40
|
const textLength = computed(() => {
|
|
52
41
|
return (children ? children.toString() : "").length;
|
|
53
42
|
});
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}),
|
|
62
|
-
createComponent(Show, {
|
|
63
|
-
get when() {
|
|
64
|
-
return Boolean(children);
|
|
65
|
-
},
|
|
66
|
-
get children() {
|
|
67
|
-
return createComponent(Prose, { get children() {
|
|
68
|
-
return code`${alignRef.value === "left" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}${children}${alignRef.value === "right" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}`;
|
|
69
|
-
} });
|
|
70
|
-
}
|
|
71
|
-
}),
|
|
72
|
-
"|"
|
|
73
|
-
];
|
|
74
|
-
} });
|
|
43
|
+
return <Prose>
|
|
44
|
+
<Show when={indexRef.value === 0}>{"|"}</Show>
|
|
45
|
+
<Show when={Boolean(children)}>
|
|
46
|
+
<Prose>{code`${alignRef.value === "left" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}${children}${alignRef.value === "right" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}`}</Prose>
|
|
47
|
+
</Show>
|
|
48
|
+
{"|"}
|
|
49
|
+
</Prose>;
|
|
75
50
|
}
|
|
76
51
|
/**
|
|
77
52
|
* Component that provides a context for rendering markdown tables.
|
|
78
53
|
*/
|
|
79
54
|
function MarkdownTableColumnHeader(props) {
|
|
80
55
|
const [{ children, name }, rest] = splitProps(props, ["children", "name"]);
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
get when() {
|
|
89
|
-
return !isUndefined(children);
|
|
90
|
-
},
|
|
91
|
-
children
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}))];
|
|
56
|
+
return <>
|
|
57
|
+
<MarkdownTableColumn {...rest} name={name}>
|
|
58
|
+
<Show fallback={titleCase(name, { useDescriptions: false })} when={!isUndefined(children)}>
|
|
59
|
+
{children}
|
|
60
|
+
</Show>
|
|
61
|
+
</MarkdownTableColumn>
|
|
62
|
+
</>;
|
|
95
63
|
}
|
|
96
64
|
|
|
97
65
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-table.mjs","names":[
|
|
1
|
+
{"version":3,"file":"markdown-table.mjs","names":[],"sources":["../../../src/markdown/components/markdown-table.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, Prose, Show, splitProps } from \"@alloy-js/core\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { ComponentProps } from \"../../types/components\";\nimport {\n MarkdownTableColumnContextInterface,\n MarkdownTableContext,\n useMarkdownTable\n} from \"../contexts/markdown-table\";\n\nexport interface MarkdownTableProps<\n T extends Record<string, any> = Record<string, any>\n> extends ComponentProps {\n data: T[];\n}\n\n/**\n * Component that provides a context for rendering markdown tables.\n */\nexport function MarkdownTable<\n T extends Record<string, any> = Record<string, any>\n>(props: MarkdownTableProps<T>) {\n const [{ children, data }] = splitProps(props, [\"children\", \"data\"]);\n\n const columns = computed(() =>\n Object.keys(data).map((name: string, index: number) => ({\n index,\n name,\n align: \"left\" as const,\n width: 20\n }))\n );\n\n return (\n <MarkdownTableContext.Provider value={{ columns: columns.value, data }}>\n <Show when={Boolean(children)}>{children}</Show>\n </MarkdownTableContext.Provider>\n );\n}\n\nexport type MarkdownTableColumnProps = ComponentProps &\n Partial<Pick<MarkdownTableColumnContextInterface, \"align\">> &\n Required<Pick<MarkdownTableColumnContextInterface, \"name\">> & {\n width?: number;\n };\n\n/**\n * Component that provides a context for rendering markdown tables.\n */\nexport function MarkdownTableColumn(props: MarkdownTableColumnProps) {\n const [{ children, width, align, name }] = splitProps(props, [\n \"children\",\n \"width\",\n \"align\",\n \"name\"\n ]);\n\n const tableContext = useMarkdownTable();\n const columnRef = computed(() =>\n tableContext?.columns.find(c => c.name === name)\n );\n\n const indexRef = computed(() => columnRef.value?.index ?? 0);\n const alignRef = computed(() => columnRef.value?.align ?? align ?? \"left\");\n const widthRef = computed(() => columnRef.value?.width ?? width ?? 20);\n\n const textLength = computed(() => {\n const content = children ? children.toString() : \"\";\n\n return content.length;\n });\n\n return (\n <Prose>\n <Show when={indexRef.value === 0}>{\"|\"}</Show>\n <Show when={Boolean(children)}>\n <Prose>{code`${\n alignRef.value === \"left\"\n ? \" \".repeat(widthRef.value - textLength.value - 1)\n : \" \"\n }${children}${\n alignRef.value === \"right\"\n ? \" \".repeat(widthRef.value - textLength.value - 1)\n : \" \"\n }`}</Prose>\n </Show>\n {\"|\"}\n </Prose>\n );\n}\n\n/**\n * Component that provides a context for rendering markdown tables.\n */\nexport function MarkdownTableColumnHeader(props: MarkdownTableColumnProps) {\n const [{ children, name }, rest] = splitProps(props, [\"children\", \"name\"]);\n\n return (\n <>\n <MarkdownTableColumn {...rest} name={name}>\n <Show\n fallback={titleCase(name, {\n useDescriptions: false\n })}\n when={!isUndefined(children)}>\n {children}\n </Show>\n </MarkdownTableColumn>\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAqCA,SAAgB,cAEd,OAA8B;CAC9B,MAAM,CAAC,EAAE,UAAU,UAAU,WAAW,OAAO,CAAC,YAAY,OAAO,CAAC;CAEpE,MAAM,UAAU,eACd,OAAO,KAAK,KAAK,CAAC,KAAK,MAAc,WAAmB;EACtD;EACA;EACA,OAAO;EACP,OAAO;EACR,EAAE,CACJ;AAED,QACE,CAAC,qBAAqB,SAAS,OAAO;EAAE,SAAS,QAAQ;EAAO;EAAM,EAAE;MACtE,CAAC,KAAK,MAAM,QAAQ,SAAS,GAAG,SAAS,EAAE,KAAK;IAClD,EAAE,qBAAqB;;;;;AAa3B,SAAgB,oBAAoB,OAAiC;CACnE,MAAM,CAAC,EAAE,UAAU,OAAO,OAAO,UAAU,WAAW,OAAO;EAC3D;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,eAAe,kBAAkB;CACvC,MAAM,YAAY,eAChB,cAAc,QAAQ,MAAK,MAAK,EAAE,SAAS,KAAK,CACjD;CAED,MAAM,WAAW,eAAe,UAAU,OAAO,SAAS,EAAE;CAC5D,MAAM,WAAW,eAAe,UAAU,OAAO,SAAS,SAAS,OAAO;CAC1E,MAAM,WAAW,eAAe,UAAU,OAAO,SAAS,SAAS,GAAG;CAEtE,MAAM,aAAa,eAAe;AAGhC,UAFgB,WAAW,SAAS,UAAU,GAAG,IAElC;GACf;AAEF,QACE,CAAC,MAAM;MACL,CAAC,KAAK,MAAM,SAAS,UAAU,IAAI,IAAI,EAAE,KAAK;MAC9C,CAAC,KAAK,MAAM,QAAQ,SAAS,EAAE;QAC7B,CAAC,OAAO,IAAI,GACV,SAAS,UAAU,SACf,IAAI,OAAO,SAAS,QAAQ,WAAW,QAAQ,EAAE,GACjD,MACH,WACD,SAAS,UAAU,UACf,IAAI,OAAO,SAAS,QAAQ,WAAW,QAAQ,EAAE,GACjD,MACH,EAAE,MAAM;MACb,EAAE,KAAK;OACN,IAAI;IACP,EAAE;;;;;AAON,SAAgB,0BAA0B,OAAiC;CACzE,MAAM,CAAC,EAAE,UAAU,QAAQ,QAAQ,WAAW,OAAO,CAAC,YAAY,OAAO,CAAC;AAE1E,QACE,EAAE;MACA,CAAC,wBAAwB,MAAM,MAAM,MAAM;QACzC,CAAC,KACC,UAAU,UAAU,MAAM,EACxB,iBAAiB,OAClB,CAAC,EACF,MAAM,CAAC,YAAY,SAAS,EAAE;WAC7B,SAAS;QACZ,EAAE,KAAK;MACT,EAAE,oBAAoB;IACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-table.mjs","names":[
|
|
1
|
+
{"version":3,"file":"markdown-table.mjs","names":[],"sources":["../../../src/markdown/contexts/markdown-table.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createContext, createNamedContext, useContext } from \"@alloy-js/core\";\n\nexport interface MarkdownTableColumnContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n index: number;\n name: keyof T;\n align: \"left\" | \"right\" | \"center\";\n width: number;\n}\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const MarkdownTableColumnContext: ComponentContext<MarkdownTableColumnContextInterface> =\n createNamedContext<MarkdownTableColumnContextInterface>(\n \"MarkdownTableColumn\",\n {} as MarkdownTableColumnContextInterface\n );\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMarkdownTableColumn() {\n return useContext<MarkdownTableColumnContextInterface>(\n MarkdownTableColumnContext\n );\n}\n\nexport interface MarkdownTableContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n columns: MarkdownTableColumnContextInterface<T>[];\n data: T[];\n}\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const MarkdownTableContext: ComponentContext<MarkdownTableContextInterface> =\n createContext<MarkdownTableContextInterface>({\n columns: [],\n data: []\n } as MarkdownTableContextInterface);\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMarkdownTable() {\n return useContext<MarkdownTableContextInterface>(MarkdownTableContext);\n}\n"],"mappings":";;;;;;AAiCA,MAAa,6BACX,mBACE,uBACA,EAAE,CACH;;;;;;AAOH,SAAgB,yBAAyB;AACvC,QAAO,WACL,2BACD;;;;;AAaH,MAAa,uBACX,cAA6C;CAC3C,SAAS,EAAE;CACX,MAAM,EAAE;CACT,CAAkC;;;;;;AAOrC,SAAgB,mBAAmB;AACjC,QAAO,WAA0C,qBAAqB"}
|
package/dist/render.cjs
CHANGED
|
@@ -2,7 +2,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_core_components_output = require('./core/components/output.cjs');
|
|
4
4
|
require('./core/index.cjs');
|
|
5
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
5
|
let _alloy_js_core = require("@alloy-js/core");
|
|
7
6
|
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
8
7
|
|
|
@@ -23,11 +22,9 @@ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
|
23
22
|
*/
|
|
24
23
|
async function render(context, children) {
|
|
25
24
|
const meta = {};
|
|
26
|
-
const output = await (0, _alloy_js_core.renderAsync)(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
children
|
|
30
|
-
}));
|
|
25
|
+
const output = await (0, _alloy_js_core.renderAsync)(<require_core_components_output.Output context={context} meta={meta}>
|
|
26
|
+
{children}
|
|
27
|
+
</require_core_components_output.Output>);
|
|
31
28
|
if (!Object.keys(output).length) context.debug("No output files were rendered by Alloy-js component templates.");
|
|
32
29
|
else {
|
|
33
30
|
context.debug(`Processing ${Object.keys(output).length} rendered output files from Alloy-js component templates.`);
|
|
@@ -80,10 +77,7 @@ async function render(context, children) {
|
|
|
80
77
|
* @returns The rendered output as a string.
|
|
81
78
|
*/
|
|
82
79
|
function renderString(context, children, options) {
|
|
83
|
-
return (0, _alloy_js_core.printTree)((0, _alloy_js_core.renderTree)(
|
|
84
|
-
context,
|
|
85
|
-
children
|
|
86
|
-
})), options);
|
|
80
|
+
return (0, _alloy_js_core.printTree)((0, _alloy_js_core.renderTree)(<require_core_components_output.Output context={context}>{children}</require_core_components_output.Output>), options);
|
|
87
81
|
}
|
|
88
82
|
|
|
89
83
|
//#endregion
|
package/dist/render.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Output as Output$1 } from "./core/components/output.mjs";
|
|
2
2
|
import "./core/index.mjs";
|
|
3
|
-
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
4
3
|
import { printTree, renderAsync, renderTree, traverseOutput } from "@alloy-js/core";
|
|
5
4
|
import { findFileExtension } from "@stryke/path/file-path-fns";
|
|
6
5
|
|
|
@@ -21,11 +20,9 @@ import { findFileExtension } from "@stryke/path/file-path-fns";
|
|
|
21
20
|
*/
|
|
22
21
|
async function render(context, children) {
|
|
23
22
|
const meta = {};
|
|
24
|
-
const output = await renderAsync(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
children
|
|
28
|
-
}));
|
|
23
|
+
const output = await renderAsync(<Output$1 context={context} meta={meta}>
|
|
24
|
+
{children}
|
|
25
|
+
</Output$1>);
|
|
29
26
|
if (!Object.keys(output).length) context.debug("No output files were rendered by Alloy-js component templates.");
|
|
30
27
|
else {
|
|
31
28
|
context.debug(`Processing ${Object.keys(output).length} rendered output files from Alloy-js component templates.`);
|
|
@@ -78,10 +75,7 @@ async function render(context, children) {
|
|
|
78
75
|
* @returns The rendered output as a string.
|
|
79
76
|
*/
|
|
80
77
|
function renderString(context, children, options) {
|
|
81
|
-
return printTree(renderTree(
|
|
82
|
-
context,
|
|
83
|
-
children
|
|
84
|
-
})), options);
|
|
78
|
+
return printTree(renderTree(<Output$1 context={context}>{children}</Output$1>), options);
|
|
85
79
|
}
|
|
86
80
|
|
|
87
81
|
//#endregion
|
package/dist/render.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.mjs","names":["
|
|
1
|
+
{"version":3,"file":"render.mjs","names":["Output"],"sources":["../src/render.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Children,\n printTree,\n PrintTreeOptions,\n renderAsync,\n renderTree,\n traverseOutput\n} from \"@alloy-js/core\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { PluginContext } from \"powerlines\";\nimport { MetaItem, Output } from \"./core\";\n\n/**\n * A function to render children components within the [Alloy](https://alloy-framework.github.io) context, and write any saved content to the file system.\n *\n * @example\n * ```tsx\n * import { render } from \"@powerlines/plugin-alloy/render\";\n *\n * await render(context, <> ... </>);\n * ```\n *\n * @param context - The Powerlines plugin context.\n * @param children - The children components to render.\n * @returns A promise that resolves when rendering is complete.\n */\nexport async function render<TContext extends PluginContext>(\n context: TContext,\n children: Children\n) {\n const meta = {} as Record<string, MetaItem>;\n const output = await renderAsync(\n <Output<TContext> context={context} meta={meta}>\n {children}\n </Output>\n );\n\n if (!Object.keys(output).length) {\n context.debug(\n \"No output files were rendered by Alloy-js component templates.\"\n );\n } else {\n context.debug(\n `Processing ${\n Object.keys(output).length\n } rendered output files from Alloy-js component templates.`\n );\n\n await traverseOutput(output, {\n visitDirectory: directory => {\n if (context.fs.existsSync(directory.path)) {\n return;\n }\n\n context.fs.mkdirSync(directory.path);\n },\n visitFile: file => {\n if (\"contents\" in file) {\n const metadata = meta[file.path] ?? {};\n if (metadata.kind === \"builtin\") {\n if (!metadata.id) {\n throw new Error(\n `Built-in file \"${\n file.path\n }\" is missing its ID in the render metadata.`\n );\n }\n\n context.emitBuiltinSync(file.contents, metadata.id, {\n skipFormat: metadata.skipFormat,\n storage: metadata.storage,\n extension: findFileExtension(file.path)\n });\n } else if (metadata.kind === \"entry\") {\n context.emitEntrySync(file.contents, file.path, {\n skipFormat: metadata.skipFormat,\n storage: metadata.storage,\n ...(metadata.typeDefinition ?? {})\n });\n } else if (metadata.kind === \"infrastructure\") {\n if (!metadata.id) {\n throw new Error(\n `Infrastructure file \"${\n file.path\n }\" is missing its ID in the render metadata.`\n );\n }\n\n context.emitInfrastructureSync(file.contents, metadata.id, {\n skipFormat: metadata.skipFormat,\n storage: metadata.storage,\n extension: findFileExtension(file.path)\n });\n } else {\n context.emitSync(file.contents, file.path, metadata);\n }\n } else {\n context.fs.copySync(file.sourcePath, file.path);\n }\n }\n });\n }\n}\n\n/**\n * A function to render children components within the [Alloy](https://alloy-framework.github.io) context and return the rendered output as a string.\n *\n * @example\n * ```tsx\n * import { renderString } from \"@powerlines/plugin-alloy/render\";\n *\n * const output = await renderString(context, <> ... </>);\n * ```\n *\n * @param context - The Powerlines plugin context.\n * @param children - The children components to render.\n * @param options - Optional print tree options.\n * @returns The rendered output as a string.\n */\nexport function renderString<TContext extends PluginContext>(\n context: TContext,\n children: Children,\n options?: PrintTreeOptions\n) {\n const tree = renderTree(\n <Output<TContext> context={context}>{children}</Output>\n );\n\n return printTree(tree, options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4CA,eAAsB,OACpB,SACA,UACA;CACA,MAAM,OAAO,EAAE;CACf,MAAM,SAAS,MAAM,YACnB,CAACA,SAAiB,SAAS,SAAS,MAAM,MAAM;OAC7C,SAAS;IACZ,EAAEA,UACH;AAED,KAAI,CAAC,OAAO,KAAK,OAAO,CAAC,OACvB,SAAQ,MACN,iEACD;MACI;AACL,UAAQ,MACN,cACE,OAAO,KAAK,OAAO,CAAC,OACrB,2DACF;AAED,QAAM,eAAe,QAAQ;GAC3B,iBAAgB,cAAa;AAC3B,QAAI,QAAQ,GAAG,WAAW,UAAU,KAAK,CACvC;AAGF,YAAQ,GAAG,UAAU,UAAU,KAAK;;GAEtC,YAAW,SAAQ;AACjB,QAAI,cAAc,MAAM;KACtB,MAAM,WAAW,KAAK,KAAK,SAAS,EAAE;AACtC,SAAI,SAAS,SAAS,WAAW;AAC/B,UAAI,CAAC,SAAS,GACZ,OAAM,IAAI,MACR,kBACE,KAAK,KACN,6CACF;AAGH,cAAQ,gBAAgB,KAAK,UAAU,SAAS,IAAI;OAClD,YAAY,SAAS;OACrB,SAAS,SAAS;OAClB,WAAW,kBAAkB,KAAK,KAAK;OACxC,CAAC;gBACO,SAAS,SAAS,QAC3B,SAAQ,cAAc,KAAK,UAAU,KAAK,MAAM;MAC9C,YAAY,SAAS;MACrB,SAAS,SAAS;MAClB,GAAI,SAAS,kBAAkB,EAAE;MAClC,CAAC;cACO,SAAS,SAAS,kBAAkB;AAC7C,UAAI,CAAC,SAAS,GACZ,OAAM,IAAI,MACR,wBACE,KAAK,KACN,6CACF;AAGH,cAAQ,uBAAuB,KAAK,UAAU,SAAS,IAAI;OACzD,YAAY,SAAS;OACrB,SAAS,SAAS;OAClB,WAAW,kBAAkB,KAAK,KAAK;OACxC,CAAC;WAEF,SAAQ,SAAS,KAAK,UAAU,KAAK,MAAM,SAAS;UAGtD,SAAQ,GAAG,SAAS,KAAK,YAAY,KAAK,KAAK;;GAGpD,CAAC;;;;;;;;;;;;;;;;;;AAmBN,SAAgB,aACd,SACA,UACA,SACA;AAKA,QAAO,UAJM,WACX,CAACA,SAAiB,SAAS,UAAU,SAAS,EAAEA,UACjD,EAEsB,QAAQ"}
|
|
@@ -3,7 +3,6 @@ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
|
3
3
|
const require_core_contexts_context = require('../../core/contexts/context.cjs');
|
|
4
4
|
const require_typescript_components_tsdoc = require('./tsdoc.cjs');
|
|
5
5
|
const require_typescript_components_typescript_file = require('./typescript-file.cjs');
|
|
6
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
7
6
|
let _alloy_js_core = require("@alloy-js/core");
|
|
8
7
|
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
9
8
|
let _stryke_path_replace = require("@stryke/path/replace");
|
|
@@ -27,36 +26,15 @@ function BuiltinFile(props) {
|
|
|
27
26
|
]);
|
|
28
27
|
const context = require_core_contexts_context.usePowerlinesSafe();
|
|
29
28
|
const path = (0, _alloy_js_core.computed)(() => (0, _stryke_path_replace.replacePath)(`${!(0, _stryke_type_checks_is_set.isSet)(tsx) ? id : (0, _stryke_path_replace.replaceExtension)(id)}${(0, _stryke_path_file_path_fns.hasFileExtension)(id) && !(0, _stryke_type_checks_is_set.isSet)(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context?.builtinsPath));
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
get children() {
|
|
40
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFileHeaderImports, {
|
|
41
|
-
imports,
|
|
42
|
-
builtinImports
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
get meta() {
|
|
48
|
-
return {
|
|
49
|
-
kind: "builtin",
|
|
50
|
-
extension: tsx ? "tsx" : "ts",
|
|
51
|
-
id: (0, _stryke_path_replace.replaceExtension)(id)
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}, rest, {
|
|
55
|
-
get path() {
|
|
56
|
-
return path.value;
|
|
57
|
-
},
|
|
58
|
-
children
|
|
59
|
-
}));
|
|
29
|
+
return <require_typescript_components_typescript_file.TypescriptFile header={<require_typescript_components_typescript_file.TypescriptFileHeader header={<require_typescript_components_tsdoc.TSDocModule name={id}>{description}</require_typescript_components_tsdoc.TSDocModule>}>
|
|
30
|
+
<require_typescript_components_typescript_file.TypescriptFileHeaderImports imports={imports} builtinImports={builtinImports} />
|
|
31
|
+
</require_typescript_components_typescript_file.TypescriptFileHeader>} meta={{
|
|
32
|
+
kind: "builtin",
|
|
33
|
+
extension: tsx ? "tsx" : "ts",
|
|
34
|
+
id: (0, _stryke_path_replace.replaceExtension)(id)
|
|
35
|
+
}} {...rest} path={path.value}>
|
|
36
|
+
{children}
|
|
37
|
+
</require_typescript_components_typescript_file.TypescriptFile>;
|
|
60
38
|
}
|
|
61
39
|
|
|
62
40
|
//#endregion
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
|
|
2
2
|
import { TSDocModule } from "./tsdoc.mjs";
|
|
3
3
|
import { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports } from "./typescript-file.mjs";
|
|
4
|
-
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
4
|
import { computed, splitProps } from "@alloy-js/core";
|
|
6
5
|
import { hasFileExtension } from "@stryke/path/file-path-fns";
|
|
7
6
|
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
@@ -25,36 +24,15 @@ function BuiltinFile(props) {
|
|
|
25
24
|
]);
|
|
26
25
|
const context = usePowerlinesSafe();
|
|
27
26
|
const path = computed(() => replacePath(`${!isSet(tsx) ? id : replaceExtension(id)}${hasFileExtension(id) && !isSet(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context?.builtinsPath));
|
|
28
|
-
return
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
get children() {
|
|
38
|
-
return createComponent(TypescriptFileHeaderImports, {
|
|
39
|
-
imports,
|
|
40
|
-
builtinImports
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
get meta() {
|
|
46
|
-
return {
|
|
47
|
-
kind: "builtin",
|
|
48
|
-
extension: tsx ? "tsx" : "ts",
|
|
49
|
-
id: replaceExtension(id)
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}, rest, {
|
|
53
|
-
get path() {
|
|
54
|
-
return path.value;
|
|
55
|
-
},
|
|
56
|
-
children
|
|
57
|
-
}));
|
|
27
|
+
return <TypescriptFile header={<TypescriptFileHeader header={<TSDocModule name={id}>{description}</TSDocModule>}>
|
|
28
|
+
<TypescriptFileHeaderImports imports={imports} builtinImports={builtinImports} />
|
|
29
|
+
</TypescriptFileHeader>} meta={{
|
|
30
|
+
kind: "builtin",
|
|
31
|
+
extension: tsx ? "tsx" : "ts",
|
|
32
|
+
id: replaceExtension(id)
|
|
33
|
+
}} {...rest} path={path.value}>
|
|
34
|
+
{children}
|
|
35
|
+
</TypescriptFile>;
|
|
58
36
|
}
|
|
59
37
|
|
|
60
38
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-file.mjs","names":[
|
|
1
|
+
{"version":3,"file":"builtin-file.mjs","names":[],"sources":["../../../src/typescript/components/builtin-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, splitProps } from \"@alloy-js/core\";\nimport { hasFileExtension } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport type { TSDocModuleProps } from \"./tsdoc\";\nimport { TSDocModule } from \"./tsdoc\";\nimport {\n TypescriptFile,\n TypescriptFileHeader,\n TypescriptFileHeaderImports,\n TypescriptFileProps\n} from \"./typescript-file\";\n\nexport type BuiltinFileProps = Omit<TypescriptFileProps, \"path\"> &\n Omit<TSDocModuleProps, \"name\"> & {\n /**\n * The runtime module identifier.\n *\n * @remarks\n * This value will be included after the \\`storm:\\` prefix in the import statement.\n */\n id: string;\n\n /**\n * The description for the builtin module.\n */\n description?: string;\n\n /**\n * Whether the file is a TSX file.\n *\n * @defaultValue false\n */\n tsx?: boolean;\n };\n\n/**\n * A base component representing a Powerlines generated Typescript source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function BuiltinFile(props: BuiltinFileProps) {\n const [{ children, imports, builtinImports, id, description, tsx }, rest] =\n splitProps(props, [\n \"children\",\n \"imports\",\n \"builtinImports\",\n \"id\",\n \"description\",\n \"tsx\"\n ]);\n\n const context = usePowerlinesSafe();\n const path = computed(() =>\n replacePath(\n `${!isSet(tsx) ? id : replaceExtension(id)}${\n hasFileExtension(id) && !isSet(tsx) ? \"\" : tsx ? \".tsx\" : \".ts\"\n }`,\n context?.builtinsPath\n )\n );\n\n return (\n <TypescriptFile\n header={\n <TypescriptFileHeader\n header={<TSDocModule name={id}>{description}</TSDocModule>}>\n <TypescriptFileHeaderImports\n imports={imports}\n builtinImports={builtinImports}\n />\n </TypescriptFileHeader>\n }\n meta={{\n kind: \"builtin\",\n extension: tsx ? \"tsx\" : \"ts\",\n id: replaceExtension(id)\n }}\n {...rest}\n path={path.value}>\n {children}\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6DA,SAAgB,YAAY,OAAyB;CACnD,MAAM,CAAC,EAAE,UAAU,SAAS,gBAAgB,IAAI,aAAa,OAAO,QAClE,WAAW,OAAO;EAChB;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAEJ,MAAM,UAAU,mBAAmB;CACnC,MAAM,OAAO,eACX,YACE,GAAG,CAAC,MAAM,IAAI,GAAG,KAAK,iBAAiB,GAAG,GACxC,iBAAiB,GAAG,IAAI,CAAC,MAAM,IAAI,GAAG,KAAK,MAAM,SAAS,SAE5D,SAAS,aACV,CACF;AAED,QACE,CAAC,eACC,QACE,CAAC,qBACC,QAAQ,CAAC,YAAY,MAAM,KAAK,YAAY,EAAE,cAAc;UAC5D,CAAC,4BACC,SAAS,SACT,gBAAgB,kBAChB;QACJ,EAAE,uBAEJ,MAAM;EACJ,MAAM;EACN,WAAW,MAAM,QAAQ;EACzB,IAAI,iBAAiB,GAAG;EACzB,MACG,MACJ,MAAM,KAAK,OAAO;OACjB,SAAS;IACZ,EAAE"}
|