@powerlines/plugin-env 0.16.364 → 0.16.365

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/babel/plugin.cjs +4 -26
  2. package/dist/babel/plugin.mjs +4 -26
  3. package/dist/components/docs.cjs +4 -47
  4. package/dist/components/docs.mjs +4 -46
  5. package/dist/components/env-builtin.cjs +70 -250
  6. package/dist/components/env-builtin.mjs +70 -248
  7. package/dist/components/index.cjs +1 -4
  8. package/dist/components/index.mjs +3 -3
  9. package/dist/helpers/automd-generator.cjs +4 -12
  10. package/dist/helpers/automd-generator.mjs +4 -12
  11. package/dist/helpers/index.cjs +1 -1
  12. package/dist/helpers/index.d.cts +2 -2
  13. package/dist/helpers/index.d.mts +2 -2
  14. package/dist/helpers/index.mjs +2 -2
  15. package/dist/helpers/load.cjs +7 -59
  16. package/dist/helpers/load.d.cts +2 -2
  17. package/dist/helpers/load.d.mts +2 -2
  18. package/dist/helpers/load.mjs +7 -59
  19. package/dist/helpers/schema.cjs +35 -154
  20. package/dist/helpers/schema.d.cts +9 -8
  21. package/dist/helpers/schema.d.cts.map +1 -1
  22. package/dist/helpers/schema.d.mts +9 -8
  23. package/dist/helpers/schema.mjs +35 -154
  24. package/dist/helpers/source-file-env.cjs +4 -34
  25. package/dist/helpers/source-file-env.mjs +4 -34
  26. package/dist/index.cjs +20 -47
  27. package/dist/index.d.cts +2 -2
  28. package/dist/index.d.cts.map +1 -1
  29. package/dist/index.d.mts +2 -2
  30. package/dist/index.mjs +18 -39
  31. package/dist/schemas/env.cjs +723 -0
  32. package/dist/schemas/env.d.cts +230 -0
  33. package/dist/schemas/env.d.cts.map +1 -0
  34. package/dist/schemas/env.d.mts +230 -0
  35. package/dist/{types → schemas}/env.d.mts.map +1 -1
  36. package/dist/schemas/env.mjs +715 -0
  37. package/dist/schemas/index.cjs +10 -0
  38. package/dist/schemas/index.d.cts +2 -0
  39. package/dist/schemas/index.d.mts +2 -0
  40. package/dist/schemas/index.mjs +3 -0
  41. package/dist/types/index.cjs +0 -12
  42. package/dist/types/index.d.cts +1 -2
  43. package/dist/types/index.d.mts +1 -2
  44. package/dist/types/index.mjs +1 -4
  45. package/dist/types/plugin.cjs +7 -107
  46. package/dist/types/plugin.d.cts +2 -2
  47. package/dist/types/plugin.d.mts +2 -2
  48. package/dist/types/plugin.mjs +7 -100
  49. package/package.json +40 -25
  50. package/dist/types/env.cjs +0 -541
  51. package/dist/types/env.d.cts +0 -938
  52. package/dist/types/env.d.cts.map +0 -1
  53. package/dist/types/env.d.mts +0 -938
  54. package/dist/types/env.mjs +0 -539
  55. /package/dist/{types → schemas}/env.mjs.map +0 -0
@@ -17,40 +17,11 @@ let _stryke_helpers_deep_clone = require("@stryke/helpers/deep-clone");
17
17
  let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
18
18
 
19
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
- }
44
- const __ΩEnvTypeDefinitionProps = [
45
- "schema",
46
- "EnvTypeDefinitionProps",
47
- "P!!4!Mw\"y"
48
- ];
49
20
  /**
50
21
  * Generates the environment configuration typescript definition for the Powerlines project.
51
22
  */
52
23
  function EnvTypeDefinition(props) {
53
- const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
24
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
54
25
  const { schema } = props;
55
26
  return [
56
27
  (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components.InterfaceDeclaration, {
@@ -72,112 +43,50 @@ function EnvTypeDefinition(props) {
72
43
  get children() {
73
44
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
74
45
  get each() {
75
- return (0, _stryke_helpers_get_unique.getUnique)(context.config.env.prefix).map(__assignType((prefix) => prefix.replace(/_*$/, ""), [
76
- "prefix",
77
- "",
78
- "P\"2!\"/\""
79
- ]));
46
+ return (0, _stryke_helpers_get_unique.getUnique)(context.config.env.prefix).map((prefix) => prefix.replace(/_*$/, ""));
80
47
  },
81
48
  doubleHardline: true,
82
- get children() {
83
- return __assignType((prefix) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
84
- get each() {
85
- return (0, _power_plant_schema.getPropertiesList)(schema).filter(__assignType((property) => !property.ignore, [
86
- "property",
87
- "",
88
- "P\"2!\"/\""
89
- ])) ?? [];
49
+ children: (prefix) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
50
+ get each() {
51
+ return (0, _power_plant_schema.getPropertiesList)(schema).filter((property) => !property.ignore) ?? [];
52
+ },
53
+ doubleHardline: true,
54
+ children: (property) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components.TSDocSchemaProperty, {
55
+ get schema() {
56
+ return {
57
+ ...property,
58
+ alias: [property.name, ...(0, _stryke_convert_to_array.toArray)(property.alias).filter((alias) => alias !== `${prefix}_${property.name}`)]
59
+ };
90
60
  },
91
- doubleHardline: true,
92
- get children() {
93
- return __assignType((property) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components.TSDocSchemaProperty, {
94
- get schema() {
95
- return {
96
- ...property,
97
- alias: [property.name, ...(0, _stryke_convert_to_array.toArray)(property.alias).filter(__assignType((alias) => alias !== `${prefix}_${property.name}`, [
98
- "alias",
99
- "",
100
- "P\"2!\"/\""
101
- ]))]
102
- };
103
- },
104
- get defaultValue() {
105
- return property?.default;
106
- }
107
- }), (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components.InterfaceMember, {
108
- get name() {
109
- return `${prefix}_${property.name}`;
110
- },
111
- get type() {
112
- return `UnprefixedEnv["${property.name}"]`;
113
- },
114
- schema: property,
115
- get required() {
116
- return property.required;
117
- },
118
- get readOnly() {
119
- return property.readOnly;
120
- }
121
- })], [
122
- "property",
123
- "",
124
- "P\"2!\"/\""
125
- ]);
61
+ get defaultValue() {
62
+ return property?.default;
63
+ }
64
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components.InterfaceMember, {
65
+ get name() {
66
+ return `${prefix}_${property.name}`;
67
+ },
68
+ get type() {
69
+ return `UnprefixedEnv["${property.name}"]`;
70
+ },
71
+ schema: property,
72
+ get required() {
73
+ return property.required;
74
+ },
75
+ get readOnly() {
76
+ return property.readOnly;
126
77
  }
127
- }), [
128
- "prefix",
129
- "",
130
- "P\"2!\"/\""
131
- ]);
132
- }
78
+ })]
79
+ })
133
80
  });
134
81
  }
135
82
  }),
136
83
  (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {})
137
84
  ];
138
85
  }
139
- EnvTypeDefinition.__type = [
140
- () => __ΩEnvTypeDefinitionProps,
141
- "props",
142
- "EnvTypeDefinition",
143
- "Generates the environment configuration typescript definition for the Powerlines project.",
144
- "Pn!2\"\"/#?$"
145
- ];
146
- const __ΩConfigPropertyConditionalProps = [
147
- "EnvPluginContext",
148
- "context",
149
- "name",
150
- "ConfigPropertyConditionalProps",
151
- "P!\"w!4\"&4#Mw$y"
152
- ];
153
86
  function ConfigPropertyConditional(props) {
154
87
  const [{ context, name }] = (0, _alloy_js_core.splitProps)(props, ["context", "name"]);
155
- 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), [
156
- "a",
157
- "b",
158
- "",
159
- "P\"2!\"2\"\"/#"
160
- ])).map(__assignType((prefix) => `${prefix.replace(/_$/, "")}_`, [
161
- "prefix",
162
- "",
163
- "P\"2!\"/\""
164
- ]))).join("|")})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${name.toLowerCase().replace(/[\s\-_]+/g, "")}"`;
88
+ return _alloy_js_core.code`propertyName === "${name}" || propertyName.replace(/^(${(0, _stryke_helpers_get_unique.getUnique)(context.config.env.prefix.sort((a, b) => a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)).map((prefix) => `${prefix.replace(/_$/, "")}_`)).join("|")})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${name.toLowerCase().replace(/[\s\-_]+/g, "")}"`;
165
89
  }
166
- ConfigPropertyConditional.__type = [
167
- () => __ΩConfigPropertyConditionalProps,
168
- "props",
169
- "ConfigPropertyConditional",
170
- "Pn!2\"\"/#"
171
- ];
172
- const __ΩConfigPropertyProps = [
173
- "index",
174
- "EnvPluginContext",
175
- "context",
176
- "name",
177
- "property",
178
- "ConfigPropertyProps",
179
- "P!'4!\"w\"4#&4$!4%Mw&y"
180
- ];
181
90
  function ConfigPropertyGet(props) {
182
91
  const [{ context, name, property, index }] = (0, _alloy_js_core.splitProps)(props, [
183
92
  "context",
@@ -200,16 +109,10 @@ function ConfigPropertyGet(props) {
200
109
  return property?.alias ?? [];
201
110
  },
202
111
  joiner: _alloy_js_core.code` || `,
203
- get children() {
204
- return __assignType((alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
205
- name: alias,
206
- context
207
- }), [
208
- "alias",
209
- "",
210
- "P\"2!\"/\""
211
- ]);
212
- }
112
+ children: (alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
113
+ name: alias,
114
+ context
115
+ })
213
116
  })];
214
117
  }
215
118
  })];
@@ -230,16 +133,10 @@ function ConfigPropertyGet(props) {
230
133
  return property?.alias ?? [];
231
134
  },
232
135
  joiner: _alloy_js_core.code` || `,
233
- get children() {
234
- return __assignType((alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
235
- name: alias,
236
- context
237
- }), [
238
- "alias",
239
- "",
240
- "P\"2!\"/\""
241
- ]);
242
- }
136
+ children: (alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
137
+ name: alias,
138
+ context
139
+ })
243
140
  })];
244
141
  }
245
142
  })];
@@ -247,12 +144,6 @@ function ConfigPropertyGet(props) {
247
144
  children: _alloy_js_core.code`return target["${name}"];`
248
145
  })];
249
146
  }
250
- ConfigPropertyGet.__type = [
251
- () => __ΩConfigPropertyProps,
252
- "props",
253
- "ConfigPropertyGet",
254
- "Pn!2\"\"/#"
255
- ];
256
147
  function ConfigPropertySet(props) {
257
148
  const [{ context, name, property, index }] = (0, _alloy_js_core.splitProps)(props, [
258
149
  "context",
@@ -275,16 +166,10 @@ function ConfigPropertySet(props) {
275
166
  return property?.alias ?? [];
276
167
  },
277
168
  joiner: _alloy_js_core.code` || `,
278
- get children() {
279
- return __assignType((alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
280
- name: alias,
281
- context
282
- }), [
283
- "alias",
284
- "",
285
- "P\"2!\"/\""
286
- ]);
287
- }
169
+ children: (alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
170
+ name: alias,
171
+ context
172
+ })
288
173
  })];
289
174
  }
290
175
  })];
@@ -308,16 +193,10 @@ function ConfigPropertySet(props) {
308
193
  return property?.alias ?? [];
309
194
  },
310
195
  joiner: _alloy_js_core.code` || `,
311
- get children() {
312
- return __assignType((alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
313
- name: alias,
314
- context
315
- }), [
316
- "alias",
317
- "",
318
- "P\"2!\"/\""
319
- ]);
320
- }
196
+ children: (alias) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
197
+ name: alias,
198
+ context
199
+ })
321
200
  })];
322
201
  }
323
202
  })];
@@ -328,20 +207,6 @@ function ConfigPropertySet(props) {
328
207
  `
329
208
  })];
330
209
  }
331
- ConfigPropertySet.__type = [
332
- () => __ΩConfigPropertyProps,
333
- "props",
334
- "ConfigPropertySet",
335
- "Pn!2\"\"/#"
336
- ];
337
- const __ΩEnvBuiltinProps = [
338
- () => __ΩOmit,
339
- "id",
340
- "Children",
341
- "defaultConfig",
342
- "EnvBuiltinProps",
343
- "P!.\"o!#\"w#4$8Mw%y"
344
- ];
345
210
  const createEnvRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("createEnv");
346
211
  const envRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("env");
347
212
  /**
@@ -349,44 +214,22 @@ const envRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("env");
349
214
  */
350
215
  function EnvBuiltin(props) {
351
216
  const [{ defaultConfig, children }, rest] = (0, _alloy_js_core.splitProps)(props, ["defaultConfig", "children"]);
352
- const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
217
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
353
218
  const defaultValue = (0, _alloy_js_core.computed)(() => context && require_helpers_load.loadEnvFromContext(context, process.env));
354
219
  const schema = (0, _alloy_js_core.computed)(() => {
355
220
  const result = (0, _stryke_helpers_deep_clone.deepClone)(context.env.config.schema);
356
221
  result.name = "Env";
357
- Object.entries(defaultValue.value ?? {}).forEach(__assignType(([key, value]) => {
222
+ Object.entries(defaultValue.value ?? {}).forEach(([key, value]) => {
358
223
  const unprefixedKey = key.replace(new RegExp(`^(${context.config.env.prefix.join("|")})_`), "");
359
224
  if (unprefixedKey in (result.properties ?? {}) && (0, _stryke_type_checks_is_set_object.isSetObject)(result.properties?.[unprefixedKey])) result.properties[unprefixedKey] = {
360
225
  ...result.properties?.[unprefixedKey],
361
226
  default: value
362
227
  };
363
- }, [
364
- "param0",
365
- "",
366
- "P\"2!\"/\""
367
- ]));
228
+ });
368
229
  return result;
369
230
  });
370
- const schemaGetProperties = (0, _alloy_js_core.computed)(() => (0, _power_plant_schema.getPropertiesList)(schema.value).filter(__assignType((property) => !property?.ignore && !property?.writeOnly, [
371
- "property",
372
- "",
373
- "P\"2!\"/\""
374
- ])).sort(__assignType((a, b) => !a?.name && !b?.name ? 0 : !a?.name ? 1 : !b?.name ? -1 : a?.name.localeCompare(b?.name), [
375
- "a",
376
- "b",
377
- "",
378
- "P\"2!\"2\"\"/#"
379
- ])) ?? []);
380
- const schemaSetProperties = (0, _alloy_js_core.computed)(() => (0, _power_plant_schema.getPropertiesList)(schema.value).filter(__assignType((property) => !property?.ignore && !property?.readOnly, [
381
- "property",
382
- "",
383
- "P\"2!\"/\""
384
- ])).sort(__assignType((a, b) => !a?.name && !b?.name ? 0 : !a?.name ? 1 : !b?.name ? -1 : a?.name.localeCompare(b?.name), [
385
- "a",
386
- "b",
387
- "",
388
- "P\"2!\"2\"\"/#"
389
- ])) ?? []);
231
+ const schemaGetProperties = (0, _alloy_js_core.computed)(() => (0, _power_plant_schema.getPropertiesList)(schema.value).filter((property) => !property?.ignore && !property?.writeOnly).sort((a, b) => !a?.name && !b?.name ? 0 : !a?.name ? 1 : !b?.name ? -1 : a?.name.localeCompare(b?.name)) ?? []);
232
+ const schemaSetProperties = (0, _alloy_js_core.computed)(() => (0, _power_plant_schema.getPropertiesList)(schema.value).filter((property) => !property?.ignore && !property?.readOnly).sort((a, b) => !a?.name && !b?.name ? 0 : !a?.name ? 1 : !b?.name ? -1 : a?.name.localeCompare(b?.name)) ?? []);
390
233
  const parserCode = (0, _power_plant_schema_codegen.generateParserCode)(schema.value);
391
234
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
392
235
  id: "env",
@@ -466,21 +309,14 @@ function EnvBuiltin(props) {
466
309
  get each() {
467
310
  return schemaGetProperties.value;
468
311
  },
469
- get children() {
470
- return __assignType((property, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyGet, {
471
- index,
472
- context,
473
- get name() {
474
- return property.name;
475
- },
476
- property
477
- }), [
478
- "property",
479
- "index",
480
- "",
481
- "P!2!'2\"\"/#"
482
- ]);
483
- }
312
+ children: (property, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyGet, {
313
+ index,
314
+ context,
315
+ get name() {
316
+ return property.name;
317
+ },
318
+ property
319
+ })
484
320
  }),
485
321
  _alloy_js_core.code`
486
322
  return undefined;
@@ -493,21 +329,14 @@ function EnvBuiltin(props) {
493
329
  return schemaSetProperties.value;
494
330
  },
495
331
  ender: _alloy_js_core.code` else `,
496
- get children() {
497
- return __assignType((property, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertySet, {
498
- index,
499
- context,
500
- get name() {
501
- return property.name;
502
- },
503
- property
504
- }), [
505
- "property",
506
- "index",
507
- "",
508
- "P!2!'2\"\"/#"
509
- ]);
510
- }
332
+ children: (property, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertySet, {
333
+ index,
334
+ context,
335
+ get name() {
336
+ return property.name;
337
+ },
338
+ property
339
+ })
511
340
  }),
512
341
  (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
513
342
  _alloy_js_core.code`return false;
@@ -660,16 +489,7 @@ function EnvBuiltin(props) {
660
489
  ];
661
490
  } }));
662
491
  }
663
- EnvBuiltin.__type = [
664
- () => __ΩEnvBuiltinProps,
665
- "props",
666
- "EnvBuiltin",
667
- "Generates the environment configuration module for the Powerlines project.",
668
- "Pn!2\"\"/#?$"
669
- ];
670
492
 
671
493
  //#endregion
672
494
  exports.EnvBuiltin = EnvBuiltin;
673
- exports.EnvTypeDefinition = EnvTypeDefinition;
674
- exports.__ΩEnvBuiltinProps = __ΩEnvBuiltinProps;
675
- exports.__ΩEnvTypeDefinitionProps = __ΩEnvTypeDefinitionProps;
495
+ exports.EnvTypeDefinition = EnvTypeDefinition;