@powerlines/plugin-env 0.16.183 → 0.16.185
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/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/babel/index.cjs +4 -1
- package/dist/babel/index.mjs +3 -1
- package/dist/babel/plugin.cjs +137 -4
- package/dist/babel/plugin.mjs +135 -4
- package/dist/babel/plugin.mjs.map +1 -1
- package/dist/components/docs.cjs +111 -1
- package/dist/components/docs.mjs +108 -1
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/env-builtin.cjs +730 -13
- package/dist/components/env-builtin.mjs +726 -11
- package/dist/components/env-builtin.mjs.map +1 -1
- package/dist/components/index.cjs +9 -1
- package/dist/components/index.mjs +4 -1
- package/dist/helpers/automd-generator.cjs +32 -1
- package/dist/helpers/automd-generator.mjs +30 -1
- package/dist/helpers/automd-generator.mjs.map +1 -1
- package/dist/helpers/create-reflection-resource.cjs +23 -1
- package/dist/helpers/create-reflection-resource.mjs +22 -1
- package/dist/helpers/create-reflection-resource.mjs.map +1 -1
- package/dist/helpers/index.cjs +34 -1
- package/dist/helpers/index.mjs +8 -1
- package/dist/helpers/load.cjs +141 -1
- package/dist/helpers/load.mjs +137 -1
- package/dist/helpers/load.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +308 -1
- package/dist/helpers/persistence.mjs +295 -1
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/reflect.cjs +290 -1
- package/dist/helpers/reflect.mjs +280 -1
- package/dist/helpers/reflect.mjs.map +1 -1
- package/dist/helpers/source-file-env.cjs +59 -1
- package/dist/helpers/source-file-env.mjs +56 -1
- package/dist/helpers/source-file-env.mjs.map +1 -1
- package/dist/helpers/template-helpers.cjs +70 -1
- package/dist/helpers/template-helpers.mjs +68 -1
- package/dist/helpers/template-helpers.mjs.map +1 -1
- package/dist/index.cjs +306 -7
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +292 -7
- package/dist/index.mjs.map +1 -1
- package/dist/types/env.cjs +541 -1
- package/dist/types/env.mjs +538 -1
- package/dist/types/env.mjs.map +1 -1
- package/dist/types/index.cjs +11 -1
- package/dist/types/index.mjs +4 -1
- package/dist/types/plugin.cjs +115 -1
- package/dist/types/plugin.mjs +109 -1
- package/dist/types/plugin.mjs.map +1 -1
- package/package.json +9 -9
|
@@ -1,10 +1,461 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_types_plugin = require('../types/plugin.cjs');
|
|
4
|
+
const require_helpers_load = require('../helpers/load.cjs');
|
|
5
|
+
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
6
|
+
let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
7
|
+
let defu = require("defu");
|
|
8
|
+
defu = require_runtime.__toESM(defu);
|
|
9
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
10
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
11
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
12
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
13
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
14
|
+
let _powerlines_plugin_alloy_helpers_refkey = require("@powerlines/plugin-alloy/helpers/refkey");
|
|
15
|
+
let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
16
|
+
let _powerlines_plugin_alloy_typescript_components_interface_declaration = require("@powerlines/plugin-alloy/typescript/components/interface-declaration");
|
|
17
|
+
let _powerlines_plugin_alloy_typescript_components_object_declaration = require("@powerlines/plugin-alloy/typescript/components/object-declaration");
|
|
18
|
+
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
19
|
+
let _powerlines_plugin_alloy_typescript_components_tsdoc_reflection = require("@powerlines/plugin-alloy/typescript/components/tsdoc-reflection");
|
|
20
|
+
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
21
|
+
|
|
22
|
+
//#region src/components/env-builtin.tsx
|
|
23
|
+
const __ΩOmit = [
|
|
24
|
+
"T",
|
|
25
|
+
"K",
|
|
26
|
+
() => __ΩPick,
|
|
27
|
+
() => __ΩExclude,
|
|
28
|
+
"Omit",
|
|
29
|
+
"b!b\"e!!e!!ge!\"o$#o##w%y"
|
|
30
|
+
];
|
|
31
|
+
const __ΩPick = [
|
|
32
|
+
"T",
|
|
33
|
+
"K",
|
|
34
|
+
"Pick",
|
|
35
|
+
"l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
|
|
36
|
+
];
|
|
37
|
+
const __ΩExclude = [
|
|
38
|
+
"T",
|
|
39
|
+
"U",
|
|
40
|
+
"Exclude",
|
|
41
|
+
"l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
|
|
42
|
+
];
|
|
43
|
+
function __assignType(fn, args) {
|
|
44
|
+
fn.__type = args;
|
|
45
|
+
return fn;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Generates the environment configuration typescript definition for the Powerlines project.
|
|
49
|
+
*/
|
|
50
|
+
function EnvTypeDefinition(props) {
|
|
51
|
+
const [{ defaultValue, reflection }] = (0, _alloy_js_core.splitProps)(props, ["defaultValue", "reflection"]);
|
|
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.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
|
|
55
|
+
name: "UnprefixedEnv",
|
|
56
|
+
defaultValue,
|
|
57
|
+
reflection,
|
|
58
|
+
"export": true
|
|
59
|
+
}),
|
|
60
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
61
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
62
|
+
heading: "The environment configuration object with prefixed keys.",
|
|
63
|
+
get children() {
|
|
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
|
+
}
|
|
66
|
+
}),
|
|
67
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
|
|
68
|
+
name: "Env",
|
|
69
|
+
"export": true,
|
|
70
|
+
"extends": "UnprefixedEnv",
|
|
71
|
+
get children() {
|
|
72
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
73
|
+
get each() {
|
|
74
|
+
return (0, _stryke_helpers_get_unique.getUnique)(context.config.env.prefix).map(__assignType((prefix) => prefix.replace(/_$/, ""), [
|
|
75
|
+
"prefix",
|
|
76
|
+
"",
|
|
77
|
+
"P\"2!\"/\""
|
|
78
|
+
]));
|
|
79
|
+
},
|
|
80
|
+
doubleHardline: true,
|
|
81
|
+
get children() {
|
|
82
|
+
return __assignType((prefix) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
83
|
+
get each() {
|
|
84
|
+
return reflection?.getProperties().filter(__assignType((property) => !property.isIgnored(), [
|
|
85
|
+
"property",
|
|
86
|
+
"",
|
|
87
|
+
"P\"2!\"/\""
|
|
88
|
+
])) ?? [];
|
|
89
|
+
},
|
|
90
|
+
doubleHardline: true,
|
|
91
|
+
get children() {
|
|
92
|
+
return __assignType((property) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc_reflection.TSDocReflectionProperty, { reflection: property }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
|
|
93
|
+
get name() {
|
|
94
|
+
return `${prefix}_${property.getNameAsString()}`;
|
|
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
|
+
}
|
|
116
|
+
}),
|
|
117
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
EnvTypeDefinition.__type = [
|
|
121
|
+
() => __ΩOmit,
|
|
122
|
+
"name",
|
|
123
|
+
"props",
|
|
124
|
+
"EnvTypeDefinition",
|
|
125
|
+
"Generates the environment configuration typescript definition for the Powerlines project.",
|
|
126
|
+
"P!.\"o!#2#\"/$?%"
|
|
127
|
+
];
|
|
128
|
+
const __ΩConfigPropertyConditionalProps = [
|
|
129
|
+
() => require_types_plugin.__ΩEnvPluginContext,
|
|
130
|
+
"context",
|
|
131
|
+
"name",
|
|
132
|
+
"ConfigPropertyConditionalProps",
|
|
133
|
+
"P!n!4\"&4#Mw$y"
|
|
134
|
+
];
|
|
135
|
+
function ConfigPropertyConditional(props) {
|
|
136
|
+
const [{ context, name }] = (0, _alloy_js_core.splitProps)(props, ["context", "name"]);
|
|
137
|
+
return _alloy_js_core.code`propertyName === "${name}" || propertyName.replace(/^(${(0, _stryke_helpers_get_unique.getUnique)(context.config.env.prefix.sort(__assignType((a, b) => a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b), [
|
|
138
|
+
"a",
|
|
139
|
+
"b",
|
|
140
|
+
"",
|
|
141
|
+
"P\"2!\"2\"\"/#"
|
|
142
|
+
])).map(__assignType((prefix) => `${prefix.replace(/_$/, "")}_`, [
|
|
143
|
+
"prefix",
|
|
144
|
+
"",
|
|
145
|
+
"P\"2!\"/\""
|
|
146
|
+
]))).join("|")})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${name.toLowerCase().replace(/[\s\-_]+/g, "")}"`;
|
|
147
|
+
}
|
|
148
|
+
ConfigPropertyConditional.__type = [
|
|
149
|
+
() => __ΩConfigPropertyConditionalProps,
|
|
150
|
+
"props",
|
|
151
|
+
"ConfigPropertyConditional",
|
|
152
|
+
"Pn!2\"\"/#"
|
|
153
|
+
];
|
|
154
|
+
const __ΩConfigPropertyProps = [
|
|
155
|
+
"index",
|
|
156
|
+
() => require_types_plugin.__ΩEnvPluginContext,
|
|
157
|
+
"context",
|
|
158
|
+
"property",
|
|
159
|
+
"ConfigPropertyProps",
|
|
160
|
+
"P!'4!n\"4#!4$Mw%y"
|
|
161
|
+
];
|
|
162
|
+
function ConfigPropertyGet(props) {
|
|
163
|
+
const [{ context, property, index }] = (0, _alloy_js_core.splitProps)(props, [
|
|
164
|
+
"context",
|
|
165
|
+
"property",
|
|
166
|
+
"index"
|
|
167
|
+
]);
|
|
168
|
+
return [index === 0 ? (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
169
|
+
get condition() {
|
|
170
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
171
|
+
get name() {
|
|
172
|
+
return property.getNameAsString();
|
|
173
|
+
},
|
|
174
|
+
context
|
|
175
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
176
|
+
get when() {
|
|
177
|
+
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
|
|
178
|
+
},
|
|
179
|
+
get children() {
|
|
180
|
+
return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
181
|
+
get each() {
|
|
182
|
+
return property.getAlias();
|
|
183
|
+
},
|
|
184
|
+
joiner: _alloy_js_core.code` || `,
|
|
185
|
+
get children() {
|
|
186
|
+
return __assignType((alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
187
|
+
name: alias,
|
|
188
|
+
context
|
|
189
|
+
}), [
|
|
190
|
+
"alias",
|
|
191
|
+
"",
|
|
192
|
+
"P\"2!\"/\""
|
|
193
|
+
]);
|
|
194
|
+
}
|
|
195
|
+
})];
|
|
196
|
+
}
|
|
197
|
+
})];
|
|
198
|
+
},
|
|
199
|
+
get children() {
|
|
200
|
+
return _alloy_js_core.code`return target["${property.getNameAsString()}"];`;
|
|
201
|
+
}
|
|
202
|
+
}) : (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
203
|
+
get condition() {
|
|
204
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
205
|
+
get name() {
|
|
206
|
+
return property.getNameAsString();
|
|
207
|
+
},
|
|
208
|
+
context
|
|
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
|
+
})];
|
|
237
|
+
}
|
|
238
|
+
ConfigPropertyGet.__type = [
|
|
239
|
+
() => __ΩConfigPropertyProps,
|
|
240
|
+
"props",
|
|
241
|
+
"ConfigPropertyGet",
|
|
242
|
+
"Pn!2\"\"/#"
|
|
243
|
+
];
|
|
244
|
+
function ConfigPropertySet(props) {
|
|
245
|
+
const [{ context, property, index }] = (0, _alloy_js_core.splitProps)(props, [
|
|
246
|
+
"context",
|
|
247
|
+
"property",
|
|
248
|
+
"index"
|
|
249
|
+
]);
|
|
250
|
+
return [index === 0 ? (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
251
|
+
get condition() {
|
|
252
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
253
|
+
get name() {
|
|
254
|
+
return property.getNameAsString();
|
|
255
|
+
},
|
|
256
|
+
context
|
|
257
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
258
|
+
get when() {
|
|
259
|
+
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
|
|
260
|
+
},
|
|
261
|
+
get children() {
|
|
262
|
+
return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
263
|
+
get each() {
|
|
264
|
+
return property.getAlias();
|
|
265
|
+
},
|
|
266
|
+
joiner: _alloy_js_core.code` || `,
|
|
267
|
+
get children() {
|
|
268
|
+
return __assignType((alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
269
|
+
name: alias,
|
|
270
|
+
context
|
|
271
|
+
}), [
|
|
272
|
+
"alias",
|
|
273
|
+
"",
|
|
274
|
+
"P\"2!\"/\""
|
|
275
|
+
]);
|
|
276
|
+
}
|
|
277
|
+
})];
|
|
278
|
+
}
|
|
279
|
+
})];
|
|
280
|
+
},
|
|
281
|
+
get children() {
|
|
282
|
+
return _alloy_js_core.code`
|
|
283
|
+
target["${property.getNameAsString()}"] = newValue;
|
|
3
284
|
return true;
|
|
4
|
-
|
|
5
|
-
|
|
285
|
+
`;
|
|
286
|
+
}
|
|
287
|
+
}) : (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
288
|
+
get condition() {
|
|
289
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
290
|
+
get name() {
|
|
291
|
+
return property.getNameAsString();
|
|
292
|
+
},
|
|
293
|
+
context
|
|
294
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
295
|
+
get when() {
|
|
296
|
+
return (0, _alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
|
|
297
|
+
},
|
|
298
|
+
get children() {
|
|
299
|
+
return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
300
|
+
get each() {
|
|
301
|
+
return property.getAlias();
|
|
302
|
+
},
|
|
303
|
+
joiner: _alloy_js_core.code` || `,
|
|
304
|
+
get children() {
|
|
305
|
+
return __assignType((alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
|
|
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`
|
|
320
|
+
target["${property.getNameAsString()}"] = newValue;
|
|
6
321
|
return true;
|
|
7
|
-
|
|
322
|
+
`;
|
|
323
|
+
}
|
|
324
|
+
})];
|
|
325
|
+
}
|
|
326
|
+
ConfigPropertySet.__type = [
|
|
327
|
+
() => __ΩConfigPropertyProps,
|
|
328
|
+
"props",
|
|
329
|
+
"ConfigPropertySet",
|
|
330
|
+
"Pn!2\"\"/#"
|
|
331
|
+
];
|
|
332
|
+
const __ΩEnvBuiltinProps = [
|
|
333
|
+
() => __ΩOmit,
|
|
334
|
+
"id",
|
|
335
|
+
"Children",
|
|
336
|
+
"defaultConfig",
|
|
337
|
+
"reflection",
|
|
338
|
+
"EnvBuiltinProps",
|
|
339
|
+
"P!.\"o!#\"w#4$8!4%Mw&y"
|
|
340
|
+
];
|
|
341
|
+
const createEnvRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("createEnv");
|
|
342
|
+
const envRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("env");
|
|
343
|
+
const envSerializerRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("EnvSerializer");
|
|
344
|
+
/**
|
|
345
|
+
* Generates the environment configuration module for the Powerlines project.
|
|
346
|
+
*/
|
|
347
|
+
function EnvBuiltin(props) {
|
|
348
|
+
const [{ defaultConfig, reflection, children }, rest] = (0, _alloy_js_core.splitProps)(props, [
|
|
349
|
+
"defaultConfig",
|
|
350
|
+
"reflection",
|
|
351
|
+
"children"
|
|
352
|
+
]);
|
|
353
|
+
const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
|
|
354
|
+
const defaultValue = (0, _alloy_js_core.computed)(() => context && require_helpers_load.loadEnvFromContext(context, process.env));
|
|
355
|
+
const envInstance = (0, _alloy_js_core.computed)(() => {
|
|
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(), [
|
|
375
|
+
"property",
|
|
376
|
+
"",
|
|
377
|
+
"P\"2!\"/\""
|
|
378
|
+
])).sort(__assignType((a, b) => a.getNameAsString().localeCompare(b.getNameAsString()), [
|
|
379
|
+
"a",
|
|
380
|
+
"b",
|
|
381
|
+
"",
|
|
382
|
+
"P\"2!\"2\"\"/#"
|
|
383
|
+
])) ?? []);
|
|
384
|
+
const reflectionSetProperties = (0, _alloy_js_core.computed)(() => reflection?.getProperties().filter(__assignType((property) => !property.isIgnored() && !property.isReadonly(), [
|
|
385
|
+
"property",
|
|
386
|
+
"",
|
|
387
|
+
"P\"2!\"/\""
|
|
388
|
+
])).sort(__assignType((a, b) => a.getNameAsString().localeCompare(b.getNameAsString()), [
|
|
389
|
+
"a",
|
|
390
|
+
"b",
|
|
391
|
+
"",
|
|
392
|
+
"P\"2!\"2\"\"/#"
|
|
393
|
+
])) ?? []);
|
|
394
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
395
|
+
id: "env",
|
|
396
|
+
description: "The environment configuration module provides an interface to define environment configuration parameters."
|
|
397
|
+
}, rest, {
|
|
398
|
+
get imports() {
|
|
399
|
+
return (0, defu.default)({ "@powerlines/deepkit/vendor/type": [
|
|
400
|
+
"serializeFunction",
|
|
401
|
+
"deserializeFunction",
|
|
402
|
+
"ReflectionKind",
|
|
403
|
+
"Serializer",
|
|
404
|
+
"NamingStrategy",
|
|
405
|
+
"TemplateState",
|
|
406
|
+
"Type",
|
|
407
|
+
"TypeProperty",
|
|
408
|
+
"TypePropertySignature"
|
|
409
|
+
] }, rest.imports ?? {});
|
|
410
|
+
},
|
|
411
|
+
get children() {
|
|
412
|
+
return [
|
|
413
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
414
|
+
get when() {
|
|
415
|
+
return Boolean(reflection);
|
|
416
|
+
},
|
|
417
|
+
get children() {
|
|
418
|
+
return [
|
|
419
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(EnvTypeDefinition, {
|
|
420
|
+
defaultValue,
|
|
421
|
+
reflection
|
|
422
|
+
}),
|
|
423
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
424
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
425
|
+
];
|
|
426
|
+
}
|
|
427
|
+
}),
|
|
428
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_object_declaration.ObjectDeclaration, {
|
|
429
|
+
name: "initialEnv",
|
|
430
|
+
type: "Partial<Env>",
|
|
431
|
+
defaultValue,
|
|
432
|
+
reflection: envInstance,
|
|
433
|
+
"export": true,
|
|
434
|
+
"const": true,
|
|
435
|
+
doc: "The initial environment configuration object values for the runtime."
|
|
436
|
+
}),
|
|
437
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
438
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
439
|
+
heading: "The environment configuration serializer for the Powerlines application.",
|
|
440
|
+
get children() {
|
|
441
|
+
return [
|
|
442
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
|
|
443
|
+
(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` }),
|
|
444
|
+
(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.` })
|
|
445
|
+
];
|
|
446
|
+
}
|
|
447
|
+
}),
|
|
448
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ClassDeclaration, {
|
|
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");
|
|
8
459
|
|
|
9
460
|
this.deserializeRegistry.register(
|
|
10
461
|
ReflectionKind.boolean,
|
|
@@ -13,7 +464,17 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
13
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()}\`
|
|
14
465
|
);
|
|
15
466
|
}
|
|
16
|
-
); `
|
|
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 {
|
|
17
478
|
constructor() {
|
|
18
479
|
super("env");
|
|
19
480
|
}
|
|
@@ -24,22 +485,209 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
24
485
|
return name;
|
|
25
486
|
}
|
|
26
487
|
|
|
27
|
-
return name.replace(/^(${(0,
|
|
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("|")})_/, "");
|
|
28
493
|
}
|
|
29
|
-
};
|
|
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`
|
|
30
610
|
return new Proxy<Env>(
|
|
31
611
|
deserializeEnv({
|
|
32
612
|
...initialEnv,
|
|
33
613
|
...environmentConfig
|
|
34
614
|
} as Env),
|
|
35
615
|
{
|
|
36
|
-
get: (target: UnprefixedEnv, propertyName: string) => { `,
|
|
616
|
+
get: (target: UnprefixedEnv, propertyName: string) => { `,
|
|
617
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
618
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
619
|
+
each: reflectionGetProperties,
|
|
620
|
+
get children() {
|
|
621
|
+
return __assignType((property, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyGet, {
|
|
622
|
+
index,
|
|
623
|
+
context,
|
|
624
|
+
property
|
|
625
|
+
}), [
|
|
626
|
+
"property",
|
|
627
|
+
"index",
|
|
628
|
+
"",
|
|
629
|
+
"P!2!'2\"\"/#"
|
|
630
|
+
]);
|
|
631
|
+
}
|
|
632
|
+
}),
|
|
633
|
+
_alloy_js_core.code`
|
|
37
634
|
return undefined;
|
|
38
|
-
}, `,
|
|
635
|
+
}, `,
|
|
636
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
637
|
+
_alloy_js_core.code` set: (target: UnprefixedEnv, propertyName: string, newValue: any) => { `,
|
|
638
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
639
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
640
|
+
each: reflectionSetProperties,
|
|
641
|
+
ender: _alloy_js_core.code` else `,
|
|
642
|
+
get children() {
|
|
643
|
+
return __assignType((property, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertySet, {
|
|
644
|
+
index,
|
|
645
|
+
context,
|
|
646
|
+
property
|
|
647
|
+
}), [
|
|
648
|
+
"property",
|
|
649
|
+
"index",
|
|
650
|
+
"",
|
|
651
|
+
"P!2!'2\"\"/#"
|
|
652
|
+
]);
|
|
653
|
+
}
|
|
654
|
+
}),
|
|
655
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
656
|
+
_alloy_js_core.code`return false;
|
|
39
657
|
}
|
|
40
658
|
}
|
|
41
659
|
);
|
|
42
|
-
`
|
|
660
|
+
`
|
|
661
|
+
];
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
}),
|
|
666
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
667
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
668
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
669
|
+
heading: "The environment configuration object.",
|
|
670
|
+
get children() {
|
|
671
|
+
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.` });
|
|
672
|
+
}
|
|
673
|
+
}),
|
|
674
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
675
|
+
refkey: envRefkey,
|
|
676
|
+
name: "env",
|
|
677
|
+
type: "Env",
|
|
678
|
+
"export": true,
|
|
679
|
+
"const": true,
|
|
680
|
+
get initializer() {
|
|
681
|
+
return [_alloy_js_core.code`createEnv(${defaultConfig || "{}"} as Partial<Env>);`];
|
|
682
|
+
}
|
|
683
|
+
}),
|
|
684
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
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(
|
|
43
691
|
env.CI ||
|
|
44
692
|
env.RUN_ID ||
|
|
45
693
|
env.AGOLA_GIT_REF ||
|
|
@@ -91,8 +739,77 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
91
739
|
env.APPCENTER_BUILD_ID ||
|
|
92
740
|
env.CI_XCODE_PROJECT ||
|
|
93
741
|
env.XCS || false
|
|
94
|
-
); `
|
|
742
|
+
); `
|
|
743
|
+
}),
|
|
744
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
745
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
746
|
+
heading: "Detect the \\`mode\\` of the current runtime environment.",
|
|
747
|
+
get children() {
|
|
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:
|
|
95
749
|
- \`production\`
|
|
96
750
|
- \`test\`
|
|
97
751
|
- \`development\`
|
|
98
|
-
`
|
|
752
|
+
` });
|
|
753
|
+
}
|
|
754
|
+
}),
|
|
755
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
756
|
+
"export": true,
|
|
757
|
+
"const": true,
|
|
758
|
+
name: "mode",
|
|
759
|
+
initializer: _alloy_js_core.code`String(env.MODE) || "production"; `
|
|
760
|
+
}),
|
|
761
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
762
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
763
|
+
"export": true,
|
|
764
|
+
"const": true,
|
|
765
|
+
name: "isProduction",
|
|
766
|
+
doc: "Detect if the application is running in `\"production\"` mode",
|
|
767
|
+
initializer: _alloy_js_core.code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
|
|
768
|
+
}),
|
|
769
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
770
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
771
|
+
"export": true,
|
|
772
|
+
"const": true,
|
|
773
|
+
name: "isTest",
|
|
774
|
+
doc: "Detect if the application is running in `\"test\"` mode",
|
|
775
|
+
initializer: _alloy_js_core.code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
|
|
776
|
+
}),
|
|
777
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
778
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
779
|
+
"export": true,
|
|
780
|
+
"const": true,
|
|
781
|
+
name: "isDevelopment",
|
|
782
|
+
doc: "Detect if the application is running in `\"development\"` mode",
|
|
783
|
+
initializer: _alloy_js_core.code`["dev", "development"].includes(mode.toLowerCase()); `
|
|
784
|
+
}),
|
|
785
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
786
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
787
|
+
"export": true,
|
|
788
|
+
"const": true,
|
|
789
|
+
name: "isDebug",
|
|
790
|
+
doc: "Detect if the application is currently being debugged",
|
|
791
|
+
initializer: _alloy_js_core.code`Boolean(isDevelopment && env.DEBUG); `
|
|
792
|
+
}),
|
|
793
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
794
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
795
|
+
get when() {
|
|
796
|
+
return Boolean(children);
|
|
797
|
+
},
|
|
798
|
+
children
|
|
799
|
+
})
|
|
800
|
+
];
|
|
801
|
+
}
|
|
802
|
+
}));
|
|
803
|
+
}
|
|
804
|
+
EnvBuiltin.__type = [
|
|
805
|
+
() => __ΩEnvBuiltinProps,
|
|
806
|
+
"props",
|
|
807
|
+
"EnvBuiltin",
|
|
808
|
+
"Generates the environment configuration module for the Powerlines project.",
|
|
809
|
+
"Pn!2\"\"/#?$"
|
|
810
|
+
];
|
|
811
|
+
|
|
812
|
+
//#endregion
|
|
813
|
+
exports.EnvBuiltin = EnvBuiltin;
|
|
814
|
+
exports.EnvTypeDefinition = EnvTypeDefinition;
|
|
815
|
+
exports.__ΩEnvBuiltinProps = __ΩEnvBuiltinProps;
|