@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
@@ -16,40 +16,11 @@ import { deepClone } from "@stryke/helpers/deep-clone";
16
16
  import { getUnique } from "@stryke/helpers/get-unique";
17
17
 
18
18
  //#region src/components/env-builtin.tsx
19
- const __ΩOmit = [
20
- "T",
21
- "K",
22
- () => __ΩPick,
23
- () => __ΩExclude,
24
- "Omit",
25
- "b!b\"e!!e!!ge!\"o$#o##w%y"
26
- ];
27
- const __ΩPick = [
28
- "T",
29
- "K",
30
- "Pick",
31
- "l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
32
- ];
33
- const __ΩExclude = [
34
- "T",
35
- "U",
36
- "Exclude",
37
- "l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
38
- ];
39
- function __assignType(fn, args) {
40
- fn.__type = args;
41
- return fn;
42
- }
43
- const __ΩEnvTypeDefinitionProps = [
44
- "schema",
45
- "EnvTypeDefinitionProps",
46
- "P!!4!Mw\"y"
47
- ];
48
19
  /**
49
20
  * Generates the environment configuration typescript definition for the Powerlines project.
50
21
  */
51
22
  function EnvTypeDefinition(props) {
52
- const context = (usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], usePowerlines());
23
+ const context = usePowerlines();
53
24
  const { schema } = props;
54
25
  return [
55
26
  createComponent(InterfaceDeclaration$1, {
@@ -71,112 +42,50 @@ function EnvTypeDefinition(props) {
71
42
  get children() {
72
43
  return createComponent(For, {
73
44
  get each() {
74
- return getUnique(context.config.env.prefix).map(__assignType((prefix) => prefix.replace(/_*$/, ""), [
75
- "prefix",
76
- "",
77
- "P\"2!\"/\""
78
- ]));
45
+ return getUnique(context.config.env.prefix).map((prefix) => prefix.replace(/_*$/, ""));
79
46
  },
80
47
  doubleHardline: true,
81
- get children() {
82
- return __assignType((prefix) => createComponent(For, {
83
- get each() {
84
- return getPropertiesList(schema).filter(__assignType((property) => !property.ignore, [
85
- "property",
86
- "",
87
- "P\"2!\"/\""
88
- ])) ?? [];
48
+ children: (prefix) => createComponent(For, {
49
+ get each() {
50
+ return getPropertiesList(schema).filter((property) => !property.ignore) ?? [];
51
+ },
52
+ doubleHardline: true,
53
+ children: (property) => [createComponent(TSDocSchemaProperty, {
54
+ get schema() {
55
+ return {
56
+ ...property,
57
+ alias: [property.name, ...toArray(property.alias).filter((alias) => alias !== `${prefix}_${property.name}`)]
58
+ };
89
59
  },
90
- doubleHardline: true,
91
- get children() {
92
- return __assignType((property) => [createComponent(TSDocSchemaProperty, {
93
- get schema() {
94
- return {
95
- ...property,
96
- alias: [property.name, ...toArray(property.alias).filter(__assignType((alias) => alias !== `${prefix}_${property.name}`, [
97
- "alias",
98
- "",
99
- "P\"2!\"/\""
100
- ]))]
101
- };
102
- },
103
- get defaultValue() {
104
- return property?.default;
105
- }
106
- }), createComponent(InterfaceMember, {
107
- get name() {
108
- return `${prefix}_${property.name}`;
109
- },
110
- get type() {
111
- return `UnprefixedEnv["${property.name}"]`;
112
- },
113
- schema: property,
114
- get required() {
115
- return property.required;
116
- },
117
- get readOnly() {
118
- return property.readOnly;
119
- }
120
- })], [
121
- "property",
122
- "",
123
- "P\"2!\"/\""
124
- ]);
60
+ get defaultValue() {
61
+ return property?.default;
62
+ }
63
+ }), createComponent(InterfaceMember, {
64
+ get name() {
65
+ return `${prefix}_${property.name}`;
66
+ },
67
+ get type() {
68
+ return `UnprefixedEnv["${property.name}"]`;
69
+ },
70
+ schema: property,
71
+ get required() {
72
+ return property.required;
73
+ },
74
+ get readOnly() {
75
+ return property.readOnly;
125
76
  }
126
- }), [
127
- "prefix",
128
- "",
129
- "P\"2!\"/\""
130
- ]);
131
- }
77
+ })]
78
+ })
132
79
  });
133
80
  }
134
81
  }),
135
82
  createComponent(Spacing, {})
136
83
  ];
137
84
  }
138
- EnvTypeDefinition.__type = [
139
- () => __ΩEnvTypeDefinitionProps,
140
- "props",
141
- "EnvTypeDefinition",
142
- "Generates the environment configuration typescript definition for the Powerlines project.",
143
- "Pn!2\"\"/#?$"
144
- ];
145
- const __ΩConfigPropertyConditionalProps = [
146
- "EnvPluginContext",
147
- "context",
148
- "name",
149
- "ConfigPropertyConditionalProps",
150
- "P!\"w!4\"&4#Mw$y"
151
- ];
152
85
  function ConfigPropertyConditional(props) {
153
86
  const [{ context, name }] = splitProps(props, ["context", "name"]);
154
- 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), [
155
- "a",
156
- "b",
157
- "",
158
- "P\"2!\"2\"\"/#"
159
- ])).map(__assignType((prefix) => `${prefix.replace(/_$/, "")}_`, [
160
- "prefix",
161
- "",
162
- "P\"2!\"/\""
163
- ]))).join("|")})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${name.toLowerCase().replace(/[\s\-_]+/g, "")}"`;
87
+ 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)).map((prefix) => `${prefix.replace(/_$/, "")}_`)).join("|")})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${name.toLowerCase().replace(/[\s\-_]+/g, "")}"`;
164
88
  }
165
- ConfigPropertyConditional.__type = [
166
- () => __ΩConfigPropertyConditionalProps,
167
- "props",
168
- "ConfigPropertyConditional",
169
- "Pn!2\"\"/#"
170
- ];
171
- const __ΩConfigPropertyProps = [
172
- "index",
173
- "EnvPluginContext",
174
- "context",
175
- "name",
176
- "property",
177
- "ConfigPropertyProps",
178
- "P!'4!\"w\"4#&4$!4%Mw&y"
179
- ];
180
89
  function ConfigPropertyGet(props) {
181
90
  const [{ context, name, property, index }] = splitProps(props, [
182
91
  "context",
@@ -199,16 +108,10 @@ function ConfigPropertyGet(props) {
199
108
  return property?.alias ?? [];
200
109
  },
201
110
  joiner: code` || `,
202
- get children() {
203
- return __assignType((alias) => createComponent(ConfigPropertyConditional, {
204
- name: alias,
205
- context
206
- }), [
207
- "alias",
208
- "",
209
- "P\"2!\"/\""
210
- ]);
211
- }
111
+ children: (alias) => createComponent(ConfigPropertyConditional, {
112
+ name: alias,
113
+ context
114
+ })
212
115
  })];
213
116
  }
214
117
  })];
@@ -229,16 +132,10 @@ function ConfigPropertyGet(props) {
229
132
  return property?.alias ?? [];
230
133
  },
231
134
  joiner: code` || `,
232
- get children() {
233
- return __assignType((alias) => createComponent(ConfigPropertyConditional, {
234
- name: alias,
235
- context
236
- }), [
237
- "alias",
238
- "",
239
- "P\"2!\"/\""
240
- ]);
241
- }
135
+ children: (alias) => createComponent(ConfigPropertyConditional, {
136
+ name: alias,
137
+ context
138
+ })
242
139
  })];
243
140
  }
244
141
  })];
@@ -246,12 +143,6 @@ function ConfigPropertyGet(props) {
246
143
  children: code`return target["${name}"];`
247
144
  })];
248
145
  }
249
- ConfigPropertyGet.__type = [
250
- () => __ΩConfigPropertyProps,
251
- "props",
252
- "ConfigPropertyGet",
253
- "Pn!2\"\"/#"
254
- ];
255
146
  function ConfigPropertySet(props) {
256
147
  const [{ context, name, property, index }] = splitProps(props, [
257
148
  "context",
@@ -274,16 +165,10 @@ function ConfigPropertySet(props) {
274
165
  return property?.alias ?? [];
275
166
  },
276
167
  joiner: code` || `,
277
- get children() {
278
- return __assignType((alias) => createComponent(ConfigPropertyConditional, {
279
- name: alias,
280
- context
281
- }), [
282
- "alias",
283
- "",
284
- "P\"2!\"/\""
285
- ]);
286
- }
168
+ children: (alias) => createComponent(ConfigPropertyConditional, {
169
+ name: alias,
170
+ context
171
+ })
287
172
  })];
288
173
  }
289
174
  })];
@@ -307,16 +192,10 @@ function ConfigPropertySet(props) {
307
192
  return property?.alias ?? [];
308
193
  },
309
194
  joiner: code` || `,
310
- get children() {
311
- return __assignType((alias) => createComponent(ConfigPropertyConditional, {
312
- name: alias,
313
- context
314
- }), [
315
- "alias",
316
- "",
317
- "P\"2!\"/\""
318
- ]);
319
- }
195
+ children: (alias) => createComponent(ConfigPropertyConditional, {
196
+ name: alias,
197
+ context
198
+ })
320
199
  })];
321
200
  }
322
201
  })];
@@ -327,20 +206,6 @@ function ConfigPropertySet(props) {
327
206
  `
328
207
  })];
329
208
  }
330
- ConfigPropertySet.__type = [
331
- () => __ΩConfigPropertyProps,
332
- "props",
333
- "ConfigPropertySet",
334
- "Pn!2\"\"/#"
335
- ];
336
- const __ΩEnvBuiltinProps = [
337
- () => __ΩOmit,
338
- "id",
339
- "Children",
340
- "defaultConfig",
341
- "EnvBuiltinProps",
342
- "P!.\"o!#\"w#4$8Mw%y"
343
- ];
344
209
  const createEnvRefkey = refkey("createEnv");
345
210
  const envRefkey = refkey("env");
346
211
  /**
@@ -348,44 +213,22 @@ const envRefkey = refkey("env");
348
213
  */
349
214
  function EnvBuiltin(props) {
350
215
  const [{ defaultConfig, children }, rest] = splitProps(props, ["defaultConfig", "children"]);
351
- const context = (usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], usePowerlines());
216
+ const context = usePowerlines();
352
217
  const defaultValue = computed(() => context && loadEnvFromContext(context, process.env));
353
218
  const schema = computed(() => {
354
219
  const result = deepClone(context.env.config.schema);
355
220
  result.name = "Env";
356
- Object.entries(defaultValue.value ?? {}).forEach(__assignType(([key, value]) => {
221
+ Object.entries(defaultValue.value ?? {}).forEach(([key, value]) => {
357
222
  const unprefixedKey = key.replace(new RegExp(`^(${context.config.env.prefix.join("|")})_`), "");
358
223
  if (unprefixedKey in (result.properties ?? {}) && isSetObject(result.properties?.[unprefixedKey])) result.properties[unprefixedKey] = {
359
224
  ...result.properties?.[unprefixedKey],
360
225
  default: value
361
226
  };
362
- }, [
363
- "param0",
364
- "",
365
- "P\"2!\"/\""
366
- ]));
227
+ });
367
228
  return result;
368
229
  });
369
- const schemaGetProperties = computed(() => getPropertiesList(schema.value).filter(__assignType((property) => !property?.ignore && !property?.writeOnly, [
370
- "property",
371
- "",
372
- "P\"2!\"/\""
373
- ])).sort(__assignType((a, b) => !a?.name && !b?.name ? 0 : !a?.name ? 1 : !b?.name ? -1 : a?.name.localeCompare(b?.name), [
374
- "a",
375
- "b",
376
- "",
377
- "P\"2!\"2\"\"/#"
378
- ])) ?? []);
379
- const schemaSetProperties = computed(() => getPropertiesList(schema.value).filter(__assignType((property) => !property?.ignore && !property?.readOnly, [
380
- "property",
381
- "",
382
- "P\"2!\"/\""
383
- ])).sort(__assignType((a, b) => !a?.name && !b?.name ? 0 : !a?.name ? 1 : !b?.name ? -1 : a?.name.localeCompare(b?.name), [
384
- "a",
385
- "b",
386
- "",
387
- "P\"2!\"2\"\"/#"
388
- ])) ?? []);
230
+ const schemaGetProperties = computed(() => 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)) ?? []);
231
+ const schemaSetProperties = computed(() => 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)) ?? []);
389
232
  const parserCode = generateParserCode(schema.value);
390
233
  return createComponent(BuiltinFile, mergeProps({
391
234
  id: "env",
@@ -465,21 +308,14 @@ function EnvBuiltin(props) {
465
308
  get each() {
466
309
  return schemaGetProperties.value;
467
310
  },
468
- get children() {
469
- return __assignType((property, index) => createComponent(ConfigPropertyGet, {
470
- index,
471
- context,
472
- get name() {
473
- return property.name;
474
- },
475
- property
476
- }), [
477
- "property",
478
- "index",
479
- "",
480
- "P!2!'2\"\"/#"
481
- ]);
482
- }
311
+ children: (property, index) => createComponent(ConfigPropertyGet, {
312
+ index,
313
+ context,
314
+ get name() {
315
+ return property.name;
316
+ },
317
+ property
318
+ })
483
319
  }),
484
320
  code`
485
321
  return undefined;
@@ -492,21 +328,14 @@ function EnvBuiltin(props) {
492
328
  return schemaSetProperties.value;
493
329
  },
494
330
  ender: code` else `,
495
- get children() {
496
- return __assignType((property, index) => createComponent(ConfigPropertySet, {
497
- index,
498
- context,
499
- get name() {
500
- return property.name;
501
- },
502
- property
503
- }), [
504
- "property",
505
- "index",
506
- "",
507
- "P!2!'2\"\"/#"
508
- ]);
509
- }
331
+ children: (property, index) => createComponent(ConfigPropertySet, {
332
+ index,
333
+ context,
334
+ get name() {
335
+ return property.name;
336
+ },
337
+ property
338
+ })
510
339
  }),
511
340
  createIntrinsic("hbr", {}),
512
341
  code`return false;
@@ -659,14 +488,7 @@ function EnvBuiltin(props) {
659
488
  ];
660
489
  } }));
661
490
  }
662
- EnvBuiltin.__type = [
663
- () => __ΩEnvBuiltinProps,
664
- "props",
665
- "EnvBuiltin",
666
- "Generates the environment configuration module for the Powerlines project.",
667
- "Pn!2\"\"/#?$"
668
- ];
669
491
 
670
492
  //#endregion
671
- export { EnvBuiltin, EnvTypeDefinition, __ΩEnvBuiltinProps, __ΩEnvTypeDefinitionProps };
493
+ export { EnvBuiltin, EnvTypeDefinition };
672
494
  //# sourceMappingURL=env-builtin.mjs.map
@@ -4,7 +4,4 @@ const require_components_env_builtin = require('./env-builtin.cjs');
4
4
 
5
5
  exports.EnvBuiltin = require_components_env_builtin.EnvBuiltin;
6
6
  exports.EnvDocsFile = require_components_docs.EnvDocsFile;
7
- exports.EnvTypeDefinition = require_components_env_builtin.EnvTypeDefinition;
8
- exports.__ΩEnvBuiltinProps = require_components_env_builtin.__ΩEnvBuiltinProps;
9
- exports.__ΩEnvDocsFileProps = require_components_docs.__ΩEnvDocsFileProps;
10
- exports.__ΩEnvTypeDefinitionProps = require_components_env_builtin.__ΩEnvTypeDefinitionProps;
7
+ exports.EnvTypeDefinition = require_components_env_builtin.EnvTypeDefinition;
@@ -1,4 +1,4 @@
1
- import { EnvDocsFile, __ΩEnvDocsFileProps } from "./docs.mjs";
2
- import { EnvBuiltin, EnvTypeDefinition, __ΩEnvBuiltinProps, __ΩEnvTypeDefinitionProps } from "./env-builtin.mjs";
1
+ import { EnvDocsFile } from "./docs.mjs";
2
+ import { EnvBuiltin, EnvTypeDefinition } from "./env-builtin.mjs";
3
3
 
4
- export { EnvBuiltin, EnvDocsFile, EnvTypeDefinition, __ΩEnvBuiltinProps, __ΩEnvDocsFileProps, __ΩEnvTypeDefinitionProps };
4
+ export { EnvBuiltin, EnvDocsFile, EnvTypeDefinition };
@@ -4,28 +4,20 @@ let automd = require("automd");
4
4
  let powerlines_plugin_utils = require("powerlines/plugin-utils");
5
5
 
6
6
  //#region src/helpers/automd-generator.ts
7
- function __assignType(fn, args) {
8
- fn.__type = args;
9
- return fn;
10
- }
11
7
  /**
12
8
  * AutoMD generator to generate environment variable documentation
13
9
  *
14
10
  * @param context - The generator context.
15
11
  * @returns The generated documentation content.
16
12
  */
17
- const env = __assignType((context) => (0, automd.defineGenerator)({
13
+ const env = (context) => (0, automd.defineGenerator)({
18
14
  name: "env",
19
- generate: __assignType(async function generate() {
15
+ async generate() {
20
16
  const envDocFile = (0, _stryke_path_join_paths.joinPaths)((0, powerlines_plugin_utils.getDocsOutputPath)(context.config.root), "env.md");
21
17
  if (!context.fs.existsSync(envDocFile)) return { contents: "" };
22
18
  return { contents: await context.fs.read(envDocFile) || "" };
23
- }, ["generate", "P\"/!"])
24
- }), [
25
- "context",
26
- "",
27
- "P!2!\"/\""
28
- ]);
19
+ }
20
+ });
29
21
 
30
22
  //#endregion
31
23
  exports.env = env;
@@ -3,28 +3,20 @@ import { defineGenerator } from "automd";
3
3
  import { getDocsOutputPath } from "powerlines/plugin-utils";
4
4
 
5
5
  //#region src/helpers/automd-generator.ts
6
- function __assignType(fn, args) {
7
- fn.__type = args;
8
- return fn;
9
- }
10
6
  /**
11
7
  * AutoMD generator to generate environment variable documentation
12
8
  *
13
9
  * @param context - The generator context.
14
10
  * @returns The generated documentation content.
15
11
  */
16
- const env = __assignType((context) => defineGenerator({
12
+ const env = (context) => defineGenerator({
17
13
  name: "env",
18
- generate: __assignType(async function generate() {
14
+ async generate() {
19
15
  const envDocFile = joinPaths(getDocsOutputPath(context.config.root), "env.md");
20
16
  if (!context.fs.existsSync(envDocFile)) return { contents: "" };
21
17
  return { contents: await context.fs.read(envDocFile) || "" };
22
- }, ["generate", "P\"/!"])
23
- }), [
24
- "context",
25
- "",
26
- "P!2!\"/\""
27
- ]);
18
+ }
19
+ });
28
20
 
29
21
  //#endregion
30
22
  export { env };
@@ -14,5 +14,5 @@ exports.getDefaultSecrets = require_helpers_schema.getDefaultSecrets;
14
14
  exports.loadEnv = require_helpers_load.loadEnv;
15
15
  exports.loadEnvFromContext = require_helpers_load.loadEnvFromContext;
16
16
  exports.removeEnvPrefix = require_helpers_source_file_env.removeEnvPrefix;
17
- exports.resolveRuntimeTypeFile = require_helpers_schema.resolveRuntimeTypeFile;
17
+ exports.resolveRuntimeSchemaFile = require_helpers_schema.resolveRuntimeSchemaFile;
18
18
  exports.writeEnv = require_helpers_schema.writeEnv;
@@ -1,5 +1,5 @@
1
1
  import { env } from "./automd-generator.cjs";
2
2
  import { loadEnv, loadEnvFromContext } from "./load.cjs";
3
- import { extractEnv, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, resolveRuntimeTypeFile, writeEnv } from "./schema.cjs";
3
+ import { extractEnv, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, resolveRuntimeSchemaFile, writeEnv } from "./schema.cjs";
4
4
  import { formatEnvField, removeEnvPrefix } from "./source-file-env.cjs";
5
- export { env, extractEnv, formatEnvField, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, loadEnv, loadEnvFromContext, removeEnvPrefix, resolveRuntimeTypeFile, writeEnv };
5
+ export { env, extractEnv, formatEnvField, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, loadEnv, loadEnvFromContext, removeEnvPrefix, resolveRuntimeSchemaFile, writeEnv };
@@ -1,5 +1,5 @@
1
1
  import { env } from "./automd-generator.mjs";
2
2
  import { loadEnv, loadEnvFromContext } from "./load.mjs";
3
- import { extractEnv, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, resolveRuntimeTypeFile, writeEnv } from "./schema.mjs";
3
+ import { extractEnv, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, resolveRuntimeSchemaFile, writeEnv } from "./schema.mjs";
4
4
  import { formatEnvField, removeEnvPrefix } from "./source-file-env.mjs";
5
- export { env, extractEnv, formatEnvField, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, loadEnv, loadEnvFromContext, removeEnvPrefix, resolveRuntimeTypeFile, writeEnv };
5
+ export { env, extractEnv, formatEnvField, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, loadEnv, loadEnvFromContext, removeEnvPrefix, resolveRuntimeSchemaFile, writeEnv };
@@ -1,6 +1,6 @@
1
1
  import { formatEnvField, removeEnvPrefix } from "./source-file-env.mjs";
2
2
  import { loadEnv, loadEnvFromContext } from "./load.mjs";
3
- import { extractEnv, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, resolveRuntimeTypeFile, writeEnv } from "./schema.mjs";
3
+ import { extractEnv, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, resolveRuntimeSchemaFile, writeEnv } from "./schema.mjs";
4
4
  import { env } from "./automd-generator.mjs";
5
5
 
6
- export { env, extractEnv, formatEnvField, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, loadEnv, loadEnvFromContext, removeEnvPrefix, resolveRuntimeTypeFile, writeEnv };
6
+ export { env, extractEnv, formatEnvField, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, loadEnv, loadEnvFromContext, removeEnvPrefix, resolveRuntimeSchemaFile, writeEnv };
@@ -1,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_types_plugin = require('../types/plugin.cjs');
4
3
  const require_helpers_source_file_env = require('./source-file-env.cjs');
5
4
  let _power_plant_schema = require("@power-plant/schema");
6
5
  let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
@@ -15,32 +14,16 @@ defu = require_runtime.__toESM(defu, 1);
15
14
  let powerlines_constants = require("powerlines/constants");
16
15
 
17
16
  //#region src/helpers/load.ts
18
- function __assignType(fn, args) {
19
- fn.__type = args;
20
- return fn;
21
- }
22
17
  async function loadEnvFiles(options, mode, cwd) {
23
18
  let env = await (0, _stryke_env_load_env.loadEnv)(cwd, mode);
24
19
  if (options.additionalFiles && options.additionalFiles?.length > 0) {
25
- const additionalEnvFiles = await Promise.all(options.additionalFiles.map(__assignType(async (additionalEnvFile) => (0, _stryke_env_load_env.loadEnvFile)(additionalEnvFile, cwd), [
26
- "additionalEnvFile",
27
- "",
28
- "P\"2!\"/\""
29
- ])));
20
+ const additionalEnvFiles = await Promise.all(options.additionalFiles.map(async (additionalEnvFile) => (0, _stryke_env_load_env.loadEnvFile)(additionalEnvFile, cwd)));
30
21
  for (const additionalEnvFile of additionalEnvFiles) env = (0, defu.default)(additionalEnvFile, env);
31
22
  }
32
23
  return require_helpers_source_file_env.removeEnvPrefix(env);
33
24
  }
34
- loadEnvFiles.__type = [
35
- () => require_types_plugin.__ΩEnvPluginOptions,
36
- "options",
37
- "mode",
38
- "cwd",
39
- "loadEnvFiles",
40
- "Pn!2\"&2#&2$\"`/%"
41
- ];
42
25
  async function loadEnvDirectory(context, options, directory, mode, cacheDir, workspaceConfig) {
43
- const [envResult, c12Result] = await Promise.all([(loadEnvFiles.Ω = [["!"]], loadEnvFiles(options, mode, directory)), (0, c12.loadConfig)({
26
+ const [envResult, c12Result] = await Promise.all([loadEnvFiles(options, mode, directory), (0, c12.loadConfig)({
44
27
  cwd: directory,
45
28
  name: context.config.framework?.name || "powerlines",
46
29
  envName: mode,
@@ -54,18 +37,6 @@ async function loadEnvDirectory(context, options, directory, mode, cacheDir, wor
54
37
  })]);
55
38
  return (0, defu.default)(envResult, c12Result.config, workspaceConfig);
56
39
  }
57
- loadEnvDirectory.__type = [
58
- () => require_types_plugin.__ΩEnvPluginContext,
59
- "context",
60
- () => require_types_plugin.__ΩEnvPluginOptions,
61
- "options",
62
- "directory",
63
- "mode",
64
- "cacheDir",
65
- "workspaceConfig",
66
- "loadEnvDirectory",
67
- "Pn!2\"n#2$&2%&2&&2'!2(8\"`/)"
68
- ];
69
40
  /**
70
41
  * Retrieves various dotenv configuration parameters from the context.
71
42
  *
@@ -94,15 +65,10 @@ function loadEnvFromContext(context, parsed, workspaceConfig) {
94
65
  STACKTRACE: context.config.mode !== "production",
95
66
  RUNTIME: context.config.environment.runtime,
96
67
  ENVIRONMENT: !context.config.environment.name || context.config.environment.name === powerlines_constants.DEFAULT_ENVIRONMENT ? context.config.mode : context.config.environment.name
97
- }, (0, _stryke_type_checks_is_set_object.isSetObject)(context.env.config) ? Object.entries((0, _power_plant_schema.getProperties)(context.env.config)).reduce(__assignType((ret, [name, prop]) => {
68
+ }, (0, _stryke_type_checks_is_set_object.isSetObject)(context.env.config) ? Object.entries((0, _power_plant_schema.getProperties)(context.env.config)).reduce((ret, [name, prop]) => {
98
69
  ret[name] = parsed[name] ?? prop?.default;
99
70
  return ret;
100
- }, [
101
- "ret",
102
- "param1",
103
- "",
104
- "P\"2!\"2\"\"/#"
105
- ]), {}) : {});
71
+ }, {}) : {});
106
72
  if (![
107
73
  "error",
108
74
  "warn",
@@ -113,33 +79,15 @@ function loadEnvFromContext(context, parsed, workspaceConfig) {
113
79
  else result.LOG_LEVEL = context.config.mode === "production" ? "info" : "debug";
114
80
  return result;
115
81
  }
116
- loadEnvFromContext.__type = [
117
- () => require_types_plugin.__ΩEnvPluginContext,
118
- "context",
119
- "parsed",
120
- "workspaceConfig",
121
- "loadEnvFromContext",
122
- "Retrieves various dotenv configuration parameters from the context.",
123
- "Pn!2\"!2#!2$8\"/%?&"
124
- ];
125
82
  async function loadEnv(context, options = context.config.env) {
126
83
  const workspaceConfig = await (0, _storm_software_config_tools_get_config.tryGetWorkspaceConfig)();
127
84
  const [project, workspace, config] = await Promise.all([
128
- (loadEnvDirectory.Ω = [["!"]], loadEnvDirectory(context, options, context.config.root, context.config.mode, context.cachePath, workspaceConfig)),
129
- (loadEnvDirectory.Ω = [["!"]], loadEnvDirectory(context, options, context.config.cwd, context.config.mode, context.cachePath, workspaceConfig)),
130
- (loadEnvDirectory.Ω = [["!"]], loadEnvDirectory(context, options, context.envPaths.config, context.config.mode, context.cachePath, workspaceConfig))
85
+ loadEnvDirectory(context, options, context.config.root, context.config.mode, context.cachePath, workspaceConfig),
86
+ loadEnvDirectory(context, options, context.config.cwd, context.config.mode, context.cachePath, workspaceConfig),
87
+ loadEnvDirectory(context, options, context.envPaths.config, context.config.mode, context.cachePath, workspaceConfig)
131
88
  ]);
132
89
  return (0, defu.default)(loadEnvFromContext(context, process.env, workspaceConfig), project, workspace, config);
133
90
  }
134
- loadEnv.__type = [
135
- () => require_types_plugin.__ΩEnvPluginContext,
136
- "context",
137
- () => require_types_plugin.__ΩEnvPluginOptions,
138
- "options",
139
- () => context.config.env,
140
- "loadEnv",
141
- "Pn!2\"n#2$>%\"`/&"
142
- ];
143
91
 
144
92
  //#endregion
145
93
  exports.loadEnv = loadEnv;