@powerlines/plugin-alloy 0.26.26 → 0.26.27
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/infrastructure-file.cjs +13 -8
- package/dist/core/components/infrastructure-file.mjs +13 -8
- package/dist/core/components/infrastructure-file.mjs.map +1 -1
- package/dist/core/components/output.cjs +17 -10
- package/dist/core/components/output.mjs +17 -10
- package/dist/core/components/output.mjs.map +1 -1
- package/dist/core/components/single-line-comment.cjs +6 -4
- package/dist/core/components/single-line-comment.mjs +6 -4
- package/dist/core/components/single-line-comment.mjs.map +1 -1
- package/dist/core/components/source-file.cjs +10 -6
- package/dist/core/components/source-file.mjs +10 -6
- package/dist/core/components/source-file.mjs.map +1 -1
- package/dist/core/components/spacing.cjs +6 -4
- package/dist/core/components/spacing.mjs +6 -4
- 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/hcl/components/block-declaration.cjs +12 -8
- package/dist/hcl/components/block-declaration.mjs +12 -8
- package/dist/hcl/components/block-declaration.mjs.map +1 -1
- package/dist/hcl/components/hcl-file.cjs +35 -21
- package/dist/hcl/components/hcl-file.mjs +36 -22
- package/dist/hcl/components/hcl-file.mjs.map +1 -1
- package/dist/hcl/components/packer-file.cjs +8 -8
- package/dist/hcl/components/packer-file.mjs +8 -8
- package/dist/hcl/components/packer-file.mjs.map +1 -1
- package/dist/hcl/components/terraform-file.cjs +8 -8
- package/dist/hcl/components/terraform-file.mjs +8 -8
- package/dist/hcl/components/terraform-file.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.cjs +16 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +15 -8
- package/dist/index.mjs.map +1 -1
- package/dist/markdown/components/front-matter.cjs +9 -7
- package/dist/markdown/components/front-matter.mjs +9 -7
- package/dist/markdown/components/front-matter.mjs.map +1 -1
- package/dist/markdown/components/markdown-file.cjs +76 -44
- package/dist/markdown/components/markdown-file.mjs +76 -44
- package/dist/markdown/components/markdown-file.mjs.map +1 -1
- package/dist/markdown/components/markdown-table.cjs +49 -28
- package/dist/markdown/components/markdown-table.mjs +49 -28
- package/dist/markdown/components/markdown-table.mjs.map +1 -1
- package/dist/markdown/contexts/markdown-table.mjs.map +1 -1
- package/dist/render.cjs +3 -3
- package/dist/render.mjs +4 -4
- package/dist/render.mjs.map +1 -1
- package/dist/types/components.cjs +9 -0
- package/dist/types/components.mjs +10 -1
- package/dist/types/components.mjs.map +1 -0
- package/dist/typescript/components/builtin-file.cjs +30 -20
- package/dist/typescript/components/builtin-file.mjs +30 -20
- package/dist/typescript/components/builtin-file.mjs.map +1 -1
- package/dist/typescript/components/class-declaration.cjs +180 -100
- package/dist/typescript/components/class-declaration.mjs +180 -100
- package/dist/typescript/components/class-declaration.mjs.map +1 -1
- package/dist/typescript/components/dynamic-import-statement.cjs +2 -6
- package/dist/typescript/components/dynamic-import-statement.mjs +2 -6
- package/dist/typescript/components/dynamic-import-statement.mjs.map +1 -1
- package/dist/typescript/components/entry-file.cjs +10 -7
- package/dist/typescript/components/entry-file.mjs +10 -7
- package/dist/typescript/components/entry-file.mjs.map +1 -1
- package/dist/typescript/components/interface-declaration.cjs +127 -74
- package/dist/typescript/components/interface-declaration.mjs +127 -74
- package/dist/typescript/components/interface-declaration.mjs.map +1 -1
- package/dist/typescript/components/object-declaration.cjs +84 -50
- package/dist/typescript/components/object-declaration.mjs +84 -50
- 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 +241 -108
- package/dist/typescript/components/tsdoc-reflection.mjs +241 -108
- package/dist/typescript/components/tsdoc-reflection.mjs.map +1 -1
- package/dist/typescript/components/tsdoc.cjs +265 -168
- package/dist/typescript/components/tsdoc.mjs +265 -168
- package/dist/typescript/components/tsdoc.mjs.map +1 -1
- package/dist/typescript/components/type-declaration.cjs +20 -15
- package/dist/typescript/components/type-declaration.mjs +20 -15
- package/dist/typescript/components/type-declaration.mjs.map +1 -1
- package/dist/typescript/components/type-parameters.cjs +56 -29
- package/dist/typescript/components/type-parameters.mjs +56 -29
- package/dist/typescript/components/type-parameters.mjs.map +1 -1
- package/dist/typescript/components/typescript-file.cjs +135 -74
- package/dist/typescript/components/typescript-file.mjs +135 -74
- package/dist/typescript/components/typescript-file.mjs.map +1 -1
- package/dist/typescript/contexts/lexical-scope.cjs +5 -3
- package/dist/typescript/contexts/lexical-scope.mjs +5 -3
- package/dist/typescript/contexts/lexical-scope.mjs.map +1 -1
- package/dist/typescript/contexts/member-scope.cjs +5 -3
- package/dist/typescript/contexts/member-scope.mjs +5 -3
- 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 +92 -47
- package/dist/yaml/components/yaml-file.mjs +92 -47
- package/dist/yaml/components/yaml-file.mjs.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/helpers/typescript.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { stringifyValue } from \"@powerlines/deepkit/utilities\";\nimport type { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\n\nexport interface GenerateInterfaceDeclarationOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n// /**\n// * Generates a TypeScript interface for the given reflection class.\n// *\n// * @param reflection - The reflection class to generate the interface for.\n// * @returns A string containing the TypeScript interface definition.\n// */\n// export function InterfaceDeclaration<T>(\n// reflection: ReflectionClass<T>,\n// options: GenerateInterfaceDeclarationOptions<T> = {}\n// ): string {\n// if (!reflection) {\n// return \"\";\n// }\n\n// return `\n// /**\n// * Interface for ${reflection.getTitle() || titleCase(options.overrideName || reflection.getName())}.\n// *\n// * @title ${reflection.getTitle() || titleCase(reflection.getName())}${\n// reflection.getAlias().length\n// ? ` ${reflection\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${reflection.getDomain() ? ` * @domain ${reflection.getDomain()}` : \"\"}${\n// reflection.getPermission().length\n// ? `\n// ${reflection\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// reflection.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// reflection.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// reflection.isIgnored()\n// ? `\n// * @ignored`\n// : \"\"\n// }${\n// reflection.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// export interface ${pascalCase(options.overrideName || reflection.getName())}${\n// options.overrideExtends !== false &&\n// (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n// ? ` extends ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n// : \"\"\n// } {\n// ${reflection\n// .getProperties()\n// .filter(item => !item.isIgnored())\n// .sort((a, b) =>\n// (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n// ? a.getNameAsString().localeCompare(b.getNameAsString())\n// : a.isReadonly()\n// ? 1\n// : -1\n// )\n// .map(\n// item =>\n// ` /**\n// * ${\n// item.getDescription() ||\n// item.getTitle() ||\n// titleCase(item.getNameAsString())\n// }\n// *\n// * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n// item.getAlias().length\n// ? `\n// ${item\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// item.getDomain()\n// ? `\n// * @domain ${item.getDomain()}`\n// : \"\"\n// }${\n// item.getPermission().length\n// ? `\n// ${item\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// !isUndefined(item.getDefaultValue()) && item.getDefaultValue() !== \"\"\n// ? `\n// * @defaultValue ${item.getDefaultValue()}`\n// : \"\"\n// }${\n// item.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// item.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// item.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// ${item.isReadonly() ? \"readonly \" : \"\"}${item.getNameAsString()}${\n// isUndefined(\n// (options.defaultValues as Record<string, any>)?.[item.getNameAsString()]\n// ) &&\n// isUndefined(item.getDefaultValue()) &&\n// !item\n// .getAlias()\n// .some(\n// alias =>\n// !isUndefined(\n// (options.defaultValues as Record<string, any>)?.[alias]\n// )\n// ) &&\n// item.isOptional()\n// ? \"?\"\n// : \"\"\n// }: ${stringifyType(item.getType())}`\n// )\n// .join(\", \\n\")}\n// }\n// `;\n// }\n\nexport interface GenerateObjectDeclarationOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n *\n * @param reflection - The reflection class to generate the object for.\n * @param options - Options for generating the object.\n * @returns A string containing the TypeScript object definition.\n */\nexport function generateObjectDeclaration<T extends Record<string, any>>(\n reflection: ReflectionClass<T>,\n options: GenerateObjectDeclarationOptions<T> = {}\n) {\n if (!reflection) {\n return \"\";\n }\n\n return `\n/**\n * ${\n reflection.getDescription() ||\n `${titleCase(options.overrideName || reflection.getClassName() || reflection.getName())} object instance`\n }.\n */\nexport const ${camelCase(options.overrideName || reflection.getName())}${\n options.overrideExtends !== false &&\n (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n ? `: ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n : \"\"\n } = {\n ${reflection\n .getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (options.defaultValues as Record<string, any>)?.[alias]\n )\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n .map(\n item =>\n ` /**\n * ${\n item.getDescription() ||\n item.getTitle() ||\n titleCase(item.getNameAsString())\n }\n *\n * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n item.getAlias().length\n ? `\n ${item\n .getAlias()\n .map(alias => ` * @alias ${alias}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.getDomain()\n ? `\n * @domain ${item.getDomain()}`\n : \"\"\n }${\n item.getPermission().length\n ? `\n ${item\n .getPermission()\n .map(permission => ` * @permission ${permission}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.isInternal()\n ? `\n * @internal`\n : \"\"\n }${\n item.isRuntime()\n ? `\n * @runtime`\n : \"\"\n }${\n item.isReadonly()\n ? `\n * @readonly`\n : \"\"\n }${\n item.isIgnored()\n ? `\n * @ignored`\n : \"\"\n }${\n item.isHidden()\n ? `\n * @hidden`\n : \"\"\n }\n */\n ${item.getNameAsString()}: ${stringifyValue(\n item.getType(),\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined((options.defaultValues as Record<string, any>)?.[alias])\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )}`\n )\n .join(\", \\n\")}\n};\n`;\n}\n"],"mappings":";;;;;;;;;;;;;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,WAAW,GACZ;gBAEA,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"}
|
|
1
|
+
{"version":3,"file":"typescript.mjs","names":[],"sources":["../../src/helpers/typescript.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { stringifyValue } from \"@powerlines/deepkit/utilities\";\nimport type { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\n\nexport interface GenerateInterfaceDeclarationOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n// /**\n// * Generates a TypeScript interface for the given reflection class.\n// *\n// * @param reflection - The reflection class to generate the interface for.\n// * @returns A string containing the TypeScript interface definition.\n// */\n// export function InterfaceDeclaration<T>(\n// reflection: ReflectionClass<T>,\n// options: GenerateInterfaceDeclarationOptions<T> = {}\n// ): string {\n// if (!reflection) {\n// return \"\";\n// }\n\n// return `\n// /**\n// * Interface for ${reflection.getTitle() || titleCase(options.overrideName || reflection.getName())}.\n// *\n// * @title ${reflection.getTitle() || titleCase(reflection.getName())}${\n// reflection.getAlias().length\n// ? ` ${reflection\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${reflection.getDomain() ? ` * @domain ${reflection.getDomain()}` : \"\"}${\n// reflection.getPermission().length\n// ? `\n// ${reflection\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// reflection.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// reflection.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// reflection.isIgnored()\n// ? `\n// * @ignored`\n// : \"\"\n// }${\n// reflection.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// export interface ${pascalCase(options.overrideName || reflection.getName())}${\n// options.overrideExtends !== false &&\n// (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n// ? ` extends ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n// : \"\"\n// } {\n// ${reflection\n// .getProperties()\n// .filter(item => !item.isIgnored())\n// .sort((a, b) =>\n// (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n// ? a.getNameAsString().localeCompare(b.getNameAsString())\n// : a.isReadonly()\n// ? 1\n// : -1\n// )\n// .map(\n// item =>\n// ` /**\n// * ${\n// item.getDescription() ||\n// item.getTitle() ||\n// titleCase(item.getNameAsString())\n// }\n// *\n// * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n// item.getAlias().length\n// ? `\n// ${item\n// .getAlias()\n// .map(alias => ` * @alias ${alias}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// item.getDomain()\n// ? `\n// * @domain ${item.getDomain()}`\n// : \"\"\n// }${\n// item.getPermission().length\n// ? `\n// ${item\n// .getPermission()\n// .map(permission => ` * @permission ${permission}`)\n// .join(\"\\n\")}`\n// : \"\"\n// }${\n// !isUndefined(item.getDefaultValue()) && item.getDefaultValue() !== \"\"\n// ? `\n// * @defaultValue ${item.getDefaultValue()}`\n// : \"\"\n// }${\n// item.isInternal()\n// ? `\n// * @internal`\n// : \"\"\n// }${\n// item.isReadonly()\n// ? `\n// * @readonly`\n// : \"\"\n// }${\n// item.isHidden()\n// ? `\n// * @hidden`\n// : \"\"\n// }\n// */\n// ${item.isReadonly() ? \"readonly \" : \"\"}${item.getNameAsString()}${\n// isUndefined(\n// (options.defaultValues as Record<string, any>)?.[item.getNameAsString()]\n// ) &&\n// isUndefined(item.getDefaultValue()) &&\n// !item\n// .getAlias()\n// .some(\n// alias =>\n// !isUndefined(\n// (options.defaultValues as Record<string, any>)?.[alias]\n// )\n// ) &&\n// item.isOptional()\n// ? \"?\"\n// : \"\"\n// }: ${stringifyType(item.getType())}`\n// )\n// .join(\", \\n\")}\n// }\n// `;\n// }\n\nexport interface GenerateObjectDeclarationOptions<T> {\n overrideName?: string;\n overrideExtends?: string | false;\n defaultValues?: Partial<T>;\n}\n\n/**\n * Generates a TypeScript object for the given reflection class.\n *\n * @param reflection - The reflection class to generate the object for.\n * @param options - Options for generating the object.\n * @returns A string containing the TypeScript object definition.\n */\nexport function generateObjectDeclaration<T extends Record<string, any>>(\n reflection: ReflectionClass<T>,\n options: GenerateObjectDeclarationOptions<T> = {}\n) {\n if (!reflection) {\n return \"\";\n }\n\n return `\n/**\n * ${\n reflection.getDescription() ||\n `${titleCase(options.overrideName || reflection.getClassName() || reflection.getName())} object instance`\n }.\n */\nexport const ${camelCase(options.overrideName || reflection.getName())}${\n options.overrideExtends !== false &&\n (options.overrideExtends || reflection.getSuperReflectionClass()?.getName())\n ? `: ${options.overrideExtends || reflection.getSuperReflectionClass()?.getName()}`\n : \"\"\n } = {\n ${reflection\n .getProperties()\n .filter(\n item =>\n !item.isIgnored() &&\n !isUndefined(\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined(\n (options.defaultValues as Record<string, any>)?.[alias]\n )\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )\n )\n .sort((a, b) =>\n (a.isReadonly() && b.isReadonly()) || (!a.isReadonly() && !b.isReadonly())\n ? a.getNameAsString().localeCompare(b.getNameAsString())\n : a.isReadonly()\n ? 1\n : -1\n )\n .map(\n item =>\n ` /**\n * ${\n item.getDescription() ||\n item.getTitle() ||\n titleCase(item.getNameAsString())\n }\n *\n * @title ${item.getTitle() || titleCase(item.getNameAsString())}${\n item.getAlias().length\n ? `\n ${item\n .getAlias()\n .map(alias => ` * @alias ${alias}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.getDomain()\n ? `\n * @domain ${item.getDomain()}`\n : \"\"\n }${\n item.getPermission().length\n ? `\n ${item\n .getPermission()\n .map(permission => ` * @permission ${permission}`)\n .join(\"\\n\")}`\n : \"\"\n }${\n item.isInternal()\n ? `\n * @internal`\n : \"\"\n }${\n item.isRuntime()\n ? `\n * @runtime`\n : \"\"\n }${\n item.isReadonly()\n ? `\n * @readonly`\n : \"\"\n }${\n item.isIgnored()\n ? `\n * @ignored`\n : \"\"\n }${\n item.isHidden()\n ? `\n * @hidden`\n : \"\"\n }\n */\n ${item.getNameAsString()}: ${stringifyValue(\n item.getType(),\n options.defaultValues?.[item.getNameAsString()] ??\n item.getAlias().reduce((ret, alias) => {\n if (\n isUndefined(ret) &&\n !isUndefined((options.defaultValues as Record<string, any>)?.[alias])\n ) {\n return (options.defaultValues as Record<string, any>)?.[alias];\n }\n\n return ret;\n }, undefined) ??\n item.getDefaultValue()\n )}`\n )\n .join(\", \\n\")}\n};\n`;\n}\n"],"mappings":";;;;;;;;;;;;;AAgLA,SAAgB,0BAAC,YAAoC,UAAA,EAAA,EAAA;AACnD,KAAA,CAAA,WACA,QAAA;AAEF,QAAA;;KAEE,WAAA,gBAAA,IAAA,GAAA,UAAA,QAAA,gBAAA,WAAA,cAAA,IAAA,WAAA,SAAA,CAAA,CAAA,kBAAA;;eAED,UAAA,QAAA,gBAAA,WAAA,SAAA,CAAA,GAAA,QAAA,oBAAA,UAAA,QAAA,mBAAA,WAAA,yBAAA,EAAA,SAAA,IAAA,KAAA,QAAA,mBAAA,WAAA,yBAAA,EAAA,SAAA,KAAA,GAAA;IACG,WAAM,eAAiB,CAAA,QAAW,SAAQ,CAAC,KAAA,WAAa,IAAO,CAAA,YAAG,QAAA,gBAAA,KAAA,iBAAA,KAAA,KAAA,UAAA,CAAA,QAAA,KAAA,UAAA;AAClE,MAAA,YAAgB,IAAA,IAAQ,CAAA,YAAI,QAAe,gBAAM,OAAA,CACjD,QAAS,QAAQ,gBAAe;AAEpC,SAAO;IACL,OAAY,IAAA,KAAA,iBAAkB,CAAA,CAAA,CAAA,MAAA,GAAA,MAAA,EAAA,YAAA,IAAA,EAAA,YAAA,IAAA,CAAA,EAAA,YAAA,IAAA,CAAA,EAAA,YAAA,GAAA,EAAA,iBAAA,CAAA,cAAA,EAAA,iBAAA,CAAA,GAAA,EAAA,YAAA,GAAA,IAAA,GAAA,CAAA,KAAA,SAAA;MAC9B,KAAS,gBAAA,IAAA,KAAA,UAAmC,IAAI,UAAA,KAAA,iBAAA,CAAA,CAAA;;aAE3C,KAAW,UAAC,IAAA,UAAA,KAAA,iBAAA,CAAA,GAAA,KAAA,UAAA,CAAA,SAAA;IACf,KAAA,UAAS,CAAA,KAAA,UAAA,aAAA,QAAA,CAAA,KAAA,KAAA,KAAA,KAAA,KAAA,WAAA,GAAA;cACX,KAAA,WAAA,KAAA,KAAA,KAAA,eAAA,CAAA,SAAA;;iBAEO,KAAA,KAAA,WAAA,GAAA;gBACP,KAAA,KAAA,YAAA,GAAA;iBACE,KAAA,KAAA,WAAA,GAAA;gBACU,KAAA,KAAA,UAAkB,GAAA;eACjB,GAAC;;IAEd,KAAA,iBAAA,CAAA,IAAA,eAAA,KAAA,SAAA,EAAA,QAAA,gBAAA,KAAA,iBAAA,KAAA,KAAA,UAAA,CAAA,QAAA,KAAA,UAAA;AACF,MAAO,YAAQ,IAAS,IAAC,CAAA,YAAQ,QAAgB,gBAAW,OAAY,CACpE,QAAQ,QAAA,gBAAyB;AAEjC,SAAO;IACN,OAAI,IAAA,KAAA,iBAAA,CAAA,GAAA,CAAA,KAAA,OAAA,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _powerlines_plugin_babel = require("@powerlines/plugin-babel");
|
|
4
|
+
_powerlines_plugin_babel = require_runtime.__toESM(_powerlines_plugin_babel);
|
|
3
5
|
let _stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
6
|
+
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
4
7
|
|
|
5
8
|
//#region src/index.tsx
|
|
6
9
|
/**
|
|
@@ -10,7 +13,7 @@ let _stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
|
10
13
|
* @returns A Powerlines plugin that integrates Alloy-js transformations.
|
|
11
14
|
*/
|
|
12
15
|
const plugin = (options = {}) => {
|
|
13
|
-
return [{
|
|
16
|
+
return [(0, _powerlines_plugin_babel.default)(), {
|
|
14
17
|
name: "alloy",
|
|
15
18
|
config() {
|
|
16
19
|
this.debug("Updating configuration options to support Alloy-js builds.");
|
|
@@ -19,19 +22,24 @@ const plugin = (options = {}) => {
|
|
|
19
22
|
typescript: true,
|
|
20
23
|
...options
|
|
21
24
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
babel: {
|
|
26
|
+
skipConfigResolution: true,
|
|
27
|
+
presets: ["@babel/preset-typescript", [
|
|
28
|
+
"@alloy-js/babel-preset",
|
|
29
|
+
{},
|
|
30
|
+
(_, id) => (0, _stryke_path_file_path_fns.findFileExtension)(id) === "tsx" || (0, _stryke_path_file_path_fns.findFileExtension)(id) === "jsx"
|
|
31
|
+
]]
|
|
32
|
+
},
|
|
33
|
+
tsdown: { inputOptions: { transform: { jsx: "preserve" } } },
|
|
26
34
|
resolve: { external: [/^@alloy-js\//] }
|
|
27
35
|
};
|
|
28
36
|
},
|
|
29
37
|
async configResolved() {
|
|
30
38
|
this.debug("Ensuring TypeScript configuration is set up for Alloy-js.");
|
|
31
|
-
if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "
|
|
39
|
+
if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource) {
|
|
32
40
|
this.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
33
|
-
if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "
|
|
34
|
-
if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource
|
|
41
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
|
|
42
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource) this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = void 0;
|
|
35
43
|
await this.fs.write(this.tsconfig.tsconfigFilePath, _stryke_json_storm_json.StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
36
44
|
}
|
|
37
45
|
}
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;YAyBY,MAAA;IACR,KAAA,GAAQ,kBAAA;EAAA;AAAA;;;;;;;cAUC,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KAkEJ,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;YAyBY,MAAA;IACR,KAAA,GAAQ,kBAAA;EAAA;AAAA;;;;;;;cAUC,MAAA,oBACM,kBAAA,GAAqB,kBAAA,EAEtC,OAAA,GAAS,kBAAA,KAkEJ,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import babel from "@powerlines/plugin-babel";
|
|
1
2
|
import { StormJSON } from "@stryke/json/storm-json";
|
|
3
|
+
import { findFileExtension } from "@stryke/path/file-path-fns";
|
|
2
4
|
|
|
3
5
|
//#region src/index.tsx
|
|
4
6
|
/**
|
|
@@ -8,7 +10,7 @@ import { StormJSON } from "@stryke/json/storm-json";
|
|
|
8
10
|
* @returns A Powerlines plugin that integrates Alloy-js transformations.
|
|
9
11
|
*/
|
|
10
12
|
const plugin = (options = {}) => {
|
|
11
|
-
return [{
|
|
13
|
+
return [babel(), {
|
|
12
14
|
name: "alloy",
|
|
13
15
|
config() {
|
|
14
16
|
this.debug("Updating configuration options to support Alloy-js builds.");
|
|
@@ -17,19 +19,24 @@ const plugin = (options = {}) => {
|
|
|
17
19
|
typescript: true,
|
|
18
20
|
...options
|
|
19
21
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
babel: {
|
|
23
|
+
skipConfigResolution: true,
|
|
24
|
+
presets: ["@babel/preset-typescript", [
|
|
25
|
+
"@alloy-js/babel-preset",
|
|
26
|
+
{},
|
|
27
|
+
(_, id) => findFileExtension(id) === "tsx" || findFileExtension(id) === "jsx"
|
|
28
|
+
]]
|
|
29
|
+
},
|
|
30
|
+
tsdown: { inputOptions: { transform: { jsx: "preserve" } } },
|
|
24
31
|
resolve: { external: [/^@alloy-js\//] }
|
|
25
32
|
};
|
|
26
33
|
},
|
|
27
34
|
async configResolved() {
|
|
28
35
|
this.debug("Ensuring TypeScript configuration is set up for Alloy-js.");
|
|
29
|
-
if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "
|
|
36
|
+
if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource) {
|
|
30
37
|
this.tsconfig.tsconfigJson.compilerOptions ??= {};
|
|
31
|
-
if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "
|
|
32
|
-
if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource
|
|
38
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
|
|
39
|
+
if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource) this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = void 0;
|
|
33
40
|
await this.fs.write(this.tsconfig.tsconfigFilePath, StormJSON.stringify(this.tsconfig.tsconfigJson));
|
|
34
41
|
}
|
|
35
42
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { 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
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport babel from \"@powerlines/plugin-babel\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { findFileExtension } from \"@stryke/path/file-path-fns\";\nimport type { Plugin } from \"powerlines\";\nimport type { AlloyPluginContext, AlloyPluginOptions } from \"./types/plugin\";\n\ndeclare module \"powerlines\" {\n interface Config {\n alloy?: AlloyPluginOptions;\n }\n}\n\n/**\n * Alloy-js plugin for Powerlines.\n *\n * @param options - The Alloy-js plugin user configuration options.\n * @returns A Powerlines plugin that integrates Alloy-js transformations.\n */\nexport const plugin = <\n TContext extends AlloyPluginContext = AlloyPluginContext\n>(\n options: AlloyPluginOptions = {}\n) => {\n return [\n babel(),\n {\n name: \"alloy\",\n config() {\n this.debug(\n \"Updating configuration options to support Alloy-js builds.\"\n );\n\n return {\n alloy: {\n typescript: true,\n ...options\n },\n babel: {\n skipConfigResolution: true,\n presets: [\n \"@babel/preset-typescript\",\n [\n \"@alloy-js/babel-preset\",\n {},\n (_: string, id: string) =>\n findFileExtension(id) === \"tsx\" ||\n findFileExtension(id) === \"jsx\"\n ]\n ]\n },\n tsdown: {\n inputOptions: {\n transform: {\n jsx: \"preserve\"\n }\n }\n },\n resolve: {\n external: [/^@alloy-js\\//]\n }\n };\n },\n async configResolved() {\n this.debug(\"Ensuring TypeScript configuration is set up for Alloy-js.\");\n\n if (\n this.tsconfig.tsconfigJson.compilerOptions?.jsx !== \"preserve\" ||\n this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource\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 (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource) {\n this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource =\n undefined;\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":";;;;;;;;;;;AA2BA,MAAE,UAAA,UAAA,EAAA,KAAA;AACF,QAAA,CAAA,OAAA,EAAA;;EAEE,SAAA;AACC,QAAQ,MAAC,6DAAqB;AAChC,UAAA;IACG,OAAM;KACN,YAAU;KACZ,GAAA;KACK;IACL,OAAS;KACV,sBAAA;KACS,SAAC,CAAA,4BAAsB;MAAA;MAAA,EAAA;OAAA,GAAA,OAAA,kBAAA,GAAA,KAAA,SAAA,kBAAA,GAAA,KAAA;MAAA,CAAA;KAC5B;IACG,QAAC,EACC,cAAC,EACP,WAAA,EACS,KAAM,YACN,EACL,EACC;IACD,SAAC,8BAED;IACD;;EAEH,MAAM,iBAAK;AACT,QAAK,MAAA,4DAAA;AACL,OAAI,KAAK,SAAE,aAAA,iBAAA,QAAA,cAAA,KAAA,SAAA,aAAA,iBAAA,iBAAA;AACT,SAAI,SAAA,aAAsB,oBAAI,EAAA;AAC9B,QAAI,KAAA,SAAS,aAAA,gBAAA,QAAA,WACX,MAAK,SAAO,aAAO,gBAAW,MAAA;AAEhC,QAAI,KAAK,SAAS,aAAa,gBAAC,gBAC9B,MAAK,SAAG,aAAA,gBAAA,kBAAA;AAEV,UAAM,KAAI,GAAA,MAAA,KAAA,SAAwB,kBAAS,UAAA,UAAA,KAAA,SAAA,aAAA,CAAA;;;EAGhD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
4
3
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
5
5
|
|
|
6
6
|
//#region src/markdown/components/front-matter.tsx
|
|
7
7
|
/**
|
|
@@ -10,17 +10,19 @@ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
|
10
10
|
* @see https://jekyllrb.com/docs/front-matter/
|
|
11
11
|
*/
|
|
12
12
|
function FrontMatter(props) {
|
|
13
|
-
return
|
|
13
|
+
return [
|
|
14
14
|
"---",
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
each
|
|
15
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
16
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
17
|
+
get each() {
|
|
18
|
+
return Object.entries(props.data);
|
|
19
|
+
},
|
|
18
20
|
hardline: true,
|
|
19
21
|
children: ([key, value]) => _alloy_js_core.code`${key}: ${JSON.stringify(value)}`
|
|
20
22
|
}),
|
|
21
23
|
"---",
|
|
22
|
-
|
|
23
|
-
]
|
|
24
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
25
|
+
];
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { createComponent, createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
1
2
|
import { For, code } from "@alloy-js/core";
|
|
2
|
-
import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/markdown/components/front-matter.tsx
|
|
5
5
|
/**
|
|
@@ -8,17 +8,19 @@ import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
|
8
8
|
* @see https://jekyllrb.com/docs/front-matter/
|
|
9
9
|
*/
|
|
10
10
|
function FrontMatter(props) {
|
|
11
|
-
return
|
|
11
|
+
return [
|
|
12
12
|
"---",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
each
|
|
13
|
+
createIntrinsic("hbr", {}),
|
|
14
|
+
createComponent(For, {
|
|
15
|
+
get each() {
|
|
16
|
+
return Object.entries(props.data);
|
|
17
|
+
},
|
|
16
18
|
hardline: true,
|
|
17
19
|
children: ([key, value]) => code`${key}: ${JSON.stringify(value)}`
|
|
18
20
|
}),
|
|
19
21
|
"---",
|
|
20
|
-
|
|
21
|
-
]
|
|
22
|
+
createIntrinsic("hbr", {})
|
|
23
|
+
];
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"front-matter.mjs","names":[],"sources":["../../../src/markdown/components/front-matter.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For } from \"@alloy-js/core\";\n\nexport interface FrontMatterProps {\n data: Record<string, any>;\n}\n\n/**\n * Renders YAML front matter for a markdown file.\n *\n * @see https://jekyllrb.com/docs/front-matter/\n */\nexport function FrontMatter(props: FrontMatterProps) {\n return (\n <>\n {\"---\"}\n <hbr />\n <For each={Object.entries(props.data)} hardline>\n {([key, value]) => code`${key}: ${JSON.stringify(value)}`}\n </For>\n {\"---\"}\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"front-matter.mjs","names":[],"sources":["../../../src/markdown/components/front-matter.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For } from \"@alloy-js/core\";\n\nexport interface FrontMatterProps {\n data: Record<string, any>;\n}\n\n/**\n * Renders YAML front matter for a markdown file.\n *\n * @see https://jekyllrb.com/docs/front-matter/\n */\nexport function FrontMatter(props: FrontMatterProps) {\n return (\n <>\n {\"---\"}\n <hbr />\n <For each={Object.entries(props.data)} hardline>\n {([key, value]) => code`${key}: ${JSON.stringify(value)}`}\n </For>\n {\"---\"}\n <hbr />\n </>\n );\n}\n"],"mappings":";;;;;;;;;AAyBA,SAAgB,YAAY,OAAO;AAClC,QAAA;EAAA;EAAA,gBAAA,OAAA,EAAA,CAAA;EAAA,gBAAA,KAAA;GACG,IAAI,OAAO;AACb,WAAA,OAAA,QAAA,MAAA,KAAA;;GAEA,UAAO;GACL,WAAC,CAAA,KAAA,WAAA,IAAA,GAAA,IAAA,IAAA,KAAA,UAAA,MAAA;GACF,CAAC;EAAE;EAAM,gBAAA,OAAA,EAAA,CAAA;EAAA"}
|
|
@@ -4,8 +4,8 @@ const require_core_contexts_context = require('../../core/contexts/context.cjs')
|
|
|
4
4
|
const require_core_components_source_file = require('../../core/components/source-file.cjs');
|
|
5
5
|
const require_core_components_single_line_comment = require('../../core/components/single-line-comment.cjs');
|
|
6
6
|
const require_markdown_components_front_matter = require('./front-matter.cjs');
|
|
7
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
8
7
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
8
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
9
9
|
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
10
10
|
let powerlines_utils = require("powerlines/utils");
|
|
11
11
|
let _alloy_js_markdown = require("@alloy-js/markdown");
|
|
@@ -24,17 +24,21 @@ function MarkdownFile(props) {
|
|
|
24
24
|
"storage",
|
|
25
25
|
"frontMatter"
|
|
26
26
|
]);
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_source_file.SourceFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({ get header() {
|
|
28
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(MarkdownFileHeader, { frontMatter });
|
|
29
|
+
} }, rest, {
|
|
30
30
|
filetype: "md",
|
|
31
31
|
reference: _alloy_js_markdown.Link,
|
|
32
32
|
storage,
|
|
33
|
-
children
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
+
}));
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
40
44
|
* Renders the header for a Powerlines Typescript source file.
|
|
@@ -51,51 +55,79 @@ function MarkdownFileHeader(props) {
|
|
|
51
55
|
"frontMatter"
|
|
52
56
|
]);
|
|
53
57
|
const context = require_core_contexts_context.usePowerlinesSafe();
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
when
|
|
57
|
-
|
|
58
|
+
return [
|
|
59
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
60
|
+
get when() {
|
|
61
|
+
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!(0, _stryke_type_checks.isSetObject)(frontMatter))() && Object.keys(frontMatter).length > 0;
|
|
62
|
+
},
|
|
63
|
+
get children() {
|
|
64
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_markdown_components_front_matter.FrontMatter, { data: frontMatter });
|
|
65
|
+
}
|
|
58
66
|
}),
|
|
59
|
-
|
|
60
|
-
when
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
68
|
+
get when() {
|
|
69
|
+
return Boolean(disableEslint);
|
|
70
|
+
},
|
|
71
|
+
get children() {
|
|
72
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, {
|
|
73
|
+
variant: "markdown",
|
|
74
|
+
children: "eslint-disable"
|
|
75
|
+
}), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
76
|
+
}
|
|
65
77
|
}),
|
|
66
|
-
|
|
67
|
-
when
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
79
|
+
get when() {
|
|
80
|
+
return Boolean(disablePrettier);
|
|
81
|
+
},
|
|
82
|
+
get children() {
|
|
83
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, {
|
|
84
|
+
variant: "markdown",
|
|
85
|
+
children: "prettier-ignore"
|
|
86
|
+
}), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
87
|
+
}
|
|
72
88
|
}),
|
|
73
|
-
|
|
74
|
-
when
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
90
|
+
get when() {
|
|
91
|
+
return Boolean(disableBiome);
|
|
92
|
+
},
|
|
93
|
+
get children() {
|
|
94
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, {
|
|
95
|
+
variant: "markdown",
|
|
96
|
+
children: "biome-ignore lint: disable"
|
|
97
|
+
}), (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
|
|
98
|
+
}
|
|
79
99
|
}),
|
|
80
|
-
|
|
81
|
-
when
|
|
82
|
-
|
|
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
|
+
}
|
|
83
107
|
}),
|
|
84
|
-
|
|
85
|
-
when
|
|
86
|
-
|
|
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
|
+
}
|
|
87
115
|
}),
|
|
88
|
-
|
|
116
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, {
|
|
89
117
|
variant: "markdown",
|
|
90
|
-
children
|
|
118
|
+
get children() {
|
|
119
|
+
return `Generated by ${(0, _stryke_string_format_title_case.titleCase)(context?.config?.framework) || "Powerlines"}`;
|
|
120
|
+
}
|
|
91
121
|
}),
|
|
92
|
-
|
|
93
|
-
|
|
122
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
123
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_single_line_comment.SingleLineComment, {
|
|
94
124
|
variant: "markdown",
|
|
95
|
-
children
|
|
125
|
+
get children() {
|
|
126
|
+
return (0, powerlines_utils.getFileHeaderWarning)(context);
|
|
127
|
+
}
|
|
96
128
|
}),
|
|
97
|
-
|
|
98
|
-
]
|
|
129
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
130
|
+
];
|
|
99
131
|
}
|
|
100
132
|
|
|
101
133
|
//#endregion
|
|
@@ -2,8 +2,8 @@ import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
|
|
|
2
2
|
import { SourceFile } from "../../core/components/source-file.mjs";
|
|
3
3
|
import { SingleLineComment } from "../../core/components/single-line-comment.mjs";
|
|
4
4
|
import { FrontMatter } from "./front-matter.mjs";
|
|
5
|
+
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
6
|
import { Show, splitProps } from "@alloy-js/core";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "@alloy-js/core/jsx-runtime";
|
|
7
7
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
8
8
|
import { getFileHeaderWarning } from "powerlines/utils";
|
|
9
9
|
import { Link } from "@alloy-js/markdown";
|
|
@@ -22,17 +22,21 @@ function MarkdownFile(props) {
|
|
|
22
22
|
"storage",
|
|
23
23
|
"frontMatter"
|
|
24
24
|
]);
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
return createComponent(SourceFile, mergeProps({ get header() {
|
|
26
|
+
return createComponent(MarkdownFileHeader, { frontMatter });
|
|
27
|
+
} }, rest, {
|
|
28
28
|
filetype: "md",
|
|
29
29
|
reference: Link,
|
|
30
30
|
storage,
|
|
31
|
-
children
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
get children() {
|
|
32
|
+
return createComponent(Show, {
|
|
33
|
+
get when() {
|
|
34
|
+
return Boolean(children);
|
|
35
|
+
},
|
|
36
|
+
children
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
42
|
* Renders the header for a Powerlines Typescript source file.
|
|
@@ -49,51 +53,79 @@ function MarkdownFileHeader(props) {
|
|
|
49
53
|
"frontMatter"
|
|
50
54
|
]);
|
|
51
55
|
const context = usePowerlinesSafe();
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
when
|
|
55
|
-
|
|
56
|
+
return [
|
|
57
|
+
createComponent(Show, {
|
|
58
|
+
get when() {
|
|
59
|
+
return memo(() => !!isSetObject(frontMatter))() && Object.keys(frontMatter).length > 0;
|
|
60
|
+
},
|
|
61
|
+
get children() {
|
|
62
|
+
return createComponent(FrontMatter, { data: frontMatter });
|
|
63
|
+
}
|
|
56
64
|
}),
|
|
57
|
-
|
|
58
|
-
when
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
createComponent(Show, {
|
|
66
|
+
get when() {
|
|
67
|
+
return Boolean(disableEslint);
|
|
68
|
+
},
|
|
69
|
+
get children() {
|
|
70
|
+
return [createComponent(SingleLineComment, {
|
|
71
|
+
variant: "markdown",
|
|
72
|
+
children: "eslint-disable"
|
|
73
|
+
}), createIntrinsic("hbr", {})];
|
|
74
|
+
}
|
|
63
75
|
}),
|
|
64
|
-
|
|
65
|
-
when
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
createComponent(Show, {
|
|
77
|
+
get when() {
|
|
78
|
+
return Boolean(disablePrettier);
|
|
79
|
+
},
|
|
80
|
+
get children() {
|
|
81
|
+
return [createComponent(SingleLineComment, {
|
|
82
|
+
variant: "markdown",
|
|
83
|
+
children: "prettier-ignore"
|
|
84
|
+
}), createIntrinsic("hbr", {})];
|
|
85
|
+
}
|
|
70
86
|
}),
|
|
71
|
-
|
|
72
|
-
when
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
createComponent(Show, {
|
|
88
|
+
get when() {
|
|
89
|
+
return Boolean(disableBiome);
|
|
90
|
+
},
|
|
91
|
+
get children() {
|
|
92
|
+
return [createComponent(SingleLineComment, {
|
|
93
|
+
variant: "markdown",
|
|
94
|
+
children: "biome-ignore lint: disable"
|
|
95
|
+
}), createIntrinsic("hbr", {})];
|
|
96
|
+
}
|
|
77
97
|
}),
|
|
78
|
-
|
|
79
|
-
when
|
|
80
|
-
|
|
98
|
+
createComponent(Show, {
|
|
99
|
+
get when() {
|
|
100
|
+
return Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome);
|
|
101
|
+
},
|
|
102
|
+
get children() {
|
|
103
|
+
return createIntrinsic("hbr", {});
|
|
104
|
+
}
|
|
81
105
|
}),
|
|
82
|
-
|
|
83
|
-
when
|
|
84
|
-
|
|
106
|
+
createComponent(Show, {
|
|
107
|
+
get when() {
|
|
108
|
+
return Boolean(children);
|
|
109
|
+
},
|
|
110
|
+
get children() {
|
|
111
|
+
return [children, createIntrinsic("hbr", {})];
|
|
112
|
+
}
|
|
85
113
|
}),
|
|
86
|
-
|
|
114
|
+
createComponent(SingleLineComment, {
|
|
87
115
|
variant: "markdown",
|
|
88
|
-
children
|
|
116
|
+
get children() {
|
|
117
|
+
return `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}`;
|
|
118
|
+
}
|
|
89
119
|
}),
|
|
90
|
-
|
|
91
|
-
|
|
120
|
+
createIntrinsic("hbr", {}),
|
|
121
|
+
createComponent(SingleLineComment, {
|
|
92
122
|
variant: "markdown",
|
|
93
|
-
children
|
|
123
|
+
get children() {
|
|
124
|
+
return getFileHeaderWarning(context);
|
|
125
|
+
}
|
|
94
126
|
}),
|
|
95
|
-
|
|
96
|
-
]
|
|
127
|
+
createIntrinsic("hbr", {})
|
|
128
|
+
];
|
|
97
129
|
}
|
|
98
130
|
|
|
99
131
|
//#endregion
|