@powerlines/plugin-env 0.16.203 → 0.16.205
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 +1 -1
- package/dist/helpers/load.d.mts +1 -1
- package/dist/helpers/persistence.cjs +4 -3
- package/dist/helpers/persistence.d.cts +6 -6
- package/dist/helpers/persistence.d.cts.map +1 -1
- package/dist/helpers/persistence.d.mts +6 -6
- package/dist/helpers/persistence.d.mts.map +1 -1
- package/dist/helpers/persistence.mjs +4 -3
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
package/dist/helpers/load.d.cts
CHANGED
|
@@ -20,7 +20,7 @@ declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvPar
|
|
|
20
20
|
RELEASE_TAG: string;
|
|
21
21
|
DEFAULT_LOCALE: string | undefined;
|
|
22
22
|
DEFAULT_TIMEZONE: string | undefined;
|
|
23
|
-
LOG_LEVEL: "
|
|
23
|
+
LOG_LEVEL: "silent" | "error" | "warn" | "info" | "debug";
|
|
24
24
|
ERROR_URL: string | undefined;
|
|
25
25
|
ORGANIZATION: string | undefined;
|
|
26
26
|
PLATFORM: "node" | "browser" | "neutral";
|
package/dist/helpers/load.d.mts
CHANGED
|
@@ -20,7 +20,7 @@ declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvPar
|
|
|
20
20
|
RELEASE_TAG: string;
|
|
21
21
|
DEFAULT_LOCALE: string | undefined;
|
|
22
22
|
DEFAULT_TIMEZONE: string | undefined;
|
|
23
|
-
LOG_LEVEL: "
|
|
23
|
+
LOG_LEVEL: "silent" | "error" | "warn" | "info" | "debug";
|
|
24
24
|
ERROR_URL: string | undefined;
|
|
25
25
|
ORGANIZATION: string | undefined;
|
|
26
26
|
PLATFORM: "node" | "browser" | "neutral";
|
|
@@ -47,7 +47,7 @@ getEnvDefaultTypeDefinition.__type = [
|
|
|
47
47
|
"context",
|
|
48
48
|
"getEnvDefaultTypeDefinition",
|
|
49
49
|
"Gets the default type definition for the environment variables.",
|
|
50
|
-
"P
|
|
50
|
+
"P\"2!!`/\"?#"
|
|
51
51
|
];
|
|
52
52
|
/** Gets the default type definition for the environment secrets.
|
|
53
53
|
*
|
|
@@ -63,7 +63,7 @@ async function getSecretsDefaultTypeDefinition(context) {
|
|
|
63
63
|
getSecretsDefaultTypeDefinition.__type = [
|
|
64
64
|
"context",
|
|
65
65
|
"getSecretsDefaultTypeDefinition",
|
|
66
|
-
"P
|
|
66
|
+
"P\"2!!`/\""
|
|
67
67
|
];
|
|
68
68
|
/**
|
|
69
69
|
* Gets the path to the environment type reflections.
|
|
@@ -76,13 +76,14 @@ function getEnvTypeReflectionsPath(context, name = "env") {
|
|
|
76
76
|
return (0, _stryke_path_join_paths.joinPaths)((0, _powerlines_deepkit_resolve_reflections.getReflectionsPath)(context), "env", `${name}-types.bin`);
|
|
77
77
|
}
|
|
78
78
|
getEnvTypeReflectionsPath.__type = [
|
|
79
|
+
() => require_types_plugin.__ΩEnvPluginContext,
|
|
79
80
|
"context",
|
|
80
81
|
() => require_types_plugin.__ΩEnvType,
|
|
81
82
|
"name",
|
|
82
83
|
() => "env",
|
|
83
84
|
"getEnvTypeReflectionsPath",
|
|
84
85
|
"Gets the path to the environment type reflections.",
|
|
85
|
-
"
|
|
86
|
+
"Pn!2\"n#2$>%&/&?'"
|
|
86
87
|
];
|
|
87
88
|
/**
|
|
88
89
|
* Reads the environment type reflection from the file system.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EnvPluginContext,
|
|
2
|
-
import {
|
|
1
|
+
import { EnvPluginContext, EnvType } from "../types/plugin.cjs";
|
|
2
|
+
import { UnresolvedContext } from "powerlines";
|
|
3
3
|
import { TypeDefinition } from "@stryke/types/configuration";
|
|
4
4
|
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
5
5
|
|
|
@@ -10,20 +10,20 @@ import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
|
10
10
|
* @param context - The plugin context.
|
|
11
11
|
* @returns The runtime type definition file for the environment variables.
|
|
12
12
|
*/
|
|
13
|
-
declare function resolveRuntimeTypeFile(context: UnresolvedContext
|
|
13
|
+
declare function resolveRuntimeTypeFile(context: UnresolvedContext): Promise<string>;
|
|
14
14
|
/**
|
|
15
15
|
* Gets the default type definition for the environment variables.
|
|
16
16
|
*
|
|
17
17
|
* @param context - The plugin context.
|
|
18
18
|
* @returns The default type definition for the environment variables.
|
|
19
19
|
*/
|
|
20
|
-
declare function getEnvDefaultTypeDefinition(context:
|
|
20
|
+
declare function getEnvDefaultTypeDefinition<TContext extends UnresolvedContext>(context: TContext): Promise<TypeDefinition>;
|
|
21
21
|
/** Gets the default type definition for the environment secrets.
|
|
22
22
|
*
|
|
23
23
|
* @param context - The plugin context.
|
|
24
24
|
* @returns The default type definition for the environment secrets.
|
|
25
25
|
*/
|
|
26
|
-
declare function getSecretsDefaultTypeDefinition(context:
|
|
26
|
+
declare function getSecretsDefaultTypeDefinition<TContext extends UnresolvedContext>(context: TContext): Promise<TypeDefinition>;
|
|
27
27
|
/**
|
|
28
28
|
* Gets the path to the environment type reflections.
|
|
29
29
|
*
|
|
@@ -31,7 +31,7 @@ declare function getSecretsDefaultTypeDefinition(context: UnresolvedContext<EnvP
|
|
|
31
31
|
* @param name - The name of the type reflections.
|
|
32
32
|
* @returns The path to the environment type reflections.
|
|
33
33
|
*/
|
|
34
|
-
declare function getEnvTypeReflectionsPath(context:
|
|
34
|
+
declare function getEnvTypeReflectionsPath(context: EnvPluginContext, name?: EnvType): string;
|
|
35
35
|
/**
|
|
36
36
|
* Reads the environment type reflection from the file system.
|
|
37
37
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.d.cts","names":[],"sources":["../../src/helpers/persistence.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"persistence.d.cts","names":[],"sources":["../../src/helpers/persistence.ts"],"mappings":";;;;;;;;AAgDA;;;;iBAAsB,sBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAA;;;;;AAiBH;;iBAAsB,2BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;;;;iBAYR,+BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;;;;;;iBAcd,yBAAA,CACd,OAAA,EAAS,gBAAA,EACT,IAAA,GAAM,OAAA;AAlBR;;;;;;;AAAA,iBA8BsB,qBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,IAAA,GAAM,OAAA,GACL,OAAA,CAAQ,eAAA;;;;;;;;iBAuCW,sBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA,GAAe,OAAA;AAAA,iBAeP,qBAAA,CACd,OAAA,EAAS,gBAAA,EACT,IAAA,EAAM,OAAA;AA5ER;;;;;;AAAA,iBAuFsB,iBAAA,CACpB,OAAA,EAAS,gBAAA,GACR,OAAA,CAAQ,eAAA;;;;AA3EX;;;iBAkIsB,qBAAA,CACpB,OAAA,EAAS,gBAAA,GACR,OAAA,CAAQ,eAAA;;;;;;;;iBA2DW,kBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA,GAAe,OAAA;;;;;;AAxJvB;;iBA8KgB,sBAAA,CACd,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EnvPluginContext,
|
|
1
|
+
import { EnvPluginContext, EnvType } from "../types/plugin.mjs";
|
|
2
2
|
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
3
|
-
import {
|
|
3
|
+
import { UnresolvedContext } from "powerlines";
|
|
4
4
|
import { TypeDefinition } from "@stryke/types/configuration";
|
|
5
5
|
|
|
6
6
|
//#region src/helpers/persistence.d.ts
|
|
@@ -10,20 +10,20 @@ import { TypeDefinition } from "@stryke/types/configuration";
|
|
|
10
10
|
* @param context - The plugin context.
|
|
11
11
|
* @returns The runtime type definition file for the environment variables.
|
|
12
12
|
*/
|
|
13
|
-
declare function resolveRuntimeTypeFile(context: UnresolvedContext
|
|
13
|
+
declare function resolveRuntimeTypeFile(context: UnresolvedContext): Promise<string>;
|
|
14
14
|
/**
|
|
15
15
|
* Gets the default type definition for the environment variables.
|
|
16
16
|
*
|
|
17
17
|
* @param context - The plugin context.
|
|
18
18
|
* @returns The default type definition for the environment variables.
|
|
19
19
|
*/
|
|
20
|
-
declare function getEnvDefaultTypeDefinition(context:
|
|
20
|
+
declare function getEnvDefaultTypeDefinition<TContext extends UnresolvedContext>(context: TContext): Promise<TypeDefinition>;
|
|
21
21
|
/** Gets the default type definition for the environment secrets.
|
|
22
22
|
*
|
|
23
23
|
* @param context - The plugin context.
|
|
24
24
|
* @returns The default type definition for the environment secrets.
|
|
25
25
|
*/
|
|
26
|
-
declare function getSecretsDefaultTypeDefinition(context:
|
|
26
|
+
declare function getSecretsDefaultTypeDefinition<TContext extends UnresolvedContext>(context: TContext): Promise<TypeDefinition>;
|
|
27
27
|
/**
|
|
28
28
|
* Gets the path to the environment type reflections.
|
|
29
29
|
*
|
|
@@ -31,7 +31,7 @@ declare function getSecretsDefaultTypeDefinition(context: UnresolvedContext<EnvP
|
|
|
31
31
|
* @param name - The name of the type reflections.
|
|
32
32
|
* @returns The path to the environment type reflections.
|
|
33
33
|
*/
|
|
34
|
-
declare function getEnvTypeReflectionsPath(context:
|
|
34
|
+
declare function getEnvTypeReflectionsPath(context: EnvPluginContext, name?: EnvType): string;
|
|
35
35
|
/**
|
|
36
36
|
* Reads the environment type reflection from the file system.
|
|
37
37
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.d.mts","names":[],"sources":["../../src/helpers/persistence.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"persistence.d.mts","names":[],"sources":["../../src/helpers/persistence.ts"],"mappings":";;;;;;;;AAgDA;;;;iBAAsB,sBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAA;;;;;AAiBH;;iBAAsB,2BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;;;;iBAYR,+BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;;;;;;iBAcd,yBAAA,CACd,OAAA,EAAS,gBAAA,EACT,IAAA,GAAM,OAAA;AAlBR;;;;;;;AAAA,iBA8BsB,qBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,IAAA,GAAM,OAAA,GACL,OAAA,CAAQ,eAAA;;;;;;;;iBAuCW,sBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA,GAAe,OAAA;AAAA,iBAeP,qBAAA,CACd,OAAA,EAAS,gBAAA,EACT,IAAA,EAAM,OAAA;AA5ER;;;;;;AAAA,iBAuFsB,iBAAA,CACpB,OAAA,EAAS,gBAAA,GACR,OAAA,CAAQ,eAAA;;;;AA3EX;;;iBAkIsB,qBAAA,CACpB,OAAA,EAAS,gBAAA,GACR,OAAA,CAAQ,eAAA;;;;;;;;iBA2DW,kBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA,GAAe,OAAA;;;;;;AAxJvB;;iBA8KgB,sBAAA,CACd,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA"}
|
|
@@ -44,7 +44,7 @@ getEnvDefaultTypeDefinition.__type = [
|
|
|
44
44
|
"context",
|
|
45
45
|
"getEnvDefaultTypeDefinition",
|
|
46
46
|
"Gets the default type definition for the environment variables.",
|
|
47
|
-
"P
|
|
47
|
+
"P\"2!!`/\"?#"
|
|
48
48
|
];
|
|
49
49
|
/** Gets the default type definition for the environment secrets.
|
|
50
50
|
*
|
|
@@ -60,7 +60,7 @@ async function getSecretsDefaultTypeDefinition(context) {
|
|
|
60
60
|
getSecretsDefaultTypeDefinition.__type = [
|
|
61
61
|
"context",
|
|
62
62
|
"getSecretsDefaultTypeDefinition",
|
|
63
|
-
"P
|
|
63
|
+
"P\"2!!`/\""
|
|
64
64
|
];
|
|
65
65
|
/**
|
|
66
66
|
* Gets the path to the environment type reflections.
|
|
@@ -73,13 +73,14 @@ function getEnvTypeReflectionsPath(context, name = "env") {
|
|
|
73
73
|
return joinPaths(getReflectionsPath(context), "env", `${name}-types.bin`);
|
|
74
74
|
}
|
|
75
75
|
getEnvTypeReflectionsPath.__type = [
|
|
76
|
+
() => __ΩEnvPluginContext,
|
|
76
77
|
"context",
|
|
77
78
|
() => __ΩEnvType,
|
|
78
79
|
"name",
|
|
79
80
|
() => "env",
|
|
80
81
|
"getEnvTypeReflectionsPath",
|
|
81
82
|
"Gets the path to the environment type reflections.",
|
|
82
|
-
"
|
|
83
|
+
"Pn!2\"n#2$>%&/&?'"
|
|
83
84
|
];
|
|
84
85
|
/**
|
|
85
86
|
* Reads the environment type reflection from the file system.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.mjs","names":[],"sources":["../../src/helpers/persistence.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 { convertFromCapnp, convertToCapnp } from \"@powerlines/deepkit/capnp\";\nimport { getReflectionsPath } from \"@powerlines/deepkit/resolve-reflections\";\nimport { SerializedTypes } from \"@powerlines/deepkit/schemas/reflection\";\nimport { Reflection } from \"@powerlines/deepkit/types\";\nimport {\n deserializeType,\n ReflectionClass,\n ReflectionKind,\n resolveClassType\n} from \"@powerlines/deepkit/vendor/type\";\nimport * as capnp from \"@stryke/capnp\";\nimport {\n readFileBuffer,\n writeFileBuffer,\n writeFileBufferSync\n} from \"@stryke/fs/buffer\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isEmptyObject } from \"@stryke/type-checks/is-empty-object\";\nimport type { TypeDefinition } from \"@stryke/types/configuration\";\nimport { existsSync } from \"node:fs\";\nimport { Context, UnresolvedContext } from \"powerlines\";\nimport {\n EnvPluginContext,\n EnvPluginResolvedConfig,\n EnvType\n} from \"../types/plugin\";\nimport { createEnvReflection } from \"./reflect\";\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 context: UnresolvedContext<EnvPluginResolvedConfig>\n): 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 getEnvDefaultTypeDefinition(\n context: UnresolvedContext<EnvPluginResolvedConfig>\n): 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 getSecretsDefaultTypeDefinition(\n context: UnresolvedContext<EnvPluginResolvedConfig>\n): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"SecretsInterface\"\n };\n}\n\n/**\n * Gets the path to the environment type reflections.\n *\n * @param context - The plugin context.\n * @param name - The name of the type reflections.\n * @returns The path to the environment type reflections.\n */\nexport function getEnvTypeReflectionsPath(\n context: Context<EnvPluginResolvedConfig>,\n name: EnvType = \"env\"\n): string {\n return joinPaths(getReflectionsPath(context), \"env\", `${name}-types.bin`);\n}\n\n/**\n * Reads the environment type reflection from the file system.\n *\n * @param context - The plugin context.\n * @param name - The name of the type reflections.\n * @returns The environment type reflection.\n */\nexport async function readEnvTypeReflection(\n context: EnvPluginContext,\n name: EnvType = \"env\"\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvTypeReflectionsPath(context, name);\n if (!existsSync(filePath)) {\n if (!context.env.types.env || isEmptyObject(context.env.types.env)) {\n const reflection = createEnvReflection(context) as Reflection;\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.types.env = reflection;\n await writeEnvTypeReflection(context, context.env.types.env, name);\n }\n\n return context.env.types.env;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.types[name] = reflection;\n context.env.types[name].messageRoot = messageRoot;\n context.env.types[name].dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Writes the environment type reflection to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The environment type reflection to write.\n * @param name - The name of the type reflections.\n */\nexport async function writeEnvTypeReflection(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n await writeFileBuffer(\n getEnvTypeReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n\nexport function getEnvReflectionsPath(\n context: EnvPluginContext,\n name: EnvType\n): string {\n return joinPaths(getReflectionsPath(context), \"env\", `${name}.bin`);\n}\n\n/**\n * Reads the environment reflection data from the file system.\n *\n * @param context - The plugin context.\n * @returns The environment reflection data.\n */\nexport async function readEnvReflection(\n context: EnvPluginContext\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvReflectionsPath(context, \"env\");\n if (!existsSync(filePath)) {\n if (!context.env.types.env) {\n context.env.types.env = await readEnvTypeReflection(context, \"env\");\n }\n\n if (!context.env.used.env || isEmptyObject(context.env.used.env)) {\n const reflection = createEnvReflection(context, {\n type: {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters that are used (at least once) by the ${\n context.config.name\n ? `${context.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n superReflection: context.env.types.env\n }) as Reflection;\n reflection.name = \"Env\";\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.used.env = reflection;\n await writeEnvReflection(context, context.env.used.env, \"env\");\n }\n\n return context.env.used.env;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.used.env = reflection;\n context.env.used.env.messageRoot = messageRoot;\n context.env.used.env.dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Reads the secret environment reflection data from the file system.\n *\n * @param context - The plugin context.\n * @returns The environment reflection data.\n */\nexport async function readSecretsReflection(\n context: EnvPluginContext\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvReflectionsPath(context, \"secrets\");\n if (!existsSync(filePath)) {\n if (!context.env.types.secrets) {\n context.env.types.secrets = await readEnvTypeReflection(\n context,\n \"secrets\"\n );\n }\n\n if (!context.env.used.secrets || isEmptyObject(context.env.used.secrets)) {\n const reflection = createEnvReflection(context, {\n type: {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters that are used (at least once) by the ${\n context.config.name\n ? `${context.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n superReflection: context.env.types.secrets\n }) as Reflection;\n reflection.name = \"Secrets\";\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.used.secrets = reflection;\n await writeEnvReflection(context, context.env.used.secrets, \"secrets\");\n }\n\n return context.env.used.secrets;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.used.secrets = reflection;\n context.env.used.secrets.messageRoot = messageRoot;\n context.env.used.secrets.dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Writes the environment reflection data to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The reflection data to write.\n * @param name - The name of the reflection (either \"env\" or \"secrets\").\n */\nexport async function writeEnvReflection(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n await writeFileBuffer(\n getEnvReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n\n/**\n * Writes the environment reflection data to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The reflection data to write.\n * @param name - The name of the reflection (either \"env\" or \"secrets\").\n */\nexport function writeEnvReflectionSync(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n writeFileBufferSync(\n getEnvReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,eAAsB,uBAAc,SAAA;CACpC,MAAQ,WAAU,MAAA,QAAA,GAAkB,QAAQ,mCAAW;AACvD,KAAM,CAAC,SACL,OAAA,IAAA,MAAgB,0JAAA;AAEhB,QAAA;;AAEF,uBAAS,SAAsB;CAAA;CAAQ;CAAQ;CAAA;CAAA;;;;;;;AAO/C,eAAE,4BAAA,SAAA;AACF,QAAO;EACL,MAAQ,MAAC,uBAAkB,QAAA;EAC1B,MAAO;EACR;;AAEF,4BAAmB,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;AAMnB,eAAA,gCAAA,SAAA;;EAEE,MAAA,MAAA,uBAAA,QAAA;EACC,MAAK;EACP;;AAED,gCAA6B,SAAW;CAAA;CAAQ;CAAqB;CAAA;;;;;;;;AAQrE,SAAG,0BAAA,SAAA,OAAA,OAAA;AACH,QAAA,UAAA,mBAAA,QAAA,EAAA,OAAA,GAAA,KAAA,YAAA;;AAEA,0BAA0B,SAAA;CAAU;OAAS;CAAmB;OAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAQhE,eAAS,sBAAA,SAAA,OAAA,OAAA;CACP,MAAM,WAAQ,0BAAuB,SAAQ,KAAA;AAC7C,KAAE,CAAA,WAAO,SAAgB,EAAA;AACxB,MAAA,CAAA,QAAA,IAAA,MAAA,OAAA,cAAA,QAAA,IAAA,MAAA,IAAA,EAAA;GACH,MAAA,aAAA,oBAAA,QAAA;;AAEE,cAAA,cAAA,QAAA,SAAA,gBAAA;AACC,cAAc,aAAO,QAAY,eAAgB;AACnD,WAAA,IAAA,MAAA,MAAA;AACG,SAAM,uBAAqB,SAAO,QAAA,IAAA,MAAA,KAAA,KAAA;;AAElC,SAAO,QAA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AAQ,QAAA,cAAA;AAChB,SAAO,IAAA,KAAA,QAAA,aAAA;AACP,QAAM;;AAER,sBAAsB,SAAO;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAQ7B,eAAI,mBAAA,SAAA,YAAA,OAAA,OAAA;;CAEF,MAAE,UAAc,IAAI,MAAM,SAAG;4BAC7B,QAAA,SAAA;AAEA,OAAM,gBAAe,sBAAuB,SAAC,KAAA,EAAA,QAAA,eAAA,CAAA;;AAE/C,mBAAmB,SAAG;OAAQ;CAAwB;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAQtD,SAAc,uBAAsB,SAAM,YAAA,OAAA,OAAA;;CAExC,MAAM,UAAC,IAAU,MAAA,SAAA;4BACnB,QAAA,SAAA;AAEE,qBAAA,sBAAA,SAAA,KAAA,EAAA,QAAA,eAAA,CAAA;;AAEF,uBAAC,SAAA;OAAA;CAAA;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
1
|
+
{"version":3,"file":"persistence.mjs","names":[],"sources":["../../src/helpers/persistence.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 { convertFromCapnp, convertToCapnp } from \"@powerlines/deepkit/capnp\";\nimport { getReflectionsPath } from \"@powerlines/deepkit/resolve-reflections\";\nimport { SerializedTypes } from \"@powerlines/deepkit/schemas/reflection\";\nimport { Reflection } from \"@powerlines/deepkit/types\";\nimport {\n deserializeType,\n ReflectionClass,\n ReflectionKind,\n resolveClassType\n} from \"@powerlines/deepkit/vendor/type\";\nimport * as capnp from \"@stryke/capnp\";\nimport {\n readFileBuffer,\n writeFileBuffer,\n writeFileBufferSync\n} from \"@stryke/fs/buffer\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isEmptyObject } from \"@stryke/type-checks/is-empty-object\";\nimport type { TypeDefinition } from \"@stryke/types/configuration\";\nimport { existsSync } from \"node:fs\";\nimport { UnresolvedContext } from \"powerlines\";\nimport { EnvPluginContext, EnvType } from \"../types/plugin\";\nimport { createEnvReflection } from \"./reflect\";\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 context: UnresolvedContext\n): 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 getEnvDefaultTypeDefinition<\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 getSecretsDefaultTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"SecretsInterface\"\n };\n}\n\n/**\n * Gets the path to the environment type reflections.\n *\n * @param context - The plugin context.\n * @param name - The name of the type reflections.\n * @returns The path to the environment type reflections.\n */\nexport function getEnvTypeReflectionsPath(\n context: EnvPluginContext,\n name: EnvType = \"env\"\n): string {\n return joinPaths(getReflectionsPath(context), \"env\", `${name}-types.bin`);\n}\n\n/**\n * Reads the environment type reflection from the file system.\n *\n * @param context - The plugin context.\n * @param name - The name of the type reflections.\n * @returns The environment type reflection.\n */\nexport async function readEnvTypeReflection(\n context: EnvPluginContext,\n name: EnvType = \"env\"\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvTypeReflectionsPath(context, name);\n if (!existsSync(filePath)) {\n if (!context.env.types.env || isEmptyObject(context.env.types.env)) {\n const reflection = createEnvReflection(context) as Reflection;\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.types.env = reflection;\n await writeEnvTypeReflection(context, context.env.types.env, name);\n }\n\n return context.env.types.env;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.types[name] = reflection;\n context.env.types[name].messageRoot = messageRoot;\n context.env.types[name].dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Writes the environment type reflection to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The environment type reflection to write.\n * @param name - The name of the type reflections.\n */\nexport async function writeEnvTypeReflection(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n await writeFileBuffer(\n getEnvTypeReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n\nexport function getEnvReflectionsPath(\n context: EnvPluginContext,\n name: EnvType\n): string {\n return joinPaths(getReflectionsPath(context), \"env\", `${name}.bin`);\n}\n\n/**\n * Reads the environment reflection data from the file system.\n *\n * @param context - The plugin context.\n * @returns The environment reflection data.\n */\nexport async function readEnvReflection(\n context: EnvPluginContext\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvReflectionsPath(context, \"env\");\n if (!existsSync(filePath)) {\n if (!context.env.types.env) {\n context.env.types.env = await readEnvTypeReflection(context, \"env\");\n }\n\n if (!context.env.used.env || isEmptyObject(context.env.used.env)) {\n const reflection = createEnvReflection(context, {\n type: {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters that are used (at least once) by the ${\n context.config.name\n ? `${context.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n superReflection: context.env.types.env\n }) as Reflection;\n reflection.name = \"Env\";\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.used.env = reflection;\n await writeEnvReflection(context, context.env.used.env, \"env\");\n }\n\n return context.env.used.env;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.used.env = reflection;\n context.env.used.env.messageRoot = messageRoot;\n context.env.used.env.dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Reads the secret environment reflection data from the file system.\n *\n * @param context - The plugin context.\n * @returns The environment reflection data.\n */\nexport async function readSecretsReflection(\n context: EnvPluginContext\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvReflectionsPath(context, \"secrets\");\n if (!existsSync(filePath)) {\n if (!context.env.types.secrets) {\n context.env.types.secrets = await readEnvTypeReflection(\n context,\n \"secrets\"\n );\n }\n\n if (!context.env.used.secrets || isEmptyObject(context.env.used.secrets)) {\n const reflection = createEnvReflection(context, {\n type: {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters that are used (at least once) by the ${\n context.config.name\n ? `${context.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n superReflection: context.env.types.secrets\n }) as Reflection;\n reflection.name = \"Secrets\";\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.used.secrets = reflection;\n await writeEnvReflection(context, context.env.used.secrets, \"secrets\");\n }\n\n return context.env.used.secrets;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.used.secrets = reflection;\n context.env.used.secrets.messageRoot = messageRoot;\n context.env.used.secrets.dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Writes the environment reflection data to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The reflection data to write.\n * @param name - The name of the reflection (either \"env\" or \"secrets\").\n */\nexport async function writeEnvReflection(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n await writeFileBuffer(\n getEnvReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n\n/**\n * Writes the environment reflection data to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The reflection data to write.\n * @param name - The name of the reflection (either \"env\" or \"secrets\").\n */\nexport function writeEnvReflectionSync(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n writeFileBufferSync(\n getEnvReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,eAAsB,uBAAc,SAAA;CACpC,MAAQ,WAAC,MAAA,QAAwB,GAAE,QAAA,mCAAW;AAC9C,KAAM,CAAC,SACP,OAAS,IAAA,MAAA,0JAAsC;AAE7C,QAAA;;AAEF,uBAAC,SAAA;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AA,WAAO,WAAA,OAAA,CAAA;AACpC,qBAAc,sBAA2B,SAAA,KAAA,EAAA,QAAA,eAAA,CAAA;;AAE3C,uBAAsB,SAAA;OAAA;CAAqB;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -277,9 +277,9 @@ const plugin = __assignType((options = {}) => {
|
|
|
277
277
|
},
|
|
278
278
|
{
|
|
279
279
|
name: "env:automd-generator",
|
|
280
|
-
|
|
280
|
+
configResolved: __assignType(function configResolved() {
|
|
281
281
|
return { automd: (0, defu.default)(options.automd ?? {}, { generators: { env: require_helpers_automd_generator.env(this) } }) };
|
|
282
|
-
}, ["
|
|
282
|
+
}, ["configResolved", "P\"/!"])
|
|
283
283
|
},
|
|
284
284
|
{
|
|
285
285
|
name: "env:vite",
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YAmEY,MAAA;IACR,GAAA,GAAM,gBAAA;EAAA;AAAA;;;;cAOG,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YAmEY,MAAA;IACR,GAAA,GAAM,gBAAA;EAAA;AAAA;;;;cAOG,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KAmeJ,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YAmEY,MAAA;IACR,GAAA,GAAM,gBAAA;EAAA;AAAA;;;;cAOG,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YAmEY,MAAA;IACR,GAAA,GAAM,gBAAA;EAAA;AAAA;;;;cAOG,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KAmeJ,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -271,9 +271,9 @@ const plugin = __assignType((options = {}) => {
|
|
|
271
271
|
},
|
|
272
272
|
{
|
|
273
273
|
name: "env:automd-generator",
|
|
274
|
-
|
|
274
|
+
configResolved: __assignType(function configResolved() {
|
|
275
275
|
return { automd: defu(options.automd ?? {}, { generators: { env: env(this) } }) };
|
|
276
|
-
}, ["
|
|
276
|
+
}, ["configResolved", "P\"/!"])
|
|
277
277
|
},
|
|
278
278
|
{
|
|
279
279
|
name: "env:vite",
|
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 {\n ReflectionClass,\n ReflectionKind\n} from \"@powerlines/deepkit/vendor/type\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport deepkit from \"@powerlines/plugin-deepkit\";\nimport { TypeScriptCompilerPluginUserConfig } from \"@powerlines/plugin-tsc\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport {\n createVirtualPrefixRegex,\n getDocsOutputPath\n} 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 { loadEnv } from \"./helpers/load\";\nimport {\n getEnvDefaultTypeDefinition,\n getEnvReflectionsPath,\n getEnvTypeReflectionsPath,\n getSecretsDefaultTypeDefinition,\n readEnvReflection,\n readEnvTypeReflection,\n readSecretsReflection,\n writeEnvReflection,\n writeEnvTypeReflection\n} from \"./helpers/persistence\";\nimport { reflectEnv, reflectSecrets } from \"./helpers/reflect\";\nimport { 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 deepkit({\n ...options.deepkit,\n reflection: \"default\",\n level: \"all\",\n filter: {}\n }),\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 types: {} as TypeDefinitionParameter,\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n ...options.babel,\n skipTransform: !options.inject,\n plugins: [envBabelPlugin]\n },\n deepkit: {\n reflection: \"default\",\n level: \"all\"\n },\n tsc: {} as TypeScriptCompilerPluginUserConfig[\"tsc\"]\n };\n\n if (\n !isSetString(config.env.types) &&\n !isSetString(config.env.types?.file)\n ) {\n this.warn(\n \"The `env.types` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n config.env.types = await getEnvDefaultTypeDefinition(this);\n }\n\n if (\n !isSetString(config.env.secrets) &&\n !isSetString(config.env.secrets?.file)\n ) {\n config.env.secrets = await getSecretsDefaultTypeDefinition(this);\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 config.tsc.filter = {\n id: {\n include: [\n createVirtualPrefixRegex(joinPaths(this.builtinsPath, \"env.ts\")),\n createVirtualPrefixRegex(\n `${this.config.framework?.name || \"powerlines\"}:env`\n )\n ]\n }\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 this.env = defu(\n {\n parsed: await loadEnv(this, this.config.env)\n },\n this.env ?? {},\n {\n types: {\n env: {}\n },\n used: {\n env: {},\n secrets: {}\n },\n parsed: {},\n injected: {}\n }\n );\n\n if (\n isSetString(this.config.env.types) ||\n (this.config.env.types && isSetString(this.config.env.types.file))\n ) {\n this.config.env.types = parseTypeDefinition(\n this.config.env.types\n ) as TypeDefinition;\n\n const file = await this.fs.resolve(this.config.env.types.file);\n if (file) {\n this.config.env.types.file = file;\n }\n }\n\n if (\n isSetString(this.config.env.secrets) ||\n (this.config.env.secrets && isSetString(this.config.env.secrets.file))\n ) {\n this.config.env.secrets = parseTypeDefinition(\n this.config.env.secrets\n )!;\n\n const file = await this.fs.resolve(this.config.env.secrets.file);\n if (file) {\n this.config.env.secrets.file = file;\n }\n }\n\n this.info({\n meta: {\n category: \"env\"\n },\n message: `Environment configuration definition file: ${\n this.config.env.types.file\n }${this.config.env.types.name ? `#${this.config.env.types.name}` : \"\"}${\n this.config.env.secrets\n ? `\\nSecrets configuration definition file: ${this.config.env.secrets?.file}${\n this.config.env.secrets?.name\n ? `#${this.config.env.secrets?.name}`\n : \"\"\n }`\n : \"\"\n }\\nEnvironment variable Prefixes: ${this.config.env.prefix.join(\", \")}\\nShould inject values: ${\n this.config.env.inject ? \"Yes\" : \"No\"\n }\\nShould validate configuration: ${\n this.config.env.validate ? \"Yes\" : \"No\"\n }`\n });\n\n if (\n this.config.command !== \"prepare\" &&\n !this.config.skipCache &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n existsSync(getEnvTypeReflectionsPath(this, \"env\"))\n ) {\n this.debug(\n `Skipping reflection initialization as the meta checksum has not changed.`\n );\n\n this.env.types.env = await readEnvTypeReflection(this, \"env\");\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameter definitions: \\n${this.env.types.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()}${\n prop.getAlias().length > 0\n ? ` (aliases: ${prop.getAlias().join(\", \")})`\n : \"\"\n }`\n )\n .join(\"\\n\")}`\n });\n\n if (existsSync(getEnvReflectionsPath(this, \"env\"))) {\n this.env.used.env = await readEnvReflection(this);\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameters used in project: \\n${this.env.used.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()}${\n prop.getAlias().length > 0\n ? ` (aliases: ${prop.getAlias().join(\", \")})`\n : \"\"\n }`\n )\n .join(\"\\n\")}`\n });\n }\n\n if (existsSync(getEnvTypeReflectionsPath(this, \"secrets\"))) {\n this.env.types.secrets = await readEnvTypeReflection(\n this,\n \"secrets\"\n );\n\n if (this.env.types.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameter definitions: \\n${this.env.types.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n }\n\n if (existsSync(getEnvReflectionsPath(this, \"secrets\"))) {\n this.env.used.secrets = await readSecretsReflection(this);\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameters used in project: \\n${this.env.used.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n }\n } else {\n this.debug(\n `Starting environment configuration reflection initialization.`\n );\n\n this.env.types.env = await reflectEnv(\n this,\n this.config.env.types?.file,\n this.config.env.types?.name\n );\n if (!this.env.types.env) {\n throw new Error(\n \"Failed to find the environment configuration type reflection in the context.\"\n );\n }\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameter definitions: \\n${this.env.types.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n\n await writeEnvTypeReflection(this, this.env.types.env, \"env\");\n\n this.env.types.secrets = await reflectSecrets(\n this,\n this.config.env.secrets?.file,\n this.config.env.secrets?.name\n );\n if (!this.env.types.secrets) {\n throw new Error(\n \"Failed to find the secrets configuration type reflection in the context.\"\n );\n }\n\n if (this.env.types.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameter definitions: \\n${this.env.types.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n\n await writeEnvTypeReflection(this, this.env.types.secrets, \"secrets\");\n\n this.info({\n meta: {\n category: \"env\"\n },\n message: `Resolved ${\n this.env.types.env.getProperties().length ?? 0\n } environment configuration parameters and ${\n this.env.types.secrets?.getProperties().length ?? 0\n } secret configuration parameters`\n });\n\n const envWithAlias = this.env.types.env\n .getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n Object.entries(await loadEnv(this, this.config.env)).forEach(\n ([key, value]) => {\n const unprefixedKey = this.config.env.prefix.reduce(\n (ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n },\n key\n );\n\n const aliasKey = envWithAlias.find(prop =>\n prop?.getAlias().reverse().includes(unprefixedKey)\n );\n if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) {\n this.env.types.env\n .getProperty(unprefixedKey)\n .setDefaultValue(value);\n }\n }\n );\n\n this.env.used.env = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.env\n );\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n\n if (this.env.types.secrets) {\n await writeEnvTypeReflection(\n this,\n this.env.types.secrets,\n \"secrets\"\n );\n\n this.env.used.secrets = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.secrets\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvBuiltin\n defaultConfig={this.config.env.defaultConfig}\n reflection={result}\n />\n );\n },\n transform: {\n order: \"post\",\n async handler() {\n if (this.env.used.env.getProperties().length > 0) {\n this.trace(\n `Persisting used environment configuration reflections to ${getEnvReflectionsPath(\n this,\n \"env\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.trace(\n `Persisting used secret configuration reflections to ${getEnvReflectionsPath(\n this,\n \"secrets\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\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 const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvDocsFile levelOffset={0} reflection={result} />\n );\n },\n async buildEnd() {\n const reflectionPath = getEnvReflectionsPath(this, \"env\");\n\n this.debug(`Writing env reflection types to ${reflectionPath}.`);\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n },\n {\n name: \"env:automd-generator\",\n config() {\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAI,aAAc,IAAM,MAAQ;AAC/B,IAAI,SAAK;AACT,QAAI;;;;;AA4CL,MAAE,SAAA,cAA2B,UAAA,EAAA,KAAA;AAC3B,QAAA;EAAA,QAAA;GACA,GAAA,QAAA;GACA,YAAA;GACA,OAAA;GACA,QAAA,EAAA;GACA,CAAA;EAAA,MAAA,QAAA,MAAqB;EAAA;GACrB,MAAA;GACA,MAAA,SAAA;AACI,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C,EACH;;GAEJ;EAAE;GACD,MAAM;GACN,MAAM,EACJ,gBAAgB,aAAA,SAAA,iBAAA;AACd,WAAK,uCAEJ;MACA;UAAK;IAAW;IAAA;IAAA;IAAA,CAAA,EACpB;GACF;EAAE,OAAO,QAAM,OAAS;EAAC;GACzB;OAAO;CAAO;QAAA,EAAA;CAAA;CAAA;CAAA,CAAA"}
|
|
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 {\n ReflectionClass,\n ReflectionKind\n} from \"@powerlines/deepkit/vendor/type\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport deepkit from \"@powerlines/plugin-deepkit\";\nimport { TypeScriptCompilerPluginUserConfig } from \"@powerlines/plugin-tsc\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport type { Plugin, UnresolvedContext } from \"powerlines\";\nimport {\n createVirtualPrefixRegex,\n getDocsOutputPath\n} 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 { loadEnv } from \"./helpers/load\";\nimport {\n getEnvDefaultTypeDefinition,\n getEnvReflectionsPath,\n getEnvTypeReflectionsPath,\n getSecretsDefaultTypeDefinition,\n readEnvReflection,\n readEnvTypeReflection,\n readSecretsReflection,\n writeEnvReflection,\n writeEnvTypeReflection\n} from \"./helpers/persistence\";\nimport { reflectEnv, reflectSecrets } from \"./helpers/reflect\";\nimport { 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 deepkit({\n ...options.deepkit,\n reflection: \"default\",\n level: \"all\",\n filter: {}\n }),\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 types: {} as TypeDefinitionParameter,\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n ...options.babel,\n skipTransform: !options.inject,\n plugins: [envBabelPlugin]\n },\n deepkit: {\n reflection: \"default\",\n level: \"all\"\n },\n tsc: {} as TypeScriptCompilerPluginUserConfig[\"tsc\"]\n };\n\n if (\n !isSetString(config.env.types) &&\n !isSetString(config.env.types?.file)\n ) {\n this.warn(\n \"The `env.types` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n config.env.types = await getEnvDefaultTypeDefinition(\n this as UnresolvedContext\n );\n }\n\n if (\n !isSetString(config.env.secrets) &&\n !isSetString(config.env.secrets?.file)\n ) {\n config.env.secrets = await getSecretsDefaultTypeDefinition(\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 config.tsc.filter = {\n id: {\n include: [\n createVirtualPrefixRegex(joinPaths(this.builtinsPath, \"env.ts\")),\n createVirtualPrefixRegex(\n `${this.config.framework?.name || \"powerlines\"}:env`\n )\n ]\n }\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 this.env = defu(\n {\n parsed: await loadEnv(this, this.config.env)\n },\n this.env ?? {},\n {\n types: {\n env: {}\n },\n used: {\n env: {},\n secrets: {}\n },\n parsed: {},\n injected: {}\n }\n );\n\n if (\n isSetString(this.config.env.types) ||\n (this.config.env.types && isSetString(this.config.env.types.file))\n ) {\n this.config.env.types = parseTypeDefinition(\n this.config.env.types\n ) as TypeDefinition;\n\n const file = await this.fs.resolve(this.config.env.types.file);\n if (file) {\n this.config.env.types.file = file;\n }\n }\n\n if (\n isSetString(this.config.env.secrets) ||\n (this.config.env.secrets && isSetString(this.config.env.secrets.file))\n ) {\n this.config.env.secrets = parseTypeDefinition(\n this.config.env.secrets\n )!;\n\n const file = await this.fs.resolve(this.config.env.secrets.file);\n if (file) {\n this.config.env.secrets.file = file;\n }\n }\n\n this.info({\n meta: {\n category: \"env\"\n },\n message: `Environment configuration definition file: ${\n this.config.env.types.file\n }${this.config.env.types.name ? `#${this.config.env.types.name}` : \"\"}${\n this.config.env.secrets\n ? `\\nSecrets configuration definition file: ${this.config.env.secrets?.file}${\n this.config.env.secrets?.name\n ? `#${this.config.env.secrets?.name}`\n : \"\"\n }`\n : \"\"\n }\\nEnvironment variable Prefixes: ${this.config.env.prefix.join(\", \")}\\nShould inject values: ${\n this.config.env.inject ? \"Yes\" : \"No\"\n }\\nShould validate configuration: ${\n this.config.env.validate ? \"Yes\" : \"No\"\n }`\n });\n\n if (\n this.config.command !== \"prepare\" &&\n !this.config.skipCache &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n existsSync(getEnvTypeReflectionsPath(this, \"env\"))\n ) {\n this.debug(\n `Skipping reflection initialization as the meta checksum has not changed.`\n );\n\n this.env.types.env = await readEnvTypeReflection(this, \"env\");\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameter definitions: \\n${this.env.types.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()}${\n prop.getAlias().length > 0\n ? ` (aliases: ${prop.getAlias().join(\", \")})`\n : \"\"\n }`\n )\n .join(\"\\n\")}`\n });\n\n if (existsSync(getEnvReflectionsPath(this, \"env\"))) {\n this.env.used.env = await readEnvReflection(this);\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameters used in project: \\n${this.env.used.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()}${\n prop.getAlias().length > 0\n ? ` (aliases: ${prop.getAlias().join(\", \")})`\n : \"\"\n }`\n )\n .join(\"\\n\")}`\n });\n }\n\n if (existsSync(getEnvTypeReflectionsPath(this, \"secrets\"))) {\n this.env.types.secrets = await readEnvTypeReflection(\n this,\n \"secrets\"\n );\n\n if (this.env.types.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameter definitions: \\n${this.env.types.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n }\n\n if (existsSync(getEnvReflectionsPath(this, \"secrets\"))) {\n this.env.used.secrets = await readSecretsReflection(this);\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameters used in project: \\n${this.env.used.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n }\n } else {\n this.debug(\n `Starting environment configuration reflection initialization.`\n );\n\n this.env.types.env = await reflectEnv(\n this,\n this.config.env.types?.file,\n this.config.env.types?.name\n );\n if (!this.env.types.env) {\n throw new Error(\n \"Failed to find the environment configuration type reflection in the context.\"\n );\n }\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameter definitions: \\n${this.env.types.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n\n await writeEnvTypeReflection(this, this.env.types.env, \"env\");\n\n this.env.types.secrets = await reflectSecrets(\n this,\n this.config.env.secrets?.file,\n this.config.env.secrets?.name\n );\n if (!this.env.types.secrets) {\n throw new Error(\n \"Failed to find the secrets configuration type reflection in the context.\"\n );\n }\n\n if (this.env.types.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameter definitions: \\n${this.env.types.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n\n await writeEnvTypeReflection(this, this.env.types.secrets, \"secrets\");\n\n this.info({\n meta: {\n category: \"env\"\n },\n message: `Resolved ${\n this.env.types.env.getProperties().length ?? 0\n } environment configuration parameters and ${\n this.env.types.secrets?.getProperties().length ?? 0\n } secret configuration parameters`\n });\n\n const envWithAlias = this.env.types.env\n .getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n Object.entries(await loadEnv(this, this.config.env)).forEach(\n ([key, value]) => {\n const unprefixedKey = this.config.env.prefix.reduce(\n (ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n },\n key\n );\n\n const aliasKey = envWithAlias.find(prop =>\n prop?.getAlias().reverse().includes(unprefixedKey)\n );\n if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) {\n this.env.types.env\n .getProperty(unprefixedKey)\n .setDefaultValue(value);\n }\n }\n );\n\n this.env.used.env = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.env\n );\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n\n if (this.env.types.secrets) {\n await writeEnvTypeReflection(\n this,\n this.env.types.secrets,\n \"secrets\"\n );\n\n this.env.used.secrets = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.secrets\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvBuiltin\n defaultConfig={this.config.env.defaultConfig}\n reflection={result}\n />\n );\n },\n transform: {\n order: \"post\",\n async handler() {\n if (this.env.used.env.getProperties().length > 0) {\n this.trace(\n `Persisting used environment configuration reflections to ${getEnvReflectionsPath(\n this,\n \"env\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.trace(\n `Persisting used secret configuration reflections to ${getEnvReflectionsPath(\n this,\n \"secrets\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\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 const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvDocsFile levelOffset={0} reflection={result} />\n );\n },\n async buildEnd() {\n const reflectionPath = getEnvReflectionsPath(this, \"env\");\n\n this.debug(`Writing env reflection types to ${reflectionPath}.`);\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAI,aAAc,IAAM,MAAQ;AAC/B,IAAI,SAAK;AACT,QAAI;;;;;AA4CL,MAAE,SAAA,cAA2B,UAAA,EAAA,KAAA;AAC3B,QAAA;EAAA,QAAA;GACA,GAAA,QAAA;GACA,YAAA;GACA,OAAA;GACA,QAAA,EAAA;GACA,CAAA;EAAA,MAAA,QAAA,MAAqB;EAAA;GACrB,MAAA;GACA,MAAA,SAAA;AACI,SAAI,MAAO,yEAAa;IACxB,MAAG,SAAY;KACb,KAAC,KAAA,SAAkB;;MAElB,UAAQ;;MAET,QAAQ,EAAA;MACd,CAAA;KACM,OAAE;MACR,GAAA,QAAA;MACF,eAAA,CAAA,QAAA;;MAEE;KACG,SAAW;MACd,YAAA;MACK,OAAM;MACJ;KACJ,KAAA,EAAA;KACH;AACE,QAAA,CAAO,YAAC,OAAA,IAAA,MAAA,IAAA,CAAA,YAAA,O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,CAAC,kBAAQ,QAAA,CAAA;GACb;EAAE;GACD,MAAM;GACN,MAAM;AAEF,WAAM,EACJ,WAAW,KAAK,QAAQ,KAAG,QAC5B;MACA;UAAM;IAAO;IAAA;IAAA;IAAA,CAAA,EACjB;;;;GAEF;OAAO;CAAqB;QAAQ,EAAA;CAAe;CAAC;CAAY,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.205",
|
|
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"],
|
|
@@ -119,14 +119,14 @@
|
|
|
119
119
|
"@alloy-js/typescript": "0.23.0-dev.4",
|
|
120
120
|
"@babel/core": "8.0.0-rc.5",
|
|
121
121
|
"@babel/types": "8.0.0-rc.5",
|
|
122
|
-
"@powerlines/core": "^0.
|
|
123
|
-
"@powerlines/deepkit": "^0.8.
|
|
124
|
-
"@powerlines/plugin-alloy": "^0.26.
|
|
125
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
126
|
-
"@powerlines/plugin-babel": "^0.13.
|
|
127
|
-
"@powerlines/plugin-deepkit": "^0.11.
|
|
128
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
129
|
-
"@powerlines/schema": "^0.
|
|
122
|
+
"@powerlines/core": "^0.8.67",
|
|
123
|
+
"@powerlines/deepkit": "^0.8.67",
|
|
124
|
+
"@powerlines/plugin-alloy": "^0.26.97",
|
|
125
|
+
"@powerlines/plugin-automd": "^0.1.477",
|
|
126
|
+
"@powerlines/plugin-babel": "^0.13.13",
|
|
127
|
+
"@powerlines/plugin-deepkit": "^0.11.359",
|
|
128
|
+
"@powerlines/plugin-plugin": "^0.12.428",
|
|
129
|
+
"@powerlines/schema": "^0.8.67",
|
|
130
130
|
"@storm-software/config-tools": "^1.190.2",
|
|
131
131
|
"@stryke/capnp": "^0.12.101",
|
|
132
132
|
"@stryke/convert": "^0.7.6",
|
|
@@ -141,9 +141,9 @@
|
|
|
141
141
|
"automd": "^0.4.3",
|
|
142
142
|
"c12": "^3.3.4",
|
|
143
143
|
"defu": "^6.1.7",
|
|
144
|
-
"powerlines": "^0.47.
|
|
144
|
+
"powerlines": "^0.47.16"
|
|
145
145
|
},
|
|
146
146
|
"devDependencies": { "@types/node": "^25.7.0", "vite": "^8.0.12" },
|
|
147
147
|
"publishConfig": { "access": "public" },
|
|
148
|
-
"gitHead": "
|
|
148
|
+
"gitHead": "0f124460d57d8b7396173bb00db5d73c1c32f473"
|
|
149
149
|
}
|