@powerlines/plugin-date 0.12.260 → 0.12.261

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