@powerlines/plugin-env 0.15.2 → 0.15.4

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 (231) hide show
  1. package/dist/components/docs.cjs +3 -70
  2. package/dist/components/docs.d.cts +1 -8
  3. package/dist/components/docs.d.mts +1 -8
  4. package/dist/components/docs.mjs +2 -68
  5. package/dist/components/env.cjs +4 -574
  6. package/dist/components/env.d.cts +2 -19
  7. package/dist/components/env.d.mts +3 -19
  8. package/dist/components/env.mjs +2 -570
  9. package/dist/components/index.cjs +7 -5
  10. package/dist/components/index.d.cts +4 -2
  11. package/dist/components/index.d.mts +5 -2
  12. package/dist/components/index.mjs +4 -2
  13. package/dist/{plugin-alloy/src/types/components.d.cts → components-8W0Zgj0y.d.mts} +2 -1
  14. package/dist/components-C9bYrQVK.cjs +0 -0
  15. package/dist/components-CNIQFfeK.mjs +1 -0
  16. package/dist/create-reflection-resource-BNYxBgW2.mjs +9846 -0
  17. package/dist/create-reflection-resource-BWYhmX7O.cjs +10085 -0
  18. package/dist/docs-5r844zC1.d.mts +9 -0
  19. package/dist/docs-B66b9li3.mjs +219 -0
  20. package/dist/docs-_MmTNBQX.d.cts +9 -0
  21. package/dist/docs-hBlKCRWK.cjs +224 -0
  22. package/dist/env-BPodCdD1.d.cts +116 -0
  23. package/dist/env-IQvgnabX.mjs +1578 -0
  24. package/dist/env-cO4BUDn1.cjs +1596 -0
  25. package/dist/env-zhzvpUI5.d.mts +98 -0
  26. package/dist/index-BXxhKmeA.d.mts +1 -0
  27. package/dist/index-Cc7fCJU9.d.mts +1 -0
  28. package/dist/index-CqdNToYT.d.cts +1 -0
  29. package/dist/index-DWPDThxu.d.cts +1 -0
  30. package/dist/index.cjs +702 -77
  31. package/dist/index.d.cts +185 -12
  32. package/dist/index.d.mts +190 -17
  33. package/dist/index.mjs +648 -28
  34. package/dist/{deepkit/schemas/reflection.d.mts → plugin-BaInAuAh.d.mts} +326 -59
  35. package/dist/{deepkit/schemas/reflection.d.cts → plugin-BwuEBScL.d.cts} +268 -1
  36. package/dist/plugin-D3B5E_Hg.mjs +1 -0
  37. package/dist/plugin-D5qyQPqC.cjs +0 -0
  38. package/dist/resolved-BZG2cwRG.d.cts +1789 -0
  39. package/dist/resolved-V5COsfDu.d.mts +1791 -0
  40. package/dist/runtime-Bisl_1Ja.cjs +0 -0
  41. package/dist/runtime-Q8Ni8SeN.d.cts +794 -0
  42. package/dist/runtime-azNoeKr-.mjs +1 -0
  43. package/dist/runtime-qZ0Z2kEd.d.mts +794 -0
  44. package/dist/types/index.cjs +3 -0
  45. package/dist/types/index.d.cts +4 -2
  46. package/dist/types/index.d.mts +5 -2
  47. package/dist/types/index.mjs +4 -0
  48. package/dist/types/plugin.cjs +1 -0
  49. package/dist/types/plugin.d.cts +3 -156
  50. package/dist/types/plugin.d.mts +4 -158
  51. package/dist/types/plugin.mjs +2 -0
  52. package/dist/types/runtime.cjs +1 -0
  53. package/dist/types/runtime.d.cts +2 -793
  54. package/dist/types/runtime.d.mts +2 -793
  55. package/dist/types/runtime.mjs +2 -0
  56. package/dist/types-DwElXV6q.mjs +1 -0
  57. package/dist/types-MYBaygjr.cjs +0 -0
  58. package/package.json +7 -7
  59. package/dist/_virtual/rolldown_runtime.cjs +0 -37
  60. package/dist/_virtual/rolldown_runtime.mjs +0 -29
  61. package/dist/babel/index.cjs +0 -1
  62. package/dist/babel/index.d.mts +0 -1
  63. package/dist/babel/index.mjs +0 -3
  64. package/dist/babel/plugin.cjs +0 -121
  65. package/dist/babel/plugin.d.cts +0 -7
  66. package/dist/babel/plugin.d.mts +0 -9
  67. package/dist/babel/plugin.mjs +0 -119
  68. package/dist/deepkit/schemas/reflection.cjs +0 -3940
  69. package/dist/deepkit/schemas/reflection.mjs +0 -3938
  70. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  71. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  72. package/dist/deepkit/src/capnp.cjs +0 -913
  73. package/dist/deepkit/src/capnp.mjs +0 -911
  74. package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
  75. package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
  76. package/dist/deepkit/src/reflect-type.cjs +0 -22
  77. package/dist/deepkit/src/reflect-type.mjs +0 -20
  78. package/dist/deepkit/src/resolve-reflections.cjs +0 -16
  79. package/dist/deepkit/src/resolve-reflections.mjs +0 -15
  80. package/dist/deepkit/src/transformer.cjs +0 -52
  81. package/dist/deepkit/src/transformer.mjs +0 -49
  82. package/dist/deepkit/src/transpile.cjs +0 -29
  83. package/dist/deepkit/src/transpile.mjs +0 -27
  84. package/dist/deepkit/src/types.d.cts +0 -10
  85. package/dist/deepkit/src/types.d.mts +0 -10
  86. package/dist/deepkit/src/utilities.cjs +0 -66
  87. package/dist/deepkit/src/utilities.mjs +0 -65
  88. package/dist/deepkit/src/vendor/type-compiler/index.cjs +0 -38
  89. package/dist/deepkit/src/vendor/type-compiler/index.mjs +0 -19
  90. package/dist/deepkit/src/vendor/type.cjs +0 -20
  91. package/dist/deepkit/src/vendor/type.d.cts +0 -7
  92. package/dist/deepkit/src/vendor/type.d.mts +0 -7
  93. package/dist/deepkit/src/vendor/type.mjs +0 -11
  94. package/dist/helpers/automd-generator.cjs +0 -22
  95. package/dist/helpers/automd-generator.mjs +0 -21
  96. package/dist/helpers/create-reflection-resource.cjs +0 -55
  97. package/dist/helpers/create-reflection-resource.d.cts +0 -15
  98. package/dist/helpers/create-reflection-resource.d.mts +0 -15
  99. package/dist/helpers/create-reflection-resource.mjs +0 -54
  100. package/dist/helpers/index.cjs +0 -6
  101. package/dist/helpers/index.d.mts +0 -6
  102. package/dist/helpers/index.mjs +0 -8
  103. package/dist/helpers/load.cjs +0 -83
  104. package/dist/helpers/load.d.cts +0 -35
  105. package/dist/helpers/load.d.mts +0 -36
  106. package/dist/helpers/load.mjs +0 -80
  107. package/dist/helpers/persistence.cjs +0 -214
  108. package/dist/helpers/persistence.d.cts +0 -84
  109. package/dist/helpers/persistence.d.mts +0 -84
  110. package/dist/helpers/persistence.mjs +0 -202
  111. package/dist/helpers/reflect.cjs +0 -111
  112. package/dist/helpers/reflect.d.cts +0 -46
  113. package/dist/helpers/reflect.d.mts +0 -46
  114. package/dist/helpers/reflect.mjs +0 -103
  115. package/dist/helpers/source-file-env.cjs +0 -28
  116. package/dist/helpers/source-file-env.d.cts +0 -8
  117. package/dist/helpers/source-file-env.d.mts +0 -8
  118. package/dist/helpers/source-file-env.mjs +0 -26
  119. package/dist/helpers/template-helpers.cjs +0 -42
  120. package/dist/helpers/template-helpers.d.cts +0 -15
  121. package/dist/helpers/template-helpers.d.mts +0 -15
  122. package/dist/helpers/template-helpers.mjs +0 -41
  123. package/dist/plugin-alloy/src/core/components/output.cjs +0 -45
  124. package/dist/plugin-alloy/src/core/components/output.mjs +0 -44
  125. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -22
  126. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -21
  127. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -64
  128. package/dist/plugin-alloy/src/core/components/source-file.d.cts +0 -23
  129. package/dist/plugin-alloy/src/core/components/source-file.d.mts +0 -23
  130. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -62
  131. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -60
  132. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -54
  133. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  134. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  135. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
  136. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
  137. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
  138. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
  139. package/dist/plugin-alloy/src/index.cjs +0 -93
  140. package/dist/plugin-alloy/src/index.mjs +0 -91
  141. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -115
  142. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -114
  143. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -39
  144. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -38
  145. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -18
  146. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
  147. package/dist/plugin-alloy/src/types/components.d.mts +0 -25
  148. package/dist/plugin-alloy/src/types/index.d.mts +0 -2
  149. package/dist/plugin-alloy/src/types/plugin.d.cts +0 -37
  150. package/dist/plugin-alloy/src/types/plugin.d.mts +0 -37
  151. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -57
  152. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +0 -25
  153. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +0 -26
  154. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -56
  155. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -126
  156. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -124
  157. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -442
  158. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +0 -27
  159. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +0 -28
  160. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -433
  161. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -194
  162. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +0 -14
  163. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +0 -15
  164. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -191
  165. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -68
  166. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +0 -11
  167. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +0 -12
  168. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -67
  169. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -124
  170. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -123
  171. package/dist/plugin-automd/src/index.cjs +0 -101
  172. package/dist/plugin-automd/src/index.mjs +0 -98
  173. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  174. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  175. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  176. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  177. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
  178. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
  179. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
  180. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
  181. package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
  182. package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
  183. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  184. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  185. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
  186. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
  187. package/dist/plugin-babel/src/helpers/options.cjs +0 -50
  188. package/dist/plugin-babel/src/helpers/options.mjs +0 -47
  189. package/dist/plugin-babel/src/index.cjs +0 -91
  190. package/dist/plugin-babel/src/index.mjs +0 -89
  191. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  192. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  193. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  194. package/dist/powerlines/schemas/fs.d.mts +0 -1
  195. package/dist/powerlines/src/api.d.mts +0 -7
  196. package/dist/powerlines/src/index.d.mts +0 -12
  197. package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -5
  198. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
  199. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
  200. package/dist/powerlines/src/lib/entry.cjs +0 -12
  201. package/dist/powerlines/src/lib/entry.mjs +0 -14
  202. package/dist/powerlines/src/lib/logger.cjs +0 -41
  203. package/dist/powerlines/src/lib/logger.mjs +0 -39
  204. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -35
  205. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -34
  206. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -30
  207. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -29
  208. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  209. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
  210. package/dist/powerlines/src/types/api.d.mts +0 -5
  211. package/dist/powerlines/src/types/babel.d.cts +0 -23
  212. package/dist/powerlines/src/types/babel.d.mts +0 -23
  213. package/dist/powerlines/src/types/build.d.cts +0 -145
  214. package/dist/powerlines/src/types/build.d.mts +0 -147
  215. package/dist/powerlines/src/types/commands.d.cts +0 -8
  216. package/dist/powerlines/src/types/commands.d.mts +0 -9
  217. package/dist/powerlines/src/types/config.d.cts +0 -380
  218. package/dist/powerlines/src/types/config.d.mts +0 -381
  219. package/dist/powerlines/src/types/context.d.cts +0 -414
  220. package/dist/powerlines/src/types/context.d.mts +0 -416
  221. package/dist/powerlines/src/types/fs.d.cts +0 -486
  222. package/dist/powerlines/src/types/fs.d.mts +0 -486
  223. package/dist/powerlines/src/types/hooks.d.mts +0 -2
  224. package/dist/powerlines/src/types/index.d.mts +0 -12
  225. package/dist/powerlines/src/types/plugin.d.cts +0 -231
  226. package/dist/powerlines/src/types/plugin.d.mts +0 -231
  227. package/dist/powerlines/src/types/resolved.d.cts +0 -82
  228. package/dist/powerlines/src/types/resolved.d.mts +0 -83
  229. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  230. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
  231. package/dist/powerlines/src/types/unplugin.d.mts +0 -7
@@ -0,0 +1,1578 @@
1
+ import { P as usePowerlines, c as ReflectionPropertyContext, d as SingleLineComment, l as useReflectionClass, o as SourceFile, r as loadEnvFromContext, s as ReflectionClassContext, t as createReflectionResource, u as useReflectionProperty } from "./create-reflection-resource-BNYxBgW2.mjs";
2
+ import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
3
+ import { ReflectionClass, ReflectionKind, stringifyType } from "@powerlines/deepkit/vendor/type";
4
+ import { Declaration, For, List, Name, Prose, Scope, Show, SourceDirectoryContext, childrenArray, code, computed, createSymbolSlot, refkey, splitProps, useContext, useScope } from "@alloy-js/core";
5
+ import { StormJSON } from "@stryke/json/storm-json";
6
+ import { replaceExtension, replacePath } from "@stryke/path/replace";
7
+ import { appendPath } from "@stryke/path/append";
8
+ import defu from "defu";
9
+ import { hasFileExtension } from "@stryke/path/file-path-fns";
10
+ import { isSetString } from "@stryke/type-checks/is-set-string";
11
+ import { titleCase } from "@stryke/string-format/title-case";
12
+ import { isString } from "@stryke/type-checks/is-string";
13
+ import { getUniqueBy } from "@stryke/helpers/get-unique";
14
+ import { isNull } from "@stryke/type-checks/is-null";
15
+ import { isUndefined } from "@stryke/type-checks/is-undefined";
16
+ import { camelCase } from "@stryke/string-format/camel-case";
17
+ import { ClassDeclaration, ClassMethod, ElseIfClause, FunctionDeclaration, IfStatement, ImportStatements, InterfaceDeclaration, InterfaceMember, NewExpression, ObjectExpression, ObjectProperty, PackageContext, SourceFileContext as SourceFileContext$1, TSModuleScope, TSSymbolFlags, TypeDeclaration, TypeRefContext, VarDeclaration, createValueSymbol, getSourceDirectoryData, useSourceFile, useTSNamePolicy } from "@alloy-js/typescript";
18
+ import { isSet } from "@stryke/type-checks/is-set";
19
+ import { isBoolean } from "@stryke/type-checks/is-boolean";
20
+ import { pascalCase } from "@stryke/string-format/pascal-case";
21
+
22
+ //#region ../deepkit/src/utilities.ts
23
+ /**
24
+ * Converts any {@link ReflectionProperty} or {@link ReflectionParameter}'s value to string representation.
25
+ *
26
+ * @param property - The {@link ReflectionProperty} or {@link ReflectionParameter} containing the value to stringify.
27
+ * @param value - The value to stringify.
28
+ * @returns A string representation of the value.
29
+ */
30
+ function stringifyDefaultValue(property, value) {
31
+ return stringifyValue(property.type, value ?? property.getDefaultValue());
32
+ }
33
+ /**
34
+ * Stringifies a value as a string.
35
+ *
36
+ * @param value - The value to stringify.
37
+ * @returns A string representation of the value.
38
+ */
39
+ function stringifyStringValue(value) {
40
+ return `"${String(value).replaceAll("\"", "\\\"")}"`;
41
+ }
42
+ /**
43
+ * Converts any {@link Type}'s actual value to string representation.
44
+ *
45
+ * @param type - The {@link Type} of the value to stringify.
46
+ * @param value - The value to stringify.
47
+ * @returns A string representation of the value.
48
+ */
49
+ function stringifyValue(type, value) {
50
+ 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);
51
+ }
52
+ /**
53
+ * Converts a {@link TypeEnum} to its underlying primitive type representation.
54
+ *
55
+ * @param type - The {@link TypeEnum} to evaluate.
56
+ * @returns A string representation of the primitive type.
57
+ */
58
+ function getEnumReflectionType(type) {
59
+ if (type.kind !== ReflectionKind.enum) throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
60
+ const unique = getUniqueBy(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString(enumMember) ? { kind: ReflectionKind.string } : { kind: ReflectionKind.number });
61
+ if (unique.length === 0) throw new Error(`No valid enum members could be found.`);
62
+ return unique[0] && isString(unique[0]) ? { kind: ReflectionKind.string } : { kind: ReflectionKind.number };
63
+ }
64
+ /**
65
+ * Converts a {@link TypeUnion} to its underlying primitive type representation.
66
+ *
67
+ * @param type - The {@link TypeUnion} to evaluate.
68
+ * @returns A string representation of the primitive type.
69
+ */
70
+ function getUnionTypes(type) {
71
+ if (type.kind === ReflectionKind.union && type.types.length > 0) return getUniqueBy(type.types, (member) => member.kind);
72
+ throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
73
+ }
74
+ function isStringUnion(type) {
75
+ return getUnionTypes(type).some((member) => member.kind === ReflectionKind.string || member.kind === ReflectionKind.literal && isString(member.literal));
76
+ }
77
+
78
+ //#endregion
79
+ //#region ../plugin-alloy/src/helpers/refkey.ts
80
+ /**
81
+ * 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.
82
+ *
83
+ * @remarks
84
+ * 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`
85
+ */
86
+ function refkey$1(...args) {
87
+ return refkey("powerlines", ...args);
88
+ }
89
+
90
+ //#endregion
91
+ //#region ../plugin-alloy/src/typescript/components/tsdoc.tsx
92
+ /**
93
+ * Generates a TypeScript interface for the given reflection class.
94
+ */
95
+ function TSDoc(props) {
96
+ const [{ children, heading }] = splitProps(props, ["children", "heading"]);
97
+ return [
98
+ "/**",
99
+ createIntrinsic("align", {
100
+ string: " * ",
101
+ get children() {
102
+ return [
103
+ createIntrinsic("hbr", {}),
104
+ createComponent(Show, {
105
+ get when() {
106
+ return !isUndefined(heading);
107
+ },
108
+ get children() {
109
+ return [
110
+ heading,
111
+ createIntrinsic("hbr", {}),
112
+ createComponent(Show, {
113
+ get when() {
114
+ return memo(() => !!!isUndefined(children))() && childrenArray(() => children).length > 0;
115
+ },
116
+ get children() {
117
+ return createIntrinsic("hbr", {});
118
+ }
119
+ })
120
+ ];
121
+ }
122
+ }),
123
+ createComponent(Show, {
124
+ get when() {
125
+ return memo(() => !!!isUndefined(children))() && childrenArray(() => children).length > 0;
126
+ },
127
+ get children() {
128
+ return createComponent(List, { get children() {
129
+ return childrenArray(() => children);
130
+ } });
131
+ }
132
+ })
133
+ ];
134
+ }
135
+ }),
136
+ createIntrinsic("hbr", {}),
137
+ ` */`,
138
+ createIntrinsic("hbr", {})
139
+ ];
140
+ }
141
+ /**
142
+ * Create a TSDoc `@<props.tag>` tag.
143
+ */
144
+ function TSDocTag(props) {
145
+ const [{ children, tag }] = splitProps(props, ["children", "tag"]);
146
+ return [
147
+ `@${tag} `,
148
+ createComponent(Show, {
149
+ get when() {
150
+ return Boolean(children);
151
+ },
152
+ get children() {
153
+ return createIntrinsic("align", {
154
+ width: 2,
155
+ get children() {
156
+ return createComponent(Prose, { children });
157
+ }
158
+ });
159
+ }
160
+ }),
161
+ createIntrinsic("hbr", {})
162
+ ];
163
+ }
164
+ /**
165
+ * Create a TSDoc `@title` tag.
166
+ */
167
+ function TSDocTitle(props) {
168
+ const [{ children }, rest] = splitProps(props, ["children"]);
169
+ return createComponent(TSDocTag, mergeProps(rest, {
170
+ tag: "title",
171
+ children
172
+ }));
173
+ }
174
+ /**
175
+ * Create a TSDoc `@domain` tag.
176
+ */
177
+ function TSDocDomain(props) {
178
+ const [{ children }, rest] = splitProps(props, ["children"]);
179
+ return createComponent(TSDocTag, mergeProps(rest, {
180
+ tag: "domain",
181
+ children
182
+ }));
183
+ }
184
+ /**
185
+ * Create a TSDoc `@alias` tag.
186
+ */
187
+ function TSDocAlias(props) {
188
+ const [{ children }, rest] = splitProps(props, ["children"]);
189
+ return createComponent(TSDocTag, mergeProps(rest, {
190
+ tag: "alias",
191
+ children
192
+ }));
193
+ }
194
+ /**
195
+ * Create a TSDoc `@permission` tag.
196
+ */
197
+ function TSDocPermission(props) {
198
+ const [{ children }, rest] = splitProps(props, ["children"]);
199
+ return createComponent(TSDocTag, mergeProps(rest, {
200
+ tag: "permission",
201
+ children
202
+ }));
203
+ }
204
+ /**
205
+ * Create a TSDoc `@defaultValue` tag.
206
+ */
207
+ function TSDocDefaultValue(props) {
208
+ return [
209
+ "@defaultValue ",
210
+ createComponent(Show, {
211
+ get when() {
212
+ return !isUndefined(props.value);
213
+ },
214
+ get children() {
215
+ return createIntrinsic("align", {
216
+ width: 2,
217
+ get children() {
218
+ return createComponent(Prose, { get children() {
219
+ return stringifyDefaultValue(props.value);
220
+ } });
221
+ }
222
+ });
223
+ }
224
+ }),
225
+ createIntrinsic("hbr", {})
226
+ ];
227
+ }
228
+ /**
229
+ * Create a TSDoc `@remarks` tag.
230
+ */
231
+ function TSDocRemarks(props) {
232
+ return [
233
+ "@remarks ",
234
+ createIntrinsic("hbr", {}),
235
+ createComponent(List, {
236
+ hardline: true,
237
+ get children() {
238
+ return childrenArray(() => props.children);
239
+ }
240
+ })
241
+ ];
242
+ }
243
+ /**
244
+ * Create a TSDoc `@see` tag.
245
+ */
246
+ function TSDocLink(props) {
247
+ return createComponent(TSDocTag, mergeProps(props, { tag: "see" }));
248
+ }
249
+ /**
250
+ * Create a TSDoc `@example` tag.
251
+ */
252
+ function TSDocExample(props) {
253
+ const [{ tsx, fenced = true, language, children }] = splitProps(props, [
254
+ "tsx",
255
+ "fenced",
256
+ "language",
257
+ "children"
258
+ ]);
259
+ return [
260
+ "@example ",
261
+ createIntrinsic("hbr", {}),
262
+ createComponent(Show, {
263
+ when: fenced,
264
+ get children() {
265
+ return [
266
+ "```",
267
+ language || (tsx ? "tsx" : "ts"),
268
+ createIntrinsic("hbr", {})
269
+ ];
270
+ }
271
+ }),
272
+ children,
273
+ createComponent(Show, {
274
+ when: fenced,
275
+ get children() {
276
+ return [createIntrinsic("hbr", {}), "```"];
277
+ }
278
+ })
279
+ ];
280
+ }
281
+ /**
282
+ * Create a TSDoc `@readonly` tag.
283
+ */
284
+ function TSDocReadonly() {
285
+ return createComponent(TSDocTag, { tag: "readonly" });
286
+ }
287
+ /**
288
+ * Create a TSDoc `@internal` tag.
289
+ */
290
+ function TSDocInternal() {
291
+ return createComponent(TSDocTag, { tag: "internal" });
292
+ }
293
+ /**
294
+ * Create a TSDoc `@ignore` tag.
295
+ */
296
+ function TSDocIgnore() {
297
+ return createComponent(TSDocTag, { tag: "ignore" });
298
+ }
299
+ /**
300
+ * Create a TSDoc `@hidden` tag.
301
+ */
302
+ function TSDocHidden() {
303
+ return createComponent(TSDocTag, { tag: "hidden" });
304
+ }
305
+ /**
306
+ * Generates a TypeScript interface property for the given reflection class.
307
+ */
308
+ function TSDocAttributesTags(props) {
309
+ const [{ title, alias, permission, domain, readonly, internal, ignore, hidden, defaultValue }] = splitProps(props, [
310
+ "title",
311
+ "alias",
312
+ "permission",
313
+ "domain",
314
+ "readonly",
315
+ "internal",
316
+ "ignore",
317
+ "hidden",
318
+ "defaultValue"
319
+ ]);
320
+ return [
321
+ createComponent(Show, {
322
+ get when() {
323
+ return isSetString(title);
324
+ },
325
+ get children() {
326
+ return createComponent(TSDocTitle, { children: title });
327
+ }
328
+ }),
329
+ createComponent(Show, {
330
+ get when() {
331
+ return !isUndefined(alias) && alias.length > 0;
332
+ },
333
+ get children() {
334
+ return createComponent(For, {
335
+ each: alias ?? [],
336
+ children: (alias$1) => createComponent(TSDocAlias, { children: alias$1 })
337
+ });
338
+ }
339
+ }),
340
+ createComponent(Show, {
341
+ get when() {
342
+ return isSetString(domain);
343
+ },
344
+ get children() {
345
+ return createComponent(TSDocDomain, { children: domain });
346
+ }
347
+ }),
348
+ createComponent(Show, {
349
+ get when() {
350
+ return !isUndefined(permission) && permission.length > 0;
351
+ },
352
+ get children() {
353
+ return createComponent(For, {
354
+ each: permission ?? [],
355
+ children: (permission$1) => createComponent(TSDocPermission, { children: permission$1 })
356
+ });
357
+ }
358
+ }),
359
+ createComponent(Show, {
360
+ when: readonly === true,
361
+ get children() {
362
+ return createComponent(TSDocReadonly, {});
363
+ }
364
+ }),
365
+ createComponent(Show, {
366
+ when: internal === true,
367
+ get children() {
368
+ return createComponent(TSDocInternal, {});
369
+ }
370
+ }),
371
+ createComponent(Show, {
372
+ when: ignore === true,
373
+ get children() {
374
+ return createComponent(TSDocIgnore, {});
375
+ }
376
+ }),
377
+ createComponent(Show, {
378
+ when: hidden === true,
379
+ get children() {
380
+ return createComponent(TSDocHidden, {});
381
+ }
382
+ }),
383
+ createComponent(Show, {
384
+ get when() {
385
+ return !isUndefined(defaultValue);
386
+ },
387
+ get children() {
388
+ return createComponent(TSDocDefaultValue, { value: defaultValue });
389
+ }
390
+ })
391
+ ];
392
+ }
393
+ /**
394
+ * Create a TSDoc parameter set off with `@param`.
395
+ */
396
+ function TSDocParam(props) {
397
+ return [
398
+ "@param ",
399
+ createComponent(TSDocParamName, {
400
+ get name() {
401
+ return props.name;
402
+ },
403
+ get optional() {
404
+ return props.optional;
405
+ },
406
+ get defaultValue() {
407
+ return props.defaultValue;
408
+ }
409
+ }),
410
+ createComponent(TSDocParamDescription, { get children() {
411
+ return props.children;
412
+ } })
413
+ ];
414
+ }
415
+ function TSDocParamName(props) {
416
+ return [
417
+ createComponent(Show, {
418
+ get when() {
419
+ return props.optional;
420
+ },
421
+ children: "["
422
+ }),
423
+ memo(() => props.name),
424
+ createComponent(Show, {
425
+ get when() {
426
+ return Boolean(props.defaultValue);
427
+ },
428
+ get children() {
429
+ return ["=", memo(() => props.defaultValue)];
430
+ }
431
+ }),
432
+ createComponent(Show, {
433
+ get when() {
434
+ return props.optional;
435
+ },
436
+ children: "]"
437
+ })
438
+ ];
439
+ }
440
+ function TSDocParamDescription(props) {
441
+ return createComponent(Show, {
442
+ get when() {
443
+ return Boolean(props.children);
444
+ },
445
+ get children() {
446
+ return [" - ", createIntrinsic("align", {
447
+ width: 2,
448
+ get children() {
449
+ return createComponent(Prose, { get children() {
450
+ return props.children;
451
+ } });
452
+ }
453
+ })];
454
+ }
455
+ });
456
+ }
457
+ /**
458
+ * Create a TSDoc `@returns` tag.
459
+ */
460
+ function TSDocReturns(props) {
461
+ return createComponent(TSDocTag, mergeProps(props, { tag: "returns" }));
462
+ }
463
+ /**
464
+ * Create a TSDoc `@throws` tag.
465
+ */
466
+ function TSDocThrows(props) {
467
+ return createComponent(TSDocTag, mergeProps(props, { tag: "throws" }));
468
+ }
469
+ /**
470
+ * Generates a TSDoc `@module` tag for the given module name.
471
+ */
472
+ function TSDocModule(props) {
473
+ const [{ children, name, prefix }] = splitProps(props, [
474
+ "children",
475
+ "name",
476
+ "prefix"
477
+ ]);
478
+ const context = usePowerlines();
479
+ return [
480
+ "/**",
481
+ createIntrinsic("align", {
482
+ string: " * ",
483
+ get children() {
484
+ return [
485
+ createIntrinsic("hbr", {}),
486
+ createComponent(Show, {
487
+ get when() {
488
+ return Boolean(children);
489
+ },
490
+ get children() {
491
+ return [
492
+ createComponent(List, {
493
+ hardline: true,
494
+ get children() {
495
+ return childrenArray(() => children);
496
+ }
497
+ }),
498
+ createIntrinsic("hbr", {}),
499
+ createIntrinsic("hbr", {})
500
+ ];
501
+ }
502
+ }),
503
+ "@module ",
504
+ memo(() => prefix || context?.config.output.builtinPrefix),
505
+ ":",
506
+ name
507
+ ];
508
+ }
509
+ }),
510
+ createIntrinsic("hbr", {}),
511
+ ` */`
512
+ ];
513
+ }
514
+
515
+ //#endregion
516
+ //#region ../plugin-alloy/src/typescript/components/typescript-file.tsx
517
+ /**
518
+ * A base component representing a Powerlines generated Typescript source file.
519
+ *
520
+ * @param props - The properties for the source file.
521
+ * @returns The rendered source file component.
522
+ */
523
+ function TypescriptFile(props) {
524
+ const [{ children, path, imports, tsx, header, hashbang }, rest] = splitProps(props, [
525
+ "children",
526
+ "path",
527
+ "imports",
528
+ "tsx",
529
+ "header",
530
+ "hashbang"
531
+ ]);
532
+ const directoryContext = useContext(SourceDirectoryContext);
533
+ const sdData = getSourceDirectoryData(directoryContext);
534
+ const modulePath = appendPath(path, directoryContext.path);
535
+ const scope = new TSModuleScope(modulePath, useScope());
536
+ sdData.modules.add(scope);
537
+ const pkg = useContext(PackageContext);
538
+ if (pkg) pkg.scope.addModule(scope);
539
+ if (props.export) {
540
+ if (pkg) if (isBoolean(props.export)) pkg.scope.addExport(modulePath, scope);
541
+ else pkg.scope.addExport(props.export, scope);
542
+ }
543
+ return createComponent(SourceFileContext$1.Provider, {
544
+ value: { scope },
545
+ get children() {
546
+ return createComponent(Scope, {
547
+ value: scope,
548
+ get children() {
549
+ return createComponent(SourceFile, mergeProps(rest, {
550
+ path: modulePath,
551
+ get header() {
552
+ return header ?? createComponent(TypescriptFileHeader, {
553
+ hashbang,
554
+ get children() {
555
+ return createComponent(TypescriptFileHeaderImports, {
556
+ imports,
557
+ scope
558
+ });
559
+ }
560
+ });
561
+ },
562
+ filetype: tsx ? "tsx" : "typescript",
563
+ children
564
+ }));
565
+ }
566
+ });
567
+ }
568
+ });
569
+ }
570
+ /**
571
+ * Renders the header for a Powerlines Typescript source file.
572
+ *
573
+ * @param props - The properties for the source file header.
574
+ * @returns The rendered source file header.
575
+ */
576
+ function TypescriptFileHeader(props) {
577
+ const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
578
+ const context = usePowerlines();
579
+ return [
580
+ createComponent(Show, {
581
+ get when() {
582
+ return Boolean(hashbang);
583
+ },
584
+ get children() {
585
+ return [memo(() => hashbang === true ? code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang), createIntrinsic("hbr", {})];
586
+ }
587
+ }),
588
+ createComponent(Show, {
589
+ get when() {
590
+ return Boolean(header);
591
+ },
592
+ get children() {
593
+ return [header, createIntrinsic("hbr", {})];
594
+ }
595
+ }),
596
+ createIntrinsic("hbr", {}),
597
+ createComponent(Show, {
598
+ get when() {
599
+ return Boolean(disableEslint);
600
+ },
601
+ get children() {
602
+ return [createComponent(SingleLineComment, {
603
+ variant: "slash-star",
604
+ children: "eslint-disable"
605
+ }), createIntrinsic("hbr", {})];
606
+ }
607
+ }),
608
+ createComponent(Show, {
609
+ get when() {
610
+ return Boolean(disablePrettier);
611
+ },
612
+ get children() {
613
+ return [createComponent(SingleLineComment, {
614
+ variant: "slash-star",
615
+ children: "prettier-ignore"
616
+ }), createIntrinsic("hbr", {})];
617
+ }
618
+ }),
619
+ createComponent(Show, {
620
+ get when() {
621
+ return Boolean(disableBiome);
622
+ },
623
+ get children() {
624
+ return [createComponent(SingleLineComment, { children: "biome-ignore lint: disable" }), createIntrinsic("hbr", {})];
625
+ }
626
+ }),
627
+ createComponent(Show, {
628
+ get when() {
629
+ return Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome);
630
+ },
631
+ get children() {
632
+ return createIntrinsic("hbr", {});
633
+ }
634
+ }),
635
+ createComponent(Show, {
636
+ get when() {
637
+ return Boolean(children);
638
+ },
639
+ get children() {
640
+ return [children, createIntrinsic("hbr", {})];
641
+ }
642
+ }),
643
+ createComponent(SingleLineComment, { get children() {
644
+ return code`Generated by ${titleCase(context?.config.framework) || "Powerlines"}`;
645
+ } }),
646
+ createIntrinsic("hbr", {}),
647
+ createComponent(SingleLineComment, { children: code`NOTE: Do not edit this file manually - it will be overwritten automatically by the "prepare" command` }),
648
+ createIntrinsic("hbr", {})
649
+ ];
650
+ }
651
+ /**
652
+ * Renders the header for a Powerlines Typescript source file.
653
+ *
654
+ * @param props - The properties for the source file header.
655
+ * @returns The rendered source file header.
656
+ */
657
+ function TypescriptFileHeaderImports(props) {
658
+ const { imports } = props;
659
+ const context = usePowerlines();
660
+ const sourceFile = useSourceFile();
661
+ const scope = props.scope ?? sourceFile.scope;
662
+ return createComponent(Show, {
663
+ get when() {
664
+ return scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0;
665
+ },
666
+ get children() {
667
+ return [
668
+ createComponent(Show, {
669
+ get when() {
670
+ return !!imports && Object.keys(imports).length > 0;
671
+ },
672
+ get children() {
673
+ 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, imported]) => {
674
+ return code`import ${imported === null ? "" : imported.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (imported.filter((i) => !isString(i) && i.default).length > 0 && imported.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (imported.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${imported.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} from "${module}";`;
675
+ });
676
+ }
677
+ }),
678
+ createComponent(Show, {
679
+ get when() {
680
+ return scope.importedModules.size > 0;
681
+ },
682
+ get children() {
683
+ return createComponent(ImportStatements, { get records() {
684
+ return scope.importedModules;
685
+ } });
686
+ }
687
+ }),
688
+ createIntrinsic("hbr", {})
689
+ ];
690
+ }
691
+ });
692
+ }
693
+
694
+ //#endregion
695
+ //#region ../plugin-alloy/src/typescript/components/builtin-file.tsx
696
+ /**
697
+ * A base component representing a Powerlines generated Typescript source file.
698
+ *
699
+ * @param props - The properties for the source file.
700
+ * @returns The rendered source file component.
701
+ */
702
+ function BuiltinFile(props) {
703
+ const [{ children, imports, id, description, tsx }, rest] = splitProps(props, [
704
+ "children",
705
+ "imports",
706
+ "id",
707
+ "description",
708
+ "tsx"
709
+ ]);
710
+ const context = usePowerlines();
711
+ const path = computed(() => replacePath(`${!isSet(tsx) ? id : replaceExtension(id)}${hasFileExtension(id) && !isSet(tsx) ? "" : tsx ? ".tsx" : ".ts"}`, context.builtinsPath));
712
+ return createComponent(TypescriptFile, mergeProps({
713
+ get header() {
714
+ return createComponent(TypescriptFileHeader, {
715
+ get header() {
716
+ return createComponent(TSDocModule, {
717
+ name: id,
718
+ children: description
719
+ });
720
+ },
721
+ get children() {
722
+ return createComponent(TypescriptFileHeaderImports, { imports });
723
+ }
724
+ });
725
+ },
726
+ get meta() {
727
+ return {
728
+ kind: "builtin",
729
+ id: replaceExtension(id)
730
+ };
731
+ }
732
+ }, rest, {
733
+ get path() {
734
+ return path.value;
735
+ },
736
+ children
737
+ }));
738
+ }
739
+
740
+ //#endregion
741
+ //#region ../plugin-alloy/src/typescript/components/tsdoc-reflection.tsx
742
+ /**
743
+ * Generates a TypeScript interface property for the given reflection class.
744
+ */
745
+ function TSDocReflectionClass(props) {
746
+ const [{ children }, rest] = splitProps(props, ["children"]);
747
+ const reflectionClass = useReflectionClass();
748
+ const title = computed(() => reflectionClass.reflection.getTitle() || titleCase(reflectionClass.reflection.getName()));
749
+ const alias = computed(() => reflectionClass.reflection.getAlias());
750
+ const domain = computed(() => reflectionClass.reflection.getDomain());
751
+ const permission = computed(() => reflectionClass.reflection.getPermission());
752
+ const readonly = computed(() => reflectionClass.reflection.isReadonly());
753
+ const internal = computed(() => reflectionClass.reflection.isInternal());
754
+ const ignore = computed(() => reflectionClass.reflection.isIgnored());
755
+ const hidden = computed(() => reflectionClass.reflection.isHidden());
756
+ if (!reflectionClass.reflection.getName()) return null;
757
+ return createComponent(TSDoc, mergeProps(rest, {
758
+ get heading() {
759
+ return reflectionClass.reflection.getDescription();
760
+ },
761
+ get children() {
762
+ return [createComponent(Show, {
763
+ get when() {
764
+ return isSetString(title.value) || !isUndefined(alias.value) && alias.value.length > 0 || !isUndefined(permission.value) && permission.value.length > 0 || isSetString(domain.value) || !isUndefined(readonly.value) || !isUndefined(internal.value) || !isUndefined(ignore.value) || !isUndefined(hidden.value);
765
+ },
766
+ get children() {
767
+ return createComponent(TSDocAttributesTags, {
768
+ get title() {
769
+ return title.value;
770
+ },
771
+ get alias() {
772
+ return alias.value;
773
+ },
774
+ get domain() {
775
+ return domain.value;
776
+ },
777
+ get permission() {
778
+ return permission.value;
779
+ },
780
+ get readonly() {
781
+ return readonly.value;
782
+ },
783
+ get internal() {
784
+ return internal.value;
785
+ },
786
+ get ignore() {
787
+ return ignore.value;
788
+ },
789
+ get hidden() {
790
+ return hidden.value;
791
+ }
792
+ });
793
+ }
794
+ }), createComponent(Show, {
795
+ get when() {
796
+ return memo(() => !!Boolean(children))() && childrenArray(() => children).length > 0;
797
+ },
798
+ get children() {
799
+ return createComponent(List, { get children() {
800
+ return childrenArray(() => children);
801
+ } });
802
+ }
803
+ })];
804
+ }
805
+ }));
806
+ }
807
+ /**
808
+ * Generates a TypeScript interface property for the given reflection class.
809
+ */
810
+ function TSDocReflectionProperty(props) {
811
+ const [{ children }, rest] = splitProps(props, ["children"]);
812
+ const context = useReflectionProperty();
813
+ return createComponent(TSDoc, mergeProps({ get heading() {
814
+ return context.getDescription();
815
+ } }, rest, { get children() {
816
+ return [createComponent(TSDocAttributesTags, {
817
+ get title() {
818
+ return context.getTitle();
819
+ },
820
+ get alias() {
821
+ return context.getAlias();
822
+ },
823
+ get domain() {
824
+ return context.getDomain();
825
+ },
826
+ get permission() {
827
+ return context.getPermission();
828
+ },
829
+ get readonly() {
830
+ return context.isReadonly();
831
+ },
832
+ get internal() {
833
+ return context.isInternal();
834
+ },
835
+ get ignore() {
836
+ return context.isIgnored();
837
+ },
838
+ get hidden() {
839
+ return context.isHidden();
840
+ }
841
+ }), createComponent(Show, {
842
+ get when() {
843
+ return memo(() => !!Boolean(children))() && childrenArray(() => children).length > 0;
844
+ },
845
+ get children() {
846
+ return createComponent(List, { get children() {
847
+ return childrenArray(() => children);
848
+ } });
849
+ }
850
+ })];
851
+ } }));
852
+ }
853
+
854
+ //#endregion
855
+ //#region ../plugin-alloy/src/typescript/components/typescript-interface.tsx
856
+ /**
857
+ * Generates a TypeScript interface for the given reflection class.
858
+ */
859
+ function TypeScriptInterface(props) {
860
+ const [{ name, reflection }, rest] = splitProps(props, ["name", "reflection"]);
861
+ const interfaceName = computed(() => pascalCase((isString(name) ? name : name.toString()) || reflection.getName()));
862
+ const properties = reflection.getProperties().filter((item) => !item.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1);
863
+ return createComponent(ReflectionClassContext.Provider, {
864
+ value: { reflection },
865
+ get children() {
866
+ return [createComponent(TSDocReflectionClass, {}), createComponent(InterfaceDeclaration, mergeProps({
867
+ "export": true,
868
+ get name() {
869
+ return interfaceName.value;
870
+ }
871
+ }, rest, { get children() {
872
+ return createComponent(For, {
873
+ each: properties,
874
+ doubleHardline: true,
875
+ semicolon: true,
876
+ children: (prop) => createComponent(TypescriptInterfaceProperty, { property: prop })
877
+ });
878
+ } }))];
879
+ }
880
+ });
881
+ }
882
+ /**
883
+ * Generates a TypeScript interface property for the given reflection class.
884
+ */
885
+ function TypescriptInterfaceProperty(props) {
886
+ const [{ property }, rest] = splitProps(props, ["property"]);
887
+ return createComponent(ReflectionPropertyContext.Provider, {
888
+ value: property,
889
+ get children() {
890
+ return [createComponent(TSDocReflectionProperty, {}), createComponent(InterfaceMember, mergeProps({
891
+ get name() {
892
+ return property.getNameAsString();
893
+ },
894
+ get readonly() {
895
+ return property.isReadonly();
896
+ },
897
+ get optional() {
898
+ return property.isOptional();
899
+ },
900
+ get nullish() {
901
+ return property.isNullable();
902
+ },
903
+ get type() {
904
+ return stringifyType(property.getType());
905
+ }
906
+ }, rest))];
907
+ }
908
+ });
909
+ }
910
+
911
+ //#endregion
912
+ //#region ../plugin-alloy/src/typescript/components/typescript-object.tsx
913
+ /**
914
+ * Generates a TypeScript object for the given reflection class.
915
+ */
916
+ function TypescriptObject(props) {
917
+ if (!props.reflection?.value) return null;
918
+ const objectName = computed(() => camelCase((isString(props.name) ? props.name : props.name.toString()) || props.reflection.value.getName()));
919
+ const objectType = computed(() => props.type || pascalCase(props.reflection.value.getName()));
920
+ const properties = computed(() => props.reflection.value.getProperties().filter((item) => !item.isIgnored() && !isUndefined(props.defaultValue?.value?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
921
+ if (isUndefined(ret) && !isUndefined(props.defaultValue?.value?.[alias])) return props.defaultValue?.value?.[alias];
922
+ return ret;
923
+ }, void 0) ?? item.getDefaultValue())).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1));
924
+ const TypeSymbolSlot = createSymbolSlot();
925
+ const ValueTypeSymbolSlot = createSymbolSlot();
926
+ const sym = createValueSymbol(props.name, {
927
+ refkeys: props.refkey,
928
+ default: props.default,
929
+ export: props.export,
930
+ metadata: props.metadata,
931
+ tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,
932
+ type: props.type ? TypeSymbolSlot.firstSymbol : void 0,
933
+ namePolicy: useTSNamePolicy().for("variable")
934
+ });
935
+ if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
936
+ const keyword = props.var ? "var" : props.let ? "let" : "const";
937
+ const type = props.type ? createComponent(TypeRefContext, { get children() {
938
+ return [": ", createComponent(TypeSymbolSlot, { get children() {
939
+ return props.type;
940
+ } })];
941
+ } }) : void 0;
942
+ return createComponent(Show, {
943
+ get when() {
944
+ return !!props.reflection.value;
945
+ },
946
+ get children() {
947
+ return createComponent(ReflectionClassContext.Provider, {
948
+ get value() {
949
+ return {
950
+ reflection: props.reflection.value,
951
+ override: {
952
+ name: objectName.value,
953
+ type: objectType.value,
954
+ defaultValue: props.defaultValue?.value
955
+ }
956
+ };
957
+ },
958
+ get children() {
959
+ return [createComponent(Show, {
960
+ get when() {
961
+ return !!objectName.value && !!objectType.value;
962
+ },
963
+ get children() {
964
+ return [createComponent(TSDocReflectionClass, {}), createComponent(Declaration, {
965
+ symbol: sym,
966
+ get children() {
967
+ return [
968
+ memo(() => props.export ? "export " : ""),
969
+ memo(() => props.default ? "default " : ""),
970
+ keyword,
971
+ " ",
972
+ createComponent(Name, {}),
973
+ type,
974
+ " =",
975
+ " ",
976
+ createComponent(ValueTypeSymbolSlot, { get children() {
977
+ return props.initializer ?? props.children ?? createComponent(ObjectExpression, { get children() {
978
+ return createComponent(For, {
979
+ get each() {
980
+ return properties.value ?? [];
981
+ },
982
+ comma: true,
983
+ doubleHardline: true,
984
+ children: (prop) => createComponent(TypescriptObjectProperty, { property: prop })
985
+ });
986
+ } });
987
+ } })
988
+ ];
989
+ }
990
+ })];
991
+ }
992
+ }), createIntrinsic("hbr", {})];
993
+ }
994
+ });
995
+ }
996
+ });
997
+ }
998
+ /**
999
+ * Generates a TypeScript object property for the given reflection class.
1000
+ */
1001
+ function TypescriptObjectProperty(props) {
1002
+ const [{ property }] = splitProps(props, ["property"]);
1003
+ return createComponent(ReflectionPropertyContext.Provider, {
1004
+ value: property,
1005
+ get children() {
1006
+ return [
1007
+ createComponent(TSDocReflectionProperty, {}),
1008
+ createComponent(ObjectProperty, {
1009
+ get name() {
1010
+ return property.getNameAsString();
1011
+ },
1012
+ get value() {
1013
+ return stringifyDefaultValue(property);
1014
+ }
1015
+ }),
1016
+ createIntrinsic("hbr", {})
1017
+ ];
1018
+ }
1019
+ });
1020
+ }
1021
+
1022
+ //#endregion
1023
+ //#region src/components/env.tsx
1024
+ /**
1025
+ * Generates the environment configuration typescript definition for the Powerlines project.
1026
+ */
1027
+ function EnvTypeDefinition(props) {
1028
+ const [{ defaultValue, reflection }] = splitProps(props, ["defaultValue", "reflection"]);
1029
+ const context = usePowerlines();
1030
+ return [
1031
+ createComponent(TypeScriptInterface, {
1032
+ name: " EnvBase",
1033
+ "extends": ["EnvInterface"],
1034
+ defaultValue,
1035
+ reflection,
1036
+ "export": true
1037
+ }),
1038
+ createIntrinsic("hbr", {}),
1039
+ createIntrinsic("hbr", {}),
1040
+ createComponent(TypeDeclaration, {
1041
+ name: "Env",
1042
+ "export": true,
1043
+ get children() {
1044
+ return code` {
1045
+ [Key in keyof EnvBase as Key ${context?.config.env.prefix.map((prefix) => `| \`${prefix.replace(/_$/g, "")}_\${Key}\``).join(" ")}]: EnvBase[Key];
1046
+ }
1047
+ `;
1048
+ }
1049
+ })
1050
+ ];
1051
+ }
1052
+ function ConfigPropertyConditional(props) {
1053
+ const [{ context, name }] = splitProps(props, ["context", "name"]);
1054
+ if (!context) return null;
1055
+ return code`propertyName === "${name}" || propertyName.replace(/^(${context.config.env.prefix.sort((a, b) => a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)).map((prefix) => `${prefix.replace(/_$/, "")}_`).join("|")})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${name.toLowerCase().replace(/[\s\-_]+/g, "")}"`;
1056
+ }
1057
+ function ConfigPropertyGet(props) {
1058
+ const [{ context, property, index }] = splitProps(props, [
1059
+ "context",
1060
+ "property",
1061
+ "index"
1062
+ ]);
1063
+ if (!context) return null;
1064
+ return [index === 0 ? createComponent(IfStatement, {
1065
+ get condition() {
1066
+ return [createComponent(ConfigPropertyConditional, {
1067
+ get name() {
1068
+ return property.getNameAsString();
1069
+ },
1070
+ context
1071
+ }), createComponent(Show, {
1072
+ get when() {
1073
+ return memo(() => !!property.getAlias())() && property.getAlias().length > 0;
1074
+ },
1075
+ get children() {
1076
+ return [code` || `, createComponent(For, {
1077
+ get each() {
1078
+ return property.getAlias();
1079
+ },
1080
+ joiner: code` || `,
1081
+ children: (alias) => createComponent(ConfigPropertyConditional, {
1082
+ name: alias,
1083
+ context
1084
+ })
1085
+ })];
1086
+ }
1087
+ })];
1088
+ },
1089
+ get children() {
1090
+ return code`return target["${property.getNameAsString()}"];`;
1091
+ }
1092
+ }) : createComponent(ElseIfClause, {
1093
+ get condition() {
1094
+ return [createComponent(ConfigPropertyConditional, {
1095
+ get name() {
1096
+ return property.getNameAsString();
1097
+ },
1098
+ context
1099
+ }), createComponent(Show, {
1100
+ get when() {
1101
+ return memo(() => !!property.getAlias())() && property.getAlias().length > 0;
1102
+ },
1103
+ get children() {
1104
+ return [code` || `, createComponent(For, {
1105
+ get each() {
1106
+ return property.getAlias();
1107
+ },
1108
+ joiner: code` || `,
1109
+ children: (alias) => createComponent(ConfigPropertyConditional, {
1110
+ name: alias,
1111
+ context
1112
+ })
1113
+ })];
1114
+ }
1115
+ })];
1116
+ },
1117
+ get children() {
1118
+ return code`return target["${property.getNameAsString()}"];`;
1119
+ }
1120
+ })];
1121
+ }
1122
+ function ConfigPropertySet(props) {
1123
+ const [{ context, property, index }] = splitProps(props, [
1124
+ "context",
1125
+ "property",
1126
+ "index"
1127
+ ]);
1128
+ if (!context) return null;
1129
+ return [index === 0 ? createComponent(IfStatement, {
1130
+ get condition() {
1131
+ return [createComponent(ConfigPropertyConditional, {
1132
+ get name() {
1133
+ return property.getNameAsString();
1134
+ },
1135
+ context
1136
+ }), createComponent(Show, {
1137
+ get when() {
1138
+ return memo(() => !!property.getAlias())() && property.getAlias().length > 0;
1139
+ },
1140
+ get children() {
1141
+ return [code` || `, createComponent(For, {
1142
+ get each() {
1143
+ return property.getAlias();
1144
+ },
1145
+ joiner: code` || `,
1146
+ children: (alias) => createComponent(ConfigPropertyConditional, {
1147
+ name: alias,
1148
+ context
1149
+ })
1150
+ })];
1151
+ }
1152
+ })];
1153
+ },
1154
+ get children() {
1155
+ return code`
1156
+ target["${property.getNameAsString()}"] = newValue;
1157
+ return true;
1158
+ `;
1159
+ }
1160
+ }) : createComponent(ElseIfClause, {
1161
+ get condition() {
1162
+ return [createComponent(ConfigPropertyConditional, {
1163
+ get name() {
1164
+ return property.getNameAsString();
1165
+ },
1166
+ context
1167
+ }), createComponent(Show, {
1168
+ get when() {
1169
+ return memo(() => !!property.getAlias())() && property.getAlias().length > 0;
1170
+ },
1171
+ get children() {
1172
+ return [code` || `, createComponent(For, {
1173
+ get each() {
1174
+ return property.getAlias();
1175
+ },
1176
+ joiner: code` || `,
1177
+ children: (alias) => createComponent(ConfigPropertyConditional, {
1178
+ name: alias,
1179
+ context
1180
+ })
1181
+ })];
1182
+ }
1183
+ })];
1184
+ },
1185
+ get children() {
1186
+ return code`
1187
+ target["${property.getNameAsString()}"] = newValue;
1188
+ return true;
1189
+ `;
1190
+ }
1191
+ })];
1192
+ }
1193
+ const createEnvRefkey = refkey$1("createEnv");
1194
+ const envRefkey = refkey$1("env");
1195
+ const envSerializerRefkey = refkey$1("EnvSerializer");
1196
+ /**
1197
+ * Generates the environment configuration module for the Powerlines project.
1198
+ */
1199
+ function EnvBuiltin(props) {
1200
+ const [{ defaultConfig, children }, rest] = splitProps(props, ["defaultConfig", "children"]);
1201
+ const context = usePowerlines();
1202
+ const defaultValue = computed(() => context && loadEnvFromContext(context, process.env));
1203
+ const reflection = createReflectionResource(context);
1204
+ const envInstance = computed(() => {
1205
+ return new ReflectionClass({
1206
+ kind: ReflectionKind.objectLiteral,
1207
+ description: `The initial environment configuration state for the ${titleCase(context?.config?.name)} project.`,
1208
+ types: []
1209
+ }, reflection.data ?? void 0);
1210
+ });
1211
+ const reflectionGetProperties = computed(() => reflection.data?.getProperties().filter((property) => !property.isIgnored()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
1212
+ const reflectionSetProperties = computed(() => reflection.data?.getProperties().filter((property) => !property.isIgnored() && !property.isReadonly()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
1213
+ return createComponent(BuiltinFile, mergeProps({
1214
+ id: "env",
1215
+ description: "The Powerlines environment configuration module provides an interface to define environment configuration parameters."
1216
+ }, rest, {
1217
+ get imports() {
1218
+ return defu({
1219
+ "@powerlines/deepkit/vendor/type": [
1220
+ "Type",
1221
+ "stringify",
1222
+ "serializer",
1223
+ "serializeFunction",
1224
+ "deserializeFunction",
1225
+ "ReflectionKind",
1226
+ "TemplateState",
1227
+ "Serializer",
1228
+ "TypeProperty",
1229
+ "TypePropertySignature"
1230
+ ],
1231
+ "@powerlines/plugin-env/types/runtime": [{ name: "EnvInterface" }]
1232
+ }, rest.imports ?? {});
1233
+ },
1234
+ get children() {
1235
+ return [
1236
+ createComponent(Show, {
1237
+ get when() {
1238
+ return !isNull(reflection.data);
1239
+ },
1240
+ get children() {
1241
+ return [
1242
+ createComponent(EnvTypeDefinition, {
1243
+ get defaultValue() {
1244
+ return defaultValue.value;
1245
+ },
1246
+ get reflection() {
1247
+ return reflection.data;
1248
+ }
1249
+ }),
1250
+ createIntrinsic("hbr", {}),
1251
+ createIntrinsic("hbr", {})
1252
+ ];
1253
+ }
1254
+ }),
1255
+ createComponent(TypescriptObject, {
1256
+ name: "initialEnv",
1257
+ type: "Partial<EnvBase>",
1258
+ defaultValue,
1259
+ reflection: envInstance,
1260
+ "export": true,
1261
+ "const": true
1262
+ }),
1263
+ createIntrinsic("hbr", {}),
1264
+ createIntrinsic("hbr", {}),
1265
+ createComponent(TSDoc, {
1266
+ heading: "The environment configuration serializer for the Powerlines application.",
1267
+ get children() {
1268
+ return [
1269
+ createComponent(TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
1270
+ createComponent(TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
1271
+ createComponent(TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
1272
+ ];
1273
+ }
1274
+ }),
1275
+ createComponent(ClassDeclaration, {
1276
+ refkey: envSerializerRefkey,
1277
+ name: "EnvSerializer",
1278
+ "extends": "Serializer",
1279
+ "export": true,
1280
+ get children() {
1281
+ return createComponent(ClassMethod, {
1282
+ name: "constructor",
1283
+ "public": true,
1284
+ children: code`
1285
+ super("env");
1286
+
1287
+ this.deserializeRegistry.register(
1288
+ ReflectionKind.boolean,
1289
+ (type: Type, state: TemplateState) => {
1290
+ state.addSetter(
1291
+ \`typeof \${state.accessor.toString()} !== "boolean" ? \${state.accessor.toString()} === 1 || \${state.accessor.toString()} === "1" || \${state.accessor.toString()}.toLowerCase() === "t" || \${state.accessor.toString()}.toLowerCase() === "true" || \${state.accessor.toString()}.toLowerCase() === "y" || \${state.accessor.toString()}.toLowerCase() === "yes" : \${state.accessor.toString()}\`
1292
+ );
1293
+ }
1294
+ );
1295
+ `
1296
+ });
1297
+ }
1298
+ }),
1299
+ createIntrinsic("hbr", {}),
1300
+ createIntrinsic("hbr", {}),
1301
+ createComponent(TSDoc, {
1302
+ heading: "A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.",
1303
+ get children() {
1304
+ return [
1305
+ createComponent(TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
1306
+ createComponent(TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
1307
+ createComponent(TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
1308
+ ];
1309
+ }
1310
+ }),
1311
+ createComponent(VarDeclaration, {
1312
+ name: "envSerializer",
1313
+ "export": false,
1314
+ "const": true,
1315
+ get initializer() {
1316
+ return createComponent(NewExpression, {
1317
+ args: [],
1318
+ target: "EnvSerializer"
1319
+ });
1320
+ }
1321
+ }),
1322
+ createIntrinsic("hbr", {}),
1323
+ createIntrinsic("hbr", {}),
1324
+ createComponent(TSDoc, {
1325
+ heading: "Serialize a environment configuration object to JSON data objects (not a JSON string).",
1326
+ get children() {
1327
+ return [
1328
+ createComponent(TSDocRemarks, { children: `The resulting JSON object can be stringified using JSON.stringify().` }),
1329
+ createComponent(TSDocExample, { children: `const json = serializeEnv(env);` }),
1330
+ createComponent(TSDocThrows, { children: `ValidationError when serialization or validation fails.` })
1331
+ ];
1332
+ }
1333
+ }),
1334
+ createComponent(VarDeclaration, {
1335
+ name: "serializeEnv",
1336
+ "export": true,
1337
+ "const": true,
1338
+ initializer: "serializeFunction<EnvBase>(envSerializer)"
1339
+ }),
1340
+ createIntrinsic("hbr", {}),
1341
+ createIntrinsic("hbr", {}),
1342
+ createComponent(TSDoc, {
1343
+ heading: "Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.",
1344
+ get children() {
1345
+ return [
1346
+ createComponent(TSDocRemarks, { children: `Types that are already correct will be used as-is.` }),
1347
+ createComponent(TSDocExample, { children: `const env = deserializeEnv(json);` }),
1348
+ createComponent(TSDocThrows, { children: `ValidationError when deserialization fails.` })
1349
+ ];
1350
+ }
1351
+ }),
1352
+ createComponent(VarDeclaration, {
1353
+ name: "deserializeEnv",
1354
+ "export": true,
1355
+ "const": true,
1356
+ initializer: "deserializeFunction<EnvBase>(envSerializer)"
1357
+ }),
1358
+ createIntrinsic("hbr", {}),
1359
+ createIntrinsic("hbr", {}),
1360
+ createComponent(TSDoc, {
1361
+ heading: "Initializes the Powerlines environment configuration module.",
1362
+ get children() {
1363
+ return [
1364
+ createComponent(TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
1365
+ createComponent(TSDocParam, {
1366
+ name: "environmentConfig",
1367
+ children: `The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`
1368
+ }),
1369
+ createComponent(TSDocReturns, { children: `The initialized Powerlines configuration object.` })
1370
+ ];
1371
+ }
1372
+ }),
1373
+ createComponent(Show, {
1374
+ get when() {
1375
+ return Boolean(context?.entryPath);
1376
+ },
1377
+ get children() {
1378
+ return createComponent(FunctionDeclaration, {
1379
+ refkey: createEnvRefkey,
1380
+ async: false,
1381
+ "export": true,
1382
+ name: "createEnv",
1383
+ parameters: [{
1384
+ name: "environmentConfig",
1385
+ type: `Partial<Env>`,
1386
+ optional: false,
1387
+ default: "{}"
1388
+ }],
1389
+ returnType: "Env",
1390
+ get children() {
1391
+ return [
1392
+ code`
1393
+ return new Proxy<Env>(
1394
+ deserializeEnv({
1395
+ ...initialEnv,
1396
+ ...environmentConfig
1397
+ }) as Env,
1398
+ {
1399
+ get: (target: EnvBase, propertyName: string) => { `,
1400
+ createIntrinsic("hbr", {}),
1401
+ createComponent(For, {
1402
+ each: reflectionGetProperties,
1403
+ children: (property, index) => createComponent(ConfigPropertyGet, {
1404
+ index,
1405
+ context,
1406
+ property
1407
+ })
1408
+ }),
1409
+ code`
1410
+ return undefined;
1411
+ }, `,
1412
+ createIntrinsic("hbr", {}),
1413
+ createIntrinsic("hbr", {}),
1414
+ code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,
1415
+ createIntrinsic("hbr", {}),
1416
+ createComponent(For, {
1417
+ each: reflectionSetProperties,
1418
+ ender: code` else `,
1419
+ children: (property, index) => createComponent(ConfigPropertySet, {
1420
+ index,
1421
+ context,
1422
+ property
1423
+ })
1424
+ }),
1425
+ createIntrinsic("hbr", {}),
1426
+ code`return false;
1427
+ }
1428
+ }
1429
+ );
1430
+ `
1431
+ ];
1432
+ }
1433
+ });
1434
+ }
1435
+ }),
1436
+ createIntrinsic("hbr", {}),
1437
+ createIntrinsic("hbr", {}),
1438
+ createIntrinsic("hbr", {}),
1439
+ createComponent(VarDeclaration, {
1440
+ refkey: envRefkey,
1441
+ name: "env",
1442
+ type: "Env",
1443
+ "export": true,
1444
+ "const": true,
1445
+ get initializer() {
1446
+ return [code`createEnv(${defaultConfig || "{}"} as Partial<Env>);`];
1447
+ }
1448
+ }),
1449
+ createIntrinsic("hbr", {}),
1450
+ createIntrinsic("hbr", {}),
1451
+ createComponent(VarDeclaration, {
1452
+ "export": true,
1453
+ "const": true,
1454
+ name: "isCI",
1455
+ doc: "Detect if the application is running in a CI environment.",
1456
+ initializer: code`Boolean(
1457
+ env.CI ||
1458
+ env.RUN_ID ||
1459
+ env.AGOLA_GIT_REF ||
1460
+ env.AC_APPCIRCLE ||
1461
+ env.APPVEYOR ||
1462
+ env.CODEBUILD ||
1463
+ env.TF_BUILD ||
1464
+ env.bamboo_planKey ||
1465
+ env.BITBUCKET_COMMIT ||
1466
+ env.BITRISE_IO ||
1467
+ env.BUDDY_WORKSPACE_ID ||
1468
+ env.BUILDKITE ||
1469
+ env.CIRCLECI ||
1470
+ env.CIRRUS_CI ||
1471
+ env.CF_BUILD_ID ||
1472
+ env.CM_BUILD_ID ||
1473
+ env.CI_NAME ||
1474
+ env.DRONE ||
1475
+ env.DSARI ||
1476
+ env.EARTHLY_CI ||
1477
+ env.EAS_BUILD ||
1478
+ env.GERRIT_PROJECT ||
1479
+ env.GITEA_ACTIONS ||
1480
+ env.GITHUB_ACTIONS ||
1481
+ env.GITLAB_CI ||
1482
+ env.GOCD ||
1483
+ env.BUILDER_OUTPUT ||
1484
+ env.HARNESS_BUILD_ID ||
1485
+ env.JENKINS_URL ||
1486
+ env.LAYERCI ||
1487
+ env.MAGNUM ||
1488
+ env.NETLIFY ||
1489
+ env.NEVERCODE ||
1490
+ env.PROW_JOB_ID ||
1491
+ env.RELEASE_BUILD_ID ||
1492
+ env.RENDER ||
1493
+ env.SAILCI ||
1494
+ env.HUDSON ||
1495
+ env.SCREWDRIVER ||
1496
+ env.SEMAPHORE ||
1497
+ env.SOURCEHUT ||
1498
+ env.STRIDER ||
1499
+ env.TASK_ID ||
1500
+ env.RUN_ID ||
1501
+ env.TEAMCITY_VERSION ||
1502
+ env.TRAVIS ||
1503
+ env.VELA ||
1504
+ env.NOW_BUILDER ||
1505
+ env.APPCENTER_BUILD_ID ||
1506
+ env.CI_XCODE_PROJECT ||
1507
+ env.XCS || false
1508
+ );
1509
+ `
1510
+ }),
1511
+ createIntrinsic("hbr", {}),
1512
+ createIntrinsic("hbr", {}),
1513
+ createComponent(TSDoc, {
1514
+ heading: "Detect the \\`mode\\` of the current runtime environment.",
1515
+ get children() {
1516
+ return createComponent(TSDocRemarks, { children: code`The \`mode\` is determined by the \`MODE\` environment variable, or falls back to the \`NEXT_PUBLIC_VERCEL_ENV\`, \`NODE_ENV\`, or defaults to \`production\`. While the value can potentially be any string, Storm Software generally only allows a value in the following list:
1517
+ - \`production\`
1518
+ - \`test\`
1519
+ - \`development\`` });
1520
+ }
1521
+ }),
1522
+ createComponent(VarDeclaration, {
1523
+ "export": true,
1524
+ "const": true,
1525
+ name: "mode",
1526
+ initializer: code`String(env.MODE) || "production"; `
1527
+ }),
1528
+ createIntrinsic("hbr", {}),
1529
+ createIntrinsic("hbr", {}),
1530
+ createComponent(VarDeclaration, {
1531
+ "export": true,
1532
+ "const": true,
1533
+ name: "isProduction",
1534
+ doc: "Detect if the application is running in \\\"production\\\\\" mode",
1535
+ initializer: code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
1536
+ }),
1537
+ createIntrinsic("hbr", {}),
1538
+ createIntrinsic("hbr", {}),
1539
+ createComponent(VarDeclaration, {
1540
+ "export": true,
1541
+ "const": true,
1542
+ name: "isTest",
1543
+ doc: "Detect if the application is running in \"test\" mode",
1544
+ initializer: code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
1545
+ }),
1546
+ createIntrinsic("hbr", {}),
1547
+ createIntrinsic("hbr", {}),
1548
+ createComponent(VarDeclaration, {
1549
+ "export": true,
1550
+ "const": true,
1551
+ name: "isDevelopment",
1552
+ doc: "Detect if the application is running in \"development\" mode",
1553
+ initializer: code`["dev", "development"].includes(mode.toLowerCase()); `
1554
+ }),
1555
+ createIntrinsic("hbr", {}),
1556
+ createIntrinsic("hbr", {}),
1557
+ createComponent(VarDeclaration, {
1558
+ "export": true,
1559
+ "const": true,
1560
+ name: "isDebug",
1561
+ doc: "Detect if the application is running in \"debug\" mode",
1562
+ initializer: code`Boolean(isDevelopment && env.DEBUG); `
1563
+ }),
1564
+ createIntrinsic("hbr", {}),
1565
+ createIntrinsic("hbr", {}),
1566
+ createComponent(Show, {
1567
+ get when() {
1568
+ return Boolean(children);
1569
+ },
1570
+ children
1571
+ })
1572
+ ];
1573
+ }
1574
+ }));
1575
+ }
1576
+
1577
+ //#endregion
1578
+ export { EnvTypeDefinition as n, stringifyDefaultValue as r, EnvBuiltin as t };