@powerlines/plugin-env 0.16.125 → 0.16.126
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 +2 -3
- package/dist/babel/plugin.d.cts +1 -1
- package/dist/babel/plugin.d.cts.map +1 -1
- package/dist/babel/plugin.d.mts +1 -1
- package/dist/babel/plugin.d.mts.map +1 -1
- package/dist/babel/plugin.mjs +2 -3
- package/dist/babel/plugin.mjs.map +1 -1
- package/dist/components/docs.cjs +39 -49
- package/dist/components/docs.mjs +40 -50
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/env-builtin.cjs +397 -513
- package/dist/components/env-builtin.mjs +398 -514
- package/dist/components/env-builtin.mjs.map +1 -1
- package/dist/helpers/load.cjs +1 -1
- package/dist/helpers/load.d.cts +5 -5
- package/dist/helpers/load.d.mts +5 -5
- package/dist/helpers/load.mjs +1 -1
- package/dist/helpers/load.mjs.map +1 -1
- package/dist/helpers/reflect.cjs +2 -2
- package/dist/helpers/reflect.mjs +2 -2
- package/dist/helpers/reflect.mjs.map +1 -1
- package/dist/index.cjs +3 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
|
@@ -50,72 +50,54 @@ function __assignType(fn, args) {
|
|
|
50
50
|
function EnvTypeDefinition(props) {
|
|
51
51
|
const [{ defaultValue, reflection }] = (0, _alloy_js_core.splitProps)(props, ["defaultValue", "reflection"]);
|
|
52
52
|
const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
|
|
53
|
-
return [
|
|
54
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
53
|
+
return (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [
|
|
54
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
55
55
|
name: "UnprefixedEnv",
|
|
56
56
|
defaultValue,
|
|
57
57
|
reflection,
|
|
58
|
-
|
|
58
|
+
export: true
|
|
59
59
|
}),
|
|
60
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
61
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
60
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
61
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
62
62
|
heading: "The environment configuration object with prefixed keys.",
|
|
63
|
-
|
|
64
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The \`Env\` type extends the \`UnprefixedEnv\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.` });
|
|
65
|
-
}
|
|
63
|
+
children: (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The \`Env\` type extends the \`UnprefixedEnv\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.` })
|
|
66
64
|
}),
|
|
67
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
65
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
68
66
|
name: "Env",
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
export: true,
|
|
68
|
+
extends: "UnprefixedEnv",
|
|
69
|
+
children: (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
|
|
70
|
+
each: (0, _stryke_helpers_get_unique.getUnique)(context.config.env.prefix).map(__assignType((prefix) => prefix.replace(/_$/, ""), [
|
|
71
|
+
"prefix",
|
|
72
|
+
"",
|
|
73
|
+
"P\"2!\"/\""
|
|
74
|
+
])),
|
|
75
|
+
doubleHardline: true,
|
|
76
|
+
children: __assignType((prefix) => (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
|
|
77
|
+
each: reflection?.getProperties().filter(__assignType((property) => !property.isIgnored(), [
|
|
78
|
+
"property",
|
|
79
|
+
"",
|
|
80
|
+
"P\"2!\"/\""
|
|
81
|
+
])) ?? [],
|
|
80
82
|
doubleHardline: true,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
get type() {
|
|
97
|
-
return `UnprefixedEnv["${property.getNameAsString()}"]`;
|
|
98
|
-
},
|
|
99
|
-
get readonly() {
|
|
100
|
-
return property.isReadonly();
|
|
101
|
-
}
|
|
102
|
-
})], [
|
|
103
|
-
"property",
|
|
104
|
-
"",
|
|
105
|
-
"P\"2!\"/\""
|
|
106
|
-
]);
|
|
107
|
-
}
|
|
108
|
-
}), [
|
|
109
|
-
"prefix",
|
|
110
|
-
"",
|
|
111
|
-
"P\"2!\"/\""
|
|
112
|
-
]);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
83
|
+
children: __assignType((property) => (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc_reflection.TSDocReflectionProperty, { reflection: property }), (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.InterfaceMember, {
|
|
84
|
+
name: `${prefix}_${property.getNameAsString()}`,
|
|
85
|
+
type: `UnprefixedEnv["${property.getNameAsString()}"]`,
|
|
86
|
+
readonly: property.isReadonly()
|
|
87
|
+
})] }), [
|
|
88
|
+
"property",
|
|
89
|
+
"",
|
|
90
|
+
"P\"2!\"/\""
|
|
91
|
+
])
|
|
92
|
+
}), [
|
|
93
|
+
"prefix",
|
|
94
|
+
"",
|
|
95
|
+
"P\"2!\"/\""
|
|
96
|
+
])
|
|
97
|
+
})
|
|
116
98
|
}),
|
|
117
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
118
|
-
];
|
|
99
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
100
|
+
] });
|
|
119
101
|
}
|
|
120
102
|
EnvTypeDefinition.__type = [
|
|
121
103
|
() => __ΩOmit,
|
|
@@ -165,75 +147,47 @@ function ConfigPropertyGet(props) {
|
|
|
165
147
|
"property",
|
|
166
148
|
"index"
|
|
167
149
|
]);
|
|
168
|
-
return
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
210
|
-
get when() {
|
|
211
|
-
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
|
|
212
|
-
},
|
|
213
|
-
get children() {
|
|
214
|
-
return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
215
|
-
get each() {
|
|
216
|
-
return property.getAlias();
|
|
217
|
-
},
|
|
218
|
-
joiner: _alloy_js_core.code` || `,
|
|
219
|
-
get children() {
|
|
220
|
-
return __assignType((alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
221
|
-
name: alias,
|
|
222
|
-
context
|
|
223
|
-
}), [
|
|
224
|
-
"alias",
|
|
225
|
-
"",
|
|
226
|
-
"P\"2!\"/\""
|
|
227
|
-
]);
|
|
228
|
-
}
|
|
229
|
-
})];
|
|
230
|
-
}
|
|
231
|
-
})];
|
|
232
|
-
},
|
|
233
|
-
get children() {
|
|
234
|
-
return _alloy_js_core.code`return target["${property.getNameAsString()}"];`;
|
|
235
|
-
}
|
|
236
|
-
})];
|
|
150
|
+
return (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core_jsx_runtime.Fragment, { children: index === 0 ? (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.IfStatement, {
|
|
151
|
+
condition: (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [(0, _alloy_js_core_jsx_runtime.jsx)(ConfigPropertyConditional, {
|
|
152
|
+
name: property.getNameAsString(),
|
|
153
|
+
context
|
|
154
|
+
}), (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Show, {
|
|
155
|
+
when: property.getAlias() && property.getAlias().length > 0,
|
|
156
|
+
children: [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
|
|
157
|
+
each: property.getAlias(),
|
|
158
|
+
joiner: _alloy_js_core.code` || `,
|
|
159
|
+
children: __assignType((alias) => (0, _alloy_js_core_jsx_runtime.jsx)(ConfigPropertyConditional, {
|
|
160
|
+
name: alias,
|
|
161
|
+
context
|
|
162
|
+
}), [
|
|
163
|
+
"alias",
|
|
164
|
+
"",
|
|
165
|
+
"P\"2!\"/\""
|
|
166
|
+
])
|
|
167
|
+
})]
|
|
168
|
+
})] }),
|
|
169
|
+
children: _alloy_js_core.code`return target["${property.getNameAsString()}"];`
|
|
170
|
+
}) : (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.ElseIfClause, {
|
|
171
|
+
condition: (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [(0, _alloy_js_core_jsx_runtime.jsx)(ConfigPropertyConditional, {
|
|
172
|
+
name: property.getNameAsString(),
|
|
173
|
+
context
|
|
174
|
+
}), (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Show, {
|
|
175
|
+
when: property.getAlias() && property.getAlias().length > 0,
|
|
176
|
+
children: [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
|
|
177
|
+
each: property.getAlias(),
|
|
178
|
+
joiner: _alloy_js_core.code` || `,
|
|
179
|
+
children: __assignType((alias) => (0, _alloy_js_core_jsx_runtime.jsx)(ConfigPropertyConditional, {
|
|
180
|
+
name: alias,
|
|
181
|
+
context
|
|
182
|
+
}), [
|
|
183
|
+
"alias",
|
|
184
|
+
"",
|
|
185
|
+
"P\"2!\"/\""
|
|
186
|
+
])
|
|
187
|
+
})]
|
|
188
|
+
})] }),
|
|
189
|
+
children: _alloy_js_core.code`return target["${property.getNameAsString()}"];`
|
|
190
|
+
}) });
|
|
237
191
|
}
|
|
238
192
|
ConfigPropertyGet.__type = [
|
|
239
193
|
() => __ΩConfigPropertyProps,
|
|
@@ -247,81 +201,53 @@ function ConfigPropertySet(props) {
|
|
|
247
201
|
"property",
|
|
248
202
|
"index"
|
|
249
203
|
]);
|
|
250
|
-
return
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
context
|
|
271
|
-
}), [
|
|
272
|
-
"alias",
|
|
273
|
-
"",
|
|
274
|
-
"P\"2!\"/\""
|
|
275
|
-
]);
|
|
276
|
-
}
|
|
277
|
-
})];
|
|
278
|
-
}
|
|
279
|
-
})];
|
|
280
|
-
},
|
|
281
|
-
get children() {
|
|
282
|
-
return _alloy_js_core.code`
|
|
204
|
+
return (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core_jsx_runtime.Fragment, { children: index === 0 ? (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.IfStatement, {
|
|
205
|
+
condition: (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [(0, _alloy_js_core_jsx_runtime.jsx)(ConfigPropertyConditional, {
|
|
206
|
+
name: property.getNameAsString(),
|
|
207
|
+
context
|
|
208
|
+
}), (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Show, {
|
|
209
|
+
when: property.getAlias() && property.getAlias().length > 0,
|
|
210
|
+
children: [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
|
|
211
|
+
each: property.getAlias(),
|
|
212
|
+
joiner: _alloy_js_core.code` || `,
|
|
213
|
+
children: __assignType((alias) => (0, _alloy_js_core_jsx_runtime.jsx)(ConfigPropertyConditional, {
|
|
214
|
+
name: alias,
|
|
215
|
+
context
|
|
216
|
+
}), [
|
|
217
|
+
"alias",
|
|
218
|
+
"",
|
|
219
|
+
"P\"2!\"/\""
|
|
220
|
+
])
|
|
221
|
+
})]
|
|
222
|
+
})] }),
|
|
223
|
+
children: _alloy_js_core.code`
|
|
283
224
|
target["${property.getNameAsString()}"] = newValue;
|
|
284
225
|
return true;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
name: alias,
|
|
307
|
-
context
|
|
308
|
-
}), [
|
|
309
|
-
"alias",
|
|
310
|
-
"",
|
|
311
|
-
"P\"2!\"/\""
|
|
312
|
-
]);
|
|
313
|
-
}
|
|
314
|
-
})];
|
|
315
|
-
}
|
|
316
|
-
})];
|
|
317
|
-
},
|
|
318
|
-
get children() {
|
|
319
|
-
return _alloy_js_core.code`
|
|
226
|
+
`
|
|
227
|
+
}) : (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.ElseIfClause, {
|
|
228
|
+
condition: (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core_jsx_runtime.Fragment, { children: [(0, _alloy_js_core_jsx_runtime.jsx)(ConfigPropertyConditional, {
|
|
229
|
+
name: property.getNameAsString(),
|
|
230
|
+
context
|
|
231
|
+
}), (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Show, {
|
|
232
|
+
when: property.getAlias() && property.getAlias().length > 0,
|
|
233
|
+
children: [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
|
|
234
|
+
each: property.getAlias(),
|
|
235
|
+
joiner: _alloy_js_core.code` || `,
|
|
236
|
+
children: __assignType((alias) => (0, _alloy_js_core_jsx_runtime.jsx)(ConfigPropertyConditional, {
|
|
237
|
+
name: alias,
|
|
238
|
+
context
|
|
239
|
+
}), [
|
|
240
|
+
"alias",
|
|
241
|
+
"",
|
|
242
|
+
"P\"2!\"/\""
|
|
243
|
+
])
|
|
244
|
+
})]
|
|
245
|
+
})] }),
|
|
246
|
+
children: _alloy_js_core.code`
|
|
320
247
|
target["${property.getNameAsString()}"] = newValue;
|
|
321
248
|
return true;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
})];
|
|
249
|
+
`
|
|
250
|
+
}) });
|
|
325
251
|
}
|
|
326
252
|
ConfigPropertySet.__type = [
|
|
327
253
|
() => __ΩConfigPropertyProps,
|
|
@@ -391,71 +317,61 @@ function EnvBuiltin(props) {
|
|
|
391
317
|
"",
|
|
392
318
|
"P\"2!\"2\"\"/#"
|
|
393
319
|
])) ?? []);
|
|
394
|
-
return (0, _alloy_js_core_jsx_runtime.
|
|
320
|
+
return (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, {
|
|
395
321
|
id: "env",
|
|
396
|
-
description: "The environment configuration module provides an interface to define environment configuration parameters."
|
|
397
|
-
|
|
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
|
-
refkey: envSerializerRefkey,
|
|
450
|
-
name: "EnvSerializer",
|
|
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");
|
|
322
|
+
description: "The environment configuration module provides an interface to define environment configuration parameters.",
|
|
323
|
+
...rest,
|
|
324
|
+
imports: (0, defu.default)({ "@powerlines/deepkit/vendor/type": [
|
|
325
|
+
"serializeFunction",
|
|
326
|
+
"deserializeFunction",
|
|
327
|
+
"ReflectionKind",
|
|
328
|
+
"Serializer",
|
|
329
|
+
"NamingStrategy",
|
|
330
|
+
"TemplateState",
|
|
331
|
+
"Type",
|
|
332
|
+
"TypeProperty",
|
|
333
|
+
"TypePropertySignature"
|
|
334
|
+
] }, rest.imports ?? {}),
|
|
335
|
+
children: [
|
|
336
|
+
(0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_core.Show, {
|
|
337
|
+
when: Boolean(reflection),
|
|
338
|
+
children: [
|
|
339
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(EnvTypeDefinition, {
|
|
340
|
+
defaultValue,
|
|
341
|
+
reflection
|
|
342
|
+
}),
|
|
343
|
+
(0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
|
|
344
|
+
(0, _alloy_js_core_jsx_runtime.jsx)("hbr", {})
|
|
345
|
+
]
|
|
346
|
+
}),
|
|
347
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_object_declaration.ObjectDeclaration, {
|
|
348
|
+
name: "initialEnv",
|
|
349
|
+
type: "Partial<Env>",
|
|
350
|
+
defaultValue,
|
|
351
|
+
reflection: envInstance,
|
|
352
|
+
export: true,
|
|
353
|
+
const: true,
|
|
354
|
+
doc: "The initial environment configuration object values for the runtime."
|
|
355
|
+
}),
|
|
356
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
357
|
+
(0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
358
|
+
heading: "The environment configuration serializer for the Powerlines application.",
|
|
359
|
+
children: [
|
|
360
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
|
|
361
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
|
|
362
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
|
|
363
|
+
]
|
|
364
|
+
}),
|
|
365
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.ClassDeclaration, {
|
|
366
|
+
refkey: envSerializerRefkey,
|
|
367
|
+
name: "EnvSerializer",
|
|
368
|
+
extends: "Serializer",
|
|
369
|
+
export: true,
|
|
370
|
+
children: (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.ClassMethod, {
|
|
371
|
+
name: "constructor",
|
|
372
|
+
public: true,
|
|
373
|
+
doc: "Initializes a new instance of the `EnvSerializer` class.",
|
|
374
|
+
children: _alloy_js_core.code`super("env");
|
|
459
375
|
|
|
460
376
|
this.deserializeRegistry.register(
|
|
461
377
|
ReflectionKind.boolean,
|
|
@@ -465,16 +381,14 @@ function EnvBuiltin(props) {
|
|
|
465
381
|
);
|
|
466
382
|
}
|
|
467
383
|
); `
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
get initializer() {
|
|
477
|
-
return _alloy_js_core.code`new class extends NamingStrategy {
|
|
384
|
+
})
|
|
385
|
+
}),
|
|
386
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
387
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
|
|
388
|
+
name: "envNamingStrategy",
|
|
389
|
+
const: true,
|
|
390
|
+
doc: "The environment naming strategy for the runtime.",
|
|
391
|
+
initializer: _alloy_js_core.code`new class extends NamingStrategy {
|
|
478
392
|
constructor() {
|
|
479
393
|
super("env");
|
|
480
394
|
}
|
|
@@ -486,127 +400,112 @@ function EnvBuiltin(props) {
|
|
|
486
400
|
}
|
|
487
401
|
|
|
488
402
|
return name.replace(/^(${(0, _stryke_helpers_get_unique.getUnique)(context.config.env.prefix).map(__assignType((prefix) => prefix.replace(/_$/, ""), [
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
403
|
+
"prefix",
|
|
404
|
+
"",
|
|
405
|
+
"P\"2!\"/\""
|
|
406
|
+
])).join("|")})_/, "");
|
|
493
407
|
}
|
|
494
|
-
};
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
509
|
-
|
|
510
|
-
"
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
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: [{
|
|
408
|
+
}; `
|
|
409
|
+
}),
|
|
410
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
411
|
+
(0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
412
|
+
heading: "A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.",
|
|
413
|
+
children: [
|
|
414
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
|
|
415
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
|
|
416
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
|
|
417
|
+
]
|
|
418
|
+
}),
|
|
419
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
|
|
420
|
+
name: "envSerializer",
|
|
421
|
+
const: true,
|
|
422
|
+
initializer: (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.NewExpression, {
|
|
423
|
+
args: [],
|
|
424
|
+
target: "EnvSerializer"
|
|
425
|
+
})
|
|
426
|
+
}),
|
|
427
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
428
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
|
|
429
|
+
name: "_serializeEnv",
|
|
430
|
+
const: true,
|
|
431
|
+
initializer: "serializeFunction<Env>(envSerializer, envNamingStrategy)"
|
|
432
|
+
}),
|
|
433
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
434
|
+
(0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
435
|
+
heading: "Serialize a environment configuration object to JSON data objects (not a JSON string).",
|
|
436
|
+
children: [
|
|
437
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The resulting JSON object can be stringified using \`JSON.stringify()\`.` }),
|
|
438
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `const json = serializeEnv(env);` }),
|
|
439
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
440
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
545
441
|
name: "input",
|
|
546
|
-
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
442
|
+
children: `The environment configuration object to serialize.`
|
|
443
|
+
}),
|
|
444
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The serialized environment configuration as JSON data objects.` }),
|
|
445
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocThrows, { children: `ValidationError when serialization or validation fails.` })
|
|
446
|
+
]
|
|
447
|
+
}),
|
|
448
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
|
|
449
|
+
name: "serializeEnv",
|
|
450
|
+
export: true,
|
|
451
|
+
parameters: [{
|
|
452
|
+
name: "input",
|
|
453
|
+
type: "Env"
|
|
454
|
+
}],
|
|
455
|
+
children: _alloy_js_core.code` return _serializeEnv(input, { loosely: true }); `
|
|
456
|
+
}),
|
|
457
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
458
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
|
|
459
|
+
name: "_deserializeEnv",
|
|
460
|
+
const: true,
|
|
461
|
+
initializer: "deserializeFunction<Env>(envSerializer, envNamingStrategy)"
|
|
462
|
+
}),
|
|
463
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
464
|
+
(0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
465
|
+
heading: "Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.",
|
|
466
|
+
children: [
|
|
467
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `Types that are already correct will be used as-is.` }),
|
|
468
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocExample, { children: `const env = deserializeEnv(json);` }),
|
|
469
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocThrows, { children: `ValidationError when deserialization fails.` })
|
|
470
|
+
]
|
|
471
|
+
}),
|
|
472
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.FunctionDeclaration, {
|
|
473
|
+
name: "deserializeEnv",
|
|
474
|
+
export: true,
|
|
475
|
+
parameters: [{
|
|
476
|
+
name: "input",
|
|
477
|
+
type: "Env"
|
|
478
|
+
}],
|
|
479
|
+
children: _alloy_js_core.code` return _deserializeEnv(input, { loosely: true }); `
|
|
480
|
+
}),
|
|
481
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
482
|
+
(0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
483
|
+
heading: "Initializes the Powerlines environment configuration module.",
|
|
484
|
+
children: [
|
|
485
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
|
|
486
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
487
|
+
name: "environmentConfig",
|
|
488
|
+
children: `The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`
|
|
489
|
+
}),
|
|
490
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The initialized Powerlines configuration object.` })
|
|
491
|
+
]
|
|
492
|
+
}),
|
|
493
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
|
|
494
|
+
when: Boolean(context?.entryPath),
|
|
495
|
+
children: (0, _alloy_js_core_jsx_runtime.jsxs)(_alloy_js_typescript.FunctionDeclaration, {
|
|
496
|
+
refkey: createEnvRefkey,
|
|
497
|
+
async: false,
|
|
498
|
+
export: true,
|
|
499
|
+
name: "createEnv",
|
|
570
500
|
parameters: [{
|
|
571
|
-
name: "
|
|
572
|
-
type:
|
|
501
|
+
name: "environmentConfig",
|
|
502
|
+
type: `Partial<Env>`,
|
|
503
|
+
optional: false,
|
|
504
|
+
default: "{}"
|
|
573
505
|
}],
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
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`
|
|
506
|
+
returnType: "Env",
|
|
507
|
+
children: [
|
|
508
|
+
_alloy_js_core.code`
|
|
610
509
|
return new Proxy<Env>(
|
|
611
510
|
deserializeEnv({
|
|
612
511
|
...initialEnv,
|
|
@@ -614,80 +513,70 @@ function EnvBuiltin(props) {
|
|
|
614
513
|
} as Env),
|
|
615
514
|
{
|
|
616
515
|
get: (target: UnprefixedEnv, propertyName: string) => { `,
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
}),
|
|
633
|
-
_alloy_js_core.code`
|
|
516
|
+
(0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
|
|
517
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
|
|
518
|
+
each: reflectionGetProperties,
|
|
519
|
+
children: __assignType((property, index) => (0, _alloy_js_core_jsx_runtime.jsx)(ConfigPropertyGet, {
|
|
520
|
+
index,
|
|
521
|
+
context,
|
|
522
|
+
property
|
|
523
|
+
}), [
|
|
524
|
+
"property",
|
|
525
|
+
"index",
|
|
526
|
+
"",
|
|
527
|
+
"P!2!'2\"\"/#"
|
|
528
|
+
])
|
|
529
|
+
}),
|
|
530
|
+
_alloy_js_core.code`
|
|
634
531
|
return undefined;
|
|
635
532
|
}, `,
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
656
|
-
_alloy_js_core.code`return false;
|
|
533
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
534
|
+
_alloy_js_core.code` set: (target: UnprefixedEnv, propertyName: string, newValue: any) => { `,
|
|
535
|
+
(0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
|
|
536
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.For, {
|
|
537
|
+
each: reflectionSetProperties,
|
|
538
|
+
ender: _alloy_js_core.code` else `,
|
|
539
|
+
children: __assignType((property, index) => (0, _alloy_js_core_jsx_runtime.jsx)(ConfigPropertySet, {
|
|
540
|
+
index,
|
|
541
|
+
context,
|
|
542
|
+
property
|
|
543
|
+
}), [
|
|
544
|
+
"property",
|
|
545
|
+
"index",
|
|
546
|
+
"",
|
|
547
|
+
"P!2!'2\"\"/#"
|
|
548
|
+
])
|
|
549
|
+
}),
|
|
550
|
+
(0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
|
|
551
|
+
_alloy_js_core.code`return false;
|
|
657
552
|
}
|
|
658
553
|
}
|
|
659
554
|
);
|
|
660
555
|
`
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
(0, _alloy_js_core_jsx_runtime.
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
686
|
-
"export": true,
|
|
687
|
-
"const": true,
|
|
688
|
-
name: "isCI",
|
|
689
|
-
doc: "Detect if the application is running in a continuous integration (CI) environment.",
|
|
690
|
-
initializer: _alloy_js_core.code`Boolean(
|
|
556
|
+
]
|
|
557
|
+
})
|
|
558
|
+
}),
|
|
559
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
560
|
+
(0, _alloy_js_core_jsx_runtime.jsx)("hbr", {}),
|
|
561
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
562
|
+
heading: "The environment configuration object.",
|
|
563
|
+
children: (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This object provides access to the environment configuration parameters in the application runtime.` })
|
|
564
|
+
}),
|
|
565
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
|
|
566
|
+
refkey: envRefkey,
|
|
567
|
+
name: "env",
|
|
568
|
+
type: "Env",
|
|
569
|
+
export: true,
|
|
570
|
+
const: true,
|
|
571
|
+
initializer: (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core_jsx_runtime.Fragment, { children: _alloy_js_core.code`createEnv(${defaultConfig || "{}"} as Partial<Env>);` })
|
|
572
|
+
}),
|
|
573
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
574
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
|
|
575
|
+
export: true,
|
|
576
|
+
const: true,
|
|
577
|
+
name: "isCI",
|
|
578
|
+
doc: "Detect if the application is running in a continuous integration (CI) environment.",
|
|
579
|
+
initializer: _alloy_js_core.code`Boolean(
|
|
691
580
|
env.CI ||
|
|
692
581
|
env.RUN_ID ||
|
|
693
582
|
env.AGOLA_GIT_REF ||
|
|
@@ -740,66 +629,61 @@ function EnvBuiltin(props) {
|
|
|
740
629
|
env.CI_XCODE_PROJECT ||
|
|
741
630
|
env.XCS || false
|
|
742
631
|
); `
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
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:
|
|
632
|
+
}),
|
|
633
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
634
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
635
|
+
heading: "Detect the \\`mode\\` of the current runtime environment.",
|
|
636
|
+
children: (0, _alloy_js_core_jsx_runtime.jsx)(_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
637
|
- \`production\`
|
|
750
638
|
- \`test\`
|
|
751
639
|
- \`development\`
|
|
752
|
-
` })
|
|
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
|
-
}));
|
|
640
|
+
` })
|
|
641
|
+
}),
|
|
642
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
|
|
643
|
+
export: true,
|
|
644
|
+
const: true,
|
|
645
|
+
name: "mode",
|
|
646
|
+
initializer: _alloy_js_core.code`String(env.MODE) || "production"; `
|
|
647
|
+
}),
|
|
648
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
649
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
|
|
650
|
+
export: true,
|
|
651
|
+
const: true,
|
|
652
|
+
name: "isProduction",
|
|
653
|
+
doc: "Detect if the application is running in `\"production\"` mode",
|
|
654
|
+
initializer: _alloy_js_core.code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
|
|
655
|
+
}),
|
|
656
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
657
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
|
|
658
|
+
export: true,
|
|
659
|
+
const: true,
|
|
660
|
+
name: "isTest",
|
|
661
|
+
doc: "Detect if the application is running in `\"test\"` mode",
|
|
662
|
+
initializer: _alloy_js_core.code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
|
|
663
|
+
}),
|
|
664
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
665
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
|
|
666
|
+
export: true,
|
|
667
|
+
const: true,
|
|
668
|
+
name: "isDevelopment",
|
|
669
|
+
doc: "Detect if the application is running in `\"development\"` mode",
|
|
670
|
+
initializer: _alloy_js_core.code`["dev", "development"].includes(mode.toLowerCase()); `
|
|
671
|
+
}),
|
|
672
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
673
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_typescript.VarDeclaration, {
|
|
674
|
+
export: true,
|
|
675
|
+
const: true,
|
|
676
|
+
name: "isDebug",
|
|
677
|
+
doc: "Detect if the application is currently being debugged",
|
|
678
|
+
initializer: _alloy_js_core.code`Boolean(isDevelopment && env.DEBUG); `
|
|
679
|
+
}),
|
|
680
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
681
|
+
(0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
|
|
682
|
+
when: Boolean(children),
|
|
683
|
+
children
|
|
684
|
+
})
|
|
685
|
+
]
|
|
686
|
+
});
|
|
803
687
|
}
|
|
804
688
|
EnvBuiltin.__type = [
|
|
805
689
|
() => __ΩEnvBuiltinProps,
|