@powerlines/plugin-alloy 0.26.19 → 0.26.21

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.
Files changed (95) hide show
  1. package/dist/core/components/infrastructure-file.cjs +9 -14
  2. package/dist/core/components/infrastructure-file.mjs +9 -14
  3. package/dist/core/components/infrastructure-file.mjs.map +1 -1
  4. package/dist/core/components/output.cjs +10 -17
  5. package/dist/core/components/output.mjs +10 -17
  6. package/dist/core/components/output.mjs.map +1 -1
  7. package/dist/core/components/single-line-comment.cjs +4 -6
  8. package/dist/core/components/single-line-comment.mjs +4 -6
  9. package/dist/core/components/single-line-comment.mjs.map +1 -1
  10. package/dist/core/components/source-file.cjs +6 -10
  11. package/dist/core/components/source-file.mjs +6 -10
  12. package/dist/core/components/source-file.mjs.map +1 -1
  13. package/dist/core/components/spacing.cjs +4 -6
  14. package/dist/core/components/spacing.mjs +4 -6
  15. package/dist/core/components/spacing.mjs.map +1 -1
  16. package/dist/hcl/components/block-declaration.cjs +8 -12
  17. package/dist/hcl/components/block-declaration.mjs +8 -12
  18. package/dist/hcl/components/block-declaration.mjs.map +1 -1
  19. package/dist/hcl/components/hcl-file.cjs +21 -35
  20. package/dist/hcl/components/hcl-file.mjs +22 -36
  21. package/dist/hcl/components/hcl-file.mjs.map +1 -1
  22. package/dist/hcl/components/packer-file.cjs +8 -8
  23. package/dist/hcl/components/packer-file.mjs +8 -8
  24. package/dist/hcl/components/packer-file.mjs.map +1 -1
  25. package/dist/hcl/components/terraform-file.cjs +8 -8
  26. package/dist/hcl/components/terraform-file.mjs +8 -8
  27. package/dist/hcl/components/terraform-file.mjs.map +1 -1
  28. package/dist/helpers/capnp.cjs +1 -1
  29. package/dist/helpers/capnp.mjs +1 -1
  30. package/dist/helpers/capnp.mjs.map +1 -1
  31. package/dist/index.cjs +7 -12
  32. package/dist/index.d.cts.map +1 -1
  33. package/dist/index.d.mts.map +1 -1
  34. package/dist/index.mjs +7 -11
  35. package/dist/index.mjs.map +1 -1
  36. package/dist/markdown/components/front-matter.cjs +7 -9
  37. package/dist/markdown/components/front-matter.mjs +7 -9
  38. package/dist/markdown/components/front-matter.mjs.map +1 -1
  39. package/dist/markdown/components/markdown-file.cjs +44 -76
  40. package/dist/markdown/components/markdown-file.mjs +44 -76
  41. package/dist/markdown/components/markdown-file.mjs.map +1 -1
  42. package/dist/markdown/components/markdown-table.cjs +28 -49
  43. package/dist/markdown/components/markdown-table.mjs +28 -49
  44. package/dist/markdown/components/markdown-table.mjs.map +1 -1
  45. package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
  46. package/dist/render.cjs +3 -3
  47. package/dist/render.mjs +4 -4
  48. package/dist/render.mjs.map +1 -1
  49. package/dist/typescript/components/builtin-file.cjs +20 -30
  50. package/dist/typescript/components/builtin-file.mjs +20 -30
  51. package/dist/typescript/components/builtin-file.mjs.map +1 -1
  52. package/dist/typescript/components/class-declaration.cjs +100 -165
  53. package/dist/typescript/components/class-declaration.mjs +100 -165
  54. package/dist/typescript/components/class-declaration.mjs.map +1 -1
  55. package/dist/typescript/components/dynamic-import-statement.cjs +6 -2
  56. package/dist/typescript/components/dynamic-import-statement.mjs +6 -2
  57. package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
  58. package/dist/typescript/components/entry-file.cjs +8 -11
  59. package/dist/typescript/components/entry-file.mjs +8 -11
  60. package/dist/typescript/components/entry-file.mjs.map +1 -1
  61. package/dist/typescript/components/interface-declaration.cjs +74 -127
  62. package/dist/typescript/components/interface-declaration.mjs +74 -127
  63. package/dist/typescript/components/interface-declaration.mjs.map +1 -1
  64. package/dist/typescript/components/object-declaration.cjs +50 -84
  65. package/dist/typescript/components/object-declaration.mjs +50 -84
  66. package/dist/typescript/components/object-declaration.mjs.map +1 -1
  67. package/dist/typescript/components/property-name.cjs +3 -3
  68. package/dist/typescript/components/property-name.mjs +3 -3
  69. package/dist/typescript/components/property-name.mjs.map +1 -1
  70. package/dist/typescript/components/record-expression.mjs.map +1 -1
  71. package/dist/typescript/components/tsdoc-reflection.cjs +108 -241
  72. package/dist/typescript/components/tsdoc-reflection.mjs +108 -241
  73. package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
  74. package/dist/typescript/components/tsdoc.cjs +168 -265
  75. package/dist/typescript/components/tsdoc.mjs +168 -265
  76. package/dist/typescript/components/tsdoc.mjs.map +1 -1
  77. package/dist/typescript/components/type-declaration.cjs +15 -20
  78. package/dist/typescript/components/type-declaration.mjs +15 -20
  79. package/dist/typescript/components/type-declaration.mjs.map +1 -1
  80. package/dist/typescript/components/type-parameters.cjs +29 -55
  81. package/dist/typescript/components/type-parameters.mjs +29 -55
  82. package/dist/typescript/components/type-parameters.mjs.map +1 -1
  83. package/dist/typescript/components/typescript-file.cjs +74 -135
  84. package/dist/typescript/components/typescript-file.mjs +74 -135
  85. package/dist/typescript/components/typescript-file.mjs.map +1 -1
  86. package/dist/typescript/contexts/lexical-scope.cjs +3 -5
  87. package/dist/typescript/contexts/lexical-scope.mjs +3 -5
  88. package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
  89. package/dist/typescript/contexts/member-scope.cjs +3 -5
  90. package/dist/typescript/contexts/member-scope.mjs +3 -5
  91. package/dist/typescript/contexts/member-scope.mjs.map +1 -1
  92. package/dist/yaml/components/yaml-file.cjs +47 -92
  93. package/dist/yaml/components/yaml-file.mjs +47 -92
  94. package/dist/yaml/components/yaml-file.mjs.map +1 -1
  95. package/package.json +6 -6
@@ -1,9 +1,9 @@
1
1
  import { usePowerlines } from "../../core/contexts/context.mjs";
2
2
  import { InfrastructureFile } from "../../core/components/infrastructure-file.mjs";
3
3
  import { SingleLineComment } from "../../core/components/single-line-comment.mjs";
4
- import { findFileExtension } from "@stryke/path/file-path-fns";
5
- import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
6
4
  import { Show, computed, splitProps } from "@alloy-js/core";
5
+ import { findFileExtension } from "@stryke/path/file-path-fns";
6
+ import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
7
7
  import { titleCase } from "@stryke/string-format/title-case";
8
8
  import { getFileHeaderWarning } from "powerlines/utils";
9
9
 
@@ -23,23 +23,17 @@ function HCLFile(props) {
23
23
  "id"
24
24
  ]);
25
25
  const filetype = computed(() => _filetype || findFileExtension(id) || "hcl");
26
- return createComponent(InfrastructureFile, mergeProps({ get header() {
27
- return createComponent(HCLFileHeader, { children: header });
28
- } }, rest, {
26
+ return /* @__PURE__ */ jsx(InfrastructureFile, {
27
+ header: /* @__PURE__ */ jsx(HCLFileHeader, { children: header }),
28
+ ...rest,
29
29
  id,
30
- get filetype() {
31
- return filetype.value;
32
- },
30
+ filetype: filetype.value,
33
31
  storage: storage || "fs",
34
- get children() {
35
- return createComponent(Show, {
36
- get when() {
37
- return Boolean(children);
38
- },
39
- children
40
- });
41
- }
42
- }));
32
+ children: /* @__PURE__ */ jsx(Show, {
33
+ when: Boolean(children),
34
+ children
35
+ })
36
+ });
43
37
  }
44
38
  /**
45
39
  * Renders the header for a Powerlines HCL source file.
@@ -50,30 +44,22 @@ function HCLFile(props) {
50
44
  function HCLFileHeader(props) {
51
45
  const [{ children }] = splitProps(props, ["children"]);
52
46
  const context = usePowerlines();
53
- return [
54
- createComponent(Show, {
55
- get when() {
56
- return Boolean(children);
57
- },
58
- get children() {
59
- return [children, createIntrinsic("hbr", {})];
60
- }
47
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
48
+ /* @__PURE__ */ jsx(Show, {
49
+ when: Boolean(children),
50
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [children, /* @__PURE__ */ jsx("hbr", {})] })
61
51
  }),
62
- createComponent(SingleLineComment, {
52
+ /* @__PURE__ */ jsx(SingleLineComment, {
63
53
  variant: "hcl",
64
- get children() {
65
- return `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}`;
66
- }
54
+ children: `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}`
67
55
  }),
68
- createIntrinsic("hbr", {}),
69
- createComponent(SingleLineComment, {
56
+ /* @__PURE__ */ jsx("hbr", {}),
57
+ /* @__PURE__ */ jsx(SingleLineComment, {
70
58
  variant: "hcl",
71
- get children() {
72
- return getFileHeaderWarning(context);
73
- }
59
+ children: getFileHeaderWarning(context)
74
60
  }),
75
- createIntrinsic("hbr", {})
76
- ];
61
+ /* @__PURE__ */ jsx("hbr", {})
62
+ ] });
77
63
  }
78
64
 
79
65
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"hcl-file.mjs","names":[],"sources":["../../../src/hcl/components/hcl-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 { Children, computed, Show, splitProps } from \"@alloy-js/core\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { getFileHeaderWarning } from \"powerlines/utils\";\nimport {\n InfrastructureFile,\n InfrastructureFileProps\n} from \"../../core/components/infrastructure-file\";\nimport { SingleLineComment } from \"../../core/components/single-line-comment\";\nimport { usePowerlines } from \"../../core/contexts/context\";\nimport { ComponentProps } from \"../../types/components\";\n\nexport type HCLFileProps = Omit<\n InfrastructureFileProps,\n \"header\" | \"filetype\"\n> &\n ComponentProps & {\n header?: Children;\n filetype?: \"hcl\" | \"tf\" | `${string}.hcl` | `${string}.tf`;\n };\n\n/**\n * A base component representing a Powerlines generated HCL source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function HCLFile(props: HCLFileProps) {\n const [{ children, storage, header, filetype: _filetype, id }, rest] =\n splitProps(props, [\"children\", \"storage\", \"header\", \"filetype\", \"id\"]);\n\n const filetype = computed(() => _filetype || findFileExtension(id) || \"hcl\");\n\n return (\n <InfrastructureFile\n header={<HCLFileHeader>{header}</HCLFileHeader>}\n {...rest}\n id={id}\n filetype={filetype.value}\n storage={storage || \"fs\"}>\n <Show when={Boolean(children)}>{children}</Show>\n </InfrastructureFile>\n );\n}\n\n/**\n * Renders the header for a Powerlines HCL source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function HCLFileHeader(props: ComponentProps) {\n const [{ children }] = splitProps(props, [\"children\"]);\n\n const context = usePowerlines();\n\n return (\n <>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n <SingleLineComment variant=\"hcl\">{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment variant=\"hcl\">\n {getFileHeaderWarning(context)}\n </SingleLineComment>\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;CAuCE,MAAA,CAAA,EACE,UACH,SACG,QACA,UAAQ,WACV,MACF,QAAO,WAAiB,OAAO;EAAA;EAAa;EAAC;EAAA;EAAA;EAAA,CAAA;CAC3C,MAAM,WAAW,eAAW,aAAiB,kBAAkB,GAAA,IAAM,MAAA;AACrE,QAAE,gBAAoB,oBAAuB,WAAU;AAEvD,SAAM,gBAAuB,eAAe,oBAE5C,CAAM;IAEL,EAAE,MAAC;EACE;EACJ,IAAI,WAAI;AACN,UAAA,SAAU;;EAEZ,SAAQ,WAAM;EACd,IAAE,WAAA;AACH,UAAA,gBAAA,MAAA;IACH,IAAA,OAAA;;;IAGe;IACd,CAAA;;EAEE,CAAC,CAAA;;;;;;;;AASJ,SAAgB,cAAU,OAAU;CAClC,MAAM,CAAC,EACL,cACG,WAAS,OAAA,CAAA,WAAA,CAAA;CACd,MAAM,UAAE,eAAA;AACR,QAAM;EAAA,gBAAI,MAAA;GACR,IAAG,OAAA;AACD,WAAE,QAAU,SAAS;;GAEvB,IAAG,WAAK;AACN,WAAC,CAAA,UAAiB,gBAAc,OAAA,EAAA,CAAA,CAAA;;GAEnC,CAAC;EAAE,gBAAE,mBAAiB;GACrB,SAAQ;GACR,IAAE,WAAA;AACH,WAAA,gBAAA,UAAA,SAAA,QAAA,UAAA,IAAA"}
1
+ {"version":3,"file":"hcl-file.mjs","names":[],"sources":["../../../src/hcl/components/hcl-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 { Children, computed, Show, splitProps } from \"@alloy-js/core\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { getFileHeaderWarning } from \"powerlines/utils\";\nimport {\n InfrastructureFile,\n InfrastructureFileProps\n} from \"../../core/components/infrastructure-file\";\nimport { SingleLineComment } from \"../../core/components/single-line-comment\";\nimport { usePowerlines } from \"../../core/contexts/context\";\nimport { ComponentProps } from \"../../types/components\";\n\nexport type HCLFileProps = Omit<\n InfrastructureFileProps,\n \"header\" | \"filetype\"\n> &\n ComponentProps & {\n header?: Children;\n filetype?: \"hcl\" | \"tf\" | `${string}.hcl` | `${string}.tf`;\n };\n\n/**\n * A base component representing a Powerlines generated HCL source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function HCLFile(props: HCLFileProps) {\n const [{ children, storage, header, filetype: _filetype, id }, rest] =\n splitProps(props, [\"children\", \"storage\", \"header\", \"filetype\", \"id\"]);\n\n const filetype = computed(() => _filetype || findFileExtension(id) || \"hcl\");\n\n return (\n <InfrastructureFile\n header={<HCLFileHeader>{header}</HCLFileHeader>}\n {...rest}\n id={id}\n filetype={filetype.value}\n storage={storage || \"fs\"}>\n <Show when={Boolean(children)}>{children}</Show>\n </InfrastructureFile>\n );\n}\n\n/**\n * Renders the header for a Powerlines HCL source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function HCLFileHeader(props: ComponentProps) {\n const [{ children }] = splitProps(props, [\"children\"]);\n\n const context = usePowerlines();\n\n return (\n <>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n <SingleLineComment variant=\"hcl\">{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment variant=\"hcl\">\n {getFileHeaderWarning(context)}\n </SingleLineComment>\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA6CA,SAAgB,QAAQ,OAAqB;CAC3C,MAAM,CAAC,EAAE,UAAU,SAAS,QAAQ,UAAU,WAAW,MAAM,QAC7D,WAAW,OAAO;EAAC;EAAY;EAAW;EAAU;EAAY;EAAK,CAAC;CAExE,MAAM,WAAW,eAAe,aAAa,kBAAkB,GAAG,IAAI,MAAM;AAE5E,QACE,oBAAC,oBAAD;EACE,QAAQ,oBAAC,eAAD,YAAgB,QAAuB;EAC/C,GAAI;EACA;EACJ,UAAU,SAAS;EACnB,SAAS,WAAW;YACpB,oBAAC,MAAD;GAAM,MAAM,QAAQ,SAAS;GAAG;GAAgB;EAC7B;;;;;;;;AAUzB,SAAgB,cAAc,OAAuB;CACnD,MAAM,CAAC,EAAE,cAAc,WAAW,OAAO,CAAC,WAAW,CAAC;CAEtD,MAAM,UAAU,eAAe;AAE/B,QACE;EACE,oBAAC,MAAD;GAAM,MAAM,QAAQ,SAAS;aAC3B,4CACG,UACD,oBAAC,OAAD,EAAO,EACN;GACE;EACP,oBAAC,mBAAD;GAAmB,SAAQ;aAAO,gBAChC,UAAU,SAAS,QAAQ,UAAU,IAAI;GACpB;EACvB,oBAAC,OAAD,EAAO;EACP,oBAAC,mBAAD;GAAmB,SAAQ;aACxB,qBAAqB,QAAQ;GACZ;EACpB,oBAAC,OAAD,EAAO;EACN"}
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  const require_hcl_components_hcl_file = require('./hcl-file.cjs');
4
- let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
4
  let _alloy_js_core = require("@alloy-js/core");
5
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
6
 
7
7
  //#region src/hcl/components/packer-file.tsx
8
8
  /**
@@ -15,14 +15,14 @@ let _alloy_js_core = require("@alloy-js/core");
15
15
  */
16
16
  function PackerFile(props) {
17
17
  const [{ children }, rest] = (0, _alloy_js_core.splitProps)(props, ["children"]);
18
- return (0, _alloy_js_core_jsx_runtime.createComponent)(require_hcl_components_hcl_file.HCLFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({ filetype: "pkr.hcl" }, rest, { get children() {
19
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
20
- get when() {
21
- return Boolean(children);
22
- },
18
+ return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_hcl_components_hcl_file.HCLFile, {
19
+ filetype: "pkr.hcl",
20
+ ...rest,
21
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
22
+ when: Boolean(children),
23
23
  children
24
- });
25
- } }));
24
+ })
25
+ });
26
26
  }
27
27
 
28
28
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { HCLFile } from "./hcl-file.mjs";
2
- import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
3
2
  import { Show, splitProps } from "@alloy-js/core";
3
+ import { jsx } from "@alloy-js/core/jsx-runtime";
4
4
 
5
5
  //#region src/hcl/components/packer-file.tsx
6
6
  /**
@@ -13,14 +13,14 @@ import { Show, splitProps } from "@alloy-js/core";
13
13
  */
14
14
  function PackerFile(props) {
15
15
  const [{ children }, rest] = splitProps(props, ["children"]);
16
- return createComponent(HCLFile, mergeProps({ filetype: "pkr.hcl" }, rest, { get children() {
17
- return createComponent(Show, {
18
- get when() {
19
- return Boolean(children);
20
- },
16
+ return /* @__PURE__ */ jsx(HCLFile, {
17
+ filetype: "pkr.hcl",
18
+ ...rest,
19
+ children: /* @__PURE__ */ jsx(Show, {
20
+ when: Boolean(children),
21
21
  children
22
- });
23
- } }));
22
+ })
23
+ });
24
24
  }
25
25
 
26
26
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"packer-file.mjs","names":[],"sources":["../../../src/hcl/components/packer-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 { Show, splitProps } from \"@alloy-js/core\";\nimport { PartialKeys } from \"@stryke/types/base\";\nimport { HCLFile, HCLFileProps } from \"./hcl-file\";\n\nexport type PackerFileProps = PartialKeys<HCLFileProps, \"filetype\">;\n\n/**\n * A base component representing a Powerlines generated [Packer](https://developer.hashicorp.com/packer/docs/templates/hcl_templates) source file.\n *\n * @see https://developer.hashicorp.com/packer\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function PackerFile(props: PackerFileProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <HCLFile filetype=\"pkr.hcl\" {...rest}>\n <Show when={Boolean(children)}>{children}</Show>\n </HCLFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,SAAgB,WAAW,OAAwB;CACjD,MAAM,CAAC,cAEP,QAAO,WAAA,OAAA,CAAA,WAAA,CAAA;AACP,QAAG,gBAAsB,SAAS,WAAK,EACrC,UAAQ,WACT,EAAE,MAAC,EACH,IAAA,WAAA;AACH,SAAA,gBAAA,MAAA"}
1
+ {"version":3,"file":"packer-file.mjs","names":[],"sources":["../../../src/hcl/components/packer-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 { Show, splitProps } from \"@alloy-js/core\";\nimport { PartialKeys } from \"@stryke/types/base\";\nimport { HCLFile, HCLFileProps } from \"./hcl-file\";\n\nexport type PackerFileProps = PartialKeys<HCLFileProps, \"filetype\">;\n\n/**\n * A base component representing a Powerlines generated [Packer](https://developer.hashicorp.com/packer/docs/templates/hcl_templates) source file.\n *\n * @see https://developer.hashicorp.com/packer\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function PackerFile(props: PackerFileProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <HCLFile filetype=\"pkr.hcl\" {...rest}>\n <Show when={Boolean(children)}>{children}</Show>\n </HCLFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,SAAgB,WAAW,OAAwB;CACjD,MAAM,CAAC,EAAE,YAAY,QAAQ,WAAW,OAAO,CAAC,WAAW,CAAC;AAE5D,QACE,oBAAC,SAAD;EAAS,UAAS;EAAU,GAAI;YAC9B,oBAAC,MAAD;GAAM,MAAM,QAAQ,SAAS;GAAG;GAAgB;EACxC"}
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  const require_hcl_components_hcl_file = require('./hcl-file.cjs');
4
- let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
4
  let _alloy_js_core = require("@alloy-js/core");
5
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
6
 
7
7
  //#region src/hcl/components/terraform-file.tsx
8
8
  /**
@@ -16,14 +16,14 @@ let _alloy_js_core = require("@alloy-js/core");
16
16
  */
17
17
  function TerraformFile(props) {
18
18
  const [{ children }, rest] = (0, _alloy_js_core.splitProps)(props, ["children"]);
19
- return (0, _alloy_js_core_jsx_runtime.createComponent)(require_hcl_components_hcl_file.HCLFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({ filetype: "tf" }, rest, { get children() {
20
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
21
- get when() {
22
- return Boolean(children);
23
- },
19
+ return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_hcl_components_hcl_file.HCLFile, {
20
+ filetype: "tf",
21
+ ...rest,
22
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
23
+ when: Boolean(children),
24
24
  children
25
- });
26
- } }));
25
+ })
26
+ });
27
27
  }
28
28
 
29
29
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { HCLFile } from "./hcl-file.mjs";
2
- import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
3
2
  import { Show, splitProps } from "@alloy-js/core";
3
+ import { jsx } from "@alloy-js/core/jsx-runtime";
4
4
 
5
5
  //#region src/hcl/components/terraform-file.tsx
6
6
  /**
@@ -14,14 +14,14 @@ import { Show, splitProps } from "@alloy-js/core";
14
14
  */
15
15
  function TerraformFile(props) {
16
16
  const [{ children }, rest] = splitProps(props, ["children"]);
17
- return createComponent(HCLFile, mergeProps({ filetype: "tf" }, rest, { get children() {
18
- return createComponent(Show, {
19
- get when() {
20
- return Boolean(children);
21
- },
17
+ return /* @__PURE__ */ jsx(HCLFile, {
18
+ filetype: "tf",
19
+ ...rest,
20
+ children: /* @__PURE__ */ jsx(Show, {
21
+ when: Boolean(children),
22
22
  children
23
- });
24
- } }));
23
+ })
24
+ });
25
25
  }
26
26
 
27
27
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"terraform-file.mjs","names":[],"sources":["../../../src/hcl/components/terraform-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 { Show, splitProps } from \"@alloy-js/core\";\nimport { PartialKeys } from \"@stryke/types/base\";\nimport { HCLFile, HCLFileProps } from \"./hcl-file\";\n\nexport type TerraformFileProps = PartialKeys<HCLFileProps, \"filetype\">;\n\n/**\n * A base component representing a Powerlines generated [Terraform](https://developer.hashicorp.com/terraform/language) or [OpenTofu](https://opentofu.org/docs/language/) source file.\n *\n * @see https://developer.hashicorp.com/terraform\n * @see https://opentofu.org\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function TerraformFile(props: TerraformFileProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <HCLFile filetype=\"tf\" {...rest}>\n <Show when={Boolean(children)}>{children}</Show>\n </HCLFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAiCA,SAAgB,cAAc,OAA2B;CACvD,MAAM,CAAC,cAEP,QAAO,WAAA,OAAA,CAAA,WAAA,CAAA;AACP,QAAG,gBAAsB,SAAS,WAAA,EAChC,UAAQ,MACT,EAAE,MAAC,EACH,IAAA,WAAA;AACH,SAAA,gBAAA,MAAA"}
1
+ {"version":3,"file":"terraform-file.mjs","names":[],"sources":["../../../src/hcl/components/terraform-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 { Show, splitProps } from \"@alloy-js/core\";\nimport { PartialKeys } from \"@stryke/types/base\";\nimport { HCLFile, HCLFileProps } from \"./hcl-file\";\n\nexport type TerraformFileProps = PartialKeys<HCLFileProps, \"filetype\">;\n\n/**\n * A base component representing a Powerlines generated [Terraform](https://developer.hashicorp.com/terraform/language) or [OpenTofu](https://opentofu.org/docs/language/) source file.\n *\n * @see https://developer.hashicorp.com/terraform\n * @see https://opentofu.org\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function TerraformFile(props: TerraformFileProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <HCLFile filetype=\"tf\" {...rest}>\n <Show when={Boolean(children)}>{children}</Show>\n </HCLFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAiCA,SAAgB,cAAc,OAA2B;CACvD,MAAM,CAAC,EAAE,YAAY,QAAQ,WAAW,OAAO,CAAC,WAAW,CAAC;AAE5D,QACE,oBAAC,SAAD;EAAS,UAAS;EAAK,GAAI;YACzB,oBAAC,MAAD;GAAM,MAAM,QAAQ,SAAS;GAAG;GAAgB;EACxC"}
@@ -41,7 +41,7 @@ async function compile(context, options = {}) {
41
41
  schemas: (0, _stryke_path_join.joinPaths)(context.artifactsPath, "schemas"),
42
42
  tsconfig: context.tsconfig,
43
43
  projectRoot: context.config.root,
44
- workspaceRoot: context.workspaceConfig.workspaceRoot,
44
+ workspaceRoot: context.config.cwd,
45
45
  tty: true
46
46
  });
47
47
  const resolvedOptions = await (0, _stryke_capnp_helpers.resolveOptions)(opts);
@@ -38,7 +38,7 @@ async function compile(context, options = {}) {
38
38
  schemas: joinPaths(context.artifactsPath, "schemas"),
39
39
  tsconfig: context.tsconfig,
40
40
  projectRoot: context.config.root,
41
- workspaceRoot: context.workspaceConfig.workspaceRoot,
41
+ workspaceRoot: context.config.cwd,
42
42
  tty: true
43
43
  });
44
44
  const resolvedOptions = await resolveOptions(opts);
@@ -1 +1 @@
1
- {"version":3,"file":"capnp.mjs","names":[],"sources":["../../src/helpers/capnp.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 { getUnionTypes, kindToName } from \"@powerlines/deepkit/utilities\";\nimport { getClassName } from \"@powerlines/deepkit/vendor/core\";\nimport {\n memberNameToString,\n ReflectionClass,\n ReflectionKind,\n ReflectionMethod,\n ReflectionParameter,\n ReflectionProperty,\n Type,\n TypeEnum,\n TypeLiteral,\n TypeUnion\n} from \"@powerlines/deepkit/vendor/type\";\nimport { capnpc } from \"@stryke/capnp/compile\";\nimport { resolveOptions } from \"@stryke/capnp/helpers\";\nimport type { CapnpcOptions, CapnpcResult } from \"@stryke/capnp/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { StormJSON } from \"@stryke/json\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { getWords } from \"@stryke/string-format/get-words\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isBigInt } from \"@stryke/type-checks/is-bigint\";\nimport { isNull } from \"@stryke/type-checks/is-null\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport defu from \"defu\";\nimport { Buffer } from \"node:buffer\";\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\nimport { Context, PluginContext } from \"powerlines\";\nimport { getFileHeader } from \"powerlines/utils\";\n\n/**\n * Compiles a Cap'n Proto schema into TypeScript definitions.\n *\n * @param context - The context containing the project and workspace information.\n * @param options - The options for compiling the schema.\n * @returns A promise that resolves to the compiled schema.\n */\nexport async function compile(\n context: Context,\n options: Partial<CapnpcOptions> = {}\n): Promise<CapnpcResult> {\n const opts = defu(options, {\n ts: true,\n js: false,\n dts: false,\n schemas: joinPaths(context.artifactsPath, \"schemas\"),\n tsconfig: context.tsconfig,\n projectRoot: context.config.root,\n workspaceRoot: context.workspaceConfig.workspaceRoot,\n tty: true\n }) as Parameters<typeof resolveOptions>[0];\n\n const resolvedOptions = await resolveOptions(opts);\n if (!resolvedOptions) {\n throw new Error(\n `✖ No Cap'n Proto schema files found in the specified source paths: ${toArray(\n opts.schemas\n ).join(\", \")}.`\n );\n }\n\n return capnpc(resolvedOptions);\n}\n\n/**\n * Converts any {@link ReflectionProperty} or {@link ReflectionParameter}'s value to string representation.\n *\n * @param property - The {@link ReflectionProperty} or {@link ReflectionParameter} containing the value to stringify.\n * @param value - The value to stringify.\n * @returns A string representation of the value.\n */\nexport function stringifyCapnpDefaultValue(\n property: ReflectionProperty | ReflectionParameter,\n value?: any\n): string {\n return stringifyCapnpValue(\n property.type,\n value ?? property.getDefaultValue()\n );\n}\n\n/**\n * Converts any {@link Type}'s actual value to string representation.\n *\n * @param type - The {@link Type} of the value to stringify.\n * @param value - The value to stringify.\n * @returns A string representation of the value.\n */\nexport function stringifyCapnpValue(type: Type, value: any): string {\n return type.kind === ReflectionKind.string ||\n (type.kind === ReflectionKind.literal && isString(type.literal))\n ? `\"${String(value)}\"`\n : type.kind === ReflectionKind.enum\n ? `${camelCase(String(value))}`\n : type.kind === ReflectionKind.array\n ? StormJSON.stringify(value)\n : type.kind === ReflectionKind.object ||\n type.kind === ReflectionKind.objectLiteral\n ? StormJSON.stringify(value).replaceAll(\"{\", \"(\").replaceAll(\"}\", \")\")\n : String(value);\n}\n\n/**\n * Converts a ReflectionProperty's default value to a Cap'n Proto schema string representation.\n *\n * @param type - The TypeEnum to evaluate.\n * @returns A string representation of the property.\n */\nexport function getCapnpEnumTypes(type: Type): \"Text\" | \"Float32\" | null {\n if (type.kind !== ReflectionKind.enum) {\n return null;\n }\n\n const unique = getUniqueBy(\n type.values.filter(value => !isUndefined(value) && !isNull(value)),\n enumMember => (isString(enumMember) ? \"Text\" : \"Float32\")\n );\n if (unique.length === 0) {\n return null;\n }\n\n return unique[0] && isString(unique[0]) ? \"Text\" : \"Float32\";\n}\n\n/**\n * Determines if a Type is a `Void` type in a Cap'n Proto schema.\n *\n * @param type - The Type to check.\n * @returns True if the Type is a `Void` type, false otherwise.\n */\nexport function isVoidType(type: Type): boolean {\n return (\n type.kind === ReflectionKind.void ||\n type.kind === ReflectionKind.never ||\n type.kind === ReflectionKind.null ||\n type.kind === ReflectionKind.undefined ||\n type.kind === ReflectionKind.symbol\n );\n}\n\n/**\n * Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.\n *\n * @param type - The {@link TypeUnion} to convert.\n * @returns A string representation of the Cap'n Proto primitive type.\n */\nexport function getCapnpUnionTypes(type: Type): Type[] {\n return getUnionTypes(type);\n}\n\n/**\n * Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.\n *\n * @param type - The {@link TypeUnion} to convert.\n * @returns An array of Cap'n Proto primitive types.\n */\nexport function isCapnpStringUnion(type: Type): boolean {\n return getCapnpUnionTypes(type).some(\n member => member.kind === ReflectionKind.string\n );\n}\n\nexport const LARGE_BUFFER = 1024 * 1000000;\nexport type IOType = \"overlapped\" | \"pipe\" | \"ignore\" | \"inherit\";\nexport type StdioOptions =\n | IOType\n | Array<IOType | \"ipc\" | number | null | undefined>;\n\nconst execAsync = promisify(exec);\n\nexport async function generateCapnpId() {\n const { stdout } = await execAsync(\"capnp id\", {\n windowsHide: true,\n maxBuffer: LARGE_BUFFER,\n killSignal: \"SIGTERM\"\n });\n\n return stdout;\n}\n\nexport interface GenerateCapnpOptions {\n name?: string;\n}\n\nexport async function generateCapnp(\n context: PluginContext,\n reflection: ReflectionClass<any>,\n options: GenerateCapnpOptions\n) {\n const capnpId = await generateCapnpId();\n\n return `${capnpId.trim()};\n${getFileHeader(context)\n .replace(/^\\r*\\n*/g, \"\")\n .replaceAll(\"//\", \"#\")}\n${\n reflection.getMethods().length === 0\n ? generateCapnpStruct(reflection, options)\n : generateCapnpInterface(reflection, options)\n}\n`.trim();\n}\n\nexport interface GenerateCapnpStructOptions extends GenerateCapnpOptions {\n indexCounter?: () => number;\n}\n\nexport function generateCapnpStruct(\n reflection: ReflectionClass<any>,\n options: GenerateCapnpStructOptions = {}\n): string {\n const structName =\n options?.name ||\n reflection.getTitle() ||\n reflection.getClassName() ||\n reflection.getName();\n\n return `${generateCapnpEnums(reflection)}struct ${pascalCase(structName)} {\n # Struct definition for ${titleCase(structName)}.\n\n ${generateCapnpSchema(reflection, options)}\n}\n`;\n}\n\nexport function generateCapnpInterface(\n reflection: ReflectionClass<any>,\n options: GenerateCapnpStructOptions = {}\n): string {\n const interfaceName =\n options?.name ||\n reflection.getTitle() ||\n reflection.getClassName() ||\n reflection.getName();\n\n return `${generateCapnpEnums(reflection)}interface ${pascalCase(interfaceName)} {\n # Interface definition for ${titleCase(interfaceName)}.\n\n ${generateCapnpSchema(reflection, options)}\n}\n`;\n}\n\nfunction formatEnumName(name: string) {\n return pascalCase(`${name}_Type`);\n}\n\nfunction generateCapnpEnums(reflection: ReflectionClass<any>): string {\n const enums = reflection\n .getProperties()\n .filter(\n prop =>\n !prop.isIgnored() &&\n (prop.type.kind === ReflectionKind.enum ||\n (prop.type.kind === ReflectionKind.union &&\n getCapnpUnionTypes(prop.type).filter(\n type =>\n type.kind === ReflectionKind.literal &&\n (isString(type.literal) || isNumber(type.literal))\n ).length === 1))\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? b.getNameAsString().localeCompare(a.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n );\n if (enums.length === 0) {\n return \"\";\n }\n\n return `${enums\n .map(enumeration =>\n generateCapnpEnumSchema(\n enumeration.type as TypeEnum | TypeUnion,\n formatEnumName(enumeration.getNameAsString())\n )\n )\n .join(\"\\n\\n\")}\n\n`;\n}\n\nexport function generateCapnpSchema(\n reflection: ReflectionClass<any>,\n options: GenerateCapnpStructOptions = {}\n): string {\n let index = 0;\n const indexCounter: () => number = options?.indexCounter ?? (() => index++);\n\n return `${reflection\n .getProperties()\n .filter(prop => !prop.isIgnored())\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? b.getNameAsString().localeCompare(a.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n .map(prop => generateCapnpPropertySchema(prop, indexCounter))\n .join(\" \\n\\n\\t\")}${reflection\n .getMethods()\n .filter(methods => !methods.isIgnored())\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? String(b.getName()).localeCompare(String(a.getName()))\n : a.isReadonly()\n ? 1\n : -1\n )\n .map(methods => generateCapnpMethodSchema(methods, indexCounter))\n .join(\" \\n\\n\\t\")}${\n reflection\n .getProperties()\n .some(\n prop =>\n prop.type.kind === ReflectionKind.class && prop.type.classType === Map\n )\n ? `\n struct Map(Key, Value) {\n entries @0 :List(Entry);\n\n struct Entry {\n key @0 :Key;\n value @1 :Value;\n }\n }`\n : \"\"\n }${\n reflection\n .getProperties()\n .some(\n prop =>\n prop.type.kind === ReflectionKind.class &&\n prop.type.classType === Date\n )\n ? `\n struct Date {\n # A standard Gregorian calendar date.\n\n year @0 :Int16;\n # The year - Must include the century.\n # Negative value indicates BC.\n\n month @1 :UInt8; # The month, 1-12\n\n day @2 :UInt8; # The day of the month, 1-30\n\n hour @3 :UInt8; # The hour of the day, 0-23\n\n minute @4 :UInt8; # The minute of the hour, 0-59\n\n second @5 :UInt8; # The second of the minute, 0-59\n\n millisecond @6 :UInt16; # Milliseconds of the second, 0-999\n }`\n : \"\"\n }`;\n}\n\nexport function generateCapnpMethodSchema(\n reflection: ReflectionMethod,\n indexCounter: () => number\n): string {\n const methodName =\n reflection.getTitle() || typeof reflection.getName() === \"string\"\n ? String(reflection.getName())\n : \"\";\n if (!methodName) {\n throw new Error(\n `Cannot generate Cap'n Proto schema for method without a name - Parent interface: ${reflection.reflectionClass.getName()}`\n );\n }\n\n return `${camelCase(methodName)} @${indexCounter()} (${reflection\n .getParameters()\n .map(param => {\n return `${camelCase(\n param.getName()\n )} :${generateCapnpPrimitive(param.getType())}${\n param.hasDefault() ? ` = ${stringifyCapnpDefaultValue(param)}` : \"\"\n }`;\n })\n .join(\", \")})${\n isVoidType(reflection.getReturnType())\n ? \"\"\n : ` -> (${kindToName(\n reflection.getReturnType().kind\n )}: ${generateCapnpPrimitive(reflection.getReturnType())})`\n }; # ${(\n reflection.getDescription() ||\n `The ${titleCase(\n reflection.reflectionClass.getTitle() ||\n reflection.reflectionClass.getName()\n )} interface ${titleCase(methodName)} method.`\n ).replaceAll(\"\\n\", \". \")}`;\n}\n\nfunction generateCapnpPropertyComment(reflection: ReflectionProperty) {\n const result = getWords(\n reflection.getDescription() ||\n `A schema property for ${titleCase(\n reflection.getTitle() || reflection.getNameAsString()\n )} field.`,\n {\n relaxed: true\n }\n )\n .reduce((ret, word) => {\n let length = ret.length;\n if (ret.includes(\"\\n\")) {\n length = ret.substring(ret.lastIndexOf(\"\\n\") + 1).length;\n }\n\n const current = word.trim();\n if (length + current.length > 60) {\n ret += `\\n\\t# ${current}`;\n } else {\n ret += ` ${current}`;\n }\n return ret;\n }, \"\")\n .trim();\n if (result.length > 0) {\n return `\\t# ${result}`;\n }\n\n return \"\";\n}\n\nfunction generateCapnpPropertySchema(\n reflection: ReflectionProperty,\n indexCounter: () => number\n): string {\n if (reflection.type.kind === ReflectionKind.union) {\n if (getCapnpUnionTypes(reflection.type).length === 0) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Void;\n${generateCapnpPropertyComment(reflection)}`;\n } else if (\n getCapnpUnionTypes(reflection.type).filter(\n type =>\n type.kind === ReflectionKind.literal &&\n (isString(type.literal) || isNumber(type.literal))\n ).length === 1\n ) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${formatEnumName(\n reflection.getNameAsString()\n )}${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else {\n return `${camelCase(reflection.getNameAsString())} :union {\n${getCapnpUnionTypes(reflection.type)\n .map(\n type =>\n ` ${kindToName(type.kind)} @${indexCounter()} :${generateCapnpPrimitive(\n type\n )};`\n )\n .join(\"\\n\")}\n }\n${generateCapnpPropertyComment(reflection)}`;\n }\n } else if (reflection.type.kind === ReflectionKind.array) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :List(${generateCapnpPrimitive(reflection.getSubType())})${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else if (reflection.type.kind === ReflectionKind.class) {\n if (reflection.type.classType === Map) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Map(${\n !reflection.type.typeArguments ||\n reflection.type.typeArguments.length === 0 ||\n !reflection.type.typeArguments[0]\n ? \"Data\"\n : generateCapnpPrimitive(reflection.type.typeArguments[0])\n }, ${\n !reflection.type.typeArguments ||\n reflection.type.typeArguments.length < 2 ||\n !reflection.type.typeArguments[1]\n ? \"Data\"\n : generateCapnpPrimitive(reflection.type.typeArguments[1])\n })${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else if (reflection.type.classType === Date) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Data${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else if (reflection.type.classType === Buffer) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Data${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else if (reflection.type.classType === ArrayBuffer) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Data${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(\n reflection.type.typeName || getClassName(reflection.type.classType)\n )}${generateCapnpStruct(reflection.reflectionClass, {\n name: pascalCase(\n reflection.type.typeName || getClassName(reflection.type.classType)\n )\n })}${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n }\n } else if (reflection.type.kind === ReflectionKind.objectLiteral) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(\n reflection.type.typeName ||\n memberNameToString(reflection.getNameAsString())\n )}${generateCapnpStruct(reflection.reflectionClass, {\n name: pascalCase(\n reflection.type.typeName ||\n memberNameToString(reflection.getNameAsString())\n )\n })}${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else if (reflection.type.kind === ReflectionKind.enum) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(\n reflection.getNameAsString()\n )}${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n }\n\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${generateCapnpPrimitive(\n reflection.getType()\n )}${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n}\n\nexport function generateCapnpEnumSchema(\n type: TypeEnum | TypeUnion,\n name: string\n): string {\n if (type.kind === ReflectionKind.union) {\n return generateCapnpEnumSchema(\n {\n kind: ReflectionKind.enum,\n indexType: type,\n enum: (type.types as TypeLiteral[]).reduce<\n Record<string, string | number>\n >((ret, type) => {\n if (isString(type.literal) || isNumber(type.literal)) {\n ret[camelCase(String(type.literal))] = type.literal;\n }\n\n return ret;\n }, {}),\n values: (\n getCapnpUnionTypes(type).filter(\n type =>\n type.kind === ReflectionKind.literal &&\n (isString(type.literal) || isNumber(type.literal))\n ) as TypeLiteral[]\n ).map(type => type.literal as string | number)\n },\n name\n );\n }\n\n let index = 0;\n const indexCounter: () => number = () => index++;\n\n const enumType = getCapnpEnumTypes(type);\n if (!enumType) {\n return \"\";\n }\n\n return `enum ${pascalCase(name)} {\n${\n type.enum && Object.entries(type.enum).length > 0\n ? Object.entries(type.enum)\n .filter(([, value]) => value !== null && value !== undefined)\n .map(([key]) => ` ${camelCase(key)} @${indexCounter()};`)\n .join(\"\\n\")\n : type.values\n .filter(value => value !== null && value !== undefined)\n .map(\n value =>\n `${\n enumType === \"Text\" && value\n ? camelCase(String(value))\n : `${\n type.typeName ? `${camelCase(type.typeName)}_` : \"\"\n }${value || \"\"}`\n } @${indexCounter()};`\n )\n .join(\"\\n\")\n}\n }`;\n}\n\n/**\n * Generates a string representation of Cap'n Proto primitive types from a Deepkit Type.\n *\n * @param type - The Deepkit Type to convert.\n * @returns A string representation of the Cap'n Proto primitive type.\n */\nexport function generateCapnpPrimitive(type: Type): string {\n return type.kind === ReflectionKind.never ||\n type.kind === ReflectionKind.void ||\n type.kind === ReflectionKind.null ||\n type.kind === ReflectionKind.undefined ||\n type.kind === ReflectionKind.symbol\n ? \"Void\"\n : type.kind === ReflectionKind.class && type.classType === Date\n ? \"Date\"\n : type.kind === ReflectionKind.class && type.classType === Set\n ? `List(${\n type.typeArguments && type.typeArguments[0]\n ? generateCapnpPrimitive(type.typeArguments[0])\n : \"Data\"\n })`\n : type.kind === ReflectionKind.bigint\n ? \"UInt64\"\n : type.kind === ReflectionKind.number\n ? \"Float64\"\n : type.kind === ReflectionKind.string ||\n type.kind === ReflectionKind.regexp\n ? \"Text\"\n : type.kind === ReflectionKind.boolean\n ? \"Bool\"\n : type.kind === ReflectionKind.literal\n ? isNumber(type.literal)\n ? \"Float64\"\n : isBigInt(type.literal)\n ? \"UInt64\"\n : isString(type.literal)\n ? \"Text\"\n : typeof type.literal === \"boolean\"\n ? \"Bool\"\n : \"Data\"\n : \"Data\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,eAAsB,QACpB,SACA,UAAkC,EAAE,EACb;CACvB,MAAM,OAAO,KAAK,SAAS;EACzB,IAAI;EACJ,IAA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AQ,GACpB,YACA,SAAS,KAAK,QAAQ,GACpB,WACA,SAAS,KAAK,QAAQ,GACpB,SACA,OAAO,KAAK,YAAY,YACtB,SACA,SACR"}
1
+ {"version":3,"file":"capnp.mjs","names":[],"sources":["../../src/helpers/capnp.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 { getUnionTypes, kindToName } from \"@powerlines/deepkit/utilities\";\nimport { getClassName } from \"@powerlines/deepkit/vendor/core\";\nimport {\n memberNameToString,\n ReflectionClass,\n ReflectionKind,\n ReflectionMethod,\n ReflectionParameter,\n ReflectionProperty,\n Type,\n TypeEnum,\n TypeLiteral,\n TypeUnion\n} from \"@powerlines/deepkit/vendor/type\";\nimport { capnpc } from \"@stryke/capnp/compile\";\nimport { resolveOptions } from \"@stryke/capnp/helpers\";\nimport type { CapnpcOptions, CapnpcResult } from \"@stryke/capnp/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { StormJSON } from \"@stryke/json\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { getWords } from \"@stryke/string-format/get-words\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isBigInt } from \"@stryke/type-checks/is-bigint\";\nimport { isNull } from \"@stryke/type-checks/is-null\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport defu from \"defu\";\nimport { Buffer } from \"node:buffer\";\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\nimport { Context, PluginContext } from \"powerlines\";\nimport { getFileHeader } from \"powerlines/utils\";\n\n/**\n * Compiles a Cap'n Proto schema into TypeScript definitions.\n *\n * @param context - The context containing the project and workspace information.\n * @param options - The options for compiling the schema.\n * @returns A promise that resolves to the compiled schema.\n */\nexport async function compile(\n context: Context,\n options: Partial<CapnpcOptions> = {}\n): Promise<CapnpcResult> {\n const opts = defu(options, {\n ts: true,\n js: false,\n dts: false,\n schemas: joinPaths(context.artifactsPath, \"schemas\"),\n tsconfig: context.tsconfig,\n projectRoot: context.config.root,\n workspaceRoot: context.config.cwd,\n tty: true\n }) as Parameters<typeof resolveOptions>[0];\n\n const resolvedOptions = await resolveOptions(opts);\n if (!resolvedOptions) {\n throw new Error(\n `✖ No Cap'n Proto schema files found in the specified source paths: ${toArray(\n opts.schemas\n ).join(\", \")}.`\n );\n }\n\n return capnpc(resolvedOptions);\n}\n\n/**\n * Converts any {@link ReflectionProperty} or {@link ReflectionParameter}'s value to string representation.\n *\n * @param property - The {@link ReflectionProperty} or {@link ReflectionParameter} containing the value to stringify.\n * @param value - The value to stringify.\n * @returns A string representation of the value.\n */\nexport function stringifyCapnpDefaultValue(\n property: ReflectionProperty | ReflectionParameter,\n value?: any\n): string {\n return stringifyCapnpValue(\n property.type,\n value ?? property.getDefaultValue()\n );\n}\n\n/**\n * Converts any {@link Type}'s actual value to string representation.\n *\n * @param type - The {@link Type} of the value to stringify.\n * @param value - The value to stringify.\n * @returns A string representation of the value.\n */\nexport function stringifyCapnpValue(type: Type, value: any): string {\n return type.kind === ReflectionKind.string ||\n (type.kind === ReflectionKind.literal && isString(type.literal))\n ? `\"${String(value)}\"`\n : type.kind === ReflectionKind.enum\n ? `${camelCase(String(value))}`\n : type.kind === ReflectionKind.array\n ? StormJSON.stringify(value)\n : type.kind === ReflectionKind.object ||\n type.kind === ReflectionKind.objectLiteral\n ? StormJSON.stringify(value).replaceAll(\"{\", \"(\").replaceAll(\"}\", \")\")\n : String(value);\n}\n\n/**\n * Converts a ReflectionProperty's default value to a Cap'n Proto schema string representation.\n *\n * @param type - The TypeEnum to evaluate.\n * @returns A string representation of the property.\n */\nexport function getCapnpEnumTypes(type: Type): \"Text\" | \"Float32\" | null {\n if (type.kind !== ReflectionKind.enum) {\n return null;\n }\n\n const unique = getUniqueBy(\n type.values.filter(value => !isUndefined(value) && !isNull(value)),\n enumMember => (isString(enumMember) ? \"Text\" : \"Float32\")\n );\n if (unique.length === 0) {\n return null;\n }\n\n return unique[0] && isString(unique[0]) ? \"Text\" : \"Float32\";\n}\n\n/**\n * Determines if a Type is a `Void` type in a Cap'n Proto schema.\n *\n * @param type - The Type to check.\n * @returns True if the Type is a `Void` type, false otherwise.\n */\nexport function isVoidType(type: Type): boolean {\n return (\n type.kind === ReflectionKind.void ||\n type.kind === ReflectionKind.never ||\n type.kind === ReflectionKind.null ||\n type.kind === ReflectionKind.undefined ||\n type.kind === ReflectionKind.symbol\n );\n}\n\n/**\n * Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.\n *\n * @param type - The {@link TypeUnion} to convert.\n * @returns A string representation of the Cap'n Proto primitive type.\n */\nexport function getCapnpUnionTypes(type: Type): Type[] {\n return getUnionTypes(type);\n}\n\n/**\n * Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.\n *\n * @param type - The {@link TypeUnion} to convert.\n * @returns An array of Cap'n Proto primitive types.\n */\nexport function isCapnpStringUnion(type: Type): boolean {\n return getCapnpUnionTypes(type).some(\n member => member.kind === ReflectionKind.string\n );\n}\n\nexport const LARGE_BUFFER = 1024 * 1000000;\nexport type IOType = \"overlapped\" | \"pipe\" | \"ignore\" | \"inherit\";\nexport type StdioOptions =\n | IOType\n | Array<IOType | \"ipc\" | number | null | undefined>;\n\nconst execAsync = promisify(exec);\n\nexport async function generateCapnpId() {\n const { stdout } = await execAsync(\"capnp id\", {\n windowsHide: true,\n maxBuffer: LARGE_BUFFER,\n killSignal: \"SIGTERM\"\n });\n\n return stdout;\n}\n\nexport interface GenerateCapnpOptions {\n name?: string;\n}\n\nexport async function generateCapnp(\n context: PluginContext,\n reflection: ReflectionClass<any>,\n options: GenerateCapnpOptions\n) {\n const capnpId = await generateCapnpId();\n\n return `${capnpId.trim()};\n${getFileHeader(context)\n .replace(/^\\r*\\n*/g, \"\")\n .replaceAll(\"//\", \"#\")}\n${\n reflection.getMethods().length === 0\n ? generateCapnpStruct(reflection, options)\n : generateCapnpInterface(reflection, options)\n}\n`.trim();\n}\n\nexport interface GenerateCapnpStructOptions extends GenerateCapnpOptions {\n indexCounter?: () => number;\n}\n\nexport function generateCapnpStruct(\n reflection: ReflectionClass<any>,\n options: GenerateCapnpStructOptions = {}\n): string {\n const structName =\n options?.name ||\n reflection.getTitle() ||\n reflection.getClassName() ||\n reflection.getName();\n\n return `${generateCapnpEnums(reflection)}struct ${pascalCase(structName)} {\n # Struct definition for ${titleCase(structName)}.\n\n ${generateCapnpSchema(reflection, options)}\n}\n`;\n}\n\nexport function generateCapnpInterface(\n reflection: ReflectionClass<any>,\n options: GenerateCapnpStructOptions = {}\n): string {\n const interfaceName =\n options?.name ||\n reflection.getTitle() ||\n reflection.getClassName() ||\n reflection.getName();\n\n return `${generateCapnpEnums(reflection)}interface ${pascalCase(interfaceName)} {\n # Interface definition for ${titleCase(interfaceName)}.\n\n ${generateCapnpSchema(reflection, options)}\n}\n`;\n}\n\nfunction formatEnumName(name: string) {\n return pascalCase(`${name}_Type`);\n}\n\nfunction generateCapnpEnums(reflection: ReflectionClass<any>): string {\n const enums = reflection\n .getProperties()\n .filter(\n prop =>\n !prop.isIgnored() &&\n (prop.type.kind === ReflectionKind.enum ||\n (prop.type.kind === ReflectionKind.union &&\n getCapnpUnionTypes(prop.type).filter(\n type =>\n type.kind === ReflectionKind.literal &&\n (isString(type.literal) || isNumber(type.literal))\n ).length === 1))\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? b.getNameAsString().localeCompare(a.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n );\n if (enums.length === 0) {\n return \"\";\n }\n\n return `${enums\n .map(enumeration =>\n generateCapnpEnumSchema(\n enumeration.type as TypeEnum | TypeUnion,\n formatEnumName(enumeration.getNameAsString())\n )\n )\n .join(\"\\n\\n\")}\n\n`;\n}\n\nexport function generateCapnpSchema(\n reflection: ReflectionClass<any>,\n options: GenerateCapnpStructOptions = {}\n): string {\n let index = 0;\n const indexCounter: () => number = options?.indexCounter ?? (() => index++);\n\n return `${reflection\n .getProperties()\n .filter(prop => !prop.isIgnored())\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? b.getNameAsString().localeCompare(a.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n .map(prop => generateCapnpPropertySchema(prop, indexCounter))\n .join(\" \\n\\n\\t\")}${reflection\n .getMethods()\n .filter(methods => !methods.isIgnored())\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? String(b.getName()).localeCompare(String(a.getName()))\n : a.isReadonly()\n ? 1\n : -1\n )\n .map(methods => generateCapnpMethodSchema(methods, indexCounter))\n .join(\" \\n\\n\\t\")}${\n reflection\n .getProperties()\n .some(\n prop =>\n prop.type.kind === ReflectionKind.class && prop.type.classType === Map\n )\n ? `\n struct Map(Key, Value) {\n entries @0 :List(Entry);\n\n struct Entry {\n key @0 :Key;\n value @1 :Value;\n }\n }`\n : \"\"\n }${\n reflection\n .getProperties()\n .some(\n prop =>\n prop.type.kind === ReflectionKind.class &&\n prop.type.classType === Date\n )\n ? `\n struct Date {\n # A standard Gregorian calendar date.\n\n year @0 :Int16;\n # The year - Must include the century.\n # Negative value indicates BC.\n\n month @1 :UInt8; # The month, 1-12\n\n day @2 :UInt8; # The day of the month, 1-30\n\n hour @3 :UInt8; # The hour of the day, 0-23\n\n minute @4 :UInt8; # The minute of the hour, 0-59\n\n second @5 :UInt8; # The second of the minute, 0-59\n\n millisecond @6 :UInt16; # Milliseconds of the second, 0-999\n }`\n : \"\"\n }`;\n}\n\nexport function generateCapnpMethodSchema(\n reflection: ReflectionMethod,\n indexCounter: () => number\n): string {\n const methodName =\n reflection.getTitle() || typeof reflection.getName() === \"string\"\n ? String(reflection.getName())\n : \"\";\n if (!methodName) {\n throw new Error(\n `Cannot generate Cap'n Proto schema for method without a name - Parent interface: ${reflection.reflectionClass.getName()}`\n );\n }\n\n return `${camelCase(methodName)} @${indexCounter()} (${reflection\n .getParameters()\n .map(param => {\n return `${camelCase(\n param.getName()\n )} :${generateCapnpPrimitive(param.getType())}${\n param.hasDefault() ? ` = ${stringifyCapnpDefaultValue(param)}` : \"\"\n }`;\n })\n .join(\", \")})${\n isVoidType(reflection.getReturnType())\n ? \"\"\n : ` -> (${kindToName(\n reflection.getReturnType().kind\n )}: ${generateCapnpPrimitive(reflection.getReturnType())})`\n }; # ${(\n reflection.getDescription() ||\n `The ${titleCase(\n reflection.reflectionClass.getTitle() ||\n reflection.reflectionClass.getName()\n )} interface ${titleCase(methodName)} method.`\n ).replaceAll(\"\\n\", \". \")}`;\n}\n\nfunction generateCapnpPropertyComment(reflection: ReflectionProperty) {\n const result = getWords(\n reflection.getDescription() ||\n `A schema property for ${titleCase(\n reflection.getTitle() || reflection.getNameAsString()\n )} field.`,\n {\n relaxed: true\n }\n )\n .reduce((ret, word) => {\n let length = ret.length;\n if (ret.includes(\"\\n\")) {\n length = ret.substring(ret.lastIndexOf(\"\\n\") + 1).length;\n }\n\n const current = word.trim();\n if (length + current.length > 60) {\n ret += `\\n\\t# ${current}`;\n } else {\n ret += ` ${current}`;\n }\n return ret;\n }, \"\")\n .trim();\n if (result.length > 0) {\n return `\\t# ${result}`;\n }\n\n return \"\";\n}\n\nfunction generateCapnpPropertySchema(\n reflection: ReflectionProperty,\n indexCounter: () => number\n): string {\n if (reflection.type.kind === ReflectionKind.union) {\n if (getCapnpUnionTypes(reflection.type).length === 0) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Void;\n${generateCapnpPropertyComment(reflection)}`;\n } else if (\n getCapnpUnionTypes(reflection.type).filter(\n type =>\n type.kind === ReflectionKind.literal &&\n (isString(type.literal) || isNumber(type.literal))\n ).length === 1\n ) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${formatEnumName(\n reflection.getNameAsString()\n )}${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else {\n return `${camelCase(reflection.getNameAsString())} :union {\n${getCapnpUnionTypes(reflection.type)\n .map(\n type =>\n ` ${kindToName(type.kind)} @${indexCounter()} :${generateCapnpPrimitive(\n type\n )};`\n )\n .join(\"\\n\")}\n }\n${generateCapnpPropertyComment(reflection)}`;\n }\n } else if (reflection.type.kind === ReflectionKind.array) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :List(${generateCapnpPrimitive(reflection.getSubType())})${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else if (reflection.type.kind === ReflectionKind.class) {\n if (reflection.type.classType === Map) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Map(${\n !reflection.type.typeArguments ||\n reflection.type.typeArguments.length === 0 ||\n !reflection.type.typeArguments[0]\n ? \"Data\"\n : generateCapnpPrimitive(reflection.type.typeArguments[0])\n }, ${\n !reflection.type.typeArguments ||\n reflection.type.typeArguments.length < 2 ||\n !reflection.type.typeArguments[1]\n ? \"Data\"\n : generateCapnpPrimitive(reflection.type.typeArguments[1])\n })${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else if (reflection.type.classType === Date) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Data${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else if (reflection.type.classType === Buffer) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Data${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else if (reflection.type.classType === ArrayBuffer) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Data${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(\n reflection.type.typeName || getClassName(reflection.type.classType)\n )}${generateCapnpStruct(reflection.reflectionClass, {\n name: pascalCase(\n reflection.type.typeName || getClassName(reflection.type.classType)\n )\n })}${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n }\n } else if (reflection.type.kind === ReflectionKind.objectLiteral) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(\n reflection.type.typeName ||\n memberNameToString(reflection.getNameAsString())\n )}${generateCapnpStruct(reflection.reflectionClass, {\n name: pascalCase(\n reflection.type.typeName ||\n memberNameToString(reflection.getNameAsString())\n )\n })}${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n } else if (reflection.type.kind === ReflectionKind.enum) {\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(\n reflection.getNameAsString()\n )}${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n }\n\n return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${generateCapnpPrimitive(\n reflection.getType()\n )}${\n reflection.hasDefault()\n ? ` = ${stringifyCapnpDefaultValue(reflection)}`\n : \"\"\n };\n${generateCapnpPropertyComment(reflection)}`;\n}\n\nexport function generateCapnpEnumSchema(\n type: TypeEnum | TypeUnion,\n name: string\n): string {\n if (type.kind === ReflectionKind.union) {\n return generateCapnpEnumSchema(\n {\n kind: ReflectionKind.enum,\n indexType: type,\n enum: (type.types as TypeLiteral[]).reduce<\n Record<string, string | number>\n >((ret, type) => {\n if (isString(type.literal) || isNumber(type.literal)) {\n ret[camelCase(String(type.literal))] = type.literal;\n }\n\n return ret;\n }, {}),\n values: (\n getCapnpUnionTypes(type).filter(\n type =>\n type.kind === ReflectionKind.literal &&\n (isString(type.literal) || isNumber(type.literal))\n ) as TypeLiteral[]\n ).map(type => type.literal as string | number)\n },\n name\n );\n }\n\n let index = 0;\n const indexCounter: () => number = () => index++;\n\n const enumType = getCapnpEnumTypes(type);\n if (!enumType) {\n return \"\";\n }\n\n return `enum ${pascalCase(name)} {\n${\n type.enum && Object.entries(type.enum).length > 0\n ? Object.entries(type.enum)\n .filter(([, value]) => value !== null && value !== undefined)\n .map(([key]) => ` ${camelCase(key)} @${indexCounter()};`)\n .join(\"\\n\")\n : type.values\n .filter(value => value !== null && value !== undefined)\n .map(\n value =>\n `${\n enumType === \"Text\" && value\n ? camelCase(String(value))\n : `${\n type.typeName ? `${camelCase(type.typeName)}_` : \"\"\n }${value || \"\"}`\n } @${indexCounter()};`\n )\n .join(\"\\n\")\n}\n }`;\n}\n\n/**\n * Generates a string representation of Cap'n Proto primitive types from a Deepkit Type.\n *\n * @param type - The Deepkit Type to convert.\n * @returns A string representation of the Cap'n Proto primitive type.\n */\nexport function generateCapnpPrimitive(type: Type): string {\n return type.kind === ReflectionKind.never ||\n type.kind === ReflectionKind.void ||\n type.kind === ReflectionKind.null ||\n type.kind === ReflectionKind.undefined ||\n type.kind === ReflectionKind.symbol\n ? \"Void\"\n : type.kind === ReflectionKind.class && type.classType === Date\n ? \"Date\"\n : type.kind === ReflectionKind.class && type.classType === Set\n ? `List(${\n type.typeArguments && type.typeArguments[0]\n ? generateCapnpPrimitive(type.typeArguments[0])\n : \"Data\"\n })`\n : type.kind === ReflectionKind.bigint\n ? \"UInt64\"\n : type.kind === ReflectionKind.number\n ? \"Float64\"\n : type.kind === ReflectionKind.string ||\n type.kind === ReflectionKind.regexp\n ? \"Text\"\n : type.kind === ReflectionKind.boolean\n ? \"Bool\"\n : type.kind === ReflectionKind.literal\n ? isNumber(type.literal)\n ? \"Float64\"\n : isBigInt(type.literal)\n ? \"UInt64\"\n : isString(type.literal)\n ? \"Text\"\n : typeof type.literal === \"boolean\"\n ? \"Bool\"\n : \"Data\"\n : \"Data\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,eAAsB,QACpB,SACA,UAAkC,EAAE,EACb;CACvB,MAAM,OAAO,KAAK,SAAS;EACzB,IAAI;EACJ,IAAI;EACJ,KAAK;EACL,SAAS,UAAU,QAAQ,eAAe,UAAU;EACpD,UAAU,QAAQ;EAClB,aAAa,QAAQ,OAAO;EAC5B,eAAe,QAAQ,OAAO;EAC9B,KAAK;EACN,CAAC;CAEF,MAAM,kBAAkB,MAAM,eAAe,KAAK;AAClD,KAAI,CAAC,gBACH,OAAM,IAAI,MACR,sEAAsE,QACpE,KAAK,QACN,CAAC,KAAK,KAAK,CAAC,GACd;AAGH,QAAO,OAAO,gBAAgB;;;;;;;;;AAUhC,SAAgB,2BACd,UACA,OACQ;AACR,QAAO,oBACL,SAAS,MACT,SAAS,SAAS,iBAAiB,CACpC;;;;;;;;;AAUH,SAAgB,oBAAoB,MAAY,OAAoB;AAClE,QAAO,KAAK,SAAS,eAAe,UACjC,KAAK,SAAS,eAAe,WAAW,SAAS,KAAK,QAAQ,GAC7D,IAAI,OAAO,MAAM,CAAC,KACl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MAAM,CAAC,GACxB,GACE,KAAK,WAAW,GAAG,UAAU,KAAK,SAAS,CAAC,KAAK,KAChD,SAAS,KACjB,IAAI,cAAc,CAAC,GACvB,CACA,KAAK,KAAK,CAClB;;;;;;;;;AAUD,SAAgB,uBAAuB,MAAoB;AACzD,QAAO,KAAK,SAAS,eAAe,SAClC,KAAK,SAAS,eAAe,QAC7B,KAAK,SAAS,eAAe,QAC7B,KAAK,SAAS,eAAe,aAC7B,KAAK,SAAS,eAAe,SAC3B,SACA,KAAK,SAAS,eAAe,SAAS,KAAK,cAAc,OACvD,SACA,KAAK,SAAS,eAAe,SAAS,KAAK,cAAc,MACvD,QACE,KAAK,iBAAiB,KAAK,cAAc,KACrC,uBAAuB,KAAK,cAAc,GAAG,GAC7C,OACL,KACD,KAAK,SAAS,eAAe,SAC3B,WACA,KAAK,SAAS,eAAe,SAC3B,YACA,KAAK,SAAS,eAAe,UAC3B,KAAK,SAAS,eAAe,SAC7B,SACA,KAAK,SAAS,eAAe,UAC3B,SACA,KAAK,SAAS,eAAe,UAC3B,SAAS,KAAK,QAAQ,GACpB,YACA,SAAS,KAAK,QAAQ,GACpB,WACA,SAAS,KAAK,QAAQ,GACpB,SACA,OAAO,KAAK,YAAY,YACtB,SACA,SACR"}
package/dist/index.cjs CHANGED
@@ -1,9 +1,6 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- let _powerlines_plugin_babel = require("@powerlines/plugin-babel");
4
- _powerlines_plugin_babel = require_runtime.__toESM(_powerlines_plugin_babel);
5
3
  let _stryke_json_storm_json = require("@stryke/json/storm-json");
6
- let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
7
4
 
8
5
  //#region src/index.tsx
9
6
  /**
@@ -13,7 +10,7 @@ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
13
10
  * @returns A Powerlines plugin that integrates Alloy-js transformations.
14
11
  */
15
12
  const plugin = (options = {}) => {
16
- return [(0, _powerlines_plugin_babel.default)(), {
13
+ return [{
17
14
  name: "alloy",
18
15
  config() {
19
16
  this.debug("Updating configuration options to support Alloy-js builds.");
@@ -22,20 +19,18 @@ const plugin = (options = {}) => {
22
19
  typescript: true,
23
20
  ...options
24
21
  },
25
- babel: { presets: [[
26
- "@alloy-js/babel-preset",
27
- {},
28
- (_, id) => (0, _stryke_path_file_path_fns.findFileExtension)(id) === "tsx" || (0, _stryke_path_file_path_fns.findFileExtension)(id) === "jsx"
29
- ]] },
30
- tsdown: { inputOptions: { transform: { jsx: "preserve" } } },
22
+ tsdown: { inputOptions: { transform: { jsx: {
23
+ runtime: "automatic",
24
+ importSource: "@alloy-js/core"
25
+ } } } },
31
26
  resolve: { external: [/^@alloy-js\//] }
32
27
  };
33
28
  },
34
29
  async configResolved() {
35
30
  this.debug("Ensuring TypeScript configuration is set up for Alloy-js.");
36
- if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
31
+ if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "react-jsx" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
37
32
  this.tsconfig.tsconfigJson.compilerOptions ??= {};
38
- if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
33
+ if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "react-jsx") this.tsconfig.tsconfigJson.compilerOptions.jsx = "react-jsx";
39
34
  if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
40
35
  await this.fs.write(this.tsconfig.tsconfigFilePath, _stryke_json_storm_json.StormJSON.stringify(this.tsconfig.tsconfigJson));
41
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;YAyBY,MAAA;IACR,KAAA,GAAQ,kBAAA;EAAA;AAAA;;;;;;;cAUC,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KAoEJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;YAuBY,MAAA;IACR,KAAA,GAAQ,kBAAA;EAAA;AAAA;;;;;;;cAUC,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KA2DJ,MAAA,CAAO,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;YAyBY,MAAA;IACR,KAAA,GAAQ,kBAAA;EAAA;AAAA;;;;;;;cAUC,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KAoEJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;YAuBY,MAAA;IACR,KAAA,GAAQ,kBAAA;EAAA;AAAA;;;;;;;cAUC,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KA2DJ,MAAA,CAAO,QAAA"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,4 @@
1
- import babel from "@powerlines/plugin-babel";
2
1
  import { StormJSON } from "@stryke/json/storm-json";
3
- import { findFileExtension } from "@stryke/path/file-path-fns";
4
2
 
5
3
  //#region src/index.tsx
6
4
  /**
@@ -10,7 +8,7 @@ import { findFileExtension } from "@stryke/path/file-path-fns";
10
8
  * @returns A Powerlines plugin that integrates Alloy-js transformations.
11
9
  */
12
10
  const plugin = (options = {}) => {
13
- return [babel(), {
11
+ return [{
14
12
  name: "alloy",
15
13
  config() {
16
14
  this.debug("Updating configuration options to support Alloy-js builds.");
@@ -19,20 +17,18 @@ const plugin = (options = {}) => {
19
17
  typescript: true,
20
18
  ...options
21
19
  },
22
- babel: { presets: [[
23
- "@alloy-js/babel-preset",
24
- {},
25
- (_, id) => findFileExtension(id) === "tsx" || findFileExtension(id) === "jsx"
26
- ]] },
27
- tsdown: { inputOptions: { transform: { jsx: "preserve" } } },
20
+ tsdown: { inputOptions: { transform: { jsx: {
21
+ runtime: "automatic",
22
+ importSource: "@alloy-js/core"
23
+ } } } },
28
24
  resolve: { external: [/^@alloy-js\//] }
29
25
  };
30
26
  },
31
27
  async configResolved() {
32
28
  this.debug("Ensuring TypeScript configuration is set up for Alloy-js.");
33
- if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
29
+ if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "react-jsx" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
34
30
  this.tsconfig.tsconfigJson.compilerOptions ??= {};
35
- if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
31
+ if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "react-jsx") this.tsconfig.tsconfigJson.compilerOptions.jsx = "react-jsx";
36
32
  if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
37
33
  await this.fs.write(this.tsconfig.tsconfigFilePath, StormJSON.stringify(this.tsconfig.tsconfigJson));
38
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 babel from \"@powerlines/plugin-babel\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport type { Plugin } from \"powerlines\";\nimport type { AlloyPluginContext, AlloyPluginOptions } from \"./types/plugin\";\n\ndeclare module \"powerlines\" {\n interface Config {\n alloy?: AlloyPluginOptions;\n }\n}\n\n/**\n * Alloy-js plugin for Powerlines.\n *\n * @param options - The Alloy-js plugin user configuration options.\n * @returns A Powerlines plugin that integrates Alloy-js transformations.\n */\nexport const plugin = <\n TContext extends AlloyPluginContext = AlloyPluginContext\n>(\n options: AlloyPluginOptions = {}\n) => {\n return [\n babel(),\n {\n name: \"alloy\",\n config() {\n this.debug(\n \"Updating configuration options to support Alloy-js builds.\"\n );\n\n return {\n alloy: {\n typescript: true,\n ...options\n },\n babel: {\n presets: [\n [\n \"@alloy-js/babel-preset\",\n {},\n (_: string, id: string) =>\n findFileExtension(id) === \"tsx\" ||\n findFileExtension(id) === \"jsx\"\n ]\n ]\n },\n tsdown: {\n inputOptions: {\n transform: {\n jsx: \"preserve\"\n }\n }\n },\n resolve: {\n external: [/^@alloy-js\\//]\n }\n };\n },\n async configResolved() {\n this.debug(\"Ensuring TypeScript configuration is set up for Alloy-js.\");\n\n if (\n this.tsconfig.tsconfigJson.compilerOptions?.jsx !== \"preserve\" ||\n this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !==\n \"@alloy-js/core\"\n ) {\n this.tsconfig.tsconfigJson.compilerOptions ??= {};\n\n if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== \"preserve\") {\n this.tsconfig.tsconfigJson.compilerOptions.jsx = \"preserve\";\n }\n\n if (\n this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !==\n \"@alloy-js/core\"\n ) {\n this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource =\n \"@alloy-js/core\";\n }\n\n await this.fs.write(\n this.tsconfig.tsconfigFilePath,\n StormJSON.stringify(this.tsconfig.tsconfigJson)\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;AAmCA,MAAE,UAAA,UAAA,EAAA,KAAA;AACF,QAAO,CAAA,OAAM,EAAM;EACjB,MAAQ;EACT,SAAA;AACC,QAAS,MAAA,6DAAsB;AAC5B,UAAA;IACG,OAAC;KACC,YAAC;KACP,GAAA;KACE;IACA,OAAS,EACP,SAAU,CAAA;KAAA;KAAA,EAAA;MAAA,GAAA,OAAA,kBAAA,GAAA,KAAA,SAAA,kBAAA,GAAA,KAAA;KAAA,CAAA,EACT;IACD,QAAC,kBAED,WAAO,EACL,KAAO,YACL,EACD,EACF;IACD,SAAS,EACP,UAAU,CAAC,eAAA,EACZ;IACF;;EAEH,MAAM,iBAAiB;AACrB,QAAK,MAAM,4DAAkC;AAC7C,OAAI,KAAK,SAAG,aAAkB,iBAAY,QAAA,cAAA,KAAA,SAAA,aAAA,iBAAA,oBAAA,kBAAA;AACxC,SAAK,SAAC,aAAA,oBAAA,EAAA;AACN,QAAI,KAAA,SAAA,aAAA,gBAAA,QAAA,WACF,MAAC,SAAA,aAAA,gBAAA,MAAA;AAEH,QAAI,KAAA,SAAc,aAAA,gBAAA,oBAAA,iBAChB,MAAI,SAAU,aAAC,gBAAA,kBAAA;AAEjB,UAAM,KAAA,GAAA,MAAA,KAAA,SAAA,kBAAA,UAAA,UAAA,KAAA,SAAA,aAAA,CAAA;;;EAGX,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.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 { StormJSON } from \"@stryke/json/storm-json\";\nimport type { Plugin } from \"powerlines\";\nimport type { AlloyPluginContext, AlloyPluginOptions } from \"./types/plugin\";\n\ndeclare module \"powerlines\" {\n interface Config {\n alloy?: AlloyPluginOptions;\n }\n}\n\n/**\n * Alloy-js plugin for Powerlines.\n *\n * @param options - The Alloy-js plugin user configuration options.\n * @returns A Powerlines plugin that integrates Alloy-js transformations.\n */\nexport const plugin = <\n TContext extends AlloyPluginContext = AlloyPluginContext\n>(\n options: AlloyPluginOptions = {}\n) => {\n return [\n {\n name: \"alloy\",\n config() {\n this.debug(\n \"Updating configuration options to support Alloy-js builds.\"\n );\n\n return {\n alloy: {\n typescript: true,\n ...options\n },\n tsdown: {\n inputOptions: {\n transform: {\n jsx: {\n runtime: \"automatic\",\n importSource: \"@alloy-js/core\"\n }\n }\n }\n },\n resolve: {\n external: [/^@alloy-js\\//]\n }\n };\n },\n async configResolved() {\n this.debug(\"Ensuring TypeScript configuration is set up for Alloy-js.\");\n\n if (\n this.tsconfig.tsconfigJson.compilerOptions?.jsx !== \"react-jsx\" ||\n this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !==\n \"@alloy-js/core\"\n ) {\n this.tsconfig.tsconfigJson.compilerOptions ??= {};\n\n if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== \"react-jsx\") {\n this.tsconfig.tsconfigJson.compilerOptions.jsx = \"react-jsx\";\n }\n\n if (\n this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !==\n \"@alloy-js/core\"\n ) {\n this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource =\n \"@alloy-js/core\";\n }\n\n await this.fs.write(\n this.tsconfig.tsconfigFilePath,\n StormJSON.stringify(this.tsconfig.tsconfigJson)\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;AAkCA,MAAa,UAGX,UAA8B,EAAE,KAC7B;AACH,QAAO,CACL;EACE,MAAM;EACN,SAAS;AACP,QAAK,MACH,6DACD;AAED,UAAO;IACL,OAAO;KACL,YAAY;KACZ,GAAG;KACJ;IACD,QAAQ,EACN,cAAc,EACZ,WAAW,EACT,KAAK;KACH,SAAS;KACT,cAAc;KACf,EACF,EACF,EACF;IACD,SAAS,EACP,UAAU,CAAC,eAAe,EAC3B;IACF;;EAEH,MAAM,iBAAiB;AACrB,QAAK,MAAM,4DAA4D;AAEvE,OACE,KAAK,SAAS,aAAa,iBAAiB,QAAQ,eACpD,KAAK,SAAS,aAAa,iBAAiB,oBAC1C,kBACF;AACA,SAAK,SAAS,aAAa,oBAAoB,EAAE;AAEjD,QAAI,KAAK,SAAS,aAAa,gBAAgB,QAAQ,YACrD,MAAK,SAAS,aAAa,gBAAgB,MAAM;AAGnD,QACE,KAAK,SAAS,aAAa,gBAAgB,oBAC3C,iBAEA,MAAK,SAAS,aAAa,gBAAgB,kBACzC;AAGJ,UAAM,KAAK,GAAG,MACZ,KAAK,SAAS,kBACd,UAAU,UAAU,KAAK,SAAS,aAAa,CAChD;;;EAGN,CACF"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
- let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
4
3
  let _alloy_js_core = require("@alloy-js/core");
4
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
5
 
6
6
  //#region src/markdown/components/front-matter.tsx
7
7
  /**
@@ -10,19 +10,17 @@ let _alloy_js_core = require("@alloy-js/core");
10
10
  * @see https://jekyllrb.com/docs/front-matter/
11
11
  */
12
12
  function FrontMatter(props) {
13
- return [
13
+ return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [
14
14
  "---",
15
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
16
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
17
- get each() {
18
- return Object.entries(props.data);
19
- },
15
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
16
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
17
+ each: Object.entries(props.data),
20
18
  hardline: true,
21
19
  children: ([key, value]) => _alloy_js_core.code`${key}: ${JSON.stringify(value)}`
22
20
  }),
23
21
  "---",
24
- (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
25
- ];
22
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})
23
+ ] });
26
24
  }
27
25
 
28
26
  //#endregion