@powerlines/plugin-alloy 0.26.123 → 0.26.125

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 (169) hide show
  1. package/dist/core/components/infrastructure-file.d.cts +3 -4
  2. package/dist/core/components/infrastructure-file.d.cts.map +1 -1
  3. package/dist/core/components/infrastructure-file.d.mts +3 -4
  4. package/dist/core/components/infrastructure-file.d.mts.map +1 -1
  5. package/dist/core/components/infrastructure-file.mjs.map +1 -1
  6. package/dist/core/components/output.d.cts +2 -3
  7. package/dist/core/components/output.d.cts.map +1 -1
  8. package/dist/core/components/output.d.mts +2 -3
  9. package/dist/core/components/output.d.mts.map +1 -1
  10. package/dist/core/components/output.mjs.map +1 -1
  11. package/dist/core/components/single-line-comment.d.cts +1 -2
  12. package/dist/core/components/single-line-comment.d.cts.map +1 -1
  13. package/dist/core/components/single-line-comment.d.mts +1 -2
  14. package/dist/core/components/single-line-comment.d.mts.map +1 -1
  15. package/dist/core/components/single-line-comment.mjs.map +1 -1
  16. package/dist/core/components/source-file.d.cts +1 -2
  17. package/dist/core/components/source-file.d.cts.map +1 -1
  18. package/dist/core/components/source-file.d.mts +1 -2
  19. package/dist/core/components/source-file.d.mts.map +1 -1
  20. package/dist/core/components/source-file.mjs.map +1 -1
  21. package/dist/core/components/spacing.d.cts +1 -3
  22. package/dist/core/components/spacing.d.cts.map +1 -1
  23. package/dist/core/components/spacing.d.mts +1 -3
  24. package/dist/core/components/spacing.d.mts.map +1 -1
  25. package/dist/core/components/spacing.mjs.map +1 -1
  26. package/dist/core/contexts/context.d.cts.map +1 -1
  27. package/dist/core/contexts/context.d.mts.map +1 -1
  28. package/dist/core/contexts/context.mjs.map +1 -1
  29. package/dist/core/contexts/meta.d.cts.map +1 -1
  30. package/dist/core/contexts/meta.d.mts.map +1 -1
  31. package/dist/core/contexts/meta.mjs.map +1 -1
  32. package/dist/core/contexts/reflection.d.cts.map +1 -1
  33. package/dist/core/contexts/reflection.d.mts.map +1 -1
  34. package/dist/core/contexts/reflection.mjs.map +1 -1
  35. package/dist/core/helpers/code.d.cts.map +1 -1
  36. package/dist/core/helpers/code.d.mts.map +1 -1
  37. package/dist/core/helpers/code.mjs.map +1 -1
  38. package/dist/hcl/components/block-declaration.d.cts +1 -2
  39. package/dist/hcl/components/block-declaration.d.cts.map +1 -1
  40. package/dist/hcl/components/block-declaration.d.mts +1 -2
  41. package/dist/hcl/components/block-declaration.d.mts.map +1 -1
  42. package/dist/hcl/components/block-declaration.mjs.map +1 -1
  43. package/dist/hcl/components/hcl-file.mjs.map +1 -1
  44. package/dist/hcl/components/packer-file.d.cts +1 -2
  45. package/dist/hcl/components/packer-file.d.cts.map +1 -1
  46. package/dist/hcl/components/packer-file.d.mts +1 -2
  47. package/dist/hcl/components/packer-file.d.mts.map +1 -1
  48. package/dist/hcl/components/packer-file.mjs.map +1 -1
  49. package/dist/hcl/components/terraform-file.d.cts +1 -2
  50. package/dist/hcl/components/terraform-file.d.cts.map +1 -1
  51. package/dist/hcl/components/terraform-file.d.mts +1 -2
  52. package/dist/hcl/components/terraform-file.d.mts.map +1 -1
  53. package/dist/hcl/components/terraform-file.mjs.map +1 -1
  54. package/dist/helpers/capnp.d.cts.map +1 -1
  55. package/dist/helpers/capnp.d.mts.map +1 -1
  56. package/dist/helpers/capnp.mjs.map +1 -1
  57. package/dist/helpers/create-builtin.mjs.map +1 -1
  58. package/dist/helpers/refkey.d.cts.map +1 -1
  59. package/dist/helpers/refkey.d.mts.map +1 -1
  60. package/dist/helpers/refkey.mjs.map +1 -1
  61. package/dist/helpers/typescript.d.cts.map +1 -1
  62. package/dist/helpers/typescript.d.mts.map +1 -1
  63. package/dist/helpers/typescript.mjs.map +1 -1
  64. package/dist/index.cjs +2 -6
  65. package/dist/index.d.cts.map +1 -1
  66. package/dist/index.d.mts.map +1 -1
  67. package/dist/index.mjs +2 -6
  68. package/dist/index.mjs.map +1 -1
  69. package/dist/markdown/components/front-matter.d.cts +1 -3
  70. package/dist/markdown/components/front-matter.d.cts.map +1 -1
  71. package/dist/markdown/components/front-matter.d.mts +1 -3
  72. package/dist/markdown/components/front-matter.d.mts.map +1 -1
  73. package/dist/markdown/components/front-matter.mjs.map +1 -1
  74. package/dist/markdown/components/heading.d.cts +1 -2
  75. package/dist/markdown/components/heading.d.cts.map +1 -1
  76. package/dist/markdown/components/heading.d.mts +1 -2
  77. package/dist/markdown/components/heading.d.mts.map +1 -1
  78. package/dist/markdown/components/heading.mjs.map +1 -1
  79. package/dist/markdown/components/markdown-file.d.cts +4 -5
  80. package/dist/markdown/components/markdown-file.d.cts.map +1 -1
  81. package/dist/markdown/components/markdown-file.d.mts +4 -5
  82. package/dist/markdown/components/markdown-file.d.mts.map +1 -1
  83. package/dist/markdown/components/markdown-file.mjs.map +1 -1
  84. package/dist/markdown/components/markdown-table.d.cts +3 -4
  85. package/dist/markdown/components/markdown-table.d.cts.map +1 -1
  86. package/dist/markdown/components/markdown-table.d.mts +3 -4
  87. package/dist/markdown/components/markdown-table.d.mts.map +1 -1
  88. package/dist/markdown/components/markdown-table.mjs.map +1 -1
  89. package/dist/markdown/contexts/markdown-table.d.cts.map +1 -1
  90. package/dist/markdown/contexts/markdown-table.d.mts.map +1 -1
  91. package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
  92. package/dist/render.d.cts.map +1 -1
  93. package/dist/render.d.mts.map +1 -1
  94. package/dist/render.mjs.map +1 -1
  95. package/dist/types/components.d.cts.map +1 -1
  96. package/dist/types/components.d.mts.map +1 -1
  97. package/dist/types/plugin.d.cts +1 -20
  98. package/dist/types/plugin.d.cts.map +1 -1
  99. package/dist/types/plugin.d.mts +1 -20
  100. package/dist/types/plugin.d.mts.map +1 -1
  101. package/dist/typescript/components/builtin-file.d.cts +1 -2
  102. package/dist/typescript/components/builtin-file.d.cts.map +1 -1
  103. package/dist/typescript/components/builtin-file.d.mts +1 -2
  104. package/dist/typescript/components/builtin-file.d.mts.map +1 -1
  105. package/dist/typescript/components/builtin-file.mjs.map +1 -1
  106. package/dist/typescript/components/class-declaration.d.cts.map +1 -1
  107. package/dist/typescript/components/class-declaration.d.mts.map +1 -1
  108. package/dist/typescript/components/class-declaration.mjs.map +1 -1
  109. package/dist/typescript/components/dynamic-import-statement.d.cts +1 -2
  110. package/dist/typescript/components/dynamic-import-statement.d.cts.map +1 -1
  111. package/dist/typescript/components/dynamic-import-statement.d.mts +1 -2
  112. package/dist/typescript/components/dynamic-import-statement.d.mts.map +1 -1
  113. package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
  114. package/dist/typescript/components/entry-file.d.cts +1 -2
  115. package/dist/typescript/components/entry-file.d.cts.map +1 -1
  116. package/dist/typescript/components/entry-file.d.mts +1 -2
  117. package/dist/typescript/components/entry-file.d.mts.map +1 -1
  118. package/dist/typescript/components/entry-file.mjs.map +1 -1
  119. package/dist/typescript/components/interface-declaration.d.cts +1 -2
  120. package/dist/typescript/components/interface-declaration.d.cts.map +1 -1
  121. package/dist/typescript/components/interface-declaration.d.mts +1 -2
  122. package/dist/typescript/components/interface-declaration.d.mts.map +1 -1
  123. package/dist/typescript/components/interface-declaration.mjs.map +1 -1
  124. package/dist/typescript/components/object-declaration.d.cts +2 -3
  125. package/dist/typescript/components/object-declaration.d.cts.map +1 -1
  126. package/dist/typescript/components/object-declaration.d.mts +2 -3
  127. package/dist/typescript/components/object-declaration.d.mts.map +1 -1
  128. package/dist/typescript/components/object-declaration.mjs.map +1 -1
  129. package/dist/typescript/components/property-name.d.cts +1 -3
  130. package/dist/typescript/components/property-name.d.cts.map +1 -1
  131. package/dist/typescript/components/property-name.d.mts +1 -3
  132. package/dist/typescript/components/property-name.d.mts.map +1 -1
  133. package/dist/typescript/components/property-name.mjs.map +1 -1
  134. package/dist/typescript/components/record-expression.d.cts.map +1 -1
  135. package/dist/typescript/components/record-expression.d.mts.map +1 -1
  136. package/dist/typescript/components/record-expression.mjs.map +1 -1
  137. package/dist/typescript/components/tsdoc-reflection.d.cts +6 -7
  138. package/dist/typescript/components/tsdoc-reflection.d.cts.map +1 -1
  139. package/dist/typescript/components/tsdoc-reflection.d.mts +6 -7
  140. package/dist/typescript/components/tsdoc-reflection.d.mts.map +1 -1
  141. package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
  142. package/dist/typescript/components/tsdoc.d.cts.map +1 -1
  143. package/dist/typescript/components/tsdoc.d.mts.map +1 -1
  144. package/dist/typescript/components/tsdoc.mjs.map +1 -1
  145. package/dist/typescript/components/type-declaration.d.cts +1 -2
  146. package/dist/typescript/components/type-declaration.d.cts.map +1 -1
  147. package/dist/typescript/components/type-declaration.d.mts +1 -2
  148. package/dist/typescript/components/type-declaration.d.mts.map +1 -1
  149. package/dist/typescript/components/type-declaration.mjs.map +1 -1
  150. package/dist/typescript/components/type-parameters.d.cts.map +1 -1
  151. package/dist/typescript/components/type-parameters.d.mts.map +1 -1
  152. package/dist/typescript/components/type-parameters.mjs.map +1 -1
  153. package/dist/typescript/components/typescript-file.mjs.map +1 -1
  154. package/dist/typescript/contexts/lexical-scope.d.cts +1 -2
  155. package/dist/typescript/contexts/lexical-scope.d.cts.map +1 -1
  156. package/dist/typescript/contexts/lexical-scope.d.mts +1 -2
  157. package/dist/typescript/contexts/lexical-scope.d.mts.map +1 -1
  158. package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
  159. package/dist/typescript/contexts/member-scope.d.cts.map +1 -1
  160. package/dist/typescript/contexts/member-scope.d.mts.map +1 -1
  161. package/dist/typescript/contexts/member-scope.mjs.map +1 -1
  162. package/dist/typescript/helpers/get-call-signature-props.mjs.map +1 -1
  163. package/dist/typescript/helpers/utilities.d.cts.map +1 -1
  164. package/dist/typescript/helpers/utilities.d.mts.map +1 -1
  165. package/dist/typescript/helpers/utilities.mjs.map +1 -1
  166. package/dist/yaml/components/yaml-file.d.cts.map +1 -1
  167. package/dist/yaml/components/yaml-file.d.mts.map +1 -1
  168. package/dist/yaml/components/yaml-file.mjs.map +1 -1
  169. package/package.json +7 -7
@@ -1,5 +1,4 @@
1
1
  import { HCLFileProps } from "./hcl-file.mjs";
2
- import * as _$_alloy_js_core0 from "@alloy-js/core";
3
2
  import { PartialKeys } from "@stryke/types/base";
4
3
 
5
4
  //#region src/hcl/components/packer-file.d.ts
@@ -12,7 +11,7 @@ type PackerFileProps = PartialKeys<HCLFileProps, "filetype">;
12
11
  * @param props - The properties for the source file.
13
12
  * @returns The rendered source file component.
14
13
  */
15
- declare function PackerFile(props: PackerFileProps): _$_alloy_js_core0.Children;
14
+ declare function PackerFile(props: PackerFileProps): import("@alloy-js/core").Children;
16
15
  //#endregion
17
16
  export { PackerFile, PackerFileProps };
18
17
  //# sourceMappingURL=packer-file.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packer-file.d.mts","names":[],"sources":["../../../src/hcl/components/packer-file.tsx"],"mappings":";;;;;KAsBY,eAAA,GAAkB,WAAA,CAAY,YAAA;;;AAA1C;;;;;AAUA;iBAAgB,UAAA,CAAW,KAAA,EAAO,eAAA,GAAe,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"packer-file.d.mts","names":[],"sources":["../../../src/hcl/components/packer-file.tsx"],"mappings":";;;;KAsBY,eAAA,GAAkB,WAAW,CAAC,YAAA;;AAA1C;;;;AAAsD;AAUtD;;iBAAgB,UAAA,CAAW,KAAA,EAAO,eAAe,4BAAA,QAAA"}
@@ -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":";;;;;;;;;;;;;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
+ {"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,UAAW,CAAA;8CAExC,UAAO,UACP,GAAG,MAAA,EACD,IAAG,WAAW;EACZ,OAAO,gBAAA,MAAA;GACV,IAAA,OAAA;IACH,OAAA,QAAA,QAAA"}
@@ -1,5 +1,4 @@
1
1
  import { HCLFileProps } from "./hcl-file.cjs";
2
- import * as _$_alloy_js_core0 from "@alloy-js/core";
3
2
  import { PartialKeys } from "@stryke/types/base";
4
3
 
5
4
  //#region src/hcl/components/terraform-file.d.ts
@@ -13,7 +12,7 @@ type TerraformFileProps = PartialKeys<HCLFileProps, "filetype">;
13
12
  * @param props - The properties for the source file.
14
13
  * @returns The rendered source file component.
15
14
  */
16
- declare function TerraformFile(props: TerraformFileProps): _$_alloy_js_core0.Children;
15
+ declare function TerraformFile(props: TerraformFileProps): import("@alloy-js/core").Children;
17
16
  //#endregion
18
17
  export { TerraformFile, TerraformFileProps };
19
18
  //# sourceMappingURL=terraform-file.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"terraform-file.d.cts","names":[],"sources":["../../../src/hcl/components/terraform-file.tsx"],"mappings":";;;;;KAsBY,kBAAA,GAAqB,WAAA,CAAY,YAAA;;;AAA7C;;;;;AAWA;;iBAAgB,aAAA,CAAc,KAAA,EAAO,kBAAA,GAAkB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"terraform-file.d.cts","names":[],"sources":["../../../src/hcl/components/terraform-file.tsx"],"mappings":";;;;KAsBY,kBAAA,GAAqB,WAAW,CAAC,YAAA;;AAA7C;;;;AAAyD;AAWzD;;;iBAAgB,aAAA,CAAc,KAAA,EAAO,kBAAkB,4BAAA,QAAA"}
@@ -1,5 +1,4 @@
1
1
  import { HCLFileProps } from "./hcl-file.mjs";
2
- import * as _$_alloy_js_core0 from "@alloy-js/core";
3
2
  import { PartialKeys } from "@stryke/types/base";
4
3
 
5
4
  //#region src/hcl/components/terraform-file.d.ts
@@ -13,7 +12,7 @@ type TerraformFileProps = PartialKeys<HCLFileProps, "filetype">;
13
12
  * @param props - The properties for the source file.
14
13
  * @returns The rendered source file component.
15
14
  */
16
- declare function TerraformFile(props: TerraformFileProps): _$_alloy_js_core0.Children;
15
+ declare function TerraformFile(props: TerraformFileProps): import("@alloy-js/core").Children;
17
16
  //#endregion
18
17
  export { TerraformFile, TerraformFileProps };
19
18
  //# sourceMappingURL=terraform-file.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"terraform-file.d.mts","names":[],"sources":["../../../src/hcl/components/terraform-file.tsx"],"mappings":";;;;;KAsBY,kBAAA,GAAqB,WAAA,CAAY,YAAA;;;AAA7C;;;;;AAWA;;iBAAgB,aAAA,CAAc,KAAA,EAAO,kBAAA,GAAkB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"terraform-file.d.mts","names":[],"sources":["../../../src/hcl/components/terraform-file.tsx"],"mappings":";;;;KAsBY,kBAAA,GAAqB,WAAW,CAAC,YAAA;;AAA7C;;;;AAAyD;AAWzD;;;iBAAgB,aAAA,CAAc,KAAA,EAAO,kBAAkB,4BAAA,QAAA"}
@@ -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":";;;;;;;;;;;;;;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
+ {"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,UAAW,CAAA;8CAExC,UAAO,KACP,GAAG,MAAA,EACD,IAAG,WAAW;EACZ,OAAO,gBAAA,MAAA;GACV,IAAA,OAAA;IACH,OAAA,QAAA,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"capnp.d.cts","names":[],"sources":["../../src/helpers/capnp.ts"],"mappings":";;;;;;;AA8DA;;;;;iBAAsB,OAAA,CACpB,OAAA,EAAS,OAAA,EACT,OAAA,GAAS,OAAA,CAAQ,aAAA,IAChB,OAAA,CAAQ,YAAA;;;;;;;;iBA+BK,0BAAA,CACd,QAAA,EAAU,kBAAA,GAAqB,mBAAA,EAC/B,KAAA;;;;;;AAFF;;iBAiBgB,mBAAA,CAAoB,IAAA,EAAM,IAAA,EAAM,KAAA;;;;;;;iBAoBhC,iBAAA,CAAkB,IAAA,EAAM,IAAA;AApBxC;;;;;;AAAA,iBA0CgB,UAAA,CAAW,IAAA,EAAM,IAAA;;;AAtBjC;;;;iBAsCgB,kBAAA,CAAmB,IAA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AmB,EAClD,KAAA;;;;;AAjCqB;AA+BvB;;iBAiBgB,mBAAA,CAAoB,IAAA,EAAM,IAAI,EAAE,KAAA;;;;;;;iBAoBhC,iBAAA,CAAkB,IAAU,EAAJ,IAAI;AApB5C;;;;;;AAAA,iBA0CgB,UAAA,CAAW,IAAU,EAAJ,IAAI;;AA1CqB;AAoB1D;;;;iBAsCgB,kBAAA,CAAmB,IAAA,EAAM,IAAA,GAAO,IAAI;AAhBpD;;;;AAAqC;AAgBrC;AAhBA,iBA0BgB,kBAAA,CAAmB,IAAU,EAAJ,IAAI;AAAA,cAMhC,YAAA;AAAA,KACD,MAAA;AAAA,KACA,YAAA,GACR,MAAA,GACA,KAAA,CAAM,MAAA;AAAA,iBAIY,eAAA,CAAA,GAAe,OAAA;AAAA,UAUpB,oBAAA;EACf,IAAI;AAAA;AAAA,iBAGgB,aAAA,CACpB,OAAA,EAAS,aAAA,EACT,UAAA,EAAY,eAAA,OACZ,OAAA,EAAS,oBAAA,GAAoB,OAAA;AAAA,UAgBd,0BAAA,SAAmC,oBAAoB;EACtE,YAAY;AAAA;AAAA,iBAGE,mBAAA,CACd,UAAA,EAAY,eAAA,OACZ,OAAA,GAAS,0BAA+B;AAAA,iBAgB1B,sBAAA,CACd,UAAA,EAAY,eAAA,OACZ,OAAA,GAAS,0BAA+B;AAAA,iBAyD1B,mBAAA,CACd,UAAA,EAAY,eAAA,OACZ,OAAA,GAAS,0BAA+B;AAAA,iBA4E1B,yBAAA,CACd,UAAA,EAAY,gBAAgB,EAC5B,YAAA;AAAA,iBA0Mc,uBAAA,CACd,IAAA,EAAM,QAAA,GAAW,SAAS,EAC1B,IAAA;AAtZwC;AAC1C;;;;AAAkB;AADwB,iBAwd1B,sBAAA,CAAuB,IAAU,EAAJ,IAAI"}
@@ -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 ? \"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;;;;;;;;;;AAW5C,SAAgB,oBAAgB,MAAA,OAAA;AAChC,QAAA,KAAA,SAAA,eAAA,UAAA,KAAA,SAAA,eAAA,WAAA,SAAA,KAAA,QAAA,GAAA,IAAA,OAAA,MAAA,CAAA,KAAA,KAAA,SAAA,eAAA,OAAA,GAAA,UAAA,OAAA,MAAA,CAAA,KAAA,KAAA,SAAA,eAAA,QAAA,UAAA,UAAA,MAAA,GAAA,KAAA,SAAA,eAAA,UAAA,KAAA,SAAA,eAAA,gBAAA,UAAA,UAAA,MAAA,CAAA,WAAA,KAAA,IAAA,CAAA,WAAA,KAAA,IAAA,GAAA,OAAA,MAAA;;;;;;;;AASA,SAAgB,kBAAA,MAAA;AACd,KAAA,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QAAA,UAAA,OAAA,CAAA,KAAA,CAAA,SAAA,OAAA,UAAA,IAAA,CAAA,IAAA,cAAA,CAAA,GAAA,CAAA,KAAA,KAAA,GAAA,KAAA,OAAA,QAAA,UAAA,UAAA,QAAA,UAAA,OAAA,CAAA,KAAA,UAAA,GAAA,aAAA,UAAA,QAAA,UAAA,OAAA,MAAA,CAAA,GAAA,GAAA,KAAA,WAAA,GAAA,UAAA,KAAA,SAAA,CAAA,KAAA,KAAA,SAAA,KAAA,IAAA,cAAA,CAAA,GAAA,CAAA,KAAA,KAAA,CAAA;;;;;;;;;AAUZ,SAAgB,uBAAC,MAA4B;AAC3C,QAAO,KAAK,SAAS,eAAA,SAAA,KAAA,SAAA,eAAA,QAAA,KAAA,SAAA,eAAA,QAAA,KAAA,SAAA,eAAA,aAAA,KAAA,SAAA,eAAA,SAAA,SAAA,KAAA,SAAA,eAAA,SAAA,KAAA,cAAA,OAAA,SAAA,KAAA,SAAA,eAAA,SAAA,KAAA,cAAA,MAAA,QAAA,KAAA,iBAAA,KAAA,cAAA,KAAA,uBAAA,KAAA,cAAA,GAAA,GAAA,OAAA,KAAA,KAAA,SAAA,eAAA,SAAA,WAAA,KAAA,SAAA,eAAA,SAAA,YAAA,KAAA,SAAA,eAAA,UAAA,KAAA,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
+ {"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,CAAA,GAAA;CACzC,MAAQ,OAAC,KAAW,SAAO;EAC3B,IAAQ;EACR,IAAQ;;EAEN,SAAA,UAAA,QAAA,eAAA,SAAA;EACC,UAAW,QAAM;EACnB,aAAA,QAAA,OAAA;EACG,eAAe,QAAK,OAAQ;EAC5B,KAAK;CACP,CAAC;CACD,MAAA,kBAAA,MAAA,eAAA,IAAA;CACF,IAAM,CAAC,iBACL,MAAQ,IAAC,MAAO,sEAAA,QAAA,KAAA,OAAA,EAAA,KAAA,IAAA,EAAA,EAAA;CAEhB,OAAC,OAAQ,eAAc;AACzB;;;;;;;;AASA,SAAQ,2BAAmC,UAAC,OAAA;;AAE5C;;;;;;;;AASA,SAAgB,oBAAgB,MAAA,OAAA;CAChC,OAAA,KAAA,SAAA,eAAA,UAAA,KAAA,SAAA,eAAA,WAAA,SAAA,KAAA,OAAA,IAAA,IAAA,OAAA,KAAA,EAAA,KAAA,KAAA,SAAA,eAAA,OAAA,GAAA,UAAA,OAAA,KAAA,CAAA,MAAA,KAAA,SAAA,eAAA,QAAA,UAAA,UAAA,KAAA,IAAA,KAAA,SAAA,eAAA,UAAA,KAAA,SAAA,eAAA,gBAAA,UAAA,UAAA,KAAA,EAAA,WAAA,KAAA,GAAA,EAAA,WAAA,KAAA,GAAA,IAAA,OAAA,KAAA;;;;;;;;AASA,SAAgB,kBAAA,MAAA;CACd,IAAA,KAAS,SAAC,eAAqB,MAC/B,OAAQ;CAER,MAAM,SAAC,YAAmB,KAAA,OAAA,QAAA,UAAA,CAAA,YAAA,KAAA,KAAA,CAAA,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AAA,KAAA,CAAA,SAAA,OAAA,UAAA,GAAA,EAAA,IAAA,aAAA,EAAA,EAAA,EAAA,KAAA,IAAA,IAAA,KAAA,OAAA,QAAA,UAAA,UAAA,QAAA,UAAA,MAAA,EAAA,KAAA,UAAA,GAAA,aAAA,UAAA,QAAA,UAAA,OAAA,KAAA,CAAA,IAAA,GAAA,KAAA,WAAA,GAAA,UAAA,KAAA,QAAA,EAAA,KAAA,KAAA,SAAA,KAAA,IAAA,aAAA,EAAA,EAAA,EAAA,KAAA,IAAA,EAAA;;AAEZ;;;;;;;AAQA,SAAgB,uBAAC,MAA4B;CAC3C,OAAO,KAAK,SAAS,eAAA,SAAA,KAAA,SAAA,eAAA,QAAA,KAAA,SAAA,eAAA,QAAA,KAAA,SAAA,eAAA,aAAA,KAAA,SAAA,eAAA,SAAA,SAAA,KAAA,SAAA,eAAA,SAAA,KAAA,cAAA,OAAA,SAAA,KAAA,SAAA,eAAA,SAAA,KAAA,cAAA,MAAA,QAAA,KAAA,iBAAA,KAAA,cAAA,KAAA,uBAAA,KAAA,cAAA,EAAA,IAAA,OAAA,KAAA,KAAA,SAAA,eAAA,SAAA,WAAA,KAAA,SAAA,eAAA,SAAA,YAAA,KAAA,SAAA,eAAA,UAAA,KAAA,SAAA,eAAA,SAAA,SAAA,KAAA,SAAA,eAAA,UAAA,SAAA,KAAA,SAAA,eAAA,UAAA,SAAA,KAAA,OAAA,IAAA,YAAA,SAAA,KAAA,OAAA,IAAA,WAAA,SAAA,KAAA,OAAA,IAAA,SAAA,OAAA,KAAA,YAAA,YAAA,SAAA,SAAA;AACvB"}
@@ -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":";;;;;;;;;AA0BA,SAAY,cAAA,SAAuB;AA8DjC,QAAO,cAAY;EACjB,GAAG;EACH,SAAS;EACV,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;CA8DjC,OAAO,cAAY;EACjB,GAAG;EACH,SAAS;CACX,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"refkey.d.cts","names":[],"sources":["../../src/helpers/refkey.ts"],"mappings":";;;;;AA0BA;;;;iBAAgB,MAAA,CAAA,GAAU,IAAA,cAAkB,MAAA"}
1
+ {"version":3,"file":"refkey.d.cts","names":[],"sources":["../../src/helpers/refkey.ts"],"mappings":";;;;;AA0BA;;;;iBAAgB,MAAA,CAAA,GAAU,IAAA,cAAkB,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"refkey.d.mts","names":[],"sources":["../../src/helpers/refkey.ts"],"mappings":";;;;;AA0BA;;;;iBAAgB,MAAA,CAAA,GAAU,IAAA,cAAkB,MAAA"}
1
+ {"version":3,"file":"refkey.d.mts","names":[],"sources":["../../src/helpers/refkey.ts"],"mappings":";;;;;AA0BA;;;;iBAAgB,MAAA,CAAA,GAAU,IAAA,cAAkB,MAAM"}
@@ -1 +1 @@
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"}
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;CAC9B,OAAO,SAAe,cAAc,GAAG,IAAI;AAC7C"}
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.d.cts","names":[],"sources":["../../src/helpers/typescript.ts"],"mappings":";;;UAwBiB,mCAAA;EACf,YAAA;EACA,eAAA;EACA,aAAA,GAAgB,OAAA,CAAQ,CAAA;AAAA;AAAA,UAqJT,gCAAA;EACf,YAAA;EACA,eAAA;EACA,aAAA,GAAgB,OAAA,CAAQ,CAAA;AAAA;;;;;AAH1B;;;iBAagB,yBAAA,WAAoC,MAAA,cAAA,CAClD,UAAA,EAAY,eAAA,CAAgB,CAAA,GAC5B,OAAA,GAAS,gCAAA,CAAiC,CAAA"}
1
+ {"version":3,"file":"typescript.d.cts","names":[],"sources":["../../src/helpers/typescript.ts"],"mappings":";;;UAwBiB,mCAAA;EACf,YAAA;EACA,eAAA;EACA,aAAA,GAAgB,OAAO,CAAC,CAAA;AAAA;AAAA,UAqJT,gCAAA;EACf,YAAA;EACA,eAAA;EACA,aAAA,GAAgB,OAAO,CAAC,CAAA;AAAA;;;;AAxJC;AAqJ3B;;;iBAagB,yBAAA,WAAoC,MAAA,cAAA,CAClD,UAAA,EAAY,eAAA,CAAgB,CAAA,GAC5B,OAAA,GAAS,gCAAA,CAAiC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.d.mts","names":[],"sources":["../../src/helpers/typescript.ts"],"mappings":";;;UAwBiB,mCAAA;EACf,YAAA;EACA,eAAA;EACA,aAAA,GAAgB,OAAA,CAAQ,CAAA;AAAA;AAAA,UAqJT,gCAAA;EACf,YAAA;EACA,eAAA;EACA,aAAA,GAAgB,OAAA,CAAQ,CAAA;AAAA;;;;;AAH1B;;;iBAagB,yBAAA,WAAoC,MAAA,cAAA,CAClD,UAAA,EAAY,eAAA,CAAgB,CAAA,GAC5B,OAAA,GAAS,gCAAA,CAAiC,CAAA"}
1
+ {"version":3,"file":"typescript.d.mts","names":[],"sources":["../../src/helpers/typescript.ts"],"mappings":";;;UAwBiB,mCAAA;EACf,YAAA;EACA,eAAA;EACA,aAAA,GAAgB,OAAO,CAAC,CAAA;AAAA;AAAA,UAqJT,gCAAA;EACf,YAAA;EACA,eAAA;EACA,aAAA,GAAgB,OAAO,CAAC,CAAA;AAAA;;;;AAxJC;AAqJ3B;;;iBAagB,yBAAA,WAAoC,MAAA,cAAA,CAClD,UAAA,EAAY,eAAA,CAAgB,CAAA,GAC5B,OAAA,GAAS,gCAAA,CAAiC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/helpers/typescript.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 { stringifyValue } from \"@powerlines/deepkit/utilities\";\nimport type { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\n\nexport interface GenerateInterfaceDeclarationOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n// /**\n// * Generates a TypeScript interface for the given reflection class.\n// *\n// * @param reflection - The reflection class to generate the interface for.\n// * @returns A string containing the TypeScript interface definition.\n// */\n// export function InterfaceDeclaration<T>(\n// reflection: ReflectionClass<T>,\n// options: GenerateInterfaceDeclarationOptions<T> = {}\n// ): string {\n// if (!reflection) {\n// return \"\";\n// }\n\n// return `\n// /**\n// * Interface for ${reflection.getTitle() || titleCase(options.overrideName || reflection.getName())}.\n// *\n// * @title ${reflection.getTitle() || titleCase(reflection.getName())}${\n// reflection.getAlias().length\n// ? ` ${reflection\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${reflection.getDomain() ? ` * @domain ${reflection.getDomain()}` : \"\"}${\n// reflection.getPermission().length\n// ? `\n// ${reflection\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// reflection.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// reflection.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// reflection.isIgnored()\n// ? `\n// * @ignored`\n// : \"\"\n// }${\n// reflection.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// export interface ${pascalCase(options.overrideName || reflection.getName())}${\n// options.overrideExtends !== false &&\n// (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n// ? ` extends ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n// : \"\"\n// } {\n// ${reflection\n// .getProperties()\n// .filter(item => !item.isIgnored())\n// .sort((a, b) =>\n// (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n// ? a.getNameAsString().localeCompare(b.getNameAsString())\n// : a.isReadonly()\n// ? 1\n// : -1\n// )\n// .map(\n// item =>\n// ` /**\n// * ${\n// item.getDescription() ||\n// item.getTitle() ||\n// titleCase(item.getNameAsString())\n// }\n// *\n// * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n// item.getAlias().length\n// ? `\n// ${item\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// item.getDomain()\n// ? `\n// * @domain ${item.getDomain()}`\n// : \"\"\n// }${\n// item.getPermission().length\n// ? `\n// ${item\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// !isUndefined(item.getDefaultValue()) && item.getDefaultValue() !== \"\"\n// ? `\n// * @defaultValue ${item.getDefaultValue()}`\n// : \"\"\n// }${\n// item.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// item.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// item.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// ${item.isReadonly() ? \"readonly \" : \"\"}${item.getNameAsString()}${\n// isUndefined(\n// (options.defaultValues as Record<string, any>)?.[item.getNameAsString()]\n// ) &&\n// isUndefined(item.getDefaultValue()) &&\n// !item\n// .getAlias()\n// .some(\n// alias =>\n// !isUndefined(\n// (options.defaultValues as Record<string, any>)?.[alias]\n// )\n// ) &&\n// item.isOptional()\n// ? \"?\"\n// : \"\"\n// }: ${stringifyType(item.getType())}`\n// )\n// .join(\", \\n\")}\n// }\n// `;\n// }\n\nexport interface GenerateObjectDeclarationOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n *\n * @param reflection - The reflection class to generate the object for.\n * @param options - Options for generating the object.\n * @returns A string containing the TypeScript object definition.\n */\nexport function generateObjectDeclaration<T extends Record<string, any>>(\n reflection: ReflectionClass<T>,\n options: GenerateObjectDeclarationOptions<T> = {}\n) {\n if (!reflection) {\n return \"\";\n }\n\n return `\n/**\n * ${\n reflection.getDescription() ||\n `${titleCase(options.overrideName || reflection.getClassName() || reflection.getName())} object instance`\n }.\n */\nexport const ${camelCase(options.overrideName || reflection.getName())}${\n options.overrideExtends !== false &&\n (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n ? `: ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n : \"\"\n } = {\n ${reflection\n .getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (options.defaultValues as Record<string, any>)?.[alias]\n )\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n .map(\n item =>\n ` /**\n * ${\n item.getDescription() ||\n item.getTitle() ||\n titleCase(item.getNameAsString())\n }\n *\n * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n item.getAlias().length\n ? `\n ${item\n .getAlias()\n .map(alias => ` * @alias ${alias}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.getDomain()\n ? `\n * @domain ${item.getDomain()}`\n : \"\"\n }${\n item.getPermission().length\n ? `\n ${item\n .getPermission()\n .map(permission => ` * @permission ${permission}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.isInternal()\n ? `\n * @internal`\n : \"\"\n }${\n item.isRuntime()\n ? `\n * @runtime`\n : \"\"\n }${\n item.isReadonly()\n ? `\n * @readonly`\n : \"\"\n }${\n item.isIgnored()\n ? `\n * @ignored`\n : \"\"\n }${\n item.isHidden()\n ? `\n * @hidden`\n : \"\"\n }\n */\n ${item.getNameAsString()}: ${stringifyValue(\n item.getType(),\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined((options.defaultValues as Record<string, any>)?.[alias])\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )}`\n )\n .join(\", \\n\")}\n};\n`;\n}\n"],"mappings":";;;;;;;;;;;;;AAgLA,SAAgB,0BAAC,YAAoC,UAAA,EAAA,EAAA;AACnD,KAAA,CAAA,WACA,QAAA;AAEF,QAAA;;KAEE,WAAA,gBAAA,IAAA,GAAA,UAAA,QAAA,gBAAA,WAAA,cAAA,IAAA,WAAA,SAAA,CAAA,CAAA,kBAAA;;eAED,UAAA,QAAA,gBAAA,WAAA,SAAA,CAAA,GAAA,QAAA,oBAAA,UAAA,QAAA,mBAAA,WAAA,yBAAA,EAAA,SAAA,IAAA,KAAA,QAAA,mBAAA,WAAA,yBAAA,EAAA,SAAA,KAAA,GAAA;IACG,WAAM,eAAiB,CAAA,QAAW,SAAQ,CAAC,KAAA,WAAa,IAAO,CAAA,YAAG,QAAA,gBAAA,KAAA,iBAAA,KAAA,KAAA,UAAA,CAAA,QAAA,KAAA,UAAA;AAClE,MAAA,YAAgB,IAAA,IAAQ,CAAA,YAAI,QAAe,gBAAM,OAAA,CACjD,QAAS,QAAQ,gBAAe;AAEpC,SAAO;IACL,OAAY,IAAA,KAAA,iBAAkB,CAAA,CAAA,CAAA,MAAA,GAAA,MAAA,EAAA,YAAA,IAAA,EAAA,YAAA,IAAA,CAAA,EAAA,YAAA,IAAA,CAAA,EAAA,YAAA,GAAA,EAAA,iBAAA,CAAA,cAAA,EAAA,iBAAA,CAAA,GAAA,EAAA,YAAA,GAAA,IAAA,GAAA,CAAA,KAAA,SAAA;MAC9B,KAAS,gBAAA,IAAA,KAAA,UAAmC,IAAI,UAAA,KAAA,iBAAA,CAAA,CAAA;;aAE3C,KAAW,UAAC,IAAA,UAAA,KAAA,iBAAA,CAAA,GAAA,KAAA,UAAA,CAAA,SAAA;IACf,KAAA,UAAS,CAAA,KAAA,UAAA,aAAA,QAAA,CAAA,KAAA,KAAA,KAAA,KAAA,KAAA,WAAA,GAAA;cACX,KAAA,WAAA,KAAA,KAAA,KAAA,eAAA,CAAA,SAAA;;iBAEO,KAAA,KAAA,WAAA,GAAA;gBACP,KAAA,KAAA,YAAA,GAAA;iBACE,KAAA,KAAA,WAAA,GAAA;gBACU,KAAA,KAAA,UAAkB,GAAA;eACjB,GAAC;;IAEd,KAAA,iBAAA,CAAA,IAAA,eAAA,KAAA,SAAA,EAAA,QAAA,gBAAA,KAAA,iBAAA,KAAA,KAAA,UAAA,CAAA,QAAA,KAAA,UAAA;AACF,MAAO,YAAQ,IAAS,IAAC,CAAA,YAAQ,QAAgB,gBAAW,OAAY,CACpE,QAAQ,QAAA,gBAAyB;AAEjC,SAAO;IACN,OAAI,IAAA,KAAA,iBAAA,CAAA,GAAA,CAAA,KAAA,OAAA,CAAA"}
1
+ {"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/helpers/typescript.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 { stringifyValue } from \"@powerlines/deepkit/utilities\";\nimport type { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\n\nexport interface GenerateInterfaceDeclarationOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n// /**\n// * Generates a TypeScript interface for the given reflection class.\n// *\n// * @param reflection - The reflection class to generate the interface for.\n// * @returns A string containing the TypeScript interface definition.\n// */\n// export function InterfaceDeclaration<T>(\n// reflection: ReflectionClass<T>,\n// options: GenerateInterfaceDeclarationOptions<T> = {}\n// ): string {\n// if (!reflection) {\n// return \"\";\n// }\n\n// return `\n// /**\n// * Interface for ${reflection.getTitle() || titleCase(options.overrideName || reflection.getName())}.\n// *\n// * @title ${reflection.getTitle() || titleCase(reflection.getName())}${\n// reflection.getAlias().length\n// ? ` ${reflection\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${reflection.getDomain() ? ` * @domain ${reflection.getDomain()}` : \"\"}${\n// reflection.getPermission().length\n// ? `\n// ${reflection\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// reflection.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// reflection.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// reflection.isIgnored()\n// ? `\n// * @ignored`\n// : \"\"\n// }${\n// reflection.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// export interface ${pascalCase(options.overrideName || reflection.getName())}${\n// options.overrideExtends !== false &&\n// (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n// ? ` extends ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n// : \"\"\n// } {\n// ${reflection\n// .getProperties()\n// .filter(item => !item.isIgnored())\n// .sort((a, b) =>\n// (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n// ? a.getNameAsString().localeCompare(b.getNameAsString())\n// : a.isReadonly()\n// ? 1\n// : -1\n// )\n// .map(\n// item =>\n// ` /**\n// * ${\n// item.getDescription() ||\n// item.getTitle() ||\n// titleCase(item.getNameAsString())\n// }\n// *\n// * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n// item.getAlias().length\n// ? `\n// ${item\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// item.getDomain()\n// ? `\n// * @domain ${item.getDomain()}`\n// : \"\"\n// }${\n// item.getPermission().length\n// ? `\n// ${item\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// !isUndefined(item.getDefaultValue()) && item.getDefaultValue() !== \"\"\n// ? `\n// * @defaultValue ${item.getDefaultValue()}`\n// : \"\"\n// }${\n// item.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// item.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// item.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// ${item.isReadonly() ? \"readonly \" : \"\"}${item.getNameAsString()}${\n// isUndefined(\n// (options.defaultValues as Record<string, any>)?.[item.getNameAsString()]\n// ) &&\n// isUndefined(item.getDefaultValue()) &&\n// !item\n// .getAlias()\n// .some(\n// alias =>\n// !isUndefined(\n// (options.defaultValues as Record<string, any>)?.[alias]\n// )\n// ) &&\n// item.isOptional()\n// ? \"?\"\n// : \"\"\n// }: ${stringifyType(item.getType())}`\n// )\n// .join(\", \\n\")}\n// }\n// `;\n// }\n\nexport interface GenerateObjectDeclarationOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n *\n * @param reflection - The reflection class to generate the object for.\n * @param options - Options for generating the object.\n * @returns A string containing the TypeScript object definition.\n */\nexport function generateObjectDeclaration<T extends Record<string, any>>(\n reflection: ReflectionClass<T>,\n options: GenerateObjectDeclarationOptions<T> = {}\n) {\n if (!reflection) {\n return \"\";\n }\n\n return `\n/**\n * ${\n reflection.getDescription() ||\n `${titleCase(options.overrideName || reflection.getClassName() || reflection.getName())} object instance`\n }.\n */\nexport const ${camelCase(options.overrideName || reflection.getName())}${\n options.overrideExtends !== false &&\n (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n ? `: ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n : \"\"\n } = {\n ${reflection\n .getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (options.defaultValues as Record<string, any>)?.[alias]\n )\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n .map(\n item =>\n ` /**\n * ${\n item.getDescription() ||\n item.getTitle() ||\n titleCase(item.getNameAsString())\n }\n *\n * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n item.getAlias().length\n ? `\n ${item\n .getAlias()\n .map(alias => ` * @alias ${alias}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.getDomain()\n ? `\n * @domain ${item.getDomain()}`\n : \"\"\n }${\n item.getPermission().length\n ? `\n ${item\n .getPermission()\n .map(permission => ` * @permission ${permission}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.isInternal()\n ? `\n * @internal`\n : \"\"\n }${\n item.isRuntime()\n ? `\n * @runtime`\n : \"\"\n }${\n item.isReadonly()\n ? `\n * @readonly`\n : \"\"\n }${\n item.isIgnored()\n ? `\n * @ignored`\n : \"\"\n }${\n item.isHidden()\n ? `\n * @hidden`\n : \"\"\n }\n */\n ${item.getNameAsString()}: ${stringifyValue(\n item.getType(),\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined((options.defaultValues as Record<string, any>)?.[alias])\n ) {\n return (options.defa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AAA;cACX,KAAA,UAAA,MAAA,KAAA,KAAA,cAAA,EAAA,SAAA;;iBAEO,KAAA,KAAA,UAAA,IAAA;gBACP,KAAA,KAAA,WAAA,IAAA;iBACE,KAAA,KAAA,UAAA,IAAA;gBACU,KAAA,KAAA,SAAkB,IAAA;eACjB,GAAC;;IAEd,KAAA,gBAAA,EAAA,IAAA,eAAA,KAAA,QAAA,GAAA,QAAA,gBAAA,KAAA,gBAAA,MAAA,KAAA,SAAA,EAAA,QAAA,KAAA,UAAA;EACF,IAAO,YAAQ,GAAA,KAAU,CAAA,YAAQ,QAAgB,gBAAW,MAAW,GACnE,OAAQ,QAAA,gBAAyB;EAEjC,OAAO;CACT,GAAG,MAAI,KAAA,KAAA,gBAAA,CAAA,GAAA,EAAA,KAAA,MAAA,EAAA;;;AAGT"}
package/dist/index.cjs CHANGED
@@ -2,7 +2,6 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  let _powerlines_plugin_babel = require("@powerlines/plugin-babel");
4
4
  _powerlines_plugin_babel = require_runtime.__toESM(_powerlines_plugin_babel);
5
- let _stryke_json_storm_json = require("@stryke/json/storm-json");
6
5
  let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
7
6
 
8
7
  //#region src/index.tsx
@@ -18,10 +17,7 @@ const plugin = (options = {}) => {
18
17
  config() {
19
18
  this.debug("Updating configuration options to support Alloy-js builds.");
20
19
  return {
21
- alloy: {
22
- typescript: true,
23
- ...options
24
- },
20
+ alloy: { ...options },
25
21
  babel: {
26
22
  skipConfigResolution: true,
27
23
  presets: ["@babel/preset-typescript", [
@@ -44,7 +40,7 @@ const plugin = (options = {}) => {
44
40
  if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve") {
45
41
  this.tsconfig.tsconfigJson.compilerOptions ??= {};
46
42
  this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
47
- await this.fs.write(this.tsconfig.tsconfigFilePath, _stryke_json_storm_json.StormJSON.stringify(this.tsconfig.tsconfigJson));
43
+ await this.fs.write(this.tsconfig.tsconfigFilePath, JSON.stringify(this.tsconfig.tsconfigJson, null, 2));
48
44
  }
49
45
  }
50
46
  }];
@@ -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,KA4DJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;YAwBY,MAAA;IACR,KAAA,GAAQ,kBAAkB;EAAA;AAAA;;;;;;;cAUjB,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,KA4DJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;YAwBY,MAAA;IACR,KAAA,GAAQ,kBAAkB;EAAA;AAAA;;;;;;;cAUjB,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KA2DJ,MAAA,CAAO,QAAA"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import babel from "@powerlines/plugin-babel";
2
- import { StormJSON } from "@stryke/json/storm-json";
3
2
  import { findFileExtension } from "@stryke/path/file-path-fns";
4
3
 
5
4
  //#region src/index.tsx
@@ -15,10 +14,7 @@ const plugin = (options = {}) => {
15
14
  config() {
16
15
  this.debug("Updating configuration options to support Alloy-js builds.");
17
16
  return {
18
- alloy: {
19
- typescript: true,
20
- ...options
21
- },
17
+ alloy: { ...options },
22
18
  babel: {
23
19
  skipConfigResolution: true,
24
20
  presets: ["@babel/preset-typescript", [
@@ -41,7 +37,7 @@ const plugin = (options = {}) => {
41
37
  if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve") {
42
38
  this.tsconfig.tsconfigJson.compilerOptions ??= {};
43
39
  this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
44
- await this.fs.write(this.tsconfig.tsconfigFilePath, StormJSON.stringify(this.tsconfig.tsconfigJson));
40
+ await this.fs.write(this.tsconfig.tsconfigFilePath, JSON.stringify(this.tsconfig.tsconfigJson, null, 2));
45
41
  }
46
42
  }
47
43
  }];
@@ -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 skipConfigResolution: true,\n presets: [\n \"@babel/preset-typescript\",\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: [\n \"@alloy-js/core\",\n \"@alloy-js/typescript\",\n \"@alloy-js/json\",\n \"@alloy-js/markdown\"\n ]\n }\n };\n },\n async configResolved() {\n this.debug(\"Ensuring TypeScript configuration is set up for Alloy-js.\");\n\n if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== \"preserve\") {\n this.tsconfig.tsconfigJson.compilerOptions ??= {};\n this.tsconfig.tsconfigJson.compilerOptions.jsx = \"preserve\";\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":";;;;;;;;;;;AA2BA,MAAE,UAAA,UAAA,EAAA,KAAA;AACF,QAAA,CAAA,OAAA,EAAA;;EAEE,SAAA;AACC,QAAQ,MAAC,6DAAqB;AAChC,UAAA;IACG,OAAM;KACN,YAAU;KACZ,GAAA;KACK;IACL,OAAS;KACV,sBAAA;KACS,SAAC,CAAA,4BAAsB;MAAA;MAAA,EAAA;OAAA,GAAA,OAAA,kBAAA,GAAA,KAAA,SAAA,kBAAA,GAAA,KAAA;MAAA,CAAA;KAC5B;IACG,QAAC,EACC,cAAC,EACP,WAAA,EACS,KAAM,YACN,EACL,EACC;IACD,SAAC;;;;;OAED;IACD;;EAEH,MAAM,iBAAK;AACT,QAAK,MAAA,4DAAA;AACL,OAAI,KAAK,SAAE,aAAA,iBAAA,QAAA,YAAA;AACT,SAAI,SAAA,aAAsB,oBAAI,EAAA;AAC9B,SAAI,SAAS,aAAA,gBAAA,MAAA;AACb,UAAM,KAAE,GAAM,MAAM,KAAC,SAAW,kBAAA,UAAA,UAAA,KAAA,SAAA,aAAA,CAAA;;;EAGrC,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 babel from \"@powerlines/plugin-babel\";\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 ...options\n },\n babel: {\n skipConfigResolution: true,\n presets: [\n \"@babel/preset-typescript\",\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: [\n \"@alloy-js/core\",\n \"@alloy-js/typescript\",\n \"@alloy-js/json\",\n \"@alloy-js/markdown\"\n ]\n }\n };\n },\n async configResolved() {\n this.debug(\"Ensuring TypeScript configuration is set up for Alloy-js.\");\n\n if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== \"preserve\") {\n this.tsconfig.tsconfigJson.compilerOptions ??= {};\n this.tsconfig.tsconfigJson.compilerOptions.jsx = \"preserve\";\n\n await this.fs.write(\n this.tsconfig.tsconfigFilePath,\n JSON.stringify(this.tsconfig.tsconfigJson, null, 2)\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;AA0BA,MAAE,UAAA,UAAA,CAAA,MAAA;CACF,OAAA,CAAA,MAAA,GAAA;;EAEE,SAAA;GACC,KAAQ,MAAC,4DAAqB;GAChC,OAAA;IACG,OAAM,EACN,GAAS,QACX;IACK,OAAM;KACH,sBAAS;KAClB,SAAA,CAAA,4BAAA;MAAA;MAAA,CAAA;OAAA,GAAA,OAAA,kBAAA,EAAA,MAAA,SAAA,kBAAA,EAAA,MAAA;KAAA,CAAA;IACC;IACG,QAAA,EACI,cAAA,EACE,WAAA,EACP,KAAA,WACQ,EACN,EACE;IACA,SAAG,EACF,UAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAEH;EACF;EACA,MAAM,iBAAK;GACT,KAAK,MAAA,2DAAA;GACL,IAAI,KAAK,SAAE,aAAA,iBAAA,QAAA,YAAA;IACT,KAAI,SAAA,aAAsB,oBAAI,CAAA;IAC9B,KAAI,SAAS,aAAA,gBAAA,MAAA;IACb,MAAM,KAAE,GAAM,MAAM,KAAC,SAAW,kBAAA,KAAA,UAAA,KAAA,SAAA,cAAA,MAAA,CAAA,CAAA;GAClC;EACF;CACF,CAAC;AACH"}
@@ -1,5 +1,3 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
-
3
1
  //#region src/markdown/components/front-matter.d.ts
4
2
  interface FrontMatterProps {
5
3
  data: Record<string, any>;
@@ -9,7 +7,7 @@ interface FrontMatterProps {
9
7
  *
10
8
  * @see https://jekyllrb.com/docs/front-matter/
11
9
  */
12
- declare function FrontMatter(props: FrontMatterProps): _$_alloy_js_core0.Children;
10
+ declare function FrontMatter(props: FrontMatterProps): import("@alloy-js/core").Children;
13
11
  //#endregion
14
12
  export { FrontMatter, FrontMatterProps };
15
13
  //# sourceMappingURL=front-matter.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"front-matter.d.cts","names":[],"sources":["../../../src/markdown/components/front-matter.tsx"],"mappings":";;;UAoBiB,gBAAA;EACf,IAAA,EAAM,MAAA;AAAA;AADR;;;;;AAAA,iBASgB,WAAA,CAAY,KAAA,EAAO,gBAAA,GAAgB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"front-matter.d.cts","names":[],"sources":["../../../src/markdown/components/front-matter.tsx"],"mappings":";UAoBiB,gBAAA;EACf,IAAA,EAAM,MAAM;AAAA;;;AAAA;AAQd;;iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
@@ -1,5 +1,3 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
-
3
1
  //#region src/markdown/components/front-matter.d.ts
4
2
  interface FrontMatterProps {
5
3
  data: Record<string, any>;
@@ -9,7 +7,7 @@ interface FrontMatterProps {
9
7
  *
10
8
  * @see https://jekyllrb.com/docs/front-matter/
11
9
  */
12
- declare function FrontMatter(props: FrontMatterProps): _$_alloy_js_core0.Children;
10
+ declare function FrontMatter(props: FrontMatterProps): import("@alloy-js/core").Children;
13
11
  //#endregion
14
12
  export { FrontMatter, FrontMatterProps };
15
13
  //# sourceMappingURL=front-matter.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"front-matter.d.mts","names":[],"sources":["../../../src/markdown/components/front-matter.tsx"],"mappings":";;;UAoBiB,gBAAA;EACf,IAAA,EAAM,MAAA;AAAA;AADR;;;;;AAAA,iBASgB,WAAA,CAAY,KAAA,EAAO,gBAAA,GAAgB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"front-matter.d.mts","names":[],"sources":["../../../src/markdown/components/front-matter.tsx"],"mappings":";UAoBiB,gBAAA;EACf,IAAA,EAAM,MAAM;AAAA;;;AAAA;AAQd;;iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"front-matter.mjs","names":[],"sources":["../../../src/markdown/components/front-matter.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For } from \"@alloy-js/core\";\n\nexport interface FrontMatterProps {\n data: Record<string, any>;\n}\n\n/**\n * Renders YAML front matter for a markdown file.\n *\n * @see https://jekyllrb.com/docs/front-matter/\n */\nexport function FrontMatter(props: FrontMatterProps) {\n return (\n <>\n {\"---\"}\n <hbr />\n <For each={Object.entries(props.data)} hardline>\n {([key, value]) => code`${key}: ${JSON.stringify(value)}`}\n </For>\n {\"---\"}\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAyBA,SAAgB,YAAY,OAAO;AAClC,QAAA;EAAA;EAAA,gBAAA,OAAA,EAAA,CAAA;EAAA,gBAAA,KAAA;GACG,IAAI,OAAO;AACb,WAAA,OAAA,QAAA,MAAA,KAAA;;GAEA,UAAO;GACL,WAAC,CAAA,KAAA,WAAA,IAAA,GAAA,IAAA,IAAA,KAAA,UAAA,MAAA;GACF,CAAC;EAAE;EAAM,gBAAA,OAAA,EAAA,CAAA;EAAA"}
1
+ {"version":3,"file":"front-matter.mjs","names":[],"sources":["../../../src/markdown/components/front-matter.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For } from \"@alloy-js/core\";\n\nexport interface FrontMatterProps {\n data: Record<string, any>;\n}\n\n/**\n * Renders YAML front matter for a markdown file.\n *\n * @see https://jekyllrb.com/docs/front-matter/\n */\nexport function FrontMatter(props: FrontMatterProps) {\n return (\n <>\n {\"---\"}\n <hbr />\n <For each={Object.entries(props.data)} hardline>\n {([key, value]) => code`${key}: ${JSON.stringify(value)}`}\n </For>\n {\"---\"}\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAyBA,SAAgB,YAAY,OAAO;CAClC,OAAA;EAAA;EAAA,gBAAA,OAAA,CAAA,CAAA;EAAA,gBAAA,KAAA;GACG,IAAI,OAAO;IACb,OAAA,OAAA,QAAA,MAAA,IAAA;GACF;GACE,UAAO;GACL,WAAC,CAAA,KAAA,WAAA,IAAA,GAAA,IAAA,IAAA,KAAA,UAAA,KAAA;EACH,CAAC;EAAG;EAAM,gBAAA,OAAA,CAAA,CAAA;CAAA;AACZ"}
@@ -1,4 +1,3 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
1
  import { HeadingProps as HeadingProps$1 } from "@alloy-js/markdown";
3
2
 
4
3
  //#region src/markdown/components/heading.d.ts
@@ -13,7 +12,7 @@ interface HeadingProps extends HeadingProps$1 {}
13
12
  * <Heading level={1}>This is a heading</Heading>
14
13
  * ```
15
14
  */
16
- declare function Heading(props: HeadingProps): _$_alloy_js_core0.Children;
15
+ declare function Heading(props: HeadingProps): import("@alloy-js/core").Children;
17
16
  //#endregion
18
17
  export { Heading, HeadingProps };
19
18
  //# sourceMappingURL=heading.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"heading.d.cts","names":[],"sources":["../../../src/markdown/components/heading.tsx"],"mappings":";;;;UAsBiB,YAAA,SAAqB,cAAA;;AAAtC;;;;;AAYA;;;;iBAAgB,OAAA,CAAQ,KAAA,EAAO,YAAA,GAAY,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"heading.d.cts","names":[],"sources":["../../../src/markdown/components/heading.tsx"],"mappings":";;;UAsBiB,YAAA,SAAqB,cAAgB;AAAtD;;;;AAAsD;AAYtD;;;;;AAZA,iBAYgB,OAAA,CAAQ,KAAA,EAAO,YAAY,4BAAA,QAAA"}
@@ -1,4 +1,3 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
1
  import { HeadingProps as HeadingProps$1 } from "@alloy-js/markdown";
3
2
 
4
3
  //#region src/markdown/components/heading.d.ts
@@ -13,7 +12,7 @@ interface HeadingProps extends HeadingProps$1 {}
13
12
  * <Heading level={1}>This is a heading</Heading>
14
13
  * ```
15
14
  */
16
- declare function Heading(props: HeadingProps): _$_alloy_js_core0.Children;
15
+ declare function Heading(props: HeadingProps): import("@alloy-js/core").Children;
17
16
  //#endregion
18
17
  export { Heading, HeadingProps };
19
18
  //# sourceMappingURL=heading.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"heading.d.mts","names":[],"sources":["../../../src/markdown/components/heading.tsx"],"mappings":";;;;UAsBiB,YAAA,SAAqB,cAAA;;AAAtC;;;;;AAYA;;;;iBAAgB,OAAA,CAAQ,KAAA,EAAO,YAAA,GAAY,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"heading.d.mts","names":[],"sources":["../../../src/markdown/components/heading.tsx"],"mappings":";;;UAsBiB,YAAA,SAAqB,cAAgB;AAAtD;;;;AAAsD;AAYtD;;;;;AAZA,iBAYgB,OAAA,CAAQ,KAAA,EAAO,YAAY,4BAAA,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"heading.mjs","names":[],"sources":["../../../src/markdown/components/heading.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 type { HeadingProps as BaseHeadingProps } from \"@alloy-js/markdown\";\nimport { Heading as BaseHeading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"../../core/components/spacing\";\n\nexport interface HeadingProps extends BaseHeadingProps {}\n\n/**\n * Renders a heading for a markdown file.\n *\n * @see https://www.markdownguide.org/basic-syntax/#headings\n *\n * @example\n * ```tsx\n * <Heading level={1}>This is a heading</Heading>\n * ```\n */\nexport function Heading(props: HeadingProps) {\n const { children, ...rest } = props;\n\n return (\n <>\n <BaseHeading level={1} {...rest}>\n {children}\n </BaseHeading>\n <Spacing />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+BA,SAAY,QAAU,OAAS;CAC7B,MAAG,EACH,UACF,GAAO,SACL;iDAEA,OAAO,GACN,EAAE,MAAA,EACE,UACJ,CAAC,CAAC,EAAE,gBAAU,SAAA,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"heading.mjs","names":[],"sources":["../../../src/markdown/components/heading.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 type { HeadingProps as BaseHeadingProps } from \"@alloy-js/markdown\";\nimport { Heading as BaseHeading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"../../core/components/spacing\";\n\nexport interface HeadingProps extends BaseHeadingProps {}\n\n/**\n * Renders a heading for a markdown file.\n *\n * @see https://www.markdownguide.org/basic-syntax/#headings\n *\n * @example\n * ```tsx\n * <Heading level={1}>This is a heading</Heading>\n * ```\n */\nexport function Heading(props: HeadingProps) {\n const { children, ...rest } = props;\n\n return (\n <>\n <BaseHeading level={1} {...rest}>\n {children}\n </BaseHeading>\n <Spacing />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+BA,SAAY,QAAU,OAAS;CAC7B,MAAG,EACH,UACF,GAAO,SACL;iDAEA,OAAO,EACP,GAAG,MAAA,EACE,SACL,CAAC,CAAC,GAAG,gBAAU,SAAA,CAAA,CAAA,CAAA;AACjB"}