@powerlines/plugin-crypto 0.10.115 → 0.10.117

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 (120) hide show
  1. package/dist/components/crypto.cjs +3 -2
  2. package/dist/components/crypto.mjs +1 -1
  3. package/dist/index.cjs +4 -3
  4. package/dist/index.mjs +3 -3
  5. package/dist/plugin-alloy/src/types/components.d.mts +1 -2
  6. package/dist/plugin-env/src/types/plugin.d.mts +1 -1
  7. package/dist/powerlines/src/types/build.d.mts +6 -6
  8. package/dist/powerlines/src/types/config.d.mts +1 -2
  9. package/dist/powerlines/src/types/tsconfig.d.mts +1 -1
  10. package/package.json +6 -6
  11. package/dist/deepkit/schemas/reflection.cjs +0 -3998
  12. package/dist/deepkit/schemas/reflection.mjs +0 -3996
  13. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  14. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  15. package/dist/deepkit/src/capnp.cjs +0 -913
  16. package/dist/deepkit/src/capnp.mjs +0 -911
  17. package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
  18. package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
  19. package/dist/deepkit/src/reflect-type.cjs +0 -22
  20. package/dist/deepkit/src/reflect-type.mjs +0 -20
  21. package/dist/deepkit/src/resolve-reflections.cjs +0 -16
  22. package/dist/deepkit/src/resolve-reflections.mjs +0 -15
  23. package/dist/deepkit/src/transformer.cjs +0 -52
  24. package/dist/deepkit/src/transformer.mjs +0 -49
  25. package/dist/deepkit/src/transpile.cjs +0 -29
  26. package/dist/deepkit/src/transpile.mjs +0 -27
  27. package/dist/deepkit/src/utilities.cjs +0 -66
  28. package/dist/deepkit/src/utilities.mjs +0 -65
  29. package/dist/plugin-alloy/src/core/components/output.cjs +0 -38
  30. package/dist/plugin-alloy/src/core/components/output.mjs +0 -37
  31. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -20
  32. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -19
  33. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -60
  34. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -58
  35. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -60
  36. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -54
  37. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  38. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  39. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
  40. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
  41. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
  42. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
  43. package/dist/plugin-alloy/src/index.cjs +0 -103
  44. package/dist/plugin-alloy/src/index.mjs +0 -101
  45. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -7
  46. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -9
  47. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -5
  48. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -7
  49. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -17
  50. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
  51. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -47
  52. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -46
  53. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -75
  54. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -73
  55. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -359
  56. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -350
  57. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -153
  58. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -150
  59. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -53
  60. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -52
  61. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -94
  62. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -93
  63. package/dist/plugin-automd/src/index.cjs +0 -101
  64. package/dist/plugin-automd/src/index.mjs +0 -98
  65. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
  66. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
  67. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
  68. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
  69. package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
  70. package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
  71. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  72. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  73. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
  74. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
  75. package/dist/plugin-babel/src/helpers/options.cjs +0 -50
  76. package/dist/plugin-babel/src/helpers/options.mjs +0 -47
  77. package/dist/plugin-babel/src/index.cjs +0 -91
  78. package/dist/plugin-babel/src/index.mjs +0 -89
  79. package/dist/plugin-env/src/babel/index.cjs +0 -1
  80. package/dist/plugin-env/src/babel/index.mjs +0 -3
  81. package/dist/plugin-env/src/babel/plugin.cjs +0 -121
  82. package/dist/plugin-env/src/babel/plugin.mjs +0 -119
  83. package/dist/plugin-env/src/components/docs.cjs +0 -9
  84. package/dist/plugin-env/src/components/docs.mjs +0 -11
  85. package/dist/plugin-env/src/components/env.cjs +0 -487
  86. package/dist/plugin-env/src/components/env.mjs +0 -484
  87. package/dist/plugin-env/src/components/index.cjs +0 -2
  88. package/dist/plugin-env/src/components/index.mjs +0 -4
  89. package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -22
  90. package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -21
  91. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -55
  92. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -54
  93. package/dist/plugin-env/src/helpers/index.cjs +0 -6
  94. package/dist/plugin-env/src/helpers/index.mjs +0 -8
  95. package/dist/plugin-env/src/helpers/load.cjs +0 -83
  96. package/dist/plugin-env/src/helpers/load.mjs +0 -80
  97. package/dist/plugin-env/src/helpers/persistence.cjs +0 -201
  98. package/dist/plugin-env/src/helpers/persistence.mjs +0 -190
  99. package/dist/plugin-env/src/helpers/reflect.cjs +0 -125
  100. package/dist/plugin-env/src/helpers/reflect.mjs +0 -117
  101. package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -24
  102. package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -23
  103. package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -2
  104. package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -4
  105. package/dist/plugin-env/src/index.cjs +0 -172
  106. package/dist/plugin-env/src/index.mjs +0 -170
  107. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
  108. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
  109. package/dist/powerlines/src/lib/entry.cjs +0 -12
  110. package/dist/powerlines/src/lib/entry.mjs +0 -14
  111. package/dist/powerlines/src/lib/logger.cjs +0 -41
  112. package/dist/powerlines/src/lib/logger.mjs +0 -39
  113. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -35
  114. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -34
  115. package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
  116. package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
  117. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -30
  118. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -29
  119. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  120. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
@@ -1,487 +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_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;