@powerlines/plugin-env 0.16.234 → 0.16.236
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/babel/plugin.cjs +23 -71
- package/dist/babel/plugin.d.cts.map +1 -1
- package/dist/babel/plugin.d.mts.map +1 -1
- package/dist/babel/plugin.mjs +23 -71
- package/dist/babel/plugin.mjs.map +1 -1
- package/dist/components/docs.cjs +14 -14
- package/dist/components/docs.d.cts +0 -2
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +0 -2
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/docs.mjs +14 -14
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/env-builtin.cjs +233 -426
- package/dist/components/env-builtin.d.cts +1 -4
- package/dist/components/env-builtin.d.cts.map +1 -1
- package/dist/components/env-builtin.d.mts +1 -4
- package/dist/components/env-builtin.d.mts.map +1 -1
- package/dist/components/env-builtin.mjs +236 -428
- package/dist/components/env-builtin.mjs.map +1 -1
- package/dist/helpers/index.cjs +9 -26
- package/dist/helpers/index.d.cts +3 -5
- package/dist/helpers/index.d.mts +3 -5
- package/dist/helpers/index.mjs +3 -5
- package/dist/helpers/load.cjs +8 -7
- package/dist/helpers/load.d.cts +3 -3
- package/dist/helpers/load.d.cts.map +1 -1
- package/dist/helpers/load.d.mts +3 -3
- package/dist/helpers/load.d.mts.map +1 -1
- package/dist/helpers/load.mjs +7 -6
- package/dist/helpers/load.mjs.map +1 -1
- package/dist/helpers/schema.cjs +206 -0
- package/dist/helpers/schema.d.cts +53 -0
- package/dist/helpers/schema.d.cts.map +1 -0
- package/dist/helpers/schema.d.mts +53 -0
- package/dist/helpers/schema.d.mts.map +1 -0
- package/dist/helpers/schema.mjs +199 -0
- package/dist/helpers/schema.mjs.map +1 -0
- package/dist/index.cjs +23 -201
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +25 -203
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +2 -2
- package/dist/types/plugin.cjs +16 -24
- package/dist/types/plugin.d.cts +23 -57
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +23 -57
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/plugin.mjs +16 -25
- package/dist/types/plugin.mjs.map +1 -1
- package/package.json +12 -26
- package/dist/helpers/create-reflection-resource.cjs +0 -23
- package/dist/helpers/create-reflection-resource.d.cts +0 -13
- package/dist/helpers/create-reflection-resource.d.cts.map +0 -1
- package/dist/helpers/create-reflection-resource.d.mts +0 -13
- package/dist/helpers/create-reflection-resource.d.mts.map +0 -1
- package/dist/helpers/create-reflection-resource.mjs +0 -23
- package/dist/helpers/create-reflection-resource.mjs.map +0 -1
- package/dist/helpers/persistence.cjs +0 -309
- package/dist/helpers/persistence.d.cts +0 -84
- package/dist/helpers/persistence.d.cts.map +0 -1
- package/dist/helpers/persistence.d.mts +0 -84
- package/dist/helpers/persistence.d.mts.map +0 -1
- package/dist/helpers/persistence.mjs +0 -297
- package/dist/helpers/persistence.mjs.map +0 -1
- package/dist/helpers/reflect.cjs +0 -290
- package/dist/helpers/reflect.d.cts +0 -68
- package/dist/helpers/reflect.d.cts.map +0 -1
- package/dist/helpers/reflect.d.mts +0 -68
- package/dist/helpers/reflect.d.mts.map +0 -1
- package/dist/helpers/reflect.mjs +0 -281
- package/dist/helpers/reflect.mjs.map +0 -1
- package/dist/helpers/template-helpers.cjs +0 -70
- package/dist/helpers/template-helpers.d.cts +0 -15
- package/dist/helpers/template-helpers.d.cts.map +0 -1
- package/dist/helpers/template-helpers.d.mts +0 -15
- package/dist/helpers/template-helpers.d.mts.map +0 -1
- package/dist/helpers/template-helpers.mjs +0 -69
- package/dist/helpers/template-helpers.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -2,32 +2,24 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_types_plugin = require('./types/plugin.cjs');
|
|
4
4
|
const require_types_env = require('./types/env.cjs');
|
|
5
|
-
const
|
|
6
|
-
const require_helpers_persistence = require('./helpers/persistence.cjs');
|
|
7
|
-
const require_helpers_load = require('./helpers/load.cjs');
|
|
5
|
+
const require_helpers_schema = require('./helpers/schema.cjs');
|
|
8
6
|
const require_helpers_automd_generator = require('./helpers/automd-generator.cjs');
|
|
9
7
|
const require_components_docs = require('./components/docs.cjs');
|
|
10
8
|
const require_components_env_builtin = require('./components/env-builtin.cjs');
|
|
11
9
|
const require_babel_plugin = require('./babel/plugin.cjs');
|
|
12
|
-
let
|
|
10
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
13
11
|
let defu = require("defu");
|
|
14
12
|
defu = require_runtime.__toESM(defu);
|
|
15
13
|
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
16
14
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
17
|
-
let _stryke_path_join = require("@stryke/path/join");
|
|
18
15
|
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
19
16
|
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
20
17
|
let _powerlines_plugin_automd = require("@powerlines/plugin-automd");
|
|
21
18
|
_powerlines_plugin_automd = require_runtime.__toESM(_powerlines_plugin_automd);
|
|
22
19
|
let _powerlines_plugin_babel = require("@powerlines/plugin-babel");
|
|
23
20
|
_powerlines_plugin_babel = require_runtime.__toESM(_powerlines_plugin_babel);
|
|
24
|
-
let _powerlines_plugin_deepkit = require("@powerlines/plugin-deepkit");
|
|
25
|
-
_powerlines_plugin_deepkit = require_runtime.__toESM(_powerlines_plugin_deepkit);
|
|
26
|
-
let _stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
27
21
|
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
28
|
-
let _stryke_fs_exists = require("@stryke/fs/exists");
|
|
29
22
|
let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
30
|
-
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
31
23
|
|
|
32
24
|
//#region src/index.tsx
|
|
33
25
|
function __assignType(fn, args) {
|
|
@@ -39,12 +31,6 @@ function __assignType(fn, args) {
|
|
|
39
31
|
*/
|
|
40
32
|
const plugin = __assignType((options = {}) => {
|
|
41
33
|
return [
|
|
42
|
-
(0, _powerlines_plugin_deepkit.default)({
|
|
43
|
-
...options.deepkit,
|
|
44
|
-
reflection: "default",
|
|
45
|
-
level: "all",
|
|
46
|
-
filter: {}
|
|
47
|
-
}),
|
|
48
34
|
(0, _powerlines_plugin_babel.default)(options.babel),
|
|
49
35
|
{
|
|
50
36
|
name: "env",
|
|
@@ -52,7 +38,6 @@ const plugin = __assignType((options = {}) => {
|
|
|
52
38
|
this.debug("Providing default configuration for the Powerlines `env` build plugin.");
|
|
53
39
|
const config = {
|
|
54
40
|
env: (0, defu.default)(options, {
|
|
55
|
-
types: {},
|
|
56
41
|
validate: false,
|
|
57
42
|
inject: false,
|
|
58
43
|
prefix: []
|
|
@@ -61,18 +46,13 @@ const plugin = __assignType((options = {}) => {
|
|
|
61
46
|
...options.babel,
|
|
62
47
|
skipTransform: !options.inject,
|
|
63
48
|
plugins: [require_babel_plugin.envBabelPlugin]
|
|
64
|
-
}
|
|
65
|
-
deepkit: {
|
|
66
|
-
reflection: "default",
|
|
67
|
-
level: "all"
|
|
68
|
-
},
|
|
69
|
-
tsc: {}
|
|
49
|
+
}
|
|
70
50
|
};
|
|
71
|
-
if (!
|
|
72
|
-
this.warn("The `env.
|
|
73
|
-
config.env.
|
|
51
|
+
if (!config.env.vars) {
|
|
52
|
+
this.warn("The `env.vars` configuration parameter was not provided. Please ensure this is expected.");
|
|
53
|
+
config.env.vars = await require_helpers_schema.getDefaultVarsTypeDefinition(this);
|
|
74
54
|
}
|
|
75
|
-
if (!
|
|
55
|
+
if (!config.env.secrets) config.env.secrets = await require_helpers_schema.getDefaultSecretsTypeDefinition(this);
|
|
76
56
|
config.env.prefix = (0, _stryke_convert_to_array.toArray)(config.env.prefix ?? []).reduce(__assignType((ret, prefix) => {
|
|
77
57
|
const formattedPrefix = (0, _stryke_string_format_constant_case.constantCase)(prefix);
|
|
78
58
|
if (!ret.includes(formattedPrefix)) ret.push(formattedPrefix);
|
|
@@ -92,187 +72,28 @@ const plugin = __assignType((options = {}) => {
|
|
|
92
72
|
"",
|
|
93
73
|
"P\"2!\"2\"\"/#"
|
|
94
74
|
]), []));
|
|
95
|
-
config.tsc.filter = { id: { include: [(0, powerlines_plugin_utils.createVirtualPrefixRegex)((0, _stryke_path_join.joinPaths)(this.builtinsPath, "env.ts")), (0, powerlines_plugin_utils.createVirtualPrefixRegex)(`${this.config.framework?.name || "powerlines"}:env`)] } };
|
|
96
75
|
return config;
|
|
97
76
|
},
|
|
98
|
-
async configResolved() {
|
|
77
|
+
configResolved: __assignType(async function configResolved() {
|
|
99
78
|
this.debug(`Environment plugin configuration has been resolved for the Powerlines project.`);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
used: {
|
|
103
|
-
env: {},
|
|
104
|
-
secrets: {}
|
|
105
|
-
},
|
|
106
|
-
parsed: {},
|
|
107
|
-
injected: {}
|
|
108
|
-
});
|
|
109
|
-
if ((0, _stryke_type_checks_is_set_string.isSetString)(this.config.env.types) || this.config.env.types && (0, _stryke_type_checks_is_set_string.isSetString)(this.config.env.types.file)) {
|
|
110
|
-
this.config.env.types = (0, _stryke_convert_parse_type_definition.parseTypeDefinition)(this.config.env.types);
|
|
111
|
-
const file = await this.fs.resolve(this.config.env.types.file);
|
|
112
|
-
if (file) this.config.env.types.file = file;
|
|
113
|
-
}
|
|
114
|
-
if ((0, _stryke_type_checks_is_set_string.isSetString)(this.config.env.secrets) || this.config.env.secrets && (0, _stryke_type_checks_is_set_string.isSetString)(this.config.env.secrets.file)) {
|
|
115
|
-
this.config.env.secrets = (0, _stryke_convert_parse_type_definition.parseTypeDefinition)(this.config.env.secrets);
|
|
116
|
-
const file = await this.fs.resolve(this.config.env.secrets.file);
|
|
117
|
-
if (file) this.config.env.secrets.file = file;
|
|
118
|
-
}
|
|
119
|
-
this.info({
|
|
120
|
-
meta: { category: "env" },
|
|
121
|
-
message: `Environment configuration definition file: ${this.config.env.types.file}${this.config.env.types.name ? `#${this.config.env.types.name}` : ""}${this.config.env.secrets ? `\nSecrets configuration definition file: ${this.config.env.secrets?.file}${this.config.env.secrets?.name ? `#${this.config.env.secrets?.name}` : ""}` : ""}\nEnvironment variable Prefixes: ${this.config.env.prefix.join(", ")}\nShould inject values: ${this.config.env.inject ? "Yes" : "No"}\nShould validate configuration: ${this.config.env.validate ? "Yes" : "No"}`
|
|
122
|
-
});
|
|
123
|
-
if (this.config.command !== "prepare" && !this.config.skipCache && this.persistedMeta?.checksum === this.meta.checksum && (0, _stryke_fs_exists.existsSync)(require_helpers_persistence.getEnvTypeReflectionsPath(this, "env"))) {
|
|
124
|
-
this.debug(`Skipping reflection initialization as the meta checksum has not changed.`);
|
|
125
|
-
this.env.types.env = await require_helpers_persistence.readEnvTypeReflection(this, "env");
|
|
126
|
-
this.debug({
|
|
127
|
-
meta: { category: "env" },
|
|
128
|
-
message: `Found the following environment configuration parameter definitions: \n${this.env.types.env.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()}${prop.getAlias().length > 0 ? ` (aliases: ${prop.getAlias().join(", ")})` : ""}`, [
|
|
129
|
-
"prop",
|
|
130
|
-
"",
|
|
131
|
-
"P\"2!\"/\""
|
|
132
|
-
])).join("\n")}`
|
|
133
|
-
});
|
|
134
|
-
if ((0, _stryke_fs_exists.existsSync)(require_helpers_persistence.getEnvReflectionsPath(this, "env"))) {
|
|
135
|
-
this.env.used.env = await require_helpers_persistence.readEnvReflection(this);
|
|
136
|
-
this.debug({
|
|
137
|
-
meta: { category: "env" },
|
|
138
|
-
message: `Found the following environment configuration parameters used in project: \n${this.env.used.env.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()}${prop.getAlias().length > 0 ? ` (aliases: ${prop.getAlias().join(", ")})` : ""}`, [
|
|
139
|
-
"prop",
|
|
140
|
-
"",
|
|
141
|
-
"P\"2!\"/\""
|
|
142
|
-
])).join("\n")}`
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
if ((0, _stryke_fs_exists.existsSync)(require_helpers_persistence.getEnvTypeReflectionsPath(this, "secrets"))) {
|
|
146
|
-
this.env.types.secrets = await require_helpers_persistence.readEnvTypeReflection(this, "secrets");
|
|
147
|
-
if (this.env.types.secrets.getProperties().length > 0) this.debug({
|
|
148
|
-
meta: { category: "env" },
|
|
149
|
-
message: `Found the following secret configuration parameter definitions: \n${this.env.types.secrets.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(", ")})`, [
|
|
150
|
-
"prop",
|
|
151
|
-
"",
|
|
152
|
-
"P\"2!\"/\""
|
|
153
|
-
])).join("\n")}`
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
if ((0, _stryke_fs_exists.existsSync)(require_helpers_persistence.getEnvReflectionsPath(this, "secrets"))) {
|
|
157
|
-
this.env.used.secrets = await require_helpers_persistence.readSecretsReflection(this);
|
|
158
|
-
if (this.env.used.secrets.getProperties().length > 0) this.debug({
|
|
159
|
-
meta: { category: "env" },
|
|
160
|
-
message: `Found the following secret configuration parameters used in project: \n${this.env.used.secrets.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(", ")})`, [
|
|
161
|
-
"prop",
|
|
162
|
-
"",
|
|
163
|
-
"P\"2!\"/\""
|
|
164
|
-
])).join("\n")}`
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
} else {
|
|
168
|
-
this.debug(`Starting environment configuration reflection initialization.`);
|
|
169
|
-
this.env.types.env = await require_helpers_reflect.reflectEnv(this, this.config.env.types?.file, this.config.env.types?.name);
|
|
170
|
-
if (!this.env.types.env) throw new Error("Failed to find the environment configuration type reflection in the context.");
|
|
171
|
-
this.debug({
|
|
172
|
-
meta: { category: "env" },
|
|
173
|
-
message: `Found the following environment configuration parameter definitions: \n${this.env.types.env.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(", ")})`, [
|
|
174
|
-
"prop",
|
|
175
|
-
"",
|
|
176
|
-
"P\"2!\"/\""
|
|
177
|
-
])).join("\n")}`
|
|
178
|
-
});
|
|
179
|
-
await require_helpers_persistence.writeEnvTypeReflection(this, this.env.types.env, "env");
|
|
180
|
-
this.env.types.secrets = await require_helpers_reflect.reflectSecrets(this, this.config.env.secrets?.file, this.config.env.secrets?.name);
|
|
181
|
-
if (!this.env.types.secrets) throw new Error("Failed to find the secrets configuration type reflection in the context.");
|
|
182
|
-
if (this.env.types.secrets.getProperties().length > 0) this.debug({
|
|
183
|
-
meta: { category: "env" },
|
|
184
|
-
message: `Found the following secret configuration parameter definitions: \n${this.env.types.secrets.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(", ")})`, [
|
|
185
|
-
"prop",
|
|
186
|
-
"",
|
|
187
|
-
"P\"2!\"/\""
|
|
188
|
-
])).join("\n")}`
|
|
189
|
-
});
|
|
190
|
-
await require_helpers_persistence.writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
|
|
191
|
-
this.info({
|
|
192
|
-
meta: { category: "env" },
|
|
193
|
-
message: `Resolved ${this.env.types.env.getProperties().length ?? 0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length ?? 0} secret configuration parameters`
|
|
194
|
-
});
|
|
195
|
-
const envWithAlias = this.env.types.env.getProperties().filter(__assignType((prop) => prop.getAlias().length > 0, [
|
|
196
|
-
"prop",
|
|
197
|
-
"",
|
|
198
|
-
"P\"2!\"/\""
|
|
199
|
-
]));
|
|
200
|
-
Object.entries(await require_helpers_load.loadEnv(this, this.config.env)).forEach(__assignType(([key, value]) => {
|
|
201
|
-
const unprefixedKey = this.config.env.prefix.reduce(__assignType((ret, prefix) => {
|
|
202
|
-
if (key.replace(/_$/g, "").startsWith(prefix)) return key.replace(/_$/g, "").slice(prefix.length);
|
|
203
|
-
return ret;
|
|
204
|
-
}, [
|
|
205
|
-
"ret",
|
|
206
|
-
"prefix",
|
|
207
|
-
"",
|
|
208
|
-
"P\"2!\"2\"\"/#"
|
|
209
|
-
]), key);
|
|
210
|
-
const aliasKey = envWithAlias.find(__assignType((prop) => prop?.getAlias().reverse().includes(unprefixedKey), [
|
|
211
|
-
"prop",
|
|
212
|
-
"",
|
|
213
|
-
"P\"2!\"/\""
|
|
214
|
-
]));
|
|
215
|
-
if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) this.env.types.env.getProperty(unprefixedKey).setDefaultValue(value);
|
|
216
|
-
}, [
|
|
217
|
-
"param0",
|
|
218
|
-
"",
|
|
219
|
-
"P\"2!\"/\""
|
|
220
|
-
]));
|
|
221
|
-
this.env.used.env = new _powerlines_deepkit_vendor_type.ReflectionClass({
|
|
222
|
-
kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
|
|
223
|
-
typeName: "Env",
|
|
224
|
-
description: `An object containing the environment configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
|
|
225
|
-
types: []
|
|
226
|
-
}, this.env.types.env);
|
|
227
|
-
await require_helpers_persistence.writeEnvReflection(this, this.env.used.env, "env");
|
|
228
|
-
if (this.env.types.secrets) {
|
|
229
|
-
await require_helpers_persistence.writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
|
|
230
|
-
this.env.used.secrets = new _powerlines_deepkit_vendor_type.ReflectionClass({
|
|
231
|
-
kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
|
|
232
|
-
typeName: "Secrets",
|
|
233
|
-
description: `An object containing the secret configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
|
|
234
|
-
types: []
|
|
235
|
-
}, this.env.types.secrets);
|
|
236
|
-
await require_helpers_persistence.writeEnvReflection(this, this.env.used.secrets, "secrets");
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
},
|
|
79
|
+
await require_helpers_schema.extractEnvSchema(this, options);
|
|
80
|
+
}, ["configResolved", "P\"/!"]),
|
|
240
81
|
prepare: __assignType(async function prepare() {
|
|
241
82
|
const _self$ = this;
|
|
242
83
|
this.debug(`Preparing the Environment runtime artifacts for the Powerlines project.`);
|
|
243
|
-
|
|
244
|
-
return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_env_builtin.EnvBuiltin, {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
},
|
|
248
|
-
reflection: result
|
|
249
|
-
}));
|
|
84
|
+
await require_helpers_schema.readActiveEnv(this);
|
|
85
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_env_builtin.EnvBuiltin, { get defaultConfig() {
|
|
86
|
+
return _self$.config.env.defaultConfig;
|
|
87
|
+
} }));
|
|
250
88
|
}, ["prepare", "P\"/!"]),
|
|
251
|
-
transform: {
|
|
252
|
-
order: "post",
|
|
253
|
-
handler: __assignType(async function handler() {
|
|
254
|
-
if (this.env.used.env.getProperties().length > 0) {
|
|
255
|
-
this.trace(`Persisting used environment configuration reflections to ${require_helpers_persistence.getEnvReflectionsPath(this, "env")}.`);
|
|
256
|
-
await require_helpers_persistence.writeEnvReflection(this, this.env.used.env, "env");
|
|
257
|
-
}
|
|
258
|
-
if (this.env.used.secrets.getProperties().length > 0) {
|
|
259
|
-
this.trace(`Persisting used secret configuration reflections to ${require_helpers_persistence.getEnvReflectionsPath(this, "secrets")}.`);
|
|
260
|
-
await require_helpers_persistence.writeEnvReflection(this, this.env.used.secrets, "secrets");
|
|
261
|
-
}
|
|
262
|
-
}, ["handler", "P\"/!"])
|
|
263
|
-
},
|
|
264
89
|
docs: __assignType(async function docs() {
|
|
265
90
|
this.debug(`Documenting environment variables configuration values in "${(0, _stryke_path_join.joinPaths)((0, powerlines_plugin_utils.getDocsOutputPath)(this.config.root), "env.md")}"`);
|
|
266
|
-
|
|
267
|
-
return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.EnvDocsFile, {
|
|
268
|
-
levelOffset: 0,
|
|
269
|
-
reflection: result
|
|
270
|
-
}));
|
|
91
|
+
await require_helpers_schema.readActiveEnv(this);
|
|
92
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.EnvDocsFile, { levelOffset: 0 }));
|
|
271
93
|
}, ["docs", "P\"/!"]),
|
|
272
94
|
buildEnd: __assignType(async function buildEnd() {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
await require_helpers_persistence.writeEnvReflection(this, this.env.used.env, "env");
|
|
95
|
+
this.debug("Writing active environment variables to disk.");
|
|
96
|
+
await require_helpers_schema.writeActiveEnv(this);
|
|
276
97
|
}, ["buildEnd", "P\"/!"])
|
|
277
98
|
},
|
|
278
99
|
{
|
|
@@ -286,20 +107,20 @@ const plugin = __assignType((options = {}) => {
|
|
|
286
107
|
vite: { configResolved: __assignType(function configResolved() {
|
|
287
108
|
return { envPrefix: this.config?.env?.prefix };
|
|
288
109
|
}, [
|
|
289
|
-
|
|
110
|
+
"EnvPluginContext",
|
|
290
111
|
"this",
|
|
291
112
|
"configResolved",
|
|
292
|
-
"
|
|
113
|
+
"P\"w!2\"\"/#"
|
|
293
114
|
]) }
|
|
294
115
|
},
|
|
295
116
|
(0, _powerlines_plugin_automd.default)(options.automd)
|
|
296
117
|
];
|
|
297
118
|
}, [
|
|
298
|
-
|
|
119
|
+
"EnvPluginOptions",
|
|
299
120
|
"options",
|
|
300
121
|
() => ({}),
|
|
301
122
|
"",
|
|
302
|
-
"
|
|
123
|
+
"P\"w!2\">#\"/$"
|
|
303
124
|
]);
|
|
304
125
|
|
|
305
126
|
//#endregion
|
|
@@ -308,6 +129,7 @@ exports.__ΩEnvPluginContext = require_types_plugin.__ΩEnvPluginContext;
|
|
|
308
129
|
exports.__ΩEnvPluginOptions = require_types_plugin.__ΩEnvPluginOptions;
|
|
309
130
|
exports.__ΩEnvPluginResolvedConfig = require_types_plugin.__ΩEnvPluginResolvedConfig;
|
|
310
131
|
exports.__ΩEnvPluginUserConfig = require_types_plugin.__ΩEnvPluginUserConfig;
|
|
132
|
+
exports.__ΩEnvSchemaMetadata = require_types_plugin.__ΩEnvSchemaMetadata;
|
|
311
133
|
exports.__ΩEnvType = require_types_plugin.__ΩEnvType;
|
|
312
134
|
exports.__ΩSecretsInterface = require_types_env.__ΩSecretsInterface;
|
|
313
135
|
exports.default = plugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType } from "./types/plugin.cjs";
|
|
1
2
|
import { EnvInterface, SecretsInterface } from "./types/env.cjs";
|
|
2
|
-
import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType } from "./types/plugin.cjs";
|
|
3
3
|
import { Plugin } from "powerlines";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
@@ -13,5 +13,5 @@ declare module "powerlines" {
|
|
|
13
13
|
*/
|
|
14
14
|
declare const plugin: <TContext extends EnvPluginContext = EnvPluginContext>(options?: EnvPluginOptions) => Plugin<TContext>[];
|
|
15
15
|
//#endregion
|
|
16
|
-
export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, SecretsInterface, plugin as default, plugin };
|
|
16
|
+
export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType, SecretsInterface, plugin as default, plugin };
|
|
17
17
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YA6CY,MAAA;IACR,GAAA,GAAM,gBAAgB;EAAA;AAAA;;;;cAOb,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KAkIJ,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType } from "./types/plugin.mjs";
|
|
1
2
|
import { EnvInterface, SecretsInterface } from "./types/env.mjs";
|
|
2
|
-
import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType } from "./types/plugin.mjs";
|
|
3
3
|
import { Plugin } from "powerlines";
|
|
4
4
|
|
|
5
5
|
//#region src/index.d.ts
|
|
@@ -13,5 +13,5 @@ declare module "powerlines" {
|
|
|
13
13
|
*/
|
|
14
14
|
declare const plugin: <TContext extends EnvPluginContext = EnvPluginContext>(options?: EnvPluginOptions) => Plugin<TContext>[];
|
|
15
15
|
//#endregion
|
|
16
|
-
export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, SecretsInterface, plugin as default, plugin };
|
|
16
|
+
export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType, SecretsInterface, plugin as default, plugin };
|
|
17
17
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YA6CY,MAAA;IACR,GAAA,GAAM,gBAAgB;EAAA;AAAA;;;;cAOb,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KAkIJ,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
import { __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./types/plugin.mjs";
|
|
1
|
+
import { __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvSchemaMetadata, __ΩEnvType } from "./types/plugin.mjs";
|
|
2
2
|
import { __ΩEnvInterface, __ΩSecretsInterface } from "./types/env.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, writeEnvReflection, writeEnvTypeReflection } from "./helpers/persistence.mjs";
|
|
5
|
-
import { loadEnv } from "./helpers/load.mjs";
|
|
3
|
+
import { extractEnvSchema, getDefaultSecretsTypeDefinition, getDefaultVarsTypeDefinition, readActiveEnv, writeActiveEnv } from "./helpers/schema.mjs";
|
|
6
4
|
import { env } from "./helpers/automd-generator.mjs";
|
|
7
5
|
import { EnvDocsFile } from "./components/docs.mjs";
|
|
8
6
|
import { EnvBuiltin } from "./components/env-builtin.mjs";
|
|
9
7
|
import { envBabelPlugin } from "./babel/plugin.mjs";
|
|
10
|
-
import {
|
|
8
|
+
import { joinPaths } from "@stryke/path/join";
|
|
11
9
|
import defu from "defu";
|
|
12
|
-
import {
|
|
10
|
+
import { getDocsOutputPath } from "powerlines/plugin-utils";
|
|
13
11
|
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
14
|
-
import { joinPaths } from "@stryke/path/join";
|
|
15
12
|
import { getUnique } from "@stryke/helpers/get-unique";
|
|
16
13
|
import { render } from "@powerlines/plugin-alloy/render";
|
|
17
14
|
import automd from "@powerlines/plugin-automd";
|
|
18
15
|
import babel from "@powerlines/plugin-babel";
|
|
19
|
-
import deepkit from "@powerlines/plugin-deepkit";
|
|
20
|
-
import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
|
|
21
16
|
import { toArray } from "@stryke/convert/to-array";
|
|
22
|
-
import { existsSync } from "@stryke/fs/exists";
|
|
23
17
|
import { constantCase } from "@stryke/string-format/constant-case";
|
|
24
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
25
18
|
|
|
26
19
|
//#region src/index.tsx
|
|
27
20
|
function __assignType(fn, args) {
|
|
@@ -33,12 +26,6 @@ function __assignType(fn, args) {
|
|
|
33
26
|
*/
|
|
34
27
|
const plugin = __assignType((options = {}) => {
|
|
35
28
|
return [
|
|
36
|
-
deepkit({
|
|
37
|
-
...options.deepkit,
|
|
38
|
-
reflection: "default",
|
|
39
|
-
level: "all",
|
|
40
|
-
filter: {}
|
|
41
|
-
}),
|
|
42
29
|
babel(options.babel),
|
|
43
30
|
{
|
|
44
31
|
name: "env",
|
|
@@ -46,7 +33,6 @@ const plugin = __assignType((options = {}) => {
|
|
|
46
33
|
this.debug("Providing default configuration for the Powerlines `env` build plugin.");
|
|
47
34
|
const config = {
|
|
48
35
|
env: defu(options, {
|
|
49
|
-
types: {},
|
|
50
36
|
validate: false,
|
|
51
37
|
inject: false,
|
|
52
38
|
prefix: []
|
|
@@ -55,18 +41,13 @@ const plugin = __assignType((options = {}) => {
|
|
|
55
41
|
...options.babel,
|
|
56
42
|
skipTransform: !options.inject,
|
|
57
43
|
plugins: [envBabelPlugin]
|
|
58
|
-
}
|
|
59
|
-
deepkit: {
|
|
60
|
-
reflection: "default",
|
|
61
|
-
level: "all"
|
|
62
|
-
},
|
|
63
|
-
tsc: {}
|
|
44
|
+
}
|
|
64
45
|
};
|
|
65
|
-
if (!
|
|
66
|
-
this.warn("The `env.
|
|
67
|
-
config.env.
|
|
46
|
+
if (!config.env.vars) {
|
|
47
|
+
this.warn("The `env.vars` configuration parameter was not provided. Please ensure this is expected.");
|
|
48
|
+
config.env.vars = await getDefaultVarsTypeDefinition(this);
|
|
68
49
|
}
|
|
69
|
-
if (!
|
|
50
|
+
if (!config.env.secrets) config.env.secrets = await getDefaultSecretsTypeDefinition(this);
|
|
70
51
|
config.env.prefix = toArray(config.env.prefix ?? []).reduce(__assignType((ret, prefix) => {
|
|
71
52
|
const formattedPrefix = constantCase(prefix);
|
|
72
53
|
if (!ret.includes(formattedPrefix)) ret.push(formattedPrefix);
|
|
@@ -86,187 +67,28 @@ const plugin = __assignType((options = {}) => {
|
|
|
86
67
|
"",
|
|
87
68
|
"P\"2!\"2\"\"/#"
|
|
88
69
|
]), []));
|
|
89
|
-
config.tsc.filter = { id: { include: [createVirtualPrefixRegex(joinPaths(this.builtinsPath, "env.ts")), createVirtualPrefixRegex(`${this.config.framework?.name || "powerlines"}:env`)] } };
|
|
90
70
|
return config;
|
|
91
71
|
},
|
|
92
|
-
async configResolved() {
|
|
72
|
+
configResolved: __assignType(async function configResolved() {
|
|
93
73
|
this.debug(`Environment plugin configuration has been resolved for the Powerlines project.`);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
used: {
|
|
97
|
-
env: {},
|
|
98
|
-
secrets: {}
|
|
99
|
-
},
|
|
100
|
-
parsed: {},
|
|
101
|
-
injected: {}
|
|
102
|
-
});
|
|
103
|
-
if (isSetString(this.config.env.types) || this.config.env.types && isSetString(this.config.env.types.file)) {
|
|
104
|
-
this.config.env.types = parseTypeDefinition(this.config.env.types);
|
|
105
|
-
const file = await this.fs.resolve(this.config.env.types.file);
|
|
106
|
-
if (file) this.config.env.types.file = file;
|
|
107
|
-
}
|
|
108
|
-
if (isSetString(this.config.env.secrets) || this.config.env.secrets && isSetString(this.config.env.secrets.file)) {
|
|
109
|
-
this.config.env.secrets = parseTypeDefinition(this.config.env.secrets);
|
|
110
|
-
const file = await this.fs.resolve(this.config.env.secrets.file);
|
|
111
|
-
if (file) this.config.env.secrets.file = file;
|
|
112
|
-
}
|
|
113
|
-
this.info({
|
|
114
|
-
meta: { category: "env" },
|
|
115
|
-
message: `Environment configuration definition file: ${this.config.env.types.file}${this.config.env.types.name ? `#${this.config.env.types.name}` : ""}${this.config.env.secrets ? `\nSecrets configuration definition file: ${this.config.env.secrets?.file}${this.config.env.secrets?.name ? `#${this.config.env.secrets?.name}` : ""}` : ""}\nEnvironment variable Prefixes: ${this.config.env.prefix.join(", ")}\nShould inject values: ${this.config.env.inject ? "Yes" : "No"}\nShould validate configuration: ${this.config.env.validate ? "Yes" : "No"}`
|
|
116
|
-
});
|
|
117
|
-
if (this.config.command !== "prepare" && !this.config.skipCache && this.persistedMeta?.checksum === this.meta.checksum && existsSync(getEnvTypeReflectionsPath(this, "env"))) {
|
|
118
|
-
this.debug(`Skipping reflection initialization as the meta checksum has not changed.`);
|
|
119
|
-
this.env.types.env = await readEnvTypeReflection(this, "env");
|
|
120
|
-
this.debug({
|
|
121
|
-
meta: { category: "env" },
|
|
122
|
-
message: `Found the following environment configuration parameter definitions: \n${this.env.types.env.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()}${prop.getAlias().length > 0 ? ` (aliases: ${prop.getAlias().join(", ")})` : ""}`, [
|
|
123
|
-
"prop",
|
|
124
|
-
"",
|
|
125
|
-
"P\"2!\"/\""
|
|
126
|
-
])).join("\n")}`
|
|
127
|
-
});
|
|
128
|
-
if (existsSync(getEnvReflectionsPath(this, "env"))) {
|
|
129
|
-
this.env.used.env = await readEnvReflection(this);
|
|
130
|
-
this.debug({
|
|
131
|
-
meta: { category: "env" },
|
|
132
|
-
message: `Found the following environment configuration parameters used in project: \n${this.env.used.env.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()}${prop.getAlias().length > 0 ? ` (aliases: ${prop.getAlias().join(", ")})` : ""}`, [
|
|
133
|
-
"prop",
|
|
134
|
-
"",
|
|
135
|
-
"P\"2!\"/\""
|
|
136
|
-
])).join("\n")}`
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
if (existsSync(getEnvTypeReflectionsPath(this, "secrets"))) {
|
|
140
|
-
this.env.types.secrets = await readEnvTypeReflection(this, "secrets");
|
|
141
|
-
if (this.env.types.secrets.getProperties().length > 0) this.debug({
|
|
142
|
-
meta: { category: "env" },
|
|
143
|
-
message: `Found the following secret configuration parameter definitions: \n${this.env.types.secrets.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(", ")})`, [
|
|
144
|
-
"prop",
|
|
145
|
-
"",
|
|
146
|
-
"P\"2!\"/\""
|
|
147
|
-
])).join("\n")}`
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
if (existsSync(getEnvReflectionsPath(this, "secrets"))) {
|
|
151
|
-
this.env.used.secrets = await readSecretsReflection(this);
|
|
152
|
-
if (this.env.used.secrets.getProperties().length > 0) this.debug({
|
|
153
|
-
meta: { category: "env" },
|
|
154
|
-
message: `Found the following secret configuration parameters used in project: \n${this.env.used.secrets.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(", ")})`, [
|
|
155
|
-
"prop",
|
|
156
|
-
"",
|
|
157
|
-
"P\"2!\"/\""
|
|
158
|
-
])).join("\n")}`
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
} else {
|
|
162
|
-
this.debug(`Starting environment configuration reflection initialization.`);
|
|
163
|
-
this.env.types.env = await reflectEnv(this, this.config.env.types?.file, this.config.env.types?.name);
|
|
164
|
-
if (!this.env.types.env) throw new Error("Failed to find the environment configuration type reflection in the context.");
|
|
165
|
-
this.debug({
|
|
166
|
-
meta: { category: "env" },
|
|
167
|
-
message: `Found the following environment configuration parameter definitions: \n${this.env.types.env.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(", ")})`, [
|
|
168
|
-
"prop",
|
|
169
|
-
"",
|
|
170
|
-
"P\"2!\"/\""
|
|
171
|
-
])).join("\n")}`
|
|
172
|
-
});
|
|
173
|
-
await writeEnvTypeReflection(this, this.env.types.env, "env");
|
|
174
|
-
this.env.types.secrets = await reflectSecrets(this, this.config.env.secrets?.file, this.config.env.secrets?.name);
|
|
175
|
-
if (!this.env.types.secrets) throw new Error("Failed to find the secrets configuration type reflection in the context.");
|
|
176
|
-
if (this.env.types.secrets.getProperties().length > 0) this.debug({
|
|
177
|
-
meta: { category: "env" },
|
|
178
|
-
message: `Found the following secret configuration parameter definitions: \n${this.env.types.secrets.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(", ")})`, [
|
|
179
|
-
"prop",
|
|
180
|
-
"",
|
|
181
|
-
"P\"2!\"/\""
|
|
182
|
-
])).join("\n")}`
|
|
183
|
-
});
|
|
184
|
-
await writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
|
|
185
|
-
this.info({
|
|
186
|
-
meta: { category: "env" },
|
|
187
|
-
message: `Resolved ${this.env.types.env.getProperties().length ?? 0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length ?? 0} secret configuration parameters`
|
|
188
|
-
});
|
|
189
|
-
const envWithAlias = this.env.types.env.getProperties().filter(__assignType((prop) => prop.getAlias().length > 0, [
|
|
190
|
-
"prop",
|
|
191
|
-
"",
|
|
192
|
-
"P\"2!\"/\""
|
|
193
|
-
]));
|
|
194
|
-
Object.entries(await loadEnv(this, this.config.env)).forEach(__assignType(([key, value]) => {
|
|
195
|
-
const unprefixedKey = this.config.env.prefix.reduce(__assignType((ret, prefix) => {
|
|
196
|
-
if (key.replace(/_$/g, "").startsWith(prefix)) return key.replace(/_$/g, "").slice(prefix.length);
|
|
197
|
-
return ret;
|
|
198
|
-
}, [
|
|
199
|
-
"ret",
|
|
200
|
-
"prefix",
|
|
201
|
-
"",
|
|
202
|
-
"P\"2!\"2\"\"/#"
|
|
203
|
-
]), key);
|
|
204
|
-
const aliasKey = envWithAlias.find(__assignType((prop) => prop?.getAlias().reverse().includes(unprefixedKey), [
|
|
205
|
-
"prop",
|
|
206
|
-
"",
|
|
207
|
-
"P\"2!\"/\""
|
|
208
|
-
]));
|
|
209
|
-
if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) this.env.types.env.getProperty(unprefixedKey).setDefaultValue(value);
|
|
210
|
-
}, [
|
|
211
|
-
"param0",
|
|
212
|
-
"",
|
|
213
|
-
"P\"2!\"/\""
|
|
214
|
-
]));
|
|
215
|
-
this.env.used.env = new ReflectionClass({
|
|
216
|
-
kind: ReflectionKind.objectLiteral,
|
|
217
|
-
typeName: "Env",
|
|
218
|
-
description: `An object containing the environment configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
|
|
219
|
-
types: []
|
|
220
|
-
}, this.env.types.env);
|
|
221
|
-
await writeEnvReflection(this, this.env.used.env, "env");
|
|
222
|
-
if (this.env.types.secrets) {
|
|
223
|
-
await writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
|
|
224
|
-
this.env.used.secrets = new ReflectionClass({
|
|
225
|
-
kind: ReflectionKind.objectLiteral,
|
|
226
|
-
typeName: "Secrets",
|
|
227
|
-
description: `An object containing the secret configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
|
|
228
|
-
types: []
|
|
229
|
-
}, this.env.types.secrets);
|
|
230
|
-
await writeEnvReflection(this, this.env.used.secrets, "secrets");
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
},
|
|
74
|
+
await extractEnvSchema(this, options);
|
|
75
|
+
}, ["configResolved", "P\"/!"]),
|
|
234
76
|
prepare: __assignType(async function prepare() {
|
|
235
77
|
const _self$ = this;
|
|
236
78
|
this.debug(`Preparing the Environment runtime artifacts for the Powerlines project.`);
|
|
237
|
-
|
|
238
|
-
return render(this, createComponent(EnvBuiltin, {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
},
|
|
242
|
-
reflection: result
|
|
243
|
-
}));
|
|
79
|
+
await readActiveEnv(this);
|
|
80
|
+
return render(this, createComponent(EnvBuiltin, { get defaultConfig() {
|
|
81
|
+
return _self$.config.env.defaultConfig;
|
|
82
|
+
} }));
|
|
244
83
|
}, ["prepare", "P\"/!"]),
|
|
245
|
-
transform: {
|
|
246
|
-
order: "post",
|
|
247
|
-
handler: __assignType(async function handler() {
|
|
248
|
-
if (this.env.used.env.getProperties().length > 0) {
|
|
249
|
-
this.trace(`Persisting used environment configuration reflections to ${getEnvReflectionsPath(this, "env")}.`);
|
|
250
|
-
await writeEnvReflection(this, this.env.used.env, "env");
|
|
251
|
-
}
|
|
252
|
-
if (this.env.used.secrets.getProperties().length > 0) {
|
|
253
|
-
this.trace(`Persisting used secret configuration reflections to ${getEnvReflectionsPath(this, "secrets")}.`);
|
|
254
|
-
await writeEnvReflection(this, this.env.used.secrets, "secrets");
|
|
255
|
-
}
|
|
256
|
-
}, ["handler", "P\"/!"])
|
|
257
|
-
},
|
|
258
84
|
docs: __assignType(async function docs() {
|
|
259
85
|
this.debug(`Documenting environment variables configuration values in "${joinPaths(getDocsOutputPath(this.config.root), "env.md")}"`);
|
|
260
|
-
|
|
261
|
-
return render(this, createComponent(EnvDocsFile, {
|
|
262
|
-
levelOffset: 0,
|
|
263
|
-
reflection: result
|
|
264
|
-
}));
|
|
86
|
+
await readActiveEnv(this);
|
|
87
|
+
return render(this, createComponent(EnvDocsFile, { levelOffset: 0 }));
|
|
265
88
|
}, ["docs", "P\"/!"]),
|
|
266
89
|
buildEnd: __assignType(async function buildEnd() {
|
|
267
|
-
|
|
268
|
-
this
|
|
269
|
-
await writeEnvReflection(this, this.env.used.env, "env");
|
|
90
|
+
this.debug("Writing active environment variables to disk.");
|
|
91
|
+
await writeActiveEnv(this);
|
|
270
92
|
}, ["buildEnd", "P\"/!"])
|
|
271
93
|
},
|
|
272
94
|
{
|
|
@@ -280,22 +102,22 @@ const plugin = __assignType((options = {}) => {
|
|
|
280
102
|
vite: { configResolved: __assignType(function configResolved() {
|
|
281
103
|
return { envPrefix: this.config?.env?.prefix };
|
|
282
104
|
}, [
|
|
283
|
-
|
|
105
|
+
"EnvPluginContext",
|
|
284
106
|
"this",
|
|
285
107
|
"configResolved",
|
|
286
|
-
"
|
|
108
|
+
"P\"w!2\"\"/#"
|
|
287
109
|
]) }
|
|
288
110
|
},
|
|
289
111
|
automd(options.automd)
|
|
290
112
|
];
|
|
291
113
|
}, [
|
|
292
|
-
|
|
114
|
+
"EnvPluginOptions",
|
|
293
115
|
"options",
|
|
294
116
|
() => ({}),
|
|
295
117
|
"",
|
|
296
|
-
"
|
|
118
|
+
"P\"w!2\">#\"/$"
|
|
297
119
|
]);
|
|
298
120
|
|
|
299
121
|
//#endregion
|
|
300
|
-
export { __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType, __ΩSecretsInterface, plugin as default, plugin };
|
|
122
|
+
export { __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvSchemaMetadata, __ΩEnvType, __ΩSecretsInterface, plugin as default, plugin };
|
|
301
123
|
//# sourceMappingURL=index.mjs.map
|