@powerlines/plugin-alloy 0.25.27 → 0.25.28
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.cjs +7 -19
- package/dist/core/components/output.mjs +7 -19
- package/dist/core/components/output.mjs.map +1 -1
- package/dist/core/components/single-line-comment.cjs +8 -7
- package/dist/core/components/single-line-comment.mjs +8 -7
- package/dist/core/components/single-line-comment.mjs.map +1 -1
- package/dist/core/components/source-file.cjs +7 -12
- package/dist/core/components/source-file.mjs +7 -12
- package/dist/core/components/source-file.mjs.map +1 -1
- package/dist/core/components/spacing.cjs +6 -7
- package/dist/core/components/spacing.mjs +6 -7
- package/dist/core/components/spacing.mjs.map +1 -1
- package/dist/core/contexts/context.mjs.map +1 -1
- package/dist/core/contexts/meta.mjs.map +1 -1
- package/dist/core/contexts/reflection.mjs.map +1 -1
- package/dist/core/helpers/code.mjs.map +1 -1
- package/dist/helpers/capnp.mjs.map +1 -1
- package/dist/helpers/create-builtin.mjs.map +1 -1
- package/dist/helpers/refkey.mjs.map +1 -1
- package/dist/helpers/typescript.mjs.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/markdown/components/front-matter.cjs +9 -14
- package/dist/markdown/components/front-matter.mjs +9 -14
- package/dist/markdown/components/front-matter.mjs.map +1 -1
- package/dist/markdown/components/markdown-file.cjs +41 -89
- package/dist/markdown/components/markdown-file.mjs +41 -89
- package/dist/markdown/components/markdown-file.mjs.map +1 -1
- package/dist/markdown/components/markdown-table.cjs +20 -52
- package/dist/markdown/components/markdown-table.mjs +20 -52
- package/dist/markdown/components/markdown-table.mjs.map +1 -1
- package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
- package/dist/render.cjs +4 -10
- package/dist/render.mjs +4 -10
- package/dist/render.mjs.map +1 -1
- package/dist/typescript/components/builtin-file.cjs +9 -31
- package/dist/typescript/components/builtin-file.mjs +9 -31
- package/dist/typescript/components/builtin-file.mjs.map +1 -1
- package/dist/typescript/components/class-declaration.cjs +80 -193
- package/dist/typescript/components/class-declaration.mjs +80 -193
- package/dist/typescript/components/class-declaration.mjs.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.cjs +1 -2
- package/dist/typescript/components/dynamic-import-statement.mjs +1 -2
- package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
- package/dist/typescript/components/entry-file.cjs +3 -10
- package/dist/typescript/components/entry-file.mjs +3 -10
- package/dist/typescript/components/entry-file.mjs.map +1 -1
- package/dist/typescript/components/infrastructure-file.cjs +3 -10
- package/dist/typescript/components/infrastructure-file.mjs +3 -10
- package/dist/typescript/components/infrastructure-file.mjs.map +1 -1
- package/dist/typescript/components/interface-declaration.cjs +47 -134
- package/dist/typescript/components/interface-declaration.mjs +47 -134
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +35 -79
- package/dist/typescript/components/object-declaration.mjs +35 -79
- package/dist/typescript/components/object-declaration.mjs.map +1 -1
- package/dist/typescript/components/property-name.cjs +3 -3
- package/dist/typescript/components/property-name.mjs +3 -3
- package/dist/typescript/components/property-name.mjs.map +1 -1
- package/dist/typescript/components/record-expression.mjs.map +1 -1
- package/dist/typescript/components/tsdoc-reflection.cjs +53 -232
- package/dist/typescript/components/tsdoc-reflection.mjs +53 -232
- package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +140 -306
- package/dist/typescript/components/tsdoc.mjs +140 -306
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/components/type-declaration.cjs +9 -22
- package/dist/typescript/components/type-declaration.mjs +9 -22
- package/dist/typescript/components/type-declaration.mjs.map +1 -1
- package/dist/typescript/components/type-parameters.cjs +33 -60
- package/dist/typescript/components/type-parameters.mjs +33 -60
- package/dist/typescript/components/type-parameters.mjs.map +1 -1
- package/dist/typescript/components/typescript-file.cjs +65 -155
- package/dist/typescript/components/typescript-file.mjs +65 -155
- package/dist/typescript/components/typescript-file.mjs.map +1 -1
- package/dist/typescript/contexts/lexical-scope.cjs +1 -7
- package/dist/typescript/contexts/lexical-scope.mjs +1 -7
- package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
- package/dist/typescript/contexts/member-scope.cjs +2 -7
- package/dist/typescript/contexts/member-scope.mjs +2 -7
- package/dist/typescript/contexts/member-scope.mjs.map +1 -1
- package/dist/typescript/helpers/get-call-signature-props.mjs.map +1 -1
- package/dist/typescript/helpers/utilities.mjs.map +1 -1
- package/dist/yaml/components/yaml-file.cjs +48 -103
- package/dist/yaml/components/yaml-file.mjs +48 -103
- package/dist/yaml/components/yaml-file.mjs.map +1 -1
- package/package.json +7 -7
- package/dist/_virtual/_rolldown/runtime.mjs +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.mjs","names":["stringifyValue","camelCase","titleCase","isUndefined","generateObjectDeclaration","reflection","options","getDescription","overrideName","getClassName","getName","overrideExtends","getSuperReflectionClass","getProperties","filter","item","isIgnored","defaultValues","getNameAsString","getAlias","reduce","ret","alias","undefined","getDefaultValue","sort","a","b","isReadonly","localeCompare","map","getTitle","length","join","getDomain","getPermission","permission","isInternal","isHidden","getType"],"sources":["../../src/helpers/typescript.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { stringifyValue } from \"@powerlines/deepkit/utilities\";\nimport type { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\n\nexport interface GenerateInterfaceDeclarationOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n// /**\n// * Generates a TypeScript interface for the given reflection class.\n// *\n// * @param reflection - The reflection class to generate the interface for.\n// * @returns A string containing the TypeScript interface definition.\n// */\n// export function InterfaceDeclaration<T>(\n// reflection: ReflectionClass<T>,\n// options: GenerateInterfaceDeclarationOptions<T> = {}\n// ): string {\n// if (!reflection) {\n// return \"\";\n// }\n\n// return `\n// /**\n// * Interface for ${reflection.getTitle() || titleCase(options.overrideName || reflection.getName())}.\n// *\n// * @title ${reflection.getTitle() || titleCase(reflection.getName())}${\n// reflection.getAlias().length\n// ? ` ${reflection\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${reflection.getDomain() ? ` * @domain ${reflection.getDomain()}` : \"\"}${\n// reflection.getPermission().length\n// ? `\n// ${reflection\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// reflection.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// reflection.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// reflection.isIgnored()\n// ? `\n// * @ignored`\n// : \"\"\n// }${\n// reflection.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// export interface ${pascalCase(options.overrideName || reflection.getName())}${\n// options.overrideExtends !== false &&\n// (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n// ? ` extends ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n// : \"\"\n// } {\n// ${reflection\n// .getProperties()\n// .filter(item => !item.isIgnored())\n// .sort((a, b) =>\n// (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n// ? a.getNameAsString().localeCompare(b.getNameAsString())\n// : a.isReadonly()\n// ? 1\n// : -1\n// )\n// .map(\n// item =>\n// ` /**\n// * ${\n// item.getDescription() ||\n// item.getTitle() ||\n// titleCase(item.getNameAsString())\n// }\n// *\n// * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n// item.getAlias().length\n// ? `\n// ${item\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// item.getDomain()\n// ? `\n// * @domain ${item.getDomain()}`\n// : \"\"\n// }${\n// item.getPermission().length\n// ? `\n// ${item\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// !isUndefined(item.getDefaultValue()) && item.getDefaultValue() !== \"\"\n// ? `\n// * @defaultValue ${item.getDefaultValue()}`\n// : \"\"\n// }${\n// item.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// item.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// item.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// ${item.isReadonly() ? \"readonly \" : \"\"}${item.getNameAsString()}${\n// isUndefined(\n// (options.defaultValues as Record<string, any>)?.[item.getNameAsString()]\n// ) &&\n// isUndefined(item.getDefaultValue()) &&\n// !item\n// .getAlias()\n// .some(\n// alias =>\n// !isUndefined(\n// (options.defaultValues as Record<string, any>)?.[alias]\n// )\n// ) &&\n// item.isOptional()\n// ? \"?\"\n// : \"\"\n// }: ${stringifyType(item.getType())}`\n// )\n// .join(\", \\n\")}\n// }\n// `;\n// }\n\nexport interface GenerateObjectDeclarationOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n *\n * @param reflection - The reflection class to generate the object for.\n * @param options - Options for generating the object.\n * @returns A string containing the TypeScript object definition.\n */\nexport function generateObjectDeclaration<T extends Record<string, any>>(\n reflection: ReflectionClass<T>,\n options: GenerateObjectDeclarationOptions<T> = {}\n) {\n if (!reflection) {\n return \"\";\n }\n\n return `\n/**\n * ${\n reflection.getDescription() ||\n `${titleCase(options.overrideName || reflection.getClassName() || reflection.getName())} object instance`\n }.\n */\nexport const ${camelCase(options.overrideName || reflection.getName())}${\n options.overrideExtends !== false &&\n (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n ? `: ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n : \"\"\n } = {\n ${reflection\n .getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (options.defaultValues as Record<string, any>)?.[alias]\n )\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n .map(\n item =>\n ` /**\n * ${\n item.getDescription() ||\n item.getTitle() ||\n titleCase(item.getNameAsString())\n }\n *\n * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n item.getAlias().length\n ? `\n ${item\n .getAlias()\n .map(alias => ` * @alias ${alias}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.getDomain()\n ? `\n * @domain ${item.getDomain()}`\n : \"\"\n }${\n item.getPermission().length\n ? `\n ${item\n .getPermission()\n .map(permission => ` * @permission ${permission}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.isInternal()\n ? `\n * @internal`\n : \"\"\n }${\n item.isReadonly()\n ? `\n * @readonly`\n : \"\"\n }${\n item.isIgnored()\n ? `\n * @ignored`\n : \"\"\n }${\n item.isHidden()\n ? `\n * @hidden`\n : \"\"\n }\n */\n ${item.getNameAsString()}: ${stringifyValue(\n item.getType(),\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined((options.defaultValues as Record<string, any>)?.[alias])\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )}`\n )\n .join(\", \\n\")}\n};\n`;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/helpers/typescript.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { stringifyValue } from \"@powerlines/deepkit/utilities\";\nimport type { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\n\nexport interface GenerateInterfaceDeclarationOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n// /**\n// * Generates a TypeScript interface for the given reflection class.\n// *\n// * @param reflection - The reflection class to generate the interface for.\n// * @returns A string containing the TypeScript interface definition.\n// */\n// export function InterfaceDeclaration<T>(\n// reflection: ReflectionClass<T>,\n// options: GenerateInterfaceDeclarationOptions<T> = {}\n// ): string {\n// if (!reflection) {\n// return \"\";\n// }\n\n// return `\n// /**\n// * Interface for ${reflection.getTitle() || titleCase(options.overrideName || reflection.getName())}.\n// *\n// * @title ${reflection.getTitle() || titleCase(reflection.getName())}${\n// reflection.getAlias().length\n// ? ` ${reflection\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${reflection.getDomain() ? ` * @domain ${reflection.getDomain()}` : \"\"}${\n// reflection.getPermission().length\n// ? `\n// ${reflection\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// reflection.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// reflection.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// reflection.isIgnored()\n// ? `\n// * @ignored`\n// : \"\"\n// }${\n// reflection.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// export interface ${pascalCase(options.overrideName || reflection.getName())}${\n// options.overrideExtends !== false &&\n// (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n// ? ` extends ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n// : \"\"\n// } {\n// ${reflection\n// .getProperties()\n// .filter(item => !item.isIgnored())\n// .sort((a, b) =>\n// (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n// ? a.getNameAsString().localeCompare(b.getNameAsString())\n// : a.isReadonly()\n// ? 1\n// : -1\n// )\n// .map(\n// item =>\n// ` /**\n// * ${\n// item.getDescription() ||\n// item.getTitle() ||\n// titleCase(item.getNameAsString())\n// }\n// *\n// * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n// item.getAlias().length\n// ? `\n// ${item\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// item.getDomain()\n// ? `\n// * @domain ${item.getDomain()}`\n// : \"\"\n// }${\n// item.getPermission().length\n// ? `\n// ${item\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// !isUndefined(item.getDefaultValue()) && item.getDefaultValue() !== \"\"\n// ? `\n// * @defaultValue ${item.getDefaultValue()}`\n// : \"\"\n// }${\n// item.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// item.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// item.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// ${item.isReadonly() ? \"readonly \" : \"\"}${item.getNameAsString()}${\n// isUndefined(\n// (options.defaultValues as Record<string, any>)?.[item.getNameAsString()]\n// ) &&\n// isUndefined(item.getDefaultValue()) &&\n// !item\n// .getAlias()\n// .some(\n// alias =>\n// !isUndefined(\n// (options.defaultValues as Record<string, any>)?.[alias]\n// )\n// ) &&\n// item.isOptional()\n// ? \"?\"\n// : \"\"\n// }: ${stringifyType(item.getType())}`\n// )\n// .join(\", \\n\")}\n// }\n// `;\n// }\n\nexport interface GenerateObjectDeclarationOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n *\n * @param reflection - The reflection class to generate the object for.\n * @param options - Options for generating the object.\n * @returns A string containing the TypeScript object definition.\n */\nexport function generateObjectDeclaration<T extends Record<string, any>>(\n reflection: ReflectionClass<T>,\n options: GenerateObjectDeclarationOptions<T> = {}\n) {\n if (!reflection) {\n return \"\";\n }\n\n return `\n/**\n * ${\n reflection.getDescription() ||\n `${titleCase(options.overrideName || reflection.getClassName() || reflection.getName())} object instance`\n }.\n */\nexport const ${camelCase(options.overrideName || reflection.getName())}${\n options.overrideExtends !== false &&\n (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n ? `: ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n : \"\"\n } = {\n ${reflection\n .getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (options.defaultValues as Record<string, any>)?.[alias]\n )\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n .map(\n item =>\n ` /**\n * ${\n item.getDescription() ||\n item.getTitle() ||\n titleCase(item.getNameAsString())\n }\n *\n * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n item.getAlias().length\n ? `\n ${item\n .getAlias()\n .map(alias => ` * @alias ${alias}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.getDomain()\n ? `\n * @domain ${item.getDomain()}`\n : \"\"\n }${\n item.getPermission().length\n ? `\n ${item\n .getPermission()\n .map(permission => ` * @permission ${permission}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.isInternal()\n ? `\n * @internal`\n : \"\"\n }${\n item.isReadonly()\n ? `\n * @readonly`\n : \"\"\n }${\n item.isIgnored()\n ? `\n * @ignored`\n : \"\"\n }${\n item.isHidden()\n ? `\n * @hidden`\n : \"\"\n }\n */\n ${item.getNameAsString()}: ${stringifyValue(\n item.getType(),\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined((options.defaultValues as Record<string, any>)?.[alias])\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )}`\n )\n .join(\", \\n\")}\n};\n`;\n}\n"],"mappings":";;;;;;;;;;;;;AA6LA,SAAgB,0BACd,YACA,UAA+C,EAAE,EACjD;AACA,KAAI,CAAC,WACH,QAAO;AAGT,QAAO;;KAGN,WAAW,gBAAgB,IAC3B,GAAG,UAAU,QAAQ,gBAAgB,WAAW,cAAc,IAAI,WAAW,SAAS,CAAC,CAAC,kBACzF;;eAEa,UAAU,QAAQ,gBAAgB,WAAW,SAAS,CAAC,GAClE,QAAQ,oBAAoB,UAC3B,QAAQ,mBAAmB,WAAW,yBAAyB,EAAE,SAAS,IACvE,KAAK,QAAQ,mBAAmB,WAAW,yBAAyB,EAAE,SAAS,KAC/E,GACL;IACC,WACC,eAAe,CACf,QACC,SACE,CAAC,KAAK,WAAW,IACjB,CAAC,YACC,QAAQ,gBAAgB,KAAK,iBAAiB,KAC5C,KAAK,UAAU,CAAC,QAAQ,KAAK,UAAU;AACrC,MACE,YAAY,IAAI,IAChB,CAAC,YACE,QAAQ,gBAAwC,OAClD,CAED,QAAQ,QAAQ,gBAAwC;AAG1D,SAAO;IACN,OAAU,IACb,KAAK,iBAAiB,CACzB,CACJ,CACA,MAAM,GAAG,MACP,EAAE,YAAY,IAAI,EAAE,YAAY,IAAM,CAAC,EAAE,YAAY,IAAI,CAAC,EAAE,YAAY,GACrE,EAAE,iBAAiB,CAAC,cAAc,EAAE,iBAAiB,CAAC,GACtD,EAAE,YAAY,GACZ,IACA,GACP,CACA,KACC,SACE;MAEJ,KAAK,gBAAgB,IACrB,KAAK,UAAU,IACf,UAAU,KAAK,iBAAiB,CAAC,CAClC;;aAEU,KAAK,UAAU,IAAI,UAAU,KAAK,iBAAiB,CAAC,GAC7D,KAAK,UAAU,CAAC,SACZ;IACJ,KACC,UAAU,CACV,KAAI,UAAS,aAAa,QAAQ,CAClC,KAAK,KAAK,KACP,KAEJ,KAAK,WAAW,GACZ;cACM,KAAK,WAAW,KACtB,KAEJ,KAAK,eAAe,CAAC,SACjB;IACJ,KACC,eAAe,CACf,KAAI,eAAc,mBAAmB,aAAa,CAClD,KAAK,KAAK,KACP,KAEJ,KAAK,YAAY,GACb;iBAEA,KAEJ,KAAK,YAAY,GACb;iBAEA,KAEJ,KAAK,WAAW,GACZ;gBAEA,KAEJ,KAAK,UAAU,GACX;eAEA,GACL;;IAEC,KAAK,iBAAiB,CAAC,IAAI,eAC3B,KAAK,SAAS,EACd,QAAQ,gBAAgB,KAAK,iBAAiB,KAC5C,KAAK,UAAU,CAAC,QAAQ,KAAK,UAAU;AACrC,MACE,YAAY,IAAI,IAChB,CAAC,YAAa,QAAQ,gBAAwC,OAAO,CAErE,QAAQ,QAAQ,gBAAwC;AAG1D,SAAO;IACN,OAAU,IACb,KAAK,iBAAiB,CACzB,GACE,CACA,KAAK,OAAO,CAAC"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport rollupPlugin from \"@alloy-js/rollup-plugin\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport type { Plugin } from \"powerlines\";\nimport type { AlloyPluginContext, AlloyPluginOptions } from \"./types/plugin\";\n\ndeclare module \"powerlines\" {\n interface Config {\n alloy?: AlloyPluginOptions;\n }\n}\n\n/**\n * Alloy-js plugin for Powerlines.\n *\n * @param options - The Alloy-js plugin user configuration options.\n * @returns A Powerlines plugin that integrates Alloy-js transformations.\n */\nexport const plugin = <\n TContext extends AlloyPluginContext = AlloyPluginContext\n>(\n options: AlloyPluginOptions = {}\n) => {\n return [\n {\n name: \"alloy\",\n config() {\n this.debug(\n \"Updating configuration options to support Alloy-js builds.\"\n );\n\n return {\n alloy: {\n typescript: true,\n ...options\n },\n resolve: {\n external: [/^@alloy-js\\//]\n },\n tsdown: {\n inputOptions: {\n transform: {\n jsx: \"preserve\"\n }\n },\n plugins: [rollupPlugin()]\n }\n };\n },\n async configResolved() {\n this.debug(\"Ensuring TypeScript configuration is set up for Alloy-js.\");\n if (\n this.tsconfig.tsconfigJson.compilerOptions?.jsx !== \"preserve\" ||\n this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !==\n \"@alloy-js/core\"\n ) {\n this.tsconfig.tsconfigJson.compilerOptions ??= {};\n\n if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== \"preserve\") {\n this.tsconfig.tsconfigJson.compilerOptions.jsx = \"preserve\";\n }\n\n if (\n this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !==\n \"@alloy-js/core\"\n ) {\n this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource =\n \"@alloy-js/core\";\n }\n\n await this.fs.write(\n this.tsconfig.tsconfigFilePath,\n StormJSON.stringify(this.tsconfig.tsconfigJson)\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;AAmCA,MAAa,UAGX,UAA8B,EAAE,KAC7B;AACH,QAAO,CACL;EACE,MAAM;EACN,SAAS;AACP,QAAK,MACH,6DACD;AAED,UAAO;IACL,OAAO;KACL,YAAY;KACZ,GAAG;KACJ;IACD,SAAS,EACP,UAAU,CAAC,eAAe,EAC3B;IACD,QAAQ;KACN,cAAc,EACZ,WAAW,EACT,KAAK,YACN,EACF;KACD,SAAS,CAAC,cAAc,CAAC;KAC1B;IACF;;EAEH,MAAM,iBAAiB;AACrB,QAAK,MAAM,4DAA4D;AACvE,OACE,KAAK,SAAS,aAAa,iBAAiB,QAAQ,cACpD,KAAK,SAAS,aAAa,iBAAiB,oBAC1C,kBACF;AACA,SAAK,SAAS,aAAa,oBAAoB,EAAE;AAEjD,QAAI,KAAK,SAAS,aAAa,gBAAgB,QAAQ,WACrD,MAAK,SAAS,aAAa,gBAAgB,MAAM;AAGnD,QACE,KAAK,SAAS,aAAa,gBAAgB,oBAC3C,iBAEA,MAAK,SAAS,aAAa,gBAAgB,kBACzC;AAGJ,UAAM,KAAK,GAAG,MACZ,KAAK,SAAS,kBACd,UAAU,UAAU,KAAK,SAAS,aAAa,CAChD;;;EAGN,CACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
3
|
let _alloy_js_core = require("@alloy-js/core");
|
|
5
4
|
|
|
6
5
|
//#region src/markdown/components/front-matter.tsx
|
|
@@ -10,19 +9,15 @@ let _alloy_js_core = require("@alloy-js/core");
|
|
|
10
9
|
* @see https://jekyllrb.com/docs/front-matter/
|
|
11
10
|
*/
|
|
12
11
|
function FrontMatter(props) {
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}),
|
|
23
|
-
"---",
|
|
24
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
25
|
-
];
|
|
12
|
+
return <>
|
|
13
|
+
{"---"}
|
|
14
|
+
<hbr />
|
|
15
|
+
<_alloy_js_core.For each={Object.entries(props.data)} hardline>
|
|
16
|
+
{([key, value]) => _alloy_js_core.code`${key}: ${JSON.stringify(value)}`}
|
|
17
|
+
</_alloy_js_core.For>
|
|
18
|
+
{"---"}
|
|
19
|
+
<hbr />
|
|
20
|
+
</>;
|
|
26
21
|
}
|
|
27
22
|
|
|
28
23
|
//#endregion
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createComponent, createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
1
|
import { For, code } from "@alloy-js/core";
|
|
3
2
|
|
|
4
3
|
//#region src/markdown/components/front-matter.tsx
|
|
@@ -8,19 +7,15 @@ import { For, code } from "@alloy-js/core";
|
|
|
8
7
|
* @see https://jekyllrb.com/docs/front-matter/
|
|
9
8
|
*/
|
|
10
9
|
function FrontMatter(props) {
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}),
|
|
21
|
-
"---",
|
|
22
|
-
createIntrinsic("hbr", {})
|
|
23
|
-
];
|
|
10
|
+
return <>
|
|
11
|
+
{"---"}
|
|
12
|
+
<hbr />
|
|
13
|
+
<For each={Object.entries(props.data)} hardline>
|
|
14
|
+
{([key, value]) => code`${key}: ${JSON.stringify(value)}`}
|
|
15
|
+
</For>
|
|
16
|
+
{"---"}
|
|
17
|
+
<hbr />
|
|
18
|
+
</>;
|
|
24
19
|
}
|
|
25
20
|
|
|
26
21
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"front-matter.mjs","names":[
|
|
1
|
+
{"version":3,"file":"front-matter.mjs","names":[],"sources":["../../../src/markdown/components/front-matter.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For } from \"@alloy-js/core\";\n\nexport interface FrontMatterProps {\n data: Record<string, any>;\n}\n\n/**\n * Renders YAML front matter for a markdown file.\n *\n * @see https://jekyllrb.com/docs/front-matter/\n */\nexport function FrontMatter(props: FrontMatterProps) {\n return (\n <>\n {\"---\"}\n <hbr />\n <For each={Object.entries(props.data)} hardline>\n {([key, value]) => code`${key}: ${JSON.stringify(value)}`}\n </For>\n {\"---\"}\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;AA6BA,SAAgB,YAAY,OAAyB;AACnD,QACE,EAAE;OACC,MAAM;MACP,CAAC,MAAM;MACP,CAAC,IAAI,MAAM,OAAO,QAAQ,MAAM,KAAK,EAAE,SAAS;UAC5C,CAAC,KAAK,WAAW,IAAI,GAAG,IAAI,IAAI,KAAK,UAAU,MAAM,GAAG;MAC5D,EAAE,IAAI;OACL,MAAM;MACP,CAAC,MAAM;IACT"}
|
|
@@ -4,7 +4,6 @@ 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
|
const require_markdown_components_front_matter = require('./front-matter.cjs');
|
|
7
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
8
7
|
let _alloy_js_core = require("@alloy-js/core");
|
|
9
8
|
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
10
9
|
let powerlines_utils = require("powerlines/utils");
|
|
@@ -24,21 +23,9 @@ function MarkdownFile(props) {
|
|
|
24
23
|
"storage",
|
|
25
24
|
"frontMatter"
|
|
26
25
|
]);
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
filetype: "md",
|
|
31
|
-
reference: _alloy_js_markdown.Link,
|
|
32
|
-
storage,
|
|
33
|
-
get children() {
|
|
34
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
35
|
-
get when() {
|
|
36
|
-
return Boolean(children);
|
|
37
|
-
},
|
|
38
|
-
children
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}));
|
|
26
|
+
return <require_core_components_source_file.SourceFile header={<MarkdownFileHeader frontMatter={frontMatter} />} {...rest} filetype="md" reference={_alloy_js_markdown.Link} storage={storage}>
|
|
27
|
+
<_alloy_js_core.Show when={Boolean(children)}>{children}</_alloy_js_core.Show>
|
|
28
|
+
</require_core_components_source_file.SourceFile>;
|
|
42
29
|
}
|
|
43
30
|
/**
|
|
44
31
|
* Renders the header for a Powerlines Typescript source file.
|
|
@@ -55,79 +42,44 @@ function MarkdownFileHeader(props) {
|
|
|
55
42
|
"frontMatter"
|
|
56
43
|
]);
|
|
57
44
|
const context = require_core_contexts_context.usePowerlinesSafe();
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
children: "biome-ignore lint: disable"
|
|
97
|
-
}), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
98
|
-
}
|
|
99
|
-
}),
|
|
100
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
101
|
-
get when() {
|
|
102
|
-
return Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome);
|
|
103
|
-
},
|
|
104
|
-
get children() {
|
|
105
|
-
return (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {});
|
|
106
|
-
}
|
|
107
|
-
}),
|
|
108
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
109
|
-
get when() {
|
|
110
|
-
return Boolean(children);
|
|
111
|
-
},
|
|
112
|
-
get children() {
|
|
113
|
-
return [children, (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
114
|
-
}
|
|
115
|
-
}),
|
|
116
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, {
|
|
117
|
-
variant: "markdown",
|
|
118
|
-
get children() {
|
|
119
|
-
return `Generated by ${(0, _stryke_string_format_title_case.titleCase)(context?.config?.framework) || "Powerlines"}`;
|
|
120
|
-
}
|
|
121
|
-
}),
|
|
122
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
123
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, {
|
|
124
|
-
variant: "markdown",
|
|
125
|
-
get children() {
|
|
126
|
-
return (0, powerlines_utils.getFileHeaderWarning)(context);
|
|
127
|
-
}
|
|
128
|
-
}),
|
|
129
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
130
|
-
];
|
|
45
|
+
return <>
|
|
46
|
+
<_alloy_js_core.Show when={(0, _stryke_type_checks.isSetObject)(frontMatter) && Object.keys(frontMatter).length > 0}>
|
|
47
|
+
<require_markdown_components_front_matter.FrontMatter data={frontMatter} />
|
|
48
|
+
</_alloy_js_core.Show>
|
|
49
|
+
<_alloy_js_core.Show when={Boolean(disableEslint)}>
|
|
50
|
+
<require_core_components_single_line_comment.SingleLineComment variant="markdown">
|
|
51
|
+
{"eslint-disable"}
|
|
52
|
+
</require_core_components_single_line_comment.SingleLineComment>
|
|
53
|
+
<hbr />
|
|
54
|
+
</_alloy_js_core.Show>
|
|
55
|
+
<_alloy_js_core.Show when={Boolean(disablePrettier)}>
|
|
56
|
+
<require_core_components_single_line_comment.SingleLineComment variant="markdown">
|
|
57
|
+
{"prettier-ignore"}
|
|
58
|
+
</require_core_components_single_line_comment.SingleLineComment>
|
|
59
|
+
<hbr />
|
|
60
|
+
</_alloy_js_core.Show>
|
|
61
|
+
<_alloy_js_core.Show when={Boolean(disableBiome)}>
|
|
62
|
+
<require_core_components_single_line_comment.SingleLineComment variant="markdown">
|
|
63
|
+
{"biome-ignore lint: disable"}
|
|
64
|
+
</require_core_components_single_line_comment.SingleLineComment>
|
|
65
|
+
<hbr />
|
|
66
|
+
</_alloy_js_core.Show>
|
|
67
|
+
<_alloy_js_core.Show when={Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome)}>
|
|
68
|
+
<hbr />
|
|
69
|
+
</_alloy_js_core.Show>
|
|
70
|
+
<_alloy_js_core.Show when={Boolean(children)}>
|
|
71
|
+
<>
|
|
72
|
+
{children}
|
|
73
|
+
<hbr />
|
|
74
|
+
</>
|
|
75
|
+
</_alloy_js_core.Show>
|
|
76
|
+
<require_core_components_single_line_comment.SingleLineComment variant="markdown">{`Generated by ${(0, _stryke_string_format_title_case.titleCase)(context?.config?.framework) || "Powerlines"}`}</require_core_components_single_line_comment.SingleLineComment>
|
|
77
|
+
<hbr />
|
|
78
|
+
<require_core_components_single_line_comment.SingleLineComment variant="markdown">
|
|
79
|
+
{(0, powerlines_utils.getFileHeaderWarning)(context)}
|
|
80
|
+
</require_core_components_single_line_comment.SingleLineComment>
|
|
81
|
+
<hbr />
|
|
82
|
+
</>;
|
|
131
83
|
}
|
|
132
84
|
|
|
133
85
|
//#endregion
|
|
@@ -2,7 +2,6 @@ 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 { FrontMatter } from "./front-matter.mjs";
|
|
5
|
-
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
6
5
|
import { Show, splitProps } from "@alloy-js/core";
|
|
7
6
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
8
7
|
import { getFileHeaderWarning } from "powerlines/utils";
|
|
@@ -22,21 +21,9 @@ function MarkdownFile(props) {
|
|
|
22
21
|
"storage",
|
|
23
22
|
"frontMatter"
|
|
24
23
|
]);
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
filetype: "md",
|
|
29
|
-
reference: Link,
|
|
30
|
-
storage,
|
|
31
|
-
get children() {
|
|
32
|
-
return createComponent(Show, {
|
|
33
|
-
get when() {
|
|
34
|
-
return Boolean(children);
|
|
35
|
-
},
|
|
36
|
-
children
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}));
|
|
24
|
+
return <SourceFile header={<MarkdownFileHeader frontMatter={frontMatter} />} {...rest} filetype="md" reference={Link} storage={storage}>
|
|
25
|
+
<Show when={Boolean(children)}>{children}</Show>
|
|
26
|
+
</SourceFile>;
|
|
40
27
|
}
|
|
41
28
|
/**
|
|
42
29
|
* Renders the header for a Powerlines Typescript source file.
|
|
@@ -53,79 +40,44 @@ function MarkdownFileHeader(props) {
|
|
|
53
40
|
"frontMatter"
|
|
54
41
|
]);
|
|
55
42
|
const context = usePowerlinesSafe();
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
children: "biome-ignore lint: disable"
|
|
95
|
-
}), createIntrinsic("hbr", {})];
|
|
96
|
-
}
|
|
97
|
-
}),
|
|
98
|
-
createComponent(Show, {
|
|
99
|
-
get when() {
|
|
100
|
-
return Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome);
|
|
101
|
-
},
|
|
102
|
-
get children() {
|
|
103
|
-
return createIntrinsic("hbr", {});
|
|
104
|
-
}
|
|
105
|
-
}),
|
|
106
|
-
createComponent(Show, {
|
|
107
|
-
get when() {
|
|
108
|
-
return Boolean(children);
|
|
109
|
-
},
|
|
110
|
-
get children() {
|
|
111
|
-
return [children, createIntrinsic("hbr", {})];
|
|
112
|
-
}
|
|
113
|
-
}),
|
|
114
|
-
createComponent(SingleLineComment, {
|
|
115
|
-
variant: "markdown",
|
|
116
|
-
get children() {
|
|
117
|
-
return `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}`;
|
|
118
|
-
}
|
|
119
|
-
}),
|
|
120
|
-
createIntrinsic("hbr", {}),
|
|
121
|
-
createComponent(SingleLineComment, {
|
|
122
|
-
variant: "markdown",
|
|
123
|
-
get children() {
|
|
124
|
-
return getFileHeaderWarning(context);
|
|
125
|
-
}
|
|
126
|
-
}),
|
|
127
|
-
createIntrinsic("hbr", {})
|
|
128
|
-
];
|
|
43
|
+
return <>
|
|
44
|
+
<Show when={isSetObject(frontMatter) && Object.keys(frontMatter).length > 0}>
|
|
45
|
+
<FrontMatter data={frontMatter} />
|
|
46
|
+
</Show>
|
|
47
|
+
<Show when={Boolean(disableEslint)}>
|
|
48
|
+
<SingleLineComment variant="markdown">
|
|
49
|
+
{"eslint-disable"}
|
|
50
|
+
</SingleLineComment>
|
|
51
|
+
<hbr />
|
|
52
|
+
</Show>
|
|
53
|
+
<Show when={Boolean(disablePrettier)}>
|
|
54
|
+
<SingleLineComment variant="markdown">
|
|
55
|
+
{"prettier-ignore"}
|
|
56
|
+
</SingleLineComment>
|
|
57
|
+
<hbr />
|
|
58
|
+
</Show>
|
|
59
|
+
<Show when={Boolean(disableBiome)}>
|
|
60
|
+
<SingleLineComment variant="markdown">
|
|
61
|
+
{"biome-ignore lint: disable"}
|
|
62
|
+
</SingleLineComment>
|
|
63
|
+
<hbr />
|
|
64
|
+
</Show>
|
|
65
|
+
<Show when={Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome)}>
|
|
66
|
+
<hbr />
|
|
67
|
+
</Show>
|
|
68
|
+
<Show when={Boolean(children)}>
|
|
69
|
+
<>
|
|
70
|
+
{children}
|
|
71
|
+
<hbr />
|
|
72
|
+
</>
|
|
73
|
+
</Show>
|
|
74
|
+
<SingleLineComment variant="markdown">{`Generated by ${titleCase(context?.config?.framework) || "Powerlines"}`}</SingleLineComment>
|
|
75
|
+
<hbr />
|
|
76
|
+
<SingleLineComment variant="markdown">
|
|
77
|
+
{getFileHeaderWarning(context)}
|
|
78
|
+
</SingleLineComment>
|
|
79
|
+
<hbr />
|
|
80
|
+
</>;
|
|
129
81
|
}
|
|
130
82
|
|
|
131
83
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-file.mjs","names":[
|
|
1
|
+
{"version":3,"file":"markdown-file.mjs","names":[],"sources":["../../../src/markdown/components/markdown-file.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Show, splitProps } from \"@alloy-js/core\";\nimport { Link } from \"@alloy-js/markdown\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks\";\nimport { getFileHeaderWarning } from \"powerlines/utils\";\nimport { SingleLineComment } from \"../../core/components/single-line-comment\";\nimport { SourceFile, SourceFileProps } from \"../../core/components/source-file\";\nimport { usePowerlinesSafe } from \"../../core/contexts/context\";\nimport { ComponentProps, SourceFileHeaderProps } from \"../../types/components\";\nimport { FrontMatter, FrontMatterProps } from \"./front-matter\";\n\nexport type MarkdownFileProps = Omit<SourceFileProps, \"filetype\"> &\n ComponentProps &\n MarkdownFileHeaderProps;\n\n/**\n * A base component representing a Powerlines generated markdown source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function MarkdownFile(props: MarkdownFileProps) {\n const [{ children, storage, frontMatter }, rest] = splitProps(props, [\n \"children\",\n \"storage\",\n \"frontMatter\"\n ]);\n\n return (\n <SourceFile\n header={<MarkdownFileHeader frontMatter={frontMatter} />}\n {...rest}\n filetype=\"md\"\n reference={Link}\n storage={storage}>\n <Show when={Boolean(children)}>{children}</Show>\n </SourceFile>\n );\n}\n\nexport type MarkdownFileHeaderProps = SourceFileHeaderProps & {\n frontMatter?: FrontMatterProps[\"data\"];\n};\n\n/**\n * Renders the header for a Powerlines Typescript source file.\n *\n * @param props - The properties for the source file header.\n * @returns The rendered source file header.\n */\nexport function MarkdownFileHeader(props: MarkdownFileHeaderProps) {\n const [\n {\n children,\n disableEslint = true,\n disableBiome = true,\n disablePrettier = false,\n frontMatter\n }\n ] = splitProps(props, [\n \"children\",\n \"disableEslint\",\n \"disableBiome\",\n \"disablePrettier\",\n \"frontMatter\"\n ]);\n\n const context = usePowerlinesSafe();\n\n return (\n <>\n <Show\n when={isSetObject(frontMatter) && Object.keys(frontMatter).length > 0}>\n <FrontMatter data={frontMatter!} />\n </Show>\n <Show when={Boolean(disableEslint)}>\n <SingleLineComment variant=\"markdown\">\n {\"eslint-disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disablePrettier)}>\n <SingleLineComment variant=\"markdown\">\n {\"prettier-ignore\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show when={Boolean(disableBiome)}>\n <SingleLineComment variant=\"markdown\">\n {\"biome-ignore lint: disable\"}\n </SingleLineComment>\n <hbr />\n </Show>\n <Show\n when={\n Boolean(disableEslint) ||\n Boolean(disablePrettier) ||\n Boolean(disableBiome)\n }>\n <hbr />\n </Show>\n <Show when={Boolean(children)}>\n <>\n {children}\n <hbr />\n </>\n </Show>\n <SingleLineComment variant=\"markdown\">{`Generated by ${\n titleCase(context?.config?.framework) || \"Powerlines\"\n }`}</SingleLineComment>\n <hbr />\n <SingleLineComment variant=\"markdown\">\n {getFileHeaderWarning(context!)}\n </SingleLineComment>\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuCA,SAAgB,aAAa,OAA0B;CACrD,MAAM,CAAC,EAAE,UAAU,SAAS,eAAe,QAAQ,WAAW,OAAO;EACnE;EACA;EACA;EACD,CAAC;AAEF,QACE,CAAC,WACC,QAAQ,CAAC,mBAAmB,aAAa,qBACrC,MACJ,cACA,WAAW,MACX,SAAS,SAAS;MAClB,CAAC,KAAK,MAAM,QAAQ,SAAS,GAAG,SAAS,EAAE,KAAK;IAClD,EAAE;;;;;;;;AAcN,SAAgB,mBAAmB,OAAgC;CACjE,MAAM,CACJ,EACE,UACA,gBAAgB,MAChB,eAAe,MACf,kBAAkB,OAClB,iBAEA,WAAW,OAAO;EACpB;EACA;EACA;EACA;EACA;EACD,CAAC;CAEF,MAAM,UAAU,mBAAmB;AAEnC,QACE,EAAE;MACA,CAAC,KACC,MAAM,YAAY,YAAY,IAAI,OAAO,KAAK,YAAY,CAAC,SAAS,GAAG;QACvE,CAAC,YAAY,MAAM,eAAgB;MACrC,EAAE,KAAK;MACP,CAAC,KAAK,MAAM,QAAQ,cAAc,EAAE;QAClC,CAAC,kBAAkB,mBAAmB;WACnC,iBAAiB;QACpB,EAAE,kBAAkB;QACpB,CAAC,MAAM;MACT,EAAE,KAAK;MACP,CAAC,KAAK,MAAM,QAAQ,gBAAgB,EAAE;QACpC,CAAC,kBAAkB,mBAAmB;WACnC,kBAAkB;QACrB,EAAE,kBAAkB;QACpB,CAAC,MAAM;MACT,EAAE,KAAK;MACP,CAAC,KAAK,MAAM,QAAQ,aAAa,EAAE;QACjC,CAAC,kBAAkB,mBAAmB;WACnC,6BAA6B;QAChC,EAAE,kBAAkB;QACpB,CAAC,MAAM;MACT,EAAE,KAAK;MACP,CAAC,KACC,MACE,QAAQ,cAAc,IACtB,QAAQ,gBAAgB,IACxB,QAAQ,aAAa,EACrB;QACF,CAAC,MAAM;MACT,EAAE,KAAK;MACP,CAAC,KAAK,MAAM,QAAQ,SAAS,EAAE;QAC7B,EAAE;WACC,SAAS;UACV,CAAC,MAAM;QACT,GAAG;MACL,EAAE,KAAK;MACP,CAAC,kBAAkB,oBAAoB,gBACrC,UAAU,SAAS,QAAQ,UAAU,IAAI,eACxC,EAAE,kBAAkB;MACvB,CAAC,MAAM;MACP,CAAC,kBAAkB,mBAAmB;SACnC,qBAAqB,QAAS,CAAC;MAClC,EAAE,kBAAkB;MACpB,CAAC,MAAM;IACT"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_markdown_contexts_markdown_table = require('../contexts/markdown-table.cjs');
|
|
4
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
4
|
let _alloy_js_core = require("@alloy-js/core");
|
|
6
5
|
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
7
6
|
let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
@@ -18,22 +17,12 @@ function MarkdownTable(props) {
|
|
|
18
17
|
align: "left",
|
|
19
18
|
width: 20
|
|
20
19
|
})));
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
get children() {
|
|
29
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
30
|
-
get when() {
|
|
31
|
-
return Boolean(children);
|
|
32
|
-
},
|
|
33
|
-
children
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
20
|
+
return <require_markdown_contexts_markdown_table.MarkdownTableContext.Provider value={{
|
|
21
|
+
columns: columns.value,
|
|
22
|
+
data
|
|
23
|
+
}}>
|
|
24
|
+
<_alloy_js_core.Show when={Boolean(children)}>{children}</_alloy_js_core.Show>
|
|
25
|
+
</require_markdown_contexts_markdown_table.MarkdownTableContext.Provider>;
|
|
37
26
|
}
|
|
38
27
|
/**
|
|
39
28
|
* Component that provides a context for rendering markdown tables.
|
|
@@ -53,47 +42,26 @@ function MarkdownTableColumn(props) {
|
|
|
53
42
|
const textLength = (0, _alloy_js_core.computed)(() => {
|
|
54
43
|
return (children ? children.toString() : "").length;
|
|
55
44
|
});
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}),
|
|
64
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
65
|
-
get when() {
|
|
66
|
-
return Boolean(children);
|
|
67
|
-
},
|
|
68
|
-
get children() {
|
|
69
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Prose, { get children() {
|
|
70
|
-
return _alloy_js_core.code`${alignRef.value === "left" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}${children}${alignRef.value === "right" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}`;
|
|
71
|
-
} });
|
|
72
|
-
}
|
|
73
|
-
}),
|
|
74
|
-
"|"
|
|
75
|
-
];
|
|
76
|
-
} });
|
|
45
|
+
return <_alloy_js_core.Prose>
|
|
46
|
+
<_alloy_js_core.Show when={indexRef.value === 0}>{"|"}</_alloy_js_core.Show>
|
|
47
|
+
<_alloy_js_core.Show when={Boolean(children)}>
|
|
48
|
+
<_alloy_js_core.Prose>{_alloy_js_core.code`${alignRef.value === "left" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}${children}${alignRef.value === "right" ? " ".repeat(widthRef.value - textLength.value - 1) : " "}`}</_alloy_js_core.Prose>
|
|
49
|
+
</_alloy_js_core.Show>
|
|
50
|
+
{"|"}
|
|
51
|
+
</_alloy_js_core.Prose>;
|
|
77
52
|
}
|
|
78
53
|
/**
|
|
79
54
|
* Component that provides a context for rendering markdown tables.
|
|
80
55
|
*/
|
|
81
56
|
function MarkdownTableColumnHeader(props) {
|
|
82
57
|
const [{ children, name }, rest] = (0, _alloy_js_core.splitProps)(props, ["children", "name"]);
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
get when() {
|
|
91
|
-
return !(0, _stryke_type_checks_is_undefined.isUndefined)(children);
|
|
92
|
-
},
|
|
93
|
-
children
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
}))];
|
|
58
|
+
return <>
|
|
59
|
+
<MarkdownTableColumn {...rest} name={name}>
|
|
60
|
+
<_alloy_js_core.Show fallback={(0, _stryke_string_format_title_case.titleCase)(name, { useDescriptions: false })} when={!(0, _stryke_type_checks_is_undefined.isUndefined)(children)}>
|
|
61
|
+
{children}
|
|
62
|
+
</_alloy_js_core.Show>
|
|
63
|
+
</MarkdownTableColumn>
|
|
64
|
+
</>;
|
|
97
65
|
}
|
|
98
66
|
|
|
99
67
|
//#endregion
|