@powerlines/plugin-alloy 0.24.6 → 0.25.1
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.
- package/dist/core/components/output.d.cts +2 -2
- package/dist/core/components/output.d.mts +2 -2
- package/dist/core/components/single-line-comment.cjs +1 -1
- package/dist/core/components/single-line-comment.d.cts +3 -3
- package/dist/core/components/single-line-comment.d.cts.map +1 -1
- package/dist/core/components/single-line-comment.d.mts +3 -3
- package/dist/core/components/single-line-comment.d.mts.map +1 -1
- package/dist/core/components/single-line-comment.mjs +1 -1
- package/dist/core/components/single-line-comment.mjs.map +1 -1
- package/dist/core/components/source-file.d.cts +2 -2
- package/dist/helpers/capnp.cjs +1 -1
- package/dist/helpers/capnp.mjs +2 -2
- package/dist/helpers/capnp.mjs.map +1 -1
- package/dist/markdown/components/front-matter.d.cts +2 -2
- package/dist/markdown/components/front-matter.d.mts +2 -2
- package/dist/markdown/components/markdown-file.cjs +2 -9
- package/dist/markdown/components/markdown-file.d.cts +3 -3
- package/dist/markdown/components/markdown-file.d.cts.map +1 -1
- package/dist/markdown/components/markdown-file.d.mts +3 -3
- package/dist/markdown/components/markdown-file.d.mts.map +1 -1
- package/dist/markdown/components/markdown-file.mjs +3 -10
- package/dist/markdown/components/markdown-file.mjs.map +1 -1
- package/dist/markdown/components/markdown-table.d.cts +4 -4
- package/dist/markdown/components/markdown-table.d.cts.map +1 -1
- package/dist/markdown/components/markdown-table.d.mts +4 -4
- package/dist/render.cjs +8 -1
- package/dist/render.d.cts.map +1 -1
- package/dist/render.d.mts.map +1 -1
- package/dist/render.mjs +8 -1
- package/dist/render.mjs.map +1 -1
- package/dist/typescript/components/builtin-file.d.cts +2 -2
- package/dist/typescript/components/builtin-file.d.mts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.cts +2 -2
- package/dist/typescript/components/dynamic-import-statement.d.mts +2 -2
- package/dist/typescript/components/entry-file.d.cts +2 -2
- package/dist/typescript/components/entry-file.d.mts +2 -2
- package/dist/typescript/components/index.cjs +2 -0
- package/dist/typescript/components/index.d.cts +2 -1
- package/dist/typescript/components/index.d.mts +2 -1
- package/dist/typescript/components/index.mjs +2 -1
- package/dist/typescript/components/infrastructure-file.cjs +39 -0
- package/dist/typescript/components/infrastructure-file.d.cts +21 -0
- package/dist/typescript/components/infrastructure-file.d.cts.map +1 -0
- package/dist/typescript/components/infrastructure-file.d.mts +21 -0
- package/dist/typescript/components/infrastructure-file.d.mts.map +1 -0
- package/dist/typescript/components/infrastructure-file.mjs +38 -0
- package/dist/typescript/components/infrastructure-file.mjs.map +1 -0
- package/dist/typescript/components/interface-declaration.d.cts +2 -2
- package/dist/typescript/components/object-declaration.d.cts +3 -3
- package/dist/typescript/components/property-name.d.cts +2 -2
- package/dist/typescript/components/tsdoc-reflection.d.cts +7 -7
- package/dist/typescript/components/tsdoc-reflection.d.cts.map +1 -1
- package/dist/typescript/components/tsdoc.d.cts.map +1 -1
- package/dist/typescript/components/type-declaration.d.cts +2 -2
- package/dist/typescript/components/typescript-file.cjs +2 -9
- package/dist/typescript/components/typescript-file.d.cts.map +1 -1
- package/dist/typescript/components/typescript-file.d.mts.map +1 -1
- package/dist/typescript/components/typescript-file.mjs +2 -9
- package/dist/typescript/components/typescript-file.mjs.map +1 -1
- package/dist/typescript/contexts/lexical-scope.d.cts +2 -2
- package/dist/typescript/contexts/lexical-scope.d.cts.map +1 -1
- package/dist/typescript/index.cjs +2 -0
- package/dist/typescript/index.d.cts +2 -1
- package/dist/typescript/index.d.mts +2 -1
- package/dist/typescript/index.mjs +2 -1
- package/dist/yaml/components/index.cjs +4 -0
- package/dist/yaml/components/index.d.cts +2 -0
- package/dist/yaml/components/index.d.mts +2 -0
- package/dist/yaml/components/index.mjs +3 -0
- package/dist/yaml/components/yaml-file.cjs +148 -0
- package/dist/yaml/components/yaml-file.d.cts +34 -0
- package/dist/yaml/components/yaml-file.d.cts.map +1 -0
- package/dist/yaml/components/yaml-file.d.mts +34 -0
- package/dist/yaml/components/yaml-file.d.mts.map +1 -0
- package/dist/yaml/components/yaml-file.mjs +147 -0
- package/dist/yaml/components/yaml-file.mjs.map +1 -0
- package/dist/yaml/index.cjs +5 -0
- package/dist/yaml/index.d.cts +3 -0
- package/dist/yaml/index.d.mts +3 -0
- package/dist/yaml/index.mjs +4 -0
- package/package.json +63 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-file.mjs","names":["code","computed","For","Scope","Show","SourceDirectoryContext","splitProps","useContext","useScope","getSourceDirectoryData","ImportStatements","PackageContext","SourceFileContext","TSModuleScope","useSourceFile","getUniqueBy","appendPath","titleCase","isBoolean","isString","SingleLineComment","SourceFile","usePowerlinesSafe","TypescriptFile","props","children","path","imports","builtinImports","tsx","header","hashbang","rest","directoryContext","sdData","modulePath","scope","modules","add","pkg","addModule","export","addExport","_$createComponent","Provider","value","_$mergeProps","TypescriptFileHeader","TypescriptFileHeaderImports","filetype","disableEslint","disableBiome","disablePrettier","context","when","Boolean","_$memo","config","mode","_$createIntrinsic","variant","framework","output","overwrite","fallback","Date","toLocaleString","importProps","builtinImportsProps","sourceFile","Object","fromEntries","entries","map","module","importItem","Array","isArray","i","alias","name","importedModules","size","keys","length","each","hardline","ender","filter","default","join","includes","records"],"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 { 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>\n <Show\n when={context?.config.output?.overwrite !== false}\n fallback={code`This file was generated on ${new Date().toLocaleString()} - it will not be overwritten by ${titleCase(context?.config?.framework) || \"Powerlines\"} while the \\`output.overwrite\\` option is set to \\`true\\`.`}>\n {code`Do not edit this file manually - it will be overwritten automatically. Automatic overwrites can be disabled by using the \\`output.overwrite\\` option.`}\n </Show>\n </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":";;;;;;;;;;;;;;;;;;;SAmUkB,eAAA,OAAA;OAAA,aAAA,MAAA,SAAA,gBAAA,KAAA,QAAA,+BAAA,OAAA"}
|
|
1
|
+
{"version":3,"file":"typescript-file.mjs","names":["code","computed","For","Scope","Show","SourceDirectoryContext","splitProps","useContext","useScope","getSourceDirectoryData","ImportStatements","PackageContext","SourceFileContext","TSModuleScope","useSourceFile","getUniqueBy","appendPath","titleCase","isBoolean","isString","getFileHeaderWarning","SingleLineComment","SourceFile","usePowerlinesSafe","TypescriptFile","props","children","path","imports","builtinImports","tsx","header","hashbang","rest","directoryContext","sdData","modulePath","scope","modules","add","pkg","addModule","export","addExport","_$createComponent","Provider","value","_$mergeProps","TypescriptFileHeader","TypescriptFileHeaderImports","filetype","disableEslint","disableBiome","disablePrettier","context","when","Boolean","_$memo","config","mode","_$createIntrinsic","variant","framework","importProps","builtinImportsProps","sourceFile","Object","fromEntries","entries","map","module","importItem","Array","isArray","i","alias","name","importedModules","size","keys","length","each","hardline","ender","filter","default","join","includes","records"],"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":";;;;;;;;;;;;;;;;;;;;SA2WwD,eAAA,OAAA;OAAA,aAAA,MAAA,SAAA,gBAAA,KAAA,QAAA,+BAAA,OAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alloy_js_core8 from "@alloy-js/core";
|
|
2
2
|
import { ScopePropsWithInfo, ScopePropsWithValue } from "@alloy-js/core";
|
|
3
3
|
|
|
4
4
|
//#region src/typescript/contexts/lexical-scope.d.ts
|
|
@@ -8,7 +8,7 @@ type LexicalScopeProps = LexicalScopePropsWithScopeValue | LexicalScopePropsWith
|
|
|
8
8
|
/**
|
|
9
9
|
* A lexical scope for TypeScript, which contains declaration spaces for types and values. Declaration components will create symbols in this scope.
|
|
10
10
|
*/
|
|
11
|
-
declare function LexicalScope(props: LexicalScopeProps):
|
|
11
|
+
declare function LexicalScope(props: LexicalScopeProps): _alloy_js_core8.Children;
|
|
12
12
|
declare type __ΩLexicalScopePropsWithScopeValue = any[];
|
|
13
13
|
declare type __ΩLexicalScopePropsWithScopeInfo = any[];
|
|
14
14
|
declare type __ΩLexicalScopeProps = any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexical-scope.d.cts","names":[],"sources":["../../../src/typescript/contexts/lexical-scope.tsx"],"sourcesContent":[],"mappings":";;;;UAqBiB,+BAAA,SAAwC;UACxC,8BAAA,SAAuC,oBADxD;AACiB,KAEL,iBAAA,GACR,+BAHoD,GAIpD,8BAJsE;AAE1E;AAOA;;iBAAgB,YAAA,QAAoB,oBAAiB,
|
|
1
|
+
{"version":3,"file":"lexical-scope.d.cts","names":[],"sources":["../../../src/typescript/contexts/lexical-scope.tsx"],"sourcesContent":[],"mappings":";;;;UAqBiB,+BAAA,SAAwC;UACxC,8BAAA,SAAuC,oBADxD;AACiB,KAEL,iBAAA,GACR,+BAHoD,GAIpD,8BAJsE;AAE1E;AAOA;;iBAAgB,YAAA,QAAoB,oBAAiB,eAAA,CAAA"}
|
|
@@ -11,6 +11,7 @@ const require_typescript_components_type_parameters = require('./components/type
|
|
|
11
11
|
const require_typescript_components_class_declaration = require('./components/class-declaration.cjs');
|
|
12
12
|
const require_typescript_components_dynamic_import_statement = require('./components/dynamic-import-statement.cjs');
|
|
13
13
|
const require_typescript_components_entry_file = require('./components/entry-file.cjs');
|
|
14
|
+
const require_typescript_components_infrastructure_file = require('./components/infrastructure-file.cjs');
|
|
14
15
|
const require_typescript_components_tsdoc_reflection = require('./components/tsdoc-reflection.cjs');
|
|
15
16
|
const require_typescript_components_interface_declaration = require('./components/interface-declaration.cjs');
|
|
16
17
|
const require_typescript_components_object_declaration = require('./components/object-declaration.cjs');
|
|
@@ -27,6 +28,7 @@ exports.ClassPropertyGet = require_typescript_components_class_declaration.Class
|
|
|
27
28
|
exports.ClassPropertySet = require_typescript_components_class_declaration.ClassPropertySet;
|
|
28
29
|
exports.DynamicImportStatement = require_typescript_components_dynamic_import_statement.DynamicImportStatement;
|
|
29
30
|
exports.EntryFile = require_typescript_components_entry_file.EntryFile;
|
|
31
|
+
exports.InfrastructureFile = require_typescript_components_infrastructure_file.InfrastructureFile;
|
|
30
32
|
exports.InterfaceDeclaration = require_typescript_components_interface_declaration.InterfaceDeclaration;
|
|
31
33
|
exports.InterfaceDeclarationProperty = require_typescript_components_interface_declaration.InterfaceDeclarationProperty;
|
|
32
34
|
exports.InterfaceExpression = require_typescript_components_interface_declaration.InterfaceExpression;
|
|
@@ -5,6 +5,7 @@ import { TypeParameters, TypeParametersProps, __ΩTypeParametersProps } from "./
|
|
|
5
5
|
import { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps, __ΩClassPropertyProps } from "./components/class-declaration.cjs";
|
|
6
6
|
import { DynamicImportStatement, DynamicImportStatementProps, __ΩDynamicImportStatementProps } from "./components/dynamic-import-statement.cjs";
|
|
7
7
|
import { EntryFile, EntryFileProps, __ΩEntryFileProps } from "./components/entry-file.cjs";
|
|
8
|
+
import { InfrastructureFile, InfrastructureFileProps, __ΩInfrastructureFileProps } from "./components/infrastructure-file.cjs";
|
|
8
9
|
import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, __ΩInterfaceDeclarationPropertyProps, __ΩInterfaceDeclarationProps, __ΩInterfaceExpressionProps, __ΩInterfaceIndexerMemberProps, __ΩInterfaceMemberProps, __ΩInterfaceMemberPropsBase, __ΩInterfacePropertyMemberProps } from "./components/interface-declaration.cjs";
|
|
9
10
|
import { ComputedRef, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, __ΩComputedRef, __ΩObjectDeclarationPropertyProps, __ΩObjectDeclarationProps } from "./components/object-declaration.cjs";
|
|
10
11
|
import { PropertyName, PropertyNameProps, __ΩPropertyNameProps } from "./components/property-name.cjs";
|
|
@@ -17,4 +18,4 @@ import "./contexts/index.cjs";
|
|
|
17
18
|
import { getCallSignatureProps } from "./helpers/get-call-signature-props.cjs";
|
|
18
19
|
import { isValidJSIdentifier } from "./helpers/utilities.cjs";
|
|
19
20
|
import "./helpers/index.cjs";
|
|
20
|
-
export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, ComputedRef, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, LexicalScope, LexicalScopeProps, LexicalScopePropsWithScopeInfo, LexicalScopePropsWithScopeValue, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocReflectionClass, TSDocReflectionClassProps, TSDocReflectionMethod, TSDocReflectionMethodProps, TSDocReflectionProperty, TSDocReflectionPropertyProps, TSDocRemarks, TSDocReturns, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps, __ΩBuiltinFileProps, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps, __ΩClassPropertyProps, __ΩComputedRef, __ΩDynamicImportStatementProps, __ΩEntryFileProps, __ΩInterfaceDeclarationPropertyProps, __ΩInterfaceDeclarationProps, __ΩInterfaceExpressionProps, __ΩInterfaceIndexerMemberProps, __ΩInterfaceMemberProps, __ΩInterfaceMemberPropsBase, __ΩInterfacePropertyMemberProps, __ΩLexicalScopeProps, __ΩLexicalScopePropsWithScopeInfo, __ΩLexicalScopePropsWithScopeValue, __ΩObjectDeclarationPropertyProps, __ΩObjectDeclarationProps, __ΩPropertyNameProps, __ΩRecordExpressionProps, __ΩTSDocAttributesTagsProps, __ΩTSDocDefaultValueProps, __ΩTSDocExampleProps, __ΩTSDocModuleProps, __ΩTSDocParamProps, __ΩTSDocParamsProps, __ΩTSDocProps, __ΩTSDocReflectionClassProps, __ΩTSDocReflectionMethodProps, __ΩTSDocReflectionPropertyProps, __ΩTSDocTagProps, __ΩTypeDeclarationProps, __ΩTypeParametersProps, __ΩTypescriptFileHeaderImportsProps, __ΩTypescriptFileHeaderProps, __ΩTypescriptFileProps, getCallSignatureProps, isValidJSIdentifier };
|
|
21
|
+
export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, ComputedRef, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InfrastructureFile, InfrastructureFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, LexicalScope, LexicalScopeProps, LexicalScopePropsWithScopeInfo, LexicalScopePropsWithScopeValue, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocReflectionClass, TSDocReflectionClassProps, TSDocReflectionMethod, TSDocReflectionMethodProps, TSDocReflectionProperty, TSDocReflectionPropertyProps, TSDocRemarks, TSDocReturns, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps, __ΩBuiltinFileProps, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps, __ΩClassPropertyProps, __ΩComputedRef, __ΩDynamicImportStatementProps, __ΩEntryFileProps, __ΩInfrastructureFileProps, __ΩInterfaceDeclarationPropertyProps, __ΩInterfaceDeclarationProps, __ΩInterfaceExpressionProps, __ΩInterfaceIndexerMemberProps, __ΩInterfaceMemberProps, __ΩInterfaceMemberPropsBase, __ΩInterfacePropertyMemberProps, __ΩLexicalScopeProps, __ΩLexicalScopePropsWithScopeInfo, __ΩLexicalScopePropsWithScopeValue, __ΩObjectDeclarationPropertyProps, __ΩObjectDeclarationProps, __ΩPropertyNameProps, __ΩRecordExpressionProps, __ΩTSDocAttributesTagsProps, __ΩTSDocDefaultValueProps, __ΩTSDocExampleProps, __ΩTSDocModuleProps, __ΩTSDocParamProps, __ΩTSDocParamsProps, __ΩTSDocProps, __ΩTSDocReflectionClassProps, __ΩTSDocReflectionMethodProps, __ΩTSDocReflectionPropertyProps, __ΩTSDocTagProps, __ΩTypeDeclarationProps, __ΩTypeParametersProps, __ΩTypescriptFileHeaderImportsProps, __ΩTypescriptFileHeaderProps, __ΩTypescriptFileProps, getCallSignatureProps, isValidJSIdentifier };
|
|
@@ -5,6 +5,7 @@ import { TypeParameters, TypeParametersProps, __ΩTypeParametersProps } from "./
|
|
|
5
5
|
import { ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps, __ΩClassPropertyProps } from "./components/class-declaration.mjs";
|
|
6
6
|
import { DynamicImportStatement, DynamicImportStatementProps, __ΩDynamicImportStatementProps } from "./components/dynamic-import-statement.mjs";
|
|
7
7
|
import { EntryFile, EntryFileProps, __ΩEntryFileProps } from "./components/entry-file.mjs";
|
|
8
|
+
import { InfrastructureFile, InfrastructureFileProps, __ΩInfrastructureFileProps } from "./components/infrastructure-file.mjs";
|
|
8
9
|
import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, __ΩInterfaceDeclarationPropertyProps, __ΩInterfaceDeclarationProps, __ΩInterfaceExpressionProps, __ΩInterfaceIndexerMemberProps, __ΩInterfaceMemberProps, __ΩInterfaceMemberPropsBase, __ΩInterfacePropertyMemberProps } from "./components/interface-declaration.mjs";
|
|
9
10
|
import { ComputedRef, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, __ΩComputedRef, __ΩObjectDeclarationPropertyProps, __ΩObjectDeclarationProps } from "./components/object-declaration.mjs";
|
|
10
11
|
import { PropertyName, PropertyNameProps, __ΩPropertyNameProps } from "./components/property-name.mjs";
|
|
@@ -17,4 +18,4 @@ import "./contexts/index.mjs";
|
|
|
17
18
|
import { getCallSignatureProps } from "./helpers/get-call-signature-props.mjs";
|
|
18
19
|
import { isValidJSIdentifier } from "./helpers/utilities.mjs";
|
|
19
20
|
import "./helpers/index.mjs";
|
|
20
|
-
export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, ComputedRef, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, LexicalScope, LexicalScopeProps, LexicalScopePropsWithScopeInfo, LexicalScopePropsWithScopeValue, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocReflectionClass, TSDocReflectionClassProps, TSDocReflectionMethod, TSDocReflectionMethodProps, TSDocReflectionProperty, TSDocReflectionPropertyProps, TSDocRemarks, TSDocReturns, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps, __ΩBuiltinFileProps, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps, __ΩClassPropertyProps, __ΩComputedRef, __ΩDynamicImportStatementProps, __ΩEntryFileProps, __ΩInterfaceDeclarationPropertyProps, __ΩInterfaceDeclarationProps, __ΩInterfaceExpressionProps, __ΩInterfaceIndexerMemberProps, __ΩInterfaceMemberProps, __ΩInterfaceMemberPropsBase, __ΩInterfacePropertyMemberProps, __ΩLexicalScopeProps, __ΩLexicalScopePropsWithScopeInfo, __ΩLexicalScopePropsWithScopeValue, __ΩObjectDeclarationPropertyProps, __ΩObjectDeclarationProps, __ΩPropertyNameProps, __ΩRecordExpressionProps, __ΩTSDocAttributesTagsProps, __ΩTSDocDefaultValueProps, __ΩTSDocExampleProps, __ΩTSDocModuleProps, __ΩTSDocParamProps, __ΩTSDocParamsProps, __ΩTSDocProps, __ΩTSDocReflectionClassProps, __ΩTSDocReflectionMethodProps, __ΩTSDocReflectionPropertyProps, __ΩTSDocTagProps, __ΩTypeDeclarationProps, __ΩTypeParametersProps, __ΩTypescriptFileHeaderImportsProps, __ΩTypescriptFileHeaderProps, __ΩTypescriptFileProps, getCallSignatureProps, isValidJSIdentifier };
|
|
21
|
+
export { BuiltinFile, BuiltinFileProps, ClassDeclaration, ClassDeclarationProps, ClassField, ClassFieldProps, ClassMember, ClassMemberProps, ClassMethod, ClassMethodProps, ClassPropertyGet, ClassPropertyProps, ClassPropertySet, ComputedRef, DynamicImportStatement, DynamicImportStatementProps, EntryFile, EntryFileProps, InfrastructureFile, InfrastructureFileProps, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceDeclarationPropertyProps, InterfaceDeclarationProps, InterfaceExpression, InterfaceExpressionProps, InterfaceIndexerMemberProps, InterfaceMember, InterfaceMemberProps, InterfaceMemberPropsBase, InterfacePropertyMemberProps, LexicalScope, LexicalScopeProps, LexicalScopePropsWithScopeInfo, LexicalScopePropsWithScopeValue, ObjectDeclaration, ObjectDeclarationProperty, ObjectDeclarationPropertyProps, ObjectDeclarationProps, PropertyName, PropertyNameProps, RecordExpression, RecordExpressionProps, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocAttributesTagsProps, TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocDefaultValue, TSDocDefaultValueProps, TSDocDomain, TSDocExample, TSDocExampleProps, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocModuleProps, TSDocParam, TSDocParamProps, TSDocParams, TSDocParamsProps, TSDocPermission, TSDocProps, TSDocReadonly, TSDocReflectionClass, TSDocReflectionClassProps, TSDocReflectionMethod, TSDocReflectionMethodProps, TSDocReflectionProperty, TSDocReflectionPropertyProps, TSDocRemarks, TSDocReturns, TSDocTag, TSDocTagProps, TSDocThrows, TSDocTitle, TypeDeclaration, TypeDeclarationProps, TypeParameters, TypeParametersProps, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, TypescriptFileHeaderImportsProps, TypescriptFileHeaderProps, TypescriptFileProps, __ΩBuiltinFileProps, __ΩClassDeclarationProps, __ΩClassFieldProps, __ΩClassMemberProps, __ΩClassMethodProps, __ΩClassPropertyProps, __ΩComputedRef, __ΩDynamicImportStatementProps, __ΩEntryFileProps, __ΩInfrastructureFileProps, __ΩInterfaceDeclarationPropertyProps, __ΩInterfaceDeclarationProps, __ΩInterfaceExpressionProps, __ΩInterfaceIndexerMemberProps, __ΩInterfaceMemberProps, __ΩInterfaceMemberPropsBase, __ΩInterfacePropertyMemberProps, __ΩLexicalScopeProps, __ΩLexicalScopePropsWithScopeInfo, __ΩLexicalScopePropsWithScopeValue, __ΩObjectDeclarationPropertyProps, __ΩObjectDeclarationProps, __ΩPropertyNameProps, __ΩRecordExpressionProps, __ΩTSDocAttributesTagsProps, __ΩTSDocDefaultValueProps, __ΩTSDocExampleProps, __ΩTSDocModuleProps, __ΩTSDocParamProps, __ΩTSDocParamsProps, __ΩTSDocProps, __ΩTSDocReflectionClassProps, __ΩTSDocReflectionMethodProps, __ΩTSDocReflectionPropertyProps, __ΩTSDocTagProps, __ΩTypeDeclarationProps, __ΩTypeParametersProps, __ΩTypescriptFileHeaderImportsProps, __ΩTypescriptFileHeaderProps, __ΩTypescriptFileProps, getCallSignatureProps, isValidJSIdentifier };
|
|
@@ -11,6 +11,7 @@ import { TypeParameters } from "./components/type-parameters.mjs";
|
|
|
11
11
|
import { ClassDeclaration, ClassField, ClassMember, ClassMethod, ClassPropertyGet, ClassPropertySet } from "./components/class-declaration.mjs";
|
|
12
12
|
import { DynamicImportStatement } from "./components/dynamic-import-statement.mjs";
|
|
13
13
|
import { EntryFile } from "./components/entry-file.mjs";
|
|
14
|
+
import { InfrastructureFile } from "./components/infrastructure-file.mjs";
|
|
14
15
|
import { TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty } from "./components/tsdoc-reflection.mjs";
|
|
15
16
|
import { InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceExpression, InterfaceMember } from "./components/interface-declaration.mjs";
|
|
16
17
|
import { ObjectDeclaration, ObjectDeclarationProperty } from "./components/object-declaration.mjs";
|
|
@@ -18,4 +19,4 @@ import { RecordExpression } from "./components/record-expression.mjs";
|
|
|
18
19
|
import { TypeDeclaration } from "./components/type-declaration.mjs";
|
|
19
20
|
import "./components/index.mjs";
|
|
20
21
|
|
|
21
|
-
export { BuiltinFile, ClassDeclaration, ClassField, ClassMember, ClassMethod, ClassPropertyGet, ClassPropertySet, DynamicImportStatement, EntryFile, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceExpression, InterfaceMember, LexicalScope, ObjectDeclaration, ObjectDeclarationProperty, PropertyName, RecordExpression, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocDefaultValue, TSDocDomain, TSDocExample, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocParam, TSDocParams, TSDocPermission, TSDocReadonly, TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty, TSDocRemarks, TSDocReturns, TSDocTag, TSDocThrows, TSDocTitle, TypeDeclaration, TypeParameters, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, getCallSignatureProps, isValidJSIdentifier };
|
|
22
|
+
export { BuiltinFile, ClassDeclaration, ClassField, ClassMember, ClassMethod, ClassPropertyGet, ClassPropertySet, DynamicImportStatement, EntryFile, InfrastructureFile, InterfaceDeclaration, InterfaceDeclarationProperty, InterfaceExpression, InterfaceMember, LexicalScope, ObjectDeclaration, ObjectDeclarationProperty, PropertyName, RecordExpression, TSDoc, TSDocAlias, TSDocAttributesTags, TSDocContextClass, TSDocContextMethod, TSDocContextProperty, TSDocDefaultValue, TSDocDomain, TSDocExample, TSDocHidden, TSDocIgnore, TSDocInternal, TSDocLink, TSDocModule, TSDocParam, TSDocParams, TSDocPermission, TSDocReadonly, TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty, TSDocRemarks, TSDocReturns, TSDocTag, TSDocThrows, TSDocTitle, TypeDeclaration, TypeParameters, TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports, getCallSignatureProps, isValidJSIdentifier };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_core_contexts_context = require('../../core/contexts/context.cjs');
|
|
3
|
+
const require_core_components_single_line_comment = require('../../core/components/single-line-comment.cjs');
|
|
4
|
+
const require_core_components_source_file = require('../../core/components/source-file.cjs');
|
|
5
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
7
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
8
|
+
let powerlines_utils = require("powerlines/utils");
|
|
9
|
+
let __stryke_type_checks = require("@stryke/type-checks");
|
|
10
|
+
|
|
11
|
+
//#region src/yaml/components/yaml-file.tsx
|
|
12
|
+
function YamlFileDataItem({ key, value }) {
|
|
13
|
+
return [
|
|
14
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
15
|
+
get when() {
|
|
16
|
+
return Boolean(key);
|
|
17
|
+
},
|
|
18
|
+
children: __alloy_js_core.code`${key}:`
|
|
19
|
+
}),
|
|
20
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
21
|
+
when: typeof value === "string" || typeof value === "number" || typeof value === "boolean",
|
|
22
|
+
get children() {
|
|
23
|
+
return __alloy_js_core.code` ${String(value)}`;
|
|
24
|
+
}
|
|
25
|
+
}),
|
|
26
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
27
|
+
get when() {
|
|
28
|
+
return (0, __alloy_js_core_jsx_runtime.memo)(() => !!(0, __stryke_type_checks.isSetObject)(value))() && !Array.isArray(value);
|
|
29
|
+
},
|
|
30
|
+
get children() {
|
|
31
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
32
|
+
get each() {
|
|
33
|
+
return Object.entries(value);
|
|
34
|
+
},
|
|
35
|
+
children: ([nestedKey, nestedValue]) => (0, __alloy_js_core_jsx_runtime.createComponent)(YamlFileDataItem, {
|
|
36
|
+
key: nestedKey,
|
|
37
|
+
value: nestedValue
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
43
|
+
get when() {
|
|
44
|
+
return Array.isArray(value);
|
|
45
|
+
},
|
|
46
|
+
get children() {
|
|
47
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
48
|
+
each: value,
|
|
49
|
+
children: (item) => (0, __alloy_js_core_jsx_runtime.createComponent)(YamlFileDataItem, { value: item })
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
function YamlFileData({ data }) {
|
|
56
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
57
|
+
get when() {
|
|
58
|
+
return Boolean(data);
|
|
59
|
+
},
|
|
60
|
+
get children() {
|
|
61
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
62
|
+
get each() {
|
|
63
|
+
return Object.entries(data ?? {});
|
|
64
|
+
},
|
|
65
|
+
children: ([key, value]) => (0, __alloy_js_core_jsx_runtime.createComponent)(YamlFileDataItem, {
|
|
66
|
+
key,
|
|
67
|
+
value
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
})];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A base component representing a Powerlines generated YAML source file.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* 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.
|
|
78
|
+
*
|
|
79
|
+
* @param props - The properties for the source file.
|
|
80
|
+
* @returns The rendered source file component.
|
|
81
|
+
*/
|
|
82
|
+
function YamlFile(props) {
|
|
83
|
+
const [{ children, path, data, header }, rest] = (0, __alloy_js_core.splitProps)(props, [
|
|
84
|
+
"children",
|
|
85
|
+
"path",
|
|
86
|
+
"data",
|
|
87
|
+
"header"
|
|
88
|
+
]);
|
|
89
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_source_file.SourceFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
90
|
+
path,
|
|
91
|
+
get header() {
|
|
92
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(YamlFileHeader, { children: header });
|
|
93
|
+
},
|
|
94
|
+
filetype: "yaml",
|
|
95
|
+
get children() {
|
|
96
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
97
|
+
get when() {
|
|
98
|
+
return Boolean(data);
|
|
99
|
+
},
|
|
100
|
+
get children() {
|
|
101
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(YamlFileData, { data });
|
|
102
|
+
}
|
|
103
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
104
|
+
get when() {
|
|
105
|
+
return Boolean(children);
|
|
106
|
+
},
|
|
107
|
+
get children() {
|
|
108
|
+
return [children, (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
109
|
+
}
|
|
110
|
+
})];
|
|
111
|
+
}
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Renders the header for a Powerlines YAML source file.
|
|
116
|
+
*
|
|
117
|
+
* @param props - The properties for the source file header.
|
|
118
|
+
* @returns The rendered source file header.
|
|
119
|
+
*/
|
|
120
|
+
function YamlFileHeader(props) {
|
|
121
|
+
const { children } = props;
|
|
122
|
+
const context = require_core_contexts_context.usePowerlinesSafe();
|
|
123
|
+
return [
|
|
124
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
125
|
+
get when() {
|
|
126
|
+
return Boolean(children);
|
|
127
|
+
},
|
|
128
|
+
get children() {
|
|
129
|
+
return [children, (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
130
|
+
}
|
|
131
|
+
}),
|
|
132
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, { get children() {
|
|
133
|
+
return `Generated by ${(0, __stryke_string_format_title_case.titleCase)(context?.config?.framework) || "Powerlines"}`;
|
|
134
|
+
} }),
|
|
135
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
136
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, {
|
|
137
|
+
variant: "yaml",
|
|
138
|
+
get children() {
|
|
139
|
+
return (0, powerlines_utils.getFileHeaderWarning)(context);
|
|
140
|
+
}
|
|
141
|
+
}),
|
|
142
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
143
|
+
];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
//#endregion
|
|
147
|
+
exports.YamlFile = YamlFile;
|
|
148
|
+
exports.YamlFileHeader = YamlFileHeader;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ComponentProps, SourceFileHeaderProps } from "../../types/components.cjs";
|
|
2
|
+
import { SourceFileProps as SourceFileProps$1 } from "../../core/components/source-file.cjs";
|
|
3
|
+
import { Children } from "@alloy-js/core";
|
|
4
|
+
|
|
5
|
+
//#region src/yaml/components/yaml-file.d.ts
|
|
6
|
+
interface YamlData {
|
|
7
|
+
[key: string]: string | number | boolean | YamlData | YamlData[];
|
|
8
|
+
}
|
|
9
|
+
type YamlFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps & {
|
|
10
|
+
header?: Children;
|
|
11
|
+
data?: YamlData;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A base component representing a Powerlines generated YAML source file.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* 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.
|
|
18
|
+
*
|
|
19
|
+
* @param props - The properties for the source file.
|
|
20
|
+
* @returns The rendered source file component.
|
|
21
|
+
*/
|
|
22
|
+
declare function YamlFile(props: YamlFileProps): Children;
|
|
23
|
+
/**
|
|
24
|
+
* Renders the header for a Powerlines YAML source file.
|
|
25
|
+
*
|
|
26
|
+
* @param props - The properties for the source file header.
|
|
27
|
+
* @returns The rendered source file header.
|
|
28
|
+
*/
|
|
29
|
+
declare function YamlFileHeader(props: SourceFileHeaderProps): Children;
|
|
30
|
+
declare type __ΩYamlData = any[];
|
|
31
|
+
declare type __ΩYamlFileProps = any[];
|
|
32
|
+
//#endregion
|
|
33
|
+
export { YamlData, YamlFile, YamlFileHeader, YamlFileProps, __ΩYamlData, __ΩYamlFileProps };
|
|
34
|
+
//# sourceMappingURL=yaml-file.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-file.d.cts","names":[],"sources":["../../../src/yaml/components/yaml-file.tsx"],"sourcesContent":[],"mappings":";;;;;UA4BiB,QAAA;6CAC4B,WAAW;AADxD;AAqDY,KAAA,aAAA,GAAgB,IAAH,CAAQ,iBAAR,EAAA,UAAA,CAAA,GACvB,cADuB,GAAA;EAAQ,MAAA,CAAA,EAEpB,QAFoB;EAAL,IAAA,CAAA,EAGjB,QAHiB;CAC1B;;;;AAcF;AAiCA;;;;;iBAjCgB,QAAA,QAAgB,gBAAa;;;;;;;iBAiC7B,cAAA,QAAsB,wBAAqB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ComponentProps, SourceFileHeaderProps } from "../../types/components.mjs";
|
|
2
|
+
import { SourceFileProps as SourceFileProps$1 } from "../../core/components/source-file.mjs";
|
|
3
|
+
import { Children } from "@alloy-js/core";
|
|
4
|
+
|
|
5
|
+
//#region src/yaml/components/yaml-file.d.ts
|
|
6
|
+
interface YamlData {
|
|
7
|
+
[key: string]: string | number | boolean | YamlData | YamlData[];
|
|
8
|
+
}
|
|
9
|
+
type YamlFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps & {
|
|
10
|
+
header?: Children;
|
|
11
|
+
data?: YamlData;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A base component representing a Powerlines generated YAML source file.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* 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.
|
|
18
|
+
*
|
|
19
|
+
* @param props - The properties for the source file.
|
|
20
|
+
* @returns The rendered source file component.
|
|
21
|
+
*/
|
|
22
|
+
declare function YamlFile(props: YamlFileProps): Children;
|
|
23
|
+
/**
|
|
24
|
+
* Renders the header for a Powerlines YAML source file.
|
|
25
|
+
*
|
|
26
|
+
* @param props - The properties for the source file header.
|
|
27
|
+
* @returns The rendered source file header.
|
|
28
|
+
*/
|
|
29
|
+
declare function YamlFileHeader(props: SourceFileHeaderProps): Children;
|
|
30
|
+
declare type __ΩYamlData = any[];
|
|
31
|
+
declare type __ΩYamlFileProps = any[];
|
|
32
|
+
//#endregion
|
|
33
|
+
export { YamlData, YamlFile, YamlFileHeader, YamlFileProps, __ΩYamlData, __ΩYamlFileProps };
|
|
34
|
+
//# sourceMappingURL=yaml-file.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-file.d.mts","names":[],"sources":["../../../src/yaml/components/yaml-file.tsx"],"sourcesContent":[],"mappings":";;;;;UA4BiB,QAAA;6CAC4B,WAAW;AADxD;AAqDY,KAAA,aAAA,GAAgB,IAAH,CAAQ,iBAAR,EAAA,UAAA,CAAA,GACvB,cADuB,GAAA;EAAQ,MAAA,CAAA,EAEpB,QAFoB;EAAL,IAAA,CAAA,EAGjB,QAHiB;CAC1B;;;;AAcF;AAiCA;;;;;iBAjCgB,QAAA,QAAgB,gBAAa;;;;;;;iBAiC7B,cAAA,QAAsB,wBAAqB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
|
|
2
|
+
import { SingleLineComment } from "../../core/components/single-line-comment.mjs";
|
|
3
|
+
import { SourceFile } from "../../core/components/source-file.mjs";
|
|
4
|
+
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
|
+
import { For, Show, code, splitProps } from "@alloy-js/core";
|
|
6
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
7
|
+
import { getFileHeaderWarning } from "powerlines/utils";
|
|
8
|
+
import { isSetObject } from "@stryke/type-checks";
|
|
9
|
+
|
|
10
|
+
//#region src/yaml/components/yaml-file.tsx
|
|
11
|
+
function YamlFileDataItem({ key, value }) {
|
|
12
|
+
return [
|
|
13
|
+
createComponent(Show, {
|
|
14
|
+
get when() {
|
|
15
|
+
return Boolean(key);
|
|
16
|
+
},
|
|
17
|
+
children: code`${key}:`
|
|
18
|
+
}),
|
|
19
|
+
createComponent(Show, {
|
|
20
|
+
when: typeof value === "string" || typeof value === "number" || typeof value === "boolean",
|
|
21
|
+
get children() {
|
|
22
|
+
return code` ${String(value)}`;
|
|
23
|
+
}
|
|
24
|
+
}),
|
|
25
|
+
createComponent(Show, {
|
|
26
|
+
get when() {
|
|
27
|
+
return memo(() => !!isSetObject(value))() && !Array.isArray(value);
|
|
28
|
+
},
|
|
29
|
+
get children() {
|
|
30
|
+
return createComponent(For, {
|
|
31
|
+
get each() {
|
|
32
|
+
return Object.entries(value);
|
|
33
|
+
},
|
|
34
|
+
children: ([nestedKey, nestedValue]) => createComponent(YamlFileDataItem, {
|
|
35
|
+
key: nestedKey,
|
|
36
|
+
value: nestedValue
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
createComponent(Show, {
|
|
42
|
+
get when() {
|
|
43
|
+
return Array.isArray(value);
|
|
44
|
+
},
|
|
45
|
+
get children() {
|
|
46
|
+
return createComponent(For, {
|
|
47
|
+
each: value,
|
|
48
|
+
children: (item) => createComponent(YamlFileDataItem, { value: item })
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
function YamlFileData({ data }) {
|
|
55
|
+
return [createComponent(Show, {
|
|
56
|
+
get when() {
|
|
57
|
+
return Boolean(data);
|
|
58
|
+
},
|
|
59
|
+
get children() {
|
|
60
|
+
return createComponent(For, {
|
|
61
|
+
get each() {
|
|
62
|
+
return Object.entries(data ?? {});
|
|
63
|
+
},
|
|
64
|
+
children: ([key, value]) => createComponent(YamlFileDataItem, {
|
|
65
|
+
key,
|
|
66
|
+
value
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
})];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A base component representing a Powerlines generated YAML source file.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* 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.
|
|
77
|
+
*
|
|
78
|
+
* @param props - The properties for the source file.
|
|
79
|
+
* @returns The rendered source file component.
|
|
80
|
+
*/
|
|
81
|
+
function YamlFile(props) {
|
|
82
|
+
const [{ children, path, data, header }, rest] = splitProps(props, [
|
|
83
|
+
"children",
|
|
84
|
+
"path",
|
|
85
|
+
"data",
|
|
86
|
+
"header"
|
|
87
|
+
]);
|
|
88
|
+
return createComponent(SourceFile, mergeProps(rest, {
|
|
89
|
+
path,
|
|
90
|
+
get header() {
|
|
91
|
+
return createComponent(YamlFileHeader, { children: header });
|
|
92
|
+
},
|
|
93
|
+
filetype: "yaml",
|
|
94
|
+
get children() {
|
|
95
|
+
return [createComponent(Show, {
|
|
96
|
+
get when() {
|
|
97
|
+
return Boolean(data);
|
|
98
|
+
},
|
|
99
|
+
get children() {
|
|
100
|
+
return createComponent(YamlFileData, { data });
|
|
101
|
+
}
|
|
102
|
+
}), createComponent(Show, {
|
|
103
|
+
get when() {
|
|
104
|
+
return Boolean(children);
|
|
105
|
+
},
|
|
106
|
+
get children() {
|
|
107
|
+
return [children, createIntrinsic("hbr", {})];
|
|
108
|
+
}
|
|
109
|
+
})];
|
|
110
|
+
}
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Renders the header for a Powerlines YAML source file.
|
|
115
|
+
*
|
|
116
|
+
* @param props - The properties for the source file header.
|
|
117
|
+
* @returns The rendered source file header.
|
|
118
|
+
*/
|
|
119
|
+
function YamlFileHeader(props) {
|
|
120
|
+
const { children } = props;
|
|
121
|
+
const context = usePowerlinesSafe();
|
|
122
|
+
return [
|
|
123
|
+
createComponent(Show, {
|
|
124
|
+
get when() {
|
|
125
|
+
return Boolean(children);
|
|
126
|
+
},
|
|
127
|
+
get children() {
|
|
128
|
+
return [children, createIntrinsic("hbr", {})];
|
|
129
|
+
}
|
|
130
|
+
}),
|
|
131
|
+
createComponent(SingleLineComment, { get children() {
|
|
132
|
+
return `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}`;
|
|
133
|
+
} }),
|
|
134
|
+
createIntrinsic("hbr", {}),
|
|
135
|
+
createComponent(SingleLineComment, {
|
|
136
|
+
variant: "yaml",
|
|
137
|
+
get children() {
|
|
138
|
+
return getFileHeaderWarning(context);
|
|
139
|
+
}
|
|
140
|
+
}),
|
|
141
|
+
createIntrinsic("hbr", {})
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
export { YamlFile, YamlFileHeader };
|
|
147
|
+
//# sourceMappingURL=yaml-file.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml-file.mjs","names":["code","For","Show","splitProps","titleCase","isSetObject","getFileHeaderWarning","SingleLineComment","SourceFile","usePowerlinesSafe","YamlFileDataItem","key","value","_$createComponent","when","Boolean","children","String","_$memo","Array","isArray","each","Object","entries","nestedKey","nestedValue","item","YamlFileData","data","YamlFile","props","path","header","rest","_$mergeProps","YamlFileHeader","filetype","_$createIntrinsic","context","config","framework","variant"],"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":";;;;;;;;;;SAoDgE,iBAAA,EAAA,KAAA,SAAA;;kBAAA,MAAA;GAAA,IAAA,OAAA;AAAA,WAAA,YAAA;;GAAA,UAAA,IAAA,GAAA,IAAA;GAAA,CAAA;EAAA,gBAAA,MAAA;GAAA,MAAA,OAAA,UAAA,YAAA,OAAA,UAAA,YAAA,OAAA,UAAA;GAAA,IAAA,WAAA;AAAA,eAAA,KAAA,OAAA,MAAA;;GAAA,CAAA;EAAA,sBAAA;GAAA,IAAA,OAAA;AAAA,WAAA,WAAA,CAAA,CAAA,YAAA,MAAA,CAAA,EAAA,IAAA,CAAA,MAAA,QAAA,MAAA;;GAAA,IAAA,WAAA;AAAA,WAAA,qBAAA;KAAA,IAAA,OAAA;AAAA,aAAA,OAAA,QAAA,MAAA;;KAAA,WAAA,CAAA,WAAA,iBAAA,gBAAA,kBAAA;MAAA,KAAA;MAAA,OAAA;MAAA,CAAA;KACrD,CAAA;;GAAA,CAAA;EAAA,gBAGK,MAAA;GAAA,IAAA,OAAA;AAAA,WAAA,MAAA,QAAA,MAAA;;GAAA,IAAA,WAAA;AAAA,WAAA,gBAAA,KAAA;KAAA,MAAA;KAAA,WAAA,SAAA,gBAAA,kBAAA,EAAA,OAAA,MAAA,CAAA;KAAA,CAAA;;GAAA,CAAA;EAAA;;AAahB,SAAS2B,aAAa,EAAA,QAAA;AAAA,QAAA,CAAA,gBAAA,MAAA;EAAA,IAAA,OAAA;AAAA,UAAA,QAAA,KAAA;;EAAA,IAAA,WAAA;AAAA,UAAA,gBAAA,KAAA;IAAA,IAAA,OAAA;AAAA,YAAA,OAAA,QAAA,QAAA,EAAA,CAAA;;IAAA,WAAA,CAAA,KAAA,WAAA,gBAAA,kBAAA;KAAA;KAAA;KAAA,CAAA;IAAA,CAAA;;EAAA,CAAA,CAAA;;;;;;;;;;;AAUtB,SAAA,SAAA,OAAA;CAQA,MAAA,CAAA,EAAA,UAAA,MAAA,MAAA,UAAA,QAAA,WAAA,OAAA;EACA;EACA;EAAA;EAAA;GAAA;AAAA,QAAA,gBAEA,YAAA,WAiBY,MAAA;EAAA;EAAA,IAAA,SAAA;AAAA,UAAA,gBAAA,gBAAA,EAAA,UAAA,QAAA,CAAA;;YAAA;EAAA,IAAA,WAAA;AAAA,UAAA,CAAA,gBAAA,MAAA;IAAA,IAAA,OAAA;AAAA,YAAA,QAAA,KAAA;;IAAA,IAAA,WAAA;AAAA,YAAA,gBAAA,cAAA,EAAA,MAAA,CAAA;;IAAA,CAAA,EAAA,gBAAA,MAAA;IAAA,IAAA,OAAA;AAAA,YAAA,QAAA,SAAA;;IAAA,IAAA,WAAA;AAAA,YAAA,CAAA,UAAA,gBAAA,OAAA,EAAA,CAAA,CAAA;;IAAA,CAAA,CAAA;;EAAA,CAAA,CAAA;;;;;;;;SAAAd,eAAAA,OAAAA;OAAAA,EAAAA,aAAAA;CAAAA,MAAAA,UAAAA,mBAAAA;;;;;;;;;;qCAAGsB,EAAAA,IAAAA,WAAAA;AAAAA,UAAAA,gBAAAA,UAAAA,SAAAA,QAAAA,UAAAA,IAAAA;KAAAA,CAAAA;EAAAA,gBAAAA,OAAAA,EAAAA,CAAAA;EAAAA"}
|