@powerlines/plugin-env 0.16.66 → 0.16.67
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 +83 -11
- package/dist/babel/plugin.mjs +83 -11
- package/dist/babel/plugin.mjs.map +1 -1
- package/dist/components/env-builtin.cjs +1 -1
- package/dist/components/env-builtin.mjs +1 -1
- package/dist/helpers/automd-generator.cjs +14 -4
- package/dist/helpers/automd-generator.d.mts +1 -1
- package/dist/helpers/automd-generator.mjs +14 -4
- package/dist/helpers/automd-generator.mjs.map +1 -1
- package/dist/helpers/create-reflection-resource.cjs +8 -0
- package/dist/helpers/create-reflection-resource.mjs +9 -0
- package/dist/helpers/create-reflection-resource.mjs.map +1 -1
- package/dist/helpers/docs-helper.cjs +8 -0
- package/dist/helpers/docs-helper.mjs +8 -0
- package/dist/helpers/docs-helper.mjs.map +1 -1
- package/dist/helpers/index.cjs +1 -0
- package/dist/helpers/index.mjs +2 -2
- package/dist/helpers/load.cjs +58 -7
- package/dist/helpers/load.mjs +58 -7
- package/dist/helpers/load.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +108 -1
- package/dist/helpers/persistence.mjs +108 -1
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/reflect.cjs +156 -3
- package/dist/helpers/reflect.mjs +156 -4
- package/dist/helpers/reflect.mjs.map +1 -1
- package/dist/helpers/source-file-env.cjs +34 -4
- package/dist/helpers/source-file-env.mjs +34 -4
- package/dist/helpers/source-file-env.mjs.map +1 -1
- package/dist/helpers/template-helpers.cjs +33 -5
- package/dist/helpers/template-helpers.mjs +33 -5
- package/dist/helpers/template-helpers.mjs.map +1 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs +2 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs.map +1 -1
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs +4 -0
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +1 -0
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs.map +1 -1
- package/dist/types/index.cjs +11 -0
- package/dist/types/index.mjs +4 -1
- package/dist/types/plugin.cjs +137 -0
- package/dist/types/plugin.d.mts +4 -4
- package/dist/types/plugin.mjs +132 -1
- package/dist/types/plugin.mjs.map +1 -0
- package/dist/types/runtime.cjs +244 -0
- package/dist/types/runtime.mjs +242 -1
- package/dist/types/runtime.mjs.map +1 -0
- package/package.json +9 -9
package/dist/babel/plugin.cjs
CHANGED
|
@@ -1,21 +1,48 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_types_plugin = require('../types/plugin.cjs');
|
|
4
|
+
let _powerlines_plugin_babel_types_config = require("@powerlines/plugin-babel/types/config");
|
|
5
|
+
let _babel_core = require("@babel/core");
|
|
3
6
|
let _powerlines_deepkit_utilities = require("@powerlines/deepkit/utilities");
|
|
4
7
|
let _powerlines_plugin_babel_helpers_create_plugin = require("@powerlines/plugin-babel/helpers/create-plugin");
|
|
5
8
|
let _powerlines_plugin_babel_helpers_module_helpers = require("@powerlines/plugin-babel/helpers/module-helpers");
|
|
6
9
|
let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
7
10
|
|
|
8
11
|
//#region src/babel/plugin.ts
|
|
9
|
-
|
|
12
|
+
function __assignType(fn, args) {
|
|
13
|
+
fn.__type = args;
|
|
14
|
+
return fn;
|
|
15
|
+
}
|
|
16
|
+
const envBabelPlugin = (_powerlines_plugin_babel_helpers_create_plugin.createBabelPlugin.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_babel_helpers_create_plugin.createBabelPlugin)("env", __assignType(({ log, context }) => {
|
|
10
17
|
function extractEnv(node, pass, isInjectable = false, isUsingBuiltin = false) {
|
|
11
|
-
const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0
|
|
18
|
+
const envTypesAliasProperties = context.env.types.env?.getProperties().filter(__assignType((prop) => prop.getAlias().length > 0, [
|
|
19
|
+
"prop",
|
|
20
|
+
"",
|
|
21
|
+
"P\"2!\"/\""
|
|
22
|
+
]));
|
|
12
23
|
if (node.name) {
|
|
13
|
-
const prefix = context.config.env.prefix.find((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, ""))
|
|
24
|
+
const prefix = context.config.env.prefix.find(__assignType((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some(__assignType((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")), [
|
|
25
|
+
"prop",
|
|
26
|
+
"",
|
|
27
|
+
"P\"2!\"/\""
|
|
28
|
+
]))), [
|
|
29
|
+
"pre",
|
|
30
|
+
"",
|
|
31
|
+
"P\"2!\"/\""
|
|
32
|
+
]));
|
|
14
33
|
let name = node.name;
|
|
15
34
|
if (prefix) name = node.name.replace(`${prefix}_`, "");
|
|
16
35
|
log(_storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
|
|
17
|
-
if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name)
|
|
18
|
-
|
|
36
|
+
if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some(__assignType((prop) => prop.getAlias().includes(name), [
|
|
37
|
+
"prop",
|
|
38
|
+
"",
|
|
39
|
+
"P\"2!\"/\""
|
|
40
|
+
]))) {
|
|
41
|
+
const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find(__assignType((prop) => prop.getAlias().includes(name), [
|
|
42
|
+
"prop",
|
|
43
|
+
"",
|
|
44
|
+
"P\"2!\"/\""
|
|
45
|
+
]));
|
|
19
46
|
if (!envProperty || envProperty.isIgnored()) return;
|
|
20
47
|
if (!context.env.used.env.hasProperty(name)) {
|
|
21
48
|
log(_storm_software_config_tools_types.LogLevelLabel.DEBUG, `Adding "${name}" environment variables found in "${pass.filename || "unknown file"}" to used environment configuration reflection object.`);
|
|
@@ -24,9 +51,13 @@ const envBabelPlugin = (0, _powerlines_plugin_babel_helpers_create_plugin.create
|
|
|
24
51
|
if (context.config.env.inject && isInjectable) {
|
|
25
52
|
let value = context.env.parsed?.[name];
|
|
26
53
|
if (value === void 0) {
|
|
27
|
-
const prefix = context.config.env.prefix.find((pre) => {
|
|
54
|
+
const prefix = context.config.env.prefix.find(__assignType((pre) => {
|
|
28
55
|
return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
|
|
29
|
-
}
|
|
56
|
+
}, [
|
|
57
|
+
"pre",
|
|
58
|
+
"",
|
|
59
|
+
"P\"2!\"/\""
|
|
60
|
+
]));
|
|
30
61
|
if (prefix) value = context.env.parsed[`${prefix.replace(/_$/g, "")}_${name}`];
|
|
31
62
|
}
|
|
32
63
|
value ??= envProperty.getDefaultValue();
|
|
@@ -35,11 +66,41 @@ const envBabelPlugin = (0, _powerlines_plugin_babel_helpers_create_plugin.create
|
|
|
35
66
|
}
|
|
36
67
|
} else if (context.config.env.validate) throw new Error(`The "${name}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${pass.filename ? pass.filename : "unknown"}.
|
|
37
68
|
|
|
38
|
-
The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort((a, b) => String(a).localeCompare(String(b))
|
|
69
|
+
The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort(__assignType((a, b) => String(a).localeCompare(String(b)), [
|
|
70
|
+
"a",
|
|
71
|
+
"b",
|
|
72
|
+
"",
|
|
73
|
+
"P\"2!\"2\"\"/#"
|
|
74
|
+
])).map(__assignType((typeDef) => ` - ${String(typeDef)} ${envTypesAliasProperties.some(__assignType((prop) => prop.getNameAsString() === String(typeDef) && prop.getAlias().length > 0, [
|
|
75
|
+
"prop",
|
|
76
|
+
"",
|
|
77
|
+
"P\"2!\"/\""
|
|
78
|
+
])) ? `(Alias: ${envTypesAliasProperties?.find(__assignType((prop) => prop.getNameAsString() === String(typeDef), [
|
|
79
|
+
"prop",
|
|
80
|
+
"",
|
|
81
|
+
"P\"2!\"/\""
|
|
82
|
+
]))?.getAlias().join(", ")})` : ""}`, [
|
|
83
|
+
"typeDef",
|
|
84
|
+
"",
|
|
85
|
+
"P\"2!\"/\""
|
|
86
|
+
])).join("\n")} \n\nUsing the following env prefix: \n${context.config.env.prefix.map(__assignType((prefix) => ` - ${prefix}`, [
|
|
87
|
+
"prefix",
|
|
88
|
+
"",
|
|
89
|
+
"P\"2!\"/\""
|
|
90
|
+
])).join("\n")} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`);
|
|
39
91
|
else if (pass.filename && isUsingBuiltin) context.warn(`The "${name}" environment variable is used in the source code file ${pass.filename}, but is not defined in the \`env\` type definition. If this is intentional, you can ignore this warning. Otherwise, please check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code.`);
|
|
40
92
|
}
|
|
41
93
|
}
|
|
42
|
-
|
|
94
|
+
extractEnv.__type = [
|
|
95
|
+
"node",
|
|
96
|
+
() => _powerlines_plugin_babel_types_config.__ΩBabelPluginPass,
|
|
97
|
+
"pass",
|
|
98
|
+
"isInjectable",
|
|
99
|
+
"isUsingBuiltin",
|
|
100
|
+
"extractEnv",
|
|
101
|
+
"P!2!n\"2#\"2$\"2%\"/&"
|
|
102
|
+
];
|
|
103
|
+
return { visitor: { MemberExpression: __assignType(function MemberExpression(path, pass) {
|
|
43
104
|
if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
|
|
44
105
|
const identifier = path.get("property")?.node;
|
|
45
106
|
if (!identifier.name) return;
|
|
@@ -65,8 +126,19 @@ const envBabelPlugin = (0, _powerlines_plugin_babel_helpers_create_plugin.create
|
|
|
65
126
|
if (!identifier.name) return;
|
|
66
127
|
extractEnv(identifier, pass, false, true);
|
|
67
128
|
}
|
|
68
|
-
}
|
|
69
|
-
|
|
129
|
+
}, [
|
|
130
|
+
() => _babel_core.NodePath,
|
|
131
|
+
"path",
|
|
132
|
+
() => _powerlines_plugin_babel_types_config.__ΩBabelPluginPass,
|
|
133
|
+
"pass",
|
|
134
|
+
"MemberExpression",
|
|
135
|
+
"PP!7!2\"n#2$\"/%"
|
|
136
|
+
]) } };
|
|
137
|
+
}, [
|
|
138
|
+
"param0",
|
|
139
|
+
"",
|
|
140
|
+
"P\"2!\"/\""
|
|
141
|
+
])));
|
|
70
142
|
|
|
71
143
|
//#endregion
|
|
72
144
|
exports.envBabelPlugin = envBabelPlugin;
|
package/dist/babel/plugin.mjs
CHANGED
|
@@ -1,19 +1,46 @@
|
|
|
1
|
+
import { __ΩEnvPluginContext } from "../types/plugin.mjs";
|
|
2
|
+
import { __ΩBabelPluginPass } from "@powerlines/plugin-babel/types/config";
|
|
3
|
+
import { NodePath } from "@babel/core";
|
|
1
4
|
import { stringifyDefaultValue } from "@powerlines/deepkit/utilities";
|
|
2
5
|
import { createBabelPlugin } from "@powerlines/plugin-babel/helpers/create-plugin";
|
|
3
6
|
import { addImport } from "@powerlines/plugin-babel/helpers/module-helpers";
|
|
4
7
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
5
8
|
|
|
6
9
|
//#region src/babel/plugin.ts
|
|
7
|
-
|
|
10
|
+
function __assignType(fn, args) {
|
|
11
|
+
fn.__type = args;
|
|
12
|
+
return fn;
|
|
13
|
+
}
|
|
14
|
+
const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!"]], createBabelPlugin("env", __assignType(({ log, context }) => {
|
|
8
15
|
function extractEnv(node, pass, isInjectable = false, isUsingBuiltin = false) {
|
|
9
|
-
const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0
|
|
16
|
+
const envTypesAliasProperties = context.env.types.env?.getProperties().filter(__assignType((prop) => prop.getAlias().length > 0, [
|
|
17
|
+
"prop",
|
|
18
|
+
"",
|
|
19
|
+
"P\"2!\"/\""
|
|
20
|
+
]));
|
|
10
21
|
if (node.name) {
|
|
11
|
-
const prefix = context.config.env.prefix.find((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, ""))
|
|
22
|
+
const prefix = context.config.env.prefix.find(__assignType((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some(__assignType((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")), [
|
|
23
|
+
"prop",
|
|
24
|
+
"",
|
|
25
|
+
"P\"2!\"/\""
|
|
26
|
+
]))), [
|
|
27
|
+
"pre",
|
|
28
|
+
"",
|
|
29
|
+
"P\"2!\"/\""
|
|
30
|
+
]));
|
|
12
31
|
let name = node.name;
|
|
13
32
|
if (prefix) name = node.name.replace(`${prefix}_`, "");
|
|
14
33
|
log(LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
|
|
15
|
-
if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name)
|
|
16
|
-
|
|
34
|
+
if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some(__assignType((prop) => prop.getAlias().includes(name), [
|
|
35
|
+
"prop",
|
|
36
|
+
"",
|
|
37
|
+
"P\"2!\"/\""
|
|
38
|
+
]))) {
|
|
39
|
+
const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find(__assignType((prop) => prop.getAlias().includes(name), [
|
|
40
|
+
"prop",
|
|
41
|
+
"",
|
|
42
|
+
"P\"2!\"/\""
|
|
43
|
+
]));
|
|
17
44
|
if (!envProperty || envProperty.isIgnored()) return;
|
|
18
45
|
if (!context.env.used.env.hasProperty(name)) {
|
|
19
46
|
log(LogLevelLabel.DEBUG, `Adding "${name}" environment variables found in "${pass.filename || "unknown file"}" to used environment configuration reflection object.`);
|
|
@@ -22,9 +49,13 @@ const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
|
|
|
22
49
|
if (context.config.env.inject && isInjectable) {
|
|
23
50
|
let value = context.env.parsed?.[name];
|
|
24
51
|
if (value === void 0) {
|
|
25
|
-
const prefix = context.config.env.prefix.find((pre) => {
|
|
52
|
+
const prefix = context.config.env.prefix.find(__assignType((pre) => {
|
|
26
53
|
return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
|
|
27
|
-
}
|
|
54
|
+
}, [
|
|
55
|
+
"pre",
|
|
56
|
+
"",
|
|
57
|
+
"P\"2!\"/\""
|
|
58
|
+
]));
|
|
28
59
|
if (prefix) value = context.env.parsed[`${prefix.replace(/_$/g, "")}_${name}`];
|
|
29
60
|
}
|
|
30
61
|
value ??= envProperty.getDefaultValue();
|
|
@@ -33,11 +64,41 @@ const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
|
|
|
33
64
|
}
|
|
34
65
|
} else if (context.config.env.validate) throw new Error(`The "${name}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${pass.filename ? pass.filename : "unknown"}.
|
|
35
66
|
|
|
36
|
-
The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort((a, b) => String(a).localeCompare(String(b))
|
|
67
|
+
The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort(__assignType((a, b) => String(a).localeCompare(String(b)), [
|
|
68
|
+
"a",
|
|
69
|
+
"b",
|
|
70
|
+
"",
|
|
71
|
+
"P\"2!\"2\"\"/#"
|
|
72
|
+
])).map(__assignType((typeDef) => ` - ${String(typeDef)} ${envTypesAliasProperties.some(__assignType((prop) => prop.getNameAsString() === String(typeDef) && prop.getAlias().length > 0, [
|
|
73
|
+
"prop",
|
|
74
|
+
"",
|
|
75
|
+
"P\"2!\"/\""
|
|
76
|
+
])) ? `(Alias: ${envTypesAliasProperties?.find(__assignType((prop) => prop.getNameAsString() === String(typeDef), [
|
|
77
|
+
"prop",
|
|
78
|
+
"",
|
|
79
|
+
"P\"2!\"/\""
|
|
80
|
+
]))?.getAlias().join(", ")})` : ""}`, [
|
|
81
|
+
"typeDef",
|
|
82
|
+
"",
|
|
83
|
+
"P\"2!\"/\""
|
|
84
|
+
])).join("\n")} \n\nUsing the following env prefix: \n${context.config.env.prefix.map(__assignType((prefix) => ` - ${prefix}`, [
|
|
85
|
+
"prefix",
|
|
86
|
+
"",
|
|
87
|
+
"P\"2!\"/\""
|
|
88
|
+
])).join("\n")} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`);
|
|
37
89
|
else if (pass.filename && isUsingBuiltin) context.warn(`The "${name}" environment variable is used in the source code file ${pass.filename}, but is not defined in the \`env\` type definition. If this is intentional, you can ignore this warning. Otherwise, please check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code.`);
|
|
38
90
|
}
|
|
39
91
|
}
|
|
40
|
-
|
|
92
|
+
extractEnv.__type = [
|
|
93
|
+
"node",
|
|
94
|
+
() => __ΩBabelPluginPass,
|
|
95
|
+
"pass",
|
|
96
|
+
"isInjectable",
|
|
97
|
+
"isUsingBuiltin",
|
|
98
|
+
"extractEnv",
|
|
99
|
+
"P!2!n\"2#\"2$\"2%\"/&"
|
|
100
|
+
];
|
|
101
|
+
return { visitor: { MemberExpression: __assignType(function MemberExpression(path, pass) {
|
|
41
102
|
if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
|
|
42
103
|
const identifier = path.get("property")?.node;
|
|
43
104
|
if (!identifier.name) return;
|
|
@@ -63,8 +124,19 @@ const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
|
|
|
63
124
|
if (!identifier.name) return;
|
|
64
125
|
extractEnv(identifier, pass, false, true);
|
|
65
126
|
}
|
|
66
|
-
}
|
|
67
|
-
|
|
127
|
+
}, [
|
|
128
|
+
() => NodePath,
|
|
129
|
+
"path",
|
|
130
|
+
() => __ΩBabelPluginPass,
|
|
131
|
+
"pass",
|
|
132
|
+
"MemberExpression",
|
|
133
|
+
"PP!7!2\"n#2$\"/%"
|
|
134
|
+
]) } };
|
|
135
|
+
}, [
|
|
136
|
+
"param0",
|
|
137
|
+
"",
|
|
138
|
+
"P\"2!\"/\""
|
|
139
|
+
])));
|
|
68
140
|
|
|
69
141
|
//#endregion
|
|
70
142
|
export { envBabelPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/babel/plugin.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 { NodePath } from \"@babel/core\";\nimport * as t from \"@babel/types\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport { createBabelPlugin } from \"@powerlines/plugin-babel/helpers/create-plugin\";\nimport { addImport } from \"@powerlines/plugin-babel/helpers/module-helpers\";\nimport { BabelPluginPass } from \"@powerlines/plugin-babel/types/config\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/*\n * The Powerlines - Environment Configuration Babel Plugin\n *\n * @param babel - The Babel core module\n * @returns The Babel plugin object\n */\nexport const envBabelPlugin = createBabelPlugin<EnvPluginContext>(\n \"env\",\n ({ log, context }) => {\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false,\n isUsingBuiltin = false\n ) {\n const envTypesAliasProperties = context.env.types.env\n ?.getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n if (node.name) {\n const prefix = context.config.env.prefix.find(\n pre =>\n node.name &&\n node.name.startsWith(pre) &&\n (context.env.types.env?.hasProperty(\n node.name.replace(`${pre}_`, \"\")\n ) ||\n envTypesAliasProperties.some(prop =>\n prop.getAlias().includes(node.name.replace(`${pre}_`, \"\"))\n ))\n );\n\n let name = node.name;\n if (prefix) {\n name = node.name.replace(`${prefix}_`, \"\");\n }\n\n log(\n LogLevelLabel.TRACE,\n `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n );\n\n if (\n context.env.types.env?.hasProperty(name) ||\n envTypesAliasProperties.some(prop => prop.getAlias().includes(name))\n ) {\n const envProperty = context.env.types.env.hasProperty(name)\n ? context.env.types.env.getProperty(name)\n : envTypesAliasProperties.find(prop =>\n prop.getAlias().includes(name)\n );\n if (!envProperty || envProperty.isIgnored()) {\n return;\n }\n\n if (!context.env.used.env.hasProperty(name)) {\n log(\n LogLevelLabel.DEBUG,\n `Adding \"${name}\" environment variables found in \"${\n pass.filename || \"unknown file\"\n }\" to used environment configuration reflection object.`\n );\n\n context.env.used.env.addProperty(envProperty.property);\n }\n\n if (context.config.env.inject && isInjectable) {\n let value = context.env.parsed?.[name];\n if (value === undefined) {\n const prefix = context.config.env.prefix.find(pre => {\n return context.env.parsed[`${pre.replace(/_$/g, \"\")}_${name}`];\n });\n if (prefix) {\n value =\n context.env.parsed[`${prefix.replace(/_$/g, \"\")}_${name}`];\n }\n }\n\n value ??= envProperty.getDefaultValue();\n\n if (envProperty.isValueRequired() && value === undefined) {\n throw new Error(\n `Environment variable \\`${name}\\` is not defined in the .env configuration files`\n );\n }\n\n return stringifyDefaultValue(envProperty, value);\n }\n } else if (context.config.env.validate) {\n throw new Error(\n `The \"${name}\" environment variable is not defined in the \\`env\\` type definition, but is used in the source code file ${\n pass.filename ? pass.filename : \"unknown\"\n }.\n\n The following environment configuration names are defined in the \\`env\\` type definition: \\n${context.env.types.env\n ?.getPropertyNames()\n .sort((a, b) => String(a).localeCompare(String(b)))\n .map(\n typeDef =>\n ` - ${String(typeDef)} ${\n envTypesAliasProperties.some(\n prop =>\n prop.getNameAsString() === String(typeDef) &&\n prop.getAlias().length > 0\n )\n ? `(Alias: ${envTypesAliasProperties\n ?.find(\n prop => prop.getNameAsString() === String(typeDef)\n )\n ?.getAlias()\n .join(\", \")})`\n : \"\"\n }`\n )\n .join(\n \"\\n\"\n )} \\n\\nUsing the following env prefix: \\n${context.config.env.prefix\n .map(prefix => ` - ${prefix}`)\n .join(\n \"\\n\"\n )} \\n\\nPlease check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \\n\\n`\n );\n } else if (pass.filename && isUsingBuiltin) {\n context.warn(\n `The \"${\n name\n }\" environment variable is used in the source code file ${\n pass.filename\n }, but is not defined in the \\`env\\` type definition. If this is intentional, you can ignore this warning. Otherwise, please check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code.`\n );\n }\n }\n\n return undefined;\n }\n\n return {\n visitor: {\n MemberExpression(\n path: NodePath<t.MemberExpression>,\n pass: BabelPluginPass\n ) {\n if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path\n .get(\"object\")\n ?.get(\"object\")\n ?.isIdentifier({ name: \"process\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // process.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path.get(\"object\")?.get(\"object\")?.isMetaProperty() &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // import.meta.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path.get(\"object\")?.isIdentifier({ name: \"env\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, true);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;AAiCA,MAAa,iBAAiB,kBAC5B,QACC,EAAE,KAAK,cAAc;CACpB,SAAS,WACP,MACA,MACA,eAAe,OACf,iBAAiB,OACjB;EACA,MAAM,0BAA0B,QAAQ,IAAI,MAAM,KAC9C,eAAe,CAChB,QAAO,SAAQ,KAAK,UAAU,CAAC,SAAS,EAAE;AAE7C,MAAI,KAAK,MAAM;GACb,MAAM,SAAS,QAAQ,OAAO,IAAI,OAAO,MACvC,QACE,KAAK,QACL,KAAK,KAAK,WAAW,IAAI,KACxB,QAAQ,IAAI,MAAM,KAAK,YACtB,KAAK,KAAK,QAAQ,GAAG,IAAI,IAAI,GAAG,CACjC,IACC,w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AAE,IAAI,SAAS,EAAE,gBAAgB,IACnD,KAAK,IAAI,WAAW,EAAE,cAAc,EACpC;GAGA,MAAM,aAAa,KAAK,IAAI,WAAW,EAAE;AACzC,OAAI,CAAC,WAAW,KACd;AAGF,cAAW,YAAY,MAAM,OAAO,MAAM;AAE1C,QAAK,wBAAwB,OAAO,WAAW,OAAO;AACtD,aAAU,MAAM;IACd,QAAQ,GAAG,QAAQ,OAAO,aAAa,aAAa;IACpD,MAAM;IACN,UAAU;IACX,CAAC;aAEF,KAAK,IAAI,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC,IACjD,KAAK,IAAI,WAAW,EAAE,cAAc,EACpC;GAGA,MAAM,aAAa,KAAK,IAAI,WAAW,EAAE;AACzC,OAAI,CAAC,WAAW,KACd;AAGF,cAAW,YAAY,MAAM,OAAO,KAAK;;IAG9C,EACF;EAEJ"}
|
|
1
|
+
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/babel/plugin.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 { NodePath } from \"@babel/core\";\nimport * as t from \"@babel/types\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport { createBabelPlugin } from \"@powerlines/plugin-babel/helpers/create-plugin\";\nimport { addImport } from \"@powerlines/plugin-babel/helpers/module-helpers\";\nimport { BabelPluginPass } from \"@powerlines/plugin-babel/types/config\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/*\n * The Powerlines - Environment Configuration Babel Plugin\n *\n * @param babel - The Babel core module\n * @returns The Babel plugin object\n */\nexport const envBabelPlugin = createBabelPlugin<EnvPluginContext>(\n \"env\",\n ({ log, context }) => {\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false,\n isUsingBuiltin = false\n ) {\n const envTypesAliasProperties = context.env.types.env\n ?.getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n if (node.name) {\n const prefix = context.config.env.prefix.find(\n pre =>\n node.name &&\n node.name.startsWith(pre) &&\n (context.env.types.env?.hasProperty(\n node.name.replace(`${pre}_`, \"\")\n ) ||\n envTypesAliasProperties.some(prop =>\n prop.getAlias().includes(node.name.replace(`${pre}_`, \"\"))\n ))\n );\n\n let name = node.name;\n if (prefix) {\n name = node.name.replace(`${prefix}_`, \"\");\n }\n\n log(\n LogLevelLabel.TRACE,\n `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n );\n\n if (\n context.env.types.env?.hasProperty(name) ||\n envTypesAliasProperties.some(prop => prop.getAlias().includes(name))\n ) {\n const envProperty = context.env.types.env.hasProperty(name)\n ? context.env.types.env.getProperty(name)\n : envTypesAliasProperties.find(prop =>\n prop.getAlias().includes(name)\n );\n if (!envProperty || envProperty.isIgnored()) {\n return;\n }\n\n if (!context.env.used.env.hasProperty(name)) {\n log(\n LogLevelLabel.DEBUG,\n `Adding \"${name}\" environment variables found in \"${\n pass.filename || \"unknown file\"\n }\" to used environment configuration reflection object.`\n );\n\n context.env.used.env.addProperty(envProperty.property);\n }\n\n if (context.config.env.inject && isInjectable) {\n let value = context.env.parsed?.[name];\n if (value === undefined) {\n const prefix = context.config.env.prefix.find(pre => {\n return context.env.parsed[`${pre.replace(/_$/g, \"\")}_${name}`];\n });\n if (prefix) {\n value =\n context.env.parsed[`${prefix.replace(/_$/g, \"\")}_${name}`];\n }\n }\n\n value ??= envProperty.getDefaultValue();\n\n if (envProperty.isValueRequired() && value === undefined) {\n throw new Error(\n `Environment variable \\`${name}\\` is not defined in the .env configuration files`\n );\n }\n\n return stringifyDefaultValue(envProperty, value);\n }\n } else if (context.config.env.validate) {\n throw new Error(\n `The \"${name}\" environment variable is not defined in the \\`env\\` type definition, but is used in the source code file ${\n pass.filename ? pass.filename : \"unknown\"\n }.\n\n The following environment configuration names are defined in the \\`env\\` type definition: \\n${context.env.types.env\n ?.getPropertyNames()\n .sort((a, b) => String(a).localeCompare(String(b)))\n .map(\n typeDef =>\n ` - ${String(typeDef)} ${\n envTypesAliasProperties.some(\n prop =>\n prop.getNameAsString() === String(typeDef) &&\n prop.getAlias().length > 0\n )\n ? `(Alias: ${envTypesAliasProperties\n ?.find(\n prop => prop.getNameAsString() === String(typeDef)\n )\n ?.getAlias()\n .join(\", \")})`\n : \"\"\n }`\n )\n .join(\n \"\\n\"\n )} \\n\\nUsing the following env prefix: \\n${context.config.env.prefix\n .map(prefix => ` - ${prefix}`)\n .join(\n \"\\n\"\n )} \\n\\nPlease check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \\n\\n`\n );\n } else if (pass.filename && isUsingBuiltin) {\n context.warn(\n `The \"${\n name\n }\" environment variable is used in the source code file ${\n pass.filename\n }, but is not defined in the \\`env\\` type definition. If this is intentional, you can ignore this warning. Otherwise, please check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code.`\n );\n }\n }\n\n return undefined;\n }\n\n return {\n visitor: {\n MemberExpression(\n path: NodePath<t.MemberExpression>,\n pass: BabelPluginPass\n ) {\n if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path\n .get(\"object\")\n ?.get(\"object\")\n ?.isIdentifier({ name: \"process\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // process.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path.get(\"object\")?.get(\"object\")?.isMetaProperty() &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // import.meta.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path.get(\"object\")?.isIdentifier({ name: \"env\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, true);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;AAC5B,IAAA,SAAW;AACd,QAAS;;AA8BV,MAAa,kBAAU,kBAAA,IAAA,CAAA,OAAA,qBAAA,KAAA,CAAA,EAAA,kBAAA,OAAA,cAAA,EAAA,KAAA,cAAA;CACnB,SAAS,WAAW,MAAA,MAAA,eAAA,OAAA,iBAAA,OAAA;EAClB,MAAM,0BAAe,QAAA,IAAA,MAAA,KACrB,eAAoB,CACpB,OAAc,cAAG,SAAA,KAAA,UAAA,CAAA,SAAA,GAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;AACjB,MAAA,KAAA,MAAA;GACM,MAAA,SAAA,QAAuB,OAAG,IAAQ,OAAI,KAAM,cAAA,QAAA,KAAA,QAC9C,KAAA,KAAc,WAAA,IAAA,KACR,QAAQ,IAAK,MAAA,KAAW,YAAW,KAAA,KAAA,QAAA,GAAA,IAAA,IAAA,GAAA,CAAA;;;;;;;;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AAG,OAAA,aAAwB,aAAA;IAC9C,MAAA;IACO,UAAA;IACF,CAAC;aAEG,KACJ,IAAC,SAAK,EACL,IAAI,WAAW,EACnB,aAAA,EAAA,MAAA,OAAA,CAAA,IACE,KAAI,IAAK,SAAI,EAAA,IAAA,SAAA,EAAA,gBAAA,IACb,KAAK,IAAC,WAAI,EAAA,cAAA,EAAA;GAEV,MAAI,aAAA,KAAA,IAAA,WAAA,EAAA;AACJ,OAAI,CAAC,WAAU,KACX;AAEP,cAAA,YAAA,MAAA,OAAA,MAAA;AACL,QAAA,wBAAA,OAAA,WAAA,OAAA;AACK,aAAA,MAAA;IACA,QAAA,GAAA,QAAA,OAAA,aAAA,aAAA;IACO,MAAK;IACL,UAAS;IAChB,CAAA;aAEQ,KAAC,IAAM,SAAW,EAAE,aAAa,EAAC,MAAO,OAAO,CAAC,IAC/D,KAAA,IAAA,WAAA,EAAA,cAAA,EAAA;GAEO,MAAI,aAAA,KAAA,IAAA,WAAA,EAAA;AACH,OAAA,CAAA,WAAA,KACL;AAEK,cAAA,YAAA,MAAA,OAAA,KAAA;;IAER;QAAA;EAAA;QAAA;EAAA;EAAA;EAAA;EAAA,CAAA,EACH,EACH"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
const require_helpers_load = require('../helpers/load.cjs');
|
|
4
|
-
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
5
4
|
let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
5
|
+
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
6
6
|
let defu = require("defu");
|
|
7
7
|
defu = require_runtime.__toESM(defu);
|
|
8
8
|
let _alloy_js_core = require("@alloy-js/core");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { loadEnvFromContext } from "../helpers/load.mjs";
|
|
2
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
3
2
|
import { ReflectionClass, ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
3
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
4
4
|
import defu from "defu";
|
|
5
5
|
import { For, Show, code, computed, splitProps } from "@alloy-js/core";
|
|
6
6
|
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let powerlines = require("powerlines");
|
|
3
4
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
4
5
|
let automd = require("automd");
|
|
5
6
|
|
|
6
7
|
//#region src/helpers/automd-generator.ts
|
|
8
|
+
function __assignType(fn, args) {
|
|
9
|
+
fn.__type = args;
|
|
10
|
+
return fn;
|
|
11
|
+
}
|
|
7
12
|
/**
|
|
8
13
|
* AutoMD generator to generate environment variable documentation
|
|
9
14
|
*
|
|
10
15
|
* @param context - The generator context.
|
|
11
16
|
* @returns The generated documentation content.
|
|
12
17
|
*/
|
|
13
|
-
const env = (context) => (0, automd.defineGenerator)({
|
|
18
|
+
const env = __assignType((context) => (0, automd.defineGenerator)({
|
|
14
19
|
name: "env",
|
|
15
|
-
async generate() {
|
|
20
|
+
generate: __assignType(async function generate() {
|
|
16
21
|
const envDocFile = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "docs", "generated", "env.md");
|
|
17
22
|
if (!context.fs.existsSync(envDocFile)) return { contents: "" };
|
|
18
23
|
return { contents: await context.fs.read(envDocFile) || "" };
|
|
19
|
-
}
|
|
20
|
-
})
|
|
24
|
+
}, ["generate", "P\"/!"])
|
|
25
|
+
}), [
|
|
26
|
+
() => powerlines.__ΩUnresolvedContext,
|
|
27
|
+
"context",
|
|
28
|
+
"",
|
|
29
|
+
"Pn!2\"\"/#"
|
|
30
|
+
]);
|
|
21
31
|
|
|
22
32
|
//#endregion
|
|
23
33
|
exports.env = env;
|
|
@@ -1,21 +1,31 @@
|
|
|
1
|
+
import { __ΩUnresolvedContext } from "powerlines";
|
|
1
2
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
2
3
|
import { defineGenerator } from "automd";
|
|
3
4
|
|
|
4
5
|
//#region src/helpers/automd-generator.ts
|
|
6
|
+
function __assignType(fn, args) {
|
|
7
|
+
fn.__type = args;
|
|
8
|
+
return fn;
|
|
9
|
+
}
|
|
5
10
|
/**
|
|
6
11
|
* AutoMD generator to generate environment variable documentation
|
|
7
12
|
*
|
|
8
13
|
* @param context - The generator context.
|
|
9
14
|
* @returns The generated documentation content.
|
|
10
15
|
*/
|
|
11
|
-
const env = (context) => defineGenerator({
|
|
16
|
+
const env = __assignType((context) => defineGenerator({
|
|
12
17
|
name: "env",
|
|
13
|
-
async generate() {
|
|
18
|
+
generate: __assignType(async function generate() {
|
|
14
19
|
const envDocFile = joinPaths(context.config.root, "docs", "generated", "env.md");
|
|
15
20
|
if (!context.fs.existsSync(envDocFile)) return { contents: "" };
|
|
16
21
|
return { contents: await context.fs.read(envDocFile) || "" };
|
|
17
|
-
}
|
|
18
|
-
})
|
|
22
|
+
}, ["generate", "P\"/!"])
|
|
23
|
+
}), [
|
|
24
|
+
() => __ΩUnresolvedContext,
|
|
25
|
+
"context",
|
|
26
|
+
"",
|
|
27
|
+
"Pn!2\"\"/#"
|
|
28
|
+
]);
|
|
19
29
|
|
|
20
30
|
//#endregion
|
|
21
31
|
export { env };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.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 { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n context.config.root,\n \"docs\",\n \"generated\",\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.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 { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n context.config.root,\n \"docs\",\n \"generated\",\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":";;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;AAE1B,QAAU;;;;;;;;AA2BX,MAAU,MAAS,cAAE,YAAA,gBAAA;CACjB,MAAE;CACF,UAAI,aAAmB,eAAA,WAAA;EACnB,MAAM,aAAA,UAAA,QAAA,OAAA,MAAA,QAAA,aAAA,SAAA;AACN,MAAC,CAAA,QAAU,GAAA,WAAA,WAAA,CACP,QAAG,EACR,UAAA;AAIC,SAAE,EACD,UAFM,MAAA,QAAA,GAAA,KAAA,WAAA,IAEN,IACH;;CAEL,CAAC,EAAE;OAAO;CAAkB;CAAe;CAAC;CAAW,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_types_plugin = require('../types/plugin.cjs');
|
|
2
3
|
|
|
3
4
|
//#region src/helpers/create-reflection-resource.ts
|
|
4
5
|
/**
|
|
@@ -10,6 +11,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
10
11
|
function createReflection(_context) {
|
|
11
12
|
return {};
|
|
12
13
|
}
|
|
14
|
+
createReflection.__type = [
|
|
15
|
+
() => require_types_plugin.__ΩEnvPluginContext,
|
|
16
|
+
"_context",
|
|
17
|
+
"createReflection",
|
|
18
|
+
"Creates a reflection resource for the environment configuration.",
|
|
19
|
+
"Pn!2\"\"/#?$"
|
|
20
|
+
];
|
|
13
21
|
|
|
14
22
|
//#endregion
|
|
15
23
|
exports.createReflection = createReflection;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { __ΩEnvPluginContext } from "../types/plugin.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/helpers/create-reflection-resource.ts
|
|
2
4
|
/**
|
|
3
5
|
* Creates a reflection resource for the environment configuration.
|
|
@@ -8,6 +10,13 @@
|
|
|
8
10
|
function createReflection(_context) {
|
|
9
11
|
return {};
|
|
10
12
|
}
|
|
13
|
+
createReflection.__type = [
|
|
14
|
+
() => __ΩEnvPluginContext,
|
|
15
|
+
"_context",
|
|
16
|
+
"createReflection",
|
|
17
|
+
"Creates a reflection resource for the environment configuration.",
|
|
18
|
+
"Pn!2\"\"/#?$"
|
|
19
|
+
];
|
|
11
20
|
|
|
12
21
|
//#endregion
|
|
13
22
|
export { createReflection };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-reflection-resource.mjs","names":[],"sources":["../../src/helpers/create-reflection-resource.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 { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Creates a reflection resource for the environment configuration.\n *\n * @param _context - The environment plugin context.\n * @returns A resource that provides the reflection of the environment configuration.\n */\nexport function createReflection(_context: EnvPluginContext) {\n // const defaultValue = computed(\n // () => context && loadEnvFromContext(context, process.env)\n // );\n\n return {};\n\n // return computed(() => {\n // result.getProperties().forEach(prop => {\n // const aliases = prop.getAlias();\n // aliases.filter(Boolean).forEach(alias => {\n // result.addProperty({\n // name: alias,\n // optional: prop.isOptional() ? true : undefined,\n // readonly: prop.isReadonly() ? true : undefined,\n // description: prop.getDescription(),\n // visibility: prop.getVisibility(),\n // type: prop.getType(),\n // default: prop.getDefaultValue(),\n // tags: {\n // hidden: prop.isHidden(),\n // ignore: prop.isIgnored(),\n // internal: prop.isInternal(),\n // alias: prop\n // .getAlias()\n // .filter(a => a !== alias)\n // .concat(prop.name),\n // title: prop.getTitle() || titleCase(prop.name),\n // readonly: prop.isReadonly(),\n // permission: prop.getPermission(),\n // domain: prop.getDomain()\n // }\n // });\n // });\n // });\n\n // result.getProperties().forEach(prop => {\n // prop.setDefaultValue(\n // (defaultValue.value as Record<string, any>)?.[prop.getNameAsString()] ??\n // prop\n // .getAlias()\n // .reduce(\n // (ret, alias) =>\n // ret ?? (defaultValue.value as Record<string, any>)?.[alias],\n // undefined\n // ) ??\n // prop.getDefaultValue()\n // );\n // });\n // });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-reflection-resource.mjs","names":[],"sources":["../../src/helpers/create-reflection-resource.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 { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Creates a reflection resource for the environment configuration.\n *\n * @param _context - The environment plugin context.\n * @returns A resource that provides the reflection of the environment configuration.\n */\nexport function createReflection(_context: EnvPluginContext) {\n // const defaultValue = computed(\n // () => context && loadEnvFromContext(context, process.env)\n // );\n\n return {};\n\n // return computed(() => {\n // result.getProperties().forEach(prop => {\n // const aliases = prop.getAlias();\n // aliases.filter(Boolean).forEach(alias => {\n // result.addProperty({\n // name: alias,\n // optional: prop.isOptional() ? true : undefined,\n // readonly: prop.isReadonly() ? true : undefined,\n // description: prop.getDescription(),\n // visibility: prop.getVisibility(),\n // type: prop.getType(),\n // default: prop.getDefaultValue(),\n // tags: {\n // hidden: prop.isHidden(),\n // ignore: prop.isIgnored(),\n // internal: prop.isInternal(),\n // alias: prop\n // .getAlias()\n // .filter(a => a !== alias)\n // .concat(prop.name),\n // title: prop.getTitle() || titleCase(prop.name),\n // readonly: prop.isReadonly(),\n // permission: prop.getPermission(),\n // domain: prop.getDomain()\n // }\n // });\n // });\n // });\n\n // result.getProperties().forEach(prop => {\n // prop.setDefaultValue(\n // (defaultValue.value as Record<string, any>)?.[prop.getNameAsString()] ??\n // prop\n // .getAlias()\n // .reduce(\n // (ret, alias) =>\n // ret ?? (defaultValue.value as Record<string, any>)?.[alias],\n // undefined\n // ) ??\n // prop.getDefaultValue()\n // );\n // });\n // });\n}\n"],"mappings":";;;;;;;;;;AAYC,QAAU,EAAE;;AA4Cb,iBAAe,SAAQ;OAAK;CAAU;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_types_plugin = require('../types/plugin.cjs');
|
|
3
4
|
let _stryke_path_join = require("@stryke/path/join");
|
|
4
5
|
|
|
5
6
|
//#region src/helpers/docs-helper.ts
|
|
@@ -12,6 +13,13 @@ let _stryke_path_join = require("@stryke/path/join");
|
|
|
12
13
|
function getDocsOutputPath(context) {
|
|
13
14
|
return (0, _stryke_path_join.joinPaths)(context.config.root, "docs", "generated");
|
|
14
15
|
}
|
|
16
|
+
getDocsOutputPath.__type = [
|
|
17
|
+
() => require_types_plugin.__ΩEnvPluginContext,
|
|
18
|
+
"context",
|
|
19
|
+
"getDocsOutputPath",
|
|
20
|
+
"Gets the output path for the generated environment documentation.",
|
|
21
|
+
"Pn!2\"&/#?$"
|
|
22
|
+
];
|
|
15
23
|
|
|
16
24
|
//#endregion
|
|
17
25
|
exports.getDocsOutputPath = getDocsOutputPath;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __ΩEnvPluginContext } from "../types/plugin.mjs";
|
|
1
2
|
import { joinPaths } from "@stryke/path/join";
|
|
2
3
|
|
|
3
4
|
//#region src/helpers/docs-helper.ts
|
|
@@ -10,6 +11,13 @@ import { joinPaths } from "@stryke/path/join";
|
|
|
10
11
|
function getDocsOutputPath(context) {
|
|
11
12
|
return joinPaths(context.config.root, "docs", "generated");
|
|
12
13
|
}
|
|
14
|
+
getDocsOutputPath.__type = [
|
|
15
|
+
() => __ΩEnvPluginContext,
|
|
16
|
+
"context",
|
|
17
|
+
"getDocsOutputPath",
|
|
18
|
+
"Gets the output path for the generated environment documentation.",
|
|
19
|
+
"Pn!2\"&/#?$"
|
|
20
|
+
];
|
|
13
21
|
|
|
14
22
|
//#endregion
|
|
15
23
|
export { getDocsOutputPath };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-helper.mjs","names":[],"sources":["../../src/helpers/docs-helper.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 { joinPaths } from \"@stryke/path/join\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Gets the output path for the generated environment documentation.\n *\n * @param context - The environment plugin context.\n * @returns The output path for the generated environment documentation.\n */\nexport function getDocsOutputPath(context: EnvPluginContext): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"docs-helper.mjs","names":[],"sources":["../../src/helpers/docs-helper.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 { joinPaths } from \"@stryke/path/join\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Gets the output path for the generated environment documentation.\n *\n * @param context - The environment plugin context.\n * @returns The output path for the generated environment documentation.\n */\nexport function getDocsOutputPath(context: EnvPluginContext): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAE,kBAAA,SAAA;AACF,QAAO,UAAS,QAAA,OAAkB,MAAQ,QAAC,YAAmB;;AAE9D,kBAAA,SAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -8,6 +8,7 @@ const require_helpers_create_reflection_resource = require('./create-reflection-
|
|
|
8
8
|
|
|
9
9
|
exports.BaseEnv = require_helpers_reflect.BaseEnv;
|
|
10
10
|
exports.BaseSecrets = require_helpers_reflect.BaseSecrets;
|
|
11
|
+
exports.__ΩCreateEnvReflectionOptions = require_helpers_reflect.__ΩCreateEnvReflectionOptions;
|
|
11
12
|
exports.createEnvReflection = require_helpers_reflect.createEnvReflection;
|
|
12
13
|
exports.createReflection = require_helpers_create_reflection_resource.createReflection;
|
|
13
14
|
exports.createSecretsReflection = require_helpers_reflect.createSecretsReflection;
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseEnv, BaseSecrets, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./reflect.mjs";
|
|
1
|
+
import { BaseEnv, BaseSecrets, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./reflect.mjs";
|
|
2
2
|
import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection } from "./persistence.mjs";
|
|
3
3
|
import { createTemplateReflection } from "./template-helpers.mjs";
|
|
4
4
|
import { formatEnvField, removeEnvPrefix } from "./source-file-env.mjs";
|
|
5
5
|
import { loadEnv, loadEnvFromContext } from "./load.mjs";
|
|
6
6
|
import { createReflection } from "./create-reflection-resource.mjs";
|
|
7
7
|
|
|
8
|
-
export { BaseEnv, BaseSecrets, createEnvReflection, createReflection, createSecretsReflection, createTemplateReflection, formatEnvField, getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, loadEnv, loadEnvFromContext, mergeEnvReflections, mergeSecretsReflections, readEnvReflection, readEnvTypeReflection, readSecretsReflection, reflectEnv, reflectSecrets, removeEnvPrefix, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|
|
8
|
+
export { BaseEnv, BaseSecrets, __ΩCreateEnvReflectionOptions, createEnvReflection, createReflection, createSecretsReflection, createTemplateReflection, formatEnvField, getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, loadEnv, loadEnvFromContext, mergeEnvReflections, mergeSecretsReflections, readEnvReflection, readEnvTypeReflection, readSecretsReflection, reflectEnv, reflectSecrets, removeEnvPrefix, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|