@powerlines/plugin-env 0.16.273 → 0.16.274
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/load.cjs +5 -4
- package/dist/helpers/load.d.cts +1 -1
- package/dist/helpers/load.d.cts.map +1 -1
- package/dist/helpers/load.d.mts +1 -1
- package/dist/helpers/load.d.mts.map +1 -1
- package/dist/helpers/load.mjs +4 -3
- package/dist/helpers/load.mjs.map +1 -1
- package/dist/helpers/schema.cjs +8 -16
- package/dist/helpers/schema.d.cts.map +1 -1
- package/dist/helpers/schema.d.mts.map +1 -1
- package/dist/helpers/schema.mjs +8 -14
- package/dist/helpers/schema.mjs.map +1 -1
- package/package.json +9 -9
package/dist/helpers/load.cjs
CHANGED
|
@@ -4,14 +4,14 @@ const require_types_plugin = require('../types/plugin.cjs');
|
|
|
4
4
|
const require_helpers_source_file_env = require('./source-file-env.cjs');
|
|
5
5
|
let _powerlines_schema = require("@powerlines/schema");
|
|
6
6
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
7
|
-
let defu = require("defu");
|
|
8
|
-
defu = require_runtime.__toESM(defu, 1);
|
|
9
7
|
let _storm_software_config_tools_get_config = require("@storm-software/config-tools/get-config");
|
|
10
8
|
let _stryke_env_environment_checks = require("@stryke/env/environment-checks");
|
|
11
9
|
let _stryke_env_load_env = require("@stryke/env/load-env");
|
|
12
10
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
13
11
|
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
14
12
|
let c12 = require("c12");
|
|
13
|
+
let defu = require("defu");
|
|
14
|
+
defu = require_runtime.__toESM(defu, 1);
|
|
15
15
|
let powerlines_constants = require("powerlines/constants");
|
|
16
16
|
|
|
17
17
|
//#region src/helpers/load.ts
|
|
@@ -119,7 +119,7 @@ loadEnvFromContext.__type = [
|
|
|
119
119
|
"Retrieves various dotenv configuration parameters from the context.",
|
|
120
120
|
"Pn!2\"!2#!2$8\"/%?&"
|
|
121
121
|
];
|
|
122
|
-
async function loadEnv(context, options) {
|
|
122
|
+
async function loadEnv(context, options = context.config.env) {
|
|
123
123
|
const workspaceConfig = await (0, _storm_software_config_tools_get_config.tryGetWorkspaceConfig)();
|
|
124
124
|
const [project, workspace, config] = await Promise.all([
|
|
125
125
|
(loadEnvDirectory.Ω = [["!"]], loadEnvDirectory(context, options, context.config.root, context.config.mode, context.cachePath, context.packageJson, workspaceConfig)),
|
|
@@ -133,8 +133,9 @@ loadEnv.__type = [
|
|
|
133
133
|
"context",
|
|
134
134
|
() => require_types_plugin.__ΩEnvPluginOptions,
|
|
135
135
|
"options",
|
|
136
|
+
() => context.config.env,
|
|
136
137
|
"loadEnv",
|
|
137
|
-
"Pn!2\"n#2
|
|
138
|
+
"Pn!2\"n#2$>%\"`/&"
|
|
138
139
|
];
|
|
139
140
|
|
|
140
141
|
//#endregion
|
package/dist/helpers/load.d.cts
CHANGED
|
@@ -31,7 +31,7 @@ declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvPar
|
|
|
31
31
|
RUNTIME: "browser" | "nodejs" | "workerd" | "edge" | undefined;
|
|
32
32
|
ENVIRONMENT: string;
|
|
33
33
|
};
|
|
34
|
-
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options
|
|
34
|
+
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options?: EnvPluginOptions): Promise<TEnv>;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { loadEnv, loadEnvFromContext };
|
|
37
37
|
//# sourceMappingURL=load.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.cts","names":[],"sources":["../../src/helpers/load.ts"],"mappings":";;;;;;;AA2GA;;;;;iBAAgB,kBAAA,CACd,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,iBAAA,EACR,eAAA,GAAkB,eAAA;;;;;;;;;;;;;;;;;;;;;iBA+CE,OAAA,cACP,iBAAA,GAAoB,iBAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"load.d.cts","names":[],"sources":["../../src/helpers/load.ts"],"mappings":";;;;;;;AA2GA;;;;;iBAAgB,kBAAA,CACd,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,iBAAA,EACR,eAAA,GAAkB,eAAA;;;;;;;;;;;;;;;;;;;;;iBA+CE,OAAA,cACP,iBAAA,GAAoB,iBAAA,CAAA,CAEjC,OAAA,EAAS,gBAAA,EACT,OAAA,GAAS,gBAAA,GACR,OAAA,CAAQ,IAAA"}
|
package/dist/helpers/load.d.mts
CHANGED
|
@@ -31,7 +31,7 @@ declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvPar
|
|
|
31
31
|
RUNTIME: "browser" | "nodejs" | "workerd" | "edge" | undefined;
|
|
32
32
|
ENVIRONMENT: string;
|
|
33
33
|
};
|
|
34
|
-
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options
|
|
34
|
+
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options?: EnvPluginOptions): Promise<TEnv>;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { loadEnv, loadEnvFromContext };
|
|
37
37
|
//# sourceMappingURL=load.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.mts","names":[],"sources":["../../src/helpers/load.ts"],"mappings":";;;;;;;AA2GA;;;;;iBAAgB,kBAAA,CACd,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,iBAAA,EACR,eAAA,GAAkB,eAAA;;;;;;;;;;;;;;;;;;;;;iBA+CE,OAAA,cACP,iBAAA,GAAoB,iBAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"load.d.mts","names":[],"sources":["../../src/helpers/load.ts"],"mappings":";;;;;;;AA2GA;;;;;iBAAgB,kBAAA,CACd,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,iBAAA,EACR,eAAA,GAAkB,eAAA;;;;;;;;;;;;;;;;;;;;;iBA+CE,OAAA,cACP,iBAAA,GAAoB,iBAAA,CAAA,CAEjC,OAAA,EAAS,gBAAA,EACT,OAAA,GAAS,gBAAA,GACR,OAAA,CAAQ,IAAA"}
|
package/dist/helpers/load.mjs
CHANGED
|
@@ -2,13 +2,13 @@ import { __ΩEnvPluginContext, __ΩEnvPluginOptions } from "../types/plugin.mjs"
|
|
|
2
2
|
import { removeEnvPrefix } from "./source-file-env.mjs";
|
|
3
3
|
import { getProperties } from "@powerlines/schema";
|
|
4
4
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
5
|
-
import defu from "defu";
|
|
6
5
|
import { tryGetWorkspaceConfig } from "@storm-software/config-tools/get-config";
|
|
7
6
|
import { isDevelopmentMode, isTestMode, toMode } from "@stryke/env/environment-checks";
|
|
8
7
|
import { loadEnv as loadEnv$1, loadEnvFile } from "@stryke/env/load-env";
|
|
9
8
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
10
9
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
11
10
|
import { loadConfig } from "c12";
|
|
11
|
+
import defu from "defu";
|
|
12
12
|
import { DEFAULT_ENVIRONMENT } from "powerlines/constants";
|
|
13
13
|
|
|
14
14
|
//#region src/helpers/load.ts
|
|
@@ -116,7 +116,7 @@ loadEnvFromContext.__type = [
|
|
|
116
116
|
"Retrieves various dotenv configuration parameters from the context.",
|
|
117
117
|
"Pn!2\"!2#!2$8\"/%?&"
|
|
118
118
|
];
|
|
119
|
-
async function loadEnv(context, options) {
|
|
119
|
+
async function loadEnv(context, options = context.config.env) {
|
|
120
120
|
const workspaceConfig = await tryGetWorkspaceConfig();
|
|
121
121
|
const [project, workspace, config] = await Promise.all([
|
|
122
122
|
(loadEnvDirectory.Ω = [["!"]], loadEnvDirectory(context, options, context.config.root, context.config.mode, context.cachePath, context.packageJson, workspaceConfig)),
|
|
@@ -130,8 +130,9 @@ loadEnv.__type = [
|
|
|
130
130
|
"context",
|
|
131
131
|
() => __ΩEnvPluginOptions,
|
|
132
132
|
"options",
|
|
133
|
+
() => context.config.env,
|
|
133
134
|
"loadEnv",
|
|
134
|
-
"Pn!2\"n#2
|
|
135
|
+
"Pn!2\"n#2$>%\"`/&"
|
|
135
136
|
];
|
|
136
137
|
|
|
137
138
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.mjs","names":[],"sources":["../../src/helpers/load.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 { getProperties } from \"@powerlines/schema\";\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopmentMode,\n isTestMode,\n toMode\n} from \"@stryke/env/environment-checks\";\nimport {\n loadEnv as loadEnvBase,\n loadEnvFile as loadEnvFileBase\n} from \"@stryke/env/load-env\";\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { PackageJson } from \"@stryke/types/package-json\";\nimport { loadConfig } from \"c12\";\nimport defu from \"defu\";\nimport { WorkspaceConfig } from \"powerlines\";\nimport { DEFAULT_ENVIRONMENT } from \"powerlines/constants\";\nimport { EnvPluginContext, EnvPluginOptions } from \"../types/plugin\";\nimport { removeEnvPrefix } from \"./source-file-env\";\n\nasync function loadEnvFiles<TEnv extends DotenvParseOutput = DotenvParseOutput>(\n options: EnvPluginOptions,\n mode: string,\n cwd: string\n): Promise<TEnv> {\n let env = await loadEnvBase(cwd, mode);\n if (options.additionalFiles && options.additionalFiles?.length > 0) {\n const additionalEnvFiles = await Promise.all(\n options.additionalFiles.map(async additionalEnvFile =>\n loadEnvFileBase(additionalEnvFile, cwd)\n )\n );\n\n for (const additionalEnvFile of additionalEnvFiles) {\n env = defu(additionalEnvFile, env);\n }\n }\n\n return removeEnvPrefix(env) as TEnv;\n}\n\nasync function loadEnvDirectory<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(\n context: EnvPluginContext,\n options: EnvPluginOptions,\n directory: string,\n mode: string,\n cacheDir: string,\n packageJson: PackageJson,\n workspaceConfig?: WorkspaceConfig\n): Promise<TEnv> {\n const [envResult, c12Result] = await Promise.all([\n loadEnvFiles<TEnv>(options, mode, directory),\n loadConfig({\n cwd: directory,\n name: context.config.framework?.name || \"powerlines\",\n envName: mode,\n defaults: {\n NAME:\n workspaceConfig?.namespace && packageJson.name\n ? packageJson.name?.replace(`@${workspaceConfig.namespace}/`, \"\")\n : context.config.name,\n MODE: mode,\n ORG: context.config.organization || workspaceConfig?.organization\n },\n globalRc: true,\n packageJson: true,\n dotenv: true,\n jitiOptions: {\n fsCache: joinPaths(cacheDir, \"jiti\"),\n moduleCache: true\n }\n })\n ]);\n\n return defu(envResult as any, c12Result.config, workspaceConfig) as TEnv;\n}\n\n/**\n * Retrieves various dotenv configuration parameters from the context.\n *\n * @param context - The context to retrieve the dotenv configuration from.\n * @param parsed - The parsed dotenv configuration.\n * @returns An object containing the dotenv configuration.\n */\nexport function loadEnvFromContext(\n context: EnvPluginContext,\n parsed: DotenvParseOutput,\n workspaceConfig?: WorkspaceConfig\n) {\n return defu(\n {\n APP_NAME: kebabCase(context.config.name),\n APP_VERSION: context.packageJson.version,\n BUILD_ID: context.meta.buildId,\n BUILD_TIMESTAMP: new Date(context.meta.timestamp).toISOString(),\n BUILD_CHECKSUM: context.meta.checksum,\n RELEASE_ID: context.meta.releaseId,\n RELEASE_TAG: `${kebabCase(context.config.name)}@${context.packageJson.version}`,\n DEFAULT_LOCALE: workspaceConfig?.locale,\n DEFAULT_TIMEZONE: workspaceConfig?.timezone,\n LOG_LEVEL:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general,\n ERROR_URL: workspaceConfig?.error?.url,\n ORGANIZATION:\n context.config.organization ||\n (isSetObject(workspaceConfig?.organization)\n ? workspaceConfig.organization.name\n : workspaceConfig?.organization),\n PLATFORM: context.config.platform,\n MODE: toMode(context.config.mode),\n TEST: isTestMode(context.config.mode),\n DEBUG: isDevelopmentMode(context.config.mode),\n STACKTRACE: context.config.mode !== \"production\",\n RUNTIME: context.config.environment.runtime,\n ENVIRONMENT:\n !context.config.environment.name ||\n context.config.environment.name === DEFAULT_ENVIRONMENT\n ? context.config.mode\n : context.config.environment.name\n },\n isSetObject(context.env.config)\n ? Object.entries(getProperties(context.env.config)).reduce(\n (ret, [name, prop]) => {\n ret[name] = parsed[name] ?? prop?.default;\n return ret;\n },\n {} as Record<string, any>\n )\n : {}\n );\n}\n\nexport async function loadEnv<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(context: EnvPluginContext
|
|
1
|
+
{"version":3,"file":"load.mjs","names":[],"sources":["../../src/helpers/load.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 { getProperties } from \"@powerlines/schema\";\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopmentMode,\n isTestMode,\n toMode\n} from \"@stryke/env/environment-checks\";\nimport {\n loadEnv as loadEnvBase,\n loadEnvFile as loadEnvFileBase\n} from \"@stryke/env/load-env\";\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { PackageJson } from \"@stryke/types/package-json\";\nimport { loadConfig } from \"c12\";\nimport defu from \"defu\";\nimport { WorkspaceConfig } from \"powerlines\";\nimport { DEFAULT_ENVIRONMENT } from \"powerlines/constants\";\nimport { EnvPluginContext, EnvPluginOptions } from \"../types/plugin\";\nimport { removeEnvPrefix } from \"./source-file-env\";\n\nasync function loadEnvFiles<TEnv extends DotenvParseOutput = DotenvParseOutput>(\n options: EnvPluginOptions,\n mode: string,\n cwd: string\n): Promise<TEnv> {\n let env = await loadEnvBase(cwd, mode);\n if (options.additionalFiles && options.additionalFiles?.length > 0) {\n const additionalEnvFiles = await Promise.all(\n options.additionalFiles.map(async additionalEnvFile =>\n loadEnvFileBase(additionalEnvFile, cwd)\n )\n );\n\n for (const additionalEnvFile of additionalEnvFiles) {\n env = defu(additionalEnvFile, env);\n }\n }\n\n return removeEnvPrefix(env) as TEnv;\n}\n\nasync function loadEnvDirectory<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(\n context: EnvPluginContext,\n options: EnvPluginOptions,\n directory: string,\n mode: string,\n cacheDir: string,\n packageJson: PackageJson,\n workspaceConfig?: WorkspaceConfig\n): Promise<TEnv> {\n const [envResult, c12Result] = await Promise.all([\n loadEnvFiles<TEnv>(options, mode, directory),\n loadConfig({\n cwd: directory,\n name: context.config.framework?.name || \"powerlines\",\n envName: mode,\n defaults: {\n NAME:\n workspaceConfig?.namespace && packageJson.name\n ? packageJson.name?.replace(`@${workspaceConfig.namespace}/`, \"\")\n : context.config.name,\n MODE: mode,\n ORG: context.config.organization || workspaceConfig?.organization\n },\n globalRc: true,\n packageJson: true,\n dotenv: true,\n jitiOptions: {\n fsCache: joinPaths(cacheDir, \"jiti\"),\n moduleCache: true\n }\n })\n ]);\n\n return defu(envResult as any, c12Result.config, workspaceConfig) as TEnv;\n}\n\n/**\n * Retrieves various dotenv configuration parameters from the context.\n *\n * @param context - The context to retrieve the dotenv configuration from.\n * @param parsed - The parsed dotenv configuration.\n * @returns An object containing the dotenv configuration.\n */\nexport function loadEnvFromContext(\n context: EnvPluginContext,\n parsed: DotenvParseOutput,\n workspaceConfig?: WorkspaceConfig\n) {\n return defu(\n {\n APP_NAME: kebabCase(context.config.name),\n APP_VERSION: context.packageJson.version,\n BUILD_ID: context.meta.buildId,\n BUILD_TIMESTAMP: new Date(context.meta.timestamp).toISOString(),\n BUILD_CHECKSUM: context.meta.checksum,\n RELEASE_ID: context.meta.releaseId,\n RELEASE_TAG: `${kebabCase(context.config.name)}@${context.packageJson.version}`,\n DEFAULT_LOCALE: workspaceConfig?.locale,\n DEFAULT_TIMEZONE: workspaceConfig?.timezone,\n LOG_LEVEL:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general,\n ERROR_URL: workspaceConfig?.error?.url,\n ORGANIZATION:\n context.config.organization ||\n (isSetObject(workspaceConfig?.organization)\n ? workspaceConfig.organization.name\n : workspaceConfig?.organization),\n PLATFORM: context.config.platform,\n MODE: toMode(context.config.mode),\n TEST: isTestMode(context.config.mode),\n DEBUG: isDevelopmentMode(context.config.mode),\n STACKTRACE: context.config.mode !== \"production\",\n RUNTIME: context.config.environment.runtime,\n ENVIRONMENT:\n !context.config.environment.name ||\n context.config.environment.name === DEFAULT_ENVIRONMENT\n ? context.config.mode\n : context.config.environment.name\n },\n isSetObject(context.env.config)\n ? Object.entries(getProperties(context.env.config)).reduce(\n (ret, [name, prop]) => {\n ret[name] = parsed[name] ?? prop?.default;\n return ret;\n },\n {} as Record<string, any>\n )\n : {}\n );\n}\n\nexport async function loadEnv<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(\n context: EnvPluginContext,\n options: EnvPluginOptions = context.config.env\n): Promise<TEnv> {\n const workspaceConfig = await tryGetWorkspaceConfig();\n\n const [project, workspace, config] = await Promise.all([\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.config.root,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.config.cwd,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.envPaths.config,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n )\n ]);\n\n return defu(\n loadEnvFromContext(context, process.env, workspaceConfig),\n project,\n workspace,\n config\n ) as TEnv;\n}\n"],"mappings":";;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;AA6BA,eAAS,aAAkB,SAAM,MAAU,KAAC;CAC5C,IAAM,MAAG,MAAA,UAAqB,KAAK,IAAE;CACrC,IAAM,QAAG,mBAAkB,QAAA,iBAA4B,SAAY,GAAC;EACpE,MAAS,qBAAsB,MAAI,QAAO,IAAK,QAAI,gBAAA,IAAA,aAAA,OAAA,sBAAA,YAAA,mBAAA,GAAA,GAAA;GAAA;GAAA;GAAA;EAAA,CAAA,CAAA,CAAA;sDAE7C,MAAA,KAAS,mBAAkB,GAAA;CAE/B;CACA,OAAK,gBAAA,GAAA;AACP;AACA,aAAY,SAAM;OAAW;CAAW;CAAA;CAAA;CAAA;CAAA;AAAA;AACxC,eAAc,iBAAkB,SAAS,SAAA,WAAiB,MAAS,UAAG,aAAA,iBAAA;CACpE,MAAE,CAAK,WAAC,aAAqB,MAAM,QAAQ,IAAG,EAAA,aAAA,IAAA,CAAA,CAAA,GAAA,CAAA,GAAA,aAAA,SAAA,MAAA,SAAA,IAAA,WAAA;EAC5C,KAAE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ACA,mBAAa,SAAe;OAAA;CAAyB;CAAS;CAAO;CAAA;CAAA;CAAA;AAAA;AACrE,eAAC,QAAA,SAAA,UAAA,QAAA,OAAA,KAAA;CACC,MAAE,kBAAoB,MAAQ,sBAAsB;CACpD,MAAE,CAAK,SAAS,WAAW,UAAQ,MAAA,QAAa,IAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,GAAA,CAAA,GAAA,iBAAA,SAAA,SAAA,QAAA,OAAA,MAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,eAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,GAAA,CAAA,GAAA,iBAAA,SAAA,SAAA,QAAA,OAAA,KAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,eAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,GAAA,CAAA,GAAA,iBAAA,SAAA,SAAA,QAAA,SAAA,QAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,eAAA;CAAA,CAAA;CAChD,OAAE,KAAU,mBAAmB,SAAI,QAAO,KAAA,eAAa,GAAA,SAAA,WAAA,MAAA;AACzD;AACA,QAAO,SAAS;OAAA;CAAkB;OAAA;CAAA;OAAA,QAAA,OAAA;CAAA;CAAA;AAAA"}
|
package/dist/helpers/schema.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
2
|
const require_types_plugin = require('../types/plugin.cjs');
|
|
4
3
|
const require_helpers_load = require('./load.cjs');
|
|
5
4
|
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
@@ -8,8 +7,6 @@ let _stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
|
8
7
|
let _stryke_path_join = require("@stryke/path/join");
|
|
9
8
|
let _stryke_type_checks_is_set_array = require("@stryke/type-checks/is-set-array");
|
|
10
9
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
11
|
-
let defu = require("defu");
|
|
12
|
-
defu = require_runtime.__toESM(defu, 1);
|
|
13
10
|
|
|
14
11
|
//#region src/helpers/schema.ts
|
|
15
12
|
function __assignType(fn, args) {
|
|
@@ -133,21 +130,15 @@ readActive.__type = [
|
|
|
133
130
|
async function extractEnv(context) {
|
|
134
131
|
const defaultVarsTypeDefinition = await getDefaultVarsTypeDefinition(context);
|
|
135
132
|
const defaultSecretsTypeDefinition = await getDefaultSecretsTypeDefinition(context);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
context.env ??= {};
|
|
134
|
+
context.env.parsed ??= {};
|
|
135
|
+
context.env.injected ??= [];
|
|
136
|
+
context.env.config = await (0, _powerlines_schema.extract)(context, context.config.env.config);
|
|
137
|
+
context.env.config.active = await readActive(context, "config");
|
|
138
|
+
if ((0, _stryke_type_checks_is_string.isString)(context.config.env.config) && context.config.env.config !== `${defaultVarsTypeDefinition.file}#${defaultVarsTypeDefinition.name}` || (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.env.config) && (context.config.env.config.file !== defaultVarsTypeDefinition.file || context.config.env.config.name !== defaultVarsTypeDefinition.name)) context.env.config.schema = (0, _powerlines_schema.mergeSchemas)(context.env.config, await (0, _powerlines_schema.extract)(context, defaultVarsTypeDefinition));
|
|
139
139
|
const secrets = await (0, _powerlines_schema.extract)(context, context.config.env.secrets);
|
|
140
140
|
secrets.active = await readActive(context, "secrets");
|
|
141
141
|
if ((0, _stryke_type_checks_is_string.isString)(context.config.env.secrets) && context.config.env.secrets !== `${defaultSecretsTypeDefinition.file}#${defaultSecretsTypeDefinition.name}` || (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.env.secrets) && (context.config.env.secrets.file !== defaultSecretsTypeDefinition.file || context.config.env.secrets.name !== defaultSecretsTypeDefinition.name)) secrets.schema = (0, _powerlines_schema.mergeSchemas)(secrets, await (0, _powerlines_schema.extract)(context, defaultSecretsTypeDefinition));
|
|
142
|
-
context.env = (0, defu.default)({
|
|
143
|
-
config,
|
|
144
|
-
secrets,
|
|
145
|
-
parsed: await require_helpers_load.loadEnv(context, context.config.env)
|
|
146
|
-
}, context.env ?? {}, {
|
|
147
|
-
active: [],
|
|
148
|
-
parsed: {},
|
|
149
|
-
injected: []
|
|
150
|
-
});
|
|
151
142
|
const properties = (0, _powerlines_schema.getProperties)(context.env.config);
|
|
152
143
|
context.info({
|
|
153
144
|
meta: { category: "env" },
|
|
@@ -170,7 +161,8 @@ async function extractEnv(context) {
|
|
|
170
161
|
"",
|
|
171
162
|
"P\"2!\"/\""
|
|
172
163
|
])));
|
|
173
|
-
|
|
164
|
+
context.env.parsed = await require_helpers_load.loadEnv(context);
|
|
165
|
+
for (const [key, value] of Object.entries(context.env.parsed)) {
|
|
174
166
|
const unprefixedKey = context.config.env.prefix.reduce(__assignType((ret, prefix) => {
|
|
175
167
|
if (key.replace(/_$/g, "").startsWith(prefix)) return key.replace(/_$/g, "").slice(prefix.length);
|
|
176
168
|
return ret;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.cts","names":[],"sources":["../../src/helpers/schema.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"schema.d.cts","names":[],"sources":["../../src/helpers/schema.ts"],"mappings":";;;;;;;AA4CA;;;;iBAAsB,sBAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA;;;;;;;iBAiBA,4BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;AAnBD;AAiB7B;;iBAcsB,+BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;;;;;iBAad,iBAAA,kBAAmC,gBAAA,CAAA,CACjD,OAAA,EAAS,QAAQ;AAAA,iBAKH,gBAAA,kBAAkC,gBAAA,CAAA,CAChD,OAAA,EAAS,QAAQ,EACjB,OAAA;;;;;;AAnC0C;AAY5C;;;iBAsEsB,UAAA,kBAA4B,gBAAA,CAAA,CAChD,OAAA,EAAS,QAAA,GACR,OAAA;;;;;;;iBAwJmB,QAAA,kBAA0B,gBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.mts","names":[],"sources":["../../src/helpers/schema.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"schema.d.mts","names":[],"sources":["../../src/helpers/schema.ts"],"mappings":";;;;;;;AA4CA;;;;iBAAsB,sBAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA;;;;;;;iBAiBA,4BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;AAnBD;AAiB7B;;iBAcsB,+BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;;;;;iBAad,iBAAA,kBAAmC,gBAAA,CAAA,CACjD,OAAA,EAAS,QAAQ;AAAA,iBAKH,gBAAA,kBAAkC,gBAAA,CAAA,CAChD,OAAA,EAAS,QAAQ,EACjB,OAAA;;;;;;AAnC0C;AAY5C;;;iBAsEsB,UAAA,kBAA4B,gBAAA,CAAA,CAChD,OAAA,EAAS,QAAA,GACR,OAAA;;;;;;;iBAwJmB,QAAA,kBAA0B,gBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,OAAA"}
|
package/dist/helpers/schema.mjs
CHANGED
|
@@ -6,7 +6,6 @@ import { omit } from "@stryke/helpers/omit";
|
|
|
6
6
|
import { joinPaths } from "@stryke/path/join";
|
|
7
7
|
import { isSetArray } from "@stryke/type-checks/is-set-array";
|
|
8
8
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
9
|
-
import defu from "defu";
|
|
10
9
|
|
|
11
10
|
//#region src/helpers/schema.ts
|
|
12
11
|
function __assignType(fn, args) {
|
|
@@ -130,21 +129,15 @@ readActive.__type = [
|
|
|
130
129
|
async function extractEnv(context) {
|
|
131
130
|
const defaultVarsTypeDefinition = await getDefaultVarsTypeDefinition(context);
|
|
132
131
|
const defaultSecretsTypeDefinition = await getDefaultSecretsTypeDefinition(context);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
context.env ??= {};
|
|
133
|
+
context.env.parsed ??= {};
|
|
134
|
+
context.env.injected ??= [];
|
|
135
|
+
context.env.config = await extract(context, context.config.env.config);
|
|
136
|
+
context.env.config.active = await readActive(context, "config");
|
|
137
|
+
if (isString(context.config.env.config) && context.config.env.config !== `${defaultVarsTypeDefinition.file}#${defaultVarsTypeDefinition.name}` || isSetObject(context.config.env.config) && (context.config.env.config.file !== defaultVarsTypeDefinition.file || context.config.env.config.name !== defaultVarsTypeDefinition.name)) context.env.config.schema = mergeSchemas(context.env.config, await extract(context, defaultVarsTypeDefinition));
|
|
136
138
|
const secrets = await extract(context, context.config.env.secrets);
|
|
137
139
|
secrets.active = await readActive(context, "secrets");
|
|
138
140
|
if (isString(context.config.env.secrets) && context.config.env.secrets !== `${defaultSecretsTypeDefinition.file}#${defaultSecretsTypeDefinition.name}` || isSetObject(context.config.env.secrets) && (context.config.env.secrets.file !== defaultSecretsTypeDefinition.file || context.config.env.secrets.name !== defaultSecretsTypeDefinition.name)) secrets.schema = mergeSchemas(secrets, await extract(context, defaultSecretsTypeDefinition));
|
|
139
|
-
context.env = defu({
|
|
140
|
-
config,
|
|
141
|
-
secrets,
|
|
142
|
-
parsed: await loadEnv(context, context.config.env)
|
|
143
|
-
}, context.env ?? {}, {
|
|
144
|
-
active: [],
|
|
145
|
-
parsed: {},
|
|
146
|
-
injected: []
|
|
147
|
-
});
|
|
148
141
|
const properties = getProperties(context.env.config);
|
|
149
142
|
context.info({
|
|
150
143
|
meta: { category: "env" },
|
|
@@ -167,7 +160,8 @@ async function extractEnv(context) {
|
|
|
167
160
|
"",
|
|
168
161
|
"P\"2!\"/\""
|
|
169
162
|
])));
|
|
170
|
-
|
|
163
|
+
context.env.parsed = await loadEnv(context);
|
|
164
|
+
for (const [key, value] of Object.entries(context.env.parsed)) {
|
|
171
165
|
const unprefixedKey = context.config.env.prefix.reduce(__assignType((ret, prefix) => {
|
|
172
166
|
if (key.replace(/_$/g, "").startsWith(prefix)) return key.replace(/_$/g, "").slice(prefix.length);
|
|
173
167
|
return 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 JsonSchemaObject,\n mergeSchemas,\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 { isString } from \"@stryke/type-checks/is-string\";\nimport type { TypeDefinition } from \"@stryke/types/configuration\";\nimport defu from \"defu\";\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 getDefaultVarsTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"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 getDefaultSecretsTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"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 defaultVarsTypeDefinition = await getDefaultVarsTypeDefinition(context);\n const defaultSecretsTypeDefinition =\n await getDefaultSecretsTypeDefinition(context);\n\n const config = (await extract(\n context,\n context.config.env.config\n )) as EnvSchema;\n config.active = await readActive(context, \"config\");\n\n if (\n (isString(context.config.env.config) &&\n context.config.env.config !==\n `${defaultVarsTypeDefinition.file}#${\n defaultVarsTypeDefinition.name\n }`) ||\n (isSetObject(context.config.env.config) &&\n ((context.config.env.config as TypeDefinition).file !==\n defaultVarsTypeDefinition.file ||\n (context.config.env.config as TypeDefinition).name !==\n defaultVarsTypeDefinition.name))\n ) {\n config.schema = mergeSchemas(\n config,\n await extract(context, defaultVarsTypeDefinition)\n ) as JsonSchemaObject;\n }\n\n const secrets = (await extract(\n context,\n context.config.env.secrets\n )) as EnvSchema;\n secrets.active = await readActive(context, \"secrets\");\n\n if (\n (isString(context.config.env.secrets) &&\n context.config.env.secrets !==\n `${defaultSecretsTypeDefinition.file}#${\n defaultSecretsTypeDefinition.name\n }`) ||\n (isSetObject(context.config.env.secrets) &&\n ((context.config.env.secrets as TypeDefinition).file !==\n defaultSecretsTypeDefinition.file ||\n (context.config.env.secrets as TypeDefinition).name !==\n defaultSecretsTypeDefinition.name))\n ) {\n secrets.schema = mergeSchemas(\n secrets,\n await extract(context, defaultSecretsTypeDefinition)\n ) as JsonSchemaObject;\n }\n\n context.env = defu(\n {\n config,\n secrets,\n parsed: await loadEnv(context, context.config.env)\n },\n context.env ?? {},\n {\n active: [],\n parsed: {},\n injected: []\n }\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 : \"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 : \"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 for (const [key, value] of Object.entries(\n await loadEnv(context, context.config.env)\n )) {\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\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;;;;;;;AAgCA,eAAmB,uBAAa,SAAA;;CAE9B,IAAA,CAAA,UACC,MAAA,IAAS,MAAI,yJAA0D;CAEx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AAA,QAAA,OAAA,GAAA,CAAA,GAAA;EAC3B,MAAA,gBAAsB,QAAC,OAAc,IAAI,OAAO,OAAI,cAAe,KAAI,WAAc;GACvF,IAAA,IAAA,QAAA,OAAA,EAAA,EAAA,WAAA,MAAA,GACK,OAAM,IAAA,QAAS,OAAW,EAAA,EAAA,MAAS,OAAQ,MAAA;GAE/C,OAAQ;EACT,GAAK;GAAC;GAAA;GAAA;GAAA;EAAiC,CAAC,GAAA,GAAA;EACxC,IAAM,WAAA,gBACJ;OAAM,CAAA,WAAA,gBAAA,SAAgC;;IAElC,IAAA,gBACJ,eAAO,UAAA;GAEN;SACI,IAAM,QAAQ;;IAElB,MAAA,QAAA,QAAA,gBAAA,QAAA,MAAA;IACA,MAAS,cAAc,cAAc,QAAA,IAAA,OAAA,MAAA,IAAA;IACpC,IAAA,aACI,YAAC,UAAA;GAEL;;CAEJ;AACF;AACA,WAAS,SAAQ;CAAA;CAAW;CAAU;CAAuB;AAAA;;;;;;;AAO7D,eAAE,SAAA,SAAA;;;;;;;AAEF;AACA,SAAI,SAAO;CAAA;CAAA;CAAA;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 JsonSchemaObject,\n mergeSchemas,\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 { isString } from \"@stryke/type-checks/is-string\";\nimport type { TypeDefinition } 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 getDefaultVarsTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"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 getDefaultSecretsTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"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 defaultVarsTypeDefinition = await getDefaultVarsTypeDefinition(context);\n const defaultSecretsTypeDefinition =\n await getDefaultSecretsTypeDefinition(context);\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 (isString(context.config.env.config) &&\n context.config.env.config !==\n `${defaultVarsTypeDefinition.file}#${\n defaultVarsTypeDefinition.name\n }`) ||\n (isSetObject(context.config.env.config) &&\n ((context.config.env.config as TypeDefinition).file !==\n defaultVarsTypeDefinition.file ||\n (context.config.env.config as TypeDefinition).name !==\n defaultVarsTypeDefinition.name))\n ) {\n context.env.config.schema = mergeSchemas(\n context.env.config,\n await extract(context, defaultVarsTypeDefinition)\n ) as JsonSchemaObject;\n }\n\n const secrets = (await extract(\n context,\n context.config.env.secrets\n )) as EnvSchema;\n secrets.active = await readActive(context, \"secrets\");\n\n if (\n (isString(context.config.env.secrets) &&\n context.config.env.secrets !==\n `${defaultSecretsTypeDefinition.file}#${\n defaultSecretsTypeDefinition.name\n }`) ||\n (isSetObject(context.config.env.secrets) &&\n ((context.config.env.secrets as TypeDefinition).file !==\n defaultSecretsTypeDefinition.file ||\n (context.config.env.secrets as TypeDefinition).name !==\n defaultSecretsTypeDefinition.name))\n ) {\n secrets.schema = mergeSchemas(\n secrets,\n await extract(context, defaultSecretsTypeDefinition)\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 : \"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 : \"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\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,eAAmB,uBAAa,SAAA;;CAE9B,IAAA,CAAA,UACC,MAAA,IAAS,MAAI,yJAA0D;CAExE,OAAO;AACT;AACA,uBAAE,SAAA;CAAA;CAAA;CAAA;CAAA;AAAA;;;;;;;AAOF,eAAiB,6BAAyB,SAAgB;CACxD,OAAG;EACH,MAAA,MAAA,uBAAA,OAAA;;CAEA;AACF;;;;;;;;;;;;AAOA,eAAE,gCAAA,SAAA;CACF,OAAO;EACL,MAAQ,MAAC,uBAAQ,OAAA;EACjB,MAAQ;CACR;AACF;AACA,gCAAuB,SAAA;CAAA;CAAA;CAAA;AAAA;;;;;;;AAOvB,SAAgB,kBAAa,SAAc;CACzC,OAAA,UAAA,QAAA,WAAA,KAAA;AACF;AACA,kBAAkB,SAAC;CAAA;CAAA;CAAA;CAAA;AAAA;AACnB,SAAW,iBAAmB,SAAA,SAAgB;CAC5C,OAAO,UAAA,kBAAA,OAAA,GAAA,GAAA,QAAA,MAAA;AACT;AACA,iBAAW,SAAA;CAAgB;CAAA;CAAA;CAAA;CAAA;CAAA;AAAA;AAC3B,eAAG,YAAA,SAAA,SAAA,QAAA;CACH,IAAA,CAAA,SAAA,MAAA;CAGE,MAAG,QAAO,GAAA,MAAY,iBAAc,SAAU,OAAS,GAAA,KAAQ,UAAS,OAAK,MAAS,CAAA;AACxF;AACA,YAAU,SAAU;CAAA;CAAY;CAAO;CAAU;OAAoB;CAAI;CAAA;CAAA;AAAA;AACzE,eAAe,WAAS,SAAU,SAAU;CAC1C,IAAA,CAAA,QAAA,GAAA,WAAA,iBAAA,SAAA,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WAAA;GACG,IAAA,IAAA,QAAA,OAAA,EAAA,EAAA,WAAA,MAAA,GACI,OAAA,IAAS,QAAU,OAAO,EAAA,EAAA,MAAU,OAAO,MAAI;GAEnD,OAAM;EACN,GAAA;GAAA;GAAU;GAAQ;GAAK;EAAc,CAAA,GAAI,GAAA;EAC3C,IAAA,WAAA,gBACI;OAAC,CAAA,WAAe,gBAAW,SAAS;IACxC,MAAS,iBAAA,cAAA,QAAA,IAAA,OAAA,MAAA,IAAA;IACR,IAAQ,gBACH,eAAA,UAA2B;GAE/B;qCAEF;OAAQ,CAAA,QAAS,gBAAK,SAAkB;IACxC,MAAY,QAAQ,QAAK,gBAAA,QAAA,MAAA;IACzB,MAAY,cAAc,cAAC,QAAA,IAAA,OAAA,MAAA,IAAA;qBAEnB,YAAY,UAAQ;GAE1B;;CAEF;;AAEF,WAAK,SAAA;CAAA;CAAA;CAAA;CAAA;AAAA;;;;;;;AAOL,eAAsB,SAAK,SAAU;CACnC,OAAM,QAAA,IAAA;EAAA,YAA0B,SAAM,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;AACxC;AACA,SAAS,SAAC;CAAA;CAAA;CAA+B;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.274",
|
|
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"],
|
|
@@ -107,12 +107,12 @@
|
|
|
107
107
|
"@alloy-js/typescript": "^0.23.0",
|
|
108
108
|
"@babel/core": "8.0.0-rc.6",
|
|
109
109
|
"@babel/types": "8.0.0-rc.6",
|
|
110
|
-
"@powerlines/core": "0.48.
|
|
111
|
-
"@powerlines/plugin-alloy": "0.26.
|
|
112
|
-
"@powerlines/plugin-automd": "0.1.
|
|
113
|
-
"@powerlines/plugin-babel": "0.13.
|
|
114
|
-
"@powerlines/plugin-plugin": "0.12.
|
|
115
|
-
"@powerlines/schema": "0.11.
|
|
110
|
+
"@powerlines/core": "0.48.18",
|
|
111
|
+
"@powerlines/plugin-alloy": "0.26.164",
|
|
112
|
+
"@powerlines/plugin-automd": "0.1.536",
|
|
113
|
+
"@powerlines/plugin-babel": "0.13.71",
|
|
114
|
+
"@powerlines/plugin-plugin": "0.12.487",
|
|
115
|
+
"@powerlines/schema": "0.11.58",
|
|
116
116
|
"@storm-software/config-tools": "^1.190.33",
|
|
117
117
|
"@stryke/capnp": "^0.12.103",
|
|
118
118
|
"@stryke/convert": "^0.7.8",
|
|
@@ -127,9 +127,9 @@
|
|
|
127
127
|
"automd": "^0.4.3",
|
|
128
128
|
"c12": "^3.3.4",
|
|
129
129
|
"defu": "^6.1.7",
|
|
130
|
-
"powerlines": "0.47.
|
|
130
|
+
"powerlines": "0.47.75"
|
|
131
131
|
},
|
|
132
132
|
"devDependencies": { "@types/node": "^25.9.1", "vite": "^8.0.14" },
|
|
133
133
|
"publishConfig": { "access": "public" },
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "c8d684b669671f6b19bc57dba25dd3bf1872e66a"
|
|
135
135
|
}
|