@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
@@ -22,12 +22,12 @@ declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvPar
22
22
  LOG_LEVEL: "error" | "warn" | "info" | "debug" | "silent";
23
23
  ERROR_URL: string | undefined;
24
24
  ORGANIZATION: string | undefined;
25
- PLATFORM: "node" | "browser" | "neutral";
25
+ PLATFORM: "browser" | "node" | "neutral";
26
26
  MODE: "development" | "test" | "production";
27
27
  TEST: boolean;
28
28
  DEBUG: boolean;
29
29
  STACKTRACE: boolean;
30
- RUNTIME: "browser" | "nodejs" | "workerd" | "edge" | undefined;
30
+ RUNTIME: "nodejs" | "workerd" | "browser" | "edge" | undefined;
31
31
  ENVIRONMENT: string;
32
32
  };
33
33
  declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options?: EnvPluginOptions): Promise<TEnv>;
@@ -22,12 +22,12 @@ declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvPar
22
22
  LOG_LEVEL: "error" | "warn" | "info" | "debug" | "silent";
23
23
  ERROR_URL: string | undefined;
24
24
  ORGANIZATION: string | undefined;
25
- PLATFORM: "node" | "browser" | "neutral";
25
+ PLATFORM: "browser" | "node" | "neutral";
26
26
  MODE: "development" | "test" | "production";
27
27
  TEST: boolean;
28
28
  DEBUG: boolean;
29
29
  STACKTRACE: boolean;
30
- RUNTIME: "browser" | "nodejs" | "workerd" | "edge" | undefined;
30
+ RUNTIME: "nodejs" | "workerd" | "browser" | "edge" | undefined;
31
31
  ENVIRONMENT: string;
32
32
  };
33
33
  declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options?: EnvPluginOptions): Promise<TEnv>;
@@ -1,4 +1,3 @@
1
- import { __ΩEnvPluginContext, __ΩEnvPluginOptions } from "../types/plugin.mjs";
2
1
  import { removeEnvPrefix } from "./source-file-env.mjs";
3
2
  import { getProperties } from "@power-plant/schema";
4
3
  import { isSetObject } from "@stryke/type-checks/is-set-object";
@@ -12,32 +11,16 @@ import defu from "defu";
12
11
  import { DEFAULT_ENVIRONMENT } from "powerlines/constants";
13
12
 
14
13
  //#region src/helpers/load.ts
15
- function __assignType(fn, args) {
16
- fn.__type = args;
17
- return fn;
18
- }
19
14
  async function loadEnvFiles(options, mode, cwd) {
20
15
  let env = await loadEnv$1(cwd, mode);
21
16
  if (options.additionalFiles && options.additionalFiles?.length > 0) {
22
- const additionalEnvFiles = await Promise.all(options.additionalFiles.map(__assignType(async (additionalEnvFile) => loadEnvFile(additionalEnvFile, cwd), [
23
- "additionalEnvFile",
24
- "",
25
- "P\"2!\"/\""
26
- ])));
17
+ const additionalEnvFiles = await Promise.all(options.additionalFiles.map(async (additionalEnvFile) => loadEnvFile(additionalEnvFile, cwd)));
27
18
  for (const additionalEnvFile of additionalEnvFiles) env = defu(additionalEnvFile, env);
28
19
  }
29
20
  return removeEnvPrefix(env);
30
21
  }
31
- loadEnvFiles.__type = [
32
- () => __ΩEnvPluginOptions,
33
- "options",
34
- "mode",
35
- "cwd",
36
- "loadEnvFiles",
37
- "Pn!2\"&2#&2$\"`/%"
38
- ];
39
22
  async function loadEnvDirectory(context, options, directory, mode, cacheDir, workspaceConfig) {
40
- const [envResult, c12Result] = await Promise.all([(loadEnvFiles.Ω = [["!"]], loadEnvFiles(options, mode, directory)), loadConfig({
23
+ const [envResult, c12Result] = await Promise.all([loadEnvFiles(options, mode, directory), loadConfig({
41
24
  cwd: directory,
42
25
  name: context.config.framework?.name || "powerlines",
43
26
  envName: mode,
@@ -51,18 +34,6 @@ async function loadEnvDirectory(context, options, directory, mode, cacheDir, wor
51
34
  })]);
52
35
  return defu(envResult, c12Result.config, workspaceConfig);
53
36
  }
54
- loadEnvDirectory.__type = [
55
- () => __ΩEnvPluginContext,
56
- "context",
57
- () => __ΩEnvPluginOptions,
58
- "options",
59
- "directory",
60
- "mode",
61
- "cacheDir",
62
- "workspaceConfig",
63
- "loadEnvDirectory",
64
- "Pn!2\"n#2$&2%&2&&2'!2(8\"`/)"
65
- ];
66
37
  /**
67
38
  * Retrieves various dotenv configuration parameters from the context.
68
39
  *
@@ -91,15 +62,10 @@ function loadEnvFromContext(context, parsed, workspaceConfig) {
91
62
  STACKTRACE: context.config.mode !== "production",
92
63
  RUNTIME: context.config.environment.runtime,
93
64
  ENVIRONMENT: !context.config.environment.name || context.config.environment.name === DEFAULT_ENVIRONMENT ? context.config.mode : context.config.environment.name
94
- }, isSetObject(context.env.config) ? Object.entries(getProperties(context.env.config)).reduce(__assignType((ret, [name, prop]) => {
65
+ }, isSetObject(context.env.config) ? Object.entries(getProperties(context.env.config)).reduce((ret, [name, prop]) => {
95
66
  ret[name] = parsed[name] ?? prop?.default;
96
67
  return ret;
97
- }, [
98
- "ret",
99
- "param1",
100
- "",
101
- "P\"2!\"2\"\"/#"
102
- ]), {}) : {});
68
+ }, {}) : {});
103
69
  if (![
104
70
  "error",
105
71
  "warn",
@@ -110,33 +76,15 @@ function loadEnvFromContext(context, parsed, workspaceConfig) {
110
76
  else result.LOG_LEVEL = context.config.mode === "production" ? "info" : "debug";
111
77
  return result;
112
78
  }
113
- loadEnvFromContext.__type = [
114
- () => __ΩEnvPluginContext,
115
- "context",
116
- "parsed",
117
- "workspaceConfig",
118
- "loadEnvFromContext",
119
- "Retrieves various dotenv configuration parameters from the context.",
120
- "Pn!2\"!2#!2$8\"/%?&"
121
- ];
122
79
  async function loadEnv(context, options = context.config.env) {
123
80
  const workspaceConfig = await tryGetWorkspaceConfig();
124
81
  const [project, workspace, config] = await Promise.all([
125
- (loadEnvDirectory.Ω = [["!"]], loadEnvDirectory(context, options, context.config.root, context.config.mode, context.cachePath, workspaceConfig)),
126
- (loadEnvDirectory.Ω = [["!"]], loadEnvDirectory(context, options, context.config.cwd, context.config.mode, context.cachePath, workspaceConfig)),
127
- (loadEnvDirectory.Ω = [["!"]], loadEnvDirectory(context, options, context.envPaths.config, context.config.mode, context.cachePath, workspaceConfig))
82
+ loadEnvDirectory(context, options, context.config.root, context.config.mode, context.cachePath, workspaceConfig),
83
+ loadEnvDirectory(context, options, context.config.cwd, context.config.mode, context.cachePath, workspaceConfig),
84
+ loadEnvDirectory(context, options, context.envPaths.config, context.config.mode, context.cachePath, workspaceConfig)
128
85
  ]);
129
86
  return defu(loadEnvFromContext(context, process.env, workspaceConfig), project, workspace, config);
130
87
  }
131
- loadEnv.__type = [
132
- () => __ΩEnvPluginContext,
133
- "context",
134
- () => __ΩEnvPluginOptions,
135
- "options",
136
- () => context.config.env,
137
- "loadEnv",
138
- "Pn!2\"n#2$>%\"`/&"
139
- ];
140
88
 
141
89
  //#endregion
142
90
  export { loadEnv, loadEnvFromContext };
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_types_plugin = require('../types/plugin.cjs');
3
2
  const require_helpers_load = require('./load.cjs');
4
3
  let _power_plant_schema = require("@power-plant/schema");
5
4
  let _powerlines_plugin_power_plant_helpers = require("@powerlines/plugin-power-plant/helpers");
@@ -9,61 +8,41 @@ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-obje
9
8
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
10
9
 
11
10
  //#region src/helpers/schema.ts
12
- function __assignType(fn, args) {
13
- fn.__type = args;
14
- return fn;
15
- }
16
11
  /**
17
- * Resolves the runtime type definition file for the environment variables.
12
+ * Resolves the runtime Zod schema file for the environment variables.
18
13
  *
19
14
  * @param context - The plugin context.
20
- * @returns The runtime type definition file for the environment variables.
15
+ * @returns The runtime schema file for the environment variables.
21
16
  */
22
- async function resolveRuntimeTypeFile(context) {
23
- const resolved = await context.fs.resolve("@powerlines/plugin-env/types/env");
24
- if (!resolved) throw new Error(`Failed to resolve the runtime type definition file for the environment variables. Please ensure that the "@powerlines/plugin-env" package is installed.`);
17
+ async function resolveRuntimeSchemaFile(context) {
18
+ const resolved = await context.fs.resolve("@powerlines/plugin-env/schemas/env");
19
+ if (!resolved) throw new Error(`Failed to resolve the runtime schema file for the environment variables. Please ensure that the "@powerlines/plugin-env" package is installed.`);
25
20
  return resolved;
26
21
  }
27
- resolveRuntimeTypeFile.__type = [
28
- "context",
29
- "resolveRuntimeTypeFile",
30
- "Resolves the runtime type definition file for the environment variables.",
31
- "P\"2!&`/\"?#"
32
- ];
33
22
  /**
34
- * Gets the default type definition for the environment variables.
23
+ * Gets the default Zod schema reference for the environment variables.
35
24
  *
36
25
  * @param context - The plugin context.
37
- * @returns The default type definition for the environment variables.
26
+ * @returns The default schema reference for the environment variables.
38
27
  */
39
28
  async function getDefaultConfig(context) {
40
29
  return {
41
- file: await resolveRuntimeTypeFile(context),
42
- export: "EnvInterface"
30
+ file: await resolveRuntimeSchemaFile(context),
31
+ export: "envSchema"
43
32
  };
44
33
  }
45
- getDefaultConfig.__type = [
46
- "context",
47
- "getDefaultConfig",
48
- "Gets the default type definition for the environment variables.",
49
- "P\"2!!`/\"?#"
50
- ];
51
- /** Gets the default type definition for the environment secrets.
34
+ /**
35
+ * Gets the default Zod schema reference for the environment secrets.
52
36
  *
53
37
  * @param context - The plugin context.
54
- * @returns The default type definition for the environment secrets.
38
+ * @returns The default schema reference for the environment secrets.
55
39
  */
56
40
  async function getDefaultSecrets(context) {
57
41
  return {
58
- file: await resolveRuntimeTypeFile(context),
59
- export: "SecretsInterface"
42
+ file: await resolveRuntimeSchemaFile(context),
43
+ export: "secretsSchema"
60
44
  };
61
45
  }
62
- getDefaultSecrets.__type = [
63
- "context",
64
- "getDefaultSecrets",
65
- "P\"2!!`/\""
66
- ];
67
46
  /**
68
47
  * A helper function to get the cache directory path for storing schemas. This function takes a context object as input and returns the path to the cache directory where schemas are stored. The cache directory is constructed by joining the `cachePath` property from the context with a subdirectory named "schemas". This function is useful for centralizing the logic for determining where schema files should be cached, ensuring that all schema-related file operations use a consistent location for storing and retrieving cached schemas.
69
48
  *
@@ -73,51 +52,19 @@ getDefaultSecrets.__type = [
73
52
  function getCacheDirectory(context) {
74
53
  return (0, _stryke_path_join.joinPaths)(context.cachePath, "env");
75
54
  }
76
- getCacheDirectory.__type = [
77
- "context",
78
- "getCacheDirectory",
79
- "A helper function to get the cache directory path for storing schemas. This function takes a context object as input and returns the path to the cache directory where schemas are stored. The cache directory is constructed by joining the `cachePath` property from the context with a subdirectory named \"schemas\". This function is useful for centralizing the logic for determining where schema files should be cached, ensuring that all schema-related file operations use a consistent location for storing and retrieving cached schemas.",
80
- "P\"2!&/\"?#"
81
- ];
82
55
  function getCacheFilePath(context, variant) {
83
56
  return (0, _stryke_path_join.joinPaths)(getCacheDirectory(context), `${variant}.json`);
84
57
  }
85
- getCacheFilePath.__type = [
86
- "context",
87
- "config",
88
- "secrets",
89
- "variant",
90
- "getCacheFilePath",
91
- "P\"2!P.\".#J2$&/%"
92
- ];
93
58
  async function writeActive(context, variant, schema) {
94
59
  if (!(0, _power_plant_schema.isSchema)(schema)) throw new Error(`The provided input is not a valid env schema. A valid schema must have a "variant" property indicating the type of the input and a "schema" property containing the parsed JSON Schema object.`);
95
60
  await context.fs.write(getCacheFilePath(context, variant), JSON.stringify(schema.schema));
96
61
  }
97
- writeActive.__type = [
98
- "context",
99
- "config",
100
- "secrets",
101
- "variant",
102
- () => require_types_plugin.__ΩEnvSchema,
103
- "schema",
104
- "writeActive",
105
- "P\"2!P.\".#J2$n%2&\"/'"
106
- ];
107
62
  async function readActive(context, variant) {
108
63
  if (!context.fs.existsSync(getCacheFilePath(context, variant))) return [];
109
64
  const data = await context.fs.read(getCacheFilePath(context, variant));
110
65
  if (!data) return [];
111
66
  return JSON.parse(data);
112
67
  }
113
- readActive.__type = [
114
- "context",
115
- "config",
116
- "secrets",
117
- "variant",
118
- "readActive",
119
- "P\"2!P.\".#J2$&F`/%"
120
- ];
121
68
  /**
122
69
  * Extracts the environment variables and secrets schema from the provided type definitions in the plugin options, merges them with the default environment variables and secrets schema, and stores the resulting schema in the plugin context for later use during the build process.
123
70
  *
@@ -144,7 +91,7 @@ async function extractEnv(context) {
144
91
  context.env.secrets.active = await readActive(context, "secrets");
145
92
  if ((0, _stryke_type_checks_is_set_string.isSetString)(context.config.env.secrets) && new RegExp(`${defaultSecrets.file}[:#;@]?${defaultSecrets.export}`).test(context.config.env.secrets) === false || (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.env.secrets) && (context.config.env.secrets.file !== defaultSecrets.file || context.config.env.secrets.export !== defaultSecrets.export)) context.env.secrets.schema = (0, _power_plant_schema.merge)(await (0, _powerlines_plugin_power_plant_helpers.extract)(context, defaultSecrets), context.env.secrets);
146
93
  const properties = (0, _power_plant_schema.getProperties)(context.env.config);
147
- const describeVariant = __assignType((variant) => {
94
+ const describeVariant = (variant) => {
148
95
  switch (variant) {
149
96
  case "json-schema": return "JSON Schema";
150
97
  case "standard-schema": return "Standard Schema";
@@ -152,47 +99,25 @@ async function extractEnv(context) {
152
99
  case "valibot": return "Valibot schema";
153
100
  case "untyped": return "Untyped configuration";
154
101
  case "file-reference": return "Typescript exported type";
102
+ case "reflection": return "TypeScript reflection";
155
103
  default: return variant;
156
104
  }
157
- }, [
158
- () => require_types_plugin.__ΩEnvSchema,
159
- "variant",
160
- "variant",
161
- "",
162
- "Pn!.\"f2#\"/$"
163
- ]);
105
+ };
164
106
  context.info({
165
107
  meta: { category: "env" },
166
108
  message: `Environment Variables configuration: ${context.config.env.config ? "" : "Defaulted "}${describeVariant(context.env.config.variant)}${context.config.env.config ? " from plugin options" : ""} provided ${Object.keys(properties).length} parameters\nEnvironment Secret configuration: ${context.config.env.secrets ? "" : "Defaulted "}${describeVariant(context.env.secrets.variant)}${context.config.env.secrets ? " from plugin options" : ""} provided ${context.env.secrets?.schema ? (0, _power_plant_schema.getPropertiesList)(context.env.secrets).length : "0"} parameters\nEnvironment variable Prefixes: ${context.config.env.prefix.join(", ")}\nShould inject values: ${context.config.env.inject ? "Yes" : "No"}\nShould validate configuration: ${context.config.env.validate ? "Yes" : "No"}`
167
109
  });
168
- const aliases = Object.fromEntries(Object.entries(properties).flatMap(__assignType(([key, prop]) => (0, _stryke_type_checks_is_set_array.isSetArray)(prop.alias) ? prop.alias?.map(__assignType((alias) => [alias, {
110
+ const aliases = Object.fromEntries(Object.entries(properties).flatMap(([key, prop]) => (0, _stryke_type_checks_is_set_array.isSetArray)(prop.alias) ? prop.alias?.map((alias) => [alias, {
169
111
  ...prop,
170
112
  name: alias,
171
- alias: [...prop.alias?.filter(__assignType((a) => a !== alias, [
172
- "a",
173
- "",
174
- "P\"2!\"/\""
175
- ])) ?? [], key]
176
- }], [
177
- "alias",
178
- "",
179
- "P\"2!\"/\""
180
- ])) : [], [
181
- "param0",
182
- "",
183
- "P\"2!\"/\""
184
- ])));
113
+ alias: [...prop.alias?.filter((a) => a !== alias) ?? [], key]
114
+ }]) : []));
185
115
  context.env.parsed = await require_helpers_load.loadEnv(context);
186
116
  for (const [key, value] of Object.entries(context.env.parsed)) {
187
- const unprefixedKey = context.config.env.prefix.reduce(__assignType((ret, prefix) => {
117
+ const unprefixedKey = context.config.env.prefix.reduce((ret, prefix) => {
188
118
  if (key.startsWith(prefix)) return key.slice(prefix.length + 1);
189
119
  return ret;
190
- }, [
191
- "ret",
192
- "prefix",
193
- "",
194
- "P\"2!\"2\"\"/#"
195
- ]), key);
120
+ }, key);
196
121
  if (properties[unprefixedKey]) {
197
122
  if (!properties[unprefixedKey]?.runtime) {
198
123
  const propertySchema = (0, _power_plant_schema.getProperties)(context.env.config.schema)?.[unprefixedKey];
@@ -207,65 +132,27 @@ async function extractEnv(context) {
207
132
  }
208
133
  }
209
134
  if (!(0, _power_plant_schema.isSchemaObject)(context.env.config)) throw new Error("Invalid environment variable schema extracted. Please ensure the `env.types` option points to a valid TypeScript type definition file that exports an interface representing the environment variable schema.");
210
- (0, _power_plant_schema.getPropertiesList)(context.env.config).forEach(__assignType((property) => {
135
+ (0, _power_plant_schema.getPropertiesList)(context.env.config).forEach((property) => {
211
136
  property.alias ??= [];
212
137
  const aliases = [...property.alias];
213
- context.config.env.prefix.forEach(__assignType((prefix) => {
138
+ context.config.env.prefix.forEach((prefix) => {
214
139
  if (!property.alias.includes(`${prefix}_${property.name}`)) property.alias.push(`${prefix}_${property.name}`);
215
- aliases.map(__assignType((alias) => `${prefix}_${alias}`, [
216
- "alias",
217
- "",
218
- "P\"2!\"/\""
219
- ])).forEach(__assignType((prefixedAlias) => {
140
+ aliases.map((alias) => `${prefix}_${alias}`).forEach((prefixedAlias) => {
220
141
  if (!property.alias.includes(prefixedAlias)) property.alias.push(prefixedAlias);
221
- }, [
222
- "prefixedAlias",
223
- "",
224
- "P\"2!\"/\""
225
- ]));
226
- }, [
227
- "prefix",
228
- "",
229
- "P\"2!\"/\""
230
- ]));
231
- }, [
232
- "property",
233
- "",
234
- "P\"2!\"/\""
235
- ]));
236
- (0, _power_plant_schema.getPropertiesList)(context.env.secrets).forEach(__assignType((property) => {
142
+ });
143
+ });
144
+ });
145
+ (0, _power_plant_schema.getPropertiesList)(context.env.secrets).forEach((property) => {
237
146
  property.alias ??= [];
238
147
  const aliases = [...property.alias];
239
- context.config.env.prefix.forEach(__assignType((prefix) => {
148
+ context.config.env.prefix.forEach((prefix) => {
240
149
  if (!property.alias.includes(`${prefix}_${property.name}`)) property.alias.push(`${prefix}_${property.name}`);
241
- aliases.map(__assignType((alias) => `${prefix}_${alias}`, [
242
- "alias",
243
- "",
244
- "P\"2!\"/\""
245
- ])).forEach(__assignType((prefixedAlias) => {
150
+ aliases.map((alias) => `${prefix}_${alias}`).forEach((prefixedAlias) => {
246
151
  if (!property.alias.includes(prefixedAlias)) property.alias.push(prefixedAlias);
247
- }, [
248
- "prefixedAlias",
249
- "",
250
- "P\"2!\"/\""
251
- ]));
252
- }, [
253
- "prefix",
254
- "",
255
- "P\"2!\"/\""
256
- ]));
257
- }, [
258
- "property",
259
- "",
260
- "P\"2!\"/\""
261
- ]));
152
+ });
153
+ });
154
+ });
262
155
  }
263
- extractEnv.__type = [
264
- "context",
265
- "extractEnv",
266
- "Extracts the environment variables and secrets schema from the provided type definitions in the plugin options, merges them with the default environment variables and secrets schema, and stores the resulting schema in the plugin context for later use during the build process.",
267
- "P\"2!$`/\"?#"
268
- ];
269
156
  /**
270
157
  * Writes the environment variables and secrets schema stored in the plugin context to the cache directory for later retrieval during the build process. This function should be called during the plugin's `build` hook after the schema has been extracted and stored in the plugin context to ensure that the active environment variables and secrets are persisted across builds and can be accessed during the build process for validation and injection purposes.
271
158
  *
@@ -275,12 +162,6 @@ extractEnv.__type = [
275
162
  async function writeEnv(context) {
276
163
  return Promise.all([writeActive(context, "config", context.env.config), writeActive(context, "secrets", context.env.secrets)]);
277
164
  }
278
- writeEnv.__type = [
279
- "context",
280
- "writeEnv",
281
- "Writes the environment variables and secrets schema stored in the plugin context to the cache directory for later retrieval during the build process. This function should be called during the plugin's `build` hook after the schema has been extracted and stored in the plugin context to ensure that the active environment variables and secrets are persisted across builds and can be accessed during the build process for validation and injection purposes.",
282
- "P\"2!$F`/\"?#"
283
- ];
284
165
 
285
166
  //#endregion
286
167
  exports.extractEnv = extractEnv;
@@ -288,5 +169,5 @@ exports.getCacheDirectory = getCacheDirectory;
288
169
  exports.getCacheFilePath = getCacheFilePath;
289
170
  exports.getDefaultConfig = getDefaultConfig;
290
171
  exports.getDefaultSecrets = getDefaultSecrets;
291
- exports.resolveRuntimeTypeFile = resolveRuntimeTypeFile;
172
+ exports.resolveRuntimeSchemaFile = resolveRuntimeSchemaFile;
292
173
  exports.writeEnv = writeEnv;
@@ -3,23 +3,24 @@ import { UnresolvedContext } from "powerlines";
3
3
  import { FileReference } from "@stryke/types/configuration";
4
4
  //#region src/helpers/schema.d.ts
5
5
  /**
6
- * Resolves the runtime type definition file for the environment variables.
6
+ * Resolves the runtime Zod schema file for the environment variables.
7
7
  *
8
8
  * @param context - The plugin context.
9
- * @returns The runtime type definition file for the environment variables.
9
+ * @returns The runtime schema file for the environment variables.
10
10
  */
11
- declare function resolveRuntimeTypeFile<TContext extends UnresolvedContext>(context: TContext): Promise<string>;
11
+ declare function resolveRuntimeSchemaFile<TContext extends UnresolvedContext>(context: TContext): Promise<string>;
12
12
  /**
13
- * Gets the default type definition for the environment variables.
13
+ * Gets the default Zod schema reference for the environment variables.
14
14
  *
15
15
  * @param context - The plugin context.
16
- * @returns The default type definition for the environment variables.
16
+ * @returns The default schema reference for the environment variables.
17
17
  */
18
18
  declare function getDefaultConfig<TContext extends UnresolvedContext>(context: TContext): Promise<FileReference>;
19
- /** Gets the default type definition for the environment secrets.
19
+ /**
20
+ * Gets the default Zod schema reference for the environment secrets.
20
21
  *
21
22
  * @param context - The plugin context.
22
- * @returns The default type definition for the environment secrets.
23
+ * @returns The default schema reference for the environment secrets.
23
24
  */
24
25
  declare function getDefaultSecrets<TContext extends UnresolvedContext>(context: TContext): Promise<FileReference>;
25
26
  /**
@@ -48,5 +49,5 @@ declare function extractEnv<TContext extends EnvPluginContext>(context: TContext
48
49
  */
49
50
  declare function writeEnv<TContext extends EnvPluginContext>(context: TContext): Promise<void[]>;
50
51
  //#endregion
51
- export { extractEnv, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, resolveRuntimeTypeFile, writeEnv };
52
+ export { extractEnv, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, resolveRuntimeSchemaFile, writeEnv };
52
53
  //# sourceMappingURL=schema.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.cts","names":[],"sources":["../../src/helpers/schema.ts"],"mappings":";;;;;;;;;;iBA0CsB,uBACpB,iBAAiB,mBACjB,SAAS,WAAW;;;;;;;iBAiBA,iBAAiB,iBAAiB,mBACtD,SAAS,WACR,QAAQ;;;;;;iBAYW,kBAAkB,iBAAiB,mBACvD,SAAS,WACR,QAAQ;;;;;;;iBAaK,kBAAkB,iBAAiB,kBACjD,SAAS;iBAKK,iBAAiB,iBAAiB,kBAChD,SAAS,UACT;;;;;;;;;;iBA+CoB,WAAW,iBAAiB,kBAChD,SAAS,WACR;;;;;;;iBAmNmB,SAAS,iBAAiB,kBAC9C,SAAS,WACR"}
1
+ {"version":3,"file":"schema.d.cts","names":[],"sources":["../../src/helpers/schema.ts"],"mappings":";;;;;;;;;;iBA0CsB,yBACpB,iBAAiB,mBACjB,SAAS,WAAW;;;;;;;iBAmBA,iBAAiB,iBAAiB,mBACtD,SAAS,WACR,QAAQ;;;;;;;iBAaW,kBAAkB,iBAAiB,mBACvD,SAAS,WACR,QAAQ;;;;;;;iBAaK,kBAAkB,iBAAiB,kBACjD,SAAS;iBAKK,iBAAiB,iBAAiB,kBAChD,SAAS,UACT;;;;;;;;;;iBA+CoB,WAAW,iBAAiB,kBAChD,SAAS,WACR;;;;;;;iBAqNmB,SAAS,iBAAiB,kBAC9C,SAAS,WACR"}
@@ -3,23 +3,24 @@ import { UnresolvedContext } from "powerlines";
3
3
  import { FileReference } from "@stryke/types/configuration";
4
4
  //#region src/helpers/schema.d.ts
5
5
  /**
6
- * Resolves the runtime type definition file for the environment variables.
6
+ * Resolves the runtime Zod schema file for the environment variables.
7
7
  *
8
8
  * @param context - The plugin context.
9
- * @returns The runtime type definition file for the environment variables.
9
+ * @returns The runtime schema file for the environment variables.
10
10
  */
11
- declare function resolveRuntimeTypeFile<TContext extends UnresolvedContext>(context: TContext): Promise<string>;
11
+ declare function resolveRuntimeSchemaFile<TContext extends UnresolvedContext>(context: TContext): Promise<string>;
12
12
  /**
13
- * Gets the default type definition for the environment variables.
13
+ * Gets the default Zod schema reference for the environment variables.
14
14
  *
15
15
  * @param context - The plugin context.
16
- * @returns The default type definition for the environment variables.
16
+ * @returns The default schema reference for the environment variables.
17
17
  */
18
18
  declare function getDefaultConfig<TContext extends UnresolvedContext>(context: TContext): Promise<FileReference>;
19
- /** Gets the default type definition for the environment secrets.
19
+ /**
20
+ * Gets the default Zod schema reference for the environment secrets.
20
21
  *
21
22
  * @param context - The plugin context.
22
- * @returns The default type definition for the environment secrets.
23
+ * @returns The default schema reference for the environment secrets.
23
24
  */
24
25
  declare function getDefaultSecrets<TContext extends UnresolvedContext>(context: TContext): Promise<FileReference>;
25
26
  /**
@@ -48,5 +49,5 @@ declare function extractEnv<TContext extends EnvPluginContext>(context: TContext
48
49
  */
49
50
  declare function writeEnv<TContext extends EnvPluginContext>(context: TContext): Promise<void[]>;
50
51
  //#endregion
51
- export { extractEnv, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, resolveRuntimeTypeFile, writeEnv };
52
+ export { extractEnv, getCacheDirectory, getCacheFilePath, getDefaultConfig, getDefaultSecrets, resolveRuntimeSchemaFile, writeEnv };
52
53
  //# sourceMappingURL=schema.d.mts.map