@powerlines/plugin-crypto 0.10.106 → 0.10.108

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/index-BgAdqTbb.d.mts +1 -0
  2. package/dist/index-CEgs-Dz2.d.cts +1 -0
  3. package/dist/index.cjs +12056 -8
  4. package/dist/index.d.cts +12 -4
  5. package/dist/index.d.mts +12 -5
  6. package/dist/index.mjs +12018 -3
  7. package/dist/plugin-C3MaN5jp.mjs +1 -0
  8. package/dist/plugin-DHXHjv16.cjs +0 -0
  9. package/dist/plugin-Dhgjf-aI.d.mts +4441 -0
  10. package/dist/plugin-Dw1wCT6b.d.cts +4438 -0
  11. package/dist/types/index.cjs +2 -0
  12. package/dist/types/index.d.cts +2 -1
  13. package/dist/types/index.d.mts +2 -1
  14. package/dist/types/index.mjs +3 -0
  15. package/dist/types/plugin.cjs +1 -0
  16. package/dist/types/plugin.d.cts +1 -41
  17. package/dist/types/plugin.d.mts +1 -41
  18. package/dist/types/plugin.mjs +2 -0
  19. package/dist/types-CTUnla4x.mjs +1 -0
  20. package/dist/types-DHkg7xmX.cjs +0 -0
  21. package/package.json +5 -5
  22. package/dist/_virtual/rolldown_runtime.cjs +0 -37
  23. package/dist/_virtual/rolldown_runtime.mjs +0 -29
  24. package/dist/components/crypto.cjs +0 -147
  25. package/dist/components/crypto.d.cts +0 -13
  26. package/dist/components/crypto.d.mts +0 -13
  27. package/dist/components/crypto.mjs +0 -147
  28. package/dist/components/index.cjs +0 -1
  29. package/dist/components/index.d.mts +0 -1
  30. package/dist/components/index.mjs +0 -3
  31. package/dist/deepkit/schemas/reflection.cjs +0 -3998
  32. package/dist/deepkit/schemas/reflection.d.cts +0 -1560
  33. package/dist/deepkit/schemas/reflection.d.mts +0 -1560
  34. package/dist/deepkit/schemas/reflection.mjs +0 -3996
  35. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  36. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  37. package/dist/deepkit/src/capnp.cjs +0 -913
  38. package/dist/deepkit/src/capnp.mjs +0 -911
  39. package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
  40. package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
  41. package/dist/deepkit/src/reflect-type.cjs +0 -22
  42. package/dist/deepkit/src/reflect-type.mjs +0 -20
  43. package/dist/deepkit/src/resolve-reflections.cjs +0 -16
  44. package/dist/deepkit/src/resolve-reflections.mjs +0 -15
  45. package/dist/deepkit/src/transformer.cjs +0 -52
  46. package/dist/deepkit/src/transformer.mjs +0 -49
  47. package/dist/deepkit/src/transpile.cjs +0 -29
  48. package/dist/deepkit/src/transpile.mjs +0 -27
  49. package/dist/deepkit/src/types.d.cts +0 -10
  50. package/dist/deepkit/src/types.d.mts +0 -10
  51. package/dist/deepkit/src/utilities.cjs +0 -66
  52. package/dist/deepkit/src/utilities.mjs +0 -65
  53. package/dist/deepkit/src/vendor/type-compiler/index.cjs +0 -38
  54. package/dist/deepkit/src/vendor/type-compiler/index.mjs +0 -19
  55. package/dist/deepkit/src/vendor/type.cjs +0 -20
  56. package/dist/deepkit/src/vendor/type.d.cts +0 -7
  57. package/dist/deepkit/src/vendor/type.d.mts +0 -7
  58. package/dist/deepkit/src/vendor/type.mjs +0 -11
  59. package/dist/plugin-alloy/src/core/components/output.cjs +0 -38
  60. package/dist/plugin-alloy/src/core/components/output.mjs +0 -37
  61. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -20
  62. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -19
  63. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -60
  64. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -58
  65. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -60
  66. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -54
  67. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  68. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  69. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
  70. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
  71. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
  72. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
  73. package/dist/plugin-alloy/src/index.cjs +0 -90
  74. package/dist/plugin-alloy/src/index.mjs +0 -88
  75. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -7
  76. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -9
  77. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -5
  78. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -7
  79. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -17
  80. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
  81. package/dist/plugin-alloy/src/types/components.d.mts +0 -4
  82. package/dist/plugin-alloy/src/types/index.d.mts +0 -2
  83. package/dist/plugin-alloy/src/types/plugin.d.cts +0 -37
  84. package/dist/plugin-alloy/src/types/plugin.d.mts +0 -37
  85. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -47
  86. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -46
  87. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -75
  88. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -73
  89. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -359
  90. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -350
  91. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -143
  92. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -140
  93. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -53
  94. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -52
  95. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -94
  96. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -93
  97. package/dist/plugin-automd/src/index.cjs +0 -101
  98. package/dist/plugin-automd/src/index.mjs +0 -98
  99. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  100. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  101. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  102. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  103. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
  104. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
  105. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
  106. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
  107. package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
  108. package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
  109. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  110. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  111. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
  112. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
  113. package/dist/plugin-babel/src/helpers/options.cjs +0 -50
  114. package/dist/plugin-babel/src/helpers/options.mjs +0 -47
  115. package/dist/plugin-babel/src/index.cjs +0 -91
  116. package/dist/plugin-babel/src/index.mjs +0 -89
  117. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  118. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  119. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  120. package/dist/plugin-env/src/babel/index.cjs +0 -1
  121. package/dist/plugin-env/src/babel/index.mjs +0 -3
  122. package/dist/plugin-env/src/babel/plugin.cjs +0 -121
  123. package/dist/plugin-env/src/babel/plugin.mjs +0 -119
  124. package/dist/plugin-env/src/components/docs.cjs +0 -9
  125. package/dist/plugin-env/src/components/docs.mjs +0 -11
  126. package/dist/plugin-env/src/components/env.cjs +0 -487
  127. package/dist/plugin-env/src/components/env.mjs +0 -484
  128. package/dist/plugin-env/src/components/index.cjs +0 -2
  129. package/dist/plugin-env/src/components/index.mjs +0 -4
  130. package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -22
  131. package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -21
  132. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -55
  133. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -54
  134. package/dist/plugin-env/src/helpers/index.cjs +0 -6
  135. package/dist/plugin-env/src/helpers/index.mjs +0 -8
  136. package/dist/plugin-env/src/helpers/load.cjs +0 -83
  137. package/dist/plugin-env/src/helpers/load.mjs +0 -80
  138. package/dist/plugin-env/src/helpers/persistence.cjs +0 -200
  139. package/dist/plugin-env/src/helpers/persistence.mjs +0 -189
  140. package/dist/plugin-env/src/helpers/reflect.cjs +0 -125
  141. package/dist/plugin-env/src/helpers/reflect.mjs +0 -117
  142. package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -24
  143. package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -23
  144. package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -2
  145. package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -4
  146. package/dist/plugin-env/src/index.cjs +0 -172
  147. package/dist/plugin-env/src/index.mjs +0 -170
  148. package/dist/plugin-env/src/types/plugin.d.cts +0 -151
  149. package/dist/plugin-env/src/types/plugin.d.mts +0 -153
  150. package/dist/plugin-env/src/types/runtime.d.cts +0 -792
  151. package/dist/plugin-env/src/types/runtime.d.mts +0 -792
  152. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
  153. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
  154. package/dist/powerlines/src/lib/entry.cjs +0 -12
  155. package/dist/powerlines/src/lib/entry.mjs +0 -14
  156. package/dist/powerlines/src/lib/logger.cjs +0 -41
  157. package/dist/powerlines/src/lib/logger.mjs +0 -39
  158. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -35
  159. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -34
  160. package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
  161. package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
  162. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -30
  163. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -29
  164. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  165. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
  166. package/dist/powerlines/src/types/babel.d.cts +0 -22
  167. package/dist/powerlines/src/types/babel.d.mts +0 -22
  168. package/dist/powerlines/src/types/build.d.cts +0 -145
  169. package/dist/powerlines/src/types/build.d.mts +0 -147
  170. package/dist/powerlines/src/types/commands.d.cts +0 -8
  171. package/dist/powerlines/src/types/commands.d.mts +0 -9
  172. package/dist/powerlines/src/types/config.d.cts +0 -380
  173. package/dist/powerlines/src/types/config.d.mts +0 -381
  174. package/dist/powerlines/src/types/context.d.cts +0 -414
  175. package/dist/powerlines/src/types/context.d.mts +0 -416
  176. package/dist/powerlines/src/types/fs.d.cts +0 -486
  177. package/dist/powerlines/src/types/fs.d.mts +0 -486
  178. package/dist/powerlines/src/types/hooks.d.mts +0 -2
  179. package/dist/powerlines/src/types/plugin.d.cts +0 -231
  180. package/dist/powerlines/src/types/plugin.d.mts +0 -231
  181. package/dist/powerlines/src/types/resolved.d.cts +0 -82
  182. package/dist/powerlines/src/types/resolved.d.mts +0 -83
  183. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  184. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
@@ -1,487 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- const require_type = require('../../../deepkit/src/vendor/type.cjs');
3
- const require_context = require('../../../plugin-alloy/src/core/contexts/context.cjs');
4
- const require_refkey = require('../../../plugin-alloy/src/helpers/refkey.cjs');
5
- const require_tsdoc = require('../../../plugin-alloy/src/typescript/components/tsdoc.cjs');
6
- const require_builtin_file = require('../../../plugin-alloy/src/typescript/components/builtin-file.cjs');
7
- const require_typescript_interface = require('../../../plugin-alloy/src/typescript/components/typescript-interface.cjs');
8
- const require_typescript_object = require('../../../plugin-alloy/src/typescript/components/typescript-object.cjs');
9
- const require_load = require('../helpers/load.cjs');
10
- const require_create_reflection_resource = require('../helpers/create-reflection-resource.cjs');
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 require_type.type_exports.ReflectionClass({
152
- kind: require_type.type_exports.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;