@powerlines/plugin-date 0.12.142 → 0.12.144

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