@powerlines/plugin-alloy 0.26.25 → 0.26.27

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 (105) hide show
  1. package/dist/core/components/infrastructure-file.cjs +13 -8
  2. package/dist/core/components/infrastructure-file.mjs +13 -8
  3. package/dist/core/components/infrastructure-file.mjs.map +1 -1
  4. package/dist/core/components/output.cjs +17 -10
  5. package/dist/core/components/output.mjs +17 -10
  6. package/dist/core/components/output.mjs.map +1 -1
  7. package/dist/core/components/single-line-comment.cjs +6 -4
  8. package/dist/core/components/single-line-comment.mjs +6 -4
  9. package/dist/core/components/single-line-comment.mjs.map +1 -1
  10. package/dist/core/components/source-file.cjs +10 -6
  11. package/dist/core/components/source-file.mjs +10 -6
  12. package/dist/core/components/source-file.mjs.map +1 -1
  13. package/dist/core/components/spacing.cjs +6 -4
  14. package/dist/core/components/spacing.mjs +6 -4
  15. package/dist/core/components/spacing.mjs.map +1 -1
  16. package/dist/core/contexts/context.mjs.map +1 -1
  17. package/dist/core/contexts/meta.mjs.map +1 -1
  18. package/dist/core/contexts/reflection.mjs.map +1 -1
  19. package/dist/core/helpers/code.mjs.map +1 -1
  20. package/dist/hcl/components/block-declaration.cjs +12 -8
  21. package/dist/hcl/components/block-declaration.mjs +12 -8
  22. package/dist/hcl/components/block-declaration.mjs.map +1 -1
  23. package/dist/hcl/components/hcl-file.cjs +35 -21
  24. package/dist/hcl/components/hcl-file.mjs +36 -22
  25. package/dist/hcl/components/hcl-file.mjs.map +1 -1
  26. package/dist/hcl/components/packer-file.cjs +8 -8
  27. package/dist/hcl/components/packer-file.mjs +8 -8
  28. package/dist/hcl/components/packer-file.mjs.map +1 -1
  29. package/dist/hcl/components/terraform-file.cjs +8 -8
  30. package/dist/hcl/components/terraform-file.mjs +8 -8
  31. package/dist/hcl/components/terraform-file.mjs.map +1 -1
  32. package/dist/helpers/capnp.mjs.map +1 -1
  33. package/dist/helpers/create-builtin.mjs.map +1 -1
  34. package/dist/helpers/refkey.mjs.map +1 -1
  35. package/dist/helpers/typescript.mjs.map +1 -1
  36. package/dist/index.cjs +16 -8
  37. package/dist/index.d.cts.map +1 -1
  38. package/dist/index.d.mts.map +1 -1
  39. package/dist/index.mjs +15 -8
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/markdown/components/front-matter.cjs +9 -7
  42. package/dist/markdown/components/front-matter.mjs +9 -7
  43. package/dist/markdown/components/front-matter.mjs.map +1 -1
  44. package/dist/markdown/components/markdown-file.cjs +76 -44
  45. package/dist/markdown/components/markdown-file.mjs +76 -44
  46. package/dist/markdown/components/markdown-file.mjs.map +1 -1
  47. package/dist/markdown/components/markdown-table.cjs +49 -28
  48. package/dist/markdown/components/markdown-table.mjs +49 -28
  49. package/dist/markdown/components/markdown-table.mjs.map +1 -1
  50. package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
  51. package/dist/render.cjs +3 -3
  52. package/dist/render.mjs +4 -4
  53. package/dist/render.mjs.map +1 -1
  54. package/dist/types/components.cjs +9 -0
  55. package/dist/types/components.mjs +10 -1
  56. package/dist/types/components.mjs.map +1 -0
  57. package/dist/typescript/components/builtin-file.cjs +30 -20
  58. package/dist/typescript/components/builtin-file.mjs +30 -20
  59. package/dist/typescript/components/builtin-file.mjs.map +1 -1
  60. package/dist/typescript/components/class-declaration.cjs +180 -100
  61. package/dist/typescript/components/class-declaration.mjs +180 -100
  62. package/dist/typescript/components/class-declaration.mjs.map +1 -1
  63. package/dist/typescript/components/dynamic-import-statement.cjs +2 -6
  64. package/dist/typescript/components/dynamic-import-statement.mjs +2 -6
  65. package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
  66. package/dist/typescript/components/entry-file.cjs +10 -7
  67. package/dist/typescript/components/entry-file.mjs +10 -7
  68. package/dist/typescript/components/entry-file.mjs.map +1 -1
  69. package/dist/typescript/components/interface-declaration.cjs +127 -74
  70. package/dist/typescript/components/interface-declaration.mjs +127 -74
  71. package/dist/typescript/components/interface-declaration.mjs.map +1 -1
  72. package/dist/typescript/components/object-declaration.cjs +84 -50
  73. package/dist/typescript/components/object-declaration.mjs +84 -50
  74. package/dist/typescript/components/object-declaration.mjs.map +1 -1
  75. package/dist/typescript/components/property-name.cjs +3 -3
  76. package/dist/typescript/components/property-name.mjs +3 -3
  77. package/dist/typescript/components/property-name.mjs.map +1 -1
  78. package/dist/typescript/components/record-expression.mjs.map +1 -1
  79. package/dist/typescript/components/tsdoc-reflection.cjs +241 -108
  80. package/dist/typescript/components/tsdoc-reflection.mjs +241 -108
  81. package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
  82. package/dist/typescript/components/tsdoc.cjs +265 -168
  83. package/dist/typescript/components/tsdoc.mjs +265 -168
  84. package/dist/typescript/components/tsdoc.mjs.map +1 -1
  85. package/dist/typescript/components/type-declaration.cjs +20 -15
  86. package/dist/typescript/components/type-declaration.mjs +20 -15
  87. package/dist/typescript/components/type-declaration.mjs.map +1 -1
  88. package/dist/typescript/components/type-parameters.cjs +56 -29
  89. package/dist/typescript/components/type-parameters.mjs +56 -29
  90. package/dist/typescript/components/type-parameters.mjs.map +1 -1
  91. package/dist/typescript/components/typescript-file.cjs +135 -74
  92. package/dist/typescript/components/typescript-file.mjs +135 -74
  93. package/dist/typescript/components/typescript-file.mjs.map +1 -1
  94. package/dist/typescript/contexts/lexical-scope.cjs +5 -3
  95. package/dist/typescript/contexts/lexical-scope.mjs +5 -3
  96. package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
  97. package/dist/typescript/contexts/member-scope.cjs +5 -3
  98. package/dist/typescript/contexts/member-scope.mjs +5 -3
  99. package/dist/typescript/contexts/member-scope.mjs.map +1 -1
  100. package/dist/typescript/helpers/get-call-signature-props.mjs.map +1 -1
  101. package/dist/typescript/helpers/utilities.mjs.map +1 -1
  102. package/dist/yaml/components/yaml-file.cjs +92 -47
  103. package/dist/yaml/components/yaml-file.mjs +92 -47
  104. package/dist/yaml/components/yaml-file.mjs.map +1 -1
  105. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"block-declaration.mjs","names":[],"sources":["../../../src/hcl/components/block-declaration.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 { Prose, Show } from \"@alloy-js/core\";\nimport { code } from \"../../core/helpers/code\";\nimport { ComponentProps } from \"../../types/components\";\n\nexport interface BlockDeclarationProps extends ComponentProps {\n type: string;\n label: string | string[];\n}\n\n/**\n * A base component representing a block declaration in HCL. The children are rendered as a prose element, which means that they are broken into multiple lines. This component can be used to create more specific block declaration components, such as resource blocks, provider blocks, etc.\n *\n * @see https://developer.hashicorp.com/terraform/language#about-the-terraform-language\n * @see https://opentofu.org/docs/language/attr-as-blocks/#summary\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function BlockDeclaration(props: BlockDeclarationProps) {\n const { children, type, label } = props;\n\n return (\n <>\n {code`${type} ${Array.isArray(label) ? label.join(\" \") : label} {`}\n <Prose>\n <Show when={Boolean(children)}>{children}</Show>\n </Prose>\n {code`} `}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAoCA,SAAgB,iBAAiB,OAA8B;CAC7D,MAAM,EAAE,UAAU,MAAM,UAAU;AAElC,QACE;EACG,MAAI,GAAG,KAAK,GAAG,MAAM,QAAQ,MAAM,GAAG,MAAM,KAAK,IAAI,GAAG,MAAM;EAC/D,oBAAC,OAAD,YACE,oBAAC,MAAD;GAAM,MAAM,QAAQ,SAAS;GAAG;GAAgB,GAC1C;EACP,MAAI;EACJ"}
1
+ {"version":3,"file":"block-declaration.mjs","names":[],"sources":["../../../src/hcl/components/block-declaration.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 { Prose, Show } from \"@alloy-js/core\";\nimport { code } from \"../../core/helpers/code\";\nimport { ComponentProps } from \"../../types/components\";\n\nexport interface BlockDeclarationProps extends ComponentProps {\n type: string;\n label: string | string[];\n}\n\n/**\n * A base component representing a block declaration in HCL. The children are rendered as a prose element, which means that they are broken into multiple lines. This component can be used to create more specific block declaration components, such as resource blocks, provider blocks, etc.\n *\n * @see https://developer.hashicorp.com/terraform/language#about-the-terraform-language\n * @see https://opentofu.org/docs/language/attr-as-blocks/#summary\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function BlockDeclaration(props: BlockDeclarationProps) {\n const { children, type, label } = props;\n\n return (\n <>\n {code`${type} ${Array.isArray(label) ? label.join(\" \") : label} {`}\n <Prose>\n <Show when={Boolean(children)}>{children}</Show>\n </Prose>\n {code`} `}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAgB,iBAAiB,OAAC;CACjC,MAAA,EACG,UACA,MACF,UACI;AACJ,QAAO;EAAC,WAAU,MAAM,GAAA,KAAS,GAAC,MAAK,QAAA,MAAA,GAAA,MAAA,KAAA,IAAA,GAAA,MAAA,IAAA;EAAA,gBAAA,OAAA;AAEvC,UAAO,gBAAA,MAAA;IACJ,IAAA,OAAA;AACE,YAAO,QAAQ,SAAM;;IAEV;IACX,CAAC;KAEL,CAAC;EAAE,MAAA;EAAA"}
@@ -3,9 +3,9 @@ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  const require_core_contexts_context = require('../../core/contexts/context.cjs');
4
4
  const require_core_components_infrastructure_file = require('../../core/components/infrastructure-file.cjs');
5
5
  const require_core_components_single_line_comment = require('../../core/components/single-line-comment.cjs');
6
- let _alloy_js_core = require("@alloy-js/core");
7
6
  let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
8
7
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
8
+ let _alloy_js_core = require("@alloy-js/core");
9
9
  let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
10
10
  let powerlines_utils = require("powerlines/utils");
11
11
 
@@ -25,17 +25,23 @@ function HCLFile(props) {
25
25
  "id"
26
26
  ]);
27
27
  const filetype = (0, _alloy_js_core.computed)(() => _filetype || (0, _stryke_path_file_path_fns.findFileExtension)(id) || "hcl");
28
- return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_core_components_infrastructure_file.InfrastructureFile, {
29
- header: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(HCLFileHeader, { children: header }),
30
- ...rest,
28
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_infrastructure_file.InfrastructureFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({ get header() {
29
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(HCLFileHeader, { children: header });
30
+ } }, rest, {
31
31
  id,
32
- filetype: filetype.value,
32
+ get filetype() {
33
+ return filetype.value;
34
+ },
33
35
  storage: storage || "fs",
34
- children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
35
- when: Boolean(children),
36
- children
37
- })
38
- });
36
+ get children() {
37
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
38
+ get when() {
39
+ return Boolean(children);
40
+ },
41
+ children
42
+ });
43
+ }
44
+ }));
39
45
  }
40
46
  /**
41
47
  * Renders the header for a Powerlines HCL source file.
@@ -46,22 +52,30 @@ function HCLFile(props) {
46
52
  function HCLFileHeader(props) {
47
53
  const [{ children }] = (0, _alloy_js_core.splitProps)(props, ["children"]);
48
54
  const context = require_core_contexts_context.usePowerlines();
49
- return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [
50
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
51
- when: Boolean(children),
52
- children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [children, /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})] })
55
+ return [
56
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
57
+ get when() {
58
+ return Boolean(children);
59
+ },
60
+ get children() {
61
+ return [children, (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
62
+ }
53
63
  }),
54
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_core_components_single_line_comment.SingleLineComment, {
64
+ (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, {
55
65
  variant: "hcl",
56
- children: `Generated by ${(0, _stryke_string_format_title_case.titleCase)(context?.config?.framework) || "Powerlines"}`
66
+ get children() {
67
+ return `Generated by ${(0, _stryke_string_format_title_case.titleCase)(context?.config?.framework) || "Powerlines"}`;
68
+ }
57
69
  }),
58
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
59
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_core_components_single_line_comment.SingleLineComment, {
70
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
71
+ (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, {
60
72
  variant: "hcl",
61
- children: (0, powerlines_utils.getFileHeaderWarning)(context)
73
+ get children() {
74
+ return (0, powerlines_utils.getFileHeaderWarning)(context);
75
+ }
62
76
  }),
63
- /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})
64
- ] });
77
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
78
+ ];
65
79
  }
66
80
 
67
81
  //#endregion
@@ -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 { Show, computed, splitProps } from "@alloy-js/core";
5
4
  import { findFileExtension } from "@stryke/path/file-path-fns";
6
- import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
5
+ import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
6
+ import { Show, computed, splitProps } from "@alloy-js/core";
7
7
  import { titleCase } from "@stryke/string-format/title-case";
8
8
  import { getFileHeaderWarning } from "powerlines/utils";
9
9
 
@@ -23,17 +23,23 @@ function HCLFile(props) {
23
23
  "id"
24
24
  ]);
25
25
  const filetype = computed(() => _filetype || findFileExtension(id) || "hcl");
26
- return /* @__PURE__ */ jsx(InfrastructureFile, {
27
- header: /* @__PURE__ */ jsx(HCLFileHeader, { children: header }),
28
- ...rest,
26
+ return createComponent(InfrastructureFile, mergeProps({ get header() {
27
+ return createComponent(HCLFileHeader, { children: header });
28
+ } }, rest, {
29
29
  id,
30
- filetype: filetype.value,
30
+ get filetype() {
31
+ return filetype.value;
32
+ },
31
33
  storage: storage || "fs",
32
- children: /* @__PURE__ */ jsx(Show, {
33
- when: Boolean(children),
34
- children
35
- })
36
- });
34
+ get children() {
35
+ return createComponent(Show, {
36
+ get when() {
37
+ return Boolean(children);
38
+ },
39
+ children
40
+ });
41
+ }
42
+ }));
37
43
  }
38
44
  /**
39
45
  * Renders the header for a Powerlines HCL source file.
@@ -44,22 +50,30 @@ function HCLFile(props) {
44
50
  function HCLFileHeader(props) {
45
51
  const [{ children }] = splitProps(props, ["children"]);
46
52
  const context = usePowerlines();
47
- return /* @__PURE__ */ jsxs(Fragment, { children: [
48
- /* @__PURE__ */ jsx(Show, {
49
- when: Boolean(children),
50
- children: /* @__PURE__ */ jsxs(Fragment, { children: [children, /* @__PURE__ */ jsx("hbr", {})] })
53
+ return [
54
+ createComponent(Show, {
55
+ get when() {
56
+ return Boolean(children);
57
+ },
58
+ get children() {
59
+ return [children, createIntrinsic("hbr", {})];
60
+ }
51
61
  }),
52
- /* @__PURE__ */ jsx(SingleLineComment, {
62
+ createComponent(SingleLineComment, {
53
63
  variant: "hcl",
54
- children: `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}`
64
+ get children() {
65
+ return `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}`;
66
+ }
55
67
  }),
56
- /* @__PURE__ */ jsx("hbr", {}),
57
- /* @__PURE__ */ jsx(SingleLineComment, {
68
+ createIntrinsic("hbr", {}),
69
+ createComponent(SingleLineComment, {
58
70
  variant: "hcl",
59
- children: getFileHeaderWarning(context)
71
+ get children() {
72
+ return getFileHeaderWarning(context);
73
+ }
60
74
  }),
61
- /* @__PURE__ */ jsx("hbr", {})
62
- ] });
75
+ createIntrinsic("hbr", {})
76
+ ];
63
77
  }
64
78
 
65
79
  //#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":";;;;;;;;;;;;;;;;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
+ {"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":";;;;;;;;;;;;;;;;AAiCA,SAAE,QAAA,OAAA;CACA,MAAA,CAAA,EACE,UACA,SACD,6BAED,MACG,QAAK,WAAU,OAAA;EAAY;EAAG;EAAoB;EAAK;EAAW;EAAA,CAAA;CACtE,MAAA,WAAA,eAAA,aAAA,kBAAA,GAAA,IAAA,MAAA;AACC,QAAO,gBAAa,oBAAyB,WAAK,EAChD,IAAA,SAAY;AACd,SAAA,gBAAA,eAAA,EACK,UAAS,QACT,CAAC;;EAGA;;AAEN,UAAO,SAAA;;EAEL,SAAS,WAAE;EACX,IAAI,WAAM;AACR,UAAM,gBAAA,MAAA;IACN,IAAA,OAAU;AACV,YAAS,QAAU,SAAM;;IAEzB;IACH,CAAA;;;;;;;;;;;CAYD,MAAM,CAAA,gBAEN,WAAO,OAAA,CAAA,WAAA,CAAA;CACP,MAAG,UAAA,eAAA;AACH,QAAK;EAAA,gBAAmB,MAAQ;GAC9B,IAAI,OAAC;AACH,WAAK,QAAQ,SAAA;;GAEf,IAAI,WAAE;AACJ,WAAM,CAAA,UAAA,gBAAA,OAAA,EAAA,CAAA,CAAA;;GAET,CAAC;EAAE,gBAAY,mBAAiB;GAC/B,SAAO;GACP,IAAG,WAAK;AACN,WAAC,gBAAkB,UAAa,SAAA,QAAA,UAAA,IAAA;;GAEnC,CAAC;EAAE,gBAAE,OAAiB,EAAA,CAAA;EAAA,gBAAA,mBAAA;GACrB,SAAQ;GACR,IAAE,WAAA;AACH,WAAA,qBAAA,QAAA"}
@@ -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 = require("@alloy-js/core");
5
4
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
+ let _alloy_js_core = require("@alloy-js/core");
6
6
 
7
7
  //#region src/hcl/components/packer-file.tsx
8
8
  /**
@@ -15,14 +15,14 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
15
15
  */
16
16
  function PackerFile(props) {
17
17
  const [{ children }, rest] = (0, _alloy_js_core.splitProps)(props, ["children"]);
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),
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
+ },
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";
2
3
  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 { jsx } from "@alloy-js/core/jsx-runtime";
13
13
  */
14
14
  function PackerFile(props) {
15
15
  const [{ children }, rest] = splitProps(props, ["children"]);
16
- return /* @__PURE__ */ jsx(HCLFile, {
17
- filetype: "pkr.hcl",
18
- ...rest,
19
- children: /* @__PURE__ */ jsx(Show, {
20
- when: Boolean(children),
16
+ return createComponent(HCLFile, mergeProps({ filetype: "pkr.hcl" }, rest, { get children() {
17
+ return createComponent(Show, {
18
+ get when() {
19
+ return Boolean(children);
20
+ },
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,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
+ {"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":";;;;;;;;;;;;;AA8BA,SAAgB,WAAS,OAAO;CAC9B,MAAA,CAAA,EACF,YACE,QAAS,WAAY,OAAQ,CAAA,WAAW,CAAA;8CAExC,UAAO,WACN,EAAE,MAAA,EACD,IAAG,WAAW;AACZ,SAAO,gBAAA,MAAA;GACV,IAAA,OAAA;AACH,WAAA,QAAA,SAAA"}
@@ -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 = require("@alloy-js/core");
5
4
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
+ let _alloy_js_core = require("@alloy-js/core");
6
6
 
7
7
  //#region src/hcl/components/terraform-file.tsx
8
8
  /**
@@ -16,14 +16,14 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
16
16
  */
17
17
  function TerraformFile(props) {
18
18
  const [{ children }, rest] = (0, _alloy_js_core.splitProps)(props, ["children"]);
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),
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
+ },
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";
2
3
  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 { jsx } from "@alloy-js/core/jsx-runtime";
14
14
  */
15
15
  function TerraformFile(props) {
16
16
  const [{ children }, rest] = splitProps(props, ["children"]);
17
- return /* @__PURE__ */ jsx(HCLFile, {
18
- filetype: "tf",
19
- ...rest,
20
- children: /* @__PURE__ */ jsx(Show, {
21
- when: Boolean(children),
17
+ return createComponent(HCLFile, mergeProps({ filetype: "tf" }, rest, { get children() {
18
+ return createComponent(Show, {
19
+ get when() {
20
+ return Boolean(children);
21
+ },
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,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"}
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":";;;;;;;;;;;;;;AA+BA,SAAgB,cAAS,OAAY;CACnC,MAAA,CAAA,EACF,YACE,QAAS,WAAY,OAAQ,CAAA,WAAW,CAAA;8CAExC,UAAO,MACN,EAAE,MAAA,EACD,IAAG,WAAW;AACZ,SAAO,gBAAA,MAAA;GACV,IAAA,OAAA;AACH,WAAA,QAAA,SAAA"}
@@ -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.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 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Ac,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"}
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,eAAsB,QAAK,SAAA,UAAc,EAAA,EAAA;CACzC,MAAQ,OAAC,KAAW,SAAO;EAC3B,IAAQ;EACR,IAAQ;;EAEN,SAAA,UAAA,QAAA,eAAA,UAAA;EACC,UAAW,QAAM;EACnB,aAAA,QAAA,OAAA;EACG,eAAe,QAAK,OAAQ;EAC5B,KAAK;EACN,CAAC;CACF,MAAA,kBAAA,MAAA,eAAA,KAAA;AACF,KAAM,CAAC,gBACL,OAAQ,IAAC,MAAO,sEAAA,QAAA,KAAA,QAAA,CAAA,KAAA,KAAA,CAAA,GAAA;AAEhB,QAAC,OAAQ,gBAAc;;;;;;;;;AAUzB,SAAQ,2BAAmC,UAAC,OAAA;;;;;;;;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SAAA,eAAA,SAAA,SAAA,KAAA,SAAA,eAAA,UAAA,SAAA,KAAA,SAAA,eAAA,UAAA,SAAA,KAAA,QAAA,GAAA,YAAA,SAAA,KAAA,QAAA,GAAA,WAAA,SAAA,KAAA,QAAA,GAAA,SAAA,OAAA,KAAA,YAAA,YAAA,SAAA,SAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-builtin.mjs","names":[],"sources":["../../src/helpers/create-builtin.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 { SymbolCreator } from \"@alloy-js/core\";\nimport {\n createPackage,\n CreatePackageProps,\n PackageDescriptor,\n PackageRefkeys\n} from \"@alloy-js/typescript\";\n\nexport type CreateBuiltinOptions<T extends PackageDescriptor> = Omit<\n CreatePackageProps<T>,\n \"builtin\"\n>;\n\n/**\n * Creates a built-in representation of a package based on the provided descriptor.\n *\n * @param options - Properties to define the package, excluding the 'builtin' flag which is set to true.\n * @returns An object containing reference keys for the package and a symbol creator function.\n */\nexport function createBuiltin<const T extends PackageDescriptor>(\n options: CreateBuiltinOptions<T>\n): PackageRefkeys<T> & SymbolCreator {\n // const refkeys: any = {\n // [getSymbolCreatorSymbol()](binder: Binder) {\n // createSymbols(binder, props, refkeys);\n // }\n // };\n\n // for (const [path, symbols] of Object.entries(props.descriptor)) {\n // const keys = path === \".\" ? refkeys : (refkeys[path] = {});\n\n // if (symbols.default) {\n // keys.default = refkey(props.descriptor, path, \"default\");\n // }\n\n // for (const named of symbols.named ?? []) {\n // const namedObj = typeof named === \"string\" ? { name: named } : named;\n // keys[namedObj.name] = refkey();\n\n // if (namedObj.staticMembers?.length) {\n // createRefkeysForMembers(\n // namedObj.staticMembers,\n // keys[namedObj.name],\n // \"static\"\n // );\n // }\n\n // if (namedObj.instanceMembers?.length) {\n // createRefkeysForMembers(\n // namedObj.instanceMembers,\n // keys[namedObj.name],\n // \"instance\"\n // );\n // }\n\n // keys[namedObj.name][getSymbolCreatorSymbol()] = (\n // binder: Binder,\n // parentSym: TSOutputSymbol\n // ) => {\n // if (namedObj.staticMembers?.length) {\n // assignMembers(\n // binder,\n // parentSym,\n // namedObj.staticMembers,\n // keys[namedObj.name],\n // true\n // );\n // }\n // if (namedObj.instanceMembers?.length) {\n // assignMembers(\n // binder,\n // parentSym,\n // namedObj.instanceMembers,\n // keys[namedObj.name],\n // false\n // );\n // }\n // };\n // }\n // }\n\n // return refkeys;\n\n return createPackage({ ...options, builtin: true });\n}\n"],"mappings":";;;;;;;;;AAqCA,SAAgB,cACd,SACmC;AA8DnC,QAAO,cAAc;EAAE,GAAG;EAAS,SAAS;EAAM,CAAC"}
1
+ {"version":3,"file":"create-builtin.mjs","names":[],"sources":["../../src/helpers/create-builtin.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 { SymbolCreator } from \"@alloy-js/core\";\nimport {\n createPackage,\n CreatePackageProps,\n PackageDescriptor,\n PackageRefkeys\n} from \"@alloy-js/typescript\";\n\nexport type CreateBuiltinOptions<T extends PackageDescriptor> = Omit<\n CreatePackageProps<T>,\n \"builtin\"\n>;\n\n/**\n * Creates a built-in representation of a package based on the provided descriptor.\n *\n * @param options - Properties to define the package, excluding the 'builtin' flag which is set to true.\n * @returns An object containing reference keys for the package and a symbol creator function.\n */\nexport function createBuiltin<const T extends PackageDescriptor>(\n options: CreateBuiltinOptions<T>\n): PackageRefkeys<T> & SymbolCreator {\n // const refkeys: any = {\n // [getSymbolCreatorSymbol()](binder: Binder) {\n // createSymbols(binder, props, refkeys);\n // }\n // };\n\n // for (const [path, symbols] of Object.entries(props.descriptor)) {\n // const keys = path === \".\" ? refkeys : (refkeys[path] = {});\n\n // if (symbols.default) {\n // keys.default = refkey(props.descriptor, path, \"default\");\n // }\n\n // for (const named of symbols.named ?? []) {\n // const namedObj = typeof named === \"string\" ? { name: named } : named;\n // keys[namedObj.name] = refkey();\n\n // if (namedObj.staticMembers?.length) {\n // createRefkeysForMembers(\n // namedObj.staticMembers,\n // keys[namedObj.name],\n // \"static\"\n // );\n // }\n\n // if (namedObj.instanceMembers?.length) {\n // createRefkeysForMembers(\n // namedObj.instanceMembers,\n // keys[namedObj.name],\n // \"instance\"\n // );\n // }\n\n // keys[namedObj.name][getSymbolCreatorSymbol()] = (\n // binder: Binder,\n // parentSym: TSOutputSymbol\n // ) => {\n // if (namedObj.staticMembers?.length) {\n // assignMembers(\n // binder,\n // parentSym,\n // namedObj.staticMembers,\n // keys[namedObj.name],\n // true\n // );\n // }\n // if (namedObj.instanceMembers?.length) {\n // assignMembers(\n // binder,\n // parentSym,\n // namedObj.instanceMembers,\n // keys[namedObj.name],\n // false\n // );\n // }\n // };\n // }\n // }\n\n // return refkeys;\n\n return createPackage({ ...options, builtin: true });\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAY,cAAA,SAAuB;AA8DjC,QAAO,cAAY;EACjB,GAAG;EACH,SAAS;EACV,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"refkey.mjs","names":["refkeyExternal"],"sources":["../../src/helpers/refkey.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 { Refkey, refkey as refkeyExternal } from \"@alloy-js/core\";\n\n/**\n * Create a refkey for the provided arguments. Passing no arguments returns a fresh refkey that is guaranteed to be unique. Otherwise, the arguments passed will be used to create a refkey for those values. Providing the same arguments will always return the same refkey.\n *\n * @remarks\n * Values are compared using the SameValueZero algorithm, which considers objects the same if they are reference identical, and primitives the same if they are the same value, with the exception of `NaN`, which is always considered equal to other `NaN` values, and `-0`, which is considered identical to `+0`\n */\nexport function refkey(...args: unknown[]): Refkey {\n return refkeyExternal(\"powerlines\", ...args);\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgB,OAAO,GAAG,MAAyB;AACjD,QAAOA,SAAe,cAAc,GAAG,KAAK"}
1
+ {"version":3,"file":"refkey.mjs","names":[],"sources":["../../src/helpers/refkey.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 { Refkey, refkey as refkeyExternal } from \"@alloy-js/core\";\n\n/**\n * Create a refkey for the provided arguments. Passing no arguments returns a fresh refkey that is guaranteed to be unique. Otherwise, the arguments passed will be used to create a refkey for those values. Providing the same arguments will always return the same refkey.\n *\n * @remarks\n * Values are compared using the SameValueZero algorithm, which considers objects the same if they are reference identical, and primitives the same if they are the same value, with the exception of `NaN`, which is always considered equal to other `NaN` values, and `-0`, which is considered identical to `+0`\n */\nexport function refkey(...args: unknown[]): Refkey {\n return refkeyExternal(\"powerlines\", ...args);\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgB,OAAO,GAAG,MAAM;AAC9B,QAAO,SAAe,cAAc,GAAG,KAAK"}