@powerlines/plugin-react 0.1.133 → 0.1.135

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 (203) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/components/index.cjs +2 -3
  3. package/dist/components/index.d.cts +1 -3
  4. package/dist/components/index.d.mts +1 -4
  5. package/dist/components/index.mjs +1 -2
  6. package/dist/components/react-optimized.cjs +48 -2
  7. package/dist/components/react-optimized.d.cts +13 -2
  8. package/dist/components/react-optimized.d.mts +13 -3
  9. package/dist/components/react-optimized.mjs +45 -1
  10. package/dist/deepkit/schemas/reflection.cjs +3940 -0
  11. package/dist/{plugin-BaOVS_rV.d.cts → deepkit/schemas/reflection.d.cts} +1 -331
  12. package/dist/{plugin-D7LpFbdk.d.mts → deepkit/schemas/reflection.d.mts} +59 -389
  13. package/dist/deepkit/schemas/reflection.mjs +3938 -0
  14. package/dist/deepkit/schemas/reflection2.cjs +4112 -0
  15. package/dist/deepkit/schemas/reflection2.mjs +4110 -0
  16. package/dist/deepkit/src/capnp.cjs +913 -0
  17. package/dist/deepkit/src/capnp.mjs +911 -0
  18. package/dist/deepkit/src/esbuild-plugin.cjs +47 -0
  19. package/dist/deepkit/src/esbuild-plugin.mjs +46 -0
  20. package/dist/deepkit/src/reflect-type.cjs +22 -0
  21. package/dist/deepkit/src/reflect-type.mjs +20 -0
  22. package/dist/deepkit/src/resolve-reflections.cjs +16 -0
  23. package/dist/deepkit/src/resolve-reflections.mjs +15 -0
  24. package/dist/deepkit/src/transformer.cjs +52 -0
  25. package/dist/deepkit/src/transformer.mjs +49 -0
  26. package/dist/deepkit/src/transpile.cjs +29 -0
  27. package/dist/deepkit/src/transpile.mjs +27 -0
  28. package/dist/deepkit/src/types.d.cts +10 -0
  29. package/dist/deepkit/src/types.d.mts +10 -0
  30. package/dist/deepkit/src/utilities.cjs +66 -0
  31. package/dist/deepkit/src/utilities.mjs +65 -0
  32. package/dist/index.cjs +16 -11295
  33. package/dist/index.d.cts +5 -7
  34. package/dist/index.d.mts +6 -8
  35. package/dist/index.mjs +7 -11280
  36. package/dist/plugin-alloy/src/core/components/output.cjs +45 -0
  37. package/dist/plugin-alloy/src/core/components/output.mjs +44 -0
  38. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +22 -0
  39. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +21 -0
  40. package/dist/plugin-alloy/src/core/components/source-file.cjs +64 -0
  41. package/dist/plugin-alloy/src/core/components/source-file.d.cts +23 -0
  42. package/dist/plugin-alloy/src/core/components/source-file.d.mts +23 -0
  43. package/dist/plugin-alloy/src/core/components/source-file.mjs +62 -0
  44. package/dist/plugin-alloy/src/core/contexts/context.cjs +60 -0
  45. package/dist/plugin-alloy/src/core/contexts/context.mjs +54 -0
  46. package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
  47. package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
  48. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +46 -0
  49. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +42 -0
  50. package/dist/plugin-alloy/src/helpers/refkey.cjs +16 -0
  51. package/dist/plugin-alloy/src/helpers/refkey.mjs +15 -0
  52. package/dist/plugin-alloy/src/index.cjs +93 -0
  53. package/dist/plugin-alloy/src/index.mjs +91 -0
  54. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +7 -0
  55. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +9 -0
  56. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +5 -0
  57. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +7 -0
  58. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +17 -0
  59. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +17 -0
  60. package/dist/plugin-alloy/src/types/components.d.cts +22 -0
  61. package/dist/{components-Bs3-ohmM.d.mts → plugin-alloy/src/types/components.d.mts} +2 -1
  62. package/dist/plugin-alloy/src/types/index.d.mts +2 -0
  63. package/dist/plugin-alloy/src/types/plugin.d.cts +37 -0
  64. package/dist/plugin-alloy/src/types/plugin.d.mts +37 -0
  65. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +57 -0
  66. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +25 -0
  67. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +26 -0
  68. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +56 -0
  69. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +126 -0
  70. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +124 -0
  71. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +442 -0
  72. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +27 -0
  73. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +28 -0
  74. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +433 -0
  75. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +194 -0
  76. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +14 -0
  77. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +15 -0
  78. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +191 -0
  79. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +68 -0
  80. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +67 -0
  81. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +124 -0
  82. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +123 -0
  83. package/dist/plugin-automd/src/index.cjs +101 -0
  84. package/dist/plugin-automd/src/index.mjs +98 -0
  85. package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
  86. package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
  87. package/dist/plugin-automd/src/types/toc.d.cts +33 -0
  88. package/dist/plugin-automd/src/types/toc.d.mts +33 -0
  89. package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -0
  90. package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -0
  91. package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -0
  92. package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -0
  93. package/dist/plugin-babel/src/helpers/filters.cjs +23 -0
  94. package/dist/plugin-babel/src/helpers/filters.mjs +21 -0
  95. package/dist/plugin-babel/src/helpers/index.cjs +5 -0
  96. package/dist/plugin-babel/src/helpers/index.mjs +7 -0
  97. package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -0
  98. package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -0
  99. package/dist/plugin-babel/src/helpers/options.cjs +50 -0
  100. package/dist/plugin-babel/src/helpers/options.mjs +47 -0
  101. package/dist/plugin-babel/src/index.cjs +91 -0
  102. package/dist/plugin-babel/src/index.mjs +89 -0
  103. package/dist/plugin-babel/src/types/index.d.mts +1 -0
  104. package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
  105. package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
  106. package/dist/plugin-env/src/babel/index.cjs +1 -0
  107. package/dist/plugin-env/src/babel/index.mjs +3 -0
  108. package/dist/plugin-env/src/babel/plugin.cjs +121 -0
  109. package/dist/plugin-env/src/babel/plugin.mjs +119 -0
  110. package/dist/plugin-env/src/components/docs.cjs +9 -0
  111. package/dist/plugin-env/src/components/docs.mjs +11 -0
  112. package/dist/plugin-env/src/components/env.cjs +575 -0
  113. package/dist/plugin-env/src/components/env.mjs +572 -0
  114. package/dist/plugin-env/src/components/index.cjs +2 -0
  115. package/dist/plugin-env/src/components/index.mjs +4 -0
  116. package/dist/plugin-env/src/helpers/automd-generator.cjs +22 -0
  117. package/dist/plugin-env/src/helpers/automd-generator.mjs +21 -0
  118. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +55 -0
  119. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +54 -0
  120. package/dist/plugin-env/src/helpers/index.cjs +6 -0
  121. package/dist/plugin-env/src/helpers/index.mjs +8 -0
  122. package/dist/plugin-env/src/helpers/load.cjs +83 -0
  123. package/dist/plugin-env/src/helpers/load.mjs +80 -0
  124. package/dist/plugin-env/src/helpers/persistence.cjs +199 -0
  125. package/dist/plugin-env/src/helpers/persistence.mjs +188 -0
  126. package/dist/plugin-env/src/helpers/reflect.cjs +111 -0
  127. package/dist/plugin-env/src/helpers/reflect.mjs +103 -0
  128. package/dist/plugin-env/src/helpers/source-file-env.cjs +24 -0
  129. package/dist/plugin-env/src/helpers/source-file-env.mjs +23 -0
  130. package/dist/plugin-env/src/helpers/template-helpers.cjs +2 -0
  131. package/dist/plugin-env/src/helpers/template-helpers.mjs +4 -0
  132. package/dist/plugin-env/src/index.cjs +175 -0
  133. package/dist/plugin-env/src/index.mjs +173 -0
  134. package/dist/plugin-env/src/types/plugin.d.cts +151 -0
  135. package/dist/plugin-env/src/types/plugin.d.mts +153 -0
  136. package/dist/{runtime-BjubXOjV.d.mts → plugin-env/src/types/runtime.d.cts} +2 -2
  137. package/dist/{runtime-CAI6R3zb.d.cts → plugin-env/src/types/runtime.d.mts} +2 -2
  138. package/dist/powerlines/src/lib/build/esbuild.cjs +102 -0
  139. package/dist/powerlines/src/lib/build/esbuild.mjs +100 -0
  140. package/dist/powerlines/src/lib/entry.cjs +12 -0
  141. package/dist/powerlines/src/lib/entry.mjs +14 -0
  142. package/dist/powerlines/src/lib/logger.cjs +41 -0
  143. package/dist/powerlines/src/lib/logger.mjs +39 -0
  144. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +38 -0
  145. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +35 -0
  146. package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -0
  147. package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -0
  148. package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -0
  149. package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -0
  150. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
  151. package/dist/powerlines/src/plugin-utils/paths.mjs +3 -0
  152. package/dist/powerlines/src/types/babel.d.cts +22 -0
  153. package/dist/powerlines/src/types/babel.d.mts +22 -0
  154. package/dist/powerlines/src/types/build.d.cts +145 -0
  155. package/dist/powerlines/src/types/build.d.mts +145 -0
  156. package/dist/powerlines/src/types/commands.d.cts +8 -0
  157. package/dist/powerlines/src/types/commands.d.mts +9 -0
  158. package/dist/powerlines/src/types/config.d.cts +387 -0
  159. package/dist/powerlines/src/types/config.d.mts +388 -0
  160. package/dist/powerlines/src/types/context.d.cts +414 -0
  161. package/dist/powerlines/src/types/context.d.mts +416 -0
  162. package/dist/powerlines/src/types/fs.d.cts +486 -0
  163. package/dist/powerlines/src/types/fs.d.mts +486 -0
  164. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  165. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  166. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  167. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  168. package/dist/powerlines/src/types/resolved.d.mts +82 -0
  169. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  170. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  171. package/dist/types/index.cjs +0 -3
  172. package/dist/types/index.d.cts +2 -5
  173. package/dist/types/index.d.mts +2 -6
  174. package/dist/types/index.mjs +0 -4
  175. package/dist/types/plugin.cjs +0 -1
  176. package/dist/types/plugin.d.cts +72 -3
  177. package/dist/types/plugin.d.mts +72 -4
  178. package/dist/types/plugin.mjs +0 -2
  179. package/dist/types/runtime.cjs +0 -1
  180. package/dist/types/runtime.d.cts +14 -3
  181. package/dist/types/runtime.d.mts +14 -3
  182. package/dist/types/runtime.mjs +0 -2
  183. package/package.json +6 -6
  184. package/dist/components-BWLXb7a2.cjs +0 -0
  185. package/dist/components-D-mbfYAe.mjs +0 -1
  186. package/dist/index-B8OHl-c_.d.mts +0 -1
  187. package/dist/index-CFG0_wK4.d.cts +0 -1
  188. package/dist/index-DNLi60D-.d.mts +0 -1
  189. package/dist/index-_wQ5ClJU.d.cts +0 -1
  190. package/dist/plugin-jZ9N9Mz-.mjs +0 -1
  191. package/dist/plugin-pBKbb5K9.cjs +0 -0
  192. package/dist/react-optimized-BpFTLlx0.mjs +0 -937
  193. package/dist/react-optimized-C_OVnrX3.d.cts +0 -105
  194. package/dist/react-optimized-Kv14o38g.cjs +0 -1078
  195. package/dist/react-optimized-oMkTiRKU.d.mts +0 -88
  196. package/dist/resolved-BmaQR2AE.d.mts +0 -1789
  197. package/dist/resolved-DaJ9lL_Z.d.cts +0 -1788
  198. package/dist/runtime-BKY6WvHV.mjs +0 -1
  199. package/dist/runtime-Bp9G0scd.cjs +0 -0
  200. package/dist/runtime-DWYeFyQG.d.cts +0 -15
  201. package/dist/runtime-YmyzXCJq.d.mts +0 -15
  202. package/dist/types--fVOUYBq.mjs +0 -1
  203. package/dist/types-a8gm_IaQ.cjs +0 -0
@@ -1,1078 +0,0 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
- let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
29
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
30
- let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
31
- let defu = require("defu");
32
- defu = __toESM(defu);
33
- let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
34
- let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
35
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
36
- let __alloy_js_core = require("@alloy-js/core");
37
- let __stryke_json_storm_json = require("@stryke/json/storm-json");
38
- let __stryke_path_replace = require("@stryke/path/replace");
39
- let __stryke_path_append = require("@stryke/path/append");
40
- let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
41
- let __stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
42
- let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
43
- let __alloy_js_typescript = require("@alloy-js/typescript");
44
- let __stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
45
- let __stryke_type_checks_is_boolean = require("@stryke/type-checks/is-boolean");
46
-
47
- //#region ../plugin-alloy/src/core/contexts/context.ts
48
- /**
49
- * The Powerlines context used in template rendering.
50
- */
51
- const PowerlinesContext = (0, __alloy_js_core.createNamedContext)("powerlines");
52
- /**
53
- * Hook to access the Powerlines Context.
54
- *
55
- * @returns The Context.
56
- */
57
- function usePowerlinesContext() {
58
- return (0, __alloy_js_core.useContext)(PowerlinesContext);
59
- }
60
- /**
61
- * Hook to safely access the {@link PluginContext | Powerlines context}.
62
- *
63
- * @returns The Powerlines context or undefined if not set.
64
- */
65
- function usePowerlinesSafe() {
66
- return usePowerlinesContext()?.ref?.value;
67
- }
68
- /**
69
- * Hook to access the {@link PluginContext | Powerlines context}.
70
- *
71
- * @returns The Powerlines context.
72
- */
73
- function usePowerlines() {
74
- const powerlines = usePowerlinesSafe();
75
- if (!powerlines) throw new Error("Powerlines - Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
76
- return powerlines;
77
- }
78
- /**
79
- * Hook to safely access the render context's metadata.
80
- *
81
- * @returns The Powerlines context or undefined if not set.
82
- */
83
- function useMetaSafe() {
84
- return usePowerlinesContext()?.meta?.value;
85
- }
86
- /**
87
- * Hook to access the render context's metadata.
88
- *
89
- * @returns The Powerlines context.
90
- */
91
- function useMeta() {
92
- const meta = useMetaSafe();
93
- if (!meta) throw new Error("Powerlines metadata is not available in the rendering context. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
94
- return meta;
95
- }
96
-
97
- //#endregion
98
- //#region ../deepkit/src/utilities.ts
99
- /**
100
- * Converts any {@link ReflectionProperty} or {@link ReflectionParameter}'s value to string representation.
101
- *
102
- * @param property - The {@link ReflectionProperty} or {@link ReflectionParameter} containing the value to stringify.
103
- * @param value - The value to stringify.
104
- * @returns A string representation of the value.
105
- */
106
- function stringifyDefaultValue(property, value) {
107
- return stringifyValue(property.type, value ?? property.getDefaultValue());
108
- }
109
- /**
110
- * Stringifies a value as a string.
111
- *
112
- * @param value - The value to stringify.
113
- * @returns A string representation of the value.
114
- */
115
- function stringifyStringValue(value) {
116
- return `"${String(value).replaceAll("\"", "\\\"")}"`;
117
- }
118
- /**
119
- * Converts any {@link Type}'s actual value to string representation.
120
- *
121
- * @param type - The {@link Type} of the value to stringify.
122
- * @param value - The value to stringify.
123
- * @returns A string representation of the value.
124
- */
125
- function stringifyValue(type, value) {
126
- 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);
127
- }
128
- /**
129
- * Converts a {@link TypeEnum} to its underlying primitive type representation.
130
- *
131
- * @param type - The {@link TypeEnum} to evaluate.
132
- * @returns A string representation of the primitive type.
133
- */
134
- function getEnumReflectionType(type) {
135
- if (type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.enum) throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
136
- 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 });
137
- if (unique.length === 0) throw new Error(`No valid enum members could be found.`);
138
- 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 };
139
- }
140
- /**
141
- * Converts a {@link TypeUnion} to its underlying primitive type representation.
142
- *
143
- * @param type - The {@link TypeUnion} to evaluate.
144
- * @returns A string representation of the primitive type.
145
- */
146
- function getUnionTypes(type) {
147
- 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);
148
- throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
149
- }
150
- function isStringUnion(type) {
151
- 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));
152
- }
153
-
154
- //#endregion
155
- //#region ../plugin-alloy/src/helpers/refkey.ts
156
- /**
157
- * Create a refkey for the provided arguments. Passing no arguments returns a fresh refkey that is guaranteed to be unique. Otherwise, the arguments passed will be used to create a refkey for those values. Providing the same arguments will always return the same refkey.
158
- *
159
- * @remarks
160
- * Values are compared using the SameValueZero algorithm, which considers objects the same if they are reference identical, and primitives the same if they are the same value, with the exception of `NaN`, which is always considered equal to other `NaN` values, and `-0`, which is considered identical to `+0`
161
- */
162
- function refkey(...args) {
163
- return (0, __alloy_js_core.refkey)("powerlines", ...args);
164
- }
165
-
166
- //#endregion
167
- //#region ../plugin-alloy/src/typescript/components/tsdoc.tsx
168
- /**
169
- * Generates a TypeScript interface for the given reflection class.
170
- */
171
- function TSDoc(props) {
172
- const [{ children, heading }] = (0, __alloy_js_core.splitProps)(props, ["children", "heading"]);
173
- return [
174
- "/**",
175
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("align", {
176
- string: " * ",
177
- get children() {
178
- return [
179
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
180
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
181
- get when() {
182
- return !(0, __stryke_type_checks_is_undefined.isUndefined)(heading);
183
- },
184
- get children() {
185
- return [
186
- heading,
187
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
188
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
189
- get when() {
190
- return (0, __alloy_js_core_jsx_runtime.memo)(() => !!!(0, __stryke_type_checks_is_undefined.isUndefined)(children))() && (0, __alloy_js_core.childrenArray)(() => children).length > 0;
191
- },
192
- get children() {
193
- return (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {});
194
- }
195
- })
196
- ];
197
- }
198
- }),
199
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
200
- get when() {
201
- return (0, __alloy_js_core_jsx_runtime.memo)(() => !!!(0, __stryke_type_checks_is_undefined.isUndefined)(children))() && (0, __alloy_js_core.childrenArray)(() => children).length > 0;
202
- },
203
- get children() {
204
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.List, { get children() {
205
- return (0, __alloy_js_core.childrenArray)(() => children);
206
- } });
207
- }
208
- })
209
- ];
210
- }
211
- }),
212
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
213
- ` */`,
214
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
215
- ];
216
- }
217
- /**
218
- * Create a TSDoc `@<props.tag>` tag.
219
- */
220
- function TSDocTag(props) {
221
- const [{ children, tag }] = (0, __alloy_js_core.splitProps)(props, ["children", "tag"]);
222
- return [
223
- `@${tag} `,
224
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
225
- get when() {
226
- return Boolean(children);
227
- },
228
- get children() {
229
- return (0, __alloy_js_core_jsx_runtime.createIntrinsic)("align", {
230
- width: 2,
231
- get children() {
232
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Prose, { children });
233
- }
234
- });
235
- }
236
- }),
237
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
238
- ];
239
- }
240
- /**
241
- * Create a TSDoc `@title` tag.
242
- */
243
- function TSDocTitle(props) {
244
- const [{ children }, rest] = (0, __alloy_js_core.splitProps)(props, ["children"]);
245
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocTag, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
246
- tag: "title",
247
- children
248
- }));
249
- }
250
- /**
251
- * Create a TSDoc `@domain` tag.
252
- */
253
- function TSDocDomain(props) {
254
- const [{ children }, rest] = (0, __alloy_js_core.splitProps)(props, ["children"]);
255
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocTag, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
256
- tag: "domain",
257
- children
258
- }));
259
- }
260
- /**
261
- * Create a TSDoc `@alias` tag.
262
- */
263
- function TSDocAlias(props) {
264
- const [{ children }, rest] = (0, __alloy_js_core.splitProps)(props, ["children"]);
265
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocTag, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
266
- tag: "alias",
267
- children
268
- }));
269
- }
270
- /**
271
- * Create a TSDoc `@permission` tag.
272
- */
273
- function TSDocPermission(props) {
274
- const [{ children }, rest] = (0, __alloy_js_core.splitProps)(props, ["children"]);
275
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocTag, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
276
- tag: "permission",
277
- children
278
- }));
279
- }
280
- /**
281
- * Create a TSDoc `@defaultValue` tag.
282
- */
283
- function TSDocDefaultValue(props) {
284
- return [
285
- "@defaultValue ",
286
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
287
- get when() {
288
- return !(0, __stryke_type_checks_is_undefined.isUndefined)(props.value);
289
- },
290
- get children() {
291
- return (0, __alloy_js_core_jsx_runtime.createIntrinsic)("align", {
292
- width: 2,
293
- get children() {
294
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Prose, { get children() {
295
- return stringifyDefaultValue(props.value);
296
- } });
297
- }
298
- });
299
- }
300
- }),
301
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
302
- ];
303
- }
304
- /**
305
- * Create a TSDoc `@remarks` tag.
306
- */
307
- function TSDocRemarks(props) {
308
- return [
309
- "@remarks ",
310
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
311
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.List, {
312
- hardline: true,
313
- get children() {
314
- return (0, __alloy_js_core.childrenArray)(() => props.children);
315
- }
316
- })
317
- ];
318
- }
319
- /**
320
- * Create a TSDoc `@see` tag.
321
- */
322
- function TSDocLink(props) {
323
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocTag, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, { tag: "see" }));
324
- }
325
- /**
326
- * Create a TSDoc `@example` tag.
327
- */
328
- function TSDocExample(props) {
329
- const [{ tsx, fenced = true, language, children }] = (0, __alloy_js_core.splitProps)(props, [
330
- "tsx",
331
- "fenced",
332
- "language",
333
- "children"
334
- ]);
335
- return [
336
- "@example ",
337
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
338
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
339
- when: fenced,
340
- get children() {
341
- return [
342
- "```",
343
- language || (tsx ? "tsx" : "ts"),
344
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
345
- ];
346
- }
347
- }),
348
- children,
349
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
350
- when: fenced,
351
- get children() {
352
- return [(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}), "```"];
353
- }
354
- })
355
- ];
356
- }
357
- /**
358
- * Create a TSDoc `@readonly` tag.
359
- */
360
- function TSDocReadonly() {
361
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocTag, { tag: "readonly" });
362
- }
363
- /**
364
- * Create a TSDoc `@internal` tag.
365
- */
366
- function TSDocInternal() {
367
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocTag, { tag: "internal" });
368
- }
369
- /**
370
- * Create a TSDoc `@ignore` tag.
371
- */
372
- function TSDocIgnore() {
373
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocTag, { tag: "ignore" });
374
- }
375
- /**
376
- * Create a TSDoc `@hidden` tag.
377
- */
378
- function TSDocHidden() {
379
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocTag, { tag: "hidden" });
380
- }
381
- /**
382
- * Generates a TypeScript interface property for the given reflection class.
383
- */
384
- function TSDocAttributesTags(props) {
385
- const [{ title, alias, permission, domain, readonly, internal, ignore, hidden, defaultValue }] = (0, __alloy_js_core.splitProps)(props, [
386
- "title",
387
- "alias",
388
- "permission",
389
- "domain",
390
- "readonly",
391
- "internal",
392
- "ignore",
393
- "hidden",
394
- "defaultValue"
395
- ]);
396
- return [
397
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
398
- get when() {
399
- return (0, __stryke_type_checks_is_set_string.isSetString)(title);
400
- },
401
- get children() {
402
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocTitle, { children: title });
403
- }
404
- }),
405
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
406
- get when() {
407
- return !(0, __stryke_type_checks_is_undefined.isUndefined)(alias) && alias.length > 0;
408
- },
409
- get children() {
410
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
411
- each: alias ?? [],
412
- children: (alias$1) => (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocAlias, { children: alias$1 })
413
- });
414
- }
415
- }),
416
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
417
- get when() {
418
- return (0, __stryke_type_checks_is_set_string.isSetString)(domain);
419
- },
420
- get children() {
421
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocDomain, { children: domain });
422
- }
423
- }),
424
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
425
- get when() {
426
- return !(0, __stryke_type_checks_is_undefined.isUndefined)(permission) && permission.length > 0;
427
- },
428
- get children() {
429
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
430
- each: permission ?? [],
431
- children: (permission$1) => (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocPermission, { children: permission$1 })
432
- });
433
- }
434
- }),
435
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
436
- when: readonly === true,
437
- get children() {
438
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocReadonly, {});
439
- }
440
- }),
441
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
442
- when: internal === true,
443
- get children() {
444
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocInternal, {});
445
- }
446
- }),
447
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
448
- when: ignore === true,
449
- get children() {
450
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocIgnore, {});
451
- }
452
- }),
453
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
454
- when: hidden === true,
455
- get children() {
456
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocHidden, {});
457
- }
458
- }),
459
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
460
- get when() {
461
- return !(0, __stryke_type_checks_is_undefined.isUndefined)(defaultValue);
462
- },
463
- get children() {
464
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocDefaultValue, { value: defaultValue });
465
- }
466
- })
467
- ];
468
- }
469
- /**
470
- * Create a TSDoc parameter set off with `@param`.
471
- */
472
- function TSDocParam(props) {
473
- return [
474
- "@param ",
475
- (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocParamName, {
476
- get name() {
477
- return props.name;
478
- },
479
- get optional() {
480
- return props.optional;
481
- },
482
- get defaultValue() {
483
- return props.defaultValue;
484
- }
485
- }),
486
- (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocParamDescription, { get children() {
487
- return props.children;
488
- } })
489
- ];
490
- }
491
- function TSDocParamName(props) {
492
- return [
493
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
494
- get when() {
495
- return props.optional;
496
- },
497
- children: "["
498
- }),
499
- (0, __alloy_js_core_jsx_runtime.memo)(() => props.name),
500
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
501
- get when() {
502
- return Boolean(props.defaultValue);
503
- },
504
- get children() {
505
- return ["=", (0, __alloy_js_core_jsx_runtime.memo)(() => props.defaultValue)];
506
- }
507
- }),
508
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
509
- get when() {
510
- return props.optional;
511
- },
512
- children: "]"
513
- })
514
- ];
515
- }
516
- function TSDocParamDescription(props) {
517
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
518
- get when() {
519
- return Boolean(props.children);
520
- },
521
- get children() {
522
- return [" - ", (0, __alloy_js_core_jsx_runtime.createIntrinsic)("align", {
523
- width: 2,
524
- get children() {
525
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Prose, { get children() {
526
- return props.children;
527
- } });
528
- }
529
- })];
530
- }
531
- });
532
- }
533
- /**
534
- * Create a TSDoc `@returns` tag.
535
- */
536
- function TSDocReturns(props) {
537
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocTag, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, { tag: "returns" }));
538
- }
539
- /**
540
- * Create a TSDoc `@throws` tag.
541
- */
542
- function TSDocThrows(props) {
543
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocTag, (0, __alloy_js_core_jsx_runtime.mergeProps)(props, { tag: "throws" }));
544
- }
545
- /**
546
- * Generates a TSDoc `@module` tag for the given module name.
547
- */
548
- function TSDocModule(props) {
549
- const [{ children, name, prefix }] = (0, __alloy_js_core.splitProps)(props, [
550
- "children",
551
- "name",
552
- "prefix"
553
- ]);
554
- const context = usePowerlines();
555
- return [
556
- "/**",
557
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("align", {
558
- string: " * ",
559
- get children() {
560
- return [
561
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
562
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
563
- get when() {
564
- return Boolean(children);
565
- },
566
- get children() {
567
- return [
568
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.List, {
569
- hardline: true,
570
- get children() {
571
- return (0, __alloy_js_core.childrenArray)(() => children);
572
- }
573
- }),
574
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
575
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
576
- ];
577
- }
578
- }),
579
- "@module ",
580
- (0, __alloy_js_core_jsx_runtime.memo)(() => prefix || context?.config.output.builtinPrefix),
581
- ":",
582
- name
583
- ];
584
- }
585
- }),
586
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
587
- ` */`
588
- ];
589
- }
590
-
591
- //#endregion
592
- //#region ../plugin-alloy/src/core/components/single-line-comment.tsx
593
- /**
594
- * A single line comment block. The children are rendered as a prose element, which means that they
595
- * are broken into multiple lines
596
- */
597
- function SingleLineComment(props) {
598
- const { variant = "double-slash", children } = props;
599
- const commentStart = variant === "slash-star" ? "/* " : variant === "slash-star-star" ? "/** " : variant === "triple-slash" ? "/// " : variant === "markdown" ? "<!-- " : "// ";
600
- return [commentStart, (0, __alloy_js_core_jsx_runtime.createIntrinsic)("align", {
601
- string: commentStart,
602
- get children() {
603
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Prose, { children }), variant === "slash-star" || variant === "slash-star-star" ? " */ " : variant === "markdown" ? " -->" : ""];
604
- }
605
- })];
606
- }
607
-
608
- //#endregion
609
- //#region ../plugin-alloy/src/core/contexts/reflection.ts
610
- /**
611
- * The reflection class context used in template rendering.
612
- */
613
- const ReflectionClassContext = (0, __alloy_js_core.createContext)();
614
- /**
615
- * Hook to access the Reflection context.
616
- *
617
- * @returns A reactive version of the current reflection.
618
- */
619
- function useReflectionClass() {
620
- const context = (0, __alloy_js_core.useContext)(ReflectionClassContext);
621
- if (!context) throw new Error("Powerlines - ReflectionClass Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
622
- return context;
623
- }
624
- /**
625
- * The reflection property context used in template rendering.
626
- */
627
- const ReflectionPropertyContext = (0, __alloy_js_core.createNamedContext)("reflection-property");
628
- /**
629
- * Hook to access the Reflection Property context.
630
- *
631
- * @returns A reactive version of the current reflection.
632
- */
633
- function useReflectionProperty() {
634
- const context = (0, __alloy_js_core.useContext)(ReflectionPropertyContext);
635
- if (!context) throw new Error("Powerlines - Reflection Property Context is not set. Please make sure the Alloy components are being provided to an invocation of the `render` function added to plugins by `@powerlines/plugin-alloy`.");
636
- return context;
637
- }
638
- /**
639
- * The reflection method context used in template rendering.
640
- */
641
- const ReflectionMethodContext = (0, __alloy_js_core.createNamedContext)("reflection-method");
642
- /**
643
- * The reflection parameter context used in template rendering.
644
- */
645
- const ReflectionParameterContext = (0, __alloy_js_core.createNamedContext)("reflection-parameter");
646
-
647
- //#endregion
648
- //#region ../plugin-alloy/src/core/components/source-file.tsx
649
- /**
650
- * A base component representing a Powerlines generated source file.
651
- *
652
- * @param props - The properties for the source file.
653
- * @returns The rendered source file component.
654
- */
655
- function SourceFile(props) {
656
- const [{ children, meta, path, header, storage, filetype, reference }] = (0, __alloy_js_core.splitProps)(props, [
657
- "children",
658
- "meta",
659
- "path",
660
- "header",
661
- "storage",
662
- "filetype",
663
- "reference"
664
- ]);
665
- const metadata = useMeta();
666
- const parentDirectory = (0, __alloy_js_core.useContext)(__alloy_js_core.SourceDirectoryContext);
667
- const sourceFile = {
668
- path: (0, __stryke_path_append.appendPath)(path, parentDirectory.path),
669
- filetype,
670
- reference
671
- };
672
- parentDirectory?.addContent(sourceFile);
673
- const printOptions = (0, __alloy_js_core.useFormatOptions)({
674
- printWidth: props.printWidth,
675
- tabWidth: props.tabWidth,
676
- useTabs: props.useTabs,
677
- insertFinalNewLine: props.insertFinalNewLine
678
- });
679
- const nodeContext = (0, __alloy_js_core.getContext)();
680
- nodeContext.meta = (0, defu.default)({
681
- sourceFile,
682
- printOptions
683
- }, meta ?? {});
684
- metadata[sourceFile.path] = {
685
- storage,
686
- ...meta ?? {}
687
- };
688
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.SourceFileContext.Provider, {
689
- value: sourceFile,
690
- get children() {
691
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
692
- when: header !== void 0,
693
- get children() {
694
- return [header, (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
695
- }
696
- }), children];
697
- }
698
- });
699
- }
700
-
701
- //#endregion
702
- //#region ../plugin-alloy/src/typescript/components/typescript-file.tsx
703
- /**
704
- * A base component representing a Powerlines generated Typescript source file.
705
- *
706
- * @param props - The properties for the source file.
707
- * @returns The rendered source file component.
708
- */
709
- function TypescriptFile(props) {
710
- const [{ children, path, imports, tsx, header, hashbang }, rest] = (0, __alloy_js_core.splitProps)(props, [
711
- "children",
712
- "path",
713
- "imports",
714
- "tsx",
715
- "header",
716
- "hashbang"
717
- ]);
718
- const directoryContext = (0, __alloy_js_core.useContext)(__alloy_js_core.SourceDirectoryContext);
719
- const sdData = (0, __alloy_js_typescript.getSourceDirectoryData)(directoryContext);
720
- const modulePath = (0, __stryke_path_append.appendPath)(path, directoryContext.path);
721
- const scope = new __alloy_js_typescript.TSModuleScope(modulePath, (0, __alloy_js_core.useScope)());
722
- sdData.modules.add(scope);
723
- const pkg = (0, __alloy_js_core.useContext)(__alloy_js_typescript.PackageContext);
724
- if (pkg) pkg.scope.addModule(scope);
725
- if (props.export) {
726
- if (pkg) if ((0, __stryke_type_checks_is_boolean.isBoolean)(props.export)) pkg.scope.addExport(modulePath, scope);
727
- else pkg.scope.addExport(props.export, scope);
728
- }
729
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.SourceFileContext.Provider, {
730
- value: { scope },
731
- get children() {
732
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Scope, {
733
- value: scope,
734
- get children() {
735
- return (0, __alloy_js_core_jsx_runtime.createComponent)(SourceFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
736
- path: modulePath,
737
- get header() {
738
- return header ?? (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptFileHeader, {
739
- hashbang,
740
- get children() {
741
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptFileHeaderImports, {
742
- imports,
743
- scope
744
- });
745
- }
746
- });
747
- },
748
- filetype: tsx ? "tsx" : "typescript",
749
- children
750
- }));
751
- }
752
- });
753
- }
754
- });
755
- }
756
- /**
757
- * Renders the header for a Powerlines Typescript source file.
758
- *
759
- * @param props - The properties for the source file header.
760
- * @returns The rendered source file header.
761
- */
762
- function TypescriptFileHeader(props) {
763
- const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
764
- const context = usePowerlines();
765
- return [
766
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
767
- get when() {
768
- return Boolean(hashbang);
769
- },
770
- get children() {
771
- return [(0, __alloy_js_core_jsx_runtime.memo)(() => hashbang === true ? __alloy_js_core.code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
772
- }
773
- }),
774
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
775
- get when() {
776
- return Boolean(header);
777
- },
778
- get children() {
779
- return [header, (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
780
- }
781
- }),
782
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
783
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
784
- get when() {
785
- return Boolean(disableEslint);
786
- },
787
- get children() {
788
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(SingleLineComment, {
789
- variant: "slash-star",
790
- children: "eslint-disable"
791
- }), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
792
- }
793
- }),
794
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
795
- get when() {
796
- return Boolean(disablePrettier);
797
- },
798
- get children() {
799
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(SingleLineComment, {
800
- variant: "slash-star",
801
- children: "prettier-ignore"
802
- }), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
803
- }
804
- }),
805
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
806
- get when() {
807
- return Boolean(disableBiome);
808
- },
809
- get children() {
810
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(SingleLineComment, { children: "biome-ignore lint: disable" }), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
811
- }
812
- }),
813
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
814
- get when() {
815
- return Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome);
816
- },
817
- get children() {
818
- return (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {});
819
- }
820
- }),
821
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
822
- get when() {
823
- return Boolean(children);
824
- },
825
- get children() {
826
- return [children, (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
827
- }
828
- }),
829
- (0, __alloy_js_core_jsx_runtime.createComponent)(SingleLineComment, { get children() {
830
- return __alloy_js_core.code`Generated by ${(0, __stryke_string_format_title_case.titleCase)(context?.config.framework) || "Powerlines"}`;
831
- } }),
832
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
833
- (0, __alloy_js_core_jsx_runtime.createComponent)(SingleLineComment, { children: __alloy_js_core.code`NOTE: Do not edit this file manually - it will be overwritten automatically by the "prepare" command` }),
834
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
835
- ];
836
- }
837
- /**
838
- * Renders the header for a Powerlines Typescript source file.
839
- *
840
- * @param props - The properties for the source file header.
841
- * @returns The rendered source file header.
842
- */
843
- function TypescriptFileHeaderImports(props) {
844
- const { imports } = props;
845
- const context = usePowerlines();
846
- const sourceFile = (0, __alloy_js_typescript.useSourceFile)();
847
- const scope = props.scope ?? sourceFile.scope;
848
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
849
- get when() {
850
- return scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0;
851
- },
852
- get children() {
853
- return [
854
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
855
- get when() {
856
- return !!imports && Object.keys(imports).length > 0;
857
- },
858
- get children() {
859
- return Object.entries(imports ?? {}).filter(([key]) => key !== "$builtins").concat(imports && imports.$builtins ? Object.entries(imports.$builtins).map(([key, entry]) => [key.includes(":") ? key : `${context.config.output.builtinPrefix}:${key}`, entry]) : []).map(([module$1, imported]) => {
860
- return __alloy_js_core.code`import ${imported === null ? "" : imported.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (imported.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && imported.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (imported.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${imported.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} from "${module$1}";`;
861
- });
862
- }
863
- }),
864
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
865
- get when() {
866
- return scope.importedModules.size > 0;
867
- },
868
- get children() {
869
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ImportStatements, { get records() {
870
- return scope.importedModules;
871
- } });
872
- }
873
- }),
874
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
875
- ];
876
- }
877
- });
878
- }
879
-
880
- //#endregion
881
- //#region ../plugin-alloy/src/typescript/components/builtin-file.tsx
882
- /**
883
- * A base component representing a Powerlines generated Typescript source file.
884
- *
885
- * @param props - The properties for the source file.
886
- * @returns The rendered source file component.
887
- */
888
- function BuiltinFile(props) {
889
- const [{ children, imports, id, description, tsx }, rest] = (0, __alloy_js_core.splitProps)(props, [
890
- "children",
891
- "imports",
892
- "id",
893
- "description",
894
- "tsx"
895
- ]);
896
- const context = usePowerlines();
897
- const path = (0, __alloy_js_core.computed)(() => (0, __stryke_path_replace.replacePath)(`${!(0, __stryke_type_checks_is_set.isSet)(tsx) ? id : (0, __stryke_path_replace.replaceExtension)(id)}${(0, __stryke_path_file_path_fns.hasFileExtension)(id) && !(0, __stryke_type_checks_is_set.isSet)(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context.builtinsPath));
898
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptFile, (0, __alloy_js_core_jsx_runtime.mergeProps)({
899
- get header() {
900
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptFileHeader, {
901
- get header() {
902
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocModule, {
903
- name: id,
904
- children: description
905
- });
906
- },
907
- get children() {
908
- return (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptFileHeaderImports, { imports });
909
- }
910
- });
911
- },
912
- get meta() {
913
- return {
914
- kind: "builtin",
915
- id: (0, __stryke_path_replace.replaceExtension)(id)
916
- };
917
- }
918
- }, rest, {
919
- get path() {
920
- return path.value;
921
- },
922
- children
923
- }));
924
- }
925
-
926
- //#endregion
927
- //#region src/components/react-optimized.tsx
928
- const isOptimizationEnabledRefkey = refkey("isOptimizationEnabled");
929
- /**
930
- * Generates the `react/optimized` builtin module for the Powerlines project.
931
- */
932
- function ReactOptimizedBuiltin(props) {
933
- const [{ override }, rest] = (0, __alloy_js_core.splitProps)(props, ["override"]);
934
- return (0, __alloy_js_core_jsx_runtime.createComponent)(BuiltinFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
935
- id: "react/optimized",
936
- description: "A built-in module to provide access to environment configuration to determine React optimizations.",
937
- get imports() {
938
- return (0, defu.default)({ $builtins: { env: ["env", "isDevelopment"] } }, rest.imports ?? {});
939
- },
940
- get children() {
941
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(TSDoc, {
942
- heading: "A gating function to determine if the optimized [React compiler](https://react.dev/reference/react-compiler) source code should be used.",
943
- get children() {
944
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(TSDocLink, { children: `https://react.dev/reference/react-compiler/gating` }), (0, __alloy_js_core_jsx_runtime.createComponent)(TSDocReturns, { children: `A boolean indicating if the React compiler's optimizations should be used.` })];
945
- }
946
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
947
- refkey: isOptimizationEnabledRefkey,
948
- async: false,
949
- "export": true,
950
- name: "isOptimizationEnabled",
951
- returnType: "boolean",
952
- get children() {
953
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
954
- when: override !== void 0,
955
- fallback: __alloy_js_core.code`return !env.DISABLE_REACT_COMPILER && !isDevelopment; `,
956
- children: __alloy_js_core.code`return ${override};`
957
- }), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
958
- }
959
- })];
960
- }
961
- }));
962
- }
963
-
964
- //#endregion
965
- Object.defineProperty(exports, 'BuiltinFile', {
966
- enumerable: true,
967
- get: function () {
968
- return BuiltinFile;
969
- }
970
- });
971
- Object.defineProperty(exports, 'PowerlinesContext', {
972
- enumerable: true,
973
- get: function () {
974
- return PowerlinesContext;
975
- }
976
- });
977
- Object.defineProperty(exports, 'ReactOptimizedBuiltin', {
978
- enumerable: true,
979
- get: function () {
980
- return ReactOptimizedBuiltin;
981
- }
982
- });
983
- Object.defineProperty(exports, 'ReflectionClassContext', {
984
- enumerable: true,
985
- get: function () {
986
- return ReflectionClassContext;
987
- }
988
- });
989
- Object.defineProperty(exports, 'ReflectionPropertyContext', {
990
- enumerable: true,
991
- get: function () {
992
- return ReflectionPropertyContext;
993
- }
994
- });
995
- Object.defineProperty(exports, 'TSDoc', {
996
- enumerable: true,
997
- get: function () {
998
- return TSDoc;
999
- }
1000
- });
1001
- Object.defineProperty(exports, 'TSDocAttributesTags', {
1002
- enumerable: true,
1003
- get: function () {
1004
- return TSDocAttributesTags;
1005
- }
1006
- });
1007
- Object.defineProperty(exports, 'TSDocExample', {
1008
- enumerable: true,
1009
- get: function () {
1010
- return TSDocExample;
1011
- }
1012
- });
1013
- Object.defineProperty(exports, 'TSDocLink', {
1014
- enumerable: true,
1015
- get: function () {
1016
- return TSDocLink;
1017
- }
1018
- });
1019
- Object.defineProperty(exports, 'TSDocParam', {
1020
- enumerable: true,
1021
- get: function () {
1022
- return TSDocParam;
1023
- }
1024
- });
1025
- Object.defineProperty(exports, 'TSDocRemarks', {
1026
- enumerable: true,
1027
- get: function () {
1028
- return TSDocRemarks;
1029
- }
1030
- });
1031
- Object.defineProperty(exports, 'TSDocReturns', {
1032
- enumerable: true,
1033
- get: function () {
1034
- return TSDocReturns;
1035
- }
1036
- });
1037
- Object.defineProperty(exports, 'TSDocThrows', {
1038
- enumerable: true,
1039
- get: function () {
1040
- return TSDocThrows;
1041
- }
1042
- });
1043
- Object.defineProperty(exports, '__toESM', {
1044
- enumerable: true,
1045
- get: function () {
1046
- return __toESM;
1047
- }
1048
- });
1049
- Object.defineProperty(exports, 'refkey', {
1050
- enumerable: true,
1051
- get: function () {
1052
- return refkey;
1053
- }
1054
- });
1055
- Object.defineProperty(exports, 'stringifyDefaultValue', {
1056
- enumerable: true,
1057
- get: function () {
1058
- return stringifyDefaultValue;
1059
- }
1060
- });
1061
- Object.defineProperty(exports, 'usePowerlines', {
1062
- enumerable: true,
1063
- get: function () {
1064
- return usePowerlines;
1065
- }
1066
- });
1067
- Object.defineProperty(exports, 'useReflectionClass', {
1068
- enumerable: true,
1069
- get: function () {
1070
- return useReflectionClass;
1071
- }
1072
- });
1073
- Object.defineProperty(exports, 'useReflectionProperty', {
1074
- enumerable: true,
1075
- get: function () {
1076
- return useReflectionProperty;
1077
- }
1078
- });