@powerlines/plugin-env 0.16.121 → 0.16.123
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 +1 -11
- package/dist/babel/plugin.d.cts.map +1 -1
- package/dist/babel/plugin.d.mts.map +1 -1
- package/dist/babel/plugin.mjs +1 -11
- package/dist/babel/plugin.mjs.map +1 -1
- package/dist/components/docs.cjs +44 -4
- package/dist/components/docs.mjs +43 -4
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/env-builtin.cjs +299 -53
- package/dist/components/env-builtin.d.cts.map +1 -1
- package/dist/components/env-builtin.d.mts.map +1 -1
- package/dist/components/env-builtin.mjs +301 -56
- package/dist/components/env-builtin.mjs.map +1 -1
- package/dist/components/index.cjs +3 -1
- package/dist/components/index.mjs +3 -3
- package/dist/helpers/load.cjs +1 -1
- package/dist/helpers/persistence.cjs +1 -1
- package/dist/index.cjs +77 -32
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +76 -31
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.cjs +1 -1
- package/dist/types/plugin.d.cts +6 -6
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +6 -6
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/dist/types/plugin.mjs.map +1 -1
- package/dist/types/runtime.cjs +303 -7
- package/dist/types/runtime.mjs +303 -7
- package/dist/types/runtime.mjs.map +1 -1
- package/package.json +10 -10
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __ΩEnvPluginContext } from "../types/plugin.mjs";
|
|
1
2
|
import { loadEnvFromContext } from "../helpers/load.mjs";
|
|
2
3
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
3
4
|
import { ReflectionClass, ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
@@ -6,24 +7,49 @@ import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/co
|
|
|
6
7
|
import { For, Show, code, computed, splitProps } from "@alloy-js/core";
|
|
7
8
|
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
8
9
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
9
|
-
import { ClassDeclaration, ClassMethod, ElseIfClause, FunctionDeclaration, IfStatement,
|
|
10
|
+
import { ClassDeclaration, ClassMethod, ElseIfClause, FunctionDeclaration, IfStatement, InterfaceDeclaration, InterfaceMember, NewExpression, VarDeclaration } from "@alloy-js/typescript";
|
|
10
11
|
import { refkey } from "@powerlines/plugin-alloy/helpers/refkey";
|
|
11
12
|
import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
12
|
-
import { InterfaceDeclaration } from "@powerlines/plugin-alloy/typescript/components/interface-declaration";
|
|
13
|
+
import { InterfaceDeclaration as InterfaceDeclaration$1 } from "@powerlines/plugin-alloy/typescript/components/interface-declaration";
|
|
13
14
|
import { ObjectDeclaration } from "@powerlines/plugin-alloy/typescript/components/object-declaration";
|
|
14
15
|
import { TSDoc, TSDocExample, TSDocLink, TSDocParam, TSDocRemarks, TSDocReturns, TSDocThrows } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
16
|
+
import { TSDocReflectionProperty } from "@powerlines/plugin-alloy/typescript/components/tsdoc-reflection";
|
|
15
17
|
import { getUnique } from "@stryke/helpers/get-unique";
|
|
16
18
|
|
|
17
19
|
//#region src/components/env-builtin.tsx
|
|
20
|
+
const __ΩOmit = [
|
|
21
|
+
"T",
|
|
22
|
+
"K",
|
|
23
|
+
() => __ΩPick,
|
|
24
|
+
() => __ΩExclude,
|
|
25
|
+
"Omit",
|
|
26
|
+
"b!b\"e!!e!!ge!\"o$#o##w%y"
|
|
27
|
+
];
|
|
28
|
+
const __ΩPick = [
|
|
29
|
+
"T",
|
|
30
|
+
"K",
|
|
31
|
+
"Pick",
|
|
32
|
+
"l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
|
|
33
|
+
];
|
|
34
|
+
const __ΩExclude = [
|
|
35
|
+
"T",
|
|
36
|
+
"U",
|
|
37
|
+
"Exclude",
|
|
38
|
+
"l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
|
|
39
|
+
];
|
|
40
|
+
function __assignType(fn, args) {
|
|
41
|
+
fn.__type = args;
|
|
42
|
+
return fn;
|
|
43
|
+
}
|
|
18
44
|
/**
|
|
19
45
|
* Generates the environment configuration typescript definition for the Powerlines project.
|
|
20
46
|
*/
|
|
21
47
|
function EnvTypeDefinition(props) {
|
|
22
48
|
const [{ defaultValue, reflection }] = splitProps(props, ["defaultValue", "reflection"]);
|
|
23
|
-
const context = usePowerlines();
|
|
49
|
+
const context = (usePowerlines.Ω = [[() => __ΩEnvPluginContext, "n!"]], usePowerlines());
|
|
24
50
|
return [
|
|
25
|
-
createComponent(InterfaceDeclaration, {
|
|
26
|
-
name: "
|
|
51
|
+
createComponent(InterfaceDeclaration$1, {
|
|
52
|
+
name: "UnprefixedEnv",
|
|
27
53
|
defaultValue,
|
|
28
54
|
reflection,
|
|
29
55
|
"export": true
|
|
@@ -32,26 +58,104 @@ function EnvTypeDefinition(props) {
|
|
|
32
58
|
createComponent(TSDoc, {
|
|
33
59
|
heading: "The environment configuration object with prefixed keys.",
|
|
34
60
|
get children() {
|
|
35
|
-
return createComponent(TSDocRemarks, { children: `The \`Env\` type extends the \`
|
|
61
|
+
return createComponent(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.` });
|
|
36
62
|
}
|
|
37
63
|
}),
|
|
38
|
-
createComponent(
|
|
64
|
+
createComponent(InterfaceDeclaration, {
|
|
39
65
|
name: "Env",
|
|
40
66
|
"export": true,
|
|
67
|
+
"extends": "UnprefixedEnv",
|
|
41
68
|
get children() {
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
69
|
+
return createComponent(For, {
|
|
70
|
+
get each() {
|
|
71
|
+
return getUnique(context.config.env.prefix).map(__assignType((prefix) => prefix.replace(/_$/, ""), [
|
|
72
|
+
"prefix",
|
|
73
|
+
"",
|
|
74
|
+
"P\"2!\"/\""
|
|
75
|
+
]));
|
|
76
|
+
},
|
|
77
|
+
doubleHardline: true,
|
|
78
|
+
get children() {
|
|
79
|
+
return __assignType((prefix) => createComponent(For, {
|
|
80
|
+
get each() {
|
|
81
|
+
return reflection?.getProperties().filter(__assignType((property) => !property.isIgnored(), [
|
|
82
|
+
"property",
|
|
83
|
+
"",
|
|
84
|
+
"P\"2!\"/\""
|
|
85
|
+
])) ?? [];
|
|
86
|
+
},
|
|
87
|
+
doubleHardline: true,
|
|
88
|
+
get children() {
|
|
89
|
+
return __assignType((property) => [createComponent(TSDocReflectionProperty, { reflection: property }), createComponent(InterfaceMember, {
|
|
90
|
+
get name() {
|
|
91
|
+
return `${prefix}_${property.getNameAsString()}`;
|
|
92
|
+
},
|
|
93
|
+
get type() {
|
|
94
|
+
return `UnprefixedEnv["${property.getNameAsString()}"]`;
|
|
95
|
+
},
|
|
96
|
+
get readonly() {
|
|
97
|
+
return property.isReadonly();
|
|
98
|
+
}
|
|
99
|
+
})], [
|
|
100
|
+
"property",
|
|
101
|
+
"",
|
|
102
|
+
"P\"2!\"/\""
|
|
103
|
+
]);
|
|
104
|
+
}
|
|
105
|
+
}), [
|
|
106
|
+
"prefix",
|
|
107
|
+
"",
|
|
108
|
+
"P\"2!\"/\""
|
|
109
|
+
]);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
46
112
|
}
|
|
47
113
|
}),
|
|
48
114
|
createComponent(Spacing, {})
|
|
49
115
|
];
|
|
50
116
|
}
|
|
117
|
+
EnvTypeDefinition.__type = [
|
|
118
|
+
() => __ΩOmit,
|
|
119
|
+
"name",
|
|
120
|
+
"props",
|
|
121
|
+
"EnvTypeDefinition",
|
|
122
|
+
"Generates the environment configuration typescript definition for the Powerlines project.",
|
|
123
|
+
"P!.\"o!#2#\"/$?%"
|
|
124
|
+
];
|
|
125
|
+
const __ΩConfigPropertyConditionalProps = [
|
|
126
|
+
() => __ΩEnvPluginContext,
|
|
127
|
+
"context",
|
|
128
|
+
"name",
|
|
129
|
+
"ConfigPropertyConditionalProps",
|
|
130
|
+
"P!n!4\"&4#Mw$y"
|
|
131
|
+
];
|
|
51
132
|
function ConfigPropertyConditional(props) {
|
|
52
133
|
const [{ context, name }] = splitProps(props, ["context", "name"]);
|
|
53
|
-
return code`propertyName === "${name}" || propertyName.replace(/^(${getUnique(context.config.env.prefix.sort((a, b) => a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)
|
|
134
|
+
return code`propertyName === "${name}" || propertyName.replace(/^(${getUnique(context.config.env.prefix.sort(__assignType((a, b) => a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b), [
|
|
135
|
+
"a",
|
|
136
|
+
"b",
|
|
137
|
+
"",
|
|
138
|
+
"P\"2!\"2\"\"/#"
|
|
139
|
+
])).map(__assignType((prefix) => `${prefix.replace(/_$/, "")}_`, [
|
|
140
|
+
"prefix",
|
|
141
|
+
"",
|
|
142
|
+
"P\"2!\"/\""
|
|
143
|
+
]))).join("|")})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${name.toLowerCase().replace(/[\s\-_]+/g, "")}"`;
|
|
54
144
|
}
|
|
145
|
+
ConfigPropertyConditional.__type = [
|
|
146
|
+
() => __ΩConfigPropertyConditionalProps,
|
|
147
|
+
"props",
|
|
148
|
+
"ConfigPropertyConditional",
|
|
149
|
+
"Pn!2\"\"/#"
|
|
150
|
+
];
|
|
151
|
+
const __ΩConfigPropertyProps = [
|
|
152
|
+
"index",
|
|
153
|
+
() => __ΩEnvPluginContext,
|
|
154
|
+
"context",
|
|
155
|
+
"property",
|
|
156
|
+
"ConfigPropertyProps",
|
|
157
|
+
"P!'4!n\"4#!4$Mw%y"
|
|
158
|
+
];
|
|
55
159
|
function ConfigPropertyGet(props) {
|
|
56
160
|
const [{ context, property, index }] = splitProps(props, [
|
|
57
161
|
"context",
|
|
@@ -75,10 +179,16 @@ function ConfigPropertyGet(props) {
|
|
|
75
179
|
return property.getAlias();
|
|
76
180
|
},
|
|
77
181
|
joiner: code` || `,
|
|
78
|
-
children
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
182
|
+
get children() {
|
|
183
|
+
return __assignType((alias) => createComponent(ConfigPropertyConditional, {
|
|
184
|
+
name: alias,
|
|
185
|
+
context
|
|
186
|
+
}), [
|
|
187
|
+
"alias",
|
|
188
|
+
"",
|
|
189
|
+
"P\"2!\"/\""
|
|
190
|
+
]);
|
|
191
|
+
}
|
|
82
192
|
})];
|
|
83
193
|
}
|
|
84
194
|
})];
|
|
@@ -103,10 +213,16 @@ function ConfigPropertyGet(props) {
|
|
|
103
213
|
return property.getAlias();
|
|
104
214
|
},
|
|
105
215
|
joiner: code` || `,
|
|
106
|
-
children
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
216
|
+
get children() {
|
|
217
|
+
return __assignType((alias) => createComponent(ConfigPropertyConditional, {
|
|
218
|
+
name: alias,
|
|
219
|
+
context
|
|
220
|
+
}), [
|
|
221
|
+
"alias",
|
|
222
|
+
"",
|
|
223
|
+
"P\"2!\"/\""
|
|
224
|
+
]);
|
|
225
|
+
}
|
|
110
226
|
})];
|
|
111
227
|
}
|
|
112
228
|
})];
|
|
@@ -116,6 +232,12 @@ function ConfigPropertyGet(props) {
|
|
|
116
232
|
}
|
|
117
233
|
})];
|
|
118
234
|
}
|
|
235
|
+
ConfigPropertyGet.__type = [
|
|
236
|
+
() => __ΩConfigPropertyProps,
|
|
237
|
+
"props",
|
|
238
|
+
"ConfigPropertyGet",
|
|
239
|
+
"Pn!2\"\"/#"
|
|
240
|
+
];
|
|
119
241
|
function ConfigPropertySet(props) {
|
|
120
242
|
const [{ context, property, index }] = splitProps(props, [
|
|
121
243
|
"context",
|
|
@@ -139,10 +261,16 @@ function ConfigPropertySet(props) {
|
|
|
139
261
|
return property.getAlias();
|
|
140
262
|
},
|
|
141
263
|
joiner: code` || `,
|
|
142
|
-
children
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
264
|
+
get children() {
|
|
265
|
+
return __assignType((alias) => createComponent(ConfigPropertyConditional, {
|
|
266
|
+
name: alias,
|
|
267
|
+
context
|
|
268
|
+
}), [
|
|
269
|
+
"alias",
|
|
270
|
+
"",
|
|
271
|
+
"P\"2!\"/\""
|
|
272
|
+
]);
|
|
273
|
+
}
|
|
146
274
|
})];
|
|
147
275
|
}
|
|
148
276
|
})];
|
|
@@ -170,10 +298,16 @@ function ConfigPropertySet(props) {
|
|
|
170
298
|
return property.getAlias();
|
|
171
299
|
},
|
|
172
300
|
joiner: code` || `,
|
|
173
|
-
children
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
301
|
+
get children() {
|
|
302
|
+
return __assignType((alias) => createComponent(ConfigPropertyConditional, {
|
|
303
|
+
name: alias,
|
|
304
|
+
context
|
|
305
|
+
}), [
|
|
306
|
+
"alias",
|
|
307
|
+
"",
|
|
308
|
+
"P\"2!\"/\""
|
|
309
|
+
]);
|
|
310
|
+
}
|
|
177
311
|
})];
|
|
178
312
|
}
|
|
179
313
|
})];
|
|
@@ -186,6 +320,21 @@ function ConfigPropertySet(props) {
|
|
|
186
320
|
}
|
|
187
321
|
})];
|
|
188
322
|
}
|
|
323
|
+
ConfigPropertySet.__type = [
|
|
324
|
+
() => __ΩConfigPropertyProps,
|
|
325
|
+
"props",
|
|
326
|
+
"ConfigPropertySet",
|
|
327
|
+
"Pn!2\"\"/#"
|
|
328
|
+
];
|
|
329
|
+
const __ΩEnvBuiltinProps = [
|
|
330
|
+
() => __ΩOmit,
|
|
331
|
+
"id",
|
|
332
|
+
"Children",
|
|
333
|
+
"defaultConfig",
|
|
334
|
+
"reflection",
|
|
335
|
+
"EnvBuiltinProps",
|
|
336
|
+
"P!.\"o!#\"w#4$8!4%Mw&y"
|
|
337
|
+
];
|
|
189
338
|
const createEnvRefkey = refkey("createEnv");
|
|
190
339
|
const envRefkey = refkey("env");
|
|
191
340
|
const envSerializerRefkey = refkey("EnvSerializer");
|
|
@@ -198,7 +347,7 @@ function EnvBuiltin(props) {
|
|
|
198
347
|
"reflection",
|
|
199
348
|
"children"
|
|
200
349
|
]);
|
|
201
|
-
const context = usePowerlines();
|
|
350
|
+
const context = (usePowerlines.Ω = [[() => __ΩEnvPluginContext, "n!"]], usePowerlines());
|
|
202
351
|
const defaultValue = computed(() => context && loadEnvFromContext(context, process.env));
|
|
203
352
|
const envInstance = computed(() => {
|
|
204
353
|
const result = new ReflectionClass({
|
|
@@ -206,13 +355,39 @@ function EnvBuiltin(props) {
|
|
|
206
355
|
description: `The initial environment configuration state for the ${titleCase(context?.config?.name)} project.`,
|
|
207
356
|
types: []
|
|
208
357
|
}, reflection);
|
|
209
|
-
result.getProperties().filter((property) => property.isRuntime() || property.getTags().runtime === true
|
|
358
|
+
result.getProperties().filter(__assignType((property) => property.isRuntime() || property.getTags().runtime === true, [
|
|
359
|
+
"property",
|
|
360
|
+
"",
|
|
361
|
+
"P\"2!\"/\""
|
|
362
|
+
])).forEach(__assignType((property) => {
|
|
210
363
|
result.removeProperty(property.getNameAsString());
|
|
211
|
-
}
|
|
364
|
+
}, [
|
|
365
|
+
"property",
|
|
366
|
+
"",
|
|
367
|
+
"P\"2!\"/\""
|
|
368
|
+
]));
|
|
212
369
|
return result;
|
|
213
370
|
});
|
|
214
|
-
const reflectionGetProperties = computed(() => reflection?.getProperties().filter((property) => !property.isIgnored()
|
|
215
|
-
|
|
371
|
+
const reflectionGetProperties = computed(() => reflection?.getProperties().filter(__assignType((property) => !property.isIgnored(), [
|
|
372
|
+
"property",
|
|
373
|
+
"",
|
|
374
|
+
"P\"2!\"/\""
|
|
375
|
+
])).sort(__assignType((a, b) => a.getNameAsString().localeCompare(b.getNameAsString()), [
|
|
376
|
+
"a",
|
|
377
|
+
"b",
|
|
378
|
+
"",
|
|
379
|
+
"P\"2!\"2\"\"/#"
|
|
380
|
+
])) ?? []);
|
|
381
|
+
const reflectionSetProperties = computed(() => reflection?.getProperties().filter(__assignType((property) => !property.isIgnored() && !property.isReadonly(), [
|
|
382
|
+
"property",
|
|
383
|
+
"",
|
|
384
|
+
"P\"2!\"/\""
|
|
385
|
+
])).sort(__assignType((a, b) => a.getNameAsString().localeCompare(b.getNameAsString()), [
|
|
386
|
+
"a",
|
|
387
|
+
"b",
|
|
388
|
+
"",
|
|
389
|
+
"P\"2!\"2\"\"/#"
|
|
390
|
+
])) ?? []);
|
|
216
391
|
return createComponent(BuiltinFile, mergeProps({
|
|
217
392
|
id: "env",
|
|
218
393
|
description: "The environment configuration module provides an interface to define environment configuration parameters."
|
|
@@ -223,6 +398,7 @@ function EnvBuiltin(props) {
|
|
|
223
398
|
"deserializeFunction",
|
|
224
399
|
"ReflectionKind",
|
|
225
400
|
"Serializer",
|
|
401
|
+
"NamingStrategy",
|
|
226
402
|
"TemplateState",
|
|
227
403
|
"Type",
|
|
228
404
|
"TypeProperty",
|
|
@@ -248,7 +424,7 @@ function EnvBuiltin(props) {
|
|
|
248
424
|
}),
|
|
249
425
|
createComponent(ObjectDeclaration, {
|
|
250
426
|
name: "initialEnv",
|
|
251
|
-
type: "Partial<
|
|
427
|
+
type: "Partial<Env>",
|
|
252
428
|
defaultValue,
|
|
253
429
|
reflection: envInstance,
|
|
254
430
|
"export": true,
|
|
@@ -290,6 +466,32 @@ function EnvBuiltin(props) {
|
|
|
290
466
|
}
|
|
291
467
|
}),
|
|
292
468
|
createComponent(Spacing, {}),
|
|
469
|
+
createComponent(VarDeclaration, {
|
|
470
|
+
name: "envNamingStrategy",
|
|
471
|
+
"const": true,
|
|
472
|
+
doc: "The environment naming strategy for the runtime.",
|
|
473
|
+
get initializer() {
|
|
474
|
+
return code`new class extends NamingStrategy {
|
|
475
|
+
constructor() {
|
|
476
|
+
super("env");
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
getPropertyName(type: TypeProperty | TypePropertySignature, forSerializer: string): string | undefined {
|
|
480
|
+
const name = super.getPropertyName(type, forSerializer);
|
|
481
|
+
if (!name) {
|
|
482
|
+
return name;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
return name.replace(/^(${getUnique(context.config.env.prefix).map(__assignType((prefix) => prefix.replace(/_$/, ""), [
|
|
486
|
+
"prefix",
|
|
487
|
+
"",
|
|
488
|
+
"P\"2!\"/\""
|
|
489
|
+
])).join("|")})_/, "");
|
|
490
|
+
}
|
|
491
|
+
}; `;
|
|
492
|
+
}
|
|
493
|
+
}),
|
|
494
|
+
createComponent(Spacing, {}),
|
|
293
495
|
createComponent(TSDoc, {
|
|
294
496
|
heading: "A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.",
|
|
295
497
|
get children() {
|
|
@@ -302,7 +504,6 @@ function EnvBuiltin(props) {
|
|
|
302
504
|
}),
|
|
303
505
|
createComponent(VarDeclaration, {
|
|
304
506
|
name: "envSerializer",
|
|
305
|
-
"export": false,
|
|
306
507
|
"const": true,
|
|
307
508
|
get initializer() {
|
|
308
509
|
return createComponent(NewExpression, {
|
|
@@ -312,21 +513,42 @@ function EnvBuiltin(props) {
|
|
|
312
513
|
}
|
|
313
514
|
}),
|
|
314
515
|
createComponent(Spacing, {}),
|
|
516
|
+
createComponent(VarDeclaration, {
|
|
517
|
+
name: "_serializeEnv",
|
|
518
|
+
"const": true,
|
|
519
|
+
initializer: "serializeFunction<Env>(envSerializer, envNamingStrategy)"
|
|
520
|
+
}),
|
|
521
|
+
createComponent(Spacing, {}),
|
|
315
522
|
createComponent(TSDoc, {
|
|
316
523
|
heading: "Serialize a environment configuration object to JSON data objects (not a JSON string).",
|
|
317
524
|
get children() {
|
|
318
525
|
return [
|
|
319
526
|
createComponent(TSDocRemarks, { children: `The resulting JSON object can be stringified using \`JSON.stringify()\`.` }),
|
|
320
527
|
createComponent(TSDocExample, { children: `const json = serializeEnv(env);` }),
|
|
528
|
+
createComponent(Spacing, {}),
|
|
529
|
+
createComponent(TSDocParam, {
|
|
530
|
+
name: "input",
|
|
531
|
+
children: `The environment configuration object to serialize.`
|
|
532
|
+
}),
|
|
533
|
+
createComponent(TSDocReturns, { children: `The serialized environment configuration as JSON data objects.` }),
|
|
321
534
|
createComponent(TSDocThrows, { children: `ValidationError when serialization or validation fails.` })
|
|
322
535
|
];
|
|
323
536
|
}
|
|
324
537
|
}),
|
|
325
|
-
createComponent(
|
|
538
|
+
createComponent(FunctionDeclaration, {
|
|
326
539
|
name: "serializeEnv",
|
|
327
540
|
"export": true,
|
|
541
|
+
parameters: [{
|
|
542
|
+
name: "input",
|
|
543
|
+
type: "Env"
|
|
544
|
+
}],
|
|
545
|
+
children: code` return _serializeEnv(input, { loosely: true }); `
|
|
546
|
+
}),
|
|
547
|
+
createComponent(Spacing, {}),
|
|
548
|
+
createComponent(VarDeclaration, {
|
|
549
|
+
name: "_deserializeEnv",
|
|
328
550
|
"const": true,
|
|
329
|
-
initializer: "
|
|
551
|
+
initializer: "deserializeFunction<Env>(envSerializer, envNamingStrategy)"
|
|
330
552
|
}),
|
|
331
553
|
createComponent(Spacing, {}),
|
|
332
554
|
createComponent(TSDoc, {
|
|
@@ -339,11 +561,14 @@ function EnvBuiltin(props) {
|
|
|
339
561
|
];
|
|
340
562
|
}
|
|
341
563
|
}),
|
|
342
|
-
createComponent(
|
|
564
|
+
createComponent(FunctionDeclaration, {
|
|
343
565
|
name: "deserializeEnv",
|
|
344
566
|
"export": true,
|
|
345
|
-
|
|
346
|
-
|
|
567
|
+
parameters: [{
|
|
568
|
+
name: "input",
|
|
569
|
+
type: "Env"
|
|
570
|
+
}],
|
|
571
|
+
children: code` return _deserializeEnv(input, { loosely: true }); `
|
|
347
572
|
}),
|
|
348
573
|
createComponent(Spacing, {}),
|
|
349
574
|
createComponent(TSDoc, {
|
|
@@ -383,32 +608,46 @@ function EnvBuiltin(props) {
|
|
|
383
608
|
deserializeEnv({
|
|
384
609
|
...initialEnv,
|
|
385
610
|
...environmentConfig
|
|
386
|
-
}
|
|
611
|
+
} as Env),
|
|
387
612
|
{
|
|
388
|
-
get: (target:
|
|
613
|
+
get: (target: UnprefixedEnv, propertyName: string) => { `,
|
|
389
614
|
createIntrinsic("hbr", {}),
|
|
390
615
|
createComponent(For, {
|
|
391
616
|
each: reflectionGetProperties,
|
|
392
|
-
children
|
|
393
|
-
index,
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
617
|
+
get children() {
|
|
618
|
+
return __assignType((property, index) => createComponent(ConfigPropertyGet, {
|
|
619
|
+
index,
|
|
620
|
+
context,
|
|
621
|
+
property
|
|
622
|
+
}), [
|
|
623
|
+
"property",
|
|
624
|
+
"index",
|
|
625
|
+
"",
|
|
626
|
+
"P!2!'2\"\"/#"
|
|
627
|
+
]);
|
|
628
|
+
}
|
|
397
629
|
}),
|
|
398
630
|
code`
|
|
399
631
|
return undefined;
|
|
400
632
|
}, `,
|
|
401
633
|
createComponent(Spacing, {}),
|
|
402
|
-
code` set: (target:
|
|
634
|
+
code` set: (target: UnprefixedEnv, propertyName: string, newValue: any) => { `,
|
|
403
635
|
createIntrinsic("hbr", {}),
|
|
404
636
|
createComponent(For, {
|
|
405
637
|
each: reflectionSetProperties,
|
|
406
638
|
ender: code` else `,
|
|
407
|
-
children
|
|
408
|
-
index,
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
639
|
+
get children() {
|
|
640
|
+
return __assignType((property, index) => createComponent(ConfigPropertySet, {
|
|
641
|
+
index,
|
|
642
|
+
context,
|
|
643
|
+
property
|
|
644
|
+
}), [
|
|
645
|
+
"property",
|
|
646
|
+
"index",
|
|
647
|
+
"",
|
|
648
|
+
"P!2!'2\"\"/#"
|
|
649
|
+
]);
|
|
650
|
+
}
|
|
412
651
|
}),
|
|
413
652
|
createIntrinsic("hbr", {}),
|
|
414
653
|
code`return false;
|
|
@@ -497,8 +736,7 @@ function EnvBuiltin(props) {
|
|
|
497
736
|
env.APPCENTER_BUILD_ID ||
|
|
498
737
|
env.CI_XCODE_PROJECT ||
|
|
499
738
|
env.XCS || false
|
|
500
|
-
);
|
|
501
|
-
`
|
|
739
|
+
); `
|
|
502
740
|
}),
|
|
503
741
|
createComponent(Spacing, {}),
|
|
504
742
|
createComponent(TSDoc, {
|
|
@@ -560,7 +798,14 @@ function EnvBuiltin(props) {
|
|
|
560
798
|
}
|
|
561
799
|
}));
|
|
562
800
|
}
|
|
801
|
+
EnvBuiltin.__type = [
|
|
802
|
+
() => __ΩEnvBuiltinProps,
|
|
803
|
+
"props",
|
|
804
|
+
"EnvBuiltin",
|
|
805
|
+
"Generates the environment configuration module for the Powerlines project.",
|
|
806
|
+
"Pn!2\"\"/#?$"
|
|
807
|
+
];
|
|
563
808
|
|
|
564
809
|
//#endregion
|
|
565
|
-
export { EnvBuiltin, EnvTypeDefinition };
|
|
810
|
+
export { EnvBuiltin, EnvTypeDefinition, __ΩEnvBuiltinProps };
|
|
566
811
|
//# sourceMappingURL=env-builtin.mjs.map
|