@powerlines/plugin-env 0.16.238 → 0.16.240
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.d.cts +2 -2
- package/dist/helpers/load.d.mts +2 -2
- package/dist/helpers/schema.cjs +3 -8
- package/dist/helpers/schema.d.cts +2 -3
- package/dist/helpers/schema.d.cts.map +1 -1
- package/dist/helpers/schema.d.mts +2 -3
- package/dist/helpers/schema.d.mts.map +1 -1
- package/dist/helpers/schema.mjs +4 -9
- package/dist/helpers/schema.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/helpers/load.d.cts
CHANGED
|
@@ -24,11 +24,11 @@ declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvPar
|
|
|
24
24
|
ERROR_URL: string | undefined;
|
|
25
25
|
ORGANIZATION: string | undefined;
|
|
26
26
|
PLATFORM: "node" | "browser" | "neutral";
|
|
27
|
-
MODE: "
|
|
27
|
+
MODE: "test" | "development" | "production";
|
|
28
28
|
TEST: boolean;
|
|
29
29
|
DEBUG: boolean;
|
|
30
30
|
STACKTRACE: boolean;
|
|
31
|
-
RUNTIME: "
|
|
31
|
+
RUNTIME: "edge" | "browser" | "nodejs" | "workerd" | undefined;
|
|
32
32
|
ENVIRONMENT: string;
|
|
33
33
|
};
|
|
34
34
|
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv>;
|
package/dist/helpers/load.d.mts
CHANGED
|
@@ -24,11 +24,11 @@ declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvPar
|
|
|
24
24
|
ERROR_URL: string | undefined;
|
|
25
25
|
ORGANIZATION: string | undefined;
|
|
26
26
|
PLATFORM: "node" | "browser" | "neutral";
|
|
27
|
-
MODE: "
|
|
27
|
+
MODE: "test" | "development" | "production";
|
|
28
28
|
TEST: boolean;
|
|
29
29
|
DEBUG: boolean;
|
|
30
30
|
STACKTRACE: boolean;
|
|
31
|
-
RUNTIME: "
|
|
31
|
+
RUNTIME: "edge" | "browser" | "nodejs" | "workerd" | undefined;
|
|
32
32
|
ENVIRONMENT: string;
|
|
33
33
|
};
|
|
34
34
|
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv>;
|
package/dist/helpers/schema.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_types_plugin = require('../types/plugin.cjs');
|
|
4
3
|
const require_helpers_load = require('./load.cjs');
|
|
5
4
|
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
6
5
|
let _powerlines_schema = require("@powerlines/schema");
|
|
@@ -75,10 +74,9 @@ getDefaultSecretsTypeDefinition.__type = [
|
|
|
75
74
|
* 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.
|
|
76
75
|
*
|
|
77
76
|
* @param context - The plugin context
|
|
78
|
-
* @param options - The plugin options containing the environment variables and secrets type definitions to extract the schema from. If not provided, the default type definitions will be used.
|
|
79
77
|
* @returns A promise that resolves when the schema has been extracted and stored in the plugin context.
|
|
80
78
|
*/
|
|
81
|
-
async function extractEnvSchema(context
|
|
79
|
+
async function extractEnvSchema(context) {
|
|
82
80
|
const defaultVarsTypeDefinition = await getDefaultVarsTypeDefinition(context);
|
|
83
81
|
const defaultSecretsTypeDefinition = await getDefaultSecretsTypeDefinition(context);
|
|
84
82
|
const vars = await (0, _powerlines_schema_extract.extract)(context, context.config.env.vars);
|
|
@@ -97,7 +95,7 @@ async function extractEnvSchema(context, options = {}) {
|
|
|
97
95
|
const properties = (0, _powerlines_schema_helpers.getProperties)(context.env.vars);
|
|
98
96
|
context.info({
|
|
99
97
|
meta: { category: "env" },
|
|
100
|
-
message: `Environment Variables configuration: ${
|
|
98
|
+
message: `Environment Variables configuration: ${context.config.env.vars ? "" : "Defaulted "}${context.env.vars.variant === "reflection" ? "Deepkit type definition" : context.env.vars.variant === "json-schema" ? "JSON Schema" : context.env.vars.variant === "standard-schema" ? "Standard Schema" : context.env.vars.variant === "zod3" ? "Zod v3 schema" : "Typescript exported type"}${context.config.env.vars ? " from plugin options" : ""} provided ${Object.keys(properties).length} parameters\nEnvironment Secret configuration: ${context.config.env.secrets ? "" : "Defaulted "}${context.env.secrets.variant === "reflection" ? "Deepkit type definition" : context.env.secrets.variant === "json-schema" ? "JSON Schema" : context.env.secrets.variant === "standard-schema" ? "Standard Schema" : context.env.secrets.variant === "zod3" ? "Zod v3 schema" : "Typescript exported type"}${context.config.env.secrets ? " from plugin options" : ""} provided ${context.env.secrets?.schema ? (0, _powerlines_schema_helpers.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"}`
|
|
101
99
|
});
|
|
102
100
|
const aliases = Object.fromEntries(Object.entries(properties).flatMap(__assignType(([key, prop]) => (0, _stryke_type_checks_is_set_array.isSetArray)(prop.metadata?.alias) ? prop.metadata?.alias?.map(__assignType((alias) => [alias, {
|
|
103
101
|
...prop,
|
|
@@ -150,12 +148,9 @@ async function extractEnvSchema(context, options = {}) {
|
|
|
150
148
|
}
|
|
151
149
|
extractEnvSchema.__type = [
|
|
152
150
|
"context",
|
|
153
|
-
() => require_types_plugin.__ΩEnvPluginOptions,
|
|
154
|
-
"options",
|
|
155
|
-
() => ({}),
|
|
156
151
|
"extractEnvSchema",
|
|
157
152
|
"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.",
|
|
158
|
-
"P\"2
|
|
153
|
+
"P\"2!$`/\"?#"
|
|
159
154
|
];
|
|
160
155
|
/**
|
|
161
156
|
* Reads the active environment variables and secrets from the plugin context's cache and stores them in the plugin context for use during the build process. This function should be called during the plugin's `buildStart` hook to ensure that the active environment variables and secrets are available before the build process begins.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnvPluginContext
|
|
1
|
+
import { EnvPluginContext } from "../types/plugin.cjs";
|
|
2
2
|
import { UnresolvedContext } from "powerlines";
|
|
3
3
|
import { TypeDefinition } from "@stryke/types/configuration";
|
|
4
4
|
|
|
@@ -30,10 +30,9 @@ declare function getDefaultSecretsTypeDefinition<TContext extends UnresolvedCont
|
|
|
30
30
|
* 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.
|
|
31
31
|
*
|
|
32
32
|
* @param context - The plugin context
|
|
33
|
-
* @param options - The plugin options containing the environment variables and secrets type definitions to extract the schema from. If not provided, the default type definitions will be used.
|
|
34
33
|
* @returns A promise that resolves when the schema has been extracted and stored in the plugin context.
|
|
35
34
|
*/
|
|
36
|
-
declare function extractEnvSchema<TContext extends EnvPluginContext>(context: TContext
|
|
35
|
+
declare function extractEnvSchema<TContext extends EnvPluginContext>(context: TContext): Promise<void>;
|
|
37
36
|
/**
|
|
38
37
|
* Reads the active environment variables and secrets from the plugin context's cache and stores them in the plugin context for use during the build process. This function should be called during the plugin's `buildStart` hook to ensure that the active environment variables and secrets are available before the build process begins.
|
|
39
38
|
*
|
|
@@ -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":";;;;;;;AAyCA;;;;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;;;;;;;;;;iBAgBR,gBAAA,kBAAkC,gBAAA,CAAA,CACtD,OAAA,EAAS,QAAA,GACR,OAAA;;;;AAhCyC;AAY5C;;iBA4LsB,aAAA,kBAA+B,gBAAA,CAAA,CACnD,OAAA,EAAS,QAAA,GAAQ,OAAA;;;;;;;iBAqCG,cAAA,kBAAgC,gBAAA,CAAA,CACpD,OAAA,EAAS,QAAA,GAAQ,OAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnvPluginContext
|
|
1
|
+
import { EnvPluginContext } from "../types/plugin.mjs";
|
|
2
2
|
import { UnresolvedContext } from "powerlines";
|
|
3
3
|
import { TypeDefinition } from "@stryke/types/configuration";
|
|
4
4
|
|
|
@@ -30,10 +30,9 @@ declare function getDefaultSecretsTypeDefinition<TContext extends UnresolvedCont
|
|
|
30
30
|
* 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.
|
|
31
31
|
*
|
|
32
32
|
* @param context - The plugin context
|
|
33
|
-
* @param options - The plugin options containing the environment variables and secrets type definitions to extract the schema from. If not provided, the default type definitions will be used.
|
|
34
33
|
* @returns A promise that resolves when the schema has been extracted and stored in the plugin context.
|
|
35
34
|
*/
|
|
36
|
-
declare function extractEnvSchema<TContext extends EnvPluginContext>(context: TContext
|
|
35
|
+
declare function extractEnvSchema<TContext extends EnvPluginContext>(context: TContext): Promise<void>;
|
|
37
36
|
/**
|
|
38
37
|
* Reads the active environment variables and secrets from the plugin context's cache and stores them in the plugin context for use during the build process. This function should be called during the plugin's `buildStart` hook to ensure that the active environment variables and secrets are available before the build process begins.
|
|
39
38
|
*
|
|
@@ -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":";;;;;;;AAyCA;;;;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;;;;;;;;;;iBAgBR,gBAAA,kBAAkC,gBAAA,CAAA,CACtD,OAAA,EAAS,QAAA,GACR,OAAA;;;;AAhCyC;AAY5C;;iBA4LsB,aAAA,kBAA+B,gBAAA,CAAA,CACnD,OAAA,EAAS,QAAA,GAAQ,OAAA;;;;;;;iBAqCG,cAAA,kBAAgC,gBAAA,CAAA,CACpD,OAAA,EAAS,QAAA,GAAQ,OAAA"}
|
package/dist/helpers/schema.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { __ΩEnvPluginOptions } from "../types/plugin.mjs";
|
|
2
1
|
import { loadEnv } from "./load.mjs";
|
|
3
2
|
import { isString } from "@stryke/type-checks/is-string";
|
|
4
3
|
import { getCacheDirectory } from "@powerlines/schema";
|
|
5
4
|
import { extract } from "@powerlines/schema/extract";
|
|
6
|
-
import { getProperties as getProperties$1, mergeSchemas } from "@powerlines/schema/helpers";
|
|
5
|
+
import { getProperties as getProperties$1, getPropertiesList, mergeSchemas } from "@powerlines/schema/helpers";
|
|
7
6
|
import { joinPaths } from "@stryke/path/join";
|
|
8
7
|
import { isSetArray } from "@stryke/type-checks/is-set-array";
|
|
9
8
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
@@ -72,10 +71,9 @@ getDefaultSecretsTypeDefinition.__type = [
|
|
|
72
71
|
* 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.
|
|
73
72
|
*
|
|
74
73
|
* @param context - The plugin context
|
|
75
|
-
* @param options - The plugin options containing the environment variables and secrets type definitions to extract the schema from. If not provided, the default type definitions will be used.
|
|
76
74
|
* @returns A promise that resolves when the schema has been extracted and stored in the plugin context.
|
|
77
75
|
*/
|
|
78
|
-
async function extractEnvSchema(context
|
|
76
|
+
async function extractEnvSchema(context) {
|
|
79
77
|
const defaultVarsTypeDefinition = await getDefaultVarsTypeDefinition(context);
|
|
80
78
|
const defaultSecretsTypeDefinition = await getDefaultSecretsTypeDefinition(context);
|
|
81
79
|
const vars = await extract(context, context.config.env.vars);
|
|
@@ -94,7 +92,7 @@ async function extractEnvSchema(context, options = {}) {
|
|
|
94
92
|
const properties = getProperties$1(context.env.vars);
|
|
95
93
|
context.info({
|
|
96
94
|
meta: { category: "env" },
|
|
97
|
-
message: `Environment Variables configuration: ${
|
|
95
|
+
message: `Environment Variables configuration: ${context.config.env.vars ? "" : "Defaulted "}${context.env.vars.variant === "reflection" ? "Deepkit type definition" : context.env.vars.variant === "json-schema" ? "JSON Schema" : context.env.vars.variant === "standard-schema" ? "Standard Schema" : context.env.vars.variant === "zod3" ? "Zod v3 schema" : "Typescript exported type"}${context.config.env.vars ? " from plugin options" : ""} provided ${Object.keys(properties).length} parameters\nEnvironment Secret configuration: ${context.config.env.secrets ? "" : "Defaulted "}${context.env.secrets.variant === "reflection" ? "Deepkit type definition" : context.env.secrets.variant === "json-schema" ? "JSON Schema" : context.env.secrets.variant === "standard-schema" ? "Standard Schema" : context.env.secrets.variant === "zod3" ? "Zod v3 schema" : "Typescript exported type"}${context.config.env.secrets ? " from plugin options" : ""} provided ${context.env.secrets?.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"}`
|
|
98
96
|
});
|
|
99
97
|
const aliases = Object.fromEntries(Object.entries(properties).flatMap(__assignType(([key, prop]) => isSetArray(prop.metadata?.alias) ? prop.metadata?.alias?.map(__assignType((alias) => [alias, {
|
|
100
98
|
...prop,
|
|
@@ -147,12 +145,9 @@ async function extractEnvSchema(context, options = {}) {
|
|
|
147
145
|
}
|
|
148
146
|
extractEnvSchema.__type = [
|
|
149
147
|
"context",
|
|
150
|
-
() => __ΩEnvPluginOptions,
|
|
151
|
-
"options",
|
|
152
|
-
() => ({}),
|
|
153
148
|
"extractEnvSchema",
|
|
154
149
|
"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.",
|
|
155
|
-
"P\"2
|
|
150
|
+
"P\"2!$`/\"?#"
|
|
156
151
|
];
|
|
157
152
|
/**
|
|
158
153
|
* Reads the active environment variables and secrets from the plugin context's cache and stores them in the plugin context for use during the build process. This function should be called during the plugin's `buildStart` hook to ensure that the active environment variables and secrets are available before the build process begins.
|
|
@@ -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 { getCacheDirectory } from \"@powerlines/schema\";\nimport { extract } from \"@powerlines/schema/extract\";\nimport { getProperties, mergeSchemas } from \"@powerlines/schema/helpers\";\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, EnvPluginOptions, 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 * 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 * @param options - The plugin options containing the environment variables and secrets type definitions to extract the schema from. If not provided, the default type definitions will be used.\n * @returns A promise that resolves when the schema has been extracted and stored in the plugin context.\n */\nexport async function extractEnvSchema<TContext extends EnvPluginContext>(\n context: TContext,\n options: EnvPluginOptions = {}\n): Promise<void> {\n const defaultVarsTypeDefinition = await getDefaultVarsTypeDefinition(context);\n const defaultSecretsTypeDefinition =\n await getDefaultSecretsTypeDefinition(context);\n\n const vars = (await extract(context, context.config.env.vars)) as EnvSchema;\n if (\n (isString(context.config.env.vars) &&\n context.config.env.vars !==\n `${defaultVarsTypeDefinition.file}#${\n defaultVarsTypeDefinition.name\n }`) ||\n (isSetObject(context.config.env.vars) &&\n ((context.config.env.vars as TypeDefinition).file !==\n defaultVarsTypeDefinition.file ||\n (context.config.env.vars as TypeDefinition).name !==\n defaultVarsTypeDefinition.name))\n ) {\n vars.schema = mergeSchemas(\n vars,\n (await extract(context, defaultVarsTypeDefinition)) as EnvSchema\n );\n }\n\n const secrets = (await extract(\n context,\n context.config.env.secrets\n )) as EnvSchema;\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)) as EnvSchema\n );\n }\n\n context.env = defu(\n {\n vars,\n secrets,\n parsed: await loadEnv(context, context.config.env)\n },\n context.env ?? {},\n {\n parsed: {},\n injected: []\n }\n );\n await readActiveEnv(context);\n\n const properties = getProperties(context.env.vars);\n context.info({\n meta: {\n category: \"env\"\n },\n message: `Environment Variables configuration: ${\n options.vars ? \"\" : \"Defaulted \"\n }${\n context.env.vars.variant === \"reflection\"\n ? \"Deepkit type definition\"\n : context.env.vars.variant === \"json-schema\"\n ? \"JSON Schema\"\n : context.env.vars.variant === \"standard-schema\"\n ? \"Standard Schema\"\n : context.env.vars.variant === \"zod3\"\n ? \"Zod v3 schema\"\n : \"Typescript exported type\"\n }${options.vars ? \" from plugin options\" : \"\"} provided ${\n Object.keys(properties).length\n } parameters\\nEnvironment Secret configuration: ${\n options.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 }${options.secrets ? \" from plugin options\" : \"\"} provided ${\n context.env.secrets?.schema\n ? Object.keys(getProperties(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.metadata?.alias)\n ? prop.metadata?.alias?.map(alias => [\n alias,\n { ...prop, metadata: { ...prop.metadata, alias: [key] } }\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].metadata?.isRuntime) {\n if (\n properties[unprefixedKey].optional &&\n context.env.vars.schema.optionalProperties?.[unprefixedKey]\n ) {\n context.env.vars.schema.optionalProperties[unprefixedKey].metadata ??=\n {};\n context.env.vars.schema.optionalProperties[\n unprefixedKey\n ].metadata.default = value;\n } else if (context.env.vars.schema.properties?.[unprefixedKey]) {\n context.env.vars.schema.properties[unprefixedKey].metadata ??= {};\n context.env.vars.schema.properties[unprefixedKey].metadata.default =\n value;\n }\n }\n } else if (aliases[unprefixedKey]) {\n if (!aliases[unprefixedKey].metadata?.isRuntime) {\n const alias =\n aliases[unprefixedKey].metadata?.alias?.[0] ?? unprefixedKey;\n if (\n aliases[unprefixedKey].optional &&\n context.env.vars.schema.optionalProperties?.[alias]\n ) {\n context.env.vars.schema.optionalProperties[alias].metadata ??= {};\n context.env.vars.schema.optionalProperties[alias].metadata.default =\n value;\n } else if (context.env.vars.schema.properties?.[alias]) {\n context.env.vars.schema.properties[alias].metadata ??= {};\n context.env.vars.schema.properties[alias].metadata.default = value;\n }\n }\n }\n }\n}\n\n/**\n * Reads the active environment variables and secrets from the plugin context's cache and stores them in the plugin context for use during the build process. This function should be called during the plugin's `buildStart` hook to ensure that the active environment variables and secrets are available before the build process begins.\n *\n * @param context - The plugin context\n * @returns A promise that resolves when the active environment variables and secrets have been read and stored in the plugin context.\n */\nexport async function readActiveEnv<TContext extends EnvPluginContext>(\n context: TContext\n) {\n context.env.vars.active ??= [];\n if (\n context.fs.existsSync(\n joinPaths(getCacheDirectory(context), \"env\", \"vars.json\")\n )\n ) {\n const content = await context.fs.read(\n joinPaths(getCacheDirectory(context), \"env\", \"vars.json\")\n );\n if (content) {\n context.env.vars.active = JSON.parse(content)?.elements ?? [];\n }\n }\n\n context.env.secrets.active ??= [];\n if (\n context.fs.existsSync(\n joinPaths(getCacheDirectory(context), \"env\", \"secrets.json\")\n )\n ) {\n const content = await context.fs.read(\n joinPaths(getCacheDirectory(context), \"env\", \"secrets.json\")\n );\n if (content) {\n context.env.secrets.active = JSON.parse(content)?.elements ?? [];\n }\n }\n}\n\n/**\n * Writes the active environment variables and secrets from the plugin context to the plugin context's cache for use during the build process. This function should be called whenever the active environment variables and secrets are updated in the plugin context to ensure that the latest values are available during the build process.\n *\n * @param context - The plugin context\n * @returns A promise that resolves when the active environment variables and secrets have been written to the plugin context's cache.\n */\nexport async function writeActiveEnv<TContext extends EnvPluginContext>(\n context: TContext\n) {\n return Promise.all(\n [\n isSetArray(context.env.vars.active)\n ? context.fs.write(\n joinPaths(getCacheDirectory(context), \"env\", \"vars.json\"),\n JSON.stringify({\n elements: context.env.vars.active\n })\n )\n : undefined,\n isSetArray(context.env.secrets.active)\n ? context.fs.write(\n joinPaths(getCacheDirectory(context), \"env\", \"secrets.json\"),\n JSON.stringify({\n elements: context.env.secrets.active\n })\n )\n : undefined\n ].filter(Boolean) as Promise<void>[]\n );\n}\n"],"mappings":";;;;;;;;;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;CAE1B,OAAK;AACN;;;;;;;AAiCA,eAAmB,uBAAA,SAAA;CACjB,MAAA,WAAiB,MAAG,QAAQ,GAAM,QAAE,kCAAA;CACpC,IAAA,CAAK,UACH,MAAG,IAAA,MAAU,yJAAA;CAEf,OAAK;AACP;AACA,uBAAE,SAAA;CAAA;CAAA;CAAA;CAAA;AAAA;;;;;;;AAOF,eAAC,6BAAA,SAAA;CACC,OAAO;EACL,MAAA,MAAY,uBAAuB,OAAK;EAC1C,MAAA;CACF;AACA;AACA,6BAA6B,SAAC;CAAA;CAAgB;CAAA;CAAA;AAAA;;;;;;;CAO5C,OAAO;EACR,MAAA,MAAA,uBAAA,OAAA;EACG,MAAM;CACR;AACF;AACA,gCAAsB,SAAA;CAAA;CAA+B;CAAA;AAAA;;;;;;;;;;;AAWrD,eAAC,iBAAA,SAAA,UAAA,CAAA,GAAA;CACC,MAAE,4BAAA,MAAA,6BAAA,OAAA;CACF,MAAM,+BAA0B,MAAW,gCAAgC,OAAM;CACl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AAA;EACpB,IAAI,SACF,QAAQ,IAAC,QAAS,SAAM,KAAA,MAAA,OAAA,GAAA,YAAA,CAAA;CAE5B;AACF;AACA,cAAc,SAAS;CAAC;CAAW;CAAgB;CAAU;AAAA;;;;;;;AAO7D,eAAsB,eAAe,SAAM;CACzC,OAAO,QAAQ,IAAC,CAAA,WAAM,QAAA,IAAA,KAAA,MAAA,IAAA,QAAA,GAAA,MAAA,UAAA,kBAAA,OAAA,GAAA,OAAA,WAAA,GAAA,KAAA,UAAA,EACpB,UAAQ,QAAQ,IAAI,KAAO,OAC7B,CAAC,CAAC,IAAI,QAAO,WAAe,QAAA,IAAA,QAAA,MAAA,IAAA,QAAA,GAAA,MAAA,UAAA,kBAAA,OAAA,GAAA,OAAA,cAAA,GAAA,KAAA,UAAA,EAC1B,UAAU,QAAQ,IAAI,QAAQ,OAChC,CAAC,CAAC,IAAI,MAAS,EAAA,OAAO,OAAM,CAAA;AAC9B;AACA,eAAe,SAAS;CAAC;CAAO;CAAsB;CAAU;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 { getCacheDirectory } from \"@powerlines/schema\";\nimport { extract } from \"@powerlines/schema/extract\";\nimport {\n getProperties,\n getPropertiesList,\n mergeSchemas\n} from \"@powerlines/schema/helpers\";\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 * 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 extractEnvSchema<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 vars = (await extract(context, context.config.env.vars)) as EnvSchema;\n if (\n (isString(context.config.env.vars) &&\n context.config.env.vars !==\n `${defaultVarsTypeDefinition.file}#${\n defaultVarsTypeDefinition.name\n }`) ||\n (isSetObject(context.config.env.vars) &&\n ((context.config.env.vars as TypeDefinition).file !==\n defaultVarsTypeDefinition.file ||\n (context.config.env.vars as TypeDefinition).name !==\n defaultVarsTypeDefinition.name))\n ) {\n vars.schema = mergeSchemas(\n vars,\n (await extract(context, defaultVarsTypeDefinition)) as EnvSchema\n );\n }\n\n const secrets = (await extract(\n context,\n context.config.env.secrets\n )) as EnvSchema;\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)) as EnvSchema\n );\n }\n\n context.env = defu(\n {\n vars,\n secrets,\n parsed: await loadEnv(context, context.config.env)\n },\n context.env ?? {},\n {\n parsed: {},\n injected: []\n }\n );\n await readActiveEnv(context);\n\n const properties = getProperties(context.env.vars);\n context.info({\n meta: {\n category: \"env\"\n },\n message: `Environment Variables configuration: ${\n context.config.env.vars ? \"\" : \"Defaulted \"\n }${\n context.env.vars.variant === \"reflection\"\n ? \"Deepkit type definition\"\n : context.env.vars.variant === \"json-schema\"\n ? \"JSON Schema\"\n : context.env.vars.variant === \"standard-schema\"\n ? \"Standard Schema\"\n : context.env.vars.variant === \"zod3\"\n ? \"Zod v3 schema\"\n : \"Typescript exported type\"\n }${context.config.env.vars ? \" 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.metadata?.alias)\n ? prop.metadata?.alias?.map(alias => [\n alias,\n { ...prop, metadata: { ...prop.metadata, alias: [key] } }\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].metadata?.isRuntime) {\n if (\n properties[unprefixedKey].optional &&\n context.env.vars.schema.optionalProperties?.[unprefixedKey]\n ) {\n context.env.vars.schema.optionalProperties[unprefixedKey].metadata ??=\n {};\n context.env.vars.schema.optionalProperties[\n unprefixedKey\n ].metadata.default = value;\n } else if (context.env.vars.schema.properties?.[unprefixedKey]) {\n context.env.vars.schema.properties[unprefixedKey].metadata ??= {};\n context.env.vars.schema.properties[unprefixedKey].metadata.default =\n value;\n }\n }\n } else if (aliases[unprefixedKey]) {\n if (!aliases[unprefixedKey].metadata?.isRuntime) {\n const alias =\n aliases[unprefixedKey].metadata?.alias?.[0] ?? unprefixedKey;\n if (\n aliases[unprefixedKey].optional &&\n context.env.vars.schema.optionalProperties?.[alias]\n ) {\n context.env.vars.schema.optionalProperties[alias].metadata ??= {};\n context.env.vars.schema.optionalProperties[alias].metadata.default =\n value;\n } else if (context.env.vars.schema.properties?.[alias]) {\n context.env.vars.schema.properties[alias].metadata ??= {};\n context.env.vars.schema.properties[alias].metadata.default = value;\n }\n }\n }\n }\n}\n\n/**\n * Reads the active environment variables and secrets from the plugin context's cache and stores them in the plugin context for use during the build process. This function should be called during the plugin's `buildStart` hook to ensure that the active environment variables and secrets are available before the build process begins.\n *\n * @param context - The plugin context\n * @returns A promise that resolves when the active environment variables and secrets have been read and stored in the plugin context.\n */\nexport async function readActiveEnv<TContext extends EnvPluginContext>(\n context: TContext\n) {\n context.env.vars.active ??= [];\n if (\n context.fs.existsSync(\n joinPaths(getCacheDirectory(context), \"env\", \"vars.json\")\n )\n ) {\n const content = await context.fs.read(\n joinPaths(getCacheDirectory(context), \"env\", \"vars.json\")\n );\n if (content) {\n context.env.vars.active = JSON.parse(content)?.elements ?? [];\n }\n }\n\n context.env.secrets.active ??= [];\n if (\n context.fs.existsSync(\n joinPaths(getCacheDirectory(context), \"env\", \"secrets.json\")\n )\n ) {\n const content = await context.fs.read(\n joinPaths(getCacheDirectory(context), \"env\", \"secrets.json\")\n );\n if (content) {\n context.env.secrets.active = JSON.parse(content)?.elements ?? [];\n }\n }\n}\n\n/**\n * Writes the active environment variables and secrets from the plugin context to the plugin context's cache for use during the build process. This function should be called whenever the active environment variables and secrets are updated in the plugin context to ensure that the latest values are available during the build process.\n *\n * @param context - The plugin context\n * @returns A promise that resolves when the active environment variables and secrets have been written to the plugin context's cache.\n */\nexport async function writeActiveEnv<TContext extends EnvPluginContext>(\n context: TContext\n) {\n return Promise.all(\n [\n isSetArray(context.env.vars.active)\n ? context.fs.write(\n joinPaths(getCacheDirectory(context), \"env\", \"vars.json\"),\n JSON.stringify({\n elements: context.env.vars.active\n })\n )\n : undefined,\n isSetArray(context.env.secrets.active)\n ? context.fs.write(\n joinPaths(getCacheDirectory(context), \"env\", \"secrets.json\"),\n JSON.stringify({\n elements: context.env.secrets.active\n })\n )\n : undefined\n ].filter(Boolean) as Promise<void>[]\n );\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;CAE9B,OAAO;;;;;;;;AAkCT,eAAgB,uBAA6B,SAAQ;CACpD,MAAA,WAAA,MAAA,QAAA,GAAA,QAAA,kCAAA;CACC,IAAE,CAAA,UACA,MAAA,IAAQ,MAAI,yJAA0D;CAE1E,OAAO;AACP;AACA,uBAAsB,SAAQ;CAAA;CAAQ;CAAA;CAAA;AAAA;;;;;;;;CAQpC,OAAO;EACT,MAAA,MAAA,uBAAA,OAAA;;CAEE;AACF;AACA,6BAAC,SAAA;CAAA;CAAA;CAAA;CAAA;AAAA;;;;;;AAMD,eAAsB,gCAAwB,SAAA;CAC5C,OAAO;EACL,MAAM,MAAM,uBAAuB,OAAO;EAC1C,MAAM;CACR;AACF;;;;;;;;;;;;;;;AAWA,eAAgB,iBAAuB,SAAQ;CAC7C,MAAM,4BAAmB,MAAA,6BAAA,OAAA;CACzB,MAAC,+BAAA,MAAA,gCAAA,OAAA;CACH,MAAA,OAAA,MAAA,QAAA,SAAA,QAAA,OAAA,IAAA,IAAA;6TAEE,KAAA,SAAA,aAAA,MAAA,MAAA,QAAA,SAAA,yBAAA,CAAA;CAED,MAAA,UAAA,MAAA,QAAA,SAAA,QAAA,OAAA,IAAA,OAAA;CACC,IAAE,SAAA,QAAA,OAAA,IAAA,OAAA,KAAA,QAAA,OAAA,IAAA,YAAA,GAAA,6BAAA,KAAA,GAAA,6BAAA,UAAA,YAAA,QAAA,OAAA,IAAA,OAAA,MAAA,QAAA,OAAA,IAAA,QAAA,SAAA,6BAAA,QAAA,QAAA,OAAA,IAAA,Q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ACA,eAAY,SAAY;CAAA;CAAQ;CAAsB;CAAM;AAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -77,7 +77,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
77
77
|
},
|
|
78
78
|
configResolved: __assignType(async function configResolved() {
|
|
79
79
|
this.debug(`Environment plugin configuration has been resolved for the Powerlines project.`);
|
|
80
|
-
await require_helpers_schema.extractEnvSchema(this
|
|
80
|
+
await require_helpers_schema.extractEnvSchema(this);
|
|
81
81
|
}, ["configResolved", "P\"/!"]),
|
|
82
82
|
prepare: __assignType(async function prepare() {
|
|
83
83
|
const _self$ = this;
|
package/dist/index.mjs
CHANGED
|
@@ -72,7 +72,7 @@ const plugin = __assignType((options = {}) => {
|
|
|
72
72
|
},
|
|
73
73
|
configResolved: __assignType(async function configResolved() {
|
|
74
74
|
this.debug(`Environment plugin configuration has been resolved for the Powerlines project.`);
|
|
75
|
-
await extractEnvSchema(this
|
|
75
|
+
await extractEnvSchema(this);
|
|
76
76
|
}, ["configResolved", "P\"/!"]),
|
|
77
77
|
prepare: __assignType(async function prepare() {
|
|
78
78
|
const _self$ = this;
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"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 { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport { writeSchema } from \"@powerlines/schema/persistence\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport defu from \"defu\";\nimport type { Plugin, UnresolvedContext } from \"powerlines\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport {\n extractEnvSchema,\n getDefaultSecretsTypeDefinition,\n getDefaultVarsTypeDefinition\n} from \"./helpers/schema\";\nimport type { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n babel(options.babel),\n {\n name: \"env\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n ...options.babel,\n skipTransform: !options.inject,\n plugins: [envBabelPlugin]\n }\n };\n\n if (!config.env.vars) {\n this.warn(\n \"The `env.vars` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n config.env.vars = await getDefaultVarsTypeDefinition(\n this as UnresolvedContext\n );\n }\n\n if (!config.env.secrets) {\n config.env.secrets = await getDefaultSecretsTypeDefinition(\n this as UnresolvedContext\n );\n }\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n \"POWERLINES_\",\n this.config.framework?.name &&\n this.config.framework?.name !== \"powerlines\" &&\n `${constantCase(this.config.framework?.name)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = getUnique(\n toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[])\n );\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n await extractEnvSchema(this
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"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 { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport { writeSchema } from \"@powerlines/schema/persistence\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport defu from \"defu\";\nimport type { Plugin, UnresolvedContext } from \"powerlines\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport {\n extractEnvSchema,\n getDefaultSecretsTypeDefinition,\n getDefaultVarsTypeDefinition\n} from \"./helpers/schema\";\nimport type { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n babel(options.babel),\n {\n name: \"env\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n ...options.babel,\n skipTransform: !options.inject,\n plugins: [envBabelPlugin]\n }\n };\n\n if (!config.env.vars) {\n this.warn(\n \"The `env.vars` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n config.env.vars = await getDefaultVarsTypeDefinition(\n this as UnresolvedContext\n );\n }\n\n if (!config.env.secrets) {\n config.env.secrets = await getDefaultSecretsTypeDefinition(\n this as UnresolvedContext\n );\n }\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n \"POWERLINES_\",\n this.config.framework?.name &&\n this.config.framework?.name !== \"powerlines\" &&\n `${constantCase(this.config.framework?.name)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = getUnique(\n toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[])\n );\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n await extractEnvSchema(this);\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n return render(\n this,\n <EnvBuiltin defaultConfig={this.config.env.defaultConfig} />\n );\n },\n async docs() {\n this.debug(\n `Documenting environment variables configuration values in \"${joinPaths(\n getDocsOutputPath(this.config.root),\n \"env.md\"\n )}\"`\n );\n\n return render(this, <EnvDocsFile levelOffset={0} />);\n },\n async buildEnd() {\n this.debug(\"Writing active environment variables to disk.\");\n\n await writeSchema(this, this.env.vars);\n }\n },\n {\n name: \"env:automd-generator\",\n configResolved() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n env: env(this)\n }\n })\n };\n }\n },\n {\n name: \"env:vite\",\n vite: {\n configResolved(this: TContext) {\n return {\n envPrefix: this.config?.env?.prefix\n } as ViteUserConfig;\n }\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;CAEE,GAAG,SAAS;;AAEd;;;;AAqCA,MAAa,SAAS,cAAC,UAAA,CAAA,MAAA;;;;GAEvB,MAAQ;GACN,MAAA,SAAiB;IACf,KAAM,MAAA,wEAAgB;IACxB,MAAA,SAAA;KACF,KAAA,KAAA,SAAA;;MAEE,QAAA;MACG,QAAW,CAAA;KACd,CAAA;KACK,OAAM;MACH,GAAC,QAAA;MACN,eAAA,CAAA,QAAA;MACI,SAAA,CAAA,cAAA;KACL;IACA;IACE,IAAI,CAAC,OAAM,IAAA,MAAA;KACX,KAAM,KAAM,0FAAG;KACb,OAAK,IAAK,OAAA,MAAA,6BAAA,IAAA;IACZ;IACA,IAAG,CAAA,OAAA,IAAA;IAGH,OAAO,IAAE,SAAK,QAAS,OAAA,IAAA,UAAA,CAAA,CAAA,EAAA,OAAA,cAAA,KAAA,WAAA;KACrB,MAAI,kBAAe,aAAA,MAAA;KACnB,IAAI,CAAA,IAAA,SAAa,eAAA,GACf,IAAE,KAAO,eAAE;KAEb,OAAO;IACT,GAAG;KAAC;KAAK;KAAQ;KAAK;IAAA,CAAA,GAAA,CAAA,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A,SAAA,iBAAA;IACd,OAAO,EACN,WAAA,KAAA,QAAA,KAAA;GAEH,GAAE;IAAA;IAAa;IAAA;IAAA;GAAA,CAAA,EACjB;EACF;EAAG,OAAO,QAAA,MAAc;CAAC;AAC3B,GAAG;CAAC;CAAc;QAAA,CAAA;CAAA;CAAA;AAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.240",
|
|
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.5",
|
|
109
109
|
"@babel/types": "8.0.0-rc.5",
|
|
110
|
-
"@powerlines/core": "^0.15.
|
|
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.15.24",
|
|
111
|
+
"@powerlines/plugin-alloy": "^0.26.132",
|
|
112
|
+
"@powerlines/plugin-automd": "^0.1.508",
|
|
113
|
+
"@powerlines/plugin-babel": "^0.13.43",
|
|
114
|
+
"@powerlines/plugin-plugin": "^0.12.459",
|
|
115
|
+
"@powerlines/schema": "^0.11.27",
|
|
116
116
|
"@storm-software/config-tools": "^1.190.20",
|
|
117
117
|
"@stryke/capnp": "^0.12.102",
|
|
118
118
|
"@stryke/convert": "^0.7.7",
|
|
@@ -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.47"
|
|
131
131
|
},
|
|
132
132
|
"devDependencies": { "@types/node": "^25.9.0", "vite": "^8.0.13" },
|
|
133
133
|
"publishConfig": { "access": "public" },
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "fa8c4ae579471be5f678883ecb35d00ea17c29ba"
|
|
135
135
|
}
|