@powerlines/plugin-alloy 0.25.29 → 0.25.31

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 (78) hide show
  1. package/dist/core/components/output.cjs +12 -7
  2. package/dist/core/components/output.mjs +12 -7
  3. package/dist/core/components/output.mjs.map +1 -1
  4. package/dist/core/components/single-line-comment.cjs +5 -8
  5. package/dist/core/components/single-line-comment.mjs +5 -8
  6. package/dist/core/components/single-line-comment.mjs.map +1 -1
  7. package/dist/core/components/source-file.cjs +8 -7
  8. package/dist/core/components/source-file.mjs +8 -7
  9. package/dist/core/components/source-file.mjs.map +1 -1
  10. package/dist/core/components/spacing.cjs +5 -6
  11. package/dist/core/components/spacing.mjs +5 -6
  12. package/dist/core/components/spacing.mjs.map +1 -1
  13. package/dist/index.cjs +5 -0
  14. package/dist/index.d.cts.map +1 -1
  15. package/dist/index.d.mts.map +1 -1
  16. package/dist/index.mjs +5 -0
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/markdown/components/front-matter.cjs +12 -9
  19. package/dist/markdown/components/front-matter.mjs +12 -9
  20. package/dist/markdown/components/front-matter.mjs.map +1 -1
  21. package/dist/markdown/components/markdown-file.cjs +57 -41
  22. package/dist/markdown/components/markdown-file.mjs +57 -41
  23. package/dist/markdown/components/markdown-file.mjs.map +1 -1
  24. package/dist/markdown/components/markdown-table.cjs +31 -20
  25. package/dist/markdown/components/markdown-table.mjs +31 -20
  26. package/dist/markdown/components/markdown-table.mjs.map +1 -1
  27. package/dist/render.cjs +10 -4
  28. package/dist/render.mjs +10 -4
  29. package/dist/render.mjs.map +1 -1
  30. package/dist/typescript/components/builtin-file.cjs +21 -9
  31. package/dist/typescript/components/builtin-file.mjs +21 -9
  32. package/dist/typescript/components/builtin-file.mjs.map +1 -1
  33. package/dist/typescript/components/class-declaration.cjs +112 -79
  34. package/dist/typescript/components/class-declaration.mjs +112 -79
  35. package/dist/typescript/components/class-declaration.mjs.map +1 -1
  36. package/dist/typescript/components/dynamic-import-statement.cjs +6 -1
  37. package/dist/typescript/components/dynamic-import-statement.mjs +6 -1
  38. package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
  39. package/dist/typescript/components/entry-file.cjs +7 -3
  40. package/dist/typescript/components/entry-file.mjs +7 -3
  41. package/dist/typescript/components/entry-file.mjs.map +1 -1
  42. package/dist/typescript/components/infrastructure-file.cjs +7 -3
  43. package/dist/typescript/components/infrastructure-file.mjs +7 -3
  44. package/dist/typescript/components/infrastructure-file.mjs.map +1 -1
  45. package/dist/typescript/components/interface-declaration.cjs +83 -47
  46. package/dist/typescript/components/interface-declaration.mjs +83 -47
  47. package/dist/typescript/components/interface-declaration.mjs.map +1 -1
  48. package/dist/typescript/components/object-declaration.cjs +48 -36
  49. package/dist/typescript/components/object-declaration.mjs +48 -36
  50. package/dist/typescript/components/object-declaration.mjs.map +1 -1
  51. package/dist/typescript/components/property-name.cjs +2 -2
  52. package/dist/typescript/components/property-name.mjs +3 -3
  53. package/dist/typescript/components/property-name.mjs.map +1 -1
  54. package/dist/typescript/components/tsdoc-reflection.cjs +112 -54
  55. package/dist/typescript/components/tsdoc-reflection.mjs +112 -54
  56. package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
  57. package/dist/typescript/components/tsdoc.cjs +211 -140
  58. package/dist/typescript/components/tsdoc.mjs +211 -140
  59. package/dist/typescript/components/tsdoc.mjs.map +1 -1
  60. package/dist/typescript/components/type-declaration.cjs +17 -9
  61. package/dist/typescript/components/type-declaration.mjs +17 -9
  62. package/dist/typescript/components/type-declaration.mjs.map +1 -1
  63. package/dist/typescript/components/type-parameters.cjs +33 -33
  64. package/dist/typescript/components/type-parameters.mjs +33 -33
  65. package/dist/typescript/components/type-parameters.mjs.map +1 -1
  66. package/dist/typescript/components/typescript-file.cjs +90 -65
  67. package/dist/typescript/components/typescript-file.mjs +90 -65
  68. package/dist/typescript/components/typescript-file.mjs.map +1 -1
  69. package/dist/typescript/contexts/lexical-scope.cjs +5 -1
  70. package/dist/typescript/contexts/lexical-scope.mjs +5 -1
  71. package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
  72. package/dist/typescript/contexts/member-scope.cjs +5 -2
  73. package/dist/typescript/contexts/member-scope.mjs +5 -2
  74. package/dist/typescript/contexts/member-scope.mjs.map +1 -1
  75. package/dist/yaml/components/yaml-file.cjs +58 -48
  76. package/dist/yaml/components/yaml-file.mjs +58 -48
  77. package/dist/yaml/components/yaml-file.mjs.map +1 -1
  78. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-file.mjs","names":["SourceFileContext"],"sources":["../../../src/typescript/components/typescript-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 type { Children } from \"@alloy-js/core\";\nimport {\n code,\n computed,\n For,\n Scope,\n Show,\n SourceDirectoryContext,\n splitProps,\n useContext,\n useScope\n} from \"@alloy-js/core\";\nimport {\n getSourceDirectoryData,\n ImportStatements,\n PackageContext,\n SourceFileContext,\n TSModuleScope,\n useSourceFile\n} from \"@alloy-js/typescript\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isString } from \"@stryke/type-checks/is-string\";\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 {\n ComponentProps,\n SourceFileHeaderProps,\n TypescriptFileImportItem,\n TypescriptFileImports\n} from \"../../types/components\";\n\nexport type TypescriptFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps & {\n hashbang?: Children | true;\n header?: Children;\n imports?: TypescriptFileImports;\n builtinImports?: TypescriptFileImports;\n export?: boolean | string;\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 TypescriptFile(props: TypescriptFileProps) {\n const [\n { children, path, imports, builtinImports, tsx, header, hashbang },\n rest\n ] = splitProps(props, [\n \"children\",\n \"path\",\n \"imports\",\n \"builtinImports\",\n \"tsx\",\n \"header\",\n \"hashbang\"\n ]);\n\n const directoryContext = useContext(SourceDirectoryContext)!;\n const sdData = getSourceDirectoryData(directoryContext);\n\n const modulePath = appendPath(path, directoryContext.path);\n const scope = new TSModuleScope(modulePath, useScope());\n sdData.modules.add(scope);\n\n const pkg = useContext(PackageContext);\n if (pkg) {\n pkg.scope.addModule(scope);\n }\n\n if (props.export) {\n if (pkg) {\n if (isBoolean(props.export)) {\n pkg.scope.addExport(modulePath, scope);\n } else {\n pkg.scope.addExport(props.export, scope);\n }\n }\n }\n\n return (\n <SourceFileContext.Provider\n value={{\n scope\n }}>\n <Scope value={scope}>\n <SourceFile\n {...rest}\n path={modulePath}\n header={\n header ?? (\n <TypescriptFileHeader hashbang={hashbang}>\n <TypescriptFileHeaderImports\n imports={imports}\n builtinImports={builtinImports}\n scope={scope}\n />\n </TypescriptFileHeader>\n )\n }\n filetype={tsx ? \"tsx\" : \"typescript\"}>\n {children}\n </SourceFile>\n </Scope>\n </SourceFileContext.Provider>\n );\n}\n\nexport interface TypescriptFileHeaderProps extends SourceFileHeaderProps {\n header?: Children;\n hashbang?: Children | true;\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 TypescriptFileHeader(props: TypescriptFileHeaderProps) {\n const {\n header,\n hashbang,\n disableEslint = true,\n disableBiome = true,\n disablePrettier = false,\n children\n } = props;\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show when={Boolean(hashbang)}>\n {hashbang === true\n ? code`#!/usr/bin/env ${\n context?.config.mode === \"development\"\n ? \"-S NODE_OPTIONS=--enable-source-maps\"\n : \"\"\n } node`\n : hashbang}\n <hbr />\n </Show>\n <Show when={Boolean(header)}>\n {header}\n <hbr />\n </Show>\n <hbr />\n <Show when={Boolean(disableEslint)}>\n <SingleLineComment variant=\"slash-star\">\n {\"eslint-disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disablePrettier)}>\n <SingleLineComment variant=\"slash-star\">\n {\"prettier-ignore\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disableBiome)}>\n <SingleLineComment>{\"biome-ignore lint: disable\"}</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>{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment>{getFileHeaderWarning(context!)}</SingleLineComment>\n <hbr />\n </>\n );\n}\n\nexport interface TypescriptFileHeaderImportsProps extends SourceFileHeaderProps {\n imports?: TypescriptFileImports;\n builtinImports?: TypescriptFileImports;\n scope?: TSModuleScope;\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 TypescriptFileHeaderImports(\n props: TypescriptFileHeaderImportsProps\n) {\n const { imports: importProps, builtinImports: builtinImportsProps } = props;\n\n const context = usePowerlinesSafe();\n const sourceFile = useSourceFile();\n\n const scope = props.scope ?? sourceFile.scope;\n\n const imports = computed(() => {\n return Object.fromEntries(\n Object.entries(importProps ?? {}).map(([module, importItem]) => [\n module,\n Array.isArray(importItem)\n ? getUniqueBy(importItem, i => (isString(i) ? i : i.alias || i.name))\n : importItem\n ])\n );\n });\n const builtinImports = computed(() => {\n return Object.fromEntries(\n Object.entries(builtinImportsProps ?? {}).map(([module, importItem]) => [\n module,\n Array.isArray(importItem)\n ? getUniqueBy(importItem, i => (isString(i) ? i : i.alias || i.name))\n : importItem\n ])\n );\n });\n\n return (\n <Show\n when={\n scope.importedModules.size > 0 ||\n (!!imports.value && Object.keys(imports.value).length > 0) ||\n (!!builtinImports.value && Object.keys(builtinImports.value).length > 0)\n }>\n <Show when={!!imports.value && Object.keys(imports.value).length > 0}>\n <For\n each={Object.entries(imports.value ?? {})}\n hardline\n ender={<hbr />}>\n {([module, importItem]) =>\n code`import ${\n importItem === null\n ? \"\"\n : isString(importItem)\n ? importItem\n : `${\n (\n importItem.filter(\n i => !isString(i) && i.default\n ) as TypescriptFileImportItem[]\n )\n .map(i => (i.alias ? i.alias : i.name))\n .join(\", \") +\n (importItem.filter(i => !isString(i) && i.default)\n .length > 0 &&\n importItem.filter(i => isString(i) || !i.default).length >\n 0\n ? \", \"\n : \"\") +\n (importItem.filter(i => isString(i) || !i.default)\n .length > 0\n ? `{ ${importItem\n .filter(i => isString(i) || !i.default)\n .map(i =>\n isString(i)\n ? i\n : i.alias\n ? `${i.name} as ${i.alias}`\n : i.name\n )\n .join(\", \")} }`\n : \"\")\n }`\n } from \"${module}\";`\n }\n </For>\n </Show>\n <Show\n when={\n builtinImports.value && Object.keys(builtinImports.value).length > 0\n }>\n <For\n each={Object.entries(\n (builtinImports.value ?? {}) as Record<\n string,\n null | Array<TypescriptFileImportItem | string>\n >\n )}\n hardline\n ender={<hbr />}>\n {([module, importItem]) =>\n code`import ${\n importItem === null\n ? \"\"\n : isString(importItem)\n ? importItem\n : `${\n (\n importItem.filter(\n i => !isString(i) && i.default\n ) as TypescriptFileImportItem[]\n )\n .map(i => (i.alias ? i.alias : i.name))\n .join(\", \") +\n (importItem.filter(i => !isString(i) && i.default)\n .length > 0 &&\n importItem.filter(i => isString(i) || !i.default).length >\n 0\n ? \", \"\n : \"\") +\n (importItem.filter(i => isString(i) || !i.default)\n .length > 0\n ? `{ ${importItem\n .filter(i => isString(i) || !i.default)\n .map(i =>\n isString(i)\n ? i\n : i.alias\n ? `${i.name} as ${i.alias}`\n : i.name\n )\n .join(\", \")} }`\n : \"\")\n }`\n } from \"${\n module.includes(\":\")\n ? module\n : `${context?.config?.framework || \"powerlines\"}:${module}`\n }\";`\n }\n </For>\n </Show>\n <Show when={scope.importedModules.size > 0}>\n <ImportStatements records={scope.importedModules} />\n </Show>\n <hbr />\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsEA,SAAgB,eAAe,OAA4B;CACzD,MAAM,CACJ,EAAE,UAAU,MAAM,SAAS,gBAAgB,KAAK,QAAQ,YACxD,QACE,WAAW,OAAO;EACpB;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,mBAAmB,WAAW,uBAAuB;CAC3D,MAAM,SAAS,uBAAuB,iBAAiB;CAEvD,MAAM,aAAa,WAAW,MAAM,iBAAiB,KAAK;CAC1D,MAAM,QAAQ,IAAI,cAAc,YAAY,UAAU,CAAC;AACvD,QAAO,QAAQ,IAAI,MAAM;CAEzB,MAAM,MAAM,WAAW,eAAe;AACtC,KAAI,IACF,KAAI,MAAM,UAAU,MAAM;AAG5B,KAAI,MAAM,QACR;MAAI,IACF,KAAI,UAAU,MAAM,OAAO,CACzB,KAAI,MAAM,UAAU,YAAY,MAAM;MAEtC,KAAI,MAAM,UAAU,MAAM,QAAQ,MAAM;;AAK9C,QACE,CAACA,oBAAkB,SACjB,OAAO,EACL,OACD,EAAE;MACH,CAAC,MAAM,OAAO,OAAO;QACnB,CAAC,eACK,MACJ,MAAM,YACN,QACE,UACE,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AC,EAAE,QAAQ,CAC/C,SAAS,IACR,KAAK,WACF,QAAO,MAAK,SAAS,EAAE,IAAI,CAAC,EAAE,QAAQ,CACtC,KAAI,MACH,SAAS,EAAE,GACP,IACA,EAAE,QACA,GAAG,EAAE,KAAK,MAAM,EAAE,UAClB,EAAE,KACT,CACA,KAAK,KAAK,CAAC,MACd,MAEb,SACC,OAAO,SAAS,IAAI,GAChB,SACA,GAAG,SAAS,QAAQ,aAAa,aAAa,GAAG,SACtD,IACF;QACH,EAAE,IAAI;MACR,EAAE,KAAK;MACP,CAAC,KAAK,MAAM,MAAM,gBAAgB,OAAO,GAAG;QAC1C,CAAC,iBAAiB,SAAS,MAAM,mBAAmB;MACtD,EAAE,KAAK;MACP,CAAC,MAAM;IACT,EAAE"}
1
+ {"version":3,"file":"typescript-file.mjs","names":["SourceFileContext"],"sources":["../../../src/typescript/components/typescript-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 type { Children } from \"@alloy-js/core\";\nimport {\n code,\n computed,\n For,\n Scope,\n Show,\n SourceDirectoryContext,\n splitProps,\n useContext,\n useScope\n} from \"@alloy-js/core\";\nimport {\n getSourceDirectoryData,\n ImportStatements,\n PackageContext,\n SourceFileContext,\n TSModuleScope,\n useSourceFile\n} from \"@alloy-js/typescript\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isString } from \"@stryke/type-checks/is-string\";\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 {\n ComponentProps,\n SourceFileHeaderProps,\n TypescriptFileImportItem,\n TypescriptFileImports\n} from \"../../types/components\";\n\nexport type TypescriptFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps & {\n hashbang?: Children | true;\n header?: Children;\n imports?: TypescriptFileImports;\n builtinImports?: TypescriptFileImports;\n export?: boolean | string;\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 TypescriptFile(props: TypescriptFileProps) {\n const [\n { children, path, imports, builtinImports, tsx, header, hashbang },\n rest\n ] = splitProps(props, [\n \"children\",\n \"path\",\n \"imports\",\n \"builtinImports\",\n \"tsx\",\n \"header\",\n \"hashbang\"\n ]);\n\n const directoryContext = useContext(SourceDirectoryContext)!;\n const sdData = getSourceDirectoryData(directoryContext);\n\n const modulePath = appendPath(path, directoryContext.path);\n const scope = new TSModuleScope(modulePath, useScope());\n sdData.modules.add(scope);\n\n const pkg = useContext(PackageContext);\n if (pkg) {\n pkg.scope.addModule(scope);\n }\n\n if (props.export) {\n if (pkg) {\n if (isBoolean(props.export)) {\n pkg.scope.addExport(modulePath, scope);\n } else {\n pkg.scope.addExport(props.export, scope);\n }\n }\n }\n\n return (\n <SourceFileContext.Provider\n value={{\n scope\n }}>\n <Scope value={scope}>\n <SourceFile\n {...rest}\n path={modulePath}\n header={\n header ?? (\n <TypescriptFileHeader hashbang={hashbang}>\n <TypescriptFileHeaderImports\n imports={imports}\n builtinImports={builtinImports}\n scope={scope}\n />\n </TypescriptFileHeader>\n )\n }\n filetype={tsx ? \"tsx\" : \"typescript\"}>\n {children}\n </SourceFile>\n </Scope>\n </SourceFileContext.Provider>\n );\n}\n\nexport interface TypescriptFileHeaderProps extends SourceFileHeaderProps {\n header?: Children;\n hashbang?: Children | true;\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 TypescriptFileHeader(props: TypescriptFileHeaderProps) {\n const {\n header,\n hashbang,\n disableEslint = true,\n disableBiome = true,\n disablePrettier = false,\n children\n } = props;\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show when={Boolean(hashbang)}>\n {hashbang === true\n ? code`#!/usr/bin/env ${\n context?.config.mode === \"development\"\n ? \"-S NODE_OPTIONS=--enable-source-maps\"\n : \"\"\n } node`\n : hashbang}\n <hbr />\n </Show>\n <Show when={Boolean(header)}>\n {header}\n <hbr />\n </Show>\n <hbr />\n <Show when={Boolean(disableEslint)}>\n <SingleLineComment variant=\"slash-star\">\n {\"eslint-disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disablePrettier)}>\n <SingleLineComment variant=\"slash-star\">\n {\"prettier-ignore\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disableBiome)}>\n <SingleLineComment>{\"biome-ignore lint: disable\"}</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>{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment>{getFileHeaderWarning(context!)}</SingleLineComment>\n <hbr />\n </>\n );\n}\n\nexport interface TypescriptFileHeaderImportsProps extends SourceFileHeaderProps {\n imports?: TypescriptFileImports;\n builtinImports?: TypescriptFileImports;\n scope?: TSModuleScope;\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 TypescriptFileHeaderImports(\n props: TypescriptFileHeaderImportsProps\n) {\n const { imports: importProps, builtinImports: builtinImportsProps } = props;\n\n const context = usePowerlinesSafe();\n const sourceFile = useSourceFile();\n\n const scope = props.scope ?? sourceFile.scope;\n\n const imports = computed(() => {\n return Object.fromEntries(\n Object.entries(importProps ?? {}).map(([module, importItem]) => [\n module,\n Array.isArray(importItem)\n ? getUniqueBy(importItem, i => (isString(i) ? i : i.alias || i.name))\n : importItem\n ])\n );\n });\n const builtinImports = computed(() => {\n return Object.fromEntries(\n Object.entries(builtinImportsProps ?? {}).map(([module, importItem]) => [\n module,\n Array.isArray(importItem)\n ? getUniqueBy(importItem, i => (isString(i) ? i : i.alias || i.name))\n : importItem\n ])\n );\n });\n\n return (\n <Show\n when={\n scope.importedModules.size > 0 ||\n (!!imports.value && Object.keys(imports.value).length > 0) ||\n (!!builtinImports.value && Object.keys(builtinImports.value).length > 0)\n }>\n <Show when={!!imports.value && Object.keys(imports.value).length > 0}>\n <For\n each={Object.entries(imports.value ?? {})}\n hardline\n ender={<hbr />}>\n {([module, importItem]) =>\n code`import ${\n importItem === null\n ? \"\"\n : isString(importItem)\n ? importItem\n : `${\n (\n importItem.filter(\n i => !isString(i) && i.default\n ) as TypescriptFileImportItem[]\n )\n .map(i => (i.alias ? i.alias : i.name))\n .join(\", \") +\n (importItem.filter(i => !isString(i) && i.default)\n .length > 0 &&\n importItem.filter(i => isString(i) || !i.default).length >\n 0\n ? \", \"\n : \"\") +\n (importItem.filter(i => isString(i) || !i.default)\n .length > 0\n ? `{ ${importItem\n .filter(i => isString(i) || !i.default)\n .map(i =>\n isString(i)\n ? i\n : i.alias\n ? `${i.name} as ${i.alias}`\n : i.name\n )\n .join(\", \")} }`\n : \"\")\n }`\n } from \"${module}\";`\n }\n </For>\n </Show>\n <Show\n when={\n builtinImports.value && Object.keys(builtinImports.value).length > 0\n }>\n <For\n each={Object.entries(\n (builtinImports.value ?? {}) as Record<\n string,\n null | Array<TypescriptFileImportItem | string>\n >\n )}\n hardline\n ender={<hbr />}>\n {([module, importItem]) =>\n code`import ${\n importItem === null\n ? \"\"\n : isString(importItem)\n ? importItem\n : `${\n (\n importItem.filter(\n i => !isString(i) && i.default\n ) as TypescriptFileImportItem[]\n )\n .map(i => (i.alias ? i.alias : i.name))\n .join(\", \") +\n (importItem.filter(i => !isString(i) && i.default)\n .length > 0 &&\n importItem.filter(i => isString(i) || !i.default).length >\n 0\n ? \", \"\n : \"\") +\n (importItem.filter(i => isString(i) || !i.default)\n .length > 0\n ? `{ ${importItem\n .filter(i => isString(i) || !i.default)\n .map(i =>\n isString(i)\n ? i\n : i.alias\n ? `${i.name} as ${i.alias}`\n : i.name\n )\n .join(\", \")} }`\n : \"\")\n }`\n } from \"${\n module.includes(\":\")\n ? module\n : `${context?.config?.framework || \"powerlines\"}:${module}`\n }\";`\n }\n </For>\n </Show>\n <Show when={scope.importedModules.size > 0}>\n <ImportStatements records={scope.importedModules} />\n </Show>\n <hbr />\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsEA,SAAgB,eAAe,OAA4B;CACzD,MAAM,CACJ,EAAE,UAAU,MAAM,SAAS,gBAAgB,KAAK,QAAQ,YACxD,QACE,WAAW,OAAO;EACpB;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,mBAAmB,WAAW,uBAAuB;CAC3D,MAAM,SAAS,uBAAuB,iBAAiB;CAEvD,MAAM,aAAa,WAAW,MAAM,iBAAiB,KAAK;CAC1D,MAAM,QAAQ,IAAI,cAAc,YAAY,UAAU,CAAC;AACvD,QAAO,QAAQ,IAAI,MAAM;CAEzB,MAAM,MAAM,WAAW,eAAe;AACtC,KAAI,IACF,KAAI,MAAM,UAAU,MAAM;AAG5B,KAAI,MAAM,QACR;MAAI,IACF,KAAI,UAAU,MAAM,OAAO,CACzB,KAAI,MAAM,UAAU,YAAY,MAAM;MAEtC,KAAI,MAAM,UAAU,MAAM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WAAW,QAAO,MAAK,SAAS,EAAE,IAAI,CAAC,EAAE,QAAQ,CAC/C,SAAS,IACR,KAAK,WACF,QAAO,MAAK,SAAS,EAAE,IAAI,CAAC,EAAE,QAAQ,CACtC,KAAI,MACH,SAAS,EAAE,GACP,IACA,EAAE,QACA,GAAG,EAAE,KAAK,MAAM,EAAE,UAClB,EAAE,KACT,CACA,KAAK,KAAK,CAAC,MACd,MAEb,SACC,OAAO,SAAS,IAAI,GAChB,SACA,GAAG,SAAS,QAAQ,aAAa,aAAa,GAAG,SACtD;KAEC;IACD;GACP,oBAAC,MAAD;IAAM,MAAM,MAAM,gBAAgB,OAAO;cACvC,oBAAC,kBAAD,EAAkB,SAAS,MAAM,iBAAmB;IAC/C;GACP,oBAAC,OAAD,EAAO;GACF"}
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  let _alloy_js_core = require("@alloy-js/core");
4
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
4
5
  let _alloy_js_typescript = require("@alloy-js/typescript");
5
6
 
6
7
  //#region src/typescript/contexts/lexical-scope.tsx
@@ -13,7 +14,10 @@ function LexicalScope(props) {
13
14
  if (!(props.value instanceof _alloy_js_typescript.TSLexicalScope)) throw new TypeError("LexicalScope value must be a TSLexicalScope instance");
14
15
  scope = props.value;
15
16
  } else scope = (0, _alloy_js_typescript.createLexicalScope)(props.name ?? "Lexical scope", props);
16
- return <_alloy_js_core.Scope value={scope}>{props.children}</_alloy_js_core.Scope>;
17
+ return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Scope, {
18
+ value: scope,
19
+ children: props.children
20
+ });
17
21
  }
18
22
 
19
23
  //#endregion
@@ -1,4 +1,5 @@
1
1
  import { Scope } from "@alloy-js/core";
2
+ import { jsx } from "@alloy-js/core/jsx-runtime";
2
3
  import { TSLexicalScope, createLexicalScope } from "@alloy-js/typescript";
3
4
 
4
5
  //#region src/typescript/contexts/lexical-scope.tsx
@@ -11,7 +12,10 @@ function LexicalScope(props) {
11
12
  if (!(props.value instanceof TSLexicalScope)) throw new TypeError("LexicalScope value must be a TSLexicalScope instance");
12
13
  scope = props.value;
13
14
  } else scope = createLexicalScope(props.name ?? "Lexical scope", props);
14
- return <Scope value={scope}>{props.children}</Scope>;
15
+ return /* @__PURE__ */ jsx(Scope, {
16
+ value: scope,
17
+ children: props.children
18
+ });
15
19
  }
16
20
 
17
21
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"lexical-scope.mjs","names":[],"sources":["../../../src/typescript/contexts/lexical-scope.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 { Scope, ScopePropsWithInfo, ScopePropsWithValue } from \"@alloy-js/core\";\nimport { createLexicalScope, TSLexicalScope } from \"@alloy-js/typescript\";\n\nexport interface LexicalScopePropsWithScopeValue extends ScopePropsWithValue {}\nexport interface LexicalScopePropsWithScopeInfo extends ScopePropsWithInfo {}\n\nexport type LexicalScopeProps =\n | LexicalScopePropsWithScopeValue\n | LexicalScopePropsWithScopeInfo;\n\n/**\n * A lexical scope for TypeScript, which contains declaration spaces for types and values. Declaration components will create symbols in this scope.\n */\nexport function LexicalScope(props: LexicalScopeProps) {\n let scope;\n if (\"value\" in props) {\n if (!(props.value instanceof TSLexicalScope)) {\n throw new TypeError(\n \"LexicalScope value must be a TSLexicalScope instance\"\n );\n }\n scope = props.value;\n } else {\n scope = createLexicalScope(props.name ?? \"Lexical scope\", props);\n }\n\n return <Scope value={scope}>{props.children}</Scope>;\n}\n"],"mappings":";;;;;;;AA+BA,SAAgB,aAAa,OAA0B;CACrD,IAAI;AACJ,KAAI,WAAW,OAAO;AACpB,MAAI,EAAE,MAAM,iBAAiB,gBAC3B,OAAM,IAAI,UACR,uDACD;AAEH,UAAQ,MAAM;OAEd,SAAQ,mBAAmB,MAAM,QAAQ,iBAAiB,MAAM;AAGlE,QAAO,CAAC,MAAM,OAAO,QAAQ,MAAM,SAAS,EAAE"}
1
+ {"version":3,"file":"lexical-scope.mjs","names":[],"sources":["../../../src/typescript/contexts/lexical-scope.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 { Scope, ScopePropsWithInfo, ScopePropsWithValue } from \"@alloy-js/core\";\nimport { createLexicalScope, TSLexicalScope } from \"@alloy-js/typescript\";\n\nexport interface LexicalScopePropsWithScopeValue extends ScopePropsWithValue {}\nexport interface LexicalScopePropsWithScopeInfo extends ScopePropsWithInfo {}\n\nexport type LexicalScopeProps =\n | LexicalScopePropsWithScopeValue\n | LexicalScopePropsWithScopeInfo;\n\n/**\n * A lexical scope for TypeScript, which contains declaration spaces for types and values. Declaration components will create symbols in this scope.\n */\nexport function LexicalScope(props: LexicalScopeProps) {\n let scope;\n if (\"value\" in props) {\n if (!(props.value instanceof TSLexicalScope)) {\n throw new TypeError(\n \"LexicalScope value must be a TSLexicalScope instance\"\n );\n }\n scope = props.value;\n } else {\n scope = createLexicalScope(props.name ?? \"Lexical scope\", props);\n }\n\n return <Scope value={scope}>{props.children}</Scope>;\n}\n"],"mappings":";;;;;;;;AA+BA,SAAgB,aAAa,OAA0B;CACrD,IAAI;AACJ,KAAI,WAAW,OAAO;AACpB,MAAI,EAAE,MAAM,iBAAiB,gBAC3B,OAAM,IAAI,UACR,uDACD;AAEH,UAAQ,MAAM;OAEd,SAAQ,mBAAmB,MAAM,QAAQ,iBAAiB,MAAM;AAGlE,QAAO,oBAAC,OAAD;EAAO,OAAO;YAAQ,MAAM;EAAiB"}
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
3
  let _alloy_js_core = require("@alloy-js/core");
4
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
4
5
  let _alloy_js_typescript = require("@alloy-js/typescript");
5
6
 
6
7
  //#region src/typescript/contexts/member-scope.tsx
@@ -11,8 +12,10 @@ let _alloy_js_typescript = require("@alloy-js/typescript");
11
12
  function MemberScope(props) {
12
13
  const parentScope = (0, _alloy_js_typescript.useTSLexicalScopeIfPresent)();
13
14
  const binder = props.ownerSymbol.binder ?? parentScope?.binder;
14
- const memberScope = (0, _alloy_js_core.createScope)(_alloy_js_typescript.TSMemberScope, "member-scope", parentScope, props.ownerSymbol, { binder });
15
- return <_alloy_js_core.MemberScope value={memberScope}>{props.children}</_alloy_js_core.MemberScope>;
15
+ return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.MemberScope, {
16
+ value: (0, _alloy_js_core.createScope)(_alloy_js_typescript.TSMemberScope, "member-scope", parentScope, props.ownerSymbol, { binder }),
17
+ children: props.children
18
+ });
16
19
  }
17
20
 
18
21
  //#endregion
@@ -1,4 +1,5 @@
1
1
  import { MemberScope as MemberScope$1, createScope } from "@alloy-js/core";
2
+ import { jsx } from "@alloy-js/core/jsx-runtime";
2
3
  import { TSMemberScope, useTSLexicalScopeIfPresent } from "@alloy-js/typescript";
3
4
 
4
5
  //#region src/typescript/contexts/member-scope.tsx
@@ -9,8 +10,10 @@ import { TSMemberScope, useTSLexicalScopeIfPresent } from "@alloy-js/typescript"
9
10
  function MemberScope(props) {
10
11
  const parentScope = useTSLexicalScopeIfPresent();
11
12
  const binder = props.ownerSymbol.binder ?? parentScope?.binder;
12
- const memberScope = createScope(TSMemberScope, "member-scope", parentScope, props.ownerSymbol, { binder });
13
- return <MemberScope$1 value={memberScope}>{props.children}</MemberScope$1>;
13
+ return /* @__PURE__ */ jsx(MemberScope$1, {
14
+ value: createScope(TSMemberScope, "member-scope", parentScope, props.ownerSymbol, { binder }),
15
+ children: props.children
16
+ });
14
17
  }
15
18
 
16
19
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"member-scope.mjs","names":["CoreMemberScope"],"sources":["../../../src/typescript/contexts/member-scope.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 MemberScope as CoreMemberScope,\n createScope\n} from \"@alloy-js/core\";\nimport {\n TSMemberScope,\n TSOutputSymbol,\n useTSLexicalScopeIfPresent\n} from \"@alloy-js/typescript\";\n\nexport interface MemberScopeProps {\n children: Children;\n\n /**\n * The symbol that this member scope will create member symbols on.\n */\n ownerSymbol: TSOutputSymbol;\n}\n\n/**\n * A member scope for TypeScript. Member declarations will create symbols\n * in this scope, which will be added to the owner symbol's members.\n */\nexport function MemberScope(props: MemberScopeProps) {\n const parentScope = useTSLexicalScopeIfPresent();\n const binder = props.ownerSymbol.binder ?? parentScope?.binder;\n const memberScope = createScope(\n TSMemberScope,\n \"member-scope\",\n parentScope,\n props.ownerSymbol,\n {\n binder\n }\n );\n\n return (\n <CoreMemberScope value={memberScope}>{props.children}</CoreMemberScope>\n );\n}\n"],"mappings":";;;;;;;;AA0CA,SAAgB,YAAY,OAAyB;CACnD,MAAM,cAAc,4BAA4B;CAChD,MAAM,SAAS,MAAM,YAAY,UAAU,aAAa;CACxD,MAAM,cAAc,YAClB,eACA,gBACA,aACA,MAAM,aACN,EACE,QACD,CACF;AAED,QACE,CAACA,cAAgB,OAAO,cAAc,MAAM,SAAS,EAAEA"}
1
+ {"version":3,"file":"member-scope.mjs","names":["CoreMemberScope"],"sources":["../../../src/typescript/contexts/member-scope.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 MemberScope as CoreMemberScope,\n createScope\n} from \"@alloy-js/core\";\nimport {\n TSMemberScope,\n TSOutputSymbol,\n useTSLexicalScopeIfPresent\n} from \"@alloy-js/typescript\";\n\nexport interface MemberScopeProps {\n children: Children;\n\n /**\n * The symbol that this member scope will create member symbols on.\n */\n ownerSymbol: TSOutputSymbol;\n}\n\n/**\n * A member scope for TypeScript. Member declarations will create symbols\n * in this scope, which will be added to the owner symbol's members.\n */\nexport function MemberScope(props: MemberScopeProps) {\n const parentScope = useTSLexicalScopeIfPresent();\n const binder = props.ownerSymbol.binder ?? parentScope?.binder;\n const memberScope = createScope(\n TSMemberScope,\n \"member-scope\",\n parentScope,\n props.ownerSymbol,\n {\n binder\n }\n );\n\n return (\n <CoreMemberScope value={memberScope}>{props.children}</CoreMemberScope>\n );\n}\n"],"mappings":";;;;;;;;;AA0CA,SAAgB,YAAY,OAAyB;CACnD,MAAM,cAAc,4BAA4B;CAChD,MAAM,SAAS,MAAM,YAAY,UAAU,aAAa;AAWxD,QACE,oBAACA,eAAD;EAAiB,OAXC,YAClB,eACA,gBACA,aACA,MAAM,aACN,EACE,QACD,CACF;YAGuC,MAAM;EAA2B"}
@@ -4,37 +4,46 @@ const require_core_contexts_context = require('../../core/contexts/context.cjs')
4
4
  const require_core_components_single_line_comment = require('../../core/components/single-line-comment.cjs');
5
5
  const require_core_components_source_file = require('../../core/components/source-file.cjs');
6
6
  let _alloy_js_core = require("@alloy-js/core");
7
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
7
8
  let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
8
9
  let powerlines_utils = require("powerlines/utils");
9
10
  let _stryke_type_checks = require("@stryke/type-checks");
10
11
 
11
12
  //#region src/yaml/components/yaml-file.tsx
12
13
  function YamlFileDataItem({ key, value }) {
13
- return <>
14
- <_alloy_js_core.Show when={Boolean(key)}>{_alloy_js_core.code`${key}:`}</_alloy_js_core.Show>
15
- <_alloy_js_core.Show when={typeof value === "string" || typeof value === "number" || typeof value === "boolean"}>
16
- {_alloy_js_core.code` ${String(value)}`}
17
- </_alloy_js_core.Show>
18
- <_alloy_js_core.Show when={(0, _stryke_type_checks.isSetObject)(value) && !Array.isArray(value)}>
19
- <_alloy_js_core.For each={Object.entries(value)}>
20
- {([nestedKey, nestedValue]) => <YamlFileDataItem key={nestedKey} value={nestedValue} />}
21
- </_alloy_js_core.For>
22
- </_alloy_js_core.Show>
23
- <_alloy_js_core.Show when={Array.isArray(value)}>
24
- <_alloy_js_core.For each={value}>
25
- {(item) => <YamlFileDataItem value={item} />}
26
- </_alloy_js_core.For>
27
- </_alloy_js_core.Show>
28
- </>;
14
+ return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [
15
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
16
+ when: Boolean(key),
17
+ children: _alloy_js_core.code`${key}:`
18
+ }),
19
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
20
+ when: typeof value === "string" || typeof value === "number" || typeof value === "boolean",
21
+ children: _alloy_js_core.code` ${String(value)}`
22
+ }),
23
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
24
+ when: (0, _stryke_type_checks.isSetObject)(value) && !Array.isArray(value),
25
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
26
+ each: Object.entries(value),
27
+ children: ([nestedKey, nestedValue]) => /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(YamlFileDataItem, { value: nestedValue }, nestedKey)
28
+ })
29
+ }),
30
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
31
+ when: Array.isArray(value),
32
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
33
+ each: value,
34
+ children: (item) => /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(YamlFileDataItem, { value: item })
35
+ })
36
+ })
37
+ ] });
29
38
  }
30
39
  function YamlFileData({ data }) {
31
- return <>
32
- <_alloy_js_core.Show when={Boolean(data)}>
33
- <_alloy_js_core.For each={Object.entries(data ?? {})}>
34
- {([key, value]) => <YamlFileDataItem key={key} value={value} />}
35
- </_alloy_js_core.For>
36
- </_alloy_js_core.Show>
37
- </>;
40
+ return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
41
+ when: Boolean(data),
42
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
43
+ each: Object.entries(data ?? {}),
44
+ children: ([key, value]) => /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(YamlFileDataItem, { value }, key)
45
+ })
46
+ }) });
38
47
  }
39
48
  /**
40
49
  * A base component representing a Powerlines generated YAML source file.
@@ -52,17 +61,19 @@ function YamlFile(props) {
52
61
  "data",
53
62
  "header"
54
63
  ]);
55
- return <require_core_components_source_file.SourceFile {...rest} path={path} header={<YamlFileHeader>{header}</YamlFileHeader>} filetype="yaml">
56
- <_alloy_js_core.Show when={Boolean(data)}>
57
- <YamlFileData data={data} />
58
- </_alloy_js_core.Show>
59
- <_alloy_js_core.Show when={Boolean(children)}>
60
- <>
61
- {children}
62
- <hbr />
63
- </>
64
- </_alloy_js_core.Show>
65
- </require_core_components_source_file.SourceFile>;
64
+ return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(require_core_components_source_file.SourceFile, {
65
+ ...rest,
66
+ path,
67
+ header: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(YamlFileHeader, { children: header }),
68
+ filetype: "yaml",
69
+ children: [/* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
70
+ when: Boolean(data),
71
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(YamlFileData, { data })
72
+ }), /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
73
+ when: Boolean(children),
74
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [children, /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})] })
75
+ })]
76
+ });
66
77
  }
67
78
  /**
68
79
  * Renders the header for a Powerlines YAML source file.
@@ -73,20 +84,19 @@ function YamlFile(props) {
73
84
  function YamlFileHeader(props) {
74
85
  const { children } = props;
75
86
  const context = require_core_contexts_context.usePowerlinesSafe();
76
- return <>
77
- <_alloy_js_core.Show when={Boolean(children)}>
78
- <>
79
- {children}
80
- <hbr />
81
- </>
82
- </_alloy_js_core.Show>
83
- <require_core_components_single_line_comment.SingleLineComment>{`Generated by ${(0, _stryke_string_format_title_case.titleCase)(context?.config?.framework) || "Powerlines"}`}</require_core_components_single_line_comment.SingleLineComment>
84
- <hbr />
85
- <require_core_components_single_line_comment.SingleLineComment variant="yaml">
86
- {(0, powerlines_utils.getFileHeaderWarning)(context)}
87
- </require_core_components_single_line_comment.SingleLineComment>
88
- <hbr />
89
- </>;
87
+ return /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [
88
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
89
+ when: Boolean(children),
90
+ children: /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [children, /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})] })
91
+ }),
92
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_core_components_single_line_comment.SingleLineComment, { children: `Generated by ${(0, _stryke_string_format_title_case.titleCase)(context?.config?.framework) || "Powerlines"}` }),
93
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
94
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)(require_core_components_single_line_comment.SingleLineComment, {
95
+ variant: "yaml",
96
+ children: (0, powerlines_utils.getFileHeaderWarning)(context)
97
+ }),
98
+ /* @__PURE__ */ (0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})
99
+ ] });
90
100
  }
91
101
 
92
102
  //#endregion
@@ -2,37 +2,46 @@ import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
2
2
  import { SingleLineComment } from "../../core/components/single-line-comment.mjs";
3
3
  import { SourceFile } from "../../core/components/source-file.mjs";
4
4
  import { For, Show, code, splitProps } from "@alloy-js/core";
5
+ import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
5
6
  import { titleCase } from "@stryke/string-format/title-case";
6
7
  import { getFileHeaderWarning } from "powerlines/utils";
7
8
  import { isSetObject } from "@stryke/type-checks";
8
9
 
9
10
  //#region src/yaml/components/yaml-file.tsx
10
11
  function YamlFileDataItem({ key, value }) {
11
- return <>
12
- <Show when={Boolean(key)}>{code`${key}:`}</Show>
13
- <Show when={typeof value === "string" || typeof value === "number" || typeof value === "boolean"}>
14
- {code` ${String(value)}`}
15
- </Show>
16
- <Show when={isSetObject(value) && !Array.isArray(value)}>
17
- <For each={Object.entries(value)}>
18
- {([nestedKey, nestedValue]) => <YamlFileDataItem key={nestedKey} value={nestedValue} />}
19
- </For>
20
- </Show>
21
- <Show when={Array.isArray(value)}>
22
- <For each={value}>
23
- {(item) => <YamlFileDataItem value={item} />}
24
- </For>
25
- </Show>
26
- </>;
12
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
13
+ /* @__PURE__ */ jsx(Show, {
14
+ when: Boolean(key),
15
+ children: code`${key}:`
16
+ }),
17
+ /* @__PURE__ */ jsx(Show, {
18
+ when: typeof value === "string" || typeof value === "number" || typeof value === "boolean",
19
+ children: code` ${String(value)}`
20
+ }),
21
+ /* @__PURE__ */ jsx(Show, {
22
+ when: isSetObject(value) && !Array.isArray(value),
23
+ children: /* @__PURE__ */ jsx(For, {
24
+ each: Object.entries(value),
25
+ children: ([nestedKey, nestedValue]) => /* @__PURE__ */ jsx(YamlFileDataItem, { value: nestedValue }, nestedKey)
26
+ })
27
+ }),
28
+ /* @__PURE__ */ jsx(Show, {
29
+ when: Array.isArray(value),
30
+ children: /* @__PURE__ */ jsx(For, {
31
+ each: value,
32
+ children: (item) => /* @__PURE__ */ jsx(YamlFileDataItem, { value: item })
33
+ })
34
+ })
35
+ ] });
27
36
  }
28
37
  function YamlFileData({ data }) {
29
- return <>
30
- <Show when={Boolean(data)}>
31
- <For each={Object.entries(data ?? {})}>
32
- {([key, value]) => <YamlFileDataItem key={key} value={value} />}
33
- </For>
34
- </Show>
35
- </>;
38
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Show, {
39
+ when: Boolean(data),
40
+ children: /* @__PURE__ */ jsx(For, {
41
+ each: Object.entries(data ?? {}),
42
+ children: ([key, value]) => /* @__PURE__ */ jsx(YamlFileDataItem, { value }, key)
43
+ })
44
+ }) });
36
45
  }
37
46
  /**
38
47
  * A base component representing a Powerlines generated YAML source file.
@@ -50,17 +59,19 @@ function YamlFile(props) {
50
59
  "data",
51
60
  "header"
52
61
  ]);
53
- return <SourceFile {...rest} path={path} header={<YamlFileHeader>{header}</YamlFileHeader>} filetype="yaml">
54
- <Show when={Boolean(data)}>
55
- <YamlFileData data={data} />
56
- </Show>
57
- <Show when={Boolean(children)}>
58
- <>
59
- {children}
60
- <hbr />
61
- </>
62
- </Show>
63
- </SourceFile>;
62
+ return /* @__PURE__ */ jsxs(SourceFile, {
63
+ ...rest,
64
+ path,
65
+ header: /* @__PURE__ */ jsx(YamlFileHeader, { children: header }),
66
+ filetype: "yaml",
67
+ children: [/* @__PURE__ */ jsx(Show, {
68
+ when: Boolean(data),
69
+ children: /* @__PURE__ */ jsx(YamlFileData, { data })
70
+ }), /* @__PURE__ */ jsx(Show, {
71
+ when: Boolean(children),
72
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [children, /* @__PURE__ */ jsx("hbr", {})] })
73
+ })]
74
+ });
64
75
  }
65
76
  /**
66
77
  * Renders the header for a Powerlines YAML source file.
@@ -71,20 +82,19 @@ function YamlFile(props) {
71
82
  function YamlFileHeader(props) {
72
83
  const { children } = props;
73
84
  const context = usePowerlinesSafe();
74
- return <>
75
- <Show when={Boolean(children)}>
76
- <>
77
- {children}
78
- <hbr />
79
- </>
80
- </Show>
81
- <SingleLineComment>{`Generated by ${titleCase(context?.config?.framework) || "Powerlines"}`}</SingleLineComment>
82
- <hbr />
83
- <SingleLineComment variant="yaml">
84
- {getFileHeaderWarning(context)}
85
- </SingleLineComment>
86
- <hbr />
87
- </>;
85
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
86
+ /* @__PURE__ */ jsx(Show, {
87
+ when: Boolean(children),
88
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [children, /* @__PURE__ */ jsx("hbr", {})] })
89
+ }),
90
+ /* @__PURE__ */ jsx(SingleLineComment, { children: `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}` }),
91
+ /* @__PURE__ */ jsx("hbr", {}),
92
+ /* @__PURE__ */ jsx(SingleLineComment, {
93
+ variant: "yaml",
94
+ children: getFileHeaderWarning(context)
95
+ }),
96
+ /* @__PURE__ */ jsx("hbr", {})
97
+ ] });
88
98
  }
89
99
 
90
100
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"yaml-file.mjs","names":[],"sources":["../../../src/yaml/components/yaml-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 type { Children } from \"@alloy-js/core\";\nimport { code, For, Show, splitProps } from \"@alloy-js/core\";\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\";\n\nexport interface YamlData {\n [key: string]: string | number | boolean | YamlData | YamlData[];\n}\n\ninterface YamlFileDataItemProps {\n value: string | number | boolean | YamlData | YamlData[];\n key?: string;\n}\n\nfunction YamlFileDataItem({ key, value }: YamlFileDataItemProps) {\n return (\n <>\n <Show when={Boolean(key)}>{code`${key}:`}</Show>\n <Show\n when={\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n }>\n {code` ${String(value)}`}\n </Show>\n <Show when={isSetObject(value) && !Array.isArray(value)}>\n <For each={Object.entries(value as YamlData)}>\n {([nestedKey, nestedValue]) => (\n <YamlFileDataItem key={nestedKey} value={nestedValue} />\n )}\n </For>\n </Show>\n <Show when={Array.isArray(value)}>\n <For each={value as YamlData[]}>\n {item => <YamlFileDataItem value={item} />}\n </For>\n </Show>\n </>\n );\n}\n\ninterface YamlFileDataProps {\n data?: YamlData;\n}\n\nfunction YamlFileData({ data }: YamlFileDataProps) {\n return (\n <>\n <Show when={Boolean(data)}>\n <For each={Object.entries(data ?? {})}>\n {([key, value]) => <YamlFileDataItem key={key} value={value} />}\n </For>\n </Show>\n </>\n );\n}\n\nexport type YamlFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps & {\n header?: Children;\n data?: YamlData;\n };\n\n/**\n * A base component representing a Powerlines generated YAML source file.\n *\n * @remarks\n * The file content can be provided either through the `data` prop, which accepts a nested object representing the YAML structure, or through the `children` prop, which allows for custom YAML content to be rendered. The `header` prop can be used to provide custom header content for the YAML file, which is rendered above the generated file header warning and generation comment.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function YamlFile(props: YamlFileProps) {\n const [{ children, path, data, header }, rest] = splitProps(props, [\n \"children\",\n \"path\",\n \"data\",\n \"header\"\n ]);\n\n return (\n <SourceFile\n {...rest}\n path={path}\n header={<YamlFileHeader>{header}</YamlFileHeader>}\n filetype=\"yaml\">\n <Show when={Boolean(data)}>\n <YamlFileData data={data} />\n </Show>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n </SourceFile>\n );\n}\n\n/**\n * Renders the header for a Powerlines YAML source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function YamlFileHeader(props: SourceFileHeaderProps) {\n const { children } = props;\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n <SingleLineComment>{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment variant=\"yaml\">\n {getFileHeaderWarning(context!)}\n </SingleLineComment>\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAqCA,SAAS,iBAAiB,EAAE,KAAK,SAAgC;AAC/D,QACE,EAAE;MACA,CAAC,KAAK,MAAM,QAAQ,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,EAAE,KAAK;MAChD,CAAC,KACC,MACE,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,OAAO,UAAU,WACjB;SACD,IAAI,KAAK,OAAO,MAAM,GAAG;MAC5B,EAAE,KAAK;MACP,CAAC,KAAK,MAAM,YAAY,MAAM,IAAI,CAAC,MAAM,QAAQ,MAAM,EAAE;QACvD,CAAC,IAAI,MAAM,OAAO,QAAQ,MAAkB,EAAE;YAC1C,CAAC,WAAW,iBACZ,CAAC,iBAAiB,KAAK,WAAW,OAAO,gBACzC;QACJ,EAAE,IAAI;MACR,EAAE,KAAK;MACP,CAAC,KAAK,MAAM,MAAM,QAAQ,MAAM,EAAE;QAChC,CAAC,IAAI,MAAM,OAAqB;YAC7B,SAAQ,CAAC,iBAAiB,OAAO,SAAS;QAC7C,EAAE,IAAI;MACR,EAAE,KAAK;IACT;;AAQJ,SAAS,aAAa,EAAE,QAA2B;AACjD,QACE,EAAE;MACA,CAAC,KAAK,MAAM,QAAQ,KAAK,EAAE;QACzB,CAAC,IAAI,MAAM,OAAO,QAAQ,QAAQ,EAAE,CAAC,EAAE;YACnC,CAAC,KAAK,WAAW,CAAC,iBAAiB,KAAK,KAAK,OAAO,UAAU;QAClE,EAAE,IAAI;MACR,EAAE,KAAK;IACT;;;;;;;;;;;AAmBJ,SAAgB,SAAS,OAAsB;CAC7C,MAAM,CAAC,EAAE,UAAU,MAAM,MAAM,UAAU,QAAQ,WAAW,OAAO;EACjE;EACA;EACA;EACA;EACD,CAAC;AAEF,QACE,CAAC,eACK,MACJ,MAAM,MACN,QAAQ,CAAC,gBAAgB,OAAO,EAAE,iBAClC,gBAAgB;MAChB,CAAC,KAAK,MAAM,QAAQ,KAAK,EAAE;QACzB,CAAC,aAAa,MAAM,QAAQ;MAC9B,EAAE,KAAK;MACP,CAAC,KAAK,MAAM,QAAQ,SAAS,EAAE;QAC7B,EAAE;WACC,SAAS;UACV,CAAC,MAAM;QACT,GAAG;MACL,EAAE,KAAK;IACT,EAAE;;;;;;;;AAUN,SAAgB,eAAe,OAA8B;CAC3D,MAAM,EAAE,aAAa;CAErB,MAAM,UAAU,mBAAmB;AAEnC,QACE,EAAE;MACA,CAAC,KAAK,MAAM,QAAQ,SAAS,EAAE;QAC7B,EAAE;WACC,SAAS;UACV,CAAC,MAAM;QACT,GAAG;MACL,EAAE,KAAK;MACP,CAAC,mBAAmB,gBAClB,UAAU,SAAS,QAAQ,UAAU,IAAI,eACxC,EAAE,kBAAkB;MACvB,CAAC,MAAM;MACP,CAAC,kBAAkB,eAAe;SAC/B,qBAAqB,QAAS,CAAC;MAClC,EAAE,kBAAkB;MACpB,CAAC,MAAM;IACT"}
1
+ {"version":3,"file":"yaml-file.mjs","names":[],"sources":["../../../src/yaml/components/yaml-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 type { Children } from \"@alloy-js/core\";\nimport { code, For, Show, splitProps } from \"@alloy-js/core\";\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\";\n\nexport interface YamlData {\n [key: string]: string | number | boolean | YamlData | YamlData[];\n}\n\ninterface YamlFileDataItemProps {\n value: string | number | boolean | YamlData | YamlData[];\n key?: string;\n}\n\nfunction YamlFileDataItem({ key, value }: YamlFileDataItemProps) {\n return (\n <>\n <Show when={Boolean(key)}>{code`${key}:`}</Show>\n <Show\n when={\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n }>\n {code` ${String(value)}`}\n </Show>\n <Show when={isSetObject(value) && !Array.isArray(value)}>\n <For each={Object.entries(value as YamlData)}>\n {([nestedKey, nestedValue]) => (\n <YamlFileDataItem key={nestedKey} value={nestedValue} />\n )}\n </For>\n </Show>\n <Show when={Array.isArray(value)}>\n <For each={value as YamlData[]}>\n {item => <YamlFileDataItem value={item} />}\n </For>\n </Show>\n </>\n );\n}\n\ninterface YamlFileDataProps {\n data?: YamlData;\n}\n\nfunction YamlFileData({ data }: YamlFileDataProps) {\n return (\n <>\n <Show when={Boolean(data)}>\n <For each={Object.entries(data ?? {})}>\n {([key, value]) => <YamlFileDataItem key={key} value={value} />}\n </For>\n </Show>\n </>\n );\n}\n\nexport type YamlFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps & {\n header?: Children;\n data?: YamlData;\n };\n\n/**\n * A base component representing a Powerlines generated YAML source file.\n *\n * @remarks\n * The file content can be provided either through the `data` prop, which accepts a nested object representing the YAML structure, or through the `children` prop, which allows for custom YAML content to be rendered. The `header` prop can be used to provide custom header content for the YAML file, which is rendered above the generated file header warning and generation comment.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function YamlFile(props: YamlFileProps) {\n const [{ children, path, data, header }, rest] = splitProps(props, [\n \"children\",\n \"path\",\n \"data\",\n \"header\"\n ]);\n\n return (\n <SourceFile\n {...rest}\n path={path}\n header={<YamlFileHeader>{header}</YamlFileHeader>}\n filetype=\"yaml\">\n <Show when={Boolean(data)}>\n <YamlFileData data={data} />\n </Show>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n </SourceFile>\n );\n}\n\n/**\n * Renders the header for a Powerlines YAML source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function YamlFileHeader(props: SourceFileHeaderProps) {\n const { children } = props;\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n <SingleLineComment>{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment variant=\"yaml\">\n {getFileHeaderWarning(context!)}\n </SingleLineComment>\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;AAqCA,SAAS,iBAAiB,EAAE,KAAK,SAAgC;AAC/D,QACE;EACE,oBAAC,MAAD;GAAM,MAAM,QAAQ,IAAI;aAAG,IAAI,GAAG,IAAI;GAAU;EAChD,oBAAC,MAAD;GACE,MACE,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,OAAO,UAAU;aAElB,IAAI,KAAK,OAAO,MAAM;GAClB;EACP,oBAAC,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AAQ,UAAU,IAAI,gBACpB;EACvB,oBAAC,OAAD,EAAO;EACP,oBAAC,mBAAD;GAAmB,SAAQ;aACxB,qBAAqB,QAAS;GACb;EACpB,oBAAC,OAAD,EAAO;EACN"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-alloy",
3
- "version": "0.25.29",
3
+ "version": "0.25.31",
4
4
  "type": "module",
5
5
  "description": "A package containing various Alloy framework components and helper utilities.",
6
6
  "repository": {
@@ -810,8 +810,8 @@
810
810
  "@alloy-js/markdown": "0.23.0-dev.1",
811
811
  "@alloy-js/rollup-plugin": "^0.1.0",
812
812
  "@alloy-js/typescript": "0.23.0-dev.4",
813
- "@powerlines/deepkit": "^0.6.124",
814
- "@powerlines/plugin-babel": "^0.12.348",
813
+ "@powerlines/deepkit": "^0.6.125",
814
+ "@powerlines/plugin-babel": "^0.12.349",
815
815
  "@storm-software/config-tools": "1.189.28",
816
816
  "@stryke/capnp": "^0.12.83",
817
817
  "@stryke/convert": "^0.6.53",
@@ -824,14 +824,14 @@
824
824
  "@stryke/types": "^0.10.52",
825
825
  "@stryke/unique-id": "^0.3.68",
826
826
  "defu": "^6.1.4",
827
- "powerlines": "^0.41.10",
827
+ "powerlines": "^0.41.11",
828
828
  "prettier": "^3.8.1",
829
829
  "unctx": "^2.5.0"
830
830
  },
831
831
  "devDependencies": {
832
- "@powerlines/plugin-plugin": "^0.12.296",
832
+ "@powerlines/plugin-plugin": "^0.12.297",
833
833
  "@types/node": "^25.5.0"
834
834
  },
835
835
  "publishConfig": { "access": "public" },
836
- "gitHead": "8ab1d6e9a7ab44ee184b19c58d6de2c4c101ec01"
836
+ "gitHead": "0398cc144640f51f1ff5b6f7c548728d47c571d3"
837
837
  }