@powerlines/plugin-env 0.15.4 → 0.15.6

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 (264) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/babel/index.cjs +1 -0
  3. package/dist/babel/index.d.cts +1 -0
  4. package/dist/babel/index.d.mts +1 -0
  5. package/dist/babel/index.mjs +3 -0
  6. package/dist/babel/plugin.cjs +200 -0
  7. package/dist/babel/plugin.d.cts +8 -0
  8. package/dist/babel/plugin.d.mts +9 -0
  9. package/dist/babel/plugin.mjs +198 -0
  10. package/dist/components/docs.cjs +70 -3
  11. package/dist/components/docs.d.cts +8 -1
  12. package/dist/components/docs.d.mts +8 -1
  13. package/dist/components/docs.mjs +68 -2
  14. package/dist/components/env.cjs +574 -4
  15. package/dist/components/env.d.cts +19 -2
  16. package/dist/components/env.d.mts +19 -3
  17. package/dist/components/env.mjs +570 -2
  18. package/dist/components/index.cjs +5 -7
  19. package/dist/components/index.d.cts +2 -4
  20. package/dist/components/index.d.mts +2 -5
  21. package/dist/components/index.mjs +2 -4
  22. package/dist/deepkit/schemas/reflection.cjs +5368 -0
  23. package/dist/{plugin-BwuEBScL.d.cts → deepkit/schemas/reflection.d.cts} +1 -268
  24. package/dist/{plugin-BaInAuAh.d.mts → deepkit/schemas/reflection.d.mts} +59 -326
  25. package/dist/deepkit/schemas/reflection.mjs +5365 -0
  26. package/dist/deepkit/schemas/reflection2.cjs +4112 -0
  27. package/dist/deepkit/schemas/reflection2.mjs +4110 -0
  28. package/dist/deepkit/src/capnp.cjs +1692 -0
  29. package/dist/deepkit/src/capnp.mjs +1690 -0
  30. package/dist/deepkit/src/esbuild-plugin.cjs +99 -0
  31. package/dist/deepkit/src/esbuild-plugin.mjs +98 -0
  32. package/dist/deepkit/src/reflect-type.cjs +40 -0
  33. package/dist/deepkit/src/reflect-type.mjs +38 -0
  34. package/dist/deepkit/src/resolve-reflections.cjs +23 -0
  35. package/dist/deepkit/src/resolve-reflections.mjs +22 -0
  36. package/dist/deepkit/src/transformer.cjs +92 -0
  37. package/dist/deepkit/src/transformer.mjs +89 -0
  38. package/dist/deepkit/src/transpile.cjs +39 -0
  39. package/dist/deepkit/src/transpile.mjs +37 -0
  40. package/dist/deepkit/src/types.cjs +22 -0
  41. package/dist/deepkit/src/types.d.cts +10 -0
  42. package/dist/deepkit/src/types.d.mts +10 -0
  43. package/dist/deepkit/src/types.mjs +21 -0
  44. package/dist/deepkit/src/utilities.cjs +182 -0
  45. package/dist/deepkit/src/utilities.mjs +181 -0
  46. package/dist/helpers/automd-generator.cjs +32 -0
  47. package/dist/helpers/automd-generator.mjs +31 -0
  48. package/dist/helpers/create-reflection-resource.cjs +98 -0
  49. package/dist/helpers/create-reflection-resource.d.cts +15 -0
  50. package/dist/helpers/create-reflection-resource.d.mts +15 -0
  51. package/dist/helpers/create-reflection-resource.mjs +97 -0
  52. package/dist/helpers/index.cjs +6 -0
  53. package/dist/helpers/index.d.cts +6 -0
  54. package/dist/helpers/index.d.mts +6 -0
  55. package/dist/helpers/index.mjs +8 -0
  56. package/dist/helpers/load.cjs +134 -0
  57. package/dist/helpers/load.d.cts +35 -0
  58. package/dist/helpers/load.d.mts +36 -0
  59. package/dist/helpers/load.mjs +131 -0
  60. package/dist/helpers/persistence.cjs +320 -0
  61. package/dist/helpers/persistence.d.cts +84 -0
  62. package/dist/helpers/persistence.d.mts +84 -0
  63. package/dist/helpers/persistence.mjs +308 -0
  64. package/dist/helpers/reflect.cjs +263 -0
  65. package/dist/helpers/reflect.d.cts +46 -0
  66. package/dist/helpers/reflect.d.mts +46 -0
  67. package/dist/helpers/reflect.mjs +254 -0
  68. package/dist/helpers/source-file-env.cjs +58 -0
  69. package/dist/helpers/source-file-env.d.cts +8 -0
  70. package/dist/helpers/source-file-env.d.mts +8 -0
  71. package/dist/helpers/source-file-env.mjs +56 -0
  72. package/dist/helpers/template-helpers.cjs +70 -0
  73. package/dist/helpers/template-helpers.d.cts +15 -0
  74. package/dist/helpers/template-helpers.d.mts +15 -0
  75. package/dist/helpers/template-helpers.mjs +69 -0
  76. package/dist/index.cjs +82 -696
  77. package/dist/index.d.cts +16 -185
  78. package/dist/index.d.mts +17 -190
  79. package/dist/index.mjs +31 -648
  80. package/dist/plugin-alloy/src/core/components/output.cjs +45 -0
  81. package/dist/plugin-alloy/src/core/components/output.mjs +44 -0
  82. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +22 -0
  83. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +21 -0
  84. package/dist/plugin-alloy/src/core/components/source-file.cjs +64 -0
  85. package/dist/plugin-alloy/src/core/components/source-file.d.cts +23 -0
  86. package/dist/plugin-alloy/src/core/components/source-file.d.mts +23 -0
  87. package/dist/plugin-alloy/src/core/components/source-file.mjs +62 -0
  88. package/dist/plugin-alloy/src/core/contexts/context.cjs +136 -0
  89. package/dist/plugin-alloy/src/core/contexts/context.mjs +128 -0
  90. package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
  91. package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
  92. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +110 -0
  93. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +101 -0
  94. package/dist/plugin-alloy/src/helpers/refkey.cjs +23 -0
  95. package/dist/plugin-alloy/src/helpers/refkey.mjs +22 -0
  96. package/dist/plugin-alloy/src/index.cjs +93 -0
  97. package/dist/plugin-alloy/src/index.mjs +91 -0
  98. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +115 -0
  99. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +114 -0
  100. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +39 -0
  101. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +38 -0
  102. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +72 -0
  103. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +71 -0
  104. package/dist/plugin-alloy/src/types/components.cjs +22 -0
  105. package/dist/plugin-alloy/src/types/components.d.cts +22 -0
  106. package/dist/{components-8W0Zgj0y.d.mts → plugin-alloy/src/types/components.d.mts} +2 -1
  107. package/dist/plugin-alloy/src/types/components.mjs +21 -0
  108. package/dist/plugin-alloy/src/types/index.d.mts +2 -0
  109. package/dist/plugin-alloy/src/types/plugin.cjs +55 -0
  110. package/dist/plugin-alloy/src/types/plugin.d.cts +37 -0
  111. package/dist/plugin-alloy/src/types/plugin.d.mts +37 -0
  112. package/dist/plugin-alloy/src/types/plugin.mjs +52 -0
  113. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +57 -0
  114. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +25 -0
  115. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +26 -0
  116. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +56 -0
  117. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +126 -0
  118. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +124 -0
  119. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +442 -0
  120. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +27 -0
  121. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +28 -0
  122. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +433 -0
  123. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +194 -0
  124. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +14 -0
  125. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +15 -0
  126. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +191 -0
  127. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +68 -0
  128. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +11 -0
  129. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +12 -0
  130. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +67 -0
  131. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +124 -0
  132. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +123 -0
  133. package/dist/plugin-automd/src/index.cjs +127 -0
  134. package/dist/plugin-automd/src/index.mjs +124 -0
  135. package/dist/plugin-automd/src/types/plugin.cjs +47 -0
  136. package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
  137. package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
  138. package/dist/plugin-automd/src/types/plugin.mjs +47 -0
  139. package/dist/plugin-automd/src/types/toc.cjs +26 -0
  140. package/dist/plugin-automd/src/types/toc.d.cts +33 -0
  141. package/dist/plugin-automd/src/types/toc.d.mts +33 -0
  142. package/dist/plugin-automd/src/types/toc.mjs +25 -0
  143. package/dist/plugin-babel/src/helpers/ast-utils.cjs +74 -0
  144. package/dist/plugin-babel/src/helpers/ast-utils.mjs +70 -0
  145. package/dist/plugin-babel/src/helpers/create-plugin.cjs +71 -0
  146. package/dist/plugin-babel/src/helpers/create-plugin.mjs +69 -0
  147. package/dist/plugin-babel/src/helpers/filters.cjs +158 -0
  148. package/dist/plugin-babel/src/helpers/filters.mjs +154 -0
  149. package/dist/plugin-babel/src/helpers/index.cjs +5 -0
  150. package/dist/plugin-babel/src/helpers/index.mjs +7 -0
  151. package/dist/plugin-babel/src/helpers/module-helpers.cjs +200 -0
  152. package/dist/plugin-babel/src/helpers/module-helpers.mjs +192 -0
  153. package/dist/plugin-babel/src/helpers/options.cjs +74 -0
  154. package/dist/plugin-babel/src/helpers/options.mjs +71 -0
  155. package/dist/plugin-babel/src/index.cjs +134 -0
  156. package/dist/plugin-babel/src/index.mjs +132 -0
  157. package/dist/plugin-babel/src/types/index.d.mts +1 -0
  158. package/dist/plugin-babel/src/types/plugin.cjs +42 -0
  159. package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
  160. package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
  161. package/dist/plugin-babel/src/types/plugin.mjs +39 -0
  162. package/dist/powerlines/schemas/fs.d.mts +1 -0
  163. package/dist/powerlines/src/api.d.mts +7 -0
  164. package/dist/powerlines/src/index.d.mts +12 -0
  165. package/dist/powerlines/src/internal/helpers/hooks.cjs +119 -0
  166. package/dist/powerlines/src/internal/helpers/hooks.d.mts +5 -0
  167. package/dist/powerlines/src/internal/helpers/hooks.mjs +118 -0
  168. package/dist/powerlines/src/lib/build/esbuild.cjs +161 -0
  169. package/dist/powerlines/src/lib/build/esbuild.mjs +159 -0
  170. package/dist/powerlines/src/lib/entry.cjs +203 -0
  171. package/dist/powerlines/src/lib/entry.mjs +201 -0
  172. package/dist/powerlines/src/lib/logger.cjs +108 -0
  173. package/dist/powerlines/src/lib/logger.mjs +106 -0
  174. package/dist/powerlines/src/lib/utilities/bundle.cjs +67 -0
  175. package/dist/powerlines/src/lib/utilities/bundle.mjs +66 -0
  176. package/dist/powerlines/src/lib/utilities/resolve.cjs +49 -0
  177. package/dist/powerlines/src/lib/utilities/resolve.mjs +48 -0
  178. package/dist/powerlines/src/plugin-utils/paths.cjs +46 -0
  179. package/dist/powerlines/src/plugin-utils/paths.mjs +45 -0
  180. package/dist/powerlines/src/types/api.cjs +1 -0
  181. package/dist/powerlines/src/types/api.d.mts +5 -0
  182. package/dist/powerlines/src/types/api.mjs +3 -0
  183. package/dist/powerlines/src/types/babel.cjs +156 -0
  184. package/dist/powerlines/src/types/babel.d.cts +23 -0
  185. package/dist/powerlines/src/types/babel.d.mts +23 -0
  186. package/dist/powerlines/src/types/babel.mjs +147 -0
  187. package/dist/powerlines/src/types/build.cjs +105 -0
  188. package/dist/powerlines/src/types/build.d.cts +145 -0
  189. package/dist/powerlines/src/types/build.d.mts +147 -0
  190. package/dist/powerlines/src/types/build.mjs +101 -0
  191. package/dist/powerlines/src/types/commands.cjs +16 -0
  192. package/dist/powerlines/src/types/commands.d.cts +8 -0
  193. package/dist/powerlines/src/types/commands.d.mts +9 -0
  194. package/dist/powerlines/src/types/commands.mjs +15 -0
  195. package/dist/powerlines/src/types/config.cjs +306 -0
  196. package/dist/powerlines/src/types/config.d.cts +387 -0
  197. package/dist/powerlines/src/types/config.d.mts +388 -0
  198. package/dist/powerlines/src/types/config.mjs +293 -0
  199. package/dist/powerlines/src/types/context.cjs +324 -0
  200. package/dist/powerlines/src/types/context.d.cts +414 -0
  201. package/dist/powerlines/src/types/context.d.mts +416 -0
  202. package/dist/powerlines/src/types/context.mjs +311 -0
  203. package/dist/powerlines/src/types/fs.cjs +78 -0
  204. package/dist/powerlines/src/types/fs.d.cts +486 -0
  205. package/dist/powerlines/src/types/fs.d.mts +486 -0
  206. package/dist/powerlines/src/types/fs.mjs +75 -0
  207. package/dist/powerlines/src/types/hooks.cjs +52 -0
  208. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  209. package/dist/powerlines/src/types/hooks.mjs +48 -0
  210. package/dist/powerlines/src/types/index.cjs +11 -0
  211. package/dist/powerlines/src/types/index.d.mts +12 -0
  212. package/dist/powerlines/src/types/index.mjs +13 -0
  213. package/dist/powerlines/src/types/plugin.cjs +249 -0
  214. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  215. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  216. package/dist/powerlines/src/types/plugin.mjs +240 -0
  217. package/dist/powerlines/src/types/resolved.cjs +153 -0
  218. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  219. package/dist/powerlines/src/types/resolved.d.mts +83 -0
  220. package/dist/powerlines/src/types/resolved.mjs +148 -0
  221. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  222. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  223. package/dist/powerlines/src/types/unplugin.cjs +1 -0
  224. package/dist/powerlines/src/types/unplugin.d.mts +7 -0
  225. package/dist/powerlines/src/types/unplugin.mjs +3 -0
  226. package/dist/types/index.cjs +10 -3
  227. package/dist/types/index.d.cts +2 -4
  228. package/dist/types/index.d.mts +2 -5
  229. package/dist/types/index.mjs +3 -4
  230. package/dist/types/plugin.cjs +133 -1
  231. package/dist/types/plugin.d.cts +156 -3
  232. package/dist/types/plugin.d.mts +158 -4
  233. package/dist/types/plugin.mjs +128 -2
  234. package/dist/types/runtime.cjs +242 -1
  235. package/dist/types/runtime.d.cts +793 -2
  236. package/dist/types/runtime.d.mts +793 -2
  237. package/dist/types/runtime.mjs +240 -2
  238. package/package.json +13 -9
  239. package/dist/components-C9bYrQVK.cjs +0 -0
  240. package/dist/components-CNIQFfeK.mjs +0 -1
  241. package/dist/create-reflection-resource-BNYxBgW2.mjs +0 -9846
  242. package/dist/create-reflection-resource-BWYhmX7O.cjs +0 -10085
  243. package/dist/docs-5r844zC1.d.mts +0 -9
  244. package/dist/docs-B66b9li3.mjs +0 -219
  245. package/dist/docs-_MmTNBQX.d.cts +0 -9
  246. package/dist/docs-hBlKCRWK.cjs +0 -224
  247. package/dist/env-BPodCdD1.d.cts +0 -116
  248. package/dist/env-IQvgnabX.mjs +0 -1578
  249. package/dist/env-cO4BUDn1.cjs +0 -1596
  250. package/dist/env-zhzvpUI5.d.mts +0 -98
  251. package/dist/index-BXxhKmeA.d.mts +0 -1
  252. package/dist/index-Cc7fCJU9.d.mts +0 -1
  253. package/dist/index-CqdNToYT.d.cts +0 -1
  254. package/dist/index-DWPDThxu.d.cts +0 -1
  255. package/dist/plugin-D3B5E_Hg.mjs +0 -1
  256. package/dist/plugin-D5qyQPqC.cjs +0 -0
  257. package/dist/resolved-BZG2cwRG.d.cts +0 -1789
  258. package/dist/resolved-V5COsfDu.d.mts +0 -1791
  259. package/dist/runtime-Bisl_1Ja.cjs +0 -0
  260. package/dist/runtime-Q8Ni8SeN.d.cts +0 -794
  261. package/dist/runtime-azNoeKr-.mjs +0 -1
  262. package/dist/runtime-qZ0Z2kEd.d.mts +0 -794
  263. package/dist/types-DwElXV6q.mjs +0 -1
  264. package/dist/types-MYBaygjr.cjs +0 -0
@@ -1,4 +1,572 @@
1
- import "../create-reflection-resource-BNYxBgW2.mjs";
2
- import { n as EnvTypeDefinition, t as EnvBuiltin } from "../env-IQvgnabX.mjs";
1
+ import { usePowerlines } from "../plugin-alloy/src/core/contexts/context.mjs";
2
+ import { refkey as refkey$1 } from "../plugin-alloy/src/helpers/refkey.mjs";
3
+ import { TSDoc, TSDocExample, TSDocLink, TSDocParam, TSDocRemarks, TSDocReturns, TSDocThrows } from "../plugin-alloy/src/typescript/components/tsdoc.mjs";
4
+ import { BuiltinFile } from "../plugin-alloy/src/typescript/components/builtin-file.mjs";
5
+ import { TypeScriptInterface } from "../plugin-alloy/src/typescript/components/typescript-interface.mjs";
6
+ import { TypescriptObject } from "../plugin-alloy/src/typescript/components/typescript-object.mjs";
7
+ import { loadEnvFromContext } from "../helpers/load.mjs";
8
+ import { createReflectionResource } from "../helpers/create-reflection-resource.mjs";
9
+ import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
10
+ import { ReflectionClass, ReflectionKind } from "@powerlines/deepkit/vendor/type";
11
+ import { For, Show, code, computed, splitProps } from "@alloy-js/core";
12
+ import defu$1 from "defu";
13
+ import { titleCase } from "@stryke/string-format/title-case";
14
+ import { isNull } from "@stryke/type-checks/is-null";
15
+ import { ClassDeclaration, ClassMethod, ElseIfClause, FunctionDeclaration, IfStatement, NewExpression, TypeDeclaration, VarDeclaration } from "@alloy-js/typescript";
3
16
 
17
+ //#region src/components/env.tsx
18
+ /**
19
+ * Generates the environment configuration typescript definition for the Powerlines project.
20
+ */
21
+ function EnvTypeDefinition(props) {
22
+ const [{ defaultValue, reflection }] = splitProps(props, ["defaultValue", "reflection"]);
23
+ const context = usePowerlines();
24
+ return [
25
+ createComponent(TypeScriptInterface, {
26
+ name: " EnvBase",
27
+ "extends": ["EnvInterface"],
28
+ defaultValue,
29
+ reflection,
30
+ "export": true
31
+ }),
32
+ createIntrinsic("hbr", {}),
33
+ createIntrinsic("hbr", {}),
34
+ createComponent(TypeDeclaration, {
35
+ name: "Env",
36
+ "export": true,
37
+ get children() {
38
+ return code` {
39
+ [Key in keyof EnvBase as Key ${context?.config.env.prefix.map((prefix) => `| \`${prefix.replace(/_$/g, "")}_\${Key}\``).join(" ")}]: EnvBase[Key];
40
+ }
41
+ `;
42
+ }
43
+ })
44
+ ];
45
+ }
46
+ function ConfigPropertyConditional(props) {
47
+ const [{ context, name }] = splitProps(props, ["context", "name"]);
48
+ if (!context) return null;
49
+ 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, "")}"`;
50
+ }
51
+ function ConfigPropertyGet(props) {
52
+ const [{ context, property, index }] = splitProps(props, [
53
+ "context",
54
+ "property",
55
+ "index"
56
+ ]);
57
+ if (!context) return null;
58
+ return [index === 0 ? createComponent(IfStatement, {
59
+ get condition() {
60
+ return [createComponent(ConfigPropertyConditional, {
61
+ get name() {
62
+ return property.getNameAsString();
63
+ },
64
+ context
65
+ }), createComponent(Show, {
66
+ get when() {
67
+ return memo(() => !!property.getAlias())() && property.getAlias().length > 0;
68
+ },
69
+ get children() {
70
+ return [code` || `, createComponent(For, {
71
+ get each() {
72
+ return property.getAlias();
73
+ },
74
+ joiner: code` || `,
75
+ children: (alias) => createComponent(ConfigPropertyConditional, {
76
+ name: alias,
77
+ context
78
+ })
79
+ })];
80
+ }
81
+ })];
82
+ },
83
+ get children() {
84
+ return code`return target["${property.getNameAsString()}"];`;
85
+ }
86
+ }) : createComponent(ElseIfClause, {
87
+ get condition() {
88
+ return [createComponent(ConfigPropertyConditional, {
89
+ get name() {
90
+ return property.getNameAsString();
91
+ },
92
+ context
93
+ }), createComponent(Show, {
94
+ get when() {
95
+ return memo(() => !!property.getAlias())() && property.getAlias().length > 0;
96
+ },
97
+ get children() {
98
+ return [code` || `, createComponent(For, {
99
+ get each() {
100
+ return property.getAlias();
101
+ },
102
+ joiner: code` || `,
103
+ children: (alias) => createComponent(ConfigPropertyConditional, {
104
+ name: alias,
105
+ context
106
+ })
107
+ })];
108
+ }
109
+ })];
110
+ },
111
+ get children() {
112
+ return code`return target["${property.getNameAsString()}"];`;
113
+ }
114
+ })];
115
+ }
116
+ function ConfigPropertySet(props) {
117
+ const [{ context, property, index }] = splitProps(props, [
118
+ "context",
119
+ "property",
120
+ "index"
121
+ ]);
122
+ if (!context) return null;
123
+ return [index === 0 ? createComponent(IfStatement, {
124
+ get condition() {
125
+ return [createComponent(ConfigPropertyConditional, {
126
+ get name() {
127
+ return property.getNameAsString();
128
+ },
129
+ context
130
+ }), createComponent(Show, {
131
+ get when() {
132
+ return memo(() => !!property.getAlias())() && property.getAlias().length > 0;
133
+ },
134
+ get children() {
135
+ return [code` || `, createComponent(For, {
136
+ get each() {
137
+ return property.getAlias();
138
+ },
139
+ joiner: code` || `,
140
+ children: (alias) => createComponent(ConfigPropertyConditional, {
141
+ name: alias,
142
+ context
143
+ })
144
+ })];
145
+ }
146
+ })];
147
+ },
148
+ get children() {
149
+ return code`
150
+ target["${property.getNameAsString()}"] = newValue;
151
+ return true;
152
+ `;
153
+ }
154
+ }) : createComponent(ElseIfClause, {
155
+ get condition() {
156
+ return [createComponent(ConfigPropertyConditional, {
157
+ get name() {
158
+ return property.getNameAsString();
159
+ },
160
+ context
161
+ }), createComponent(Show, {
162
+ get when() {
163
+ return memo(() => !!property.getAlias())() && property.getAlias().length > 0;
164
+ },
165
+ get children() {
166
+ return [code` || `, createComponent(For, {
167
+ get each() {
168
+ return property.getAlias();
169
+ },
170
+ joiner: code` || `,
171
+ children: (alias) => createComponent(ConfigPropertyConditional, {
172
+ name: alias,
173
+ context
174
+ })
175
+ })];
176
+ }
177
+ })];
178
+ },
179
+ get children() {
180
+ return code`
181
+ target["${property.getNameAsString()}"] = newValue;
182
+ return true;
183
+ `;
184
+ }
185
+ })];
186
+ }
187
+ const createEnvRefkey = refkey$1("createEnv");
188
+ const envRefkey = refkey$1("env");
189
+ const envSerializerRefkey = refkey$1("EnvSerializer");
190
+ /**
191
+ * Generates the environment configuration module for the Powerlines project.
192
+ */
193
+ function EnvBuiltin(props) {
194
+ const [{ defaultConfig, children }, rest] = splitProps(props, ["defaultConfig", "children"]);
195
+ const context = usePowerlines();
196
+ const defaultValue = computed(() => context && loadEnvFromContext(context, process.env));
197
+ const reflection = createReflectionResource(context);
198
+ const envInstance = computed(() => {
199
+ return new ReflectionClass({
200
+ kind: ReflectionKind.objectLiteral,
201
+ description: `The initial environment configuration state for the ${titleCase(context?.config?.name)} project.`,
202
+ types: []
203
+ }, reflection.data ?? void 0);
204
+ });
205
+ const reflectionGetProperties = computed(() => reflection.data?.getProperties().filter((property) => !property.isIgnored()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
206
+ const reflectionSetProperties = computed(() => reflection.data?.getProperties().filter((property) => !property.isIgnored() && !property.isReadonly()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
207
+ return createComponent(BuiltinFile, mergeProps({
208
+ id: "env",
209
+ description: "The Powerlines environment configuration module provides an interface to define environment configuration parameters."
210
+ }, rest, {
211
+ get imports() {
212
+ return defu$1({
213
+ "@powerlines/deepkit/vendor/type": [
214
+ "Type",
215
+ "stringify",
216
+ "serializer",
217
+ "serializeFunction",
218
+ "deserializeFunction",
219
+ "ReflectionKind",
220
+ "TemplateState",
221
+ "Serializer",
222
+ "TypeProperty",
223
+ "TypePropertySignature"
224
+ ],
225
+ "@powerlines/plugin-env/types/runtime": [{ name: "EnvInterface" }]
226
+ }, rest.imports ?? {});
227
+ },
228
+ get children() {
229
+ return [
230
+ createComponent(Show, {
231
+ get when() {
232
+ return !isNull(reflection.data);
233
+ },
234
+ get children() {
235
+ return [
236
+ createComponent(EnvTypeDefinition, {
237
+ get defaultValue() {
238
+ return defaultValue.value;
239
+ },
240
+ get reflection() {
241
+ return reflection.data;
242
+ }
243
+ }),
244
+ createIntrinsic("hbr", {}),
245
+ createIntrinsic("hbr", {})
246
+ ];
247
+ }
248
+ }),
249
+ createComponent(TypescriptObject, {
250
+ name: "initialEnv",
251
+ type: "Partial<EnvBase>",
252
+ defaultValue,
253
+ reflection: envInstance,
254
+ "export": true,
255
+ "const": true
256
+ }),
257
+ createIntrinsic("hbr", {}),
258
+ createIntrinsic("hbr", {}),
259
+ createComponent(TSDoc, {
260
+ heading: "The environment configuration serializer for the Powerlines application.",
261
+ get children() {
262
+ return [
263
+ createComponent(TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
264
+ createComponent(TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
265
+ createComponent(TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
266
+ ];
267
+ }
268
+ }),
269
+ createComponent(ClassDeclaration, {
270
+ refkey: envSerializerRefkey,
271
+ name: "EnvSerializer",
272
+ "extends": "Serializer",
273
+ "export": true,
274
+ get children() {
275
+ return createComponent(ClassMethod, {
276
+ name: "constructor",
277
+ "public": true,
278
+ children: code`
279
+ super("env");
280
+
281
+ this.deserializeRegistry.register(
282
+ ReflectionKind.boolean,
283
+ (type: Type, state: TemplateState) => {
284
+ state.addSetter(
285
+ \`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()}\`
286
+ );
287
+ }
288
+ );
289
+ `
290
+ });
291
+ }
292
+ }),
293
+ createIntrinsic("hbr", {}),
294
+ createIntrinsic("hbr", {}),
295
+ createComponent(TSDoc, {
296
+ heading: "A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.",
297
+ get children() {
298
+ return [
299
+ createComponent(TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
300
+ createComponent(TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
301
+ createComponent(TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
302
+ ];
303
+ }
304
+ }),
305
+ createComponent(VarDeclaration, {
306
+ name: "envSerializer",
307
+ "export": false,
308
+ "const": true,
309
+ get initializer() {
310
+ return createComponent(NewExpression, {
311
+ args: [],
312
+ target: "EnvSerializer"
313
+ });
314
+ }
315
+ }),
316
+ createIntrinsic("hbr", {}),
317
+ createIntrinsic("hbr", {}),
318
+ createComponent(TSDoc, {
319
+ heading: "Serialize a environment configuration object to JSON data objects (not a JSON string).",
320
+ get children() {
321
+ return [
322
+ createComponent(TSDocRemarks, { children: `The resulting JSON object can be stringified using JSON.stringify().` }),
323
+ createComponent(TSDocExample, { children: `const json = serializeEnv(env);` }),
324
+ createComponent(TSDocThrows, { children: `ValidationError when serialization or validation fails.` })
325
+ ];
326
+ }
327
+ }),
328
+ createComponent(VarDeclaration, {
329
+ name: "serializeEnv",
330
+ "export": true,
331
+ "const": true,
332
+ initializer: "serializeFunction<EnvBase>(envSerializer)"
333
+ }),
334
+ createIntrinsic("hbr", {}),
335
+ createIntrinsic("hbr", {}),
336
+ createComponent(TSDoc, {
337
+ heading: "Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.",
338
+ get children() {
339
+ return [
340
+ createComponent(TSDocRemarks, { children: `Types that are already correct will be used as-is.` }),
341
+ createComponent(TSDocExample, { children: `const env = deserializeEnv(json);` }),
342
+ createComponent(TSDocThrows, { children: `ValidationError when deserialization fails.` })
343
+ ];
344
+ }
345
+ }),
346
+ createComponent(VarDeclaration, {
347
+ name: "deserializeEnv",
348
+ "export": true,
349
+ "const": true,
350
+ initializer: "deserializeFunction<EnvBase>(envSerializer)"
351
+ }),
352
+ createIntrinsic("hbr", {}),
353
+ createIntrinsic("hbr", {}),
354
+ createComponent(TSDoc, {
355
+ heading: "Initializes the Powerlines environment configuration module.",
356
+ get children() {
357
+ return [
358
+ createComponent(TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
359
+ createComponent(TSDocParam, {
360
+ name: "environmentConfig",
361
+ children: `The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`
362
+ }),
363
+ createComponent(TSDocReturns, { children: `The initialized Powerlines configuration object.` })
364
+ ];
365
+ }
366
+ }),
367
+ createComponent(Show, {
368
+ get when() {
369
+ return Boolean(context?.entryPath);
370
+ },
371
+ get children() {
372
+ return createComponent(FunctionDeclaration, {
373
+ refkey: createEnvRefkey,
374
+ async: false,
375
+ "export": true,
376
+ name: "createEnv",
377
+ parameters: [{
378
+ name: "environmentConfig",
379
+ type: `Partial<Env>`,
380
+ optional: false,
381
+ default: "{}"
382
+ }],
383
+ returnType: "Env",
384
+ get children() {
385
+ return [
386
+ code`
387
+ return new Proxy<Env>(
388
+ deserializeEnv({
389
+ ...initialEnv,
390
+ ...environmentConfig
391
+ }) as Env,
392
+ {
393
+ get: (target: EnvBase, propertyName: string) => { `,
394
+ createIntrinsic("hbr", {}),
395
+ createComponent(For, {
396
+ each: reflectionGetProperties,
397
+ children: (property, index) => createComponent(ConfigPropertyGet, {
398
+ index,
399
+ context,
400
+ property
401
+ })
402
+ }),
403
+ code`
404
+ return undefined;
405
+ }, `,
406
+ createIntrinsic("hbr", {}),
407
+ createIntrinsic("hbr", {}),
408
+ code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,
409
+ createIntrinsic("hbr", {}),
410
+ createComponent(For, {
411
+ each: reflectionSetProperties,
412
+ ender: code` else `,
413
+ children: (property, index) => createComponent(ConfigPropertySet, {
414
+ index,
415
+ context,
416
+ property
417
+ })
418
+ }),
419
+ createIntrinsic("hbr", {}),
420
+ code`return false;
421
+ }
422
+ }
423
+ );
424
+ `
425
+ ];
426
+ }
427
+ });
428
+ }
429
+ }),
430
+ createIntrinsic("hbr", {}),
431
+ createIntrinsic("hbr", {}),
432
+ createIntrinsic("hbr", {}),
433
+ createComponent(VarDeclaration, {
434
+ refkey: envRefkey,
435
+ name: "env",
436
+ type: "Env",
437
+ "export": true,
438
+ "const": true,
439
+ get initializer() {
440
+ return [code`createEnv(${defaultConfig || "{}"} as Partial<Env>);`];
441
+ }
442
+ }),
443
+ createIntrinsic("hbr", {}),
444
+ createIntrinsic("hbr", {}),
445
+ createComponent(VarDeclaration, {
446
+ "export": true,
447
+ "const": true,
448
+ name: "isCI",
449
+ doc: "Detect if the application is running in a CI environment.",
450
+ initializer: code`Boolean(
451
+ env.CI ||
452
+ env.RUN_ID ||
453
+ env.AGOLA_GIT_REF ||
454
+ env.AC_APPCIRCLE ||
455
+ env.APPVEYOR ||
456
+ env.CODEBUILD ||
457
+ env.TF_BUILD ||
458
+ env.bamboo_planKey ||
459
+ env.BITBUCKET_COMMIT ||
460
+ env.BITRISE_IO ||
461
+ env.BUDDY_WORKSPACE_ID ||
462
+ env.BUILDKITE ||
463
+ env.CIRCLECI ||
464
+ env.CIRRUS_CI ||
465
+ env.CF_BUILD_ID ||
466
+ env.CM_BUILD_ID ||
467
+ env.CI_NAME ||
468
+ env.DRONE ||
469
+ env.DSARI ||
470
+ env.EARTHLY_CI ||
471
+ env.EAS_BUILD ||
472
+ env.GERRIT_PROJECT ||
473
+ env.GITEA_ACTIONS ||
474
+ env.GITHUB_ACTIONS ||
475
+ env.GITLAB_CI ||
476
+ env.GOCD ||
477
+ env.BUILDER_OUTPUT ||
478
+ env.HARNESS_BUILD_ID ||
479
+ env.JENKINS_URL ||
480
+ env.LAYERCI ||
481
+ env.MAGNUM ||
482
+ env.NETLIFY ||
483
+ env.NEVERCODE ||
484
+ env.PROW_JOB_ID ||
485
+ env.RELEASE_BUILD_ID ||
486
+ env.RENDER ||
487
+ env.SAILCI ||
488
+ env.HUDSON ||
489
+ env.SCREWDRIVER ||
490
+ env.SEMAPHORE ||
491
+ env.SOURCEHUT ||
492
+ env.STRIDER ||
493
+ env.TASK_ID ||
494
+ env.RUN_ID ||
495
+ env.TEAMCITY_VERSION ||
496
+ env.TRAVIS ||
497
+ env.VELA ||
498
+ env.NOW_BUILDER ||
499
+ env.APPCENTER_BUILD_ID ||
500
+ env.CI_XCODE_PROJECT ||
501
+ env.XCS || false
502
+ );
503
+ `
504
+ }),
505
+ createIntrinsic("hbr", {}),
506
+ createIntrinsic("hbr", {}),
507
+ createComponent(TSDoc, {
508
+ heading: "Detect the \\`mode\\` of the current runtime environment.",
509
+ get children() {
510
+ 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:
511
+ - \`production\`
512
+ - \`test\`
513
+ - \`development\`` });
514
+ }
515
+ }),
516
+ createComponent(VarDeclaration, {
517
+ "export": true,
518
+ "const": true,
519
+ name: "mode",
520
+ initializer: code`String(env.MODE) || "production"; `
521
+ }),
522
+ createIntrinsic("hbr", {}),
523
+ createIntrinsic("hbr", {}),
524
+ createComponent(VarDeclaration, {
525
+ "export": true,
526
+ "const": true,
527
+ name: "isProduction",
528
+ doc: "Detect if the application is running in \\\"production\\\\\" mode",
529
+ initializer: code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
530
+ }),
531
+ createIntrinsic("hbr", {}),
532
+ createIntrinsic("hbr", {}),
533
+ createComponent(VarDeclaration, {
534
+ "export": true,
535
+ "const": true,
536
+ name: "isTest",
537
+ doc: "Detect if the application is running in \"test\" mode",
538
+ initializer: code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
539
+ }),
540
+ createIntrinsic("hbr", {}),
541
+ createIntrinsic("hbr", {}),
542
+ createComponent(VarDeclaration, {
543
+ "export": true,
544
+ "const": true,
545
+ name: "isDevelopment",
546
+ doc: "Detect if the application is running in \"development\" mode",
547
+ initializer: code`["dev", "development"].includes(mode.toLowerCase()); `
548
+ }),
549
+ createIntrinsic("hbr", {}),
550
+ createIntrinsic("hbr", {}),
551
+ createComponent(VarDeclaration, {
552
+ "export": true,
553
+ "const": true,
554
+ name: "isDebug",
555
+ doc: "Detect if the application is running in \"debug\" mode",
556
+ initializer: code`Boolean(isDevelopment && env.DEBUG); `
557
+ }),
558
+ createIntrinsic("hbr", {}),
559
+ createIntrinsic("hbr", {}),
560
+ createComponent(Show, {
561
+ get when() {
562
+ return Boolean(children);
563
+ },
564
+ children
565
+ })
566
+ ];
567
+ }
568
+ }));
569
+ }
570
+
571
+ //#endregion
4
572
  export { EnvBuiltin, EnvTypeDefinition };
@@ -1,8 +1,6 @@
1
- require('../create-reflection-resource-BWYhmX7O.cjs');
2
- const require_env = require('../env-cO4BUDn1.cjs');
3
- const require_docs = require('../docs-hBlKCRWK.cjs');
4
- require('../components-C9bYrQVK.cjs');
1
+ const require_components_env = require('./env.cjs');
2
+ const require_components_docs = require('./docs.cjs');
5
3
 
6
- exports.EnvBuiltin = require_env.EnvBuiltin;
7
- exports.EnvDocs = require_docs.EnvDocs;
8
- exports.EnvTypeDefinition = require_env.EnvTypeDefinition;
4
+ exports.EnvBuiltin = require_components_env.EnvBuiltin;
5
+ exports.EnvDocs = require_components_docs.EnvDocs;
6
+ exports.EnvTypeDefinition = require_components_env.EnvTypeDefinition;
@@ -1,5 +1,3 @@
1
- import { t as EnvDocs } from "../docs-_MmTNBQX.cjs";
2
- import "../resolved-BZG2cwRG.cjs";
3
- import { i as __ΩEnvBuiltinProps, n as EnvBuiltinProps, r as EnvTypeDefinition, t as EnvBuiltin } from "../env-BPodCdD1.cjs";
4
- import "../index-DWPDThxu.cjs";
1
+ import { EnvDocs } from "./docs.cjs";
2
+ import { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from "./env.cjs";
5
3
  export { EnvBuiltin, EnvBuiltinProps, EnvDocs, EnvTypeDefinition, __ΩEnvBuiltinProps };
@@ -1,6 +1,3 @@
1
- import { t as EnvDocs } from "../docs-5r844zC1.mjs";
2
- import "../resolved-V5COsfDu.mjs";
3
- import "../components-8W0Zgj0y.mjs";
4
- import { i as __ΩEnvBuiltinProps, n as EnvBuiltinProps, r as EnvTypeDefinition, t as EnvBuiltin } from "../env-zhzvpUI5.mjs";
5
- import "../index-Cc7fCJU9.mjs";
1
+ import { EnvDocs } from "./docs.mjs";
2
+ import { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from "./env.mjs";
6
3
  export { EnvBuiltin, EnvBuiltinProps, EnvDocs, EnvTypeDefinition, __ΩEnvBuiltinProps };
@@ -1,6 +1,4 @@
1
- import "../create-reflection-resource-BNYxBgW2.mjs";
2
- import { n as EnvTypeDefinition, t as EnvBuiltin } from "../env-IQvgnabX.mjs";
3
- import { t as EnvDocs } from "../docs-B66b9li3.mjs";
4
- import "../components-CNIQFfeK.mjs";
1
+ import { EnvBuiltin, EnvTypeDefinition } from "./env.mjs";
2
+ import { EnvDocs } from "./docs.mjs";
5
3
 
6
4
  export { EnvBuiltin, EnvDocs, EnvTypeDefinition };