@powerlines/plugin-alloy 0.26.75 → 0.26.77

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 (164) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -1
  2. package/dist/core/components/index.cjs +12 -1
  3. package/dist/core/components/index.mjs +7 -1
  4. package/dist/core/components/infrastructure-file.cjs +48 -1
  5. package/dist/core/components/infrastructure-file.mjs +45 -1
  6. package/dist/core/components/infrastructure-file.mjs.map +1 -1
  7. package/dist/core/components/output.cjs +41 -1
  8. package/dist/core/components/output.mjs +39 -1
  9. package/dist/core/components/output.mjs.map +1 -1
  10. package/dist/core/components/single-line-comment.cjs +23 -1
  11. package/dist/core/components/single-line-comment.mjs +21 -1
  12. package/dist/core/components/single-line-comment.mjs.map +1 -1
  13. package/dist/core/components/source-file.cjs +64 -1
  14. package/dist/core/components/source-file.mjs +61 -1
  15. package/dist/core/components/source-file.mjs.map +1 -1
  16. package/dist/core/components/spacing.cjs +20 -1
  17. package/dist/core/components/spacing.mjs +18 -1
  18. package/dist/core/components/spacing.mjs.map +1 -1
  19. package/dist/core/contexts/context.cjs +41 -1
  20. package/dist/core/contexts/context.mjs +36 -1
  21. package/dist/core/contexts/context.mjs.map +1 -1
  22. package/dist/core/contexts/index.cjs +22 -1
  23. package/dist/core/contexts/index.mjs +5 -1
  24. package/dist/core/contexts/meta.cjs +41 -1
  25. package/dist/core/contexts/meta.mjs +36 -1
  26. package/dist/core/contexts/meta.mjs.map +1 -1
  27. package/dist/core/contexts/reflection.cjs +80 -1
  28. package/dist/core/contexts/reflection.mjs +70 -1
  29. package/dist/core/contexts/reflection.mjs.map +1 -1
  30. package/dist/core/helpers/code.cjs +34 -1
  31. package/dist/core/helpers/code.mjs +32 -1
  32. package/dist/core/helpers/code.mjs.map +1 -1
  33. package/dist/core/helpers/index.cjs +4 -1
  34. package/dist/core/helpers/index.mjs +3 -1
  35. package/dist/core/index.cjs +37 -1
  36. package/dist/core/index.mjs +14 -1
  37. package/dist/hcl/components/block-declaration.cjs +34 -1
  38. package/dist/hcl/components/block-declaration.mjs +32 -1
  39. package/dist/hcl/components/block-declaration.mjs.map +1 -1
  40. package/dist/hcl/components/hcl-file.cjs +83 -1
  41. package/dist/hcl/components/hcl-file.mjs +80 -1
  42. package/dist/hcl/components/hcl-file.mjs.map +1 -1
  43. package/dist/hcl/components/index.cjs +11 -1
  44. package/dist/hcl/components/index.mjs +6 -1
  45. package/dist/hcl/components/packer-file.cjs +29 -1
  46. package/dist/hcl/components/packer-file.mjs +27 -1
  47. package/dist/hcl/components/packer-file.mjs.map +1 -1
  48. package/dist/hcl/components/terraform-file.cjs +30 -1
  49. package/dist/hcl/components/terraform-file.mjs +28 -1
  50. package/dist/hcl/components/terraform-file.mjs.map +1 -1
  51. package/dist/hcl/index.cjs +12 -1
  52. package/dist/hcl/index.mjs +7 -1
  53. package/dist/helpers/capnp.cjs +245 -37
  54. package/dist/helpers/capnp.mjs +227 -37
  55. package/dist/helpers/capnp.mjs.map +1 -1
  56. package/dist/helpers/create-builtin.cjs +20 -1
  57. package/dist/helpers/create-builtin.mjs +18 -1
  58. package/dist/helpers/create-builtin.mjs.map +1 -1
  59. package/dist/helpers/index.cjs +25 -1
  60. package/dist/helpers/index.mjs +6 -1
  61. package/dist/helpers/refkey.cjs +17 -1
  62. package/dist/helpers/refkey.mjs +15 -1
  63. package/dist/helpers/refkey.mjs.map +1 -1
  64. package/dist/helpers/typescript.cjs +43 -19
  65. package/dist/helpers/typescript.mjs +41 -19
  66. package/dist/helpers/typescript.mjs.map +1 -1
  67. package/dist/index.cjs +55 -1
  68. package/dist/index.mjs +51 -1
  69. package/dist/index.mjs.map +1 -1
  70. package/dist/markdown/components/front-matter.cjs +29 -1
  71. package/dist/markdown/components/front-matter.mjs +27 -1
  72. package/dist/markdown/components/front-matter.mjs.map +1 -1
  73. package/dist/markdown/components/heading.cjs +24 -1
  74. package/dist/markdown/components/heading.mjs +22 -1
  75. package/dist/markdown/components/heading.mjs.map +1 -1
  76. package/dist/markdown/components/index.cjs +13 -1
  77. package/dist/markdown/components/index.mjs +6 -1
  78. package/dist/markdown/components/markdown-file.cjs +135 -1
  79. package/dist/markdown/components/markdown-file.mjs +132 -1
  80. package/dist/markdown/components/markdown-file.mjs.map +1 -1
  81. package/dist/markdown/components/markdown-table.cjs +102 -1
  82. package/dist/markdown/components/markdown-table.mjs +98 -1
  83. package/dist/markdown/components/markdown-table.mjs.map +1 -1
  84. package/dist/markdown/contexts/index.cjs +7 -1
  85. package/dist/markdown/contexts/index.mjs +3 -1
  86. package/dist/markdown/contexts/markdown-table.cjs +38 -1
  87. package/dist/markdown/contexts/markdown-table.mjs +33 -1
  88. package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
  89. package/dist/markdown/index.cjs +20 -1
  90. package/dist/markdown/index.mjs +9 -1
  91. package/dist/render.cjs +91 -1
  92. package/dist/render.mjs +88 -1
  93. package/dist/render.mjs.map +1 -1
  94. package/dist/types/components.cjs +9 -0
  95. package/dist/types/components.mjs +9 -1
  96. package/dist/types/index.mjs +1 -1
  97. package/dist/types/plugin.mjs +1 -1
  98. package/dist/typescript/components/builtin-file.cjs +63 -1
  99. package/dist/typescript/components/builtin-file.mjs +61 -1
  100. package/dist/typescript/components/builtin-file.mjs.map +1 -1
  101. package/dist/typescript/components/class-declaration.cjs +306 -1
  102. package/dist/typescript/components/class-declaration.mjs +299 -1
  103. package/dist/typescript/components/class-declaration.mjs.map +1 -1
  104. package/dist/typescript/components/dynamic-import-statement.cjs +26 -1
  105. package/dist/typescript/components/dynamic-import-statement.mjs +24 -1
  106. package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
  107. package/dist/typescript/components/entry-file.cjs +43 -1
  108. package/dist/typescript/components/entry-file.mjs +40 -1
  109. package/dist/typescript/components/entry-file.mjs.map +1 -1
  110. package/dist/typescript/components/index.cjs +64 -1
  111. package/dist/typescript/components/index.mjs +15 -1
  112. package/dist/typescript/components/interface-declaration.cjs +239 -1
  113. package/dist/typescript/components/interface-declaration.mjs +234 -1
  114. package/dist/typescript/components/interface-declaration.mjs.map +1 -1
  115. package/dist/typescript/components/object-declaration.cjs +139 -1
  116. package/dist/typescript/components/object-declaration.mjs +136 -1
  117. package/dist/typescript/components/object-declaration.mjs.map +1 -1
  118. package/dist/typescript/components/property-name.cjs +32 -1
  119. package/dist/typescript/components/property-name.mjs +30 -1
  120. package/dist/typescript/components/property-name.mjs.map +1 -1
  121. package/dist/typescript/components/record-expression.cjs +13 -3
  122. package/dist/typescript/components/record-expression.mjs +11 -3
  123. package/dist/typescript/components/record-expression.mjs.map +1 -1
  124. package/dist/typescript/components/tsdoc-reflection.cjs +331 -1
  125. package/dist/typescript/components/tsdoc-reflection.mjs +324 -1
  126. package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
  127. package/dist/typescript/components/tsdoc.cjs +497 -1
  128. package/dist/typescript/components/tsdoc.mjs +475 -1
  129. package/dist/typescript/components/tsdoc.mjs.map +1 -1
  130. package/dist/typescript/components/type-declaration.cjs +39 -1
  131. package/dist/typescript/components/type-declaration.mjs +37 -1
  132. package/dist/typescript/components/type-declaration.mjs.map +1 -1
  133. package/dist/typescript/components/type-parameters.cjs +83 -1
  134. package/dist/typescript/components/type-parameters.mjs +81 -1
  135. package/dist/typescript/components/type-parameters.mjs.map +1 -1
  136. package/dist/typescript/components/typescript-file.cjs +221 -1
  137. package/dist/typescript/components/typescript-file.mjs +217 -1
  138. package/dist/typescript/components/typescript-file.mjs.map +1 -1
  139. package/dist/typescript/contexts/index.cjs +4 -1
  140. package/dist/typescript/contexts/index.mjs +3 -1
  141. package/dist/typescript/contexts/lexical-scope.cjs +26 -1
  142. package/dist/typescript/contexts/lexical-scope.mjs +24 -1
  143. package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
  144. package/dist/typescript/contexts/member-scope.cjs +24 -1
  145. package/dist/typescript/contexts/member-scope.mjs +22 -1
  146. package/dist/typescript/contexts/member-scope.mjs.map +1 -1
  147. package/dist/typescript/helpers/get-call-signature-props.cjs +26 -1
  148. package/dist/typescript/helpers/get-call-signature-props.mjs +24 -1
  149. package/dist/typescript/helpers/get-call-signature-props.mjs.map +1 -1
  150. package/dist/typescript/helpers/index.cjs +6 -1
  151. package/dist/typescript/helpers/index.mjs +4 -1
  152. package/dist/typescript/helpers/utilities.cjs +15 -1
  153. package/dist/typescript/helpers/utilities.mjs +13 -1
  154. package/dist/typescript/helpers/utilities.mjs.map +1 -1
  155. package/dist/typescript/index.cjs +73 -1
  156. package/dist/typescript/index.mjs +21 -1
  157. package/dist/yaml/components/index.cjs +5 -1
  158. package/dist/yaml/components/index.mjs +3 -1
  159. package/dist/yaml/components/yaml-file.cjs +149 -1
  160. package/dist/yaml/components/yaml-file.mjs +146 -1
  161. package/dist/yaml/components/yaml-file.mjs.map +1 -1
  162. package/dist/yaml/index.cjs +6 -1
  163. package/dist/yaml/index.mjs +4 -1
  164. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-table.mjs","names":[],"sources":["../../../src/markdown/contexts/markdown-table.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createContext, createNamedContext, useContext } from \"@alloy-js/core\";\n\nexport interface MarkdownTableColumnContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n index: number;\n name: keyof T;\n align: \"left\" | \"right\" | \"center\";\n width: number;\n}\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const MarkdownTableColumnContext: ComponentContext<MarkdownTableColumnContextInterface> =\n createNamedContext<MarkdownTableColumnContextInterface>(\n \"MarkdownTableColumn\",\n {} as MarkdownTableColumnContextInterface\n );\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMarkdownTableColumn() {\n return useContext<MarkdownTableColumnContextInterface>(\n MarkdownTableColumnContext\n );\n}\n\nexport interface MarkdownTableContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n columns: MarkdownTableColumnContextInterface<T>[];\n data: T[];\n}\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const MarkdownTableContext: ComponentContext<MarkdownTableContextInterface> =\n createContext<MarkdownTableContextInterface>({\n columns: [],\n data: []\n });\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMarkdownTable() {\n return useContext<MarkdownTableContextInterface>(MarkdownTableContext);\n}\n"],"mappings":"uFAsBA,MAAY,EAA6B,EAAW,sBAAA,EAAA,CAAA,cAQlD,OAAA,EAAA,EAAA,CAKF,MAAK,EAAoB,EAAA,CACvB,QAAQ,EAAA,CACR,KAAC,EAAA,GAQH,SAAS,GAAW,CAClB,OAAE,EAAA,EAAA"}
1
+ {"version":3,"file":"markdown-table.mjs","names":[],"sources":["../../../src/markdown/contexts/markdown-table.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createContext, createNamedContext, useContext } from \"@alloy-js/core\";\n\nexport interface MarkdownTableColumnContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n index: number;\n name: keyof T;\n align: \"left\" | \"right\" | \"center\";\n width: number;\n}\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const MarkdownTableColumnContext: ComponentContext<MarkdownTableColumnContextInterface> =\n createNamedContext<MarkdownTableColumnContextInterface>(\n \"MarkdownTableColumn\",\n {} as MarkdownTableColumnContextInterface\n );\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMarkdownTableColumn() {\n return useContext<MarkdownTableColumnContextInterface>(\n MarkdownTableColumnContext\n );\n}\n\nexport interface MarkdownTableContextInterface<\n T extends Record<string, any> = Record<string, any>\n> {\n columns: MarkdownTableColumnContextInterface<T>[];\n data: T[];\n}\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const MarkdownTableContext: ComponentContext<MarkdownTableContextInterface> =\n createContext<MarkdownTableContextInterface>({\n columns: [],\n data: []\n });\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMarkdownTable() {\n return useContext<MarkdownTableContextInterface>(MarkdownTableContext);\n}\n"],"mappings":";;;;;;AAsBA,MAAY,6BAA6B,mBAAW,uBAAA,EAAA,CAAA;;;;;;;AAQlD,QAAA,WAAA,2BAAA;;;;;AAKF,MAAK,uBAAoB,cAAA;CACvB,SAAQ,EAAA;CACR,MAAC,EAAA;;;;;;;AAQH,SAAS,mBAAW;AAClB,QAAE,WAAA,qBAAA"}
@@ -1 +1,20 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./components/front-matter.cjs`),t=require(`./components/heading.cjs`),n=require(`./components/markdown-file.cjs`),r=require(`./contexts/markdown-table.cjs`),i=require(`./components/markdown-table.cjs`);require(`./components/index.cjs`),require(`./contexts/index.cjs`),exports.FrontMatter=e.FrontMatter,exports.Heading=t.Heading,exports.MarkdownFile=n.MarkdownFile,exports.MarkdownFileHeader=n.MarkdownFileHeader,exports.MarkdownTable=i.MarkdownTable,exports.MarkdownTableColumn=i.MarkdownTableColumn,exports.MarkdownTableColumnContext=r.MarkdownTableColumnContext,exports.MarkdownTableColumnHeader=i.MarkdownTableColumnHeader,exports.MarkdownTableContext=r.MarkdownTableContext,exports.useMarkdownTable=r.useMarkdownTable,exports.useMarkdownTableColumn=r.useMarkdownTableColumn;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_markdown_components_front_matter = require('./components/front-matter.cjs');
3
+ const require_markdown_components_heading = require('./components/heading.cjs');
4
+ const require_markdown_components_markdown_file = require('./components/markdown-file.cjs');
5
+ const require_markdown_contexts_markdown_table = require('./contexts/markdown-table.cjs');
6
+ const require_markdown_components_markdown_table = require('./components/markdown-table.cjs');
7
+ require('./components/index.cjs');
8
+ require('./contexts/index.cjs');
9
+
10
+ exports.FrontMatter = require_markdown_components_front_matter.FrontMatter;
11
+ exports.Heading = require_markdown_components_heading.Heading;
12
+ exports.MarkdownFile = require_markdown_components_markdown_file.MarkdownFile;
13
+ exports.MarkdownFileHeader = require_markdown_components_markdown_file.MarkdownFileHeader;
14
+ exports.MarkdownTable = require_markdown_components_markdown_table.MarkdownTable;
15
+ exports.MarkdownTableColumn = require_markdown_components_markdown_table.MarkdownTableColumn;
16
+ exports.MarkdownTableColumnContext = require_markdown_contexts_markdown_table.MarkdownTableColumnContext;
17
+ exports.MarkdownTableColumnHeader = require_markdown_components_markdown_table.MarkdownTableColumnHeader;
18
+ exports.MarkdownTableContext = require_markdown_contexts_markdown_table.MarkdownTableContext;
19
+ exports.useMarkdownTable = require_markdown_contexts_markdown_table.useMarkdownTable;
20
+ exports.useMarkdownTableColumn = require_markdown_contexts_markdown_table.useMarkdownTableColumn;
@@ -1 +1,9 @@
1
- import{FrontMatter as e}from"./components/front-matter.mjs";import{Heading as t}from"./components/heading.mjs";import{MarkdownFile as n,MarkdownFileHeader as r}from"./components/markdown-file.mjs";import{MarkdownTableColumnContext as i,MarkdownTableContext as a,useMarkdownTable as o,useMarkdownTableColumn as s}from"./contexts/markdown-table.mjs";import{MarkdownTable as c,MarkdownTableColumn as l,MarkdownTableColumnHeader as u}from"./components/markdown-table.mjs";import"./components/index.mjs";import"./contexts/index.mjs";export{e as FrontMatter,t as Heading,n as MarkdownFile,r as MarkdownFileHeader,c as MarkdownTable,l as MarkdownTableColumn,i as MarkdownTableColumnContext,u as MarkdownTableColumnHeader,a as MarkdownTableContext,o as useMarkdownTable,s as useMarkdownTableColumn};
1
+ import { FrontMatter } from "./components/front-matter.mjs";
2
+ import { Heading } from "./components/heading.mjs";
3
+ import { MarkdownFile, MarkdownFileHeader } from "./components/markdown-file.mjs";
4
+ import { MarkdownTableColumnContext, MarkdownTableContext, useMarkdownTable, useMarkdownTableColumn } from "./contexts/markdown-table.mjs";
5
+ import { MarkdownTable, MarkdownTableColumn, MarkdownTableColumnHeader } from "./components/markdown-table.mjs";
6
+ import "./components/index.mjs";
7
+ import "./contexts/index.mjs";
8
+
9
+ export { FrontMatter, Heading, MarkdownFile, MarkdownFileHeader, MarkdownTable, MarkdownTableColumn, MarkdownTableColumnContext, MarkdownTableColumnHeader, MarkdownTableContext, useMarkdownTable, useMarkdownTableColumn };
package/dist/render.cjs CHANGED
@@ -1 +1,91 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./core/components/output.cjs`);require(`./core/index.cjs`);let t=require(`@stryke/path/file-path-fns`),n=require(`@alloy-js/core/jsx-runtime`),r=require(`@alloy-js/core`);async function i(i,a){let o={},s=await(0,r.renderAsync)((0,n.createComponent)(e.Output,{context:i,meta:o,children:a}));Object.keys(s).length?(i.debug(`Processing ${Object.keys(s).length} rendered output files from Alloy-js component templates.`),await(0,r.traverseOutput)(s,{visitDirectory:e=>{i.fs.existsSync(e.path)||i.fs.mkdirSync(e.path)},visitFile:e=>{if(`contents`in e){let n=o[e.path]??{};if(n.kind===`builtin`){if(!n.id)throw Error(`Built-in file "${e.path}" is missing its ID in the render metadata.`);i.emitBuiltinSync(e.contents,n.id,{skipFormat:n.skipFormat,storage:n.storage,extension:(0,t.findFileExtension)(e.path)})}else if(n.kind===`entry`)i.emitEntrySync(e.contents,e.path,{skipFormat:n.skipFormat,storage:n.storage,...n.typeDefinition??{}});else if(n.kind===`infrastructure`){if(!n.id)throw Error(`Infrastructure file "${e.path}" is missing its ID in the render metadata.`);i.emitInfrastructureSync(e.contents,n.id,{skipFormat:n.skipFormat,storage:n.storage,extension:(0,t.findFileExtension)(e.path)})}else i.emitSync(e.contents,e.path,n)}else i.fs.copySync(e.sourcePath,e.path)}})):i.debug(`No output files were rendered by Alloy-js component templates.`)}function a(t,i,a){return(0,r.printTree)((0,r.renderTree)((0,n.createComponent)(e.Output,{context:t,children:i})),a)}exports.render=i,exports.renderString=a;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_core_components_output = require('./core/components/output.cjs');
4
+ require('./core/index.cjs');
5
+ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
6
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
7
+ let _alloy_js_core = require("@alloy-js/core");
8
+
9
+ //#region src/render.tsx
10
+ /**
11
+ * A function to render children components within the [Alloy](https://alloy-framework.github.io) context, and write any saved content to the file system.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * import { render } from "@powerlines/plugin-alloy/render";
16
+ *
17
+ * await render(context, <> ... </>);
18
+ * ```
19
+ *
20
+ * @param context - The Powerlines plugin context.
21
+ * @param children - The children components to render.
22
+ * @returns A promise that resolves when rendering is complete.
23
+ */
24
+ async function render(context, children) {
25
+ const meta = {};
26
+ const output = await (0, _alloy_js_core.renderAsync)((0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_output.Output, {
27
+ context,
28
+ meta,
29
+ children
30
+ }));
31
+ if (!Object.keys(output).length) context.debug("No output files were rendered by Alloy-js component templates.");
32
+ else {
33
+ context.debug(`Processing ${Object.keys(output).length} rendered output files from Alloy-js component templates.`);
34
+ await (0, _alloy_js_core.traverseOutput)(output, {
35
+ visitDirectory: (directory) => {
36
+ if (context.fs.existsSync(directory.path)) return;
37
+ context.fs.mkdirSync(directory.path);
38
+ },
39
+ visitFile: (file) => {
40
+ if ("contents" in file) {
41
+ const metadata = meta[file.path] ?? {};
42
+ if (metadata.kind === "builtin") {
43
+ if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
44
+ context.emitBuiltinSync(file.contents, metadata.id, {
45
+ skipFormat: metadata.skipFormat,
46
+ storage: metadata.storage,
47
+ extension: (0, _stryke_path_file_path_fns.findFileExtension)(file.path)
48
+ });
49
+ } else if (metadata.kind === "entry") context.emitEntrySync(file.contents, file.path, {
50
+ skipFormat: metadata.skipFormat,
51
+ storage: metadata.storage,
52
+ ...metadata.typeDefinition ?? {}
53
+ });
54
+ else if (metadata.kind === "infrastructure") {
55
+ if (!metadata.id) throw new Error(`Infrastructure file "${file.path}" is missing its ID in the render metadata.`);
56
+ context.emitInfrastructureSync(file.contents, metadata.id, {
57
+ skipFormat: metadata.skipFormat,
58
+ storage: metadata.storage,
59
+ extension: (0, _stryke_path_file_path_fns.findFileExtension)(file.path)
60
+ });
61
+ } else context.emitSync(file.contents, file.path, metadata);
62
+ } else context.fs.copySync(file.sourcePath, file.path);
63
+ }
64
+ });
65
+ }
66
+ }
67
+ /**
68
+ * A function to render children components within the [Alloy](https://alloy-framework.github.io) context and return the rendered output as a string.
69
+ *
70
+ * @example
71
+ * ```tsx
72
+ * import { renderString } from "@powerlines/plugin-alloy/render";
73
+ *
74
+ * const output = await renderString(context, <> ... </>);
75
+ * ```
76
+ *
77
+ * @param context - The Powerlines plugin context.
78
+ * @param children - The children components to render.
79
+ * @param options - Optional print tree options.
80
+ * @returns The rendered output as a string.
81
+ */
82
+ function renderString(context, children, options) {
83
+ return (0, _alloy_js_core.printTree)((0, _alloy_js_core.renderTree)((0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_output.Output, {
84
+ context,
85
+ children
86
+ })), options);
87
+ }
88
+
89
+ //#endregion
90
+ exports.render = render;
91
+ exports.renderString = renderString;
package/dist/render.mjs CHANGED
@@ -1,2 +1,89 @@
1
- import{Output as e}from"./core/components/output.mjs";import"./core/index.mjs";import{findFileExtension as t}from"@stryke/path/file-path-fns";import{createComponent as n}from"@alloy-js/core/jsx-runtime";import{printTree as r,renderAsync as i,renderTree as a,traverseOutput as o}from"@alloy-js/core";async function s(r,a){let s={},c=await i(n(e,{context:r,meta:s,children:a}));Object.keys(c).length?(r.debug(`Processing ${Object.keys(c).length} rendered output files from Alloy-js component templates.`),await o(c,{visitDirectory:e=>{r.fs.existsSync(e.path)||r.fs.mkdirSync(e.path)},visitFile:e=>{if(`contents`in e){let n=s[e.path]??{};if(n.kind===`builtin`){if(!n.id)throw Error(`Built-in file "${e.path}" is missing its ID in the render metadata.`);r.emitBuiltinSync(e.contents,n.id,{skipFormat:n.skipFormat,storage:n.storage,extension:t(e.path)})}else if(n.kind===`entry`)r.emitEntrySync(e.contents,e.path,{skipFormat:n.skipFormat,storage:n.storage,...n.typeDefinition??{}});else if(n.kind===`infrastructure`){if(!n.id)throw Error(`Infrastructure file "${e.path}" is missing its ID in the render metadata.`);r.emitInfrastructureSync(e.contents,n.id,{skipFormat:n.skipFormat,storage:n.storage,extension:t(e.path)})}else r.emitSync(e.contents,e.path,n)}else r.fs.copySync(e.sourcePath,e.path)}})):r.debug(`No output files were rendered by Alloy-js component templates.`)}function c(t,i,o){return r(a(n(e,{context:t,children:i})),o)}export{s as render,c as renderString};
1
+ import { Output as Output$1 } from "./core/components/output.mjs";
2
+ import "./core/index.mjs";
3
+ import { findFileExtension } from "@stryke/path/file-path-fns";
4
+ import { createComponent } from "@alloy-js/core/jsx-runtime";
5
+ import { printTree, renderAsync, renderTree, traverseOutput } from "@alloy-js/core";
6
+
7
+ //#region src/render.tsx
8
+ /**
9
+ * A function to render children components within the [Alloy](https://alloy-framework.github.io) context, and write any saved content to the file system.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * import { render } from "@powerlines/plugin-alloy/render";
14
+ *
15
+ * await render(context, <> ... </>);
16
+ * ```
17
+ *
18
+ * @param context - The Powerlines plugin context.
19
+ * @param children - The children components to render.
20
+ * @returns A promise that resolves when rendering is complete.
21
+ */
22
+ async function render(context, children) {
23
+ const meta = {};
24
+ const output = await renderAsync(createComponent(Output$1, {
25
+ context,
26
+ meta,
27
+ children
28
+ }));
29
+ if (!Object.keys(output).length) context.debug("No output files were rendered by Alloy-js component templates.");
30
+ else {
31
+ context.debug(`Processing ${Object.keys(output).length} rendered output files from Alloy-js component templates.`);
32
+ await traverseOutput(output, {
33
+ visitDirectory: (directory) => {
34
+ if (context.fs.existsSync(directory.path)) return;
35
+ context.fs.mkdirSync(directory.path);
36
+ },
37
+ visitFile: (file) => {
38
+ if ("contents" in file) {
39
+ const metadata = meta[file.path] ?? {};
40
+ if (metadata.kind === "builtin") {
41
+ if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
42
+ context.emitBuiltinSync(file.contents, metadata.id, {
43
+ skipFormat: metadata.skipFormat,
44
+ storage: metadata.storage,
45
+ extension: findFileExtension(file.path)
46
+ });
47
+ } else if (metadata.kind === "entry") context.emitEntrySync(file.contents, file.path, {
48
+ skipFormat: metadata.skipFormat,
49
+ storage: metadata.storage,
50
+ ...metadata.typeDefinition ?? {}
51
+ });
52
+ else if (metadata.kind === "infrastructure") {
53
+ if (!metadata.id) throw new Error(`Infrastructure file "${file.path}" is missing its ID in the render metadata.`);
54
+ context.emitInfrastructureSync(file.contents, metadata.id, {
55
+ skipFormat: metadata.skipFormat,
56
+ storage: metadata.storage,
57
+ extension: findFileExtension(file.path)
58
+ });
59
+ } else context.emitSync(file.contents, file.path, metadata);
60
+ } else context.fs.copySync(file.sourcePath, file.path);
61
+ }
62
+ });
63
+ }
64
+ }
65
+ /**
66
+ * A function to render children components within the [Alloy](https://alloy-framework.github.io) context and return the rendered output as a string.
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * import { renderString } from "@powerlines/plugin-alloy/render";
71
+ *
72
+ * const output = await renderString(context, <> ... </>);
73
+ * ```
74
+ *
75
+ * @param context - The Powerlines plugin context.
76
+ * @param children - The children components to render.
77
+ * @param options - Optional print tree options.
78
+ * @returns The rendered output as a string.
79
+ */
80
+ function renderString(context, children, options) {
81
+ return printTree(renderTree(createComponent(Output$1, {
82
+ context,
83
+ children
84
+ })), options);
85
+ }
86
+
87
+ //#endregion
88
+ export { render, renderString };
2
89
  //# sourceMappingURL=render.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.mjs","names":[],"sources":["../src/render.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Children,\n printTree,\n PrintTreeOptions,\n renderAsync,\n renderTree,\n traverseOutput\n} from \"@alloy-js/core\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { PluginContext } from \"powerlines\";\nimport { MetaItem, Output } from \"./core\";\n\n/**\n * A function to render children components within the [Alloy](https://alloy-framework.github.io) context, and write any saved content to the file system.\n *\n * @example\n * ```tsx\n * import { render } from \"@powerlines/plugin-alloy/render\";\n *\n * await render(context, <> ... </>);\n * ```\n *\n * @param context - The Powerlines plugin context.\n * @param children - The children components to render.\n * @returns A promise that resolves when rendering is complete.\n */\nexport async function render<TContext extends PluginContext>(\n context: TContext,\n children: Children\n) {\n const meta = {} as Record<string, MetaItem>;\n const output = await renderAsync(\n <Output<TContext> context={context} meta={meta}>\n {children}\n </Output>\n );\n\n if (!Object.keys(output).length) {\n context.debug(\n \"No output files were rendered by Alloy-js component templates.\"\n );\n } else {\n context.debug(\n `Processing ${\n Object.keys(output).length\n } rendered output files from Alloy-js component templates.`\n );\n\n await traverseOutput(output, {\n visitDirectory: directory => {\n if (context.fs.existsSync(directory.path)) {\n return;\n }\n\n context.fs.mkdirSync(directory.path);\n },\n visitFile: file => {\n if (\"contents\" in file) {\n const metadata = meta[file.path] ?? {};\n if (metadata.kind === \"builtin\") {\n if (!metadata.id) {\n throw new Error(\n `Built-in file \"${\n file.path\n }\" is missing its ID in the render metadata.`\n );\n }\n\n context.emitBuiltinSync(file.contents, metadata.id, {\n skipFormat: metadata.skipFormat,\n storage: metadata.storage,\n extension: findFileExtension(file.path)\n });\n } else if (metadata.kind === \"entry\") {\n context.emitEntrySync(file.contents, file.path, {\n skipFormat: metadata.skipFormat,\n storage: metadata.storage,\n ...(metadata.typeDefinition ?? {})\n });\n } else if (metadata.kind === \"infrastructure\") {\n if (!metadata.id) {\n throw new Error(\n `Infrastructure file \"${\n file.path\n }\" is missing its ID in the render metadata.`\n );\n }\n\n context.emitInfrastructureSync(file.contents, metadata.id, {\n skipFormat: metadata.skipFormat,\n storage: metadata.storage,\n extension: findFileExtension(file.path)\n });\n } else {\n context.emitSync(file.contents, file.path, metadata);\n }\n } else {\n context.fs.copySync(file.sourcePath, file.path);\n }\n }\n });\n }\n}\n\n/**\n * A function to render children components within the [Alloy](https://alloy-framework.github.io) context and return the rendered output as a string.\n *\n * @example\n * ```tsx\n * import { renderString } from \"@powerlines/plugin-alloy/render\";\n *\n * const output = await renderString(context, <> ... </>);\n * ```\n *\n * @param context - The Powerlines plugin context.\n * @param children - The children components to render.\n * @param options - Optional print tree options.\n * @returns The rendered output as a string.\n */\nexport function renderString<TContext extends PluginContext>(\n context: TContext,\n children: Children,\n options?: PrintTreeOptions\n) {\n const tree = renderTree(\n <Output<TContext> context={context}>{children}</Output>\n );\n\n return printTree(tree, options);\n}\n"],"mappings":"2SAsCA,eAAK,EAAA,EAAA,EAAA,CACJ,IAAA,EAAA,EAAA,CACG,EAAa,MAAM,EAAY,EAAc,EAAA,CACvC,UACN,OACF,WACF,CAAA,CAAA,CACE,OAAS,KAAQ,EAAA,CAAA,QAGjB,EAAU,MAAM,cAAU,OAAQ,KAAQ,EAAC,CAAA,OAAA,2DAAA,CAC3C,MAAM,EAAe,EAAA,CAClB,eAAiB,GAAS,CACxB,EAAQ,GAAA,WAAA,EAAA,KAAA,0BAKX,UAAa,GAAA,CACV,GAAG,aAAa,EAAK,CACvB,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,CACI,GAAA,EAAA,OAAA,UAAA,CACG,GAAA,CAAK,EAAA,GACV,MAAY,MAAA,kBAAA,EAAA,KAAA,6CAAA,CAEX,EAAS,gBAAkB,EAAM,SAAG,EAAU,GAAU,CAC3D,WAAA,EAAA,6BAEK,UAAe,EAAQ,EAAA,KAAA,CAC3B,CAAA,SACc,EAAG,OAAW,QACxB,EAAM,cAAA,EAAA,SAAA,EAAA,KAAA,CACR,WAAA,EAAA,6BAEA,GAAU,EAAC,gBAAyB,EAAA,CACrC,CAAA,SACc,EAAI,OAAA,iBAAA,CACb,GAAC,CAAA,EAAa,GAChB,MAAc,MAAG,wBAAqB,EAAA,KAAA,6CAAA,CAEpC,EAAK,uBAAa,EAAA,SAAA,EAAA,GAAA,CAChB,WAAU,EAAK,WACf,QAAS,EAAS,QAClB,UAAS,EAAA,EAAA,KAAA,CACV,CAAC,MAEF,EAAA,SAAA,EAAA,SAAA,EAAA,KAAA,EAAA,MAGF,EAAI,GAAA,SAAY,EAAS,WAAU,EAAA,KAAA,EAGxC,CAAC,EA5CJ,EAAU,MAAA,iEAAA,CA+DZ,SAAc,EAAW,EAAA,EAAuB,EAAI,CAKlD,OAAO,EAJK,EAAA,EAAA,EAAA,CACF,UACA,WACT,CAAC,CACW,CAAA,EAAA"}
1
+ {"version":3,"file":"render.mjs","names":[],"sources":["../src/render.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Children,\n printTree,\n PrintTreeOptions,\n renderAsync,\n renderTree,\n traverseOutput\n} from \"@alloy-js/core\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { PluginContext } from \"powerlines\";\nimport { MetaItem, Output } from \"./core\";\n\n/**\n * A function to render children components within the [Alloy](https://alloy-framework.github.io) context, and write any saved content to the file system.\n *\n * @example\n * ```tsx\n * import { render } from \"@powerlines/plugin-alloy/render\";\n *\n * await render(context, <> ... </>);\n * ```\n *\n * @param context - The Powerlines plugin context.\n * @param children - The children components to render.\n * @returns A promise that resolves when rendering is complete.\n */\nexport async function render<TContext extends PluginContext>(\n context: TContext,\n children: Children\n) {\n const meta = {} as Record<string, MetaItem>;\n const output = await renderAsync(\n <Output<TContext> context={context} meta={meta}>\n {children}\n </Output>\n );\n\n if (!Object.keys(output).length) {\n context.debug(\n \"No output files were rendered by Alloy-js component templates.\"\n );\n } else {\n context.debug(\n `Processing ${\n Object.keys(output).length\n } rendered output files from Alloy-js component templates.`\n );\n\n await traverseOutput(output, {\n visitDirectory: directory => {\n if (context.fs.existsSync(directory.path)) {\n return;\n }\n\n context.fs.mkdirSync(directory.path);\n },\n visitFile: file => {\n if (\"contents\" in file) {\n const metadata = meta[file.path] ?? {};\n if (metadata.kind === \"builtin\") {\n if (!metadata.id) {\n throw new Error(\n `Built-in file \"${\n file.path\n }\" is missing its ID in the render metadata.`\n );\n }\n\n context.emitBuiltinSync(file.contents, metadata.id, {\n skipFormat: metadata.skipFormat,\n storage: metadata.storage,\n extension: findFileExtension(file.path)\n });\n } else if (metadata.kind === \"entry\") {\n context.emitEntrySync(file.contents, file.path, {\n skipFormat: metadata.skipFormat,\n storage: metadata.storage,\n ...(metadata.typeDefinition ?? {})\n });\n } else if (metadata.kind === \"infrastructure\") {\n if (!metadata.id) {\n throw new Error(\n `Infrastructure file \"${\n file.path\n }\" is missing its ID in the render metadata.`\n );\n }\n\n context.emitInfrastructureSync(file.contents, metadata.id, {\n skipFormat: metadata.skipFormat,\n storage: metadata.storage,\n extension: findFileExtension(file.path)\n });\n } else {\n context.emitSync(file.contents, file.path, metadata);\n }\n } else {\n context.fs.copySync(file.sourcePath, file.path);\n }\n }\n });\n }\n}\n\n/**\n * A function to render children components within the [Alloy](https://alloy-framework.github.io) context and return the rendered output as a string.\n *\n * @example\n * ```tsx\n * import { renderString } from \"@powerlines/plugin-alloy/render\";\n *\n * const output = await renderString(context, <> ... </>);\n * ```\n *\n * @param context - The Powerlines plugin context.\n * @param children - The children components to render.\n * @param options - Optional print tree options.\n * @returns The rendered output as a string.\n */\nexport function renderString<TContext extends PluginContext>(\n context: TContext,\n children: Children,\n options?: PrintTreeOptions\n) {\n const tree = renderTree(\n <Output<TContext> context={context}>{children}</Output>\n );\n\n return printTree(tree, options);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCA,eAAK,OAAA,SAAA,UAAA;CACJ,MAAA,OAAA,EAAA;CACC,MAAE,SAAa,MAAM,YAAY,gBAAc,UAAA;EACvC;EACN;EACF;EACF,CAAA,CAAA;AACE,KAAA,CAAA,OAAS,KAAQ,OAAA,CAAA,OACjB,SAAU,MAAA,iEAAA;MACV;AACA,UAAU,MAAM,cAAU,OAAQ,KAAQ,OAAC,CAAA,OAAA,2DAAA;AAC3C,QAAM,eAAe,QAAA;GAClB,iBAAiB,cAAS;AACxB,QAAA,QAAQ,GAAA,WAAA,UAAA,KAAA,CACT;;;GAIF,YAAa,SAAA;AACV,QAAG,cAAa,MAAK;KACvB,MAAA,WAAA,KAAA,KAAA,SAAA,EAAA;AACI,SAAA,SAAA,SAAA,WAAA;AACG,UAAA,CAAK,SAAA,GACV,OAAY,IAAA,MAAA,kBAAA,KAAA,KAAA,6CAAA;AAEX,cAAS,gBAAkB,KAAM,UAAG,SAAU,IAAU;OAC3D,YAAA,SAAA;;OAEK,WAAe,kBAAQ,KAAA,KAAA;OAC3B,CAAA;gBACc,SAAG,SAAW,QACxB,SAAM,cAAA,KAAA,UAAA,KAAA,MAAA;MACR,YAAA,SAAA;;MAEA,GAAU,SAAC,kBAAyB,EAAA;MACrC,CAAA;cACc,SAAI,SAAA,kBAAA;AACb,UAAC,CAAA,SAAa,GAChB,OAAM,IAAQ,MAAG,wBAAqB,KAAA,KAAA,6CAAA;AAEpC,cAAK,uBAAa,KAAA,UAAA,SAAA,IAAA;OAChB,YAAU,SAAK;OACf,SAAS,SAAS;OAClB,WAAS,kBAAA,KAAA,KAAA;OACV,CAAC;WAEF,SAAA,SAAA,KAAA,UAAA,KAAA,MAAA,SAAA;UAGF,SAAI,GAAA,SAAY,KAAS,YAAU,KAAA,KAAA;;GAGxC,CAAC;;;;;;;;;;;;;;;;;;AAmBN,SAAc,aAAW,SAAA,UAAuB,SAAI;AAKlD,QAAO,UAJK,WAAA,gBAAA,UAAA;EACF;EACA;EACT,CAAC,CACW,EAAA,QAAA"}
@@ -0,0 +1,9 @@
1
+
2
+ //#region src/types/components.ts
3
+ /**
4
+ * A type that represents the props of a component that can have children.
5
+ */
6
+ /**
7
+ * A type that requires the `children` prop in a component.
8
+ */
9
+ //#endregion
@@ -1,2 +1,10 @@
1
- export{};
1
+ //#region src/types/components.ts
2
+ /**
3
+ * A type that represents the props of a component that can have children.
4
+ */
5
+ /**
6
+ * A type that requires the `children` prop in a component.
7
+ */
8
+ //#endregion
9
+ export { };
2
10
  //# sourceMappingURL=components.mjs.map
@@ -1 +1 @@
1
- export{};
1
+ export { };
@@ -1 +1 @@
1
- export{};
1
+ export { };
@@ -1 +1,63 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../core/contexts/context.cjs`),t=require(`./tsdoc.cjs`),n=require(`./typescript-file.cjs`);let r=require(`@stryke/path/file-path-fns`),i=require(`@alloy-js/core/jsx-runtime`),a=require(`@alloy-js/core`),o=require(`@stryke/path/replace`),s=require(`@stryke/type-checks/is-set`);function c(c){let[{children:l,imports:u,builtinImports:d,id:f,description:p,tsx:m},h]=(0,a.splitProps)(c,[`children`,`imports`,`builtinImports`,`id`,`description`,`tsx`]),g=e.usePowerlinesSafe(),_=(0,a.computed)(()=>(0,o.replacePath)(`${(0,s.isSet)(m)?(0,o.replaceExtension)(f):f}${(0,r.hasFileExtension)(f)&&!(0,s.isSet)(m)?``:m?`.tsx`:`.ts`}`,g?.builtinsPath));return(0,i.createComponent)(n.TypescriptFile,(0,i.mergeProps)({get header(){return(0,i.createComponent)(n.TypescriptFileHeader,{get header(){return(0,i.createComponent)(t.TSDocModule,{name:f,children:p})},get children(){return(0,i.createComponent)(n.TypescriptFileHeaderImports,{imports:u,builtinImports:d})}})},get meta(){return{kind:`builtin`,extension:m?`tsx`:`ts`,id:(0,o.replaceExtension)(f)}}},h,{get path(){return _.value},children:l}))}exports.BuiltinFile=c;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
+ const require_core_contexts_context = require('../../core/contexts/context.cjs');
4
+ const require_typescript_components_tsdoc = require('./tsdoc.cjs');
5
+ const require_typescript_components_typescript_file = require('./typescript-file.cjs');
6
+ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
7
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
8
+ let _alloy_js_core = require("@alloy-js/core");
9
+ let _stryke_path_replace = require("@stryke/path/replace");
10
+ let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
11
+
12
+ //#region src/typescript/components/builtin-file.tsx
13
+ /**
14
+ * A base component representing a Powerlines generated Typescript source file.
15
+ *
16
+ * @param props - The properties for the source file.
17
+ * @returns The rendered source file component.
18
+ */
19
+ function BuiltinFile(props) {
20
+ const [{ children, imports, builtinImports, id, description, tsx }, rest] = (0, _alloy_js_core.splitProps)(props, [
21
+ "children",
22
+ "imports",
23
+ "builtinImports",
24
+ "id",
25
+ "description",
26
+ "tsx"
27
+ ]);
28
+ const context = require_core_contexts_context.usePowerlinesSafe();
29
+ const path = (0, _alloy_js_core.computed)(() => (0, _stryke_path_replace.replacePath)(`${!(0, _stryke_type_checks_is_set.isSet)(tsx) ? id : (0, _stryke_path_replace.replaceExtension)(id)}${(0, _stryke_path_file_path_fns.hasFileExtension)(id) && !(0, _stryke_type_checks_is_set.isSet)(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context?.builtinsPath));
30
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
31
+ get header() {
32
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFileHeader, {
33
+ get header() {
34
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_tsdoc.TSDocModule, {
35
+ name: id,
36
+ children: description
37
+ });
38
+ },
39
+ get children() {
40
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_typescript_components_typescript_file.TypescriptFileHeaderImports, {
41
+ imports,
42
+ builtinImports
43
+ });
44
+ }
45
+ });
46
+ },
47
+ get meta() {
48
+ return {
49
+ kind: "builtin",
50
+ extension: tsx ? "tsx" : "ts",
51
+ id: (0, _stryke_path_replace.replaceExtension)(id)
52
+ };
53
+ }
54
+ }, rest, {
55
+ get path() {
56
+ return path.value;
57
+ },
58
+ children
59
+ }));
60
+ }
61
+
62
+ //#endregion
63
+ exports.BuiltinFile = BuiltinFile;
@@ -1,2 +1,62 @@
1
- import{usePowerlinesSafe as e}from"../../core/contexts/context.mjs";import{TSDocModule as t}from"./tsdoc.mjs";import{TypescriptFile as n,TypescriptFileHeader as r,TypescriptFileHeaderImports as i}from"./typescript-file.mjs";import{hasFileExtension as a}from"@stryke/path/file-path-fns";import{createComponent as o,mergeProps as s}from"@alloy-js/core/jsx-runtime";import{computed as c,splitProps as l}from"@alloy-js/core";import{replaceExtension as u,replacePath as d}from"@stryke/path/replace";import{isSet as f}from"@stryke/type-checks/is-set";function p(p){let[{children:m,imports:h,builtinImports:g,id:_,description:v,tsx:y},b]=l(p,[`children`,`imports`,`builtinImports`,`id`,`description`,`tsx`]),x=e(),S=c(()=>d(`${f(y)?u(_):_}${a(_)&&!f(y)?``:y?`.tsx`:`.ts`}`,x?.builtinsPath));return o(n,s({get header(){return o(r,{get header(){return o(t,{name:_,children:v})},get children(){return o(i,{imports:h,builtinImports:g})}})},get meta(){return{kind:`builtin`,extension:y?`tsx`:`ts`,id:u(_)}}},b,{get path(){return S.value},children:m}))}export{p as BuiltinFile};
1
+ import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
2
+ import { TSDocModule } from "./tsdoc.mjs";
3
+ import { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports } from "./typescript-file.mjs";
4
+ import { hasFileExtension } from "@stryke/path/file-path-fns";
5
+ import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
6
+ import { computed, splitProps } from "@alloy-js/core";
7
+ import { replaceExtension, replacePath } from "@stryke/path/replace";
8
+ import { isSet } from "@stryke/type-checks/is-set";
9
+
10
+ //#region src/typescript/components/builtin-file.tsx
11
+ /**
12
+ * A base component representing a Powerlines generated Typescript source file.
13
+ *
14
+ * @param props - The properties for the source file.
15
+ * @returns The rendered source file component.
16
+ */
17
+ function BuiltinFile(props) {
18
+ const [{ children, imports, builtinImports, id, description, tsx }, rest] = splitProps(props, [
19
+ "children",
20
+ "imports",
21
+ "builtinImports",
22
+ "id",
23
+ "description",
24
+ "tsx"
25
+ ]);
26
+ const context = usePowerlinesSafe();
27
+ const path = computed(() => replacePath(`${!isSet(tsx) ? id : replaceExtension(id)}${hasFileExtension(id) && !isSet(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context?.builtinsPath));
28
+ return createComponent(TypescriptFile, mergeProps({
29
+ get header() {
30
+ return createComponent(TypescriptFileHeader, {
31
+ get header() {
32
+ return createComponent(TSDocModule, {
33
+ name: id,
34
+ children: description
35
+ });
36
+ },
37
+ get children() {
38
+ return createComponent(TypescriptFileHeaderImports, {
39
+ imports,
40
+ builtinImports
41
+ });
42
+ }
43
+ });
44
+ },
45
+ get meta() {
46
+ return {
47
+ kind: "builtin",
48
+ extension: tsx ? "tsx" : "ts",
49
+ id: replaceExtension(id)
50
+ };
51
+ }
52
+ }, rest, {
53
+ get path() {
54
+ return path.value;
55
+ },
56
+ children
57
+ }));
58
+ }
59
+
60
+ //#endregion
61
+ export { BuiltinFile };
2
62
  //# sourceMappingURL=builtin-file.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"builtin-file.mjs","names":[],"sources":["../../../src/typescript/components/builtin-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, splitProps } from \"@alloy-js/core\";\nimport { hasFileExtension } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport type { TSDocModuleProps } from \"./tsdoc\";\nimport { TSDocModule } from \"./tsdoc\";\nimport {\n TypescriptFile,\n TypescriptFileHeader,\n TypescriptFileHeaderImports,\n TypescriptFileProps\n} from \"./typescript-file\";\n\nexport type BuiltinFileProps = Omit<TypescriptFileProps, \"path\"> &\n Omit<TSDocModuleProps, \"name\"> & {\n /**\n * The runtime module identifier.\n *\n * @remarks\n * This value will be included after the \\`storm:\\` prefix in the import statement.\n */\n id: string;\n\n /**\n * The description for the builtin module.\n */\n description?: string;\n\n /**\n * Whether the file is a TSX file.\n *\n * @defaultValue false\n */\n tsx?: boolean;\n };\n\n/**\n * A base component representing a Powerlines generated Typescript source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function BuiltinFile(props: BuiltinFileProps) {\n const [{ children, imports, builtinImports, id, description, tsx }, rest] =\n splitProps(props, [\n \"children\",\n \"imports\",\n \"builtinImports\",\n \"id\",\n \"description\",\n \"tsx\"\n ]);\n\n const context = usePowerlinesSafe();\n const path = computed(() =>\n replacePath(\n `${!isSet(tsx) ? id : replaceExtension(id)}${\n hasFileExtension(id) && !isSet(tsx) ? \"\" : tsx ? \".tsx\" : \".ts\"\n }`,\n context?.builtinsPath\n )\n );\n\n return (\n <TypescriptFile\n header={\n <TypescriptFileHeader\n header={<TSDocModule name={id}>{description}</TSDocModule>}>\n <TypescriptFileHeaderImports\n imports={imports}\n builtinImports={builtinImports}\n />\n </TypescriptFileHeader>\n }\n meta={{\n kind: \"builtin\",\n extension: tsx ? \"tsx\" : \"ts\",\n id: replaceExtension(id)\n }}\n {...rest}\n path={path.value}>\n {children}\n </TypescriptFile>\n );\n}\n"],"mappings":"iiBAgCA,SAAY,EAAgB,EAAO,CACjC,GAAK,CAAA,CACH,WACA,UACA,iBACA,KACA,cACA,OACA,GAAI,EAAM,EAAA,CAAA,WAAA,UAAA,iBAAA,KAAA,cAAA,MAAA,CAAA,OAER,EAAA,MAAA,EAAA,GAAA,EAAA,EAAA,CAAA,EAAA,EAAA,CAAA,IAAA,EAAA,EAAA,EAAA,CAAA,EAAA,EAAA,CAAA,GAAA,EAAA,OAAA,QAAA,GAAA,aAAA,CAAA,CACJ,OAAK,EAAoB,EAAY,EAAM,CACzC,IAAE,QAAA,CACF,OAAA,EAAoB,EAAA,cAElB,OAAA,EAAA,EAAA,CACC,KAAW,EACb,SAAA,EACG,CAAA,EAEA,IAAE,UAAO,CACd,OAAA,EAAA,EAAA,WAED,iBACQ,CAAA,EAEN,CAAA,EAEF,IAAA,MAAA,CACI,MAAC,CACC,KAAG,UACP,UAAW,EAAO,MAAA,KACf,GAAA,EAAS,EAAA,CACT,EAEJ,CAAE,EAAK,CACN,IAAG,MAAA,CACD,OAAI,EAAA,kBAGR,CAAA,CAAA"}
1
+ {"version":3,"file":"builtin-file.mjs","names":[],"sources":["../../../src/typescript/components/builtin-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, splitProps } from \"@alloy-js/core\";\nimport { hasFileExtension } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport type { TSDocModuleProps } from \"./tsdoc\";\nimport { TSDocModule } from \"./tsdoc\";\nimport {\n TypescriptFile,\n TypescriptFileHeader,\n TypescriptFileHeaderImports,\n TypescriptFileProps\n} from \"./typescript-file\";\n\nexport type BuiltinFileProps = Omit<TypescriptFileProps, \"path\"> &\n Omit<TSDocModuleProps, \"name\"> & {\n /**\n * The runtime module identifier.\n *\n * @remarks\n * This value will be included after the \\`storm:\\` prefix in the import statement.\n */\n id: string;\n\n /**\n * The description for the builtin module.\n */\n description?: string;\n\n /**\n * Whether the file is a TSX file.\n *\n * @defaultValue false\n */\n tsx?: boolean;\n };\n\n/**\n * A base component representing a Powerlines generated Typescript source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function BuiltinFile(props: BuiltinFileProps) {\n const [{ children, imports, builtinImports, id, description, tsx }, rest] =\n splitProps(props, [\n \"children\",\n \"imports\",\n \"builtinImports\",\n \"id\",\n \"description\",\n \"tsx\"\n ]);\n\n const context = usePowerlinesSafe();\n const path = computed(() =>\n replacePath(\n `${!isSet(tsx) ? id : replaceExtension(id)}${\n hasFileExtension(id) && !isSet(tsx) ? \"\" : tsx ? \".tsx\" : \".ts\"\n }`,\n context?.builtinsPath\n )\n );\n\n return (\n <TypescriptFile\n header={\n <TypescriptFileHeader\n header={<TSDocModule name={id}>{description}</TSDocModule>}>\n <TypescriptFileHeaderImports\n imports={imports}\n builtinImports={builtinImports}\n />\n </TypescriptFileHeader>\n }\n meta={{\n kind: \"builtin\",\n extension: tsx ? \"tsx\" : \"ts\",\n id: replaceExtension(id)\n }}\n {...rest}\n path={path.value}>\n {children}\n </TypescriptFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgCA,SAAY,YAAgB,OAAO;CACjC,MAAK,CAAA,EACH,UACA,SACA,gBACA,IACA,aACA,OACA,QAAI,WAAM,OAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA;;CAEZ,MAAI,OAAA,eAAA,YAAA,GAAA,CAAA,MAAA,IAAA,GAAA,KAAA,iBAAA,GAAA,GAAA,iBAAA,GAAA,IAAA,CAAA,MAAA,IAAA,GAAA,KAAA,MAAA,SAAA,SAAA,SAAA,aAAA,CAAA;AACJ,QAAK,gBAAoB,gBAAY,WAAM;EACzC,IAAE,SAAA;AACF,UAAA,gBAAoB,sBAAA;;AAElB,YAAA,gBAAA,aAAA;MACC,MAAW;MACb,UAAA;MACG,CAAA;;IAEA,IAAE,WAAO;AACd,YAAA,gBAAA,6BAAA;;MAED;MACQ,CAAA;;IAEN,CAAA;;EAEF,IAAA,OAAA;AACI,UAAC;IACC,MAAG;IACP,WAAW,MAAO,QAAA;IACf,IAAA,iBAAS,GAAA;IACT;;EAEJ,EAAE,MAAK;EACN,IAAG,OAAA;AACD,UAAI,KAAA;;;EAGR,CAAA,CAAA"}