@powerlines/plugin-env 0.16.233 → 0.16.235
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.
- package/dist/babel/plugin.cjs +23 -71
- package/dist/babel/plugin.d.cts.map +1 -1
- package/dist/babel/plugin.d.mts.map +1 -1
- package/dist/babel/plugin.mjs +23 -71
- package/dist/babel/plugin.mjs.map +1 -1
- package/dist/components/docs.cjs +14 -14
- package/dist/components/docs.d.cts +0 -2
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +0 -2
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/docs.mjs +14 -14
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/env-builtin.cjs +233 -426
- package/dist/components/env-builtin.d.cts +1 -4
- package/dist/components/env-builtin.d.cts.map +1 -1
- package/dist/components/env-builtin.d.mts +1 -4
- package/dist/components/env-builtin.d.mts.map +1 -1
- package/dist/components/env-builtin.mjs +236 -428
- package/dist/components/env-builtin.mjs.map +1 -1
- package/dist/helpers/index.cjs +9 -26
- package/dist/helpers/index.d.cts +3 -5
- package/dist/helpers/index.d.mts +3 -5
- package/dist/helpers/index.mjs +3 -5
- package/dist/helpers/load.cjs +8 -7
- package/dist/helpers/load.d.cts +3 -3
- package/dist/helpers/load.d.cts.map +1 -1
- package/dist/helpers/load.d.mts +3 -3
- package/dist/helpers/load.d.mts.map +1 -1
- package/dist/helpers/load.mjs +7 -6
- package/dist/helpers/load.mjs.map +1 -1
- package/dist/helpers/schema.cjs +206 -0
- package/dist/helpers/schema.d.cts +53 -0
- package/dist/helpers/schema.d.cts.map +1 -0
- package/dist/helpers/schema.d.mts +53 -0
- package/dist/helpers/schema.d.mts.map +1 -0
- package/dist/helpers/schema.mjs +199 -0
- package/dist/helpers/schema.mjs.map +1 -0
- package/dist/index.cjs +23 -201
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +25 -203
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +2 -2
- package/dist/types/plugin.cjs +16 -24
- package/dist/types/plugin.d.cts +23 -57
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +23 -57
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/plugin.mjs +16 -25
- package/dist/types/plugin.mjs.map +1 -1
- package/package.json +12 -26
- package/dist/helpers/create-reflection-resource.cjs +0 -23
- package/dist/helpers/create-reflection-resource.d.cts +0 -13
- package/dist/helpers/create-reflection-resource.d.cts.map +0 -1
- package/dist/helpers/create-reflection-resource.d.mts +0 -13
- package/dist/helpers/create-reflection-resource.d.mts.map +0 -1
- package/dist/helpers/create-reflection-resource.mjs +0 -23
- package/dist/helpers/create-reflection-resource.mjs.map +0 -1
- package/dist/helpers/persistence.cjs +0 -309
- package/dist/helpers/persistence.d.cts +0 -84
- package/dist/helpers/persistence.d.cts.map +0 -1
- package/dist/helpers/persistence.d.mts +0 -84
- package/dist/helpers/persistence.d.mts.map +0 -1
- package/dist/helpers/persistence.mjs +0 -297
- package/dist/helpers/persistence.mjs.map +0 -1
- package/dist/helpers/reflect.cjs +0 -290
- package/dist/helpers/reflect.d.cts +0 -68
- package/dist/helpers/reflect.d.cts.map +0 -1
- package/dist/helpers/reflect.d.mts +0 -68
- package/dist/helpers/reflect.d.mts.map +0 -1
- package/dist/helpers/reflect.mjs +0 -281
- package/dist/helpers/reflect.mjs.map +0 -1
- package/dist/helpers/template-helpers.cjs +0 -70
- package/dist/helpers/template-helpers.d.cts +0 -15
- package/dist/helpers/template-helpers.d.cts.map +0 -1
- package/dist/helpers/template-helpers.d.mts +0 -15
- package/dist/helpers/template-helpers.d.mts.map +0 -1
- package/dist/helpers/template-helpers.mjs +0 -69
- package/dist/helpers/template-helpers.mjs.map +0 -1
|
@@ -2,10 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_types_plugin = require('../types/plugin.cjs');
|
|
4
4
|
const require_helpers_load = require('../helpers/load.cjs');
|
|
5
|
-
let
|
|
6
|
-
let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
7
|
-
let defu = require("defu");
|
|
8
|
-
defu = require_runtime.__toESM(defu);
|
|
5
|
+
let _powerlines_schema_helpers = require("@powerlines/schema/helpers");
|
|
9
6
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
10
7
|
let _alloy_js_core = require("@alloy-js/core");
|
|
11
8
|
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
@@ -16,7 +13,7 @@ let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powe
|
|
|
16
13
|
let _powerlines_plugin_alloy_typescript_components_interface_declaration = require("@powerlines/plugin-alloy/typescript/components/interface-declaration");
|
|
17
14
|
let _powerlines_plugin_alloy_typescript_components_object_declaration = require("@powerlines/plugin-alloy/typescript/components/object-declaration");
|
|
18
15
|
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
19
|
-
let
|
|
16
|
+
let _powerlines_plugin_alloy_typescript_components_tsdoc_schema = require("@powerlines/plugin-alloy/typescript/components/tsdoc-schema");
|
|
20
17
|
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
21
18
|
|
|
22
19
|
//#region src/components/env-builtin.tsx
|
|
@@ -47,14 +44,14 @@ function __assignType(fn, args) {
|
|
|
47
44
|
/**
|
|
48
45
|
* Generates the environment configuration typescript definition for the Powerlines project.
|
|
49
46
|
*/
|
|
50
|
-
function EnvTypeDefinition(
|
|
51
|
-
const [{ defaultValue, reflection }] = (0, _alloy_js_core.splitProps)(props, ["defaultValue", "reflection"]);
|
|
47
|
+
function EnvTypeDefinition() {
|
|
52
48
|
const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
|
|
53
49
|
return [
|
|
54
50
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
55
51
|
name: "UnprefixedEnv",
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
get schema() {
|
|
53
|
+
return context.env.vars.schema;
|
|
54
|
+
},
|
|
58
55
|
"export": true
|
|
59
56
|
}),
|
|
60
57
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
@@ -81,7 +78,7 @@ function EnvTypeDefinition(props) {
|
|
|
81
78
|
get children() {
|
|
82
79
|
return __assignType((prefix) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
83
80
|
get each() {
|
|
84
|
-
return
|
|
81
|
+
return Object.values((0, _powerlines_schema_helpers.getProperties)(context.env.vars.schema)).filter(__assignType((property) => !property.metadata?.isIgnored, [
|
|
85
82
|
"property",
|
|
86
83
|
"",
|
|
87
84
|
"P\"2!\"/\""
|
|
@@ -89,15 +86,15 @@ function EnvTypeDefinition(props) {
|
|
|
89
86
|
},
|
|
90
87
|
doubleHardline: true,
|
|
91
88
|
get children() {
|
|
92
|
-
return __assignType((property) => [(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
89
|
+
return __assignType((property) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc_schema.TSDocSchemaProperty, { schema: property }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
93
90
|
get name() {
|
|
94
|
-
return `${prefix}_${property.
|
|
91
|
+
return `${prefix}_${property.metadata?.name}`;
|
|
95
92
|
},
|
|
96
93
|
get type() {
|
|
97
|
-
return `UnprefixedEnv["${property.
|
|
94
|
+
return `UnprefixedEnv["${property.metadata?.name}"]`;
|
|
98
95
|
},
|
|
99
|
-
get
|
|
100
|
-
return property.isReadonly
|
|
96
|
+
get isReadonly() {
|
|
97
|
+
return property.metadata?.isReadonly;
|
|
101
98
|
}
|
|
102
99
|
})], [
|
|
103
100
|
"property",
|
|
@@ -118,12 +115,9 @@ function EnvTypeDefinition(props) {
|
|
|
118
115
|
];
|
|
119
116
|
}
|
|
120
117
|
EnvTypeDefinition.__type = [
|
|
121
|
-
() => __ΩOmit,
|
|
122
|
-
"name",
|
|
123
|
-
"props",
|
|
124
118
|
"EnvTypeDefinition",
|
|
125
119
|
"Generates the environment configuration typescript definition for the Powerlines project.",
|
|
126
|
-
"P
|
|
120
|
+
"P\"/!?\""
|
|
127
121
|
];
|
|
128
122
|
const __ΩConfigPropertyConditionalProps = [
|
|
129
123
|
() => require_types_plugin.__ΩEnvPluginContext,
|
|
@@ -155,31 +149,31 @@ const __ΩConfigPropertyProps = [
|
|
|
155
149
|
"index",
|
|
156
150
|
() => require_types_plugin.__ΩEnvPluginContext,
|
|
157
151
|
"context",
|
|
152
|
+
"name",
|
|
158
153
|
"property",
|
|
159
154
|
"ConfigPropertyProps",
|
|
160
|
-
"P!'4!n\"4
|
|
155
|
+
"P!'4!n\"4#&4$!4%Mw&y"
|
|
161
156
|
];
|
|
162
157
|
function ConfigPropertyGet(props) {
|
|
163
|
-
const [{ context, property, index }] = (0, _alloy_js_core.splitProps)(props, [
|
|
158
|
+
const [{ context, name, property, index }] = (0, _alloy_js_core.splitProps)(props, [
|
|
164
159
|
"context",
|
|
160
|
+
"name",
|
|
165
161
|
"property",
|
|
166
162
|
"index"
|
|
167
163
|
]);
|
|
168
164
|
return [index === 0 ? (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
169
165
|
get condition() {
|
|
170
166
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
171
|
-
|
|
172
|
-
return property.getNameAsString();
|
|
173
|
-
},
|
|
167
|
+
name,
|
|
174
168
|
context
|
|
175
169
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
176
170
|
get when() {
|
|
177
|
-
return
|
|
171
|
+
return property.metadata?.alias && property.metadata?.alias.length > 0;
|
|
178
172
|
},
|
|
179
173
|
get children() {
|
|
180
174
|
return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
181
175
|
get each() {
|
|
182
|
-
return property.
|
|
176
|
+
return property.metadata?.alias ?? [];
|
|
183
177
|
},
|
|
184
178
|
joiner: _alloy_js_core.code` || `,
|
|
185
179
|
get children() {
|
|
@@ -196,24 +190,20 @@ function ConfigPropertyGet(props) {
|
|
|
196
190
|
}
|
|
197
191
|
})];
|
|
198
192
|
},
|
|
199
|
-
|
|
200
|
-
return _alloy_js_core.code`return target["${property.getNameAsString()}"];`;
|
|
201
|
-
}
|
|
193
|
+
children: _alloy_js_core.code`return target["${name}"];`
|
|
202
194
|
}) : (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
203
195
|
get condition() {
|
|
204
196
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
205
|
-
|
|
206
|
-
return property.getNameAsString();
|
|
207
|
-
},
|
|
197
|
+
name,
|
|
208
198
|
context
|
|
209
199
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
210
200
|
get when() {
|
|
211
|
-
return
|
|
201
|
+
return property.metadata?.alias && property.metadata?.alias.length > 0;
|
|
212
202
|
},
|
|
213
203
|
get children() {
|
|
214
204
|
return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
215
205
|
get each() {
|
|
216
|
-
return property.
|
|
206
|
+
return property.metadata?.alias ?? [];
|
|
217
207
|
},
|
|
218
208
|
joiner: _alloy_js_core.code` || `,
|
|
219
209
|
get children() {
|
|
@@ -230,9 +220,7 @@ function ConfigPropertyGet(props) {
|
|
|
230
220
|
}
|
|
231
221
|
})];
|
|
232
222
|
},
|
|
233
|
-
|
|
234
|
-
return _alloy_js_core.code`return target["${property.getNameAsString()}"];`;
|
|
235
|
-
}
|
|
223
|
+
children: _alloy_js_core.code`return target["${name}"];`
|
|
236
224
|
})];
|
|
237
225
|
}
|
|
238
226
|
ConfigPropertyGet.__type = [
|
|
@@ -242,26 +230,25 @@ ConfigPropertyGet.__type = [
|
|
|
242
230
|
"Pn!2\"\"/#"
|
|
243
231
|
];
|
|
244
232
|
function ConfigPropertySet(props) {
|
|
245
|
-
const [{ context, property, index }] = (0, _alloy_js_core.splitProps)(props, [
|
|
233
|
+
const [{ context, name, property, index }] = (0, _alloy_js_core.splitProps)(props, [
|
|
246
234
|
"context",
|
|
235
|
+
"name",
|
|
247
236
|
"property",
|
|
248
237
|
"index"
|
|
249
238
|
]);
|
|
250
239
|
return [index === 0 ? (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
251
240
|
get condition() {
|
|
252
241
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
253
|
-
|
|
254
|
-
return property.getNameAsString();
|
|
255
|
-
},
|
|
242
|
+
name,
|
|
256
243
|
context
|
|
257
244
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
258
245
|
get when() {
|
|
259
|
-
return
|
|
246
|
+
return property.metadata?.alias && property.metadata?.alias.length > 0;
|
|
260
247
|
},
|
|
261
248
|
get children() {
|
|
262
249
|
return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
263
250
|
get each() {
|
|
264
|
-
return property.
|
|
251
|
+
return property.metadata?.alias ?? [];
|
|
265
252
|
},
|
|
266
253
|
joiner: _alloy_js_core.code` || `,
|
|
267
254
|
get children() {
|
|
@@ -278,27 +265,23 @@ function ConfigPropertySet(props) {
|
|
|
278
265
|
}
|
|
279
266
|
})];
|
|
280
267
|
},
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
target["${property.getNameAsString()}"] = newValue;
|
|
268
|
+
children: _alloy_js_core.code`
|
|
269
|
+
target["${name}"] = newValue;
|
|
284
270
|
return true;
|
|
285
|
-
|
|
286
|
-
}
|
|
271
|
+
`
|
|
287
272
|
}) : (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
288
273
|
get condition() {
|
|
289
274
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
290
|
-
|
|
291
|
-
return property.getNameAsString();
|
|
292
|
-
},
|
|
275
|
+
name,
|
|
293
276
|
context
|
|
294
277
|
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
295
278
|
get when() {
|
|
296
|
-
return
|
|
279
|
+
return property.metadata?.alias && property.metadata?.alias.length > 0;
|
|
297
280
|
},
|
|
298
281
|
get children() {
|
|
299
282
|
return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
300
283
|
get each() {
|
|
301
|
-
return property.
|
|
284
|
+
return property.metadata?.alias ?? [];
|
|
302
285
|
},
|
|
303
286
|
joiner: _alloy_js_core.code` || `,
|
|
304
287
|
get children() {
|
|
@@ -315,12 +298,10 @@ function ConfigPropertySet(props) {
|
|
|
315
298
|
}
|
|
316
299
|
})];
|
|
317
300
|
},
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
target["${property.getNameAsString()}"] = newValue;
|
|
301
|
+
children: _alloy_js_core.code`
|
|
302
|
+
target["${name}"] = newValue;
|
|
321
303
|
return true;
|
|
322
|
-
|
|
323
|
-
}
|
|
304
|
+
`
|
|
324
305
|
})];
|
|
325
306
|
}
|
|
326
307
|
ConfigPropertySet.__type = [
|
|
@@ -334,58 +315,33 @@ const __ΩEnvBuiltinProps = [
|
|
|
334
315
|
"id",
|
|
335
316
|
"Children",
|
|
336
317
|
"defaultConfig",
|
|
337
|
-
"reflection",
|
|
338
318
|
"EnvBuiltinProps",
|
|
339
|
-
"P!.\"o!#\"w#4$
|
|
319
|
+
"P!.\"o!#\"w#4$8Mw%y"
|
|
340
320
|
];
|
|
341
321
|
const createEnvRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("createEnv");
|
|
342
322
|
const envRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("env");
|
|
343
|
-
const envSerializerRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("EnvSerializer");
|
|
344
323
|
/**
|
|
345
324
|
* Generates the environment configuration module for the Powerlines project.
|
|
346
325
|
*/
|
|
347
326
|
function EnvBuiltin(props) {
|
|
348
|
-
const [{ defaultConfig,
|
|
349
|
-
"defaultConfig",
|
|
350
|
-
"reflection",
|
|
351
|
-
"children"
|
|
352
|
-
]);
|
|
327
|
+
const [{ defaultConfig, children }, rest] = (0, _alloy_js_core.splitProps)(props, ["defaultConfig", "children"]);
|
|
353
328
|
const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
|
|
354
329
|
const defaultValue = (0, _alloy_js_core.computed)(() => context && require_helpers_load.loadEnvFromContext(context, process.env));
|
|
355
|
-
const
|
|
356
|
-
const result = new _powerlines_deepkit_vendor_type.ReflectionClass({
|
|
357
|
-
kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
|
|
358
|
-
description: `The initial environment configuration state for the ${(0, _stryke_string_format_title_case.titleCase)(context?.config?.name)} project.`,
|
|
359
|
-
types: []
|
|
360
|
-
}, reflection);
|
|
361
|
-
result.getProperties().filter(__assignType((property) => property.isRuntime() || property.getTags().runtime === true, [
|
|
362
|
-
"property",
|
|
363
|
-
"",
|
|
364
|
-
"P\"2!\"/\""
|
|
365
|
-
])).forEach(__assignType((property) => {
|
|
366
|
-
result.removeProperty(property.getNameAsString());
|
|
367
|
-
}, [
|
|
368
|
-
"property",
|
|
369
|
-
"",
|
|
370
|
-
"P\"2!\"/\""
|
|
371
|
-
]));
|
|
372
|
-
return result;
|
|
373
|
-
});
|
|
374
|
-
const reflectionGetProperties = (0, _alloy_js_core.computed)(() => reflection?.getProperties().filter(__assignType((property) => !property.isIgnored(), [
|
|
330
|
+
const reflectionGetProperties = (0, _alloy_js_core.computed)(() => Object.values((0, _powerlines_schema_helpers.getProperties)(context.env.vars.schema)).filter(__assignType((property) => !property.metadata?.isIgnored, [
|
|
375
331
|
"property",
|
|
376
332
|
"",
|
|
377
333
|
"P\"2!\"/\""
|
|
378
|
-
])).sort(__assignType((a, b) => a.
|
|
334
|
+
])).sort(__assignType((a, b) => !a.metadata?.name && !b.metadata?.name ? 0 : !a.metadata?.name ? 1 : !b.metadata?.name ? -1 : a.metadata?.name.localeCompare(b.metadata?.name), [
|
|
379
335
|
"a",
|
|
380
336
|
"b",
|
|
381
337
|
"",
|
|
382
338
|
"P\"2!\"2\"\"/#"
|
|
383
339
|
])) ?? []);
|
|
384
|
-
const reflectionSetProperties = (0, _alloy_js_core.computed)(() =>
|
|
340
|
+
const reflectionSetProperties = (0, _alloy_js_core.computed)(() => Object.values((0, _powerlines_schema_helpers.getProperties)(context.env.vars.schema)).filter(__assignType((property) => !property.metadata?.isIgnored && !property.metadata?.isReadonly, [
|
|
385
341
|
"property",
|
|
386
342
|
"",
|
|
387
343
|
"P\"2!\"/\""
|
|
388
|
-
])).sort(__assignType((a, b) => a.
|
|
344
|
+
])).sort(__assignType((a, b) => !a.metadata?.name && !b.metadata?.name ? 0 : !a.metadata?.name ? 1 : !b.metadata?.name ? -1 : a.metadata?.name.localeCompare(b.metadata?.name), [
|
|
389
345
|
"a",
|
|
390
346
|
"b",
|
|
391
347
|
"",
|
|
@@ -394,219 +350,60 @@ function EnvBuiltin(props) {
|
|
|
394
350
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
395
351
|
id: "env",
|
|
396
352
|
description: "The environment configuration module provides an interface to define environment configuration parameters."
|
|
397
|
-
}, rest, {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
"
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
"extends": "Serializer",
|
|
452
|
-
"export": true,
|
|
453
|
-
get children() {
|
|
454
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ClassMethod, {
|
|
455
|
-
name: "constructor",
|
|
456
|
-
"public": true,
|
|
457
|
-
doc: "Initializes a new instance of the `EnvSerializer` class.",
|
|
458
|
-
children: _alloy_js_core.code`super("env");
|
|
459
|
-
|
|
460
|
-
this.deserializeRegistry.register(
|
|
461
|
-
ReflectionKind.boolean,
|
|
462
|
-
(type: Type, state: TemplateState) => {
|
|
463
|
-
state.addSetter(
|
|
464
|
-
\`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()}\`
|
|
465
|
-
);
|
|
466
|
-
}
|
|
467
|
-
); `
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
}),
|
|
471
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
472
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
473
|
-
name: "envNamingStrategy",
|
|
474
|
-
"const": true,
|
|
475
|
-
doc: "The environment naming strategy for the runtime.",
|
|
476
|
-
get initializer() {
|
|
477
|
-
return _alloy_js_core.code`new class extends NamingStrategy {
|
|
478
|
-
constructor() {
|
|
479
|
-
super("env");
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
getPropertyName(type: TypeProperty | TypePropertySignature, forSerializer: string): string | undefined {
|
|
483
|
-
const name = super.getPropertyName(type, forSerializer);
|
|
484
|
-
if (!name) {
|
|
485
|
-
return name;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
return name.replace(/^(${(0, _stryke_helpers_get_unique.getUnique)(context.config.env.prefix).map(__assignType((prefix) => prefix.replace(/_$/, ""), [
|
|
489
|
-
"prefix",
|
|
490
|
-
"",
|
|
491
|
-
"P\"2!\"/\""
|
|
492
|
-
])).join("|")})_/, "");
|
|
493
|
-
}
|
|
494
|
-
}; `;
|
|
495
|
-
}
|
|
496
|
-
}),
|
|
497
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
498
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
499
|
-
heading: "A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.",
|
|
500
|
-
get children() {
|
|
501
|
-
return [
|
|
502
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
|
|
503
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
|
|
504
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
|
|
505
|
-
];
|
|
506
|
-
}
|
|
507
|
-
}),
|
|
508
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
509
|
-
name: "envSerializer",
|
|
510
|
-
"const": true,
|
|
511
|
-
get initializer() {
|
|
512
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.NewExpression, {
|
|
513
|
-
args: [],
|
|
514
|
-
target: "EnvSerializer"
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
}),
|
|
518
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
519
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
520
|
-
name: "_serializeEnv",
|
|
521
|
-
"const": true,
|
|
522
|
-
initializer: "serializeFunction<Env>(envSerializer, envNamingStrategy)"
|
|
523
|
-
}),
|
|
524
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
525
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
526
|
-
heading: "Serialize a environment configuration object to JSON data objects (not a JSON string).",
|
|
527
|
-
get children() {
|
|
528
|
-
return [
|
|
529
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The resulting JSON object can be stringified using \`JSON.stringify()\`.` }),
|
|
530
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `const json = serializeEnv(env);` }),
|
|
531
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
532
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
533
|
-
name: "input",
|
|
534
|
-
children: `The environment configuration object to serialize.`
|
|
535
|
-
}),
|
|
536
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The serialized environment configuration as JSON data objects.` }),
|
|
537
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocThrows, { children: `ValidationError when serialization or validation fails.` })
|
|
538
|
-
];
|
|
539
|
-
}
|
|
540
|
-
}),
|
|
541
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
542
|
-
name: "serializeEnv",
|
|
543
|
-
"export": true,
|
|
544
|
-
parameters: [{
|
|
545
|
-
name: "input",
|
|
546
|
-
type: "Env"
|
|
547
|
-
}],
|
|
548
|
-
children: _alloy_js_core.code` return _serializeEnv(input, { loosely: true }); `
|
|
549
|
-
}),
|
|
550
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
551
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
552
|
-
name: "_deserializeEnv",
|
|
553
|
-
"const": true,
|
|
554
|
-
initializer: "deserializeFunction<Env>(envSerializer, envNamingStrategy)"
|
|
555
|
-
}),
|
|
556
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
557
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
558
|
-
heading: "Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.",
|
|
559
|
-
get children() {
|
|
560
|
-
return [
|
|
561
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `Types that are already correct will be used as-is.` }),
|
|
562
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `const env = deserializeEnv(json);` }),
|
|
563
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocThrows, { children: `ValidationError when deserialization fails.` })
|
|
564
|
-
];
|
|
565
|
-
}
|
|
566
|
-
}),
|
|
567
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
568
|
-
name: "deserializeEnv",
|
|
569
|
-
"export": true,
|
|
570
|
-
parameters: [{
|
|
571
|
-
name: "input",
|
|
572
|
-
type: "Env"
|
|
573
|
-
}],
|
|
574
|
-
children: _alloy_js_core.code` return _deserializeEnv(input, { loosely: true }); `
|
|
575
|
-
}),
|
|
576
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
577
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
578
|
-
heading: "Initializes the Powerlines environment configuration module.",
|
|
579
|
-
get children() {
|
|
580
|
-
return [
|
|
581
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
|
|
582
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
583
|
-
name: "environmentConfig",
|
|
584
|
-
children: `The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`
|
|
585
|
-
}),
|
|
586
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The initialized Powerlines configuration object.` })
|
|
587
|
-
];
|
|
588
|
-
}
|
|
589
|
-
}),
|
|
590
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
591
|
-
get when() {
|
|
592
|
-
return Boolean(context?.entryPath);
|
|
593
|
-
},
|
|
594
|
-
get children() {
|
|
595
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
596
|
-
refkey: createEnvRefkey,
|
|
597
|
-
async: false,
|
|
598
|
-
"export": true,
|
|
599
|
-
name: "createEnv",
|
|
600
|
-
parameters: [{
|
|
601
|
-
name: "environmentConfig",
|
|
602
|
-
type: `Partial<Env>`,
|
|
603
|
-
optional: false,
|
|
604
|
-
default: "{}"
|
|
605
|
-
}],
|
|
606
|
-
returnType: "Env",
|
|
607
|
-
get children() {
|
|
608
|
-
return [
|
|
609
|
-
_alloy_js_core.code`
|
|
353
|
+
}, rest, { get children() {
|
|
354
|
+
return [
|
|
355
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
356
|
+
get when() {
|
|
357
|
+
return Boolean(context.env.vars.schema);
|
|
358
|
+
},
|
|
359
|
+
get children() {
|
|
360
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(EnvTypeDefinition, { defaultValue }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})];
|
|
361
|
+
}
|
|
362
|
+
}),
|
|
363
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_object_declaration.ObjectDeclaration, {
|
|
364
|
+
name: "initialEnv",
|
|
365
|
+
type: "Partial<Env>",
|
|
366
|
+
get schema() {
|
|
367
|
+
return context.env.vars.schema;
|
|
368
|
+
},
|
|
369
|
+
"export": true,
|
|
370
|
+
"const": true,
|
|
371
|
+
doc: "The initial environment configuration object values for the runtime."
|
|
372
|
+
}),
|
|
373
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
374
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
375
|
+
heading: "Initializes the Powerlines environment configuration module.",
|
|
376
|
+
get children() {
|
|
377
|
+
return [
|
|
378
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
|
|
379
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
380
|
+
name: "environmentConfig",
|
|
381
|
+
children: `The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`
|
|
382
|
+
}),
|
|
383
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The initialized Powerlines configuration object.` })
|
|
384
|
+
];
|
|
385
|
+
}
|
|
386
|
+
}),
|
|
387
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
388
|
+
get when() {
|
|
389
|
+
return Boolean(context?.entryPath);
|
|
390
|
+
},
|
|
391
|
+
get children() {
|
|
392
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
393
|
+
refkey: createEnvRefkey,
|
|
394
|
+
async: false,
|
|
395
|
+
"export": true,
|
|
396
|
+
name: "createEnv",
|
|
397
|
+
parameters: [{
|
|
398
|
+
name: "environmentConfig",
|
|
399
|
+
type: `Partial<Env>`,
|
|
400
|
+
optional: false,
|
|
401
|
+
default: "{}"
|
|
402
|
+
}],
|
|
403
|
+
returnType: "Env",
|
|
404
|
+
get children() {
|
|
405
|
+
return [
|
|
406
|
+
_alloy_js_core.code`
|
|
610
407
|
return new Proxy<Env>(
|
|
611
408
|
deserializeEnv({
|
|
612
409
|
...initialEnv,
|
|
@@ -614,80 +411,91 @@ function EnvBuiltin(props) {
|
|
|
614
411
|
} as Env),
|
|
615
412
|
{
|
|
616
413
|
get: (target: UnprefixedEnv, propertyName: string) => { `,
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
414
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
415
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
416
|
+
get each() {
|
|
417
|
+
return reflectionGetProperties.value;
|
|
418
|
+
},
|
|
419
|
+
get children() {
|
|
420
|
+
return __assignType((property, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyGet, {
|
|
421
|
+
index,
|
|
422
|
+
context,
|
|
423
|
+
get name() {
|
|
424
|
+
return property.name;
|
|
425
|
+
},
|
|
426
|
+
property
|
|
427
|
+
}), [
|
|
428
|
+
"name",
|
|
429
|
+
"property",
|
|
430
|
+
"index",
|
|
431
|
+
"",
|
|
432
|
+
"PP!P&4!MK2\"'2#\"/$"
|
|
433
|
+
]);
|
|
434
|
+
}
|
|
435
|
+
}),
|
|
436
|
+
_alloy_js_core.code`
|
|
634
437
|
return undefined;
|
|
635
438
|
}, `,
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
439
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
440
|
+
_alloy_js_core.code` set: (target: UnprefixedEnv, propertyName: string, newValue: any) => { `,
|
|
441
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
442
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
443
|
+
get each() {
|
|
444
|
+
return reflectionSetProperties.value;
|
|
445
|
+
},
|
|
446
|
+
ender: _alloy_js_core.code` else `,
|
|
447
|
+
get children() {
|
|
448
|
+
return __assignType((property, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertySet, {
|
|
449
|
+
index,
|
|
450
|
+
context,
|
|
451
|
+
get name() {
|
|
452
|
+
return property.name;
|
|
453
|
+
},
|
|
454
|
+
property
|
|
455
|
+
}), [
|
|
456
|
+
"name",
|
|
457
|
+
"property",
|
|
458
|
+
"index",
|
|
459
|
+
"",
|
|
460
|
+
"PP!P&4!MK2\"'2#\"/$"
|
|
461
|
+
]);
|
|
462
|
+
}
|
|
463
|
+
}),
|
|
464
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
465
|
+
_alloy_js_core.code`return false;
|
|
657
466
|
}
|
|
658
467
|
}
|
|
659
468
|
);
|
|
660
469
|
`
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
initializer: _alloy_js_core.code`Boolean(
|
|
470
|
+
];
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
}),
|
|
475
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
476
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
477
|
+
heading: "The environment configuration object.",
|
|
478
|
+
get children() {
|
|
479
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This object provides access to the environment configuration parameters in the application runtime.` });
|
|
480
|
+
}
|
|
481
|
+
}),
|
|
482
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
483
|
+
refkey: envRefkey,
|
|
484
|
+
name: "env",
|
|
485
|
+
type: "Env",
|
|
486
|
+
"export": true,
|
|
487
|
+
"const": true,
|
|
488
|
+
get initializer() {
|
|
489
|
+
return [_alloy_js_core.code`createEnv(${defaultConfig || "{}"} as Partial<Env>);`];
|
|
490
|
+
}
|
|
491
|
+
}),
|
|
492
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
493
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
494
|
+
"export": true,
|
|
495
|
+
"const": true,
|
|
496
|
+
name: "isCI",
|
|
497
|
+
doc: "Detect if the application is running in a continuous integration (CI) environment.",
|
|
498
|
+
initializer: _alloy_js_core.code`Boolean(
|
|
691
499
|
env.CI ||
|
|
692
500
|
env.RUN_ID ||
|
|
693
501
|
env.AGOLA_GIT_REF ||
|
|
@@ -740,66 +548,65 @@ function EnvBuiltin(props) {
|
|
|
740
548
|
env.CI_XCODE_PROJECT ||
|
|
741
549
|
env.XCS || false
|
|
742
550
|
); `
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
551
|
+
}),
|
|
552
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
553
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
554
|
+
heading: "Detect the \\`mode\\` of the current runtime environment.",
|
|
555
|
+
get children() {
|
|
556
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_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:
|
|
749
557
|
- \`production\`
|
|
750
558
|
- \`test\`
|
|
751
559
|
- \`development\`
|
|
752
560
|
` });
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
}));
|
|
561
|
+
}
|
|
562
|
+
}),
|
|
563
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
564
|
+
"export": true,
|
|
565
|
+
"const": true,
|
|
566
|
+
name: "mode",
|
|
567
|
+
initializer: _alloy_js_core.code`String(env.MODE) || "production"; `
|
|
568
|
+
}),
|
|
569
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
570
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
571
|
+
"export": true,
|
|
572
|
+
"const": true,
|
|
573
|
+
name: "isProduction",
|
|
574
|
+
doc: "Detect if the application is running in `\"production\"` mode",
|
|
575
|
+
initializer: _alloy_js_core.code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
|
|
576
|
+
}),
|
|
577
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
578
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
579
|
+
"export": true,
|
|
580
|
+
"const": true,
|
|
581
|
+
name: "isTest",
|
|
582
|
+
doc: "Detect if the application is running in `\"test\"` mode",
|
|
583
|
+
initializer: _alloy_js_core.code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
|
|
584
|
+
}),
|
|
585
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
586
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
587
|
+
"export": true,
|
|
588
|
+
"const": true,
|
|
589
|
+
name: "isDevelopment",
|
|
590
|
+
doc: "Detect if the application is running in `\"development\"` mode",
|
|
591
|
+
initializer: _alloy_js_core.code`["dev", "development"].includes(mode.toLowerCase()); `
|
|
592
|
+
}),
|
|
593
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
594
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
595
|
+
"export": true,
|
|
596
|
+
"const": true,
|
|
597
|
+
name: "isDebug",
|
|
598
|
+
doc: "Detect if the application is currently being debugged",
|
|
599
|
+
initializer: _alloy_js_core.code`Boolean(isDevelopment && env.DEBUG); `
|
|
600
|
+
}),
|
|
601
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
602
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
603
|
+
get when() {
|
|
604
|
+
return Boolean(children);
|
|
605
|
+
},
|
|
606
|
+
children
|
|
607
|
+
})
|
|
608
|
+
];
|
|
609
|
+
} }));
|
|
803
610
|
}
|
|
804
611
|
EnvBuiltin.__type = [
|
|
805
612
|
() => __ΩEnvBuiltinProps,
|