@powerlines/plugin-env 0.16.325 → 0.16.326
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/helpers/schema.cjs
CHANGED
|
@@ -168,7 +168,7 @@ async function extractEnv(context) {
|
|
|
168
168
|
context.env.parsed = await require_helpers_load.loadEnv(context);
|
|
169
169
|
for (const [key, value] of Object.entries(context.env.parsed)) {
|
|
170
170
|
const unprefixedKey = context.config.env.prefix.reduce(__assignType((ret, prefix) => {
|
|
171
|
-
if (key.
|
|
171
|
+
if (key.startsWith(prefix)) return key.slice(prefix.length + 1);
|
|
172
172
|
return ret;
|
|
173
173
|
}, [
|
|
174
174
|
"ret",
|
package/dist/helpers/schema.mjs
CHANGED
|
@@ -167,7 +167,7 @@ async function extractEnv(context) {
|
|
|
167
167
|
context.env.parsed = await loadEnv(context);
|
|
168
168
|
for (const [key, value] of Object.entries(context.env.parsed)) {
|
|
169
169
|
const unprefixedKey = context.config.env.prefix.reduce(__assignType((ret, prefix) => {
|
|
170
|
-
if (key.
|
|
170
|
+
if (key.startsWith(prefix)) return key.slice(prefix.length + 1);
|
|
171
171
|
return ret;
|
|
172
172
|
}, [
|
|
173
173
|
"ret",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.mjs","names":[],"sources":["../../src/helpers/schema.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n extract,\n getProperties,\n getPropertiesList,\n isSchema,\n isSchemaObject,\n JsonSchemaObject,\n merge,\n Schema,\n writeSchema\n} from \"@powerlines/schema\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSetArray } from \"@stryke/type-checks/is-set-array\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type { FileReference } from \"@stryke/types/configuration\";\nimport { UnresolvedContext } from \"powerlines\";\nimport { EnvPluginContext, EnvSchema } from \"../types/plugin\";\nimport { loadEnv } from \"./load\";\n\n/**\n * Resolves the runtime type definition file for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The runtime type definition file for the environment variables.\n */\nexport async function resolveRuntimeTypeFile<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<string> {\n const resolved = await context.fs.resolve(\"@powerlines/plugin-env/types/env\");\n if (!resolved) {\n throw new Error(\n `Failed to resolve the runtime type definition file for the environment variables. Please ensure that the \"@powerlines/plugin-env\" package is installed.`\n );\n }\n\n return resolved;\n}\n\n/**\n * Gets the default type definition for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment variables.\n */\nexport async function getDefaultConfig<TContext extends UnresolvedContext>(\n context: TContext\n): Promise<FileReference> {\n return {\n file: await resolveRuntimeTypeFile(context),\n export: \"EnvInterface\"\n };\n}\n\n/** Gets the default type definition for the environment secrets.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment secrets.\n */\nexport async function getDefaultSecrets<TContext extends UnresolvedContext>(\n context: TContext\n): Promise<FileReference> {\n return {\n file: await resolveRuntimeTypeFile(context),\n export: \"SecretsInterface\"\n };\n}\n\n/**\n * 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.\n *\n * @param context - The context object providing access to the cache path.\n * @returns The path to the cache directory for storing schemas, constructed by joining the context's `cachePath` with the \"schemas\" subdirectory.\n */\nexport function getCacheDirectory<TContext extends EnvPluginContext>(\n context: TContext\n): string {\n return joinPaths(context.cachePath, \"env\");\n}\n\nexport function getCacheFilePath<TContext extends EnvPluginContext>(\n context: TContext,\n variant: \"config\" | \"secrets\"\n): string {\n return joinPaths(getCacheDirectory(context), `${variant}.json`);\n}\n\nasync function writeActive<TContext extends EnvPluginContext>(\n context: TContext,\n variant: \"config\" | \"secrets\",\n schema: EnvSchema\n) {\n if (!isSchema(schema)) {\n throw new Error(\n `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.`\n );\n }\n\n await context.fs.write(\n getCacheFilePath(context, variant),\n JSON.stringify(schema.schema)\n );\n}\n\nasync function readActive<TContext extends EnvPluginContext>(\n context: TContext,\n variant: \"config\" | \"secrets\"\n): Promise<string[]> {\n if (!context.fs.existsSync(getCacheFilePath(context, variant))) {\n return [];\n }\n\n const data = await context.fs.read(getCacheFilePath(context, variant));\n if (!data) {\n return [];\n }\n\n return JSON.parse(data);\n}\n\n/**\n * 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.\n *\n * @remarks\n * This function should be called during the plugin's `config` hook to ensure that the environment variables and secrets schema is available in the plugin context before the build process begins. The resulting schema will be used to validate the loaded environment variables and secrets, as well as to provide type information for the injected environment variables and secrets during the build process.\n *\n * @param context - The plugin context\n * @returns A promise that resolves when the schema has been extracted and stored in the plugin context.\n */\nexport async function extractEnv<TContext extends EnvPluginContext>(\n context: TContext\n): Promise<void> {\n const defaultConfig = await getDefaultConfig(context);\n const defaultSecrets = await getDefaultSecrets(context);\n\n context.debug({\n meta: {\n category: \"env\"\n },\n message: `Environment Variables configuration: ${\n context.config.env.config\n ? JSON.stringify(context.config.env.config, null, 2)\n : \"None\"\n }\\nEnvironment Secret configuration: ${\n context.config.env.secrets\n ? JSON.stringify(context.config.env.secrets, null, 2)\n : \"None\"\n }`\n });\n\n context.env ??= {} as EnvPluginContext[\"env\"];\n context.env.parsed ??= {};\n context.env.injected ??= [];\n\n context.env.config = (await extract(\n context,\n context.config.env.config\n )) as EnvSchema;\n context.env.config.active = await readActive(context, \"config\");\n\n if (\n (isSetString(context.config.env.config) &&\n new RegExp(`${defaultConfig.file}[:#;@]?${defaultConfig.export}`).test(\n context.config.env.config\n ) === false) ||\n (isSetObject(context.config.env.config) &&\n ((context.config.env.config as FileReference).file !==\n defaultConfig.file ||\n (context.config.env.config as FileReference).export !==\n defaultConfig.export))\n ) {\n context.env.config.schema = merge(\n await extract(context, defaultConfig),\n context.env.config\n ) as JsonSchemaObject;\n }\n\n context.env.secrets = (await extract(\n context,\n context.config.env.secrets\n )) as EnvSchema;\n context.env.secrets.active = await readActive(context, \"secrets\");\n\n if (\n (isSetString(context.config.env.secrets) &&\n new RegExp(`${defaultSecrets.file}[:#;@]?${defaultSecrets.export}`).test(\n context.config.env.secrets\n ) === false) ||\n (isSetObject(context.config.env.secrets) &&\n ((context.config.env.secrets as FileReference).file !==\n defaultSecrets.file ||\n (context.config.env.secrets as FileReference).export !==\n defaultSecrets.export))\n ) {\n context.env.secrets.schema = merge(\n await extract(context, defaultSecrets),\n context.env.secrets\n ) as JsonSchemaObject;\n }\n\n const properties = getProperties(context.env.config);\n context.info({\n meta: {\n category: \"env\"\n },\n message: `Environment Variables configuration: ${\n context.config.env.config ? \"\" : \"Defaulted \"\n }${\n context.env.config.variant === \"reflection\"\n ? \"Deepkit type definition\"\n : context.env.config.variant === \"json-schema\"\n ? \"JSON Schema\"\n : context.env.config.variant === \"standard-schema\"\n ? \"Standard Schema\"\n : context.env.config.variant === \"zod3\"\n ? \"Zod v3 schema\"\n : context.env.config.variant === \"valibot\"\n ? \"Valibot schema\"\n : context.env.config.variant === \"untyped\"\n ? \"Untyped configuration\"\n : \"Typescript exported type\"\n }${context.config.env.config ? \" from plugin options\" : \"\"} provided ${\n Object.keys(properties).length\n } parameters\\nEnvironment Secret configuration: ${\n context.config.env.secrets ? \"\" : \"Defaulted \"\n }${\n context.env.secrets.variant === \"reflection\"\n ? \"Deepkit type definition\"\n : context.env.secrets.variant === \"json-schema\"\n ? \"JSON Schema\"\n : context.env.secrets.variant === \"standard-schema\"\n ? \"Standard Schema\"\n : context.env.secrets.variant === \"zod3\"\n ? \"Zod v3 schema\"\n : context.env.secrets.variant === \"valibot\"\n ? \"Valibot schema\"\n : context.env.secrets.variant === \"untyped\"\n ? \"Untyped configuration\"\n : \"Typescript exported type\"\n }${context.config.env.secrets ? \" from plugin options\" : \"\"} provided ${\n context.env.secrets?.schema\n ? getPropertiesList(context.env.secrets).length\n : \"0\"\n } parameters\\nEnvironment variable Prefixes: ${context.config.env.prefix.join(\n \", \"\n )}\\nShould inject values: ${\n context.config.env.inject ? \"Yes\" : \"No\"\n }\\nShould validate configuration: ${\n context.config.env.validate ? \"Yes\" : \"No\"\n }`\n });\n\n const aliases = Object.fromEntries(\n Object.entries(properties).flatMap(\n ([key, prop]) =>\n (isSetArray(prop.alias)\n ? prop.alias?.map(alias => [\n alias,\n {\n ...prop,\n name: alias,\n alias: [...(prop.alias?.filter(a => a !== alias) ?? []), key]\n }\n ])\n : []) as [string, typeof prop][]\n )\n );\n\n context.env.parsed = await loadEnv(context);\n for (const [key, value] of Object.entries(context.env.parsed)) {\n const unprefixedKey = context.config.env.prefix.reduce((ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n }, key);\n if (properties[unprefixedKey]) {\n if (!properties[unprefixedKey]?.runtime) {\n const propertySchema = getProperties(context.env.config.schema)?.[\n unprefixedKey\n ];\n if (propertySchema) {\n propertySchema.default = value;\n }\n }\n } else if (aliases[unprefixedKey]) {\n if (!aliases[unprefixedKey]?.runtime) {\n const alias = aliases[unprefixedKey]?.alias?.[0] ?? unprefixedKey;\n const aliasSchema = getProperties(context.env.config.schema)?.[alias];\n if (aliasSchema) {\n aliasSchema.default = value;\n }\n }\n }\n }\n\n if (!isSchemaObject(context.env.config)) {\n throw new Error(\n \"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.\"\n );\n }\n\n getPropertiesList(context.env.config).forEach(property => {\n property.alias ??= [];\n const aliases = [...property.alias];\n context.config.env.prefix.forEach(prefix => {\n if (!property.alias!.includes(`${prefix}_${property.name}`)) {\n property.alias!.push(`${prefix}_${property.name}`);\n }\n\n aliases\n .map(alias => `${prefix}_${alias}`)\n .forEach(prefixedAlias => {\n if (!property.alias!.includes(prefixedAlias)) {\n property.alias!.push(prefixedAlias);\n }\n });\n });\n });\n\n getPropertiesList(context.env.secrets).forEach(property => {\n property.alias ??= [];\n const aliases = [...property.alias];\n context.config.env.prefix.forEach(prefix => {\n if (!property.alias!.includes(`${prefix}_${property.name}`)) {\n property.alias!.push(`${prefix}_${property.name}`);\n }\n\n aliases\n .map(alias => `${prefix}_${alias}`)\n .forEach(prefixedAlias => {\n if (!property.alias!.includes(prefixedAlias)) {\n property.alias!.push(prefixedAlias);\n }\n });\n });\n });\n}\n\n/**\n * 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.\n *\n * @param context - The plugin context containing the environment variables and secrets schema to be written to the cache directory.\n * @returns A promise that resolves when the schema has been successfully written to the cache directory.\n */\nexport async function writeEnv<TContext extends EnvPluginContext>(\n context: TContext\n): Promise<void[]> {\n return Promise.all([\n writeSchema(context, omit(context.env.config, [\"active\"]) as Schema),\n writeSchema(context, omit(context.env.secrets, [\"active\"]) as Schema),\n writeActive(context, \"config\", context.env.config),\n writeActive(context, \"secrets\", context.env.secrets)\n ]);\n}\n"],"mappings":";;;;;;;;;;AAEA,SAAS,aAAY,IAAK,MAAC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AS,SAAC;CAAA;CAAe;CAAO;CAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"schema.mjs","names":[],"sources":["../../src/helpers/schema.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n extract,\n getProperties,\n getPropertiesList,\n isSchema,\n isSchemaObject,\n JsonSchemaObject,\n merge,\n Schema,\n writeSchema\n} from \"@powerlines/schema\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSetArray } from \"@stryke/type-checks/is-set-array\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type { FileReference } from \"@stryke/types/configuration\";\nimport { UnresolvedContext } from \"powerlines\";\nimport { EnvPluginContext, EnvSchema } from \"../types/plugin\";\nimport { loadEnv } from \"./load\";\n\n/**\n * Resolves the runtime type definition file for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The runtime type definition file for the environment variables.\n */\nexport async function resolveRuntimeTypeFile<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<string> {\n const resolved = await context.fs.resolve(\"@powerlines/plugin-env/types/env\");\n if (!resolved) {\n throw new Error(\n `Failed to resolve the runtime type definition file for the environment variables. Please ensure that the \"@powerlines/plugin-env\" package is installed.`\n );\n }\n\n return resolved;\n}\n\n/**\n * Gets the default type definition for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment variables.\n */\nexport async function getDefaultConfig<TContext extends UnresolvedContext>(\n context: TContext\n): Promise<FileReference> {\n return {\n file: await resolveRuntimeTypeFile(context),\n export: \"EnvInterface\"\n };\n}\n\n/** Gets the default type definition for the environment secrets.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment secrets.\n */\nexport async function getDefaultSecrets<TContext extends UnresolvedContext>(\n context: TContext\n): Promise<FileReference> {\n return {\n file: await resolveRuntimeTypeFile(context),\n export: \"SecretsInterface\"\n };\n}\n\n/**\n * 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.\n *\n * @param context - The context object providing access to the cache path.\n * @returns The path to the cache directory for storing schemas, constructed by joining the context's `cachePath` with the \"schemas\" subdirectory.\n */\nexport function getCacheDirectory<TContext extends EnvPluginContext>(\n context: TContext\n): string {\n return joinPaths(context.cachePath, \"env\");\n}\n\nexport function getCacheFilePath<TContext extends EnvPluginContext>(\n context: TContext,\n variant: \"config\" | \"secrets\"\n): string {\n return joinPaths(getCacheDirectory(context), `${variant}.json`);\n}\n\nasync function writeActive<TContext extends EnvPluginContext>(\n context: TContext,\n variant: \"config\" | \"secrets\",\n schema: EnvSchema\n) {\n if (!isSchema(schema)) {\n throw new Error(\n `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.`\n );\n }\n\n await context.fs.write(\n getCacheFilePath(context, variant),\n JSON.stringify(schema.schema)\n );\n}\n\nasync function readActive<TContext extends EnvPluginContext>(\n context: TContext,\n variant: \"config\" | \"secrets\"\n): Promise<string[]> {\n if (!context.fs.existsSync(getCacheFilePath(context, variant))) {\n return [];\n }\n\n const data = await context.fs.read(getCacheFilePath(context, variant));\n if (!data) {\n return [];\n }\n\n return JSON.parse(data);\n}\n\n/**\n * 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.\n *\n * @remarks\n * This function should be called during the plugin's `config` hook to ensure that the environment variables and secrets schema is available in the plugin context before the build process begins. The resulting schema will be used to validate the loaded environment variables and secrets, as well as to provide type information for the injected environment variables and secrets during the build process.\n *\n * @param context - The plugin context\n * @returns A promise that resolves when the schema has been extracted and stored in the plugin context.\n */\nexport async function extractEnv<TContext extends EnvPluginContext>(\n context: TContext\n): Promise<void> {\n const defaultConfig = await getDefaultConfig(context);\n const defaultSecrets = await getDefaultSecrets(context);\n\n context.debug({\n meta: {\n category: \"env\"\n },\n message: `Environment Variables configuration: ${\n context.config.env.config\n ? JSON.stringify(context.config.env.config, null, 2)\n : \"None\"\n }\\nEnvironment Secret configuration: ${\n context.config.env.secrets\n ? JSON.stringify(context.config.env.secrets, null, 2)\n : \"None\"\n }`\n });\n\n context.env ??= {} as EnvPluginContext[\"env\"];\n context.env.parsed ??= {};\n context.env.injected ??= [];\n\n context.env.config = (await extract(\n context,\n context.config.env.config\n )) as EnvSchema;\n context.env.config.active = await readActive(context, \"config\");\n\n if (\n (isSetString(context.config.env.config) &&\n new RegExp(`${defaultConfig.file}[:#;@]?${defaultConfig.export}`).test(\n context.config.env.config\n ) === false) ||\n (isSetObject(context.config.env.config) &&\n ((context.config.env.config as FileReference).file !==\n defaultConfig.file ||\n (context.config.env.config as FileReference).export !==\n defaultConfig.export))\n ) {\n context.env.config.schema = merge(\n await extract(context, defaultConfig),\n context.env.config\n ) as JsonSchemaObject;\n }\n\n context.env.secrets = (await extract(\n context,\n context.config.env.secrets\n )) as EnvSchema;\n context.env.secrets.active = await readActive(context, \"secrets\");\n\n if (\n (isSetString(context.config.env.secrets) &&\n new RegExp(`${defaultSecrets.file}[:#;@]?${defaultSecrets.export}`).test(\n context.config.env.secrets\n ) === false) ||\n (isSetObject(context.config.env.secrets) &&\n ((context.config.env.secrets as FileReference).file !==\n defaultSecrets.file ||\n (context.config.env.secrets as FileReference).export !==\n defaultSecrets.export))\n ) {\n context.env.secrets.schema = merge(\n await extract(context, defaultSecrets),\n context.env.secrets\n ) as JsonSchemaObject;\n }\n\n const properties = getProperties(context.env.config);\n context.info({\n meta: {\n category: \"env\"\n },\n message: `Environment Variables configuration: ${\n context.config.env.config ? \"\" : \"Defaulted \"\n }${\n context.env.config.variant === \"reflection\"\n ? \"Deepkit type definition\"\n : context.env.config.variant === \"json-schema\"\n ? \"JSON Schema\"\n : context.env.config.variant === \"standard-schema\"\n ? \"Standard Schema\"\n : context.env.config.variant === \"zod3\"\n ? \"Zod v3 schema\"\n : context.env.config.variant === \"valibot\"\n ? \"Valibot schema\"\n : context.env.config.variant === \"untyped\"\n ? \"Untyped configuration\"\n : \"Typescript exported type\"\n }${context.config.env.config ? \" from plugin options\" : \"\"} provided ${\n Object.keys(properties).length\n } parameters\\nEnvironment Secret configuration: ${\n context.config.env.secrets ? \"\" : \"Defaulted \"\n }${\n context.env.secrets.variant === \"reflection\"\n ? \"Deepkit type definition\"\n : context.env.secrets.variant === \"json-schema\"\n ? \"JSON Schema\"\n : context.env.secrets.variant === \"standard-schema\"\n ? \"Standard Schema\"\n : context.env.secrets.variant === \"zod3\"\n ? \"Zod v3 schema\"\n : context.env.secrets.variant === \"valibot\"\n ? \"Valibot schema\"\n : context.env.secrets.variant === \"untyped\"\n ? \"Untyped configuration\"\n : \"Typescript exported type\"\n }${context.config.env.secrets ? \" from plugin options\" : \"\"} provided ${\n context.env.secrets?.schema\n ? getPropertiesList(context.env.secrets).length\n : \"0\"\n } parameters\\nEnvironment variable Prefixes: ${context.config.env.prefix.join(\n \", \"\n )}\\nShould inject values: ${\n context.config.env.inject ? \"Yes\" : \"No\"\n }\\nShould validate configuration: ${\n context.config.env.validate ? \"Yes\" : \"No\"\n }`\n });\n\n const aliases = Object.fromEntries(\n Object.entries(properties).flatMap(\n ([key, prop]) =>\n (isSetArray(prop.alias)\n ? prop.alias?.map(alias => [\n alias,\n {\n ...prop,\n name: alias,\n alias: [...(prop.alias?.filter(a => a !== alias) ?? []), key]\n }\n ])\n : []) as [string, typeof prop][]\n )\n );\n\n context.env.parsed = await loadEnv(context);\n for (const [key, value] of Object.entries(context.env.parsed)) {\n const unprefixedKey = context.config.env.prefix.reduce((ret, prefix) => {\n if (key.startsWith(prefix)) {\n return key.slice(prefix.length + 1); // + 1 to account for the underscore after the prefix\n }\n return ret;\n }, key);\n if (properties[unprefixedKey]) {\n if (!properties[unprefixedKey]?.runtime) {\n const propertySchema = getProperties(context.env.config.schema)?.[\n unprefixedKey\n ];\n if (propertySchema) {\n propertySchema.default = value;\n }\n }\n } else if (aliases[unprefixedKey]) {\n if (!aliases[unprefixedKey]?.runtime) {\n const alias = aliases[unprefixedKey]?.alias?.[0] ?? unprefixedKey;\n const aliasSchema = getProperties(context.env.config.schema)?.[alias];\n if (aliasSchema) {\n aliasSchema.default = value;\n }\n }\n }\n }\n\n if (!isSchemaObject(context.env.config)) {\n throw new Error(\n \"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.\"\n );\n }\n\n getPropertiesList(context.env.config).forEach(property => {\n property.alias ??= [];\n const aliases = [...property.alias];\n context.config.env.prefix.forEach(prefix => {\n if (!property.alias!.includes(`${prefix}_${property.name}`)) {\n property.alias!.push(`${prefix}_${property.name}`);\n }\n\n aliases\n .map(alias => `${prefix}_${alias}`)\n .forEach(prefixedAlias => {\n if (!property.alias!.includes(prefixedAlias)) {\n property.alias!.push(prefixedAlias);\n }\n });\n });\n });\n\n getPropertiesList(context.env.secrets).forEach(property => {\n property.alias ??= [];\n const aliases = [...property.alias];\n context.config.env.prefix.forEach(prefix => {\n if (!property.alias!.includes(`${prefix}_${property.name}`)) {\n property.alias!.push(`${prefix}_${property.name}`);\n }\n\n aliases\n .map(alias => `${prefix}_${alias}`)\n .forEach(prefixedAlias => {\n if (!property.alias!.includes(prefixedAlias)) {\n property.alias!.push(prefixedAlias);\n }\n });\n });\n });\n}\n\n/**\n * 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.\n *\n * @param context - The plugin context containing the environment variables and secrets schema to be written to the cache directory.\n * @returns A promise that resolves when the schema has been successfully written to the cache directory.\n */\nexport async function writeEnv<TContext extends EnvPluginContext>(\n context: TContext\n): Promise<void[]> {\n return Promise.all([\n writeSchema(context, omit(context.env.config, [\"active\"]) as Schema),\n writeSchema(context, omit(context.env.secrets, [\"active\"]) as Schema),\n writeActive(context, \"config\", context.env.config),\n writeActive(context, \"secrets\", context.env.secrets)\n ]);\n}\n"],"mappings":";;;;;;;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;CAE1B,OAAK;AACN;;;;;;;AA+BA,eAAS,uBAAoC,SAAS;CACtD,MAAQ,WAAW,MAAM,QAAO,GAAA,QAAA,kCAAA;gBAE9B,MAAA,IAAA,MAAA,yJAAA;CAED,OAAA;AACD;AACA,uBAAuB,SAAM;CAAA;CAAe;CAAqB;CAAS;AAAA;;;;;;;AAO1E,eAAmB,iBAAA,SAAA;CACjB,OAAK;EACH,MAAC,MAAA,uBAAA,OAAA;EACH,QAAA;;AAEF;AACA,iBAAA,SAAA;CAAA;CAAA;CAAA;CAAA;AAAA;;;;;;AAMA,eAAgB,kBAAwB,SAAQ;CAC9C,OAAA;EACF,MAAO,MAAM,uBAA0B,OAAA;EACrC,QAAS;CACT;AACF;AACA,kBAAgB,SAAA;CAAA;CAAuB;CAAQ;AAAA;;;;;;;AAO/C,SAAU,kBAAqB,SAAO;CACpC,OAAE,UAAY,QAAQ,WAAK,KAAc;AAC3C;AACA,kBAAa,SAAS;CAAA;CAAiB;CAAkB;CAAkB;AAAA;AAC3E,SAAW,iBAAA,SAAA,SAAA;CACT,OAAC,UAAQ,kBAAe,OAAA,GAAA,GAAA,QAAA,MAAA;AAC1B;AACA,iBAAgB,SAAA;CAAA;CAA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IAAO;IAAA;GAAA,CAAA,CAAA;EACP,GAAA;GAAA;GAAc;GAAI;EAAC,CAAA,CAAA;CACrB,GAAG;EAAA;EAAY;EAAA;CAAA,CAAA,CAAA;AACjB;;;;;;;;;;;;;AAQA,eAAsB,SAAK,SAAW;CACpC,OAAM,QAAA,IAAA;EAAc,YAAO,SAAA,KAAA,QAAA,IAAA,QAAA,CAAA,QAAA,CAAA,CAAA;EAAA,YAAA,SAAA,KAAA,QAAA,IAAA,SAAA,CAAA,QAAA,CAAA,CAAA;EAAA,YAAA,SAAA,UAAA,QAAA,IAAA,MAAA;EAAA,YAAA,SAAA,WAAA,QAAA,IAAA,OAAA;CAAA,CAAA;AAC7B;AACA,SAAS,SAAC;CAAA;CAAe;CAAO;CAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.326",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing a Powerlines plugin for injecting static .env configuration values to the code so that they're accessible at runtime.",
|
|
6
6
|
"keywords": ["dotenv", "powerlines", "storm-software", "powerlines-plugin"],
|
|
@@ -251,11 +251,11 @@
|
|
|
251
251
|
"@babel/core": "8.0.0-rc.6",
|
|
252
252
|
"@babel/types": "8.0.0-rc.6",
|
|
253
253
|
"@powerlines/core": "^0.48.45",
|
|
254
|
-
"@powerlines/plugin-alloy": "0.26.
|
|
255
|
-
"@powerlines/plugin-automd": "0.1.
|
|
256
|
-
"@powerlines/plugin-babel": "0.13.
|
|
257
|
-
"@powerlines/plugin-plugin": "0.12.
|
|
258
|
-
"@powerlines/schema": "0.11.
|
|
254
|
+
"@powerlines/plugin-alloy": "0.26.215",
|
|
255
|
+
"@powerlines/plugin-automd": "0.1.583",
|
|
256
|
+
"@powerlines/plugin-babel": "0.13.118",
|
|
257
|
+
"@powerlines/plugin-plugin": "0.12.534",
|
|
258
|
+
"@powerlines/schema": "0.11.104",
|
|
259
259
|
"@storm-software/config-tools": "^1.190.40",
|
|
260
260
|
"@stryke/capnp": "^0.12.111",
|
|
261
261
|
"@stryke/convert": "^0.7.15",
|
|
@@ -270,9 +270,9 @@
|
|
|
270
270
|
"automd": "^0.4.3",
|
|
271
271
|
"c12": "^3.3.4",
|
|
272
272
|
"defu": "^6.1.7",
|
|
273
|
-
"powerlines": "0.47.
|
|
273
|
+
"powerlines": "0.47.122"
|
|
274
274
|
},
|
|
275
275
|
"devDependencies": { "@types/node": "^25.9.1", "vite": "^8.0.16" },
|
|
276
276
|
"publishConfig": { "access": "public" },
|
|
277
|
-
"gitHead": "
|
|
277
|
+
"gitHead": "c49560c5c534ab47aa13b2843f0fa401b6a4bb4d"
|
|
278
278
|
}
|