@powerlines/plugin-alloy 0.18.15 → 0.18.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/core/components/output.d.cts +2 -2
  2. package/dist/core/components/output.d.mts +2 -2
  3. package/dist/core/components/single-line-comment.d.cts +2 -2
  4. package/dist/core/components/single-line-comment.d.mts +2 -2
  5. package/dist/core/components/source-file.d.cts +2 -2
  6. package/dist/helpers/capnp.cjs +11 -11
  7. package/dist/helpers/capnp.mjs +7 -7
  8. package/dist/helpers/typescript.cjs +3 -3
  9. package/dist/helpers/typescript.mjs +2 -2
  10. package/dist/index.cjs +12 -16
  11. package/dist/index.mjs +12 -16
  12. package/dist/markdown/components/markdown-file.d.cts +3 -3
  13. package/dist/markdown/components/markdown-file.d.mts +3 -3
  14. package/dist/markdown/components/markdown-table.cjs +1 -1
  15. package/dist/markdown/components/markdown-table.d.cts +4 -4
  16. package/dist/markdown/components/markdown-table.d.mts +4 -4
  17. package/dist/markdown/components/markdown-table.mjs +1 -1
  18. package/dist/powerlines/src/types/context.d.cts +4 -0
  19. package/dist/powerlines/src/types/context.d.mts +4 -0
  20. package/dist/typescript/components/builtin-file.d.mts +2 -2
  21. package/dist/typescript/components/dynamic-import-statement.d.cts +2 -2
  22. package/dist/typescript/components/entry-file.cjs +1 -1
  23. package/dist/typescript/components/entry-file.d.mts +2 -2
  24. package/dist/typescript/components/entry-file.mjs +1 -1
  25. package/dist/typescript/components/tsdoc-reflection.cjs +2 -2
  26. package/dist/typescript/components/tsdoc-reflection.d.cts +4 -4
  27. package/dist/typescript/components/tsdoc-reflection.mjs +2 -2
  28. package/dist/typescript/components/tsdoc.cjs +2 -2
  29. package/dist/typescript/components/tsdoc.mjs +1 -1
  30. package/dist/typescript/components/typescript-file.cjs +1 -1
  31. package/dist/typescript/components/typescript-file.mjs +1 -1
  32. package/dist/typescript/components/typescript-interface.cjs +1 -1
  33. package/dist/typescript/components/typescript-interface.d.cts +3 -3
  34. package/dist/typescript/components/typescript-interface.d.mts +3 -3
  35. package/dist/typescript/components/typescript-interface.mjs +1 -1
  36. package/dist/typescript/components/typescript-object.cjs +4 -4
  37. package/dist/typescript/components/typescript-object.d.cts +3 -3
  38. package/dist/typescript/components/typescript-object.d.mts +3 -3
  39. package/dist/typescript/components/typescript-object.mjs +3 -3
  40. package/package.json +5 -5
  41. package/dist/deepkit/src/utilities.cjs +0 -113
  42. package/dist/deepkit/src/utilities.mjs +0 -109
  43. package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -13
  44. package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -12
@@ -1,6 +1,6 @@
1
1
  import { PluginContext } from "../../powerlines/src/types/context.cjs";
2
2
  import { MetaItem } from "../contexts/context.cjs";
3
- import * as _alloy_js_core8 from "@alloy-js/core";
3
+ import * as _alloy_js_core1 from "@alloy-js/core";
4
4
  import { OutputProps as OutputProps$1 } from "@alloy-js/core";
5
5
 
6
6
  //#region src/core/components/output.d.ts
@@ -17,7 +17,7 @@ interface OutputProps<TContext extends PluginContext = PluginContext, TMeta exte
17
17
  /**
18
18
  * Output component for rendering the Powerlines plugin's output files via templates.
19
19
  */
20
- declare function Output<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps<TContext, TMeta>): _alloy_js_core8.Children;
20
+ declare function Output<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps<TContext, TMeta>): _alloy_js_core1.Children;
21
21
  declare type __ΩOutputProps = any[];
22
22
  //#endregion
23
23
  export { Output, OutputProps, __ΩOutputProps };
@@ -1,6 +1,6 @@
1
1
  import { PluginContext } from "../../powerlines/src/types/context.mjs";
2
2
  import { MetaItem } from "../contexts/context.mjs";
3
- import * as _alloy_js_core1 from "@alloy-js/core";
3
+ import * as _alloy_js_core0 from "@alloy-js/core";
4
4
  import { OutputProps as OutputProps$1 } from "@alloy-js/core";
5
5
 
6
6
  //#region src/core/components/output.d.ts
@@ -17,7 +17,7 @@ interface OutputProps<TContext extends PluginContext = PluginContext, TMeta exte
17
17
  /**
18
18
  * Output component for rendering the Powerlines plugin's output files via templates.
19
19
  */
20
- declare function Output<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps<TContext, TMeta>): _alloy_js_core1.Children;
20
+ declare function Output<TContext extends PluginContext = PluginContext, TMeta extends Record<string, MetaItem> = Record<string, MetaItem>>(props: OutputProps<TContext, TMeta>): _alloy_js_core0.Children;
21
21
  declare type __ΩOutputProps = any[];
22
22
  //#endregion
23
23
  export { Output, OutputProps, __ΩOutputProps };
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps } from "../../types/components.cjs";
2
- import * as _alloy_js_core5 from "@alloy-js/core";
2
+ import * as _alloy_js_core0 from "@alloy-js/core";
3
3
 
4
4
  //#region src/core/components/single-line-comment.d.ts
5
5
  type SingleLineCommentVariant = "double-slash" | "triple-slash" | "slash-star" | "slash-star-star" | "markdown";
@@ -15,7 +15,7 @@ interface SingleLineCommentProps extends ComponentProps {
15
15
  * A single line comment block. The children are rendered as a prose element, which means that they
16
16
  * are broken into multiple lines
17
17
  */
18
- declare function SingleLineComment(props: SingleLineCommentProps): _alloy_js_core5.Children;
18
+ declare function SingleLineComment(props: SingleLineCommentProps): _alloy_js_core0.Children;
19
19
  declare type __ΩSingleLineCommentVariant = any[];
20
20
  declare type __ΩSingleLineCommentProps = any[];
21
21
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps } from "../../types/components.mjs";
2
- import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import * as _alloy_js_core6 from "@alloy-js/core";
3
3
 
4
4
  //#region src/core/components/single-line-comment.d.ts
5
5
  type SingleLineCommentVariant = "double-slash" | "triple-slash" | "slash-star" | "slash-star-star" | "markdown";
@@ -15,7 +15,7 @@ interface SingleLineCommentProps extends ComponentProps {
15
15
  * A single line comment block. The children are rendered as a prose element, which means that they
16
16
  * are broken into multiple lines
17
17
  */
18
- declare function SingleLineComment(props: SingleLineCommentProps): _alloy_js_core0.Children;
18
+ declare function SingleLineComment(props: SingleLineCommentProps): _alloy_js_core6.Children;
19
19
  declare type __ΩSingleLineCommentVariant = any[];
20
20
  declare type __ΩSingleLineCommentProps = any[];
21
21
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { StoragePreset } from "../../powerlines/src/types/fs.cjs";
2
2
  import { ComponentProps } from "../../types/components.cjs";
3
- import * as _alloy_js_core2 from "@alloy-js/core";
3
+ import * as _alloy_js_core0 from "@alloy-js/core";
4
4
  import { SourceFileProps as SourceFileProps$1 } from "@alloy-js/core";
5
5
 
6
6
  //#region src/core/components/source-file.d.ts
@@ -26,7 +26,7 @@ type SourceFileProps = SourceFileProps$1 & ComponentProps & {
26
26
  * @param props - The properties for the source file.
27
27
  * @returns The rendered source file component.
28
28
  */
29
- declare function SourceFile(props: SourceFileProps): _alloy_js_core2.Children;
29
+ declare function SourceFile(props: SourceFileProps): _alloy_js_core0.Children;
30
30
  declare type __ΩSourceFileProps = any[];
31
31
  //#endregion
32
32
  export { SourceFile, SourceFileProps, __ΩSourceFileProps };
@@ -1,28 +1,28 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const require_utilities = require('../deepkit/src/utilities.cjs');
3
- const require_file_header = require('../powerlines/src/lib/utilities/file-header.cjs');
4
2
  let defu = require("defu");
5
3
  defu = require_rolldown_runtime.__toESM(defu);
6
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
7
- let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
8
- let __stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
9
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
10
- let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
4
+ let __powerlines_deepkit_utilities = require("@powerlines/deepkit/utilities");
11
5
  let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
12
6
  let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
7
+ let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
13
8
  let __powerlines_deepkit_vendor_core = require("@powerlines/deepkit/vendor/core");
9
+ let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
14
10
  let __stryke_capnp_compile = require("@stryke/capnp/compile");
15
11
  let __stryke_capnp_helpers = require("@stryke/capnp/helpers");
16
12
  let __stryke_convert_to_array = require("@stryke/convert/to-array");
13
+ let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
17
14
  let __stryke_json = require("@stryke/json");
18
15
  let __stryke_path_join = require("@stryke/path/join");
19
16
  let __stryke_string_format_get_words = require("@stryke/string-format/get-words");
20
17
  let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
21
18
  let __stryke_type_checks_is_bigint = require("@stryke/type-checks/is-bigint");
19
+ let __stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
22
20
  let __stryke_type_checks_is_number = require("@stryke/type-checks/is-number");
21
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
23
22
  let node_buffer = require("node:buffer");
24
23
  let node_child_process = require("node:child_process");
25
24
  let node_util = require("node:util");
25
+ let powerlines_lib_utilities_file_header = require("powerlines/lib/utilities/file-header");
26
26
 
27
27
  //#region src/helpers/capnp.ts
28
28
  /**
@@ -95,7 +95,7 @@ function isVoidType(type) {
95
95
  * @returns A string representation of the Cap'n Proto primitive type.
96
96
  */
97
97
  function getCapnpUnionTypes(type) {
98
- return require_utilities.getUnionTypes(type);
98
+ return (0, __powerlines_deepkit_utilities.getUnionTypes)(type);
99
99
  }
100
100
  /**
101
101
  * Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.
@@ -118,7 +118,7 @@ async function generateCapnpId() {
118
118
  }
119
119
  async function generateCapnp(context, reflection, options) {
120
120
  return `${(await generateCapnpId()).trim()};
121
- ${require_file_header.getBaseFileHeader(context).replace(/^\r*\n*/g, "").replaceAll("//", "#")}
121
+ ${(0, powerlines_lib_utilities_file_header.getBaseFileHeader)(context).replace(/^\r*\n*/g, "").replaceAll("//", "#")}
122
122
  ${reflection.getMethods().length === 0 ? generateCapnpStruct(reflection, options) : generateCapnpInterface(reflection, options)}
123
123
  `.trim();
124
124
  }
@@ -187,7 +187,7 @@ function generateCapnpMethodSchema(reflection, indexCounter) {
187
187
  if (!methodName) throw new Error(`Cannot generate Cap'n Proto schema for method without a name - Parent interface: ${reflection.reflectionClass.getName()}`);
188
188
  return `${(0, __stryke_string_format_camel_case.camelCase)(methodName)} @${indexCounter()} (${reflection.getParameters().map((param) => {
189
189
  return `${(0, __stryke_string_format_camel_case.camelCase)(param.getName())} :${generateCapnpPrimitive(param.getType())}${param.hasDefault() ? ` = ${stringifyCapnpDefaultValue(param)}` : ""}`;
190
- }).join(", ")})${isVoidType(reflection.getReturnType()) ? "" : ` -> (${require_utilities.kindToName(reflection.getReturnType().kind)}: ${generateCapnpPrimitive(reflection.getReturnType())})`}; # ${(reflection.getDescription() || `The ${(0, __stryke_string_format_title_case.titleCase)(reflection.reflectionClass.getTitle() || reflection.reflectionClass.getName())} interface ${(0, __stryke_string_format_title_case.titleCase)(methodName)} method.`).replaceAll("\n", ". ")}`;
190
+ }).join(", ")})${isVoidType(reflection.getReturnType()) ? "" : ` -> (${(0, __powerlines_deepkit_utilities.kindToName)(reflection.getReturnType().kind)}: ${generateCapnpPrimitive(reflection.getReturnType())})`}; # ${(reflection.getDescription() || `The ${(0, __stryke_string_format_title_case.titleCase)(reflection.reflectionClass.getTitle() || reflection.reflectionClass.getName())} interface ${(0, __stryke_string_format_title_case.titleCase)(methodName)} method.`).replaceAll("\n", ". ")}`;
191
191
  }
192
192
  function generateCapnpPropertyComment(reflection) {
193
193
  const result = (0, __stryke_string_format_get_words.getWords)(reflection.getDescription() || `A schema property for ${(0, __stryke_string_format_title_case.titleCase)(reflection.getTitle() || reflection.getNameAsString())} field.`, { relaxed: true }).reduce((ret, word) => {
@@ -207,7 +207,7 @@ ${generateCapnpPropertyComment(reflection)}`;
207
207
  else if (getCapnpUnionTypes(reflection.type).filter((type) => type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.literal && ((0, __stryke_type_checks_is_string.isString)(type.literal) || (0, __stryke_type_checks_is_number.isNumber)(type.literal))).length === 1) return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :${formatEnumName(reflection.getNameAsString())}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
208
208
  ${generateCapnpPropertyComment(reflection)}`;
209
209
  else return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} :union {
210
- ${getCapnpUnionTypes(reflection.type).map((type) => ` ${require_utilities.kindToName(type.kind)} @${indexCounter()} :${generateCapnpPrimitive(type)};`).join("\n")}
210
+ ${getCapnpUnionTypes(reflection.type).map((type) => ` ${(0, __powerlines_deepkit_utilities.kindToName)(type.kind)} @${indexCounter()} :${generateCapnpPrimitive(type)};`).join("\n")}
211
211
  }
212
212
  ${generateCapnpPropertyComment(reflection)}`;
213
213
  else if (reflection.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.array) return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :List(${generateCapnpPrimitive(reflection.getSubType())})${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
@@ -1,26 +1,26 @@
1
- import { getUnionTypes, kindToName } from "../deepkit/src/utilities.mjs";
2
- import { getBaseFileHeader } from "../powerlines/src/lib/utilities/file-header.mjs";
3
1
  import defu from "defu";
4
- import { ReflectionKind, memberNameToString } from "@powerlines/deepkit/vendor/type";
5
- import { getUniqueBy } from "@stryke/helpers/get-unique";
6
- import { isNull } from "@stryke/type-checks/is-null";
7
- import { isString } from "@stryke/type-checks/is-string";
8
- import { isUndefined } from "@stryke/type-checks/is-undefined";
2
+ import { getUnionTypes, kindToName } from "@powerlines/deepkit/utilities";
9
3
  import { camelCase } from "@stryke/string-format/camel-case";
10
4
  import { titleCase } from "@stryke/string-format/title-case";
5
+ import { isUndefined } from "@stryke/type-checks/is-undefined";
11
6
  import { getClassName } from "@powerlines/deepkit/vendor/core";
7
+ import { ReflectionKind, memberNameToString } from "@powerlines/deepkit/vendor/type";
12
8
  import { capnpc } from "@stryke/capnp/compile";
13
9
  import { resolveOptions } from "@stryke/capnp/helpers";
14
10
  import { toArray } from "@stryke/convert/to-array";
11
+ import { getUniqueBy } from "@stryke/helpers/get-unique";
15
12
  import { StormJSON } from "@stryke/json";
16
13
  import { joinPaths } from "@stryke/path/join";
17
14
  import { getWords } from "@stryke/string-format/get-words";
18
15
  import { pascalCase } from "@stryke/string-format/pascal-case";
19
16
  import { isBigInt } from "@stryke/type-checks/is-bigint";
17
+ import { isNull } from "@stryke/type-checks/is-null";
20
18
  import { isNumber } from "@stryke/type-checks/is-number";
19
+ import { isString } from "@stryke/type-checks/is-string";
21
20
  import { Buffer } from "node:buffer";
22
21
  import { exec } from "node:child_process";
23
22
  import { promisify } from "node:util";
23
+ import { getBaseFileHeader } from "powerlines/lib/utilities/file-header";
24
24
 
25
25
  //#region src/helpers/capnp.ts
26
26
  /**
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- const require_utilities = require('../deepkit/src/utilities.cjs');
3
- let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
2
+ let __powerlines_deepkit_utilities = require("@powerlines/deepkit/utilities");
4
3
  let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
5
4
  let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
5
+ let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
6
6
 
7
7
  //#region src/helpers/typescript.ts
8
8
  /**
@@ -34,7 +34,7 @@ export const ${(0, __stryke_string_format_camel_case.camelCase)(options.override
34
34
  * @ignored` : ""}${item.isHidden() ? `
35
35
  * @hidden` : ""}
36
36
  */
37
- ${item.getNameAsString()}: ${require_utilities.stringifyValue(item.getType(), options.defaultValues?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
37
+ ${item.getNameAsString()}: ${(0, __powerlines_deepkit_utilities.stringifyValue)(item.getType(), options.defaultValues?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
38
38
  if ((0, __stryke_type_checks_is_undefined.isUndefined)(ret) && !(0, __stryke_type_checks_is_undefined.isUndefined)(options.defaultValues?.[alias])) return options.defaultValues?.[alias];
39
39
  return ret;
40
40
  }, void 0) ?? item.getDefaultValue())}`).join(", \n")}
@@ -1,7 +1,7 @@
1
- import { stringifyValue } from "../deepkit/src/utilities.mjs";
2
- import { isUndefined } from "@stryke/type-checks/is-undefined";
1
+ import { stringifyValue } from "@powerlines/deepkit/utilities";
3
2
  import { camelCase } from "@stryke/string-format/camel-case";
4
3
  import { titleCase } from "@stryke/string-format/title-case";
4
+ import { isUndefined } from "@stryke/type-checks/is-undefined";
5
5
 
6
6
  //#region src/helpers/typescript.ts
7
7
  /**
package/dist/index.cjs CHANGED
@@ -6,6 +6,7 @@ let __alloy_js_core = require("@alloy-js/core");
6
6
  let __alloy_js_rollup_plugin = require("@alloy-js/rollup-plugin");
7
7
  __alloy_js_rollup_plugin = require_rolldown_runtime.__toESM(__alloy_js_rollup_plugin);
8
8
  let __stryke_json_storm_json = require("@stryke/json/storm-json");
9
+ let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
9
10
 
10
11
  //#region src/index.tsx
11
12
  /**
@@ -24,18 +25,12 @@ const plugin = (options = {}) => {
24
25
  ...options
25
26
  },
26
27
  build: {
27
- inputOptions: { transform: {
28
- typescript: {
29
- jsxPragma: "Alloy.createElement",
30
- jsxPragmaFrag: "Alloy.Fragment"
31
- },
32
- jsx: {
33
- runtime: "classic",
34
- pragma: "Alloy.createElement",
35
- pragmaFrag: "Alloy.Fragment",
36
- importSource: "@alloy-js/core"
37
- }
38
- } },
28
+ inputOptions: { transform: { jsx: {
29
+ runtime: "classic",
30
+ pragma: "Alloy.createElement",
31
+ pragmaFrag: "Alloy.Fragment",
32
+ importSource: "@alloy-js/core"
33
+ } } },
39
34
  plugins: [(0, __alloy_js_rollup_plugin.default)()],
40
35
  external: [
41
36
  "@alloy-js/core",
@@ -53,7 +48,6 @@ const plugin = (options = {}) => {
53
48
  if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
54
49
  await this.fs.write(this.tsconfig.tsconfigFilePath, __stryke_json_storm_json.StormJSON.stringify(this.tsconfig.tsconfigJson));
55
50
  }
56
- this.dependencies["@alloy-js/core"] = "^0.22.0";
57
51
  if (this.config.alloy?.typescript !== false) this.dependencies["@alloy-js/typescript"] = "^0.22.0";
58
52
  if (this.config.alloy?.json === true) this.dependencies["@alloy-js/json"] = "^0.22.0";
59
53
  if (this.config.alloy?.markdown === true) this.dependencies["@alloy-js/markdown"] = "^0.22.0";
@@ -63,7 +57,7 @@ const plugin = (options = {}) => {
63
57
  configResolved: {
64
58
  order: "pre",
65
59
  async handler() {
66
- this.render = async (children) => {
60
+ async function render(children) {
67
61
  const _self$ = this;
68
62
  const meta = {};
69
63
  await (0, __alloy_js_core.traverseOutput)(await (0, __alloy_js_core.renderAsync)((0, __alloy_js_core_jsx_runtime.createComponent)(require_core_components_output.Output, {
@@ -85,7 +79,8 @@ const plugin = (options = {}) => {
85
79
  if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
86
80
  this.emitBuiltinSync(file.contents, metadata.id, {
87
81
  skipFormat: metadata.skipFormat,
88
- storage: metadata.storage
82
+ storage: metadata.storage,
83
+ extension: (0, __stryke_path_file_path_fns.findFileExtension)(file.path)
89
84
  });
90
85
  } else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
91
86
  skipFormat: metadata.skipFormat,
@@ -96,7 +91,8 @@ const plugin = (options = {}) => {
96
91
  } else this.fs.copySync(file.sourcePath, file.path);
97
92
  }
98
93
  });
99
- };
94
+ }
95
+ this.render = render.bind(this);
100
96
  }
101
97
  }
102
98
  }];
package/dist/index.mjs CHANGED
@@ -3,6 +3,7 @@ import { createComponent } from "@alloy-js/core/jsx-runtime";
3
3
  import { renderAsync, traverseOutput } from "@alloy-js/core";
4
4
  import alloy from "@alloy-js/rollup-plugin";
5
5
  import { StormJSON } from "@stryke/json/storm-json";
6
+ import { findFileExtension } from "@stryke/path/file-path-fns";
6
7
 
7
8
  //#region src/index.tsx
8
9
  /**
@@ -21,18 +22,12 @@ const plugin = (options = {}) => {
21
22
  ...options
22
23
  },
23
24
  build: {
24
- inputOptions: { transform: {
25
- typescript: {
26
- jsxPragma: "Alloy.createElement",
27
- jsxPragmaFrag: "Alloy.Fragment"
28
- },
29
- jsx: {
30
- runtime: "classic",
31
- pragma: "Alloy.createElement",
32
- pragmaFrag: "Alloy.Fragment",
33
- importSource: "@alloy-js/core"
34
- }
35
- } },
25
+ inputOptions: { transform: { jsx: {
26
+ runtime: "classic",
27
+ pragma: "Alloy.createElement",
28
+ pragmaFrag: "Alloy.Fragment",
29
+ importSource: "@alloy-js/core"
30
+ } } },
36
31
  plugins: [alloy()],
37
32
  external: [
38
33
  "@alloy-js/core",
@@ -50,7 +45,6 @@ const plugin = (options = {}) => {
50
45
  if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
51
46
  await this.fs.write(this.tsconfig.tsconfigFilePath, StormJSON.stringify(this.tsconfig.tsconfigJson));
52
47
  }
53
- this.dependencies["@alloy-js/core"] = "^0.22.0";
54
48
  if (this.config.alloy?.typescript !== false) this.dependencies["@alloy-js/typescript"] = "^0.22.0";
55
49
  if (this.config.alloy?.json === true) this.dependencies["@alloy-js/json"] = "^0.22.0";
56
50
  if (this.config.alloy?.markdown === true) this.dependencies["@alloy-js/markdown"] = "^0.22.0";
@@ -60,7 +54,7 @@ const plugin = (options = {}) => {
60
54
  configResolved: {
61
55
  order: "pre",
62
56
  async handler() {
63
- this.render = async (children) => {
57
+ async function render(children) {
64
58
  const _self$ = this;
65
59
  const meta = {};
66
60
  await traverseOutput(await renderAsync(createComponent(Output$1, {
@@ -82,7 +76,8 @@ const plugin = (options = {}) => {
82
76
  if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
83
77
  this.emitBuiltinSync(file.contents, metadata.id, {
84
78
  skipFormat: metadata.skipFormat,
85
- storage: metadata.storage
79
+ storage: metadata.storage,
80
+ extension: findFileExtension(file.path)
86
81
  });
87
82
  } else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
88
83
  skipFormat: metadata.skipFormat,
@@ -93,7 +88,8 @@ const plugin = (options = {}) => {
93
88
  } else this.fs.copySync(file.sourcePath, file.path);
94
89
  }
95
90
  });
96
- };
91
+ }
92
+ this.render = render.bind(this);
97
93
  }
98
94
  }
99
95
  }];
@@ -1,6 +1,6 @@
1
1
  import { ComponentProps, SourceFileHeaderProps } from "../../types/components.cjs";
2
2
  import { SourceFileProps as SourceFileProps$1 } from "../../core/components/source-file.cjs";
3
- import * as _alloy_js_core13 from "@alloy-js/core";
3
+ import * as _alloy_js_core7 from "@alloy-js/core";
4
4
 
5
5
  //#region src/markdown/components/markdown-file.d.ts
6
6
  type MarkdownFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps;
@@ -10,14 +10,14 @@ type MarkdownFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps;
10
10
  * @param props - The properties for the source file.
11
11
  * @returns The rendered source file component.
12
12
  */
13
- declare function MarkdownFile(props: MarkdownFileProps): _alloy_js_core13.Children;
13
+ declare function MarkdownFile(props: MarkdownFileProps): _alloy_js_core7.Children;
14
14
  /**
15
15
  * Renders the header for a Powerlines Typescript source file.
16
16
  *
17
17
  * @param props - The properties for the source file header.
18
18
  * @returns The rendered source file header.
19
19
  */
20
- declare function MarkdownFileHeader(props: SourceFileHeaderProps): _alloy_js_core13.Children;
20
+ declare function MarkdownFileHeader(props: SourceFileHeaderProps): _alloy_js_core7.Children;
21
21
  declare type __ΩMarkdownFileProps = any[];
22
22
  //#endregion
23
23
  export { MarkdownFile, MarkdownFileHeader, MarkdownFileProps, __ΩMarkdownFileProps };
@@ -1,6 +1,6 @@
1
1
  import { ComponentProps, SourceFileHeaderProps } from "../../types/components.mjs";
2
2
  import { SourceFileProps as SourceFileProps$1 } from "../../core/components/source-file.mjs";
3
- import * as _alloy_js_core5 from "@alloy-js/core";
3
+ import * as _alloy_js_core1 from "@alloy-js/core";
4
4
 
5
5
  //#region src/markdown/components/markdown-file.d.ts
6
6
  type MarkdownFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps;
@@ -10,14 +10,14 @@ type MarkdownFileProps = Omit<SourceFileProps$1, "filetype"> & ComponentProps;
10
10
  * @param props - The properties for the source file.
11
11
  * @returns The rendered source file component.
12
12
  */
13
- declare function MarkdownFile(props: MarkdownFileProps): _alloy_js_core5.Children;
13
+ declare function MarkdownFile(props: MarkdownFileProps): _alloy_js_core1.Children;
14
14
  /**
15
15
  * Renders the header for a Powerlines Typescript source file.
16
16
  *
17
17
  * @param props - The properties for the source file header.
18
18
  * @returns The rendered source file header.
19
19
  */
20
- declare function MarkdownFileHeader(props: SourceFileHeaderProps): _alloy_js_core5.Children;
20
+ declare function MarkdownFileHeader(props: SourceFileHeaderProps): _alloy_js_core1.Children;
21
21
  declare type __ΩMarkdownFileProps = any[];
22
22
  //#endregion
23
23
  export { MarkdownFile, MarkdownFileHeader, MarkdownFileProps, __ΩMarkdownFileProps };
@@ -2,8 +2,8 @@ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_markdown_contexts_markdown_table = require('../contexts/markdown-table.cjs');
3
3
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
4
4
  let __alloy_js_core = require("@alloy-js/core");
5
- let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
6
5
  let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
6
+ let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
7
7
 
8
8
  //#region src/markdown/components/markdown-table.tsx
9
9
  /**
@@ -1,6 +1,6 @@
1
1
  import { ComponentProps } from "../../types/components.cjs";
2
2
  import { MarkdownTableColumnContextInterface } from "../contexts/markdown-table.cjs";
3
- import * as _alloy_js_core0 from "@alloy-js/core";
3
+ import * as _alloy_js_core2 from "@alloy-js/core";
4
4
 
5
5
  //#region src/markdown/components/markdown-table.d.ts
6
6
  interface MarkdownTableProps<T extends Record<string, any> = Record<string, any>> extends ComponentProps {
@@ -9,18 +9,18 @@ interface MarkdownTableProps<T extends Record<string, any> = Record<string, any>
9
9
  /**
10
10
  * Component that provides a context for rendering markdown tables.
11
11
  */
12
- declare function MarkdownTable<T extends Record<string, any> = Record<string, any>>(props: MarkdownTableProps<T>): _alloy_js_core0.Children;
12
+ declare function MarkdownTable<T extends Record<string, any> = Record<string, any>>(props: MarkdownTableProps<T>): _alloy_js_core2.Children;
13
13
  type MarkdownTableColumnProps = ComponentProps & Partial<Pick<MarkdownTableColumnContextInterface, "align">> & Required<Pick<MarkdownTableColumnContextInterface, "name">> & {
14
14
  width?: number;
15
15
  };
16
16
  /**
17
17
  * Component that provides a context for rendering markdown tables.
18
18
  */
19
- declare function MarkdownTableColumn(props: MarkdownTableColumnProps): _alloy_js_core0.Children;
19
+ declare function MarkdownTableColumn(props: MarkdownTableColumnProps): _alloy_js_core2.Children;
20
20
  /**
21
21
  * Component that provides a context for rendering markdown tables.
22
22
  */
23
- declare function MarkdownTableColumnHeader(props: MarkdownTableColumnProps): _alloy_js_core0.Children;
23
+ declare function MarkdownTableColumnHeader(props: MarkdownTableColumnProps): _alloy_js_core2.Children;
24
24
  declare type __ΩMarkdownTableProps = any[];
25
25
  declare type __ΩMarkdownTableColumnProps = any[];
26
26
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { ComponentProps } from "../../types/components.mjs";
2
2
  import { MarkdownTableColumnContextInterface } from "../contexts/markdown-table.mjs";
3
- import * as _alloy_js_core2 from "@alloy-js/core";
3
+ import * as _alloy_js_core3 from "@alloy-js/core";
4
4
 
5
5
  //#region src/markdown/components/markdown-table.d.ts
6
6
  interface MarkdownTableProps<T extends Record<string, any> = Record<string, any>> extends ComponentProps {
@@ -9,18 +9,18 @@ interface MarkdownTableProps<T extends Record<string, any> = Record<string, any>
9
9
  /**
10
10
  * Component that provides a context for rendering markdown tables.
11
11
  */
12
- declare function MarkdownTable<T extends Record<string, any> = Record<string, any>>(props: MarkdownTableProps<T>): _alloy_js_core2.Children;
12
+ declare function MarkdownTable<T extends Record<string, any> = Record<string, any>>(props: MarkdownTableProps<T>): _alloy_js_core3.Children;
13
13
  type MarkdownTableColumnProps = ComponentProps & Partial<Pick<MarkdownTableColumnContextInterface, "align">> & Required<Pick<MarkdownTableColumnContextInterface, "name">> & {
14
14
  width?: number;
15
15
  };
16
16
  /**
17
17
  * Component that provides a context for rendering markdown tables.
18
18
  */
19
- declare function MarkdownTableColumn(props: MarkdownTableColumnProps): _alloy_js_core2.Children;
19
+ declare function MarkdownTableColumn(props: MarkdownTableColumnProps): _alloy_js_core3.Children;
20
20
  /**
21
21
  * Component that provides a context for rendering markdown tables.
22
22
  */
23
- declare function MarkdownTableColumnHeader(props: MarkdownTableColumnProps): _alloy_js_core2.Children;
23
+ declare function MarkdownTableColumnHeader(props: MarkdownTableColumnProps): _alloy_js_core3.Children;
24
24
  declare type __ΩMarkdownTableProps = any[];
25
25
  declare type __ΩMarkdownTableColumnProps = any[];
26
26
  //#endregion
@@ -1,8 +1,8 @@
1
1
  import { MarkdownTableContext, useMarkdownTable } from "../contexts/markdown-table.mjs";
2
2
  import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
3
3
  import { Prose, Show, code, computed, splitProps } from "@alloy-js/core";
4
- import { isUndefined } from "@stryke/type-checks/is-undefined";
5
4
  import { titleCase } from "@stryke/string-format/title-case";
5
+ import { isUndefined } from "@stryke/type-checks/is-undefined";
6
6
 
7
7
  //#region src/markdown/components/markdown-table.tsx
8
8
  /**
@@ -84,6 +84,10 @@ interface ParseOptions extends ParserOptions {
84
84
  allowReturnOutsideFunction?: boolean;
85
85
  }
86
86
  interface EmitOptions extends WriteOptions {
87
+ /**
88
+ * The file extension to use when emitting the file
89
+ */
90
+ extension?: string;
87
91
  /**
88
92
  * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
89
93
  */
@@ -84,6 +84,10 @@ interface ParseOptions extends ParserOptions {
84
84
  allowReturnOutsideFunction?: boolean;
85
85
  }
86
86
  interface EmitOptions extends WriteOptions {
87
+ /**
88
+ * The file extension to use when emitting the file
89
+ */
90
+ extension?: string;
87
91
  /**
88
92
  * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
89
93
  */
@@ -1,6 +1,6 @@
1
1
  import { TSDocModuleProps } from "./tsdoc.mjs";
2
2
  import { TypescriptFileProps } from "./typescript-file.mjs";
3
- import * as _alloy_js_core15 from "@alloy-js/core";
3
+ import * as _alloy_js_core16 from "@alloy-js/core";
4
4
 
5
5
  //#region src/typescript/components/builtin-file.d.ts
6
6
  type BuiltinFileProps = Omit<TypescriptFileProps, "path"> & Omit<TSDocModuleProps, "name"> & {
@@ -28,7 +28,7 @@ type BuiltinFileProps = Omit<TypescriptFileProps, "path"> & Omit<TSDocModuleProp
28
28
  * @param props - The properties for the source file.
29
29
  * @returns The rendered source file component.
30
30
  */
31
- declare function BuiltinFile(props: BuiltinFileProps): _alloy_js_core15.Children;
31
+ declare function BuiltinFile(props: BuiltinFileProps): _alloy_js_core16.Children;
32
32
  declare type __ΩBuiltinFileProps = any[];
33
33
  //#endregion
34
34
  export { BuiltinFile, BuiltinFileProps, __ΩBuiltinFileProps };
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core12 from "@alloy-js/core";
1
+ import * as _alloy_js_core9 from "@alloy-js/core";
2
2
  import { VarDeclarationProps } from "@alloy-js/typescript";
3
3
 
4
4
  //#region src/typescript/components/dynamic-import-statement.d.ts
@@ -26,7 +26,7 @@ interface DynamicImportStatementProps extends Omit<VarDeclarationProps, "initial
26
26
  * @param props - The properties for the dynamic import statement.
27
27
  * @returns A `VarDeclaration` component representing the dynamic import statement.
28
28
  */
29
- declare function DynamicImportStatement(props: DynamicImportStatementProps): _alloy_js_core12.Children;
29
+ declare function DynamicImportStatement(props: DynamicImportStatementProps): _alloy_js_core9.Children;
30
30
  declare type __ΩDynamicImportStatementProps = any[];
31
31
  //#endregion
32
32
  export { DynamicImportStatement, DynamicImportStatementProps, __ΩDynamicImportStatementProps };
@@ -4,9 +4,9 @@ const require_typescript_components_typescript_file = require('./typescript-file
4
4
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
5
  let __alloy_js_core = require("@alloy-js/core");
6
6
  let __stryke_path_replace = require("@stryke/path/replace");
7
+ let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
7
8
  let defu = require("defu");
8
9
  defu = require_rolldown_runtime.__toESM(defu);
9
- let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
10
10
  let __stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
11
11
 
12
12
  //#region src/typescript/components/entry-file.tsx
@@ -1,6 +1,6 @@
1
1
  import { ResolvedEntryTypeDefinition } from "../../powerlines/src/types/resolved.mjs";
2
2
  import { TypescriptFileProps } from "./typescript-file.mjs";
3
- import * as _alloy_js_core16 from "@alloy-js/core";
3
+ import * as _alloy_js_core15 from "@alloy-js/core";
4
4
 
5
5
  //#region src/typescript/components/entry-file.d.ts
6
6
  type EntryFileProps = TypescriptFileProps & {
@@ -21,7 +21,7 @@ type EntryFileProps = TypescriptFileProps & {
21
21
  * @param props - The properties for the source file.
22
22
  * @returns The rendered source file component.
23
23
  */
24
- declare function EntryFile(props: EntryFileProps): _alloy_js_core16.Children;
24
+ declare function EntryFile(props: EntryFileProps): _alloy_js_core15.Children;
25
25
  declare type __ΩEntryFileProps = any[];
26
26
  //#endregion
27
27
  export { EntryFile, EntryFileProps, __ΩEntryFileProps };
@@ -3,8 +3,8 @@ import { TypescriptFile } from "./typescript-file.mjs";
3
3
  import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
4
4
  import { computed, splitProps } from "@alloy-js/core";
5
5
  import { replaceExtension, replacePath } from "@stryke/path/replace";
6
- import defu from "defu";
7
6
  import { hasFileExtension } from "@stryke/path/file-path-fns";
7
+ import defu from "defu";
8
8
  import { isSet } from "@stryke/type-checks/is-set";
9
9
 
10
10
  //#region src/typescript/components/entry-file.tsx
@@ -3,9 +3,9 @@ const require_core_contexts_reflection = require('../../core/contexts/reflection
3
3
  const require_typescript_components_tsdoc = require('./tsdoc.cjs');
4
4
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
5
  let __alloy_js_core = require("@alloy-js/core");
6
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
7
- let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
8
6
  let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
7
+ let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
8
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
9
9
  let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
10
10
 
11
11
  //#region src/typescript/components/tsdoc-reflection.tsx
@@ -1,18 +1,18 @@
1
1
  import { TSDocProps } from "./tsdoc.cjs";
2
- import * as _alloy_js_core9 from "@alloy-js/core";
2
+ import * as _alloy_js_core10 from "@alloy-js/core";
3
3
 
4
4
  //#region src/typescript/components/tsdoc-reflection.d.ts
5
5
  /**
6
6
  * Generates a TypeScript interface property for the given reflection class.
7
7
  */
8
- declare function TSDocReflectionClass<T extends Record<string, any> = Record<string, any>>(props: TSDocProps): _alloy_js_core9.Children;
8
+ declare function TSDocReflectionClass<T extends Record<string, any> = Record<string, any>>(props: TSDocProps): _alloy_js_core10.Children;
9
9
  /**
10
10
  * Generates a TypeScript interface property for the given reflection class.
11
11
  */
12
- declare function TSDocReflectionProperty(props: TSDocProps): _alloy_js_core9.Children;
12
+ declare function TSDocReflectionProperty(props: TSDocProps): _alloy_js_core10.Children;
13
13
  /**
14
14
  * Generates a TypeScript interface property for the given reflection class.
15
15
  */
16
- declare function TSDocReflectionMethod(props: TSDocProps): _alloy_js_core9.Children;
16
+ declare function TSDocReflectionMethod(props: TSDocProps): _alloy_js_core10.Children;
17
17
  //#endregion
18
18
  export { TSDocReflectionClass, TSDocReflectionMethod, TSDocReflectionProperty };
@@ -2,9 +2,9 @@ import { useReflectionClass, useReflectionMethod, useReflectionProperty } from "
2
2
  import { TSDoc, TSDocAttributesTags } from "./tsdoc.mjs";
3
3
  import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
4
4
  import { List, Show, childrenArray, code, computed, splitProps } from "@alloy-js/core";
5
- import { isString } from "@stryke/type-checks/is-string";
6
- import { isUndefined } from "@stryke/type-checks/is-undefined";
7
5
  import { titleCase } from "@stryke/string-format/title-case";
6
+ import { isUndefined } from "@stryke/type-checks/is-undefined";
7
+ import { isString } from "@stryke/type-checks/is-string";
8
8
  import { isSetString } from "@stryke/type-checks/is-set-string";
9
9
 
10
10
  //#region src/typescript/components/tsdoc-reflection.tsx
@@ -1,8 +1,8 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_core_contexts_context = require('../../core/contexts/context.cjs');
3
- const require_utilities = require('../../deepkit/src/utilities.cjs');
4
3
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
4
  let __alloy_js_core = require("@alloy-js/core");
5
+ let __powerlines_deepkit_utilities = require("@powerlines/deepkit/utilities");
6
6
  let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
7
7
  let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
8
8
 
@@ -157,7 +157,7 @@ function TSDocDefaultValue(props) {
157
157
  width: 2,
158
158
  get children() {
159
159
  return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Prose, { get children() {
160
- return require_utilities.stringifyDefaultValue(props.value);
160
+ return (0, __powerlines_deepkit_utilities.stringifyDefaultValue)(props.value);
161
161
  } });
162
162
  }
163
163
  });
@@ -1,7 +1,7 @@
1
1
  import { usePowerlines } from "../../core/contexts/context.mjs";
2
- import { stringifyDefaultValue } from "../../deepkit/src/utilities.mjs";
3
2
  import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
4
3
  import { For, List, Prose, Show, childrenArray, splitProps } from "@alloy-js/core";
4
+ import { stringifyDefaultValue } from "@powerlines/deepkit/utilities";
5
5
  import { isUndefined } from "@stryke/type-checks/is-undefined";
6
6
  import { isSetString } from "@stryke/type-checks/is-set-string";
7
7
 
@@ -5,8 +5,8 @@ const require_core_components_source_file = require('../../core/components/sourc
5
5
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
6
  let __alloy_js_core = require("@alloy-js/core");
7
7
  let __stryke_path_append = require("@stryke/path/append");
8
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
9
8
  let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
9
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
10
10
  let __alloy_js_typescript = require("@alloy-js/typescript");
11
11
  let __stryke_type_checks_is_boolean = require("@stryke/type-checks/is-boolean");
12
12
 
@@ -4,8 +4,8 @@ import { SourceFile } from "../../core/components/source-file.mjs";
4
4
  import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
5
5
  import { For, Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
6
6
  import { appendPath } from "@stryke/path/append";
7
- import { isString } from "@stryke/type-checks/is-string";
8
7
  import { titleCase } from "@stryke/string-format/title-case";
8
+ import { isString } from "@stryke/type-checks/is-string";
9
9
  import { ImportStatements, PackageContext, SourceFileContext as SourceFileContext$1, TSModuleScope, getSourceDirectoryData, useSourceFile } from "@alloy-js/typescript";
10
10
  import { isBoolean } from "@stryke/type-checks/is-boolean";
11
11
 
@@ -4,8 +4,8 @@ const require_typescript_components_tsdoc_reflection = require('./tsdoc-reflecti
4
4
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
5
  let __alloy_js_core = require("@alloy-js/core");
6
6
  let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
7
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
8
7
  let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
8
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
9
9
  let __alloy_js_typescript = require("@alloy-js/typescript");
10
10
 
11
11
  //#region src/typescript/components/typescript-interface.tsx
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps } from "../../types/components.cjs";
2
- import * as _alloy_js_core6 from "@alloy-js/core";
2
+ import * as _alloy_js_core5 from "@alloy-js/core";
3
3
  import { InterfaceDeclarationProps, InterfaceMemberProps } from "@alloy-js/typescript";
4
4
  import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
5
5
 
@@ -14,11 +14,11 @@ interface TypescriptInterfacePropertyProps extends Omit<InterfaceMemberProps, "n
14
14
  /**
15
15
  * Generates a TypeScript interface for the given reflection class.
16
16
  */
17
- declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core6.Children;
17
+ declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core5.Children;
18
18
  /**
19
19
  * Generates a TypeScript interface property for the given reflection class.
20
20
  */
21
- declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core6.Children;
21
+ declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core5.Children;
22
22
  declare type __ΩTypeScriptInterfaceProps = any[];
23
23
  declare type __ΩTypescriptInterfacePropertyProps = any[];
24
24
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps } from "../../types/components.mjs";
2
- import * as _alloy_js_core7 from "@alloy-js/core";
2
+ import * as _alloy_js_core9 from "@alloy-js/core";
3
3
  import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
4
4
  import { InterfaceDeclarationProps, InterfaceMemberProps } from "@alloy-js/typescript";
5
5
 
@@ -14,11 +14,11 @@ interface TypescriptInterfacePropertyProps extends Omit<InterfaceMemberProps, "n
14
14
  /**
15
15
  * Generates a TypeScript interface for the given reflection class.
16
16
  */
17
- declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core7.Children;
17
+ declare function TypeScriptInterface<T extends Record<string, any> = Record<string, any>>(props: TypeScriptInterfaceProps<T>): _alloy_js_core9.Children;
18
18
  /**
19
19
  * Generates a TypeScript interface property for the given reflection class.
20
20
  */
21
- declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core7.Children;
21
+ declare function TypescriptInterfaceProperty(props: TypescriptInterfacePropertyProps): _alloy_js_core9.Children;
22
22
  declare type __ΩTypeScriptInterfaceProps = any[];
23
23
  declare type __ΩTypescriptInterfacePropertyProps = any[];
24
24
  //#endregion
@@ -3,8 +3,8 @@ import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflectio
3
3
  import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
4
4
  import { For, computed, splitProps } from "@alloy-js/core";
5
5
  import { stringifyType } from "@powerlines/deepkit/vendor/type";
6
- import { isString } from "@stryke/type-checks/is-string";
7
6
  import { pascalCase } from "@stryke/string-format/pascal-case";
7
+ import { isString } from "@stryke/type-checks/is-string";
8
8
  import { InterfaceDeclaration, InterfaceMember } from "@alloy-js/typescript";
9
9
 
10
10
  //#region src/typescript/components/typescript-interface.tsx
@@ -1,13 +1,13 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_core_contexts_reflection = require('../../core/contexts/reflection.cjs');
3
- const require_utilities = require('../../deepkit/src/utilities.cjs');
4
3
  const require_typescript_components_tsdoc_reflection = require('./tsdoc-reflection.cjs');
5
4
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
5
  let __alloy_js_core = require("@alloy-js/core");
7
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
8
- let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
6
+ let __powerlines_deepkit_utilities = require("@powerlines/deepkit/utilities");
9
7
  let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
8
+ let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
10
9
  let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
10
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
11
11
  let __alloy_js_typescript = require("@alloy-js/typescript");
12
12
 
13
13
  //#region src/typescript/components/typescript-object.tsx
@@ -111,7 +111,7 @@ function TypescriptObjectProperty(props) {
111
111
  return property.getNameAsString();
112
112
  },
113
113
  get value() {
114
- return require_utilities.stringifyDefaultValue(property);
114
+ return (0, __powerlines_deepkit_utilities.stringifyDefaultValue)(property);
115
115
  }
116
116
  }),
117
117
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps } from "../../types/components.cjs";
2
- import * as _alloy_js_core3 from "@alloy-js/core";
2
+ import * as _alloy_js_core13 from "@alloy-js/core";
3
3
  import { VarDeclarationProps } from "@alloy-js/typescript";
4
4
  import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
5
5
  import { ComputedRef } from "@vue/reactivity";
@@ -15,11 +15,11 @@ interface TypescriptObjectPropertyProps extends ComponentProps {
15
15
  /**
16
16
  * Generates a TypeScript object for the given reflection class.
17
17
  */
18
- declare function TypescriptObject<T extends Record<string, any> = Record<string, any>>(props: TypescriptObjectProps<T>): _alloy_js_core3.Children;
18
+ declare function TypescriptObject<T extends Record<string, any> = Record<string, any>>(props: TypescriptObjectProps<T>): _alloy_js_core13.Children;
19
19
  /**
20
20
  * Generates a TypeScript object property for the given reflection class.
21
21
  */
22
- declare function TypescriptObjectProperty(props: TypescriptObjectPropertyProps): _alloy_js_core3.Children;
22
+ declare function TypescriptObjectProperty(props: TypescriptObjectPropertyProps): _alloy_js_core13.Children;
23
23
  declare type __ΩTypescriptObjectProps = any[];
24
24
  declare type __ΩTypescriptObjectPropertyProps = any[];
25
25
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { ComponentProps } from "../../types/components.mjs";
2
- import * as _alloy_js_core9 from "@alloy-js/core";
2
+ import * as _alloy_js_core7 from "@alloy-js/core";
3
3
  import { ReflectionClass, ReflectionProperty } from "@powerlines/deepkit/vendor/type";
4
4
  import { VarDeclarationProps } from "@alloy-js/typescript";
5
5
  import { ComputedRef } from "@vue/reactivity";
@@ -15,11 +15,11 @@ interface TypescriptObjectPropertyProps extends ComponentProps {
15
15
  /**
16
16
  * Generates a TypeScript object for the given reflection class.
17
17
  */
18
- declare function TypescriptObject<T extends Record<string, any> = Record<string, any>>(props: TypescriptObjectProps<T>): _alloy_js_core9.Children;
18
+ declare function TypescriptObject<T extends Record<string, any> = Record<string, any>>(props: TypescriptObjectProps<T>): _alloy_js_core7.Children;
19
19
  /**
20
20
  * Generates a TypeScript object property for the given reflection class.
21
21
  */
22
- declare function TypescriptObjectProperty(props: TypescriptObjectPropertyProps): _alloy_js_core9.Children;
22
+ declare function TypescriptObjectProperty(props: TypescriptObjectPropertyProps): _alloy_js_core7.Children;
23
23
  declare type __ΩTypescriptObjectProps = any[];
24
24
  declare type __ΩTypescriptObjectPropertyProps = any[];
25
25
  //#endregion
@@ -1,12 +1,12 @@
1
1
  import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
2
- import { stringifyDefaultValue } from "../../deepkit/src/utilities.mjs";
3
2
  import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
4
3
  import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
5
4
  import { Declaration, For, Name, Show, computed, createSymbolSlot, splitProps } from "@alloy-js/core";
6
- import { isString } from "@stryke/type-checks/is-string";
7
- import { isUndefined } from "@stryke/type-checks/is-undefined";
5
+ import { stringifyDefaultValue } from "@powerlines/deepkit/utilities";
8
6
  import { camelCase } from "@stryke/string-format/camel-case";
7
+ import { isUndefined } from "@stryke/type-checks/is-undefined";
9
8
  import { pascalCase } from "@stryke/string-format/pascal-case";
9
+ import { isString } from "@stryke/type-checks/is-string";
10
10
  import { ObjectExpression, ObjectProperty, TSSymbolFlags, TypeRefContext, createValueSymbol, useTSNamePolicy } from "@alloy-js/typescript";
11
11
 
12
12
  //#region src/typescript/components/typescript-object.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-alloy",
3
- "version": "0.18.15",
3
+ "version": "0.18.17",
4
4
  "type": "module",
5
5
  "description": "A package containing various Alloy framework components and helper utilities.",
6
6
  "repository": {
@@ -360,7 +360,7 @@
360
360
  "@alloy-js/markdown": "^0.22.0",
361
361
  "@alloy-js/rollup-plugin": "^0.1.0",
362
362
  "@alloy-js/typescript": "^0.22.0",
363
- "@powerlines/deepkit": "^0.5.48",
363
+ "@powerlines/deepkit": "^0.5.50",
364
364
  "@storm-software/config-tools": "^1.188.75",
365
365
  "@stryke/capnp": "^0.12.52",
366
366
  "@stryke/convert": "^0.6.30",
@@ -373,13 +373,13 @@
373
373
  "@stryke/types": "^0.10.29",
374
374
  "@stryke/unique-id": "^0.3.38",
375
375
  "defu": "^6.1.4",
376
- "powerlines": "^0.37.7",
376
+ "powerlines": "^0.37.9",
377
377
  "prettier": "^3.7.4"
378
378
  },
379
379
  "devDependencies": {
380
- "@powerlines/plugin-plugin": "^0.12.85",
380
+ "@powerlines/plugin-plugin": "^0.12.87",
381
381
  "@types/node": "^24.10.4"
382
382
  },
383
383
  "publishConfig": { "access": "public" },
384
- "gitHead": "59db410d946ed8bbbff6ee6230b0716b91ef0115"
384
+ "gitHead": "c8f7d40e33243f2a610de2c53c050f3b2f2dcd31"
385
385
  }
@@ -1,113 +0,0 @@
1
- const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
- let __stryke_json_storm_json = require("@stryke/json/storm-json");
3
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
4
- let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
5
- let __stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
6
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
7
- let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
8
-
9
- //#region ../deepkit/src/utilities.ts
10
- /**
11
- * Converts any {@link ReflectionProperty} or {@link ReflectionParameter}'s value to string representation.
12
- *
13
- * @param property - The {@link ReflectionProperty} or {@link ReflectionParameter} containing the value to stringify.
14
- * @param value - The value to stringify.
15
- * @returns A string representation of the value.
16
- */
17
- function stringifyDefaultValue(property, value) {
18
- return stringifyValue(property.type, value ?? property.getDefaultValue());
19
- }
20
- /**
21
- * Stringifies a value as a string.
22
- *
23
- * @param value - The value to stringify.
24
- * @returns A string representation of the value.
25
- */
26
- function stringifyStringValue(value) {
27
- return `"${String(value).replaceAll("\"", "\\\"")}"`;
28
- }
29
- /**
30
- * Converts any {@link Type}'s actual value to string representation.
31
- *
32
- * @param type - The {@link Type} of the value to stringify.
33
- * @param value - The value to stringify.
34
- * @returns A string representation of the value.
35
- */
36
- function stringifyValue(type, value) {
37
- return (0, __stryke_type_checks_is_undefined.isUndefined)(value) ? "undefined" : (0, __stryke_type_checks_is_null.isNull)(value) ? "null" : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.literal && (0, __stryke_type_checks_is_string.isString)(type.literal) ? stringifyStringValue(value) : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.enum ? getEnumReflectionType(type).kind === __powerlines_deepkit_vendor_type.ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.array ? stringifyStringValue(__stryke_json_storm_json.StormJSON.stringify(value)) : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.object || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral ? __stryke_json_storm_json.StormJSON.stringify(value) : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.property || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value)?.includes("\"") || String(value)?.includes("'") ? stringifyStringValue(value) : String(value);
38
- }
39
- /**
40
- * Converts a {@link TypeEnum} to its underlying primitive type representation.
41
- *
42
- * @param type - The {@link TypeEnum} to evaluate.
43
- * @returns A string representation of the primitive type.
44
- */
45
- function getEnumReflectionType(type) {
46
- if (type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.enum) throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
47
- const unique = (0, __stryke_helpers_get_unique.getUniqueBy)(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => (0, __stryke_type_checks_is_string.isString)(enumMember) ? { kind: __powerlines_deepkit_vendor_type.ReflectionKind.string } : { kind: __powerlines_deepkit_vendor_type.ReflectionKind.number });
48
- if (unique.length === 0) throw new Error(`No valid enum members could be found.`);
49
- return unique[0] && (0, __stryke_type_checks_is_string.isString)(unique[0]) ? { kind: __powerlines_deepkit_vendor_type.ReflectionKind.string } : { kind: __powerlines_deepkit_vendor_type.ReflectionKind.number };
50
- }
51
- /**
52
- * Converts a {@link TypeUnion} to its underlying primitive type representation.
53
- *
54
- * @param type - The {@link TypeUnion} to evaluate.
55
- * @returns A string representation of the primitive type.
56
- */
57
- function getUnionTypes(type) {
58
- if (type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.union && type.types.length > 0) return (0, __stryke_helpers_get_unique.getUniqueBy)(type.types, (member) => member.kind);
59
- throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
60
- }
61
- function isStringUnion(type) {
62
- return getUnionTypes(type).some((member) => member.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || member.kind === __powerlines_deepkit_vendor_type.ReflectionKind.literal && (0, __stryke_type_checks_is_string.isString)(member.literal));
63
- }
64
- /**
65
- * Converts a ReflectionKind to its string representation.
66
- *
67
- * @param kind - The {@link ReflectionKind} to convert.
68
- * @returns A string representation of the kind.
69
- */
70
- function kindToName(kind) {
71
- if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.void) return "void";
72
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.never) return "never";
73
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.null) return "null";
74
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.undefined) return "undefined";
75
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.symbol) return "symbol";
76
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.bigint) return "bigint";
77
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.number) return "number";
78
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.string) return "string";
79
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean) return "boolean";
80
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.literal) return "literal";
81
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.class) return "class";
82
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.array) return "array";
83
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.object) return "object";
84
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral) return "objectLiteral";
85
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.union) return "union";
86
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.enum) return "enum";
87
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.regexp) return "regexp";
88
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.templateLiteral) return "templateLiteral";
89
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.property) return "property";
90
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.method) return "method";
91
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.function) return "function";
92
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.parameter) return "parameter";
93
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.promise) return "promise";
94
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.typeParameter) return "typeParameter";
95
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.tuple) return "tuple";
96
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.tupleMember) return "tupleMember";
97
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.enumMember) return "enumMember";
98
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.rest) return "rest";
99
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.indexSignature) return "indexSignature";
100
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.propertySignature) return "propertySignature";
101
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.methodSignature) return "methodSignature";
102
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.infer) return "infer";
103
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.callSignature) return "callSignature";
104
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.any) return "any";
105
- else if (kind === __powerlines_deepkit_vendor_type.ReflectionKind.intersection) return "intersection";
106
- return "unknown";
107
- }
108
-
109
- //#endregion
110
- exports.getUnionTypes = getUnionTypes;
111
- exports.kindToName = kindToName;
112
- exports.stringifyDefaultValue = stringifyDefaultValue;
113
- exports.stringifyValue = stringifyValue;
@@ -1,109 +0,0 @@
1
- import { StormJSON } from "@stryke/json/storm-json";
2
- import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
3
- import { getUniqueBy } from "@stryke/helpers/get-unique";
4
- import { isNull } from "@stryke/type-checks/is-null";
5
- import { isString } from "@stryke/type-checks/is-string";
6
- import { isUndefined } from "@stryke/type-checks/is-undefined";
7
-
8
- //#region ../deepkit/src/utilities.ts
9
- /**
10
- * Converts any {@link ReflectionProperty} or {@link ReflectionParameter}'s value to string representation.
11
- *
12
- * @param property - The {@link ReflectionProperty} or {@link ReflectionParameter} containing the value to stringify.
13
- * @param value - The value to stringify.
14
- * @returns A string representation of the value.
15
- */
16
- function stringifyDefaultValue(property, value) {
17
- return stringifyValue(property.type, value ?? property.getDefaultValue());
18
- }
19
- /**
20
- * Stringifies a value as a string.
21
- *
22
- * @param value - The value to stringify.
23
- * @returns A string representation of the value.
24
- */
25
- function stringifyStringValue(value) {
26
- return `"${String(value).replaceAll("\"", "\\\"")}"`;
27
- }
28
- /**
29
- * Converts any {@link Type}'s actual value to string representation.
30
- *
31
- * @param type - The {@link Type} of the value to stringify.
32
- * @param value - The value to stringify.
33
- * @returns A string representation of the value.
34
- */
35
- function stringifyValue(type, value) {
36
- return isUndefined(value) ? "undefined" : isNull(value) ? "null" : type.kind === ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === ReflectionKind.string || type.kind === ReflectionKind.literal && isString(type.literal) ? stringifyStringValue(value) : type.kind === ReflectionKind.enum ? getEnumReflectionType(type).kind === ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === ReflectionKind.array ? stringifyStringValue(StormJSON.stringify(value)) : type.kind === ReflectionKind.object || type.kind === ReflectionKind.objectLiteral ? StormJSON.stringify(value) : type.kind === ReflectionKind.property || type.kind === ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value)?.includes("\"") || String(value)?.includes("'") ? stringifyStringValue(value) : String(value);
37
- }
38
- /**
39
- * Converts a {@link TypeEnum} to its underlying primitive type representation.
40
- *
41
- * @param type - The {@link TypeEnum} to evaluate.
42
- * @returns A string representation of the primitive type.
43
- */
44
- function getEnumReflectionType(type) {
45
- if (type.kind !== ReflectionKind.enum) throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
46
- const unique = getUniqueBy(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString(enumMember) ? { kind: ReflectionKind.string } : { kind: ReflectionKind.number });
47
- if (unique.length === 0) throw new Error(`No valid enum members could be found.`);
48
- return unique[0] && isString(unique[0]) ? { kind: ReflectionKind.string } : { kind: ReflectionKind.number };
49
- }
50
- /**
51
- * Converts a {@link TypeUnion} to its underlying primitive type representation.
52
- *
53
- * @param type - The {@link TypeUnion} to evaluate.
54
- * @returns A string representation of the primitive type.
55
- */
56
- function getUnionTypes(type) {
57
- if (type.kind === ReflectionKind.union && type.types.length > 0) return getUniqueBy(type.types, (member) => member.kind);
58
- throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
59
- }
60
- function isStringUnion(type) {
61
- return getUnionTypes(type).some((member) => member.kind === ReflectionKind.string || member.kind === ReflectionKind.literal && isString(member.literal));
62
- }
63
- /**
64
- * Converts a ReflectionKind to its string representation.
65
- *
66
- * @param kind - The {@link ReflectionKind} to convert.
67
- * @returns A string representation of the kind.
68
- */
69
- function kindToName(kind) {
70
- if (kind === ReflectionKind.void) return "void";
71
- else if (kind === ReflectionKind.never) return "never";
72
- else if (kind === ReflectionKind.null) return "null";
73
- else if (kind === ReflectionKind.undefined) return "undefined";
74
- else if (kind === ReflectionKind.symbol) return "symbol";
75
- else if (kind === ReflectionKind.bigint) return "bigint";
76
- else if (kind === ReflectionKind.number) return "number";
77
- else if (kind === ReflectionKind.string) return "string";
78
- else if (kind === ReflectionKind.boolean) return "boolean";
79
- else if (kind === ReflectionKind.literal) return "literal";
80
- else if (kind === ReflectionKind.class) return "class";
81
- else if (kind === ReflectionKind.array) return "array";
82
- else if (kind === ReflectionKind.object) return "object";
83
- else if (kind === ReflectionKind.objectLiteral) return "objectLiteral";
84
- else if (kind === ReflectionKind.union) return "union";
85
- else if (kind === ReflectionKind.enum) return "enum";
86
- else if (kind === ReflectionKind.regexp) return "regexp";
87
- else if (kind === ReflectionKind.templateLiteral) return "templateLiteral";
88
- else if (kind === ReflectionKind.property) return "property";
89
- else if (kind === ReflectionKind.method) return "method";
90
- else if (kind === ReflectionKind.function) return "function";
91
- else if (kind === ReflectionKind.parameter) return "parameter";
92
- else if (kind === ReflectionKind.promise) return "promise";
93
- else if (kind === ReflectionKind.typeParameter) return "typeParameter";
94
- else if (kind === ReflectionKind.tuple) return "tuple";
95
- else if (kind === ReflectionKind.tupleMember) return "tupleMember";
96
- else if (kind === ReflectionKind.enumMember) return "enumMember";
97
- else if (kind === ReflectionKind.rest) return "rest";
98
- else if (kind === ReflectionKind.indexSignature) return "indexSignature";
99
- else if (kind === ReflectionKind.propertySignature) return "propertySignature";
100
- else if (kind === ReflectionKind.methodSignature) return "methodSignature";
101
- else if (kind === ReflectionKind.infer) return "infer";
102
- else if (kind === ReflectionKind.callSignature) return "callSignature";
103
- else if (kind === ReflectionKind.any) return "any";
104
- else if (kind === ReflectionKind.intersection) return "intersection";
105
- return "unknown";
106
- }
107
-
108
- //#endregion
109
- export { getUnionTypes, kindToName, stringifyDefaultValue, stringifyValue };
@@ -1,13 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
- let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
3
-
4
- //#region ../powerlines/src/lib/utilities/file-header.ts
5
- function getBaseFileHeader(context) {
6
- return `
7
- // Generated with ${(0, __stryke_string_format_title_case.titleCase)(context.config.framework)}
8
- // Note: Do not edit this file manually - it will be overwritten automatically
9
- `;
10
- }
11
-
12
- //#endregion
13
- exports.getBaseFileHeader = getBaseFileHeader;
@@ -1,12 +0,0 @@
1
- import { titleCase } from "@stryke/string-format/title-case";
2
-
3
- //#region ../powerlines/src/lib/utilities/file-header.ts
4
- function getBaseFileHeader(context) {
5
- return `
6
- // Generated with ${titleCase(context.config.framework)}
7
- // Note: Do not edit this file manually - it will be overwritten automatically
8
- `;
9
- }
10
-
11
- //#endregion
12
- export { getBaseFileHeader };