@powerlines/plugin-env 0.16.183 → 0.16.185
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/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/babel/index.cjs +4 -1
- package/dist/babel/index.mjs +3 -1
- package/dist/babel/plugin.cjs +137 -4
- package/dist/babel/plugin.mjs +135 -4
- package/dist/babel/plugin.mjs.map +1 -1
- package/dist/components/docs.cjs +111 -1
- package/dist/components/docs.mjs +108 -1
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/env-builtin.cjs +730 -13
- package/dist/components/env-builtin.mjs +726 -11
- package/dist/components/env-builtin.mjs.map +1 -1
- package/dist/components/index.cjs +9 -1
- package/dist/components/index.mjs +4 -1
- package/dist/helpers/automd-generator.cjs +32 -1
- package/dist/helpers/automd-generator.mjs +30 -1
- package/dist/helpers/automd-generator.mjs.map +1 -1
- package/dist/helpers/create-reflection-resource.cjs +23 -1
- package/dist/helpers/create-reflection-resource.mjs +22 -1
- package/dist/helpers/create-reflection-resource.mjs.map +1 -1
- package/dist/helpers/index.cjs +34 -1
- package/dist/helpers/index.mjs +8 -1
- package/dist/helpers/load.cjs +141 -1
- package/dist/helpers/load.mjs +137 -1
- package/dist/helpers/load.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +308 -1
- package/dist/helpers/persistence.mjs +295 -1
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/reflect.cjs +290 -1
- package/dist/helpers/reflect.mjs +280 -1
- package/dist/helpers/reflect.mjs.map +1 -1
- package/dist/helpers/source-file-env.cjs +59 -1
- package/dist/helpers/source-file-env.mjs +56 -1
- package/dist/helpers/source-file-env.mjs.map +1 -1
- package/dist/helpers/template-helpers.cjs +70 -1
- package/dist/helpers/template-helpers.mjs +68 -1
- package/dist/helpers/template-helpers.mjs.map +1 -1
- package/dist/index.cjs +306 -7
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +292 -7
- package/dist/index.mjs.map +1 -1
- package/dist/types/env.cjs +541 -1
- package/dist/types/env.mjs +538 -1
- package/dist/types/env.mjs.map +1 -1
- package/dist/types/index.cjs +11 -1
- package/dist/types/index.mjs +4 -1
- package/dist/types/plugin.cjs +115 -1
- package/dist/types/plugin.mjs +109 -1
- package/dist/types/plugin.mjs.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1,59 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _stryke_env_types = require("@stryke/env/types");
|
|
4
|
+
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
5
|
+
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
6
|
+
|
|
7
|
+
//#region src/helpers/source-file-env.ts
|
|
8
|
+
function __assignType(fn, args) {
|
|
9
|
+
fn.__type = args;
|
|
10
|
+
return fn;
|
|
11
|
+
}
|
|
12
|
+
const __ΩTReturned = [
|
|
13
|
+
"TEnv",
|
|
14
|
+
"TReturned",
|
|
15
|
+
"l2&R!RPe#!&qk#%QRb!Pde\"!p'w\"y"
|
|
16
|
+
];
|
|
17
|
+
function removeEnvPrefix(env) {
|
|
18
|
+
if ((0, _stryke_type_checks_is_string.isString)(env)) {
|
|
19
|
+
let name = _stryke_env_types.ENV_PREFIXES.reduce(__assignType((ret, prefix) => {
|
|
20
|
+
if (ret.startsWith(prefix)) ret = ret.slice(prefix.length);
|
|
21
|
+
return ret;
|
|
22
|
+
}, [
|
|
23
|
+
"ret",
|
|
24
|
+
"prefix",
|
|
25
|
+
"",
|
|
26
|
+
"P\"2!\"2\"\"/#"
|
|
27
|
+
]), env.toUpperCase());
|
|
28
|
+
while (name.startsWith("_")) name = name.slice(1);
|
|
29
|
+
return name;
|
|
30
|
+
}
|
|
31
|
+
return Object.keys(env).reduce(__assignType((ret, key) => {
|
|
32
|
+
const name = removeEnvPrefix(key);
|
|
33
|
+
if (name) ret[name] = env[key];
|
|
34
|
+
return ret;
|
|
35
|
+
}, [
|
|
36
|
+
"ret",
|
|
37
|
+
"key",
|
|
38
|
+
"",
|
|
39
|
+
"P\"2!\"2\"\"/#"
|
|
40
|
+
]), {});
|
|
41
|
+
}
|
|
42
|
+
removeEnvPrefix.__type = [
|
|
43
|
+
"env",
|
|
44
|
+
() => __ΩTReturned,
|
|
45
|
+
"removeEnvPrefix",
|
|
46
|
+
"P\"2!\"o\"\"/#"
|
|
47
|
+
];
|
|
48
|
+
function formatEnvField(key) {
|
|
49
|
+
return (0, _stryke_string_format_camel_case.camelCase)(removeEnvPrefix(key));
|
|
50
|
+
}
|
|
51
|
+
formatEnvField.__type = [
|
|
52
|
+
"key",
|
|
53
|
+
"formatEnvField",
|
|
54
|
+
"P&2!&/\""
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
exports.formatEnvField = formatEnvField;
|
|
59
|
+
exports.removeEnvPrefix = removeEnvPrefix;
|
|
@@ -1,2 +1,57 @@
|
|
|
1
|
-
import{ENV_PREFIXES
|
|
1
|
+
import { ENV_PREFIXES } from "@stryke/env/types";
|
|
2
|
+
import { camelCase } from "@stryke/string-format/camel-case";
|
|
3
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
4
|
+
|
|
5
|
+
//#region src/helpers/source-file-env.ts
|
|
6
|
+
function __assignType(fn, args) {
|
|
7
|
+
fn.__type = args;
|
|
8
|
+
return fn;
|
|
9
|
+
}
|
|
10
|
+
const __ΩTReturned = [
|
|
11
|
+
"TEnv",
|
|
12
|
+
"TReturned",
|
|
13
|
+
"l2&R!RPe#!&qk#%QRb!Pde\"!p'w\"y"
|
|
14
|
+
];
|
|
15
|
+
function removeEnvPrefix(env) {
|
|
16
|
+
if (isString(env)) {
|
|
17
|
+
let name = ENV_PREFIXES.reduce(__assignType((ret, prefix) => {
|
|
18
|
+
if (ret.startsWith(prefix)) ret = ret.slice(prefix.length);
|
|
19
|
+
return ret;
|
|
20
|
+
}, [
|
|
21
|
+
"ret",
|
|
22
|
+
"prefix",
|
|
23
|
+
"",
|
|
24
|
+
"P\"2!\"2\"\"/#"
|
|
25
|
+
]), env.toUpperCase());
|
|
26
|
+
while (name.startsWith("_")) name = name.slice(1);
|
|
27
|
+
return name;
|
|
28
|
+
}
|
|
29
|
+
return Object.keys(env).reduce(__assignType((ret, key) => {
|
|
30
|
+
const name = removeEnvPrefix(key);
|
|
31
|
+
if (name) ret[name] = env[key];
|
|
32
|
+
return ret;
|
|
33
|
+
}, [
|
|
34
|
+
"ret",
|
|
35
|
+
"key",
|
|
36
|
+
"",
|
|
37
|
+
"P\"2!\"2\"\"/#"
|
|
38
|
+
]), {});
|
|
39
|
+
}
|
|
40
|
+
removeEnvPrefix.__type = [
|
|
41
|
+
"env",
|
|
42
|
+
() => __ΩTReturned,
|
|
43
|
+
"removeEnvPrefix",
|
|
44
|
+
"P\"2!\"o\"\"/#"
|
|
45
|
+
];
|
|
46
|
+
function formatEnvField(key) {
|
|
47
|
+
return camelCase(removeEnvPrefix(key));
|
|
48
|
+
}
|
|
49
|
+
formatEnvField.__type = [
|
|
50
|
+
"key",
|
|
51
|
+
"formatEnvField",
|
|
52
|
+
"P&2!&/\""
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { formatEnvField, removeEnvPrefix };
|
|
2
57
|
//# sourceMappingURL=source-file-env.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-file-env.mjs","names":[],"sources":["../../src/helpers/source-file-env.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 type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { ENV_PREFIXES } from \"@stryke/env/types\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\n\ntype TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;\n\nexport function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(\n env: TEnv\n): TReturned<TEnv> {\n if (isString(env)) {\n let name: string = ENV_PREFIXES.reduce((ret, prefix) => {\n if (ret.startsWith(prefix)) {\n ret = ret.slice(prefix.length);\n }\n\n return ret;\n }, env.toUpperCase());\n\n while (name.startsWith(\"_\")) {\n name = name.slice(1);\n }\n\n return name as TReturned<TEnv>;\n }\n\n return Object.keys(env).reduce((ret, key) => {\n const name = removeEnvPrefix(key);\n if (name) {\n (ret as DotenvParseOutput)[name] = env[key];\n }\n\n return ret;\n }, {} as TReturned<TEnv>);\n}\n\nexport function formatEnvField(key: string): string {\n return camelCase(removeEnvPrefix(key));\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"source-file-env.mjs","names":[],"sources":["../../src/helpers/source-file-env.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 type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { ENV_PREFIXES } from \"@stryke/env/types\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\n\ntype TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;\n\nexport function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(\n env: TEnv\n): TReturned<TEnv> {\n if (isString(env)) {\n let name: string = ENV_PREFIXES.reduce((ret, prefix) => {\n if (ret.startsWith(prefix)) {\n ret = ret.slice(prefix.length);\n }\n\n return ret;\n }, env.toUpperCase());\n\n while (name.startsWith(\"_\")) {\n name = name.slice(1);\n }\n\n return name as TReturned<TEnv>;\n }\n\n return Object.keys(env).reduce((ret, key) => {\n const name = removeEnvPrefix(key);\n if (name) {\n (ret as DotenvParseOutput)[name] = env[key];\n }\n\n return ret;\n }, {} as TReturned<TEnv>);\n}\n\nexport function formatEnvField(key: string): string {\n return camelCase(removeEnvPrefix(key));\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE9B,QAAO;;AAKT,MAAK,eAAe;CAAE;CAAQ;CAAC;CAAoC;;AAElE,KAAA,SAAc,IAAI,EAAE;EACpB,IAAA,OAAc,aAAY,OAAQ,cAAW,KAAM,WAAS;AAC5D,OAAA,IAAa,WAAW,OAAO,CACxB,OAAM,IAAI,MAAM,OAAG,OAAQ;AAE7B,UAAO;;;;;;;AAET,SAAO,KAAK,WAAW,IAAI;AAG/B,SAAS;;AAET,QAAS,OAAA,KAAW,IAAK,CAAC,OAAO,cAAa,KAAG,QAAO;;AAEpD,MAAC;AAGH,SAAK;IACJ;EAAA;EAAU;EAAM;EAAA;EAAA,CAAA,EAAA,EAAA,CAAA;;AAEnB,gBAAc,SAAS;CAAA;OAAa;CAAa;CAAW;CAAA;AAC5D,SAAc,eAAiB,KAAG;AAChC,QAAM,UAAU,gBAAa,IAAO,CAAA"}
|
|
@@ -1 +1,70 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_types_plugin = require('../types/plugin.cjs');
|
|
4
|
+
const require_helpers_persistence = require('./persistence.cjs');
|
|
5
|
+
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
6
|
+
|
|
7
|
+
//#region src/helpers/template-helpers.ts
|
|
8
|
+
function __assignType(fn, args) {
|
|
9
|
+
fn.__type = args;
|
|
10
|
+
return fn;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates the reflection data used when generating runtime template files.
|
|
14
|
+
*
|
|
15
|
+
* @param context - The context for the configuration plugin.
|
|
16
|
+
* @param name - The name of the configuration template.
|
|
17
|
+
* @returns The reflection for the specified configuration template.
|
|
18
|
+
*/
|
|
19
|
+
async function createTemplateReflection(context, name) {
|
|
20
|
+
const reflection = await require_helpers_persistence.readEnvTypeReflection(context, name);
|
|
21
|
+
reflection.getProperties().forEach(__assignType((prop) => {
|
|
22
|
+
prop.getAlias().filter(Boolean).forEach(__assignType((alias) => {
|
|
23
|
+
reflection.addProperty({
|
|
24
|
+
name: alias,
|
|
25
|
+
optional: prop.isOptional() ? true : void 0,
|
|
26
|
+
readonly: prop.isReadonly() ? true : void 0,
|
|
27
|
+
description: prop.getDescription(),
|
|
28
|
+
visibility: prop.getVisibility(),
|
|
29
|
+
type: prop.getType(),
|
|
30
|
+
default: prop.getDefaultValue(),
|
|
31
|
+
tags: {
|
|
32
|
+
hidden: prop.isHidden(),
|
|
33
|
+
ignore: prop.isIgnored(),
|
|
34
|
+
internal: prop.isInternal(),
|
|
35
|
+
runtime: prop.isRuntime(),
|
|
36
|
+
alias: prop.getAlias().filter(__assignType((a) => a !== alias, [
|
|
37
|
+
"a",
|
|
38
|
+
"",
|
|
39
|
+
"P\"2!\"/\""
|
|
40
|
+
])).concat(prop.name),
|
|
41
|
+
title: prop.getTitle() || (0, _stryke_string_format_title_case.titleCase)(prop.name),
|
|
42
|
+
readonly: prop.isReadonly(),
|
|
43
|
+
permission: prop.getPermission(),
|
|
44
|
+
domain: prop.getDomain()
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}, [
|
|
48
|
+
"alias",
|
|
49
|
+
"",
|
|
50
|
+
"P\"2!\"/\""
|
|
51
|
+
]));
|
|
52
|
+
}, [
|
|
53
|
+
"prop",
|
|
54
|
+
"",
|
|
55
|
+
"P\"2!\"/\""
|
|
56
|
+
]));
|
|
57
|
+
return reflection;
|
|
58
|
+
}
|
|
59
|
+
createTemplateReflection.__type = [
|
|
60
|
+
() => require_types_plugin.__ΩEnvPluginContext,
|
|
61
|
+
"context",
|
|
62
|
+
() => require_types_plugin.__ΩEnvType,
|
|
63
|
+
"name",
|
|
64
|
+
"createTemplateReflection",
|
|
65
|
+
"Creates the reflection data used when generating runtime template files.",
|
|
66
|
+
"Pn!2\"n#2$8!`/%?&"
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
exports.createTemplateReflection = createTemplateReflection;
|
|
@@ -1,2 +1,69 @@
|
|
|
1
|
-
import{__ΩEnvPluginContext
|
|
1
|
+
import { __ΩEnvPluginContext, __ΩEnvType } from "../types/plugin.mjs";
|
|
2
|
+
import { readEnvTypeReflection } from "./persistence.mjs";
|
|
3
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
4
|
+
|
|
5
|
+
//#region src/helpers/template-helpers.ts
|
|
6
|
+
function __assignType(fn, args) {
|
|
7
|
+
fn.__type = args;
|
|
8
|
+
return fn;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Creates the reflection data used when generating runtime template files.
|
|
12
|
+
*
|
|
13
|
+
* @param context - The context for the configuration plugin.
|
|
14
|
+
* @param name - The name of the configuration template.
|
|
15
|
+
* @returns The reflection for the specified configuration template.
|
|
16
|
+
*/
|
|
17
|
+
async function createTemplateReflection(context, name) {
|
|
18
|
+
const reflection = await readEnvTypeReflection(context, name);
|
|
19
|
+
reflection.getProperties().forEach(__assignType((prop) => {
|
|
20
|
+
prop.getAlias().filter(Boolean).forEach(__assignType((alias) => {
|
|
21
|
+
reflection.addProperty({
|
|
22
|
+
name: alias,
|
|
23
|
+
optional: prop.isOptional() ? true : void 0,
|
|
24
|
+
readonly: prop.isReadonly() ? true : void 0,
|
|
25
|
+
description: prop.getDescription(),
|
|
26
|
+
visibility: prop.getVisibility(),
|
|
27
|
+
type: prop.getType(),
|
|
28
|
+
default: prop.getDefaultValue(),
|
|
29
|
+
tags: {
|
|
30
|
+
hidden: prop.isHidden(),
|
|
31
|
+
ignore: prop.isIgnored(),
|
|
32
|
+
internal: prop.isInternal(),
|
|
33
|
+
runtime: prop.isRuntime(),
|
|
34
|
+
alias: prop.getAlias().filter(__assignType((a) => a !== alias, [
|
|
35
|
+
"a",
|
|
36
|
+
"",
|
|
37
|
+
"P\"2!\"/\""
|
|
38
|
+
])).concat(prop.name),
|
|
39
|
+
title: prop.getTitle() || titleCase(prop.name),
|
|
40
|
+
readonly: prop.isReadonly(),
|
|
41
|
+
permission: prop.getPermission(),
|
|
42
|
+
domain: prop.getDomain()
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}, [
|
|
46
|
+
"alias",
|
|
47
|
+
"",
|
|
48
|
+
"P\"2!\"/\""
|
|
49
|
+
]));
|
|
50
|
+
}, [
|
|
51
|
+
"prop",
|
|
52
|
+
"",
|
|
53
|
+
"P\"2!\"/\""
|
|
54
|
+
]));
|
|
55
|
+
return reflection;
|
|
56
|
+
}
|
|
57
|
+
createTemplateReflection.__type = [
|
|
58
|
+
() => __ΩEnvPluginContext,
|
|
59
|
+
"context",
|
|
60
|
+
() => __ΩEnvType,
|
|
61
|
+
"name",
|
|
62
|
+
"createTemplateReflection",
|
|
63
|
+
"Creates the reflection data used when generating runtime template files.",
|
|
64
|
+
"Pn!2\"n#2$8!`/%?&"
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { createTemplateReflection };
|
|
2
69
|
//# sourceMappingURL=template-helpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-helpers.mjs","names":[],"sources":["../../src/helpers/template-helpers.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 { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { EnvPluginContext, EnvType } from \"../types/plugin\";\nimport { readEnvTypeReflection } from \"./persistence\";\n\n/**\n * Creates the reflection data used when generating runtime template files.\n *\n * @param context - The context for the configuration plugin.\n * @param name - The name of the configuration template.\n * @returns The reflection for the specified configuration template.\n */\nexport async function createTemplateReflection(\n context: EnvPluginContext,\n name?: EnvType\n): Promise<ReflectionClass<any>> {\n const reflection = await readEnvTypeReflection(context, name);\n\n reflection.getProperties().forEach(prop => {\n const aliases = prop.getAlias();\n aliases.filter(Boolean).forEach(alias => {\n reflection.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 runtime: prop.isRuntime(),\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 return reflection;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"template-helpers.mjs","names":[],"sources":["../../src/helpers/template-helpers.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 { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { EnvPluginContext, EnvType } from \"../types/plugin\";\nimport { readEnvTypeReflection } from \"./persistence\";\n\n/**\n * Creates the reflection data used when generating runtime template files.\n *\n * @param context - The context for the configuration plugin.\n * @param name - The name of the configuration template.\n * @returns The reflection for the specified configuration template.\n */\nexport async function createTemplateReflection(\n context: EnvPluginContext,\n name?: EnvType\n): Promise<ReflectionClass<any>> {\n const reflection = await readEnvTypeReflection(context, name);\n\n reflection.getProperties().forEach(prop => {\n const aliases = prop.getAlias();\n aliases.filter(Boolean).forEach(alias => {\n reflection.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 runtime: prop.isRuntime(),\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 return reflection;\n}\n"],"mappings":";;;;;AAIA,SAAM,aAAS,IAAW,MAAM;AAC/B,IAAG,SAAU;AACb,QAAQ;;;;;;;;;;CAYT,MAAQ,aAAC,MAAkB,sBAAkB,SAAQ,KAAO;AAC5D,YAAS,eAAmB,CAAA,QAAO,cAAc,SAAM;AAEvD,EADS,KAAgB,UAChB,CAAA,OAAA,QAAA,CAAA,QAAwB,cAAQ,UAAY;;IAEnD,MAAA;IACC,UAAY,KAAA,YAAoB,GAAC,OAAK;IACxC,UAAA,KAAA,YAAA,GAAA,OAAA;IACG,aAAgB,KAAI,gBAAgB;IACpC,YAAgB,KAAK,eAAQ;IAC7B,MAAQ,KAAI,SAAW;IACzB,SAAA,KAAA,iBAAA;IACK,MAAM;KACH,QAAC,KAAA,UAAgB;KAClB,QAAA,KAAA,WAAA;KACC,UAAC,KAAA,YAAsB;KACzB,SAAW,KAAE,WAAM;;;;;;KAEzB,OAAW,KAAA,UAAgB,IAAO,UAAS,KAAA,KAAA;KACnC,UAAU,KAAK,YAAU;KAC/B,YAAe,KAAQ,eAAe;KACpC,QAAW,KAAA,WAAY;KACrB;IACD,CAAC;KACD;GAAC;GAAS;GAAC;GAAK,CAAA,CAAU;IAC5B;EAAC;EAAE;EAAA;EAAkB,CAAA,CAAA;AACxB,QAAM;;AAER,yBAAsB,SAAA;OAAiB;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,306 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_types_plugin = require('./types/plugin.cjs');
|
|
4
|
+
const require_types_env = require('./types/env.cjs');
|
|
5
|
+
const require_helpers_reflect = require('./helpers/reflect.cjs');
|
|
6
|
+
const require_helpers_persistence = require('./helpers/persistence.cjs');
|
|
7
|
+
const require_helpers_load = require('./helpers/load.cjs');
|
|
8
|
+
const require_helpers_automd_generator = require('./helpers/automd-generator.cjs');
|
|
9
|
+
const require_components_docs = require('./components/docs.cjs');
|
|
10
|
+
const require_components_env_builtin = require('./components/env-builtin.cjs');
|
|
11
|
+
const require_babel_plugin = require('./babel/plugin.cjs');
|
|
12
|
+
let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
13
|
+
let defu = require("defu");
|
|
14
|
+
defu = require_runtime.__toESM(defu);
|
|
15
|
+
let powerlines_constants = require("powerlines/constants");
|
|
16
|
+
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
17
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
18
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
19
|
+
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
20
|
+
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
21
|
+
let _powerlines_plugin_automd = require("@powerlines/plugin-automd");
|
|
22
|
+
_powerlines_plugin_automd = require_runtime.__toESM(_powerlines_plugin_automd);
|
|
23
|
+
let _powerlines_plugin_babel = require("@powerlines/plugin-babel");
|
|
24
|
+
_powerlines_plugin_babel = require_runtime.__toESM(_powerlines_plugin_babel);
|
|
25
|
+
let _powerlines_plugin_deepkit = require("@powerlines/plugin-deepkit");
|
|
26
|
+
_powerlines_plugin_deepkit = require_runtime.__toESM(_powerlines_plugin_deepkit);
|
|
27
|
+
let _stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
28
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
29
|
+
let _stryke_fs_exists = require("@stryke/fs/exists");
|
|
30
|
+
let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
31
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
32
|
+
|
|
33
|
+
//#region src/index.tsx
|
|
34
|
+
function __assignType(fn, args) {
|
|
35
|
+
fn.__type = args;
|
|
36
|
+
return fn;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A Powerlines plugin to inject environment variables into the source code.
|
|
40
|
+
*/
|
|
41
|
+
const plugin = __assignType((options = {}) => {
|
|
42
|
+
return [
|
|
43
|
+
(0, _powerlines_plugin_deepkit.default)(options.deepkit),
|
|
44
|
+
(0, _powerlines_plugin_babel.default)(options.babel),
|
|
45
|
+
{
|
|
46
|
+
name: "env",
|
|
47
|
+
async config() {
|
|
48
|
+
this.debug("Providing default configuration for the Powerlines `env` build plugin.");
|
|
49
|
+
const config = {
|
|
50
|
+
env: (0, defu.default)(options, {
|
|
51
|
+
types: {},
|
|
52
|
+
validate: false,
|
|
53
|
+
inject: false,
|
|
54
|
+
prefix: []
|
|
55
|
+
}),
|
|
56
|
+
babel: { plugins: [require_babel_plugin.envBabelPlugin] },
|
|
57
|
+
deepkit: {
|
|
58
|
+
reflection: "default",
|
|
59
|
+
level: "all"
|
|
60
|
+
},
|
|
61
|
+
tsc: {}
|
|
62
|
+
};
|
|
63
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(config.env.types) && !(0, _stryke_type_checks_is_set_string.isSetString)(config.env.types?.file)) {
|
|
64
|
+
this.warn("The `env.types` configuration parameter was not provided. Please ensure this is expected.");
|
|
65
|
+
config.env.types = await require_helpers_persistence.getEnvDefaultTypeDefinition(this);
|
|
66
|
+
}
|
|
67
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(config.env.secrets) && !(0, _stryke_type_checks_is_set_string.isSetString)(config.env.secrets?.file)) config.env.secrets = await require_helpers_persistence.getSecretsDefaultTypeDefinition(this);
|
|
68
|
+
if (config.env.types || config.env.secrets) config.tsc.filter = { id: [new RegExp(`^(${powerlines_constants.VIRTUAL_MODULE_PREFIX})?${(0, _stryke_path_join.joinPaths)(this.builtinsPath, "env.ts").replace(/\\/g, "\\\\").replace(/\//g, "\\/").replace(/\./g, "\\.").replace(/\$/g, "\\$")}$`)] };
|
|
69
|
+
config.env.prefix = (0, _stryke_convert_to_array.toArray)(config.env.prefix ?? []).reduce(__assignType((ret, prefix) => {
|
|
70
|
+
const formattedPrefix = (0, _stryke_string_format_constant_case.constantCase)(prefix);
|
|
71
|
+
if (!ret.includes(formattedPrefix)) ret.push(formattedPrefix);
|
|
72
|
+
return ret;
|
|
73
|
+
}, [
|
|
74
|
+
"ret",
|
|
75
|
+
"prefix",
|
|
76
|
+
"",
|
|
77
|
+
"P&F2!&2\"\"/#"
|
|
78
|
+
]), ["POWERLINES_", this.config.framework && this.config.framework !== "powerlines" && `${(0, _stryke_string_format_constant_case.constantCase)(this.config.framework)}_`].filter(Boolean));
|
|
79
|
+
config.env.prefix = (0, _stryke_helpers_get_unique.getUnique)((0, _stryke_convert_to_array.toArray)(config.env.prefix).reduce(__assignType((ret, prefix) => {
|
|
80
|
+
if (!ret.includes(prefix.replace(/_$/g, ""))) ret.push(prefix.replace(/_$/g, ""));
|
|
81
|
+
return ret;
|
|
82
|
+
}, [
|
|
83
|
+
"ret",
|
|
84
|
+
"prefix",
|
|
85
|
+
"",
|
|
86
|
+
"P\"2!\"2\"\"/#"
|
|
87
|
+
]), []));
|
|
88
|
+
return config;
|
|
89
|
+
},
|
|
90
|
+
async configResolved() {
|
|
91
|
+
this.debug(`Environment plugin configuration has been resolved for the Powerlines project.`);
|
|
92
|
+
this.env = (0, defu.default)({ parsed: await require_helpers_load.loadEnv(this, this.config.env) }, this.env ?? {}, {
|
|
93
|
+
types: { env: {} },
|
|
94
|
+
used: {
|
|
95
|
+
env: {},
|
|
96
|
+
secrets: {}
|
|
97
|
+
},
|
|
98
|
+
parsed: {},
|
|
99
|
+
injected: {}
|
|
100
|
+
});
|
|
101
|
+
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)) {
|
|
102
|
+
this.config.env.types = (0, _stryke_convert_parse_type_definition.parseTypeDefinition)(this.config.env.types);
|
|
103
|
+
const file = await this.fs.resolve(this.config.env.types.file);
|
|
104
|
+
if (file) this.config.env.types.file = file;
|
|
105
|
+
}
|
|
106
|
+
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)) {
|
|
107
|
+
this.config.env.secrets = (0, _stryke_convert_parse_type_definition.parseTypeDefinition)(this.config.env.secrets);
|
|
108
|
+
const file = await this.fs.resolve(this.config.env.secrets.file);
|
|
109
|
+
if (file) this.config.env.secrets.file = file;
|
|
110
|
+
}
|
|
111
|
+
this.info({
|
|
112
|
+
meta: { category: "env" },
|
|
113
|
+
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"}`
|
|
114
|
+
});
|
|
115
|
+
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"))) {
|
|
116
|
+
this.debug(`Skipping reflection initialization as the meta checksum has not changed.`);
|
|
117
|
+
this.env.types.env = await require_helpers_persistence.readEnvTypeReflection(this, "env");
|
|
118
|
+
this.debug({
|
|
119
|
+
meta: { category: "env" },
|
|
120
|
+
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(", ")})` : ""}`, [
|
|
121
|
+
"prop",
|
|
122
|
+
"",
|
|
123
|
+
"P\"2!\"/\""
|
|
124
|
+
])).join("\n")}`
|
|
125
|
+
});
|
|
126
|
+
if ((0, _stryke_fs_exists.existsSync)(require_helpers_persistence.getEnvReflectionsPath(this, "env"))) {
|
|
127
|
+
this.env.used.env = await require_helpers_persistence.readEnvReflection(this);
|
|
128
|
+
this.debug({
|
|
129
|
+
meta: { category: "env" },
|
|
130
|
+
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(", ")})` : ""}`, [
|
|
131
|
+
"prop",
|
|
132
|
+
"",
|
|
133
|
+
"P\"2!\"/\""
|
|
134
|
+
])).join("\n")}`
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
if ((0, _stryke_fs_exists.existsSync)(require_helpers_persistence.getEnvTypeReflectionsPath(this, "secrets"))) {
|
|
138
|
+
this.env.types.secrets = await require_helpers_persistence.readEnvTypeReflection(this, "secrets");
|
|
139
|
+
if (this.env.types.secrets.getProperties().length > 0) this.debug({
|
|
140
|
+
meta: { category: "env" },
|
|
141
|
+
message: `Found the following secret configuration parameter definitions: \n${this.env.types.secrets.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(", ")})`, [
|
|
142
|
+
"prop",
|
|
143
|
+
"",
|
|
144
|
+
"P\"2!\"/\""
|
|
145
|
+
])).join("\n")}`
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
if ((0, _stryke_fs_exists.existsSync)(require_helpers_persistence.getEnvReflectionsPath(this, "secrets"))) {
|
|
149
|
+
this.env.used.secrets = await require_helpers_persistence.readSecretsReflection(this);
|
|
150
|
+
if (this.env.used.secrets.getProperties().length > 0) this.debug({
|
|
151
|
+
meta: { category: "env" },
|
|
152
|
+
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(", ")})`, [
|
|
153
|
+
"prop",
|
|
154
|
+
"",
|
|
155
|
+
"P\"2!\"/\""
|
|
156
|
+
])).join("\n")}`
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
this.debug(`Starting environment configuration reflection initialization.`);
|
|
161
|
+
this.env.types.env = await require_helpers_reflect.reflectEnv(this, this.config.env.types?.file, this.config.env.types?.name);
|
|
162
|
+
if (!this.env.types.env) throw new Error("Failed to find the environment configuration type reflection in the context.");
|
|
163
|
+
this.debug({
|
|
164
|
+
meta: { category: "env" },
|
|
165
|
+
message: `Found the following environment configuration parameter definitions: \n${this.env.types.env.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(", ")})`, [
|
|
166
|
+
"prop",
|
|
167
|
+
"",
|
|
168
|
+
"P\"2!\"/\""
|
|
169
|
+
])).join("\n")}`
|
|
170
|
+
});
|
|
171
|
+
await require_helpers_persistence.writeEnvTypeReflection(this, this.env.types.env, "env");
|
|
172
|
+
this.env.types.secrets = await require_helpers_reflect.reflectSecrets(this, this.config.env.secrets?.file, this.config.env.secrets?.name);
|
|
173
|
+
if (!this.env.types.secrets) throw new Error("Failed to find the secrets configuration type reflection in the context.");
|
|
174
|
+
if (this.env.types.secrets.getProperties().length > 0) this.debug({
|
|
175
|
+
meta: { category: "env" },
|
|
176
|
+
message: `Found the following secret configuration parameter definitions: \n${this.env.types.secrets.getProperties().map(__assignType((prop) => `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(", ")})`, [
|
|
177
|
+
"prop",
|
|
178
|
+
"",
|
|
179
|
+
"P\"2!\"/\""
|
|
180
|
+
])).join("\n")}`
|
|
181
|
+
});
|
|
182
|
+
await require_helpers_persistence.writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
|
|
183
|
+
this.info({
|
|
184
|
+
meta: { category: "env" },
|
|
185
|
+
message: `Resolved ${this.env.types.env.getProperties().length ?? 0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length ?? 0} secret configuration parameters`
|
|
186
|
+
});
|
|
187
|
+
const envWithAlias = this.env.types.env.getProperties().filter(__assignType((prop) => prop.getAlias().length > 0, [
|
|
188
|
+
"prop",
|
|
189
|
+
"",
|
|
190
|
+
"P\"2!\"/\""
|
|
191
|
+
]));
|
|
192
|
+
Object.entries(await require_helpers_load.loadEnv(this, this.config.env)).forEach(__assignType(([key, value]) => {
|
|
193
|
+
const unprefixedKey = this.config.env.prefix.reduce(__assignType((ret, prefix) => {
|
|
194
|
+
if (key.replace(/_$/g, "").startsWith(prefix)) return key.replace(/_$/g, "").slice(prefix.length);
|
|
195
|
+
return ret;
|
|
196
|
+
}, [
|
|
197
|
+
"ret",
|
|
198
|
+
"prefix",
|
|
199
|
+
"",
|
|
200
|
+
"P\"2!\"2\"\"/#"
|
|
201
|
+
]), key);
|
|
202
|
+
const aliasKey = envWithAlias.find(__assignType((prop) => prop?.getAlias().reverse().includes(unprefixedKey), [
|
|
203
|
+
"prop",
|
|
204
|
+
"",
|
|
205
|
+
"P\"2!\"/\""
|
|
206
|
+
]));
|
|
207
|
+
if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) this.env.types.env.getProperty(unprefixedKey).setDefaultValue(value);
|
|
208
|
+
}, [
|
|
209
|
+
"param0",
|
|
210
|
+
"",
|
|
211
|
+
"P\"2!\"/\""
|
|
212
|
+
]));
|
|
213
|
+
this.env.used.env = new _powerlines_deepkit_vendor_type.ReflectionClass({
|
|
214
|
+
kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
|
|
215
|
+
typeName: "Env",
|
|
216
|
+
description: `An object containing the environment configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
|
|
217
|
+
types: []
|
|
218
|
+
}, this.env.types.env);
|
|
219
|
+
await require_helpers_persistence.writeEnvReflection(this, this.env.used.env, "env");
|
|
220
|
+
if (this.env.types.secrets) {
|
|
221
|
+
await require_helpers_persistence.writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
|
|
222
|
+
this.env.used.secrets = new _powerlines_deepkit_vendor_type.ReflectionClass({
|
|
223
|
+
kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
|
|
224
|
+
typeName: "Secrets",
|
|
225
|
+
description: `An object containing the secret configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
|
|
226
|
+
types: []
|
|
227
|
+
}, this.env.types.secrets);
|
|
228
|
+
await require_helpers_persistence.writeEnvReflection(this, this.env.used.secrets, "secrets");
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
prepare: __assignType(async function prepare() {
|
|
233
|
+
const _self$ = this;
|
|
234
|
+
this.debug(`Preparing the Environment runtime artifacts for the Powerlines project.`);
|
|
235
|
+
const result = await require_helpers_persistence.readEnvTypeReflection(this, "env");
|
|
236
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_env_builtin.EnvBuiltin, {
|
|
237
|
+
get defaultConfig() {
|
|
238
|
+
return _self$.config.env.defaultConfig;
|
|
239
|
+
},
|
|
240
|
+
reflection: result
|
|
241
|
+
}));
|
|
242
|
+
}, ["prepare", "P\"/!"]),
|
|
243
|
+
transform: {
|
|
244
|
+
order: "post",
|
|
245
|
+
handler: __assignType(async function handler() {
|
|
246
|
+
if (this.env.used.env.getProperties().length > 0) {
|
|
247
|
+
this.trace(`Persisting used environment configuration reflections to ${require_helpers_persistence.getEnvReflectionsPath(this, "env")}.`);
|
|
248
|
+
await require_helpers_persistence.writeEnvReflection(this, this.env.used.env, "env");
|
|
249
|
+
}
|
|
250
|
+
if (this.env.used.secrets.getProperties().length > 0) {
|
|
251
|
+
this.trace(`Persisting used secret configuration reflections to ${require_helpers_persistence.getEnvReflectionsPath(this, "secrets")}.`);
|
|
252
|
+
await require_helpers_persistence.writeEnvReflection(this, this.env.used.secrets, "secrets");
|
|
253
|
+
}
|
|
254
|
+
}, ["handler", "P\"/!"])
|
|
255
|
+
},
|
|
256
|
+
docs: __assignType(async function docs() {
|
|
257
|
+
this.debug(`Documenting environment variables configuration values in "${(0, _stryke_path_join.joinPaths)((0, powerlines_plugin_utils.getDocsOutputPath)(this.config.root), "env.md")}"`);
|
|
258
|
+
const result = await require_helpers_persistence.readEnvTypeReflection(this, "env");
|
|
259
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.EnvDocsFile, {
|
|
260
|
+
levelOffset: 0,
|
|
261
|
+
reflection: result
|
|
262
|
+
}));
|
|
263
|
+
}, ["docs", "P\"/!"]),
|
|
264
|
+
buildEnd: __assignType(async function buildEnd() {
|
|
265
|
+
const reflectionPath = require_helpers_persistence.getEnvReflectionsPath(this, "env");
|
|
266
|
+
this.debug(`Writing env reflection types to ${reflectionPath}.`);
|
|
267
|
+
await require_helpers_persistence.writeEnvReflection(this, this.env.used.env, "env");
|
|
268
|
+
}, ["buildEnd", "P\"/!"])
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
name: "env:automd-generator",
|
|
272
|
+
config: __assignType(function config() {
|
|
273
|
+
return { automd: (0, defu.default)(options.automd ?? {}, { generators: { env: require_helpers_automd_generator.env(this) } }) };
|
|
274
|
+
}, ["config", "P\"/!"])
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: "env:vite",
|
|
278
|
+
vite: { configResolved: __assignType(function configResolved() {
|
|
279
|
+
return { envPrefix: this.config?.env?.prefix };
|
|
280
|
+
}, [
|
|
281
|
+
() => require_types_plugin.__ΩEnvPluginContext,
|
|
282
|
+
"this",
|
|
283
|
+
"configResolved",
|
|
284
|
+
"Pn!2\"\"/#"
|
|
285
|
+
]) }
|
|
286
|
+
},
|
|
287
|
+
(0, _powerlines_plugin_automd.default)(options.automd)
|
|
288
|
+
];
|
|
289
|
+
}, [
|
|
290
|
+
() => require_types_plugin.__ΩEnvPluginOptions,
|
|
291
|
+
"options",
|
|
292
|
+
() => ({}),
|
|
293
|
+
"",
|
|
294
|
+
"Pn!2\">#\"/$"
|
|
295
|
+
]);
|
|
296
|
+
|
|
297
|
+
//#endregion
|
|
298
|
+
exports.__ΩEnvInterface = require_types_env.__ΩEnvInterface;
|
|
299
|
+
exports.__ΩEnvPluginContext = require_types_plugin.__ΩEnvPluginContext;
|
|
300
|
+
exports.__ΩEnvPluginOptions = require_types_plugin.__ΩEnvPluginOptions;
|
|
301
|
+
exports.__ΩEnvPluginResolvedConfig = require_types_plugin.__ΩEnvPluginResolvedConfig;
|
|
302
|
+
exports.__ΩEnvPluginUserConfig = require_types_plugin.__ΩEnvPluginUserConfig;
|
|
303
|
+
exports.__ΩEnvType = require_types_plugin.__ΩEnvType;
|
|
304
|
+
exports.__ΩSecretsInterface = require_types_env.__ΩSecretsInterface;
|
|
305
|
+
exports.default = plugin;
|
|
306
|
+
exports.plugin = plugin;
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YAiEY,MAAA;IACR,GAAA,GAAM,gBAAA;EAAA;AAAA;;;;cAOG,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YAiEY,MAAA;IACR,GAAA,GAAM,gBAAA;EAAA;AAAA;;;;cAOG,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KA8dJ,MAAA,CAAO,QAAA"}
|