@powerlines/plugin-alloy 0.26.215 → 0.26.217

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 (88) hide show
  1. package/dist/core/components/infrastructure-file.d.mts.map +1 -1
  2. package/dist/core/components/infrastructure-file.mjs.map +1 -1
  3. package/dist/core/components/output.d.mts.map +1 -1
  4. package/dist/core/components/output.mjs.map +1 -1
  5. package/dist/core/components/single-line-comment.d.mts.map +1 -1
  6. package/dist/core/components/single-line-comment.mjs.map +1 -1
  7. package/dist/core/components/source-file.d.mts.map +1 -1
  8. package/dist/core/components/source-file.mjs.map +1 -1
  9. package/dist/core/components/spacing.d.mts.map +1 -1
  10. package/dist/core/components/spacing.mjs.map +1 -1
  11. package/dist/core/contexts/context.d.mts.map +1 -1
  12. package/dist/core/contexts/context.mjs.map +1 -1
  13. package/dist/core/contexts/meta.d.mts.map +1 -1
  14. package/dist/core/contexts/meta.mjs.map +1 -1
  15. package/dist/core/contexts/schema.d.mts.map +1 -1
  16. package/dist/core/contexts/schema.mjs.map +1 -1
  17. package/dist/core/helpers/code.d.mts.map +1 -1
  18. package/dist/core/helpers/code.mjs.map +1 -1
  19. package/dist/hcl/components/block-declaration.d.mts.map +1 -1
  20. package/dist/hcl/components/block-declaration.mjs.map +1 -1
  21. package/dist/hcl/components/hcl-file.d.mts.map +1 -1
  22. package/dist/hcl/components/hcl-file.mjs.map +1 -1
  23. package/dist/hcl/components/packer-file.d.mts.map +1 -1
  24. package/dist/hcl/components/packer-file.mjs.map +1 -1
  25. package/dist/hcl/components/terraform-file.d.mts.map +1 -1
  26. package/dist/hcl/components/terraform-file.mjs.map +1 -1
  27. package/dist/helpers/capnp.d.mts.map +1 -1
  28. package/dist/helpers/capnp.mjs.map +1 -1
  29. package/dist/helpers/create-builtin.d.mts.map +1 -1
  30. package/dist/helpers/create-builtin.mjs.map +1 -1
  31. package/dist/helpers/refkey.d.mts.map +1 -1
  32. package/dist/helpers/refkey.mjs.map +1 -1
  33. package/dist/helpers/typescript.d.mts.map +1 -1
  34. package/dist/helpers/typescript.mjs.map +1 -1
  35. package/dist/index.d.mts.map +1 -1
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/markdown/components/front-matter.d.mts.map +1 -1
  38. package/dist/markdown/components/front-matter.mjs.map +1 -1
  39. package/dist/markdown/components/heading.d.mts.map +1 -1
  40. package/dist/markdown/components/heading.mjs.map +1 -1
  41. package/dist/markdown/components/markdown-file.d.mts.map +1 -1
  42. package/dist/markdown/components/markdown-file.mjs.map +1 -1
  43. package/dist/markdown/components/markdown-table.d.mts.map +1 -1
  44. package/dist/markdown/components/markdown-table.mjs.map +1 -1
  45. package/dist/markdown/contexts/markdown-table.d.mts.map +1 -1
  46. package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
  47. package/dist/render.d.mts.map +1 -1
  48. package/dist/render.mjs.map +1 -1
  49. package/dist/types/components.d.mts.map +1 -1
  50. package/dist/types/components.mjs.map +1 -1
  51. package/dist/types/plugin.d.mts.map +1 -1
  52. package/dist/typescript/components/builtin-file.d.mts.map +1 -1
  53. package/dist/typescript/components/builtin-file.mjs.map +1 -1
  54. package/dist/typescript/components/class-declaration.d.mts.map +1 -1
  55. package/dist/typescript/components/class-declaration.mjs.map +1 -1
  56. package/dist/typescript/components/dynamic-import-statement.d.mts.map +1 -1
  57. package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
  58. package/dist/typescript/components/entry-file.d.mts.map +1 -1
  59. package/dist/typescript/components/entry-file.mjs.map +1 -1
  60. package/dist/typescript/components/interface-declaration.d.mts.map +1 -1
  61. package/dist/typescript/components/interface-declaration.mjs.map +1 -1
  62. package/dist/typescript/components/object-declaration.d.mts.map +1 -1
  63. package/dist/typescript/components/object-declaration.mjs.map +1 -1
  64. package/dist/typescript/components/property-name.d.mts.map +1 -1
  65. package/dist/typescript/components/property-name.mjs.map +1 -1
  66. package/dist/typescript/components/record-expression.d.mts.map +1 -1
  67. package/dist/typescript/components/record-expression.mjs.map +1 -1
  68. package/dist/typescript/components/tsdoc-schema.d.mts.map +1 -1
  69. package/dist/typescript/components/tsdoc-schema.mjs.map +1 -1
  70. package/dist/typescript/components/tsdoc.d.mts.map +1 -1
  71. package/dist/typescript/components/tsdoc.mjs.map +1 -1
  72. package/dist/typescript/components/type-declaration.d.mts.map +1 -1
  73. package/dist/typescript/components/type-declaration.mjs.map +1 -1
  74. package/dist/typescript/components/type-parameters.d.mts.map +1 -1
  75. package/dist/typescript/components/type-parameters.mjs.map +1 -1
  76. package/dist/typescript/components/typescript-file.d.mts.map +1 -1
  77. package/dist/typescript/components/typescript-file.mjs.map +1 -1
  78. package/dist/typescript/contexts/lexical-scope.d.mts.map +1 -1
  79. package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
  80. package/dist/typescript/contexts/member-scope.d.mts.map +1 -1
  81. package/dist/typescript/contexts/member-scope.mjs.map +1 -1
  82. package/dist/typescript/helpers/get-call-signature-props.d.mts.map +1 -1
  83. package/dist/typescript/helpers/get-call-signature-props.mjs.map +1 -1
  84. package/dist/typescript/helpers/utilities.d.mts.map +1 -1
  85. package/dist/typescript/helpers/utilities.mjs.map +1 -1
  86. package/dist/yaml/components/yaml-file.d.mts.map +1 -1
  87. package/dist/yaml/components/yaml-file.mjs.map +1 -1
  88. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"infrastructure-file.d.mts","names":[],"sources":["../../../src/core/components/infrastructure-file.tsx"],"mappings":";;;KA6BY,uBAAA,GAA0B,IAAI,CAAC,eAAA;;AAA3C;;EAIE,EAAA;EAJwC;;;;;;EAYxC,SAAA;AAAA;;;;;;;iBASc,kBAAA,CAAmB,KAAA,EAAO,uBAAuB,4BAAA,QAAA"}
1
+ {"version":3,"file":"infrastructure-file.d.mts","names":[],"sources":["../../../src/core/components/infrastructure-file.tsx"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"infrastructure-file.mjs","names":[],"sources":["../../../src/core/components/infrastructure-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 { appendExtension, appendPath } from \"@stryke/path/append\";\nimport {\n findFileExtensionSafe,\n hasFileExtension\n} from \"@stryke/path/file-path-fns\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport defu from \"defu\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport { SourceFile, SourceFileProps } from \"./source-file\";\n\nexport type InfrastructureFileProps = Omit<SourceFileProps, \"path\"> & {\n /**\n * The infrastructure module identifier.\n */\n id: string;\n\n /**\n * The extension for the infrastructure file. This is used to determine the file extension if the `id` does not already include one.\n *\n * @remarks\n * If none is provided, the file extension will be determined by the {@link SourceFileProps.filetype | filetype} property.\n */\n extension?: string;\n};\n\n/**\n * A base component representing a Powerlines generated infrastructure file.\n *\n * @param props - The properties for the infrastructure file.\n * @returns The rendered infrastructure file component.\n */\nexport function InfrastructureFile(props: InfrastructureFileProps) {\n const [{ children, meta, id, extension, filetype: _filetype }, rest] =\n splitProps(props, [\"children\", \"meta\", \"id\", \"extension\", \"filetype\"]);\n\n const context = usePowerlinesSafe();\n const filetype = computed(\n () =>\n _filetype ||\n extension?.replace(/^\\.*/, \"\") ||\n (hasFileExtension(id) ? findFileExtensionSafe(id) : \"\")\n );\n const path = computed(() => {\n const value = context\n ? appendPath(\n id,\n replacePath(context.infrastructurePath, context.config.cwd)\n )\n : id;\n\n return appendExtension(replaceExtension(value), filetype.value);\n });\n\n return (\n <SourceFile\n {...rest}\n filetype={filetype.value}\n path={path.value}\n meta={defu(\n {\n kind: \"infrastructure\"\n },\n meta ?? {}\n )}>\n {children}\n </SourceFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgCA,SAAI,mBAAA,OAAA;CACF,MAAI,CAAA,YAEF,MACA,IACD,WACC,UAAE,aACD,QAAQ,WAAW,OAAM;EAAA;EAAc;EAAQ;EAAC;EAAkB;CAAO,CAAA;CAC5E,MAAE,UAAA,kBAAA;CACF,MAAA,WAAY,eAAM,aAAA,WAAA,QAAA,QAAA,EAAA,MAAA,iBAAA,EAAA,IAAA,sBAAA,EAAA,IAAA,GAAA;CACnB,MAAA,OAAA,eAAA;EAEC,OAAA,gBAAA,2GAAA,GAAA,SAAA,KAAA;CACA,CAAC;CACF,OAAA,gBAAA,YAAA,WAAA,MAAA;EACG,IAAA,WAAc;GACd,OAAQ,SAAI;EACd;EACF,IAAO,OAAQ;GACb,OAAS,KAAA;EACP;;GAEF,OAAM,KAAU,EACV,MAAA,iBACF,GAAE,QAAA,CAAA,CAAA;EACJ;EACE;CACJ,CAAC,CAAC;AACJ"}
1
+ {"version":3,"file":"infrastructure-file.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.mts","names":[],"sources":["../../../src/core/components/output.tsx"],"mappings":";;;;;UAwBiB,WAAA,kBACE,aAAA,GAAgB,aAAA,UACzB,IAAA,CAAK,aAAA;;;AAFf;EAME,OAAA,EAAS,QAAA;EANiB;;;EAW1B,IAAA,GAAO,MAAA,SAAe,QAAA;AAAA;;;;iBAMR,MAAA,kBAAwB,aAAA,GAAgB,aAAA,EACtD,KAAA,EAAO,WAAA,CAAY,QAAA,6BAAS,QAAA"}
1
+ {"version":3,"file":"output.d.mts","names":[],"sources":["../../../src/core/components/output.tsx"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"output.mjs","names":[],"sources":["../../../src/core/components/output.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 { OutputProps as OutputPropsExternal } from \"@alloy-js/core\";\nimport { computed, Output as OutputExternal, splitProps } from \"@alloy-js/core\";\nimport type { PluginContext } from \"powerlines\";\nimport { MetaContext, MetaItem } from \"../contexts\";\nimport { PowerlinesContext } from \"../contexts/context\";\n\nexport interface OutputProps<\n TContext extends PluginContext = PluginContext\n> extends Omit<OutputPropsExternal, \"basePath\"> {\n /**\n * The current Powerlines process context.\n */\n context: TContext;\n\n /**\n * The file metadata collected during rendering.\n */\n meta?: Record<string, MetaItem>;\n}\n\n/**\n * Output component for rendering the Powerlines plugin's output files via templates.\n */\nexport function Output<TContext extends PluginContext = PluginContext>(\n props: OutputProps<TContext>\n) {\n const [{ children, context, meta = {} }, rest] = splitProps(props, [\n \"children\",\n \"context\",\n \"meta\"\n ]);\n\n const contextRef = computed(() => context);\n\n return (\n <MetaContext.Provider value={meta}>\n <PowerlinesContext.Provider value={contextRef.value}>\n <OutputExternal {...rest} basePath={contextRef.value.config.cwd}>\n {children}\n </OutputExternal>\n </PowerlinesContext.Provider>\n </MetaContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAW,OAAQ,OAAA;CACjB,MAAA,CAAO,EACL,UACA,SACA,OAAA,CAAA,KACF,QAAS,WAAQ,OAAA;EAAA;EAAA;EAAA;CAAA,CAAA;;CAEjB,OAAE,gBAAA,YAAA,UAAA;EACA,OAAK;EACL,IAAA,WAAA;GACE,OAAG,gBAAe,kBAAS,UAAA;IACjC,IAAA,QAAA;;IAEE;IACC,IAAO,WAAa;KACrB,OAAA,gBAAA,UAAA,WAAA,MAAA;MACK,IAAS,WAAO;OACd,OAAY,WAAQ,MAAA,OAAA;MAC3B;MACmB;KAChB,CAAA,CAAA;IACA;GACA,CAAA;EACD;;AAEJ"}
1
+ {"version":3,"file":"output.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"single-line-comment.d.mts","names":[],"sources":["../../../src/core/components/single-line-comment.tsx"],"mappings":";;;KAqBY,wBAAA;AAAA,UASK,sBAAA,SAA+B,cAAc;EATlD;;;;AAAwB;EAelC,OAAA,GAAU,wBAAA;AAAA;;;;;iBAOI,iBAAA,CAAkB,KAAA,EAAO,sBAAsB,4BAAA,QAAA"}
1
+ {"version":3,"file":"single-line-comment.d.mts","names":[],"sources":["../../../src/core/components/single-line-comment.tsx"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"single-line-comment.mjs","names":[],"sources":["../../../src/core/components/single-line-comment.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Prose } from \"@alloy-js/core\";\nimport { ComponentProps } from \"../../types/components\";\n\nexport type SingleLineCommentVariant =\n | \"double-slash\"\n | \"triple-slash\"\n | \"slash-star\"\n | \"slash-star-star\"\n | \"markdown\"\n | \"yaml\"\n | \"hcl\";\n\nexport interface SingleLineCommentProps extends ComponentProps {\n /**\n * The variant of the single line comment.\n *\n * @defaultValue \"double-slash\"\n */\n variant?: SingleLineCommentVariant;\n}\n\n/**\n * A single line comment block. The children are rendered as a prose element, which means that they\n * are broken into multiple lines\n */\nexport function SingleLineComment(props: SingleLineCommentProps) {\n const { variant = \"double-slash\", children } = props;\n\n const commentStart =\n variant === \"slash-star\"\n ? \"/* \"\n : variant === \"slash-star-star\"\n ? \"/** \"\n : variant === \"triple-slash\"\n ? \"/// \"\n : variant === \"markdown\"\n ? \"<!-- \"\n : variant === \"yaml\" || variant === \"hcl\"\n ? \"# \"\n : \"// \";\n\n return (\n <>\n {commentStart}\n <align string={commentStart}>\n <Prose>{children}</Prose>\n\n {variant === \"slash-star\" || variant === \"slash-star-star\"\n ? \" */ \"\n : variant === \"markdown\"\n ? \" -->\"\n : \"\"}\n </align>\n </>\n );\n}\n"],"mappings":";;;;;;;;AAyBA,SAAgB,kBAAI,OAAA;CAClB,MAAG,EACD,UAAK,gBACL;CAEJ,MAAO,eAAU,YAAA,eAA+B,QAAA,YAAe,oBAAA,SAAA,YAAA,iBAAA,SAAA,YAAA,aAAA,UAAA,YAAA,UAAA,YAAA,QAAA,OAAA;CAC7D,OAAE,CAAA,cAAA,gBAAA,SAAA;EACA,QAAK;EACN,IAAA,WAAA;GACG,OAAA,CAAA,gBAA0B,OAAA,EAC5B,SACF,CAAA,GAAQ,YAAE,gBAAwB,YAAA,oBAAA,SAAA,YAAA,aAAA,SAAA,EAAA;EACpC;;AAEA"}
1
+ {"version":3,"file":"single-line-comment.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"source-file.d.mts","names":[],"sources":["../../../src/core/components/source-file.tsx"],"mappings":";;;;;KAkCY,eAAA,GAAkB,iBAAA,GAC5B,cAAA;;AADF;;;;;EAQI,OAAA,GAAU,aAAA;EAQH;;;;;;EAAP,IAAA,GAAO,MAAA;AAAA;;;AAAM;AASjB;;;iBAAgB,UAAA,CAAW,KAAA,EAAO,eAAe,4BAAA,QAAA"}
1
+ {"version":3,"file":"source-file.d.mts","names":[],"sources":["../../../src/core/components/source-file.tsx"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"source-file.mjs","names":[],"sources":["../../../src/core/components/source-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 {\n getContext,\n Show,\n SourceDirectoryContext,\n SourceFileContext,\n SourceFileProps as SourceFilePropsExternal,\n splitProps,\n useContext,\n useFormatOptions\n} from \"@alloy-js/core\";\nimport { appendPath } from \"@stryke/path/append\";\nimport defu from \"defu\";\nimport type { StoragePreset } from \"powerlines\";\nimport { ComponentProps } from \"../../types/components\";\nimport { useMeta } from \"../contexts/meta\";\n\nexport type SourceFileProps = SourceFilePropsExternal &\n ComponentProps & {\n /**\n * The storage preset for the output files.\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided `output.mode` value.\n */\n storage?: StoragePreset;\n\n /**\n * The metadata associated with the source file.\n *\n * @remarks\n * The values stored in the metadata will be available in the rendering context.\n */\n meta?: Record<string, any>;\n };\n\n/**\n * A base component representing a Powerlines generated source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function SourceFile(props: SourceFileProps) {\n const [{ children, meta, path, header, storage, filetype, reference }] =\n splitProps(props, [\n \"children\",\n \"meta\",\n \"path\",\n \"header\",\n \"storage\",\n \"filetype\",\n \"reference\"\n ]);\n\n const metadata = useMeta();\n const parentDirectory = useContext(SourceDirectoryContext)!;\n\n const sourceFile: SourceFileContext = {\n path: appendPath(path, parentDirectory.path),\n filetype,\n reference\n };\n parentDirectory?.addContent(sourceFile);\n\n const printOptions = useFormatOptions({\n printWidth: props.printWidth,\n tabWidth: props.tabWidth,\n useTabs: props.useTabs,\n insertFinalNewLine: props.insertFinalNewLine\n });\n\n const nodeContext = getContext()!;\n nodeContext.meta = defu(\n {\n sourceFile,\n printOptions\n },\n meta ?? {}\n );\n\n if (metadata) {\n metadata[sourceFile.path] = {\n storage,\n ...(meta ?? {})\n };\n }\n\n return (\n <SourceFileContext.Provider value={sourceFile}>\n <Show when={header !== undefined}>\n {header}\n <hbr />\n </Show>\n {children}\n </SourceFileContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAc,WAAa,OAAO;CAClC,MAAQ,CAAC,EACT,gBAEA,MACE,QACE,SACA,UACA,eACG,WAAC,OAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;CAAA,CAAA;CACN,MAAK,WAAO,QAAW;CACvB,MAAI,kBAAA,WAAA,sBAAA;CACJ,MAAE,aAAU;;EAEV;EACA;CACF;CACA,iBAAM,WAAA,UAAA;CACN,MAAK,eAAW,iBAAsB;EACpC,YAAE,MAAA;EACF,UAAO,MAAO;EACf,SAAA,MAAA;;CAED,CAAA;CACA,MAAG,cAAe,WAAa;CAChC,YAAA,OAAA,KAAA;EACG;EACA;CACF,GAAA,QAAA,CAAA,CAAA;CACF,IAAM,UACJ,SAAS,WAAU,QAAW;EAC5B;EACE,GAAC,QAAS,CAAA;CACZ;CAEF,OAAK,gBAAO,kBAAA,UAAA;EACV,OAAG;EACH,IAAG,WAAS;GACV,OAAC,CAAA,gBAAS,MAAA;IACV,MAAA,WAAA;;KAEE,OAAS,CAAC,QAAQ,gBAAE,OAAA,CAAA,CAAA,CAAA;IACpB;;EAEN;CACA,CAAC;AACH"}
1
+ {"version":3,"file":"source-file.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"spacing.d.mts","names":[],"sources":["../../../src/core/components/spacing.tsx"],"mappings":";UAoBiB,YAAA;EAAA;;;;AASV;AAMP;;;EANE,KAAK;AAAA;;;;iBAMS,OAAA;EAAU;AAAA,GAAa,YAAY,4BAAA,QAAA"}
1
+ {"version":3,"file":"spacing.d.mts","names":[],"sources":["../../../src/core/components/spacing.tsx"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"spacing.mjs","names":[],"sources":["../../../src/core/components/spacing.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 { For } from \"@alloy-js/core\";\n\nexport interface SpacingProps {\n /**\n * A scale factor that determines the amount of vertical space to be added.\n *\n * @remarks\n * The default value is 1, which corresponds to a standard spacing. A value of 2 would double the spacing, while a value of 0.5 would halve it.\n *\n * @defaultValue 1\n */\n scale?: number;\n}\n\n/**\n * A simple component that renders two horizontal breaks to create vertical spacing between elements.\n */\nexport function Spacing({ scale = 1 }: SpacingProps) {\n return (\n <For each={Array.from({ length: scale })}>\n {_ => (\n <>\n <hbr />\n <hbr />\n </>\n )}\n </For>\n );\n}\n"],"mappings":";;;;;;;AAuBA,SAAG,QAAA,EACD,QAAI,KACH;CACD,OAAC,gBAAA,KAAA;EACC,IAAE,OAAA;GACF,OAAA,MAAA,KAAA,EACI,QAAQ,MAChB,CAAA;;EAEE,WAAA,MAAA,CAAA,gBAAA,OAAA,CAAA,CAAA,GAAA,gBAAA,OAAA,CAAA,CAAA,CAAA;CACA,CAAC;AACH"}
1
+ {"version":3,"file":"spacing.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.mts","names":[],"sources":["../../../src/core/contexts/context.ts"],"mappings":";;;;;;AA4BA;cAAa,iBAAA,EAAmB,gBAAgB,CAAC,aAAA;;;AAAa;AAQ9D;;iBAAgB,oBAAA,kBACG,aAAA,GAAgB,aAAA,KAC9B,QAAA;;;;;;iBASW,iBAAA,kBACG,aAAA,GAAgB,aAAA,KAC9B,QAAA;;;;;AAXQ;iBAsBG,aAAA,kBACG,aAAA,GAAgB,aAAA,KAC9B,QAAA"}
1
+ {"version":3,"file":"context.d.mts","names":[],"sources":["../../../src/core/contexts/context.ts"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"context.mjs","names":[],"sources":["../../../src/core/contexts/context.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 {\n ComponentContext,\n createNamedContext,\n useContext\n} from \"@alloy-js/core\";\nimport type { PluginContext } from \"powerlines\";\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const PowerlinesContext: ComponentContext<PluginContext> =\n createNamedContext<PluginContext>(\"Powerlines\");\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function usePowerlinesContext<\n TContext extends PluginContext = PluginContext\n>(): TContext | undefined {\n return useContext(PowerlinesContext) as TContext | undefined;\n}\n\n/**\n * Hook to safely access the {@link PluginContext | Powerlines context}.\n *\n * @returns The Powerlines context or undefined if not set.\n */\nexport function usePowerlinesSafe<\n TContext extends PluginContext = PluginContext\n>(): TContext | undefined {\n const powerlines = usePowerlinesContext<TContext>();\n\n return powerlines ?? undefined;\n}\n\n/**\n * Hook to access the {@link PluginContext | Powerlines context}.\n *\n * @returns The Powerlines context.\n */\nexport function usePowerlines<\n TContext extends PluginContext = PluginContext\n>(): TContext {\n const powerlines = usePowerlinesSafe<TContext>();\n if (!powerlines) {\n throw new Error(\n \"Powerlines - Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return powerlines;\n}\n"],"mappings":";;;;;;AAsBA,MAAS,oBAAc,mBAAA,YAAA;;;;;;AAOvB,SAAE,uBAAmC;;AAErC;;;;;;AAOA,SAAgB,oBAAU;CAE1B,OADoB,qBACpB,KAAA;;;;;;;AAQA,SAAW,gBAAqB;CAC9B,MAAG,aAAW,kBAAU;CACxB,IAAA,CAAK;CAGP,OAAA"}
1
+ {"version":3,"file":"context.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"meta.d.mts","names":[],"sources":["../../../src/core/contexts/meta.ts"],"mappings":";;;;UAyBiB,QAAA;;AAAjB;;EAIE,IAAA;EAauB;;;EARvB,UAAA;EAQU;;;AAEE;AAMd;;EARE,OAAA,GAAU,aAAa;EAAA,CAEtB,GAAA;AAAA;;;;cAMU,WAAA,EAAa,gBAAA,CAAiB,MAAA,SAAe,QAAA;;;;AAAQ;AAQlE;iBAAgB,cAAA,IAAkB,MAAM,SAAS,QAAA;;;AAAQ;AASzD;;iBAAgB,WAAA,IAAe,MAAM,SAAS,QAAA;;AAAQ;AAWtD;;;iBAAgB,OAAA,IAAW,MAAM,SAAS,QAAA"}
1
+ {"version":3,"file":"meta.d.mts","names":[],"sources":["../../../src/core/contexts/meta.ts"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"meta.mjs","names":[],"sources":["../../../src/core/contexts/meta.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 {\n ComponentContext,\n createNamedContext,\n useContext\n} from \"@alloy-js/core\";\nimport type { StoragePreset } from \"powerlines\";\n\nexport interface MetaItem {\n /**\n * The kind of metadata item.\n */\n kind?: \"builtin\" | \"entry\" | string;\n\n /**\n * Whether to skip formatting for this output.\n */\n skipFormat?: boolean;\n\n /**\n * The storage preset or adapter name for the output files.\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided `output.mode` value.\n */\n storage?: StoragePreset | string;\n\n [key: string]: any;\n}\n\n/**\n * The Powerlines meta context used to determine metadata of files generated during rendering.\n */\nexport const MetaContext: ComponentContext<Record<string, MetaItem>> =\n createNamedContext<Record<string, MetaItem>>(\"Meta\");\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function useMetaContext(): Record<string, MetaItem> | undefined {\n return useContext(MetaContext);\n}\n\n/**\n * Hook to safely access the render context's metadata.\n *\n * @returns The Powerlines context or undefined if not set.\n */\nexport function useMetaSafe(): Record<string, MetaItem> | undefined {\n const meta = useMetaContext();\n\n return meta ?? undefined;\n}\n\n/**\n * Hook to access the render context's metadata.\n *\n * @returns The Powerlines context.\n */\nexport function useMeta(): Record<string, MetaItem> {\n const meta = useMetaSafe();\n if (!meta) {\n throw new Error(\n \"Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return meta;\n}\n"],"mappings":";;;;;;AAsBA,MAAS,cAAc,mBAAA,MAAA;;;;;;AAOvB,SAAU,iBAAqB;;AAE/B;;;;;;AAOA,SAAG,cAAA;CAED,OADI,eACM,KAAA;AACZ;;;;;;AAOA,SAAO,UAAgB;CACrB,MAAA,OAAA,YAAA;CACF,IAAM,CAAC,MACL,MAAA,IAAA,MAAkB,mNAAkC;CAEpD,OAAA;AACF"}
1
+ {"version":3,"file":"meta.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.mts","names":[],"sources":["../../../src/core/contexts/schema.ts"],"mappings":";;;;;;AAyBA;cAAa,aAAA,EAAe,gBAAgB,CAAC,cAAA;;;AAAc;AAQ3D;;iBAAgB,SAAA,IAAS,cAAA;;AAAA;AAezB;cAAa,qBAAA,EAAuB,gBAAgB,CAAC,cAAA;;;AAAc;AAQnE;;iBAAgB,iBAAA,IAAiB,cAAA"}
1
+ {"version":3,"file":"schema.d.mts","names":[],"sources":["../../../src/core/contexts/schema.ts"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.mjs","names":[],"sources":["../../../src/core/contexts/schema.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\";\nimport { JsonSchemaLike } from \"@powerlines/schema\";\n\n/**\n * The reflection class context used in template rendering.\n */\nexport const SchemaContext: ComponentContext<JsonSchemaLike> =\n createContext<JsonSchemaLike>();\n\n/**\n * Hook to access the schema context.\n *\n * @returns A reactive version of the current schema.\n */\nexport function useSchema() {\n const context = useContext<JsonSchemaLike>(SchemaContext)!;\n\n if (!context) {\n throw new Error(\n \"Powerlines - Schema Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n/**\n * The schema property context used in template rendering.\n */\nexport const SchemaPropertyContext: ComponentContext<JsonSchemaLike> =\n createNamedContext<JsonSchemaLike>(\"SchemaProperty\");\n\n/**\n * Hook to access the Schema Property context.\n *\n * @returns A reactive version of the current schema property.\n */\nexport function useSchemaProperty() {\n const context = useContext<JsonSchemaLike>(SchemaPropertyContext)!;\n if (!context) {\n throw new Error(\n \"Powerlines - Schema Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n );\n }\n\n return context;\n}\n\n// /**\n// * The reflection method context used in template rendering.\n// */\n// export const ReflectionMethodContext: ComponentContext<ReflectionMethod> =\n// createNamedContext<ReflectionMethod>(\"ReflectionMethod\");\n\n// /**\n// * Hook to access the Reflection Method context.\n// *\n// * @returns A reactive version of the current reflection.\n// */\n// export function useReflectionMethod() {\n// const context = useContext<ReflectionMethod>(ReflectionMethodContext)!;\n\n// if (!context) {\n// throw new Error(\n// \"Powerlines - Reflection Method Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.\"\n// );\n// }\n\n// return context;\n// }\n\n// /**\n// * The reflection parameter context used in template rendering.\n// */\n// export const ReflectionParameterContext: ComponentContext<ReflectionParameter> =\n// createNamedContext<ReflectionParameter>(\"ReflectionParameter\");\n\n// /**\n// * Hook to access the Reflection Parameter context.\n// *\n// * @returns A reactive version of the current reflection.\n// */\n// export function useReflectionParameter() {\n// return useContext<ReflectionParameter>(ReflectionParameterContext)!;\n// }\n"],"mappings":";;;;;;AAwBA,MAAE,gBAAA,cAAA;;;;;;AAOF,SAAc,YAAS;CACrB,MAAA,UAAA,WAAA,aAAA;CACF,IAAM,CAAC,SACL,MAAM,IAAA,MAAU,4LAA0C;CAE1D,OAAK;AACP;;;;AAKA,MAAS,wBAAO,mBAAA,gBAAA;;;;;;AAOhB,SAAE,oBAAkC;;CAElC,IAAA,CAAA,SACC,MAAO,IAAC,MAAO,qMAA2B;CAE3C,OAAE;AACJ"}
1
+ {"version":3,"file":"schema.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"code.d.mts","names":[],"sources":["../../../src/core/helpers/code.ts"],"mappings":";;;;;AA0CA;;;;;;;;;;;;;;AAGW;;;;;;iBAHK,IAAA,CACd,QAAA,EAAU,oBAAA,KACP,aAAA,EAAe,QAAA,KACjB,QAAA"}
1
+ {"version":3,"file":"code.d.mts","names":[],"sources":["../../../src/core/helpers/code.ts"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"code.mjs","names":[],"sources":["../../../src/core/helpers/code.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 { code as baseCode, Children } from \"@alloy-js/core\";\n\n/**\n * Turn the provided string template into Children by replacing literal line\n * breaks with hardlines and automatically indenting indented content. Similar\n * in spirit to the `<code>` element in HTML.\n *\n * @see {@link text} for a similar function which treats whitespace similar to\n * JSX template bodies.\n *\n * @example\n * ```ts\n * code`\n * function greet(name: string) {\n * console.log(\"Hello, \" + name + \"!\");\n * }\n * `\n * ```\n *\n * @param template - The template string to be processed into Children.\n * @param substitutions - Any interpolated values within the template, which will be treated as Children and properly indented.\n * @returns A Children representation of the provided template string, with proper handling of line breaks and indentation.\n * @throws Will throw an error if the provided template contains only whitespace, as this is likely a mistake and would cause a less recognizable \"Cannot read properties of undefined\" exception later in the processing.\n */\nexport function code(\n template: TemplateStringsArray,\n ...substitutions: Children[]\n): Children {\n if (\n template.filter(seg => seg.trim()).length === 0 &&\n substitutions.length === 0\n ) {\n throw new Error(\n \"The `code` function cannot be used with a template that contains only whitespace. Please provide a non-empty template.\"\n );\n }\n\n return baseCode(template, ...substitutions);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,KAAI,UAAA,GAAA,eAAA;CAClB,IAAA,SAAU,QAAA,QAAA,IAAoB,KAAA,CAAA,EAAA,WAAA,KAAA,cAAA,WAAA,GAC5B,MAAC,IAAA,MAAe,wHAAS;CAE3B,OAAG,OAAA,UAAA,GAAA,aAAA;AACL"}
1
+ {"version":3,"file":"code.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"block-declaration.d.mts","names":[],"sources":["../../../src/hcl/components/block-declaration.tsx"],"mappings":";;;UAsBiB,qBAAA,SAA8B,cAAc;EAC3D,IAAA;EACA,KAAA;AAAA;;;;;;;AAAK;AAYP;;iBAAgB,gBAAA,CAAiB,KAAA,EAAO,qBAAqB,4BAAA,QAAA"}
1
+ {"version":3,"file":"block-declaration.d.mts","names":[],"sources":["../../../src/hcl/components/block-declaration.tsx"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"block-declaration.mjs","names":[],"sources":["../../../src/hcl/components/block-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Prose, Show } from \"@alloy-js/core\";\nimport { code } from \"../../core/helpers/code\";\nimport { ComponentProps } from \"../../types/components\";\n\nexport interface BlockDeclarationProps extends ComponentProps {\n type: string;\n label: string | string[];\n}\n\n/**\n * A base component representing a block declaration in HCL. The children are rendered as a prose element, which means that they are broken into multiple lines. This component can be used to create more specific block declaration components, such as resource blocks, provider blocks, etc.\n *\n * @see https://developer.hashicorp.com/terraform/language#about-the-terraform-language\n * @see https://opentofu.org/docs/language/attr-as-blocks/#summary\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function BlockDeclaration(props: BlockDeclarationProps) {\n const { children, type, label } = props;\n\n return (\n <>\n {code`${type} ${Array.isArray(label) ? label.join(\" \") : label} {`}\n <Prose>\n <Show when={Boolean(children)}>{children}</Show>\n </Prose>\n {code`} `}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAgB,iBAAiB,OAAC;CACjC,MAAA,EACG,UACA,MACF,UACI;CACJ,OAAO;EAAC,WAAU,MAAM,GAAA,KAAS,GAAC,MAAK,QAAA,KAAA,IAAA,MAAA,KAAA,GAAA,IAAA,MAAA,GAAA;EAAA,gBAAA,OAAA;GAEvC,OAAO,gBAAA,MAAA;IACJ,IAAA,OAAA;KACE,OAAO,QAAQ,QAAM;IACrB;IACW;GACZ,CAAC;EACH,EACF,CAAC;EAAG,MAAA;CAAA;AACN"}
1
+ {"version":3,"file":"block-declaration.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"hcl-file.d.mts","names":[],"sources":["../../../src/hcl/components/hcl-file.tsx"],"mappings":";;;;;KA8BY,YAAA,GAAe,IAAA,CACzB,uBAAA,2BAGA,cAAA;EACE,MAAA,GAAS,QAAA;EACT,QAAA;AAAA;;;;;;;iBASY,OAAA,CAAQ,KAAA,EAAO,YAAA,GAAY,QAAA;;;;;;;iBAwB3B,aAAA,CAAc,KAAA,EAAO,cAAA,GAAc,QAAA"}
1
+ {"version":3,"file":"hcl-file.d.mts","names":[],"sources":["../../../src/hcl/components/hcl-file.tsx"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"hcl-file.mjs","names":[],"sources":["../../../src/hcl/components/hcl-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Children, computed, Show, splitProps } from \"@alloy-js/core\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { getFileHeaderWarning } from \"powerlines/utils\";\nimport {\n InfrastructureFile,\n InfrastructureFileProps\n} from \"../../core/components/infrastructure-file\";\nimport { SingleLineComment } from \"../../core/components/single-line-comment\";\nimport { usePowerlines } from \"../../core/contexts/context\";\nimport { ComponentProps } from \"../../types/components\";\n\nexport type HCLFileProps = Omit<\n InfrastructureFileProps,\n \"header\" | \"filetype\"\n> &\n ComponentProps & {\n header?: Children;\n filetype?: \"hcl\" | \"tf\" | `${string}.hcl` | `${string}.tf`;\n };\n\n/**\n * A base component representing a Powerlines generated HCL source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function HCLFile(props: HCLFileProps) {\n const [{ children, storage, header, filetype: _filetype, id }, rest] =\n splitProps(props, [\"children\", \"storage\", \"header\", \"filetype\", \"id\"]);\n\n const filetype = computed(() => _filetype || findFileExtension(id) || \"hcl\");\n\n return (\n <InfrastructureFile\n header={<HCLFileHeader>{header}</HCLFileHeader>}\n {...rest}\n id={id}\n filetype={filetype.value}\n storage={storage || \"fs\"}>\n <Show when={Boolean(children)}>{children}</Show>\n </InfrastructureFile>\n );\n}\n\n/**\n * Renders the header for a Powerlines HCL source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function HCLFileHeader(props: ComponentProps) {\n const [{ children }] = splitProps(props, [\"children\"]);\n\n const context = usePowerlines();\n\n return (\n <>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n <SingleLineComment variant=\"hcl\">{`Generated by ${\n titleCase(context?.config?.framework?.name) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment variant=\"hcl\">\n {getFileHeaderWarning(context)}\n </SingleLineComment>\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,SAAE,QAAA,OAAA;CACA,MAAA,CAAA,EACE,UACA,SACD,6BAED,MACG,QAAK,WAAU,OAAA;EAAY;EAAG;EAAoB;EAAK;EAAW;CAAA,CAAA;CACtE,MAAA,WAAA,eAAA,aAAA,kBAAA,EAAA,KAAA,KAAA;CACC,OAAO,gBAAa,oBAAyB,WAAK,EAChD,IAAA,SAAY;EACd,OAAA,gBAAA,eAAA,EACK,UAAS,OACd,CAAK;CACH;EAEI;;GAEN,OAAO,SAAA;EACL;EACA,SAAS,WAAE;EACX,IAAI,WAAM;GACR,OAAM,gBAAA,MAAA;IACN,IAAA,OAAU;KACV,OAAS,QAAU,QAAM;IACxB;IACD;GACH,CAAA;EACH;;AAEA;;;;;;;;CASE,MAAM,CAAA,gBAEN,WAAO,OAAA,CAAA,UAAA,CAAA;CACP,MAAG,UAAA,cAAA;CACH,OAAK;EAAA,gBAAmB,MAAQ;GAC9B,IAAI,OAAC;IACH,OAAK,QAAQ,QAAA;GACf;GACA,IAAI,WAAE;IACJ,OAAM,CAAA,UAAA,gBAAA,OAAA,CAAA,CAAA,CAAA;GACR;EACF,CAAC;EAAG,gBAAY,mBAAiB;GAC/B,SAAO;GACP,IAAG,WAAK;IACN,OAAC,gBAAkB,UAAa,SAAA,QAAA,WAAA,IAAA,KAAA;GAClC;EACF,CAAC;EAAG,gBAAE,OAAiB,CAAA,CAAA;EAAA,gBAAA,mBAAA;GACrB,SAAQ;GACR,IAAE,WAAA;IACH,OAAA,qBAAA,OAAA;GACH"}
1
+ {"version":3,"file":"hcl-file.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
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
+ {"version":3,"file":"packer-file.d.mts","names":[],"sources":["../../../src/hcl/components/packer-file.tsx"],"mappings":""}
@@ -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,UAAW,CAAA;8CAExC,UAAO,UACP,GAAG,MAAA,EACD,IAAG,WAAW;EACZ,OAAO,gBAAA,MAAA;GACV,IAAA,OAAA;IACH,OAAA,QAAA,QAAA"}
1
+ {"version":3,"file":"packer-file.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
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
+ {"version":3,"file":"terraform-file.d.mts","names":[],"sources":["../../../src/hcl/components/terraform-file.tsx"],"mappings":""}
@@ -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,UAAW,CAAA;8CAExC,UAAO,KACP,GAAG,MAAA,EACD,IAAG,WAAW;EACZ,OAAO,gBAAA,MAAA;GACV,IAAA,OAAA;IACH,OAAA,QAAA,QAAA"}
1
+ {"version":3,"file":"terraform-file.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"capnp.d.mts","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,mBAAmB,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,IAAe,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
+ {"version":3,"file":"capnp.d.mts","names":[],"sources":["../../src/helpers/capnp.ts"],"mappings":""}
@@ -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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AA,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
+ {"version":3,"file":"capnp.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"create-builtin.d.mts","names":[],"sources":["../../src/helpers/create-builtin.ts"],"mappings":";;;;KA0BY,oBAAA,WAA+B,iBAAA,IAAqB,IAAA,CAC9D,kBAAA,CAAmB,CAAA;;AADrB;;;;;iBAWgB,aAAA,iBAA8B,iBAAA,EAC5C,OAAA,EAAS,oBAAA,CAAqB,CAAA,IAC7B,cAAA,CAAe,CAAA,IAAK,aAAA"}
1
+ {"version":3,"file":"create-builtin.d.mts","names":[],"sources":["../../src/helpers/create-builtin.ts"],"mappings":""}
@@ -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;CA8DjC,OAAO,cAAY;EACjB,GAAG;EACH,SAAS;CACX,CAAC;AACH"}
1
+ {"version":3,"file":"create-builtin.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"refkey.d.mts","names":[],"sources":["../../src/helpers/refkey.ts"],"mappings":";;;;;AA0BA;;;;iBAAgB,MAAA,IAAU,IAAA,cAAkB,MAAM"}
1
+ {"version":3,"file":"refkey.d.mts","names":[],"sources":["../../src/helpers/refkey.ts"],"mappings":""}
@@ -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 if (args.length === 0) {\n return refkeyExternal();\n }\n\n return refkeyExternal(\"powerlines\", ...args);\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgB,OAAO,GAAG,MAAM;CAC9B,IAAI,KAAK,WAAW,GAClB,OAAO,SAAe;;AAG1B"}
1
+ {"version":3,"file":"refkey.mjs","names":[],"sources":[],"mappings":""}
@@ -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,OAAO,CAAC,CAAA;AAAA;AAAA,UAqJT,gCAAA;EACf,YAAA;EACA,eAAA;EACA,aAAA,GAAgB,OAAO,CAAC,CAAA;AAAA;;;;AAxJC;AAqJ3B;;;iBAagB,yBAAA,WAAoC,MAAA,eAClD,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":""}
@@ -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,CAAA,GAAA;CACnD,IAAA,CAAA,YACA,OAAA;CAEF,OAAA;;KAEE,WAAA,eAAA,KAAA,GAAA,UAAA,QAAA,gBAAA,WAAA,aAAA,KAAA,WAAA,QAAA,CAAA,EAAA,kBAAA;;eAED,UAAA,QAAA,gBAAA,WAAA,QAAA,CAAA,IAAA,QAAA,oBAAA,UAAA,QAAA,mBAAA,WAAA,wBAAA,GAAA,QAAA,KAAA,KAAA,QAAA,mBAAA,WAAA,wBAAA,GAAA,QAAA,MAAA,GAAA;IACG,WAAM,cAAiB,EAAA,QAAW,SAAQ,CAAC,KAAA,UAAa,KAAO,CAAA,YAAG,QAAA,gBAAA,KAAA,gBAAA,MAAA,KAAA,SAAA,EAAA,QAAA,KAAA,UAAA;EAClE,IAAA,YAAgB,GAAA,KAAQ,CAAA,YAAI,QAAe,gBAAM,MAAA,GACjD,OAAS,QAAQ,gBAAe;EAEpC,OAAO;CACL,GAAA,MAAY,KAAA,KAAA,gBAAkB,CAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA,WAAA,KAAA,EAAA,WAAA,KAAA,CAAA,EAAA,WAAA,KAAA,CAAA,EAAA,WAAA,IAAA,EAAA,gBAAA,EAAA,cAAA,EAAA,gBAAA,CAAA,IAAA,EAAA,WAAA,IAAA,IAAA,EAAA,EAAA,KAAA,SAAA;MAC9B,KAAS,eAAA,KAAA,KAAA,SAAkC,KAAK,UAAA,KAAA,gBAAA,CAAA,EAAA;;aAE3C,KAAW,SAAC,KAAA,UAAA,KAAA,gBAAA,CAAA,IAAA,KAAA,SAAA,EAAA,SAAA;IACf,KAAA,SAAS,EAAA,KAAA,UAAA,aAAA,OAAA,EAAA,KAAA,IAAA,MAAA,KAAA,KAAA,UAAA,IAAA;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"}
1
+ {"version":3,"file":"typescript.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":""}
@@ -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 { 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
+ {"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
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
+ {"version":3,"file":"front-matter.d.mts","names":[],"sources":["../../../src/markdown/components/front-matter.tsx"],"mappings":""}
@@ -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;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
+ {"version":3,"file":"front-matter.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
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
+ {"version":3,"file":"heading.d.mts","names":[],"sources":["../../../src/markdown/components/heading.tsx"],"mappings":""}
@@ -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,EACP,GAAG,MAAA,EACE,SACL,CAAC,CAAC,GAAG,gBAAU,SAAA,CAAA,CAAA,CAAA;AACjB"}
1
+ {"version":3,"file":"heading.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-file.d.mts","names":[],"sources":["../../../src/markdown/components/markdown-file.tsx"],"mappings":";;;;;KA6BY,iBAAA,GAAoB,IAAA,CAAK,eAAA,gBACnC,cAAA,GACA,uBAAA;;AAFF;;;;;iBAUgB,YAAA,CAAa,KAAA,EAAO,iBAAiB,4BAAA,QAAA;AAAA,KAmBzC,uBAAA,GAA0B,qBAAA;EACpC,WAAA,GAAc,gBAAgB;AAAA;;;;;;AA5BP;iBAqCT,kBAAA,CAAmB,KAAA,EAAO,uBAAuB,4BAAA,QAAA"}
1
+ {"version":3,"file":"markdown-file.d.mts","names":[],"sources":["../../../src/markdown/components/markdown-file.tsx"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-file.mjs","names":[],"sources":["../../../src/markdown/components/markdown-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 { Link } from \"@alloy-js/markdown\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks\";\nimport { getFileHeaderWarning } from \"powerlines/utils\";\nimport { SingleLineComment } from \"../../core/components/single-line-comment\";\nimport { SourceFile, SourceFileProps } from \"../../core/components/source-file\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport { ComponentProps, SourceFileHeaderProps } from \"../../types/components\";\nimport { FrontMatter, FrontMatterProps } from \"./front-matter\";\n\nexport type MarkdownFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps &\n MarkdownFileHeaderProps;\n\n/**\n * A base component representing a Powerlines generated markdown source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function MarkdownFile(props: MarkdownFileProps) {\n const [{ children, storage, frontMatter }, rest] = splitProps(props, [\n \"children\",\n \"storage\",\n \"frontMatter\"\n ]);\n\n return (\n <SourceFile\n header={<MarkdownFileHeader frontMatter={frontMatter} />}\n {...rest}\n filetype=\"md\"\n reference={Link}\n storage={storage}>\n <Show when={Boolean(children)}>{children}</Show>\n </SourceFile>\n );\n}\n\nexport type MarkdownFileHeaderProps = SourceFileHeaderProps & {\n frontMatter?: FrontMatterProps[\"data\"];\n};\n\n/**\n * Renders the header for a Powerlines Typescript source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function MarkdownFileHeader(props: MarkdownFileHeaderProps) {\n const [\n {\n children,\n disableEslint = true,\n disableBiome = true,\n disablePrettier = false,\n frontMatter\n }\n ] = splitProps(props, [\n \"children\",\n \"disableEslint\",\n \"disableBiome\",\n \"disablePrettier\",\n \"frontMatter\"\n ]);\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show\n when={isSetObject(frontMatter) && Object.keys(frontMatter).length > 0}>\n <FrontMatter data={frontMatter!} />\n </Show>\n <Show when={Boolean(disableEslint)}>\n <SingleLineComment variant=\"markdown\">\n {\"eslint-disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disablePrettier)}>\n <SingleLineComment variant=\"markdown\">\n {\"prettier-ignore\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disableBiome)}>\n <SingleLineComment variant=\"markdown\">\n {\"biome-ignore lint: disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show\n when={\n Boolean(disableEslint) ||\n Boolean(disablePrettier) ||\n Boolean(disableBiome)\n }>\n <hbr />\n </Show>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n <SingleLineComment variant=\"markdown\">{`Generated by ${\n titleCase(context?.config?.framework?.name) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment variant=\"markdown\">\n {getFileHeaderWarning(context!)}\n </SingleLineComment>\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,SAAC,aAAA,OAAA;CACC,MAAE,CAAK,EACL,UACF,SACF,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AA;KACC,UAAK;IACP,CAAC,GAAG,gBAAQ,OAAgB,CAAA,CAAA,CAAA;GAC9B;EACF,CAAC;EAAG,gBAAY,MAAY;GAC1B,IAAI,OAAC;IACH,OAAO,QAAC,aAAA,KAAA,QAAA,eAAA,KAAA,QAAA,YAAA;GACV;GACA,IAAG,WAAW;IACZ,OAAG,gBAAA,OAAA,CAAA,CAAA;GACL;EACF,CAAC;EAAG,gBAAU,MAAA;GACZ,IAAI,OAAE;IACJ,OAAM,QAAA,QAAA;GACR;GACA,IAAI,WAAU;IACZ,OAAK,CAAA,UAAA,gBAAiB,OAAA,CAAA,CAAA,CAAA;GACxB;EACF,CAAC;EAAG,gBAAkB,mBAAmB;GACvC,SAAK;GACL,IAAI,WAAA;IACF,OAAM,gBAAA,UAAA,SAAA,QAAA,WAAA,IAAA,KAAA;GACR;EACF,CAAC;EAAA,gBAAA,OAAA,CAAA,CAAA;EAAA,gBAAA,mBAAA;GACH,SAAA"}
1
+ {"version":3,"file":"markdown-file.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-table.d.mts","names":[],"sources":["../../../src/markdown/components/markdown-table.tsx"],"mappings":";;;;UA4BiB,kBAAA,WACL,MAAA,gBAAsB,MAAA,uBACxB,cAAA;EACR,IAAA,EAAM,CAAA;AAAA;;;;iBAMQ,aAAA,WACJ,MAAA,gBAAsB,MAAA,eAChC,KAAA,EAAO,kBAAA,CAAmB,CAAA,6BAAE,QAAA;AAAA,KAmBlB,wBAAA,GAA2B,cAAA,GACrC,OAAA,CAAQ,IAAA,CAAK,mCAAA,cACb,QAAA,CAAS,IAAA,CAAK,mCAAA;EACZ,KAAA;AAAA;;;;iBAMY,mBAAA,CAAoB,KAAA,EAAO,wBAAwB,4BAAA,QAAA;;;;iBA6CnD,yBAAA,CAA0B,KAAA,EAAO,wBAAwB,4BAAA,QAAA"}
1
+ {"version":3,"file":"markdown-table.d.mts","names":[],"sources":["../../../src/markdown/components/markdown-table.tsx"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-table.mjs","names":[],"sources":["../../../src/markdown/components/markdown-table.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, Prose, Show, splitProps } from \"@alloy-js/core\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { ComponentProps } from \"../../types/components\";\nimport {\n MarkdownTableColumnContextInterface,\n MarkdownTableContext,\n useMarkdownTable\n} from \"../contexts/markdown-table\";\n\nexport interface MarkdownTableProps<\n T extends Record<string, any> = Record<string, any>\n> extends ComponentProps {\n data: T[];\n}\n\n/**\n * Component that provides a context for rendering markdown tables.\n */\nexport function MarkdownTable<\n T extends Record<string, any> = Record<string, any>\n>(props: MarkdownTableProps<T>) {\n const [{ children, data }] = splitProps(props, [\"children\", \"data\"]);\n\n const columns = computed(() =>\n Object.keys(data).map((name: string, index: number) => ({\n index,\n name,\n align: \"left\" as const,\n width: 20\n }))\n );\n\n return (\n <MarkdownTableContext.Provider value={{ columns: columns.value, data }}>\n <Show when={Boolean(children)}>{children}</Show>\n </MarkdownTableContext.Provider>\n );\n}\n\nexport type MarkdownTableColumnProps = ComponentProps &\n Partial<Pick<MarkdownTableColumnContextInterface, \"align\">> &\n Required<Pick<MarkdownTableColumnContextInterface, \"name\">> & {\n width?: number;\n };\n\n/**\n * Component that provides a context for rendering markdown tables.\n */\nexport function MarkdownTableColumn(props: MarkdownTableColumnProps) {\n const [{ children, width, align, name }] = splitProps(props, [\n \"children\",\n \"width\",\n \"align\",\n \"name\"\n ]);\n\n const tableContext = useMarkdownTable();\n const columnRef = computed(() =>\n tableContext?.columns.find(c => c.name === name)\n );\n\n const indexRef = computed(() => columnRef.value?.index ?? 0);\n const alignRef = computed(() => columnRef.value?.align ?? align ?? \"left\");\n const widthRef = computed(() => columnRef.value?.width ?? width ?? 20);\n\n const textLength = computed(() => {\n const content = children ? children.toString() : \"\";\n\n return content.length;\n });\n\n return (\n <Prose>\n <Show when={indexRef.value === 0}>{\"|\"}</Show>\n <Show when={Boolean(children)}>\n <Prose>{code`${\n alignRef.value === \"left\"\n ? \" \".repeat(widthRef.value - textLength.value - 1)\n : \" \"\n }${children}${\n alignRef.value === \"right\"\n ? \" \".repeat(widthRef.value - textLength.value - 1)\n : \" \"\n }`}</Prose>\n </Show>\n {\"|\"}\n </Prose>\n );\n}\n\n/**\n * Component that provides a context for rendering markdown tables.\n */\nexport function MarkdownTableColumnHeader(props: MarkdownTableColumnProps) {\n const [{ children, name }, rest] = splitProps(props, [\"children\", \"name\"]);\n\n return (\n <>\n <MarkdownTableColumn {...rest} name={name}>\n <Show\n fallback={titleCase(name, {\n useDescriptions: false\n })}\n when={!isUndefined(children)}>\n {children}\n </Show>\n </MarkdownTableColumn>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;CA4BA,MAAO,CAAA,EACH,UACF,UACK,WAAI,OAAA,CAAA,YAAA,MAAA,CAAA;CACX,MAAA,UAAA,eAAA,OAAA,KAAA,IAAA,EAAA,KAAA,MAAA,WAAA;;EAEE;EACC,OAAA;EACD,OAAA;CACF,EAAA,CAAA;CACE,OAAE,gBAAuB,qBAAqB,UAAI;EAClD,IAAM,QAAC;GACP,OAAS;;IAEH;GACJ;EACA;EACA,IAAE,WAAI;GACJ,OAAO,gBAAe,MAAA;IACtB,IAAM,OAAC;KACP,OAAA,QAAA,QAAA;IACH;;GAED,CAAA;EACE;CACF,CAAC;AACH;;;;AAIA,SAA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[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-table.d.mts","names":[],"sources":["../../../src/markdown/contexts/markdown-table.ts"],"mappings":";;;UAqBiB,mCAAA,WACL,MAAA,gBAAsB,MAAA;EAEhC,KAAA;EACA,IAAA,QAAY,CAAA;EACZ,KAAA;EACA,KAAA;AAAA;;;;cAMW,0BAAA,EAA4B,gBAAgB,CAAC,mCAAA;;;;;;iBAW1C,sBAAA,IAAsB,mCAAA,CAAA,MAAA;AAAA,UAMrB,6BAAA,WACL,MAAA,gBAAsB,MAAA;EAEhC,OAAA,EAAS,mCAAA,CAAoC,CAAA;EAC7C,IAAA,EAAM,CAAA;AAAA;AArBR;;;AAAA,cA2Ba,oBAAA,EAAsB,gBAAgB,CAAC,6BAAA;AA3ByC;AAW7F;;;;AAX6F,iBAsC7E,gBAAA,IAAgB,6BAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"markdown-table.d.mts","names":[],"sources":["../../../src/markdown/contexts/markdown-table.ts"],"mappings":""}
@@ -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":";;;;;;AAsBA,MAAY,6BAA6B,mBAAW,uBAAA,CAAA,CAAA;;;;;;;CAQlD,OAAA,WAAA,0BAAA;AACF;;;;AAIA,MAAK,uBAAoB,cAAA;CACvB,SAAQ,CAAA;CACR,MAAC,CAAA;;;;;;;AAQH,SAAS,mBAAW;CAClB,OAAE,WAAA,oBAAA;AACJ"}
1
+ {"version":3,"file":"markdown-table.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.mts","names":[],"sources":["../src/render.tsx"],"mappings":";;;;;;AAgDA;;;;;;;;;;;;iBAAsB,MAAA,kBAAwB,aAAA,EAC5C,OAAA,EAAS,QAAA,EACT,QAAA,EAAU,QAAA,GAAQ,OAAA;;;;;AAAA;AA2GpB;;;;;;;;;;iBAAgB,YAAA,kBAA8B,aAAA,EAC5C,OAAA,EAAS,QAAA,EACT,QAAA,EAAU,QAAA,EACV,OAAA,GAAU,gBAAA"}
1
+ {"version":3,"file":"render.d.mts","names":[],"sources":["../src/render.tsx"],"mappings":""}
@@ -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 { noop } from \"@stryke/helpers/noop\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { list } from \"@stryke/string-format/list\";\nimport { PluginContext } from \"powerlines\";\nimport { MetaItem, Output } from \"./core\";\nimport { OutputFile } from \"./types\";\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 context={context} meta={meta}>\n {children}\n </Output>\n );\n\n const files = [] as OutputFile[];\n await traverseOutput(output, {\n visitDirectory: noop,\n visitFile: file => files.push(file)\n });\n\n if (!files.length) {\n context.debug(\"No output files were rendered by the Alloy-js components.\");\n } else {\n context.debug(\n `Rendering ${files.length} output files from Alloy-js components: ${list(\n files.map(\n file =>\n `${replacePath(file.path, context.config.cwd)}${\n meta[file.path]?.kind === \"builtin\" ||\n meta[file.path]?.kind === \"infrastructure\"\n ? ` (${\n meta[file.path]?.kind === \"builtin\"\n ? \"Builtin\"\n : \"Infrastructure\"\n })`\n : \"\"\n }`\n )\n )}.`\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(<Output context={context}>{children}</Output>);\n\n return printTree(tree, options);\n}\n"],"mappings":";;;;;;;;;;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OACvB,YAAW,SAAW;OACxB,SAAM,SAAA;OACR,WAAA,kBAAA,KAAA,IAAA;;KAEA,OACD,QAAA,SAAA,KAAA,UAAA,KAAA,MAAA,QAAA;IAEC,OACE,QAAM,GAAA,SAAW,KAAK,YAAe,KAAC,IAAA;GAE1C;EACF,CAAC;CACH;AACF;;;;;;;;;;;;;;;;AAiBA,SAAgB,aAAa,SAAC,UAAA,SAAA;CAK5B,OAAO,UAJK,WAAU,gBAAK,UAAA;EAChB;EACC;CACZ,CAAC,CACY,GAAA,OAAA;AACf"}
1
+ {"version":3,"file":"render.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.mts","names":[],"sources":["../../src/types/components.ts"],"mappings":";;;;;UAsBiB,cAAA;EACf,IAAA;EACA,IAAA;EACA,UAAA;;;;;;;EAQA,MAAA,GAAS,aAAa;AAAA;AAAA,UAGP,eAAA;EACf,IAAA;EACA,IAAA;EACA,QAAA;EACA,QAAA;EAHA;;;;;;EAWA,MAAA,GAAS,aAAa;AAAA;AAAA,KAGZ,UAAA,IACP,eAAA;EAAoB,IAAA;AAAA,MACpB,eAAA;EACC,IAAA;EACA,cAAA,GAAiB,0BAAA;AAAA,MAElB,eAAA;EAAoB,IAAA;EAAiB,EAAA;AAAA,KACtC,cAAA;AAAA,UAEa,eAAA;EACf,IAAA;EACA,IAAA;EACA,QAAA,GAAW,eAAA,GAAkB,UAAU;AAAA;AAAA,UAGxB,kBAAA;EACf,cAAA,EAAgB,0BAA0B;AAAA;AAAA,UAG3B,oBAAA;EACf,EAAE;AAAA;AAAA,UAGa,mBAAA;EACf,IAAA,GAAO,aAAa;AAAA;AAAA,UAGL,qBAAA;EACf,IAAA;EACA,UAAU;AAAA;AAAA,UAGK,aAAA,SAAsB,OAAA;EACrC,IAAA;IACE,QAAA,GAAW,qBAAA;IAtBgB;;AAAU;IA2BrC,OAAA,GAAU,oBAAA;IAxBqB;;;IA6B/B,KAAA,GAAQ,kBAAA;IAzBK;;;IA8Bb,MAAA,GAAS,mBAAA;EAAA,IACP,MAAA;AAAA;;;;UAMW,cAAA;EACf,QAAA,GAAW,QAAQ;AAAA;;;AA5BT;KAkCA,0BAAA,GAA6B,IAAA,CAAK,cAAA,gBAC5C,QAAA,CAAS,IAAA,CAAK,cAAA;AAAA,UAEC,wBAAA,SAAiC,mBAAiB;;;;EAIjE,EAAE;AAAA;AAAA,UAGa,2BAAA;EACf,IAAA,YAAgB,QAAA;EAChB,IAAA,YAAgB,QAAA;EAChB,OAAA;EACA,YAAA,GAAe,OAAA,CAAQ,CAAA;AAAA;AAAA,UAGR,wBAAA;EACf,IAAA;EACA,OAAA;EACA,KAAA;EACA,IAAA;AAAA;AAAA,KAGU,qBAAA,GAAwB,MAAA,yBAElB,KAAA,CAAM,wBAAA;AAAA,UAGP,qBAAA,SAA8B,cAAc;EA1CvD;;AAAM;AAMZ;;EA0CE,aAAA;EAzCA;AAAmB;AAMrB;;;EA0CE,YAAA;EA1CuC;;;;;EAiDvC,eAAA;AAAA"}
1
+ {"version":3,"file":"components.d.mts","names":[],"sources":["../../src/types/components.ts"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"components.mjs","names":[],"sources":["../../src/types/components.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 { Children, Context } from \"@alloy-js/core\";\nimport type { SourceFileContext } from \"@alloy-js/typescript\";\nimport { ResolvedEntryFileReference, StoragePreset } from \"powerlines\";\n\nexport interface CopyOutputFile {\n kind: \"file\";\n path: string;\n sourcePath: string;\n\n /**\n * The format of the output files\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided \\`output.mode\\` value.\n */\n preset?: StoragePreset;\n}\n\nexport interface WriteOutputFile {\n kind: \"file\" | \"entry\" | \"builtin\";\n path: string;\n contents: string;\n filetype: string;\n\n /**\n * The format of the output files\n *\n * @remarks\n * If not specified, the output mode will be determined by the provided \\`output.mode\\` value.\n */\n preset?: StoragePreset;\n}\n\nexport type OutputFile =\n | (WriteOutputFile & { kind: \"file\" })\n | (WriteOutputFile & {\n kind: \"entry\";\n typeDefinition?: ResolvedEntryFileReference;\n })\n | (WriteOutputFile & { kind: \"builtin\"; id: string })\n | CopyOutputFile;\n\nexport interface OutputDirectory {\n kind: \"directory\";\n path: string;\n contents: (OutputDirectory | OutputFile)[];\n}\n\nexport interface RenderEntryContext {\n typeDefinition: ResolvedEntryFileReference;\n}\n\nexport interface RenderBuiltinContext {\n id: string;\n}\n\nexport interface RenderOutputContext {\n mode?: StoragePreset;\n}\n\nexport interface CopyFileOutputContext {\n path?: string;\n sourcePath?: string;\n}\n\nexport interface RenderContext extends Context {\n meta?: {\n copyFile?: CopyFileOutputContext;\n\n /**\n * The current context for the built-in module.\n */\n builtin?: RenderBuiltinContext;\n\n /**\n * The current context for the application entrypoint file being rendered.\n */\n entry?: RenderEntryContext;\n\n /**\n * The current context for output rendering.\n */\n output?: RenderOutputContext;\n } & Record<string, any>;\n}\n\n/**\n * A type that represents the props of a component that can have children.\n */\nexport interface ComponentProps {\n children?: Children;\n}\n\n/**\n * A type that requires the `children` prop in a component.\n */\nexport type ComponentPropsWithChildren = Omit<ComponentProps, \"children\"> &\n Required<Pick<ComponentProps, \"children\">>;\n\nexport interface BuiltinSourceFileContext extends SourceFileContext {\n /**\n * The runtime module identifier.\n */\n id: string;\n}\n\nexport interface ReflectionOverrideInterface<T> {\n name?: string | Children;\n type?: string | Children;\n extends?: string | false;\n defaultValue?: Partial<T>;\n}\n\nexport interface TypescriptFileImportItem {\n name: string;\n default?: boolean;\n alias?: string;\n type?: boolean;\n}\n\nexport type TypescriptFileImports = Record<\n string,\n null | string | Array<TypescriptFileImportItem | string>\n>;\n\nexport interface SourceFileHeaderProps extends ComponentProps {\n /**\n * If true, disables the ESLint directive at the top of the file.\n *\n * @defaultValue true\n */\n disableEslint?: boolean;\n\n /**\n * If true, disables the Biome directive at the top of the file.\n *\n * @defaultValue true\n */\n disableBiome?: boolean;\n\n /**\n * If true, disables the Prettier directive at the top of the file.\n *\n * @defaultValue false\n */\n disablePrettier?: boolean;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"components.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;KAyBY,kBAAA,GAAqB,OAAO,CAAC,gBAAA;AAAA,KAE7B,qBAAA,GAAwB,qBAAA;EAClC,KAAA,GAAQ,kBAAkB;AAAA;AAAA,KAGhB,yBAAA,GAA4B,yBAAA;EACtC,KAAA,EAAO,kBAAkB;AAAA;AAAA,KAGf,kBAAA,yBACc,yBAAA,GAA4B,yBAAA,IAClD,aAAA,CAAc,eAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"builtin-file.d.mts","names":[],"sources":["../../../src/typescript/components/builtin-file.tsx"],"mappings":";;;;KAgCY,gBAAA,GAAmB,IAAA,CAAK,mBAAA,YAClC,IAAA,CAAK,gBAAA;;AADP;;;;;EAQI,EAAA;EAPF;;;EAYE,WAAA;EAbgC;;;;;EAoBhC,GAAA;AAAA;AAAG;AASP;;;;;AATO,iBASS,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
1
+ {"version":3,"file":"builtin-file.d.mts","names":[],"sources":["../../../src/typescript/components/builtin-file.tsx"],"mappings":""}
@@ -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":";;;;;;;;;;;;;;;;AAgCA,SAAY,YAAgB,OAAO;CACjC,MAAK,CAAA,EACH,UACA,SACA,gBACA,IACA,aACA,OACA,QAAI,WAAM,OAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;CAAA,CAAA;;CAEZ,MAAI,OAAA,eAAA,YAAA,GAAA,CAAA,MAAA,GAAA,IAAA,KAAA,iBAAA,EAAA,IAAA,iBAAA,EAAA,KAAA,CAAA,MAAA,GAAA,IAAA,KAAA,MAAA,SAAA,SAAA,SAAA,YAAA,CAAA;CACJ,OAAK,gBAAoB,gBAAY,WAAM;EACzC,IAAE,SAAA;GACF,OAAA,gBAAoB,sBAAA;;KAElB,OAAA,gBAAA,aAAA;MACC,MAAW;MACb,UAAA;KACG,CAAA;IACF;IACE,IAAE,WAAO;KACd,OAAA,gBAAA,6BAAA;;MAED;KACQ,CAAA;IACT;GACG,CAAA;EACA;EACF,IAAA,OAAA;GACI,OAAC;IACC,MAAG;IACP,WAAW,MAAO,QAAA;IACf,IAAA,iBAAS,EAAA;GACV;EACF;CACF,GAAG,MAAK;EACN,IAAG,OAAA;GACD,OAAI,KAAA;EACN;;CAEF,CAAA,CAAA;AACF"}
1
+ {"version":3,"file":"builtin-file.mjs","names":[],"sources":[],"mappings":""}