@powerlines/plugin-env 0.16.254 → 0.16.255
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 +10 -10
- package/dist/babel/plugin.d.cts.map +1 -1
- package/dist/babel/plugin.d.mts.map +1 -1
- package/dist/babel/plugin.mjs +11 -11
- package/dist/babel/plugin.mjs.map +1 -1
- package/dist/components/docs.cjs +6 -23
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/docs.mjs +9 -26
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/env-builtin.cjs +6 -6
- package/dist/components/env-builtin.mjs +6 -6
- package/dist/components/env-builtin.mjs.map +1 -1
- package/dist/helpers/index.cjs +4 -1
- package/dist/helpers/index.d.cts +2 -2
- package/dist/helpers/index.d.mts +2 -2
- package/dist/helpers/index.mjs +2 -2
- package/dist/helpers/load.cjs +1 -1
- package/dist/helpers/load.mjs +1 -1
- package/dist/helpers/load.mjs.map +1 -1
- package/dist/helpers/schema.cjs +99 -10
- package/dist/helpers/schema.d.cts +16 -1
- package/dist/helpers/schema.d.cts.map +1 -1
- package/dist/helpers/schema.d.mts +16 -1
- package/dist/helpers/schema.d.mts.map +1 -1
- package/dist/helpers/schema.mjs +98 -12
- package/dist/helpers/schema.mjs.map +1 -1
- package/dist/index.cjs +6 -7
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +8 -9
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +2 -2
- package/dist/types/plugin.cjs +9 -7
- package/dist/types/plugin.d.cts +11 -11
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +11 -11
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/plugin.mjs +9 -7
- package/dist/types/plugin.mjs.map +1 -1
- package/package.json +9 -9
package/dist/babel/plugin.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_types_plugin = require('../types/plugin.cjs');
|
|
3
|
+
let _powerlines_schema = require("@powerlines/schema");
|
|
3
4
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
4
5
|
let _powerlines_plugin_babel_helpers_create_plugin = require("@powerlines/plugin-babel/helpers/create-plugin");
|
|
5
6
|
let _powerlines_plugin_babel_helpers_module_helpers = require("@powerlines/plugin-babel/helpers/module-helpers");
|
|
6
|
-
let _powerlines_schema = require("@powerlines/schema");
|
|
7
7
|
let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
8
8
|
|
|
9
9
|
//#region src/babel/plugin.ts
|
|
@@ -12,7 +12,7 @@ function __assignType(fn, args) {
|
|
|
12
12
|
return fn;
|
|
13
13
|
}
|
|
14
14
|
const envBabelPlugin = (_powerlines_plugin_babel_helpers_create_plugin.createBabelPlugin.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_babel_helpers_create_plugin.createBabelPlugin)("env", __assignType(({ logger, context }) => {
|
|
15
|
-
const
|
|
15
|
+
const config = (0, _powerlines_schema.getProperties)(context.env.config);
|
|
16
16
|
function extractEnv(node, pass, isInjectable = false) {
|
|
17
17
|
if (node.name) {
|
|
18
18
|
const name = node.name.replace(new RegExp(`^(${context.config.env.prefix.join("|")})_`), "");
|
|
@@ -20,21 +20,21 @@ const envBabelPlugin = (_powerlines_plugin_babel_helpers_create_plugin.createBab
|
|
|
20
20
|
meta: { category: "env" },
|
|
21
21
|
message: `Environment variable ${name} found in ${pass.filename || "unknown file"}.`
|
|
22
22
|
});
|
|
23
|
-
if (name in
|
|
24
|
-
|
|
23
|
+
if (name in config && (0, _stryke_type_checks_is_set_object.isSetObject)(config[name]) && !config[name]?.isIgnored) {
|
|
24
|
+
config[name] ??= {};
|
|
25
25
|
logger.debug({
|
|
26
26
|
meta: { category: "env" },
|
|
27
27
|
message: `The "${name}" environment variable is used in the source code file "${pass.filename || "unknown file"}" and will be added to the environment schema's active variables list.`
|
|
28
28
|
});
|
|
29
|
-
|
|
30
|
-
if (!
|
|
31
|
-
if (context.config.env.validate && !
|
|
32
|
-
return (0, _powerlines_schema.stringifyValue)(
|
|
29
|
+
context.env.config.active.push(name);
|
|
30
|
+
if (!config[name].runtime && (context.config.env.inject && isInjectable || context.config.env.validate)) {
|
|
31
|
+
if (context.config.env.validate && !config[name].optional && (0, _stryke_type_checks_is_undefined.isUndefined)(config[name].default)) throw new Error(`Environment variable \`${name}\` is missing a default value, but is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}.\n\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`);
|
|
32
|
+
return (0, _powerlines_schema.stringifyValue)(config[name].default);
|
|
33
33
|
}
|
|
34
|
-
} else if (context.config.env.validate) throw new Error(`Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, but is not defined in the \`
|
|
34
|
+
} else if (context.config.env.validate) throw new Error(`Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, but is not defined in the \`config\` schema. Please check the \`env.config\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`);
|
|
35
35
|
else logger.warn({
|
|
36
36
|
meta: { category: "env" },
|
|
37
|
-
message: `Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, but is not defined in the \`
|
|
37
|
+
message: `Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, but is not defined in the \`config\` schema. If this is intentional, you can ignore this warning. Otherwise, please check the \`env.config\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;cAsCa,cAAA,qCAAc,iCAAA,CAAA,gBAAA,CA2J1B,uBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;cAsCa,cAAA,qCAAc,iCAAA,CAAA,gBAAA,CA2J1B,uBAAA"}
|
package/dist/babel/plugin.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { __Ω
|
|
1
|
+
import { __ΩEnvPluginContext } from "../types/plugin.mjs";
|
|
2
|
+
import { getProperties, stringifyValue } from "@powerlines/schema";
|
|
2
3
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
3
4
|
import { createBabelPlugin } from "@powerlines/plugin-babel/helpers/create-plugin";
|
|
4
5
|
import { addImport } from "@powerlines/plugin-babel/helpers/module-helpers";
|
|
5
|
-
import { getProperties, stringifyValue } from "@powerlines/schema";
|
|
6
6
|
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
7
7
|
|
|
8
8
|
//#region src/babel/plugin.ts
|
|
@@ -11,7 +11,7 @@ function __assignType(fn, args) {
|
|
|
11
11
|
return fn;
|
|
12
12
|
}
|
|
13
13
|
const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!"]], createBabelPlugin("env", __assignType(({ logger, context }) => {
|
|
14
|
-
const
|
|
14
|
+
const config = getProperties(context.env.config);
|
|
15
15
|
function extractEnv(node, pass, isInjectable = false) {
|
|
16
16
|
if (node.name) {
|
|
17
17
|
const name = node.name.replace(new RegExp(`^(${context.config.env.prefix.join("|")})_`), "");
|
|
@@ -19,21 +19,21 @@ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!
|
|
|
19
19
|
meta: { category: "env" },
|
|
20
20
|
message: `Environment variable ${name} found in ${pass.filename || "unknown file"}.`
|
|
21
21
|
});
|
|
22
|
-
if (name in
|
|
23
|
-
|
|
22
|
+
if (name in config && isSetObject(config[name]) && !config[name]?.isIgnored) {
|
|
23
|
+
config[name] ??= {};
|
|
24
24
|
logger.debug({
|
|
25
25
|
meta: { category: "env" },
|
|
26
26
|
message: `The "${name}" environment variable is used in the source code file "${pass.filename || "unknown file"}" and will be added to the environment schema's active variables list.`
|
|
27
27
|
});
|
|
28
|
-
|
|
29
|
-
if (!
|
|
30
|
-
if (context.config.env.validate && !
|
|
31
|
-
return stringifyValue(
|
|
28
|
+
context.env.config.active.push(name);
|
|
29
|
+
if (!config[name].runtime && (context.config.env.inject && isInjectable || context.config.env.validate)) {
|
|
30
|
+
if (context.config.env.validate && !config[name].optional && isUndefined(config[name].default)) throw new Error(`Environment variable \`${name}\` is missing a default value, but is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}.\n\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`);
|
|
31
|
+
return stringifyValue(config[name].default);
|
|
32
32
|
}
|
|
33
|
-
} else if (context.config.env.validate) throw new Error(`Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, but is not defined in the \`
|
|
33
|
+
} else if (context.config.env.validate) throw new Error(`Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, but is not defined in the \`config\` schema. Please check the \`env.config\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`);
|
|
34
34
|
else logger.warn({
|
|
35
35
|
meta: { category: "env" },
|
|
36
|
-
message: `Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, but is not defined in the \`
|
|
36
|
+
message: `Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, but is not defined in the \`config\` schema. If this is intentional, you can ignore this warning. Otherwise, please check the \`env.config\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -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 { 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 {
|
|
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 { 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 {\n getProperties,\n JsonSchemaProperty,\n stringifyValue\n} from \"@powerlines/schema\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\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 ({ logger, context }) => {\n const config = getProperties(context.env.config);\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false\n ) {\n if (node.name) {\n const name = node.name.replace(\n new RegExp(`^(${context.config.env.prefix.join(\"|\")})_`),\n \"\"\n );\n\n logger.trace({\n meta: {\n category: \"env\"\n },\n message: `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n });\n\n if (\n name in config &&\n isSetObject(config[name]) &&\n !config[name]?.isIgnored\n ) {\n config[name] ??= {} as JsonSchemaProperty<Record<string, any>>;\n\n logger.debug({\n meta: {\n category: \"env\"\n },\n message: `The \"${name}\" environment variable is used in the source code file \"${\n pass.filename || \"unknown file\"\n }\" and will be added to the environment schema's active variables list.`\n });\n\n context.env.config.active.push(name);\n if (\n !config[name].runtime &&\n ((context.config.env.inject && isInjectable) ||\n context.config.env.validate)\n ) {\n if (\n context.config.env.validate &&\n !config[name].optional &&\n isUndefined(config[name].default)\n ) {\n throw new Error(\n `Environment variable \\`${\n name\n }\\` is missing a default value, but is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }.\\n\\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`\n );\n }\n\n return stringifyValue(config[name].default);\n }\n } else if (context.config.env.validate) {\n throw new Error(\n `Environment variable \\`${name}\\` is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }, but is not defined in the \\`config\\` schema. Please check the \\`env.config\\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`\n );\n } else {\n logger.warn({\n meta: {\n category: \"env\"\n },\n message: `Environment variable \\`${name}\\` is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }, but is not defined in the \\`config\\` schema. If this is intentional, you can ignore this warning. Otherwise, please check the \\`env.config\\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source 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);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework?.name || \"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);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework?.name || \"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);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;CAE1B,OAAK;AACN;4HAaA,QACA,cACM;CACN,MAAQ,SAAC,cAAmB,QAAW,IAAA,MAAO;CAC9C,SAAS,WAAA,MAAkB,MAAO,eAAW,OAAO;EACpD,IAAO,KAAA,MAAA;GACL,MAAA,OAAa,KAAA,KAAA,QAAA,IAAA,OAAA,KAAA,QAAA,OAAA,IAAA,OAAA,KAAA,GAAA,EAAA,GAAA,GAAA,EAAA;GACb,OAAA,MAAA;IACA,MAAA,EACO,UAAW,MACZ;IACA,SAAC,wBAAgC,KAAC,YAAU,KAAU,YAAA,eAAA;GACxD,CAAC;;IAEN,OAAA,UAAA,CAAA;IACM,OAAA,MAAa;KACnB,MAAA,EACS,UAAY,MAClB;KACF,SAAA,QAAA,KAAA,0DAAA,KAAA,YAAA,eAAA;IACK,CAAA;IACA,QAAA,IAAA,OAAA,OAAA,KAAA,IAAA;IACF,IAAO,CAAC,OAAO,MAAM,YAAC,QAAA,OAAA,IAAA,UAAA,gBAAA,QAAA,OAAA,IAAA,WAAA;KACjB,IAAA,QAAS,OAAA,IAAc,YAAY,CAAA,OAAO,MAAA,YAAA,YAAA,OAAA,MAAA,OAAA,GACxC,MAAC,IAAA,MAAU,0BAAA,KAAA,iEAAA,KAAA,WAAA,WAAA,KAAA,SAAA,MAAA,GAAA,mIAAA;KAEb,OAAE,eAAe,OAAA,MAAA,OAAA;IACrB;GACA,OAAA,IAAA,QAAA,OAAA,IAAA,UACE,MAAM,IAAC,MAAM,0BAAA,KAAA,iCAAA,KAAA,WAAA,WAAA,KAAA,SAAA,MAAA,GAAA,0OAAA;QAEb,OAAM,KAAM;IACV,MAAC,EACF,UAAA;IAED,SAAO,0BAAM,KAAA,iCAAA,KAAA,WAA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,CAAA,EACP,EACF;AACF,GAAG;CAAC;CAAQ;CAAM;AAAA,CAAA,CAAA"}
|
package/dist/components/docs.cjs
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_types_plugin = require('../types/plugin.cjs');
|
|
3
3
|
let _powerlines_schema_helpers = require("@powerlines/schema/helpers");
|
|
4
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
4
5
|
let powerlines_plugin_utils = require("powerlines/plugin-utils");
|
|
5
6
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
7
|
let _alloy_js_core = require("@alloy-js/core");
|
|
7
|
-
let _alloy_js_markdown = require("@alloy-js/markdown");
|
|
8
8
|
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
9
9
|
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
10
10
|
let _powerlines_plugin_alloy_markdown_components_heading = require("@powerlines/plugin-alloy/markdown/components/heading");
|
|
11
11
|
let _powerlines_plugin_alloy_markdown_components_markdown_file = require("@powerlines/plugin-alloy/markdown/components/markdown-file");
|
|
12
12
|
let _powerlines_plugin_alloy_markdown_components_markdown_table = require("@powerlines/plugin-alloy/markdown/components/markdown-table");
|
|
13
13
|
let _powerlines_schema_codegen = require("@powerlines/schema/codegen");
|
|
14
|
-
let _stryke_path_join = require("@stryke/path/join");
|
|
15
14
|
|
|
16
15
|
//#region src/components/docs.tsx
|
|
17
16
|
const __ΩPartial = [
|
|
@@ -43,35 +42,19 @@ function EnvDocsFile(props) {
|
|
|
43
42
|
return [
|
|
44
43
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_markdown_components_heading.Heading, {
|
|
45
44
|
level: 1 + levelOffset,
|
|
46
|
-
children: "Environment
|
|
47
|
-
}),
|
|
48
|
-
_alloy_js_core.code`Below is a list of environment configuration parameters used by the`,
|
|
49
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
50
|
-
get when() {
|
|
51
|
-
return !!context.packageJson.name;
|
|
52
|
-
},
|
|
53
|
-
get children() {
|
|
54
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_markdown.Link, {
|
|
55
|
-
get href() {
|
|
56
|
-
return `https://www.npmjs.com/package/${context.packageJson.name}`;
|
|
57
|
-
},
|
|
58
|
-
get title() {
|
|
59
|
-
return context.packageJson.name;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
45
|
+
children: "Environment"
|
|
63
46
|
}),
|
|
64
|
-
_alloy_js_core.code`package. These
|
|
47
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`The ${context.config.name} package uses various configuration parameters to control the behavior of the application. These parameters can be provided as environment variables when the application is run, or they can be defined in a \`config.json\` file in the application configuration directory.`),
|
|
65
48
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
66
49
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_markdown_components_heading.Heading, {
|
|
67
50
|
level: 2 + levelOffset,
|
|
68
|
-
children: "
|
|
51
|
+
children: "Configuration"
|
|
69
52
|
}),
|
|
70
53
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
71
|
-
_alloy_js_core.code`The below list of
|
|
54
|
+
_alloy_js_core.code`The below list of configuration parameters are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text locally.`,
|
|
72
55
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
73
56
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_markdown_components_markdown_table.MarkdownTable, { get data() {
|
|
74
|
-
return (
|
|
57
|
+
return (0, _powerlines_schema_helpers.getPropertiesList)(context.env.config).filter(__assignType((property) => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.config).some(__assignType((p) => p.name === property.name && context.env.config.active.includes(property.name), [
|
|
75
58
|
"p",
|
|
76
59
|
"",
|
|
77
60
|
"P\"2!\"/\""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;UAkCiB,gBAAA,SAAyB,OAAO,CAAC,iBAAA;;AAAlD;;;;;;;EASE,WAAA;AAAA;AAMF;;;AAAA,iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;UAkCiB,gBAAA,SAAyB,OAAO,CAAC,iBAAA;;AAAlD;;;;;;;EASE,WAAA;AAAA;AAMF;;;AAAA,iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
|
package/dist/components/docs.mjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { __Ω
|
|
1
|
+
import { __ΩEnvPluginContext } from "../types/plugin.mjs";
|
|
2
2
|
import { getPropertiesList } from "@powerlines/schema/helpers";
|
|
3
|
+
import { joinPaths } from "@stryke/path/join";
|
|
3
4
|
import { getDocsOutputPath } from "powerlines/plugin-utils";
|
|
4
|
-
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import { Link } from "@alloy-js/markdown";
|
|
5
|
+
import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
6
|
+
import { code } from "@alloy-js/core";
|
|
7
7
|
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
8
8
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
9
9
|
import { Heading } from "@powerlines/plugin-alloy/markdown/components/heading";
|
|
10
10
|
import { MarkdownFile } from "@powerlines/plugin-alloy/markdown/components/markdown-file";
|
|
11
11
|
import { MarkdownTable } from "@powerlines/plugin-alloy/markdown/components/markdown-table";
|
|
12
12
|
import { stringifyType } from "@powerlines/schema/codegen";
|
|
13
|
-
import { joinPaths } from "@stryke/path/join";
|
|
14
13
|
|
|
15
14
|
//#region src/components/docs.tsx
|
|
16
15
|
const __ΩPartial = [
|
|
@@ -42,35 +41,19 @@ function EnvDocsFile(props) {
|
|
|
42
41
|
return [
|
|
43
42
|
createComponent(Heading, {
|
|
44
43
|
level: 1 + levelOffset,
|
|
45
|
-
children: "Environment
|
|
46
|
-
}),
|
|
47
|
-
code`Below is a list of environment configuration parameters used by the`,
|
|
48
|
-
createComponent(Show, {
|
|
49
|
-
get when() {
|
|
50
|
-
return !!context.packageJson.name;
|
|
51
|
-
},
|
|
52
|
-
get children() {
|
|
53
|
-
return createComponent(Link, {
|
|
54
|
-
get href() {
|
|
55
|
-
return `https://www.npmjs.com/package/${context.packageJson.name}`;
|
|
56
|
-
},
|
|
57
|
-
get title() {
|
|
58
|
-
return context.packageJson.name;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
44
|
+
children: "Environment"
|
|
62
45
|
}),
|
|
63
|
-
code`package. These
|
|
46
|
+
memo(() => code`The ${context.config.name} package uses various configuration parameters to control the behavior of the application. These parameters can be provided as environment variables when the application is run, or they can be defined in a \`config.json\` file in the application configuration directory.`),
|
|
64
47
|
createComponent(Spacing, {}),
|
|
65
48
|
createComponent(Heading, {
|
|
66
49
|
level: 2 + levelOffset,
|
|
67
|
-
children: "
|
|
50
|
+
children: "Configuration"
|
|
68
51
|
}),
|
|
69
52
|
createComponent(Spacing, {}),
|
|
70
|
-
code`The below list of
|
|
53
|
+
code`The below list of configuration parameters are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text locally.`,
|
|
71
54
|
createComponent(Spacing, {}),
|
|
72
55
|
createComponent(MarkdownTable, { get data() {
|
|
73
|
-
return
|
|
56
|
+
return getPropertiesList(context.env.config).filter(__assignType((property) => getPropertiesList(context.env.config).some(__assignType((p) => p.name === property.name && context.env.config.active.includes(property.name), [
|
|
74
57
|
"p",
|
|
75
58
|
"",
|
|
76
59
|
"P\"2!\"/\""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code
|
|
1
|
+
{"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { Heading } from \"@powerlines/plugin-alloy/markdown/components/heading\";\nimport {\n MarkdownFile,\n MarkdownFileProps\n} from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { JsonSchema } from \"@powerlines/schema\";\nimport { stringifyType } from \"@powerlines/schema/codegen\";\nimport { getPropertiesList } from \"@powerlines/schema/helpers\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\nexport interface EnvDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n}\n\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context.config.root), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment</Heading>\n {code`The ${\n context.config.name\n } package uses various configuration parameters to control the behavior of the application. These parameters can be provided as environment variables when the application is run, or they can be defined in a \\`config.json\\` file in the application configuration directory.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Configuration</Heading>\n <Spacing />\n {code`The below list of configuration parameters are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text locally.`}\n <Spacing />\n <MarkdownTable\n data={\n getPropertiesList(context.env.config)\n .filter(\n property =>\n getPropertiesList(context.env.config).some(\n p =>\n p.name === property.name &&\n context.env.config.active.includes(property.name)\n ) &&\n !property?.hidden &&\n !property?.ignore &&\n !property?.readOnly &&\n !property?.internal\n )\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a.name.localeCompare(b.name)\n )\n .map(property => {\n return {\n name: property.name?.trim(),\n description: (property.description ?? \"\").trim(),\n type: stringifyType<any>(property as JsonSchema<any>)\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: property.default\n ? stringifyType(property.default)\n : \"\",\n required: property.nullable ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;AA4BA,MAAI,sBAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AAAA;;;;AAKJ,SAAG,YAAA,OAAA;CACD,MAAI,EACF,cAAA,GACF,GAAA,SACF;;CAEE,OAAA,gBAAA,cAAA,WAAA,EACC,IAAA,OAAU;EACX,OAAA,UAAA,kBAAA,QAAA,OAAA,IAAA,GAAA,QAAA;CACF,EACE,GAAA,MAAQ;EAER,OAAM;GAAA,gBAAwB,SAAA;;IAExB,UAAC;GACJ,CAAA;GAAA,WAAA,IAAA,OAAA,QAAA,OAAA,KAAA,+QAAA;GAAA,gBAAA,SAAA,CAAA,CAAA;GAAA,gBAAA,SAAA;IACC,OAAM,IAAA;IACJ,UAAO;GACT,CAAC;GAAA,gBAAmB,SAAW,CAAC,CAAC;GAAA,IAAA;GAAoB,gBAAA,SAAA,CAAA,CAAA;GAAA,gBAAA,eAAA,EACpD,IAAK,OAAK;IACT,OAAQ,kBAAO,QAAA,IAAA,MAAA,EAAA,OAAA,cAAA,aAAA,kBAAA,QAAA,IAAA,MAAA,EAAA,KAAA,cAAA,MAAA,EAAA,SAAA,SAAA,QAAA,QAAA,IAAA,OAAA,OAAA,SAAA,SAAA,IAAA,GAAA;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,KAAA,CAAA,UAAA,UAAA,CAAA,UAAA,UAAA,CAAA,UAAA,YAAA,CAAA,UAAA,UAAA;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,EAAA,KAAA,cAAA,GAAA,MAAA,CAAA,GAAA,QAAA,CAAA,GAAA,OAAA,IAAA,CAAA,GAAA,OAAA,IAAA,CAAA,GAAA,OAAA,KAAA,EAAA,KAAA,cAAA,EAAA,IAAA,GAAA;KAAA;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,EAAA,IAAA,cAAA,aAAA;KACf,OAAQ;MACF,MAAE,SAAA,MAAA,KAAA;MACF,cAAY,SAAW,eAAe,IAAE,KAAO;MAC/C,OAAE,cAAA,IAAA,CAAA,CAAA,IAAA,CAAA,GAAA,cAAA,QAAA,GAAA,KAAA,EAAA,WAAA,mBAAA,OAAA;MACJ,cAAe,SAAG,UAAc,cAAiB,SAAM,OAAU,IAAC;MAChE,UAAE,SAAA,WAAA,KAAA;KACT;IACC,GAAK;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,KAAA,CAAA;GACL,EACF,CAAC;EAAC;CACJ,EACF,CAAC,CAAC;AACJ;AACA,YAAY,SAAS;OAAO;CAAkB;CAAA;CAAA;CAAA;AAAA"}
|
|
@@ -45,7 +45,7 @@ function EnvTypeDefinition() {
|
|
|
45
45
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components.InterfaceDeclaration, {
|
|
46
46
|
name: "UnprefixedEnv",
|
|
47
47
|
get schema() {
|
|
48
|
-
return context.env.
|
|
48
|
+
return context.env.config.schema;
|
|
49
49
|
},
|
|
50
50
|
"export": true
|
|
51
51
|
}),
|
|
@@ -73,7 +73,7 @@ function EnvTypeDefinition() {
|
|
|
73
73
|
get children() {
|
|
74
74
|
return __assignType((prefix) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
75
75
|
get each() {
|
|
76
|
-
return (0, _powerlines_schema_helpers.getPropertiesList)(context.env.
|
|
76
|
+
return (0, _powerlines_schema_helpers.getPropertiesList)(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored, [
|
|
77
77
|
"property",
|
|
78
78
|
"",
|
|
79
79
|
"P\"2!\"/\""
|
|
@@ -322,7 +322,7 @@ function EnvBuiltin(props) {
|
|
|
322
322
|
const [{ defaultConfig, children }, rest] = (0, _alloy_js_core.splitProps)(props, ["defaultConfig", "children"]);
|
|
323
323
|
const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
|
|
324
324
|
const defaultValue = (0, _alloy_js_core.computed)(() => context && require_helpers_load.loadEnvFromContext(context, process.env));
|
|
325
|
-
const reflectionGetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.
|
|
325
|
+
const reflectionGetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored, [
|
|
326
326
|
"property",
|
|
327
327
|
"",
|
|
328
328
|
"P\"2!\"/\""
|
|
@@ -332,7 +332,7 @@ function EnvBuiltin(props) {
|
|
|
332
332
|
"",
|
|
333
333
|
"P\"2!\"2\"\"/#"
|
|
334
334
|
])) ?? []);
|
|
335
|
-
const reflectionSetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.
|
|
335
|
+
const reflectionSetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored && !property?.readOnly, [
|
|
336
336
|
"property",
|
|
337
337
|
"",
|
|
338
338
|
"P\"2!\"/\""
|
|
@@ -349,7 +349,7 @@ function EnvBuiltin(props) {
|
|
|
349
349
|
return [
|
|
350
350
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
351
351
|
get when() {
|
|
352
|
-
return Boolean(context.env.
|
|
352
|
+
return Boolean(context.env.config.schema);
|
|
353
353
|
},
|
|
354
354
|
get children() {
|
|
355
355
|
return [(0, _alloy_js_core_jsx_runtime.createComponent)(EnvTypeDefinition, { defaultValue }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})];
|
|
@@ -359,7 +359,7 @@ function EnvBuiltin(props) {
|
|
|
359
359
|
name: "initialEnv",
|
|
360
360
|
type: "Partial<Env>",
|
|
361
361
|
get schema() {
|
|
362
|
-
return context.env.
|
|
362
|
+
return context.env.config.schema;
|
|
363
363
|
},
|
|
364
364
|
"export": true,
|
|
365
365
|
"const": true,
|
|
@@ -44,7 +44,7 @@ function EnvTypeDefinition() {
|
|
|
44
44
|
createComponent(InterfaceDeclaration$1, {
|
|
45
45
|
name: "UnprefixedEnv",
|
|
46
46
|
get schema() {
|
|
47
|
-
return context.env.
|
|
47
|
+
return context.env.config.schema;
|
|
48
48
|
},
|
|
49
49
|
"export": true
|
|
50
50
|
}),
|
|
@@ -72,7 +72,7 @@ function EnvTypeDefinition() {
|
|
|
72
72
|
get children() {
|
|
73
73
|
return __assignType((prefix) => createComponent(For, {
|
|
74
74
|
get each() {
|
|
75
|
-
return getPropertiesList(context.env.
|
|
75
|
+
return getPropertiesList(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored, [
|
|
76
76
|
"property",
|
|
77
77
|
"",
|
|
78
78
|
"P\"2!\"/\""
|
|
@@ -321,7 +321,7 @@ function EnvBuiltin(props) {
|
|
|
321
321
|
const [{ defaultConfig, children }, rest] = splitProps(props, ["defaultConfig", "children"]);
|
|
322
322
|
const context = (usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], usePowerlines());
|
|
323
323
|
const defaultValue = computed(() => context && loadEnvFromContext(context, process.env));
|
|
324
|
-
const reflectionGetProperties = computed(() => getPropertiesList(context.env.
|
|
324
|
+
const reflectionGetProperties = computed(() => getPropertiesList(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored, [
|
|
325
325
|
"property",
|
|
326
326
|
"",
|
|
327
327
|
"P\"2!\"/\""
|
|
@@ -331,7 +331,7 @@ function EnvBuiltin(props) {
|
|
|
331
331
|
"",
|
|
332
332
|
"P\"2!\"2\"\"/#"
|
|
333
333
|
])) ?? []);
|
|
334
|
-
const reflectionSetProperties = computed(() => getPropertiesList(context.env.
|
|
334
|
+
const reflectionSetProperties = computed(() => getPropertiesList(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored && !property?.readOnly, [
|
|
335
335
|
"property",
|
|
336
336
|
"",
|
|
337
337
|
"P\"2!\"/\""
|
|
@@ -348,7 +348,7 @@ function EnvBuiltin(props) {
|
|
|
348
348
|
return [
|
|
349
349
|
createComponent(Show, {
|
|
350
350
|
get when() {
|
|
351
|
-
return Boolean(context.env.
|
|
351
|
+
return Boolean(context.env.config.schema);
|
|
352
352
|
},
|
|
353
353
|
get children() {
|
|
354
354
|
return [createComponent(EnvTypeDefinition, { defaultValue }), createComponent(Spacing, {})];
|
|
@@ -358,7 +358,7 @@ function EnvBuiltin(props) {
|
|
|
358
358
|
name: "initialEnv",
|
|
359
359
|
type: "Partial<Env>",
|
|
360
360
|
get schema() {
|
|
361
|
-
return context.env.
|
|
361
|
+
return context.env.config.schema;
|
|
362
362
|
},
|
|
363
363
|
"export": true,
|
|
364
364
|
"const": true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-builtin.mjs","names":[],"sources":["../../src/components/env-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Children,\n code,\n computed,\n For,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n InterfaceDeclaration as BaseInterfaceDeclaration,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { refkey } from \"@powerlines/plugin-alloy/helpers/refkey\";\nimport type { ComponentProps } from \"@powerlines/plugin-alloy/types/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps,\n InterfaceDeclaration,\n InterfaceMember,\n ObjectDeclaration,\n TSDocSchemaProperty\n} from \"@powerlines/plugin-alloy/typescript/components\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport type { JsonSchemaProperty } from \"@powerlines/schema\";\nimport { getPropertiesList } from \"@powerlines/schema/helpers\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { loadEnvFromContext } from \"../helpers/load\";\nimport type { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Generates the environment configuration typescript definition for the Powerlines project.\n */\nexport function EnvTypeDefinition() {\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <>\n <InterfaceDeclaration\n name=\"UnprefixedEnv\"\n schema={context.env.vars.schema}\n export\n />\n <Spacing />\n <TSDoc heading=\"The environment configuration object with prefixed keys.\">\n <TSDocRemarks>\n {`The \\`Env\\` type extends the \\`UnprefixedEnv\\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.`}\n </TSDocRemarks>\n </TSDoc>\n <BaseInterfaceDeclaration name=\"Env\" export extends=\"UnprefixedEnv\">\n <For\n each={getUnique(context.config.env.prefix).map(prefix =>\n prefix.replace(/_$/, \"\")\n )}\n doubleHardline>\n {prefix => (\n <For\n each={\n getPropertiesList(context.env.vars.schema).filter(\n property => !property?.isIgnored\n ) ?? []\n }\n doubleHardline>\n {property => (\n <>\n <TSDocSchemaProperty schema={property} />\n <InterfaceMember\n name={`${prefix}_${property?.name}`}\n type={`UnprefixedEnv[\"${property?.name}\"]`}\n readOnly={property?.readOnly}\n />\n </>\n )}\n </For>\n )}\n </For>\n </BaseInterfaceDeclaration>\n <Spacing />\n </>\n );\n}\n\ninterface ConfigPropertyConditionalProps extends ComponentProps {\n context: EnvPluginContext;\n name: string;\n}\n\nfunction ConfigPropertyConditional(props: ConfigPropertyConditionalProps) {\n const [{ context, name }] = splitProps(props, [\"context\", \"name\"]);\n\n return code`propertyName === \"${name}\" || propertyName.replace(/^(${getUnique(\n context.config.env.prefix\n .sort((a, b) =>\n a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)\n )\n .map(prefix => `${prefix.replace(/_$/, \"\")}_`)\n ).join(\"|\")})/g, \"\").toLowerCase().replace(/[\\\\s\\\\-_]+/g, \"\") === \"${name\n .toLowerCase()\n .replace(/[\\s\\-_]+/g, \"\")}\"`;\n}\n\ninterface ConfigPropertyProps extends ComponentProps {\n index: number;\n context: EnvPluginContext;\n name: string;\n property: JsonSchemaProperty;\n}\n\nfunction ConfigPropertyGet(props: ConfigPropertyProps) {\n const [{ context, name, property, index }] = splitProps(props, [\n \"context\",\n \"name\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${name}\"];`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${name}\"];`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nfunction ConfigPropertySet(props: ConfigPropertyProps) {\n const [{ context, name, property, index }] = splitProps(props, [\n \"context\",\n \"name\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${name}\"] = newValue;\n return true;\n`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${name}\"] = newValue;\n return true;\n`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nexport interface EnvBuiltinProps extends Omit<BuiltinFileProps, \"id\"> {\n defaultConfig?: Children;\n}\n\nconst createEnvRefkey = refkey(\"createEnv\");\nconst envRefkey = refkey(\"env\");\n\n/**\n * Generates the environment configuration module for the Powerlines project.\n */\nexport function EnvBuiltin(props: EnvBuiltinProps) {\n const [{ defaultConfig, children }, rest] = splitProps(props, [\n \"defaultConfig\",\n \"children\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n const defaultValue = computed(\n () => context && loadEnvFromContext(context, process.env)\n );\n\n const reflectionGetProperties = computed(\n () =>\n getPropertiesList(context.env.vars.schema)\n .filter(property => !property?.isIgnored)\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a?.name.localeCompare(b?.name)\n ) ?? []\n );\n const reflectionSetProperties = computed(\n () =>\n getPropertiesList(context.env.vars.schema)\n .filter(property => !property?.isIgnored && !property?.readOnly)\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a?.name.localeCompare(b?.name)\n ) ?? []\n );\n\n return (\n <BuiltinFile\n id=\"env\"\n description=\"The environment configuration module provides an interface to define environment configuration parameters.\"\n {...rest}>\n <Show when={Boolean(context.env.vars.schema)}>\n <EnvTypeDefinition defaultValue={defaultValue} />\n <Spacing />\n </Show>\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<Env>\"\n schema={context.env.vars.schema}\n export\n const\n doc=\"The initial environment configuration object values for the runtime.\"\n />\n <Spacing />\n <TSDoc heading=\"Initializes the Powerlines environment configuration module.\">\n <TSDocRemarks>\n {`This function initializes the Powerlines environment configuration object.`}\n </TSDocRemarks>\n <TSDocParam name=\"environmentConfig\">\n {`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}\n </TSDocParam>\n <TSDocReturns>\n {`The initialized Powerlines configuration object.`}\n </TSDocReturns>\n </TSDoc>\n <Show when={Boolean(context?.entryPath)}>\n <FunctionDeclaration\n refkey={createEnvRefkey}\n async={false}\n export\n name=\"createEnv\"\n parameters={[\n {\n name: \"environmentConfig\",\n type: `Partial<Env>`,\n optional: false,\n default: \"{}\"\n }\n ]}\n returnType=\"Env\">\n {code`\n return new Proxy<Env>(\n deserializeEnv({\n ...initialEnv,\n ...environmentConfig\n } as Env),\n {\n get: (target: UnprefixedEnv, propertyName: string) => { `}\n <hbr />\n <For each={reflectionGetProperties.value}>\n {(property: JsonSchemaProperty, index: number) => (\n <ConfigPropertyGet\n index={index}\n context={context}\n name={property.name}\n property={property}\n />\n )}\n </For>\n {code`\n return undefined;\n }, `}\n\n <Spacing />\n {code` set: (target: UnprefixedEnv, propertyName: string, newValue: any) => { `}\n <hbr />\n <For each={reflectionSetProperties.value} ender={code` else `}>\n {(property: JsonSchemaProperty, index: number) => (\n <ConfigPropertySet\n index={index}\n context={context}\n name={property.name}\n property={property}\n />\n )}\n </For>\n\n <hbr />\n {code`return false;\n }\n }\n );\n`}\n </FunctionDeclaration>\n </Show>\n <Spacing />\n <TSDoc heading=\"The environment configuration object.\">\n <TSDocRemarks>\n {`This object provides access to the environment configuration parameters in the application runtime.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n refkey={envRefkey}\n name=\"env\"\n type=\"Env\"\n export\n const\n initializer={\n <>{code`createEnv(${defaultConfig || \"{}\"} as Partial<Env>);`}</>\n }\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isCI\"\n doc=\"Detect if the application is running in a continuous integration (CI) environment.\"\n initializer={code`Boolean(\n env.CI ||\n env.RUN_ID ||\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS || false\n ); `}\n />\n <Spacing />\n\n <TSDoc heading=\"Detect the \\`mode\\` of the current runtime environment.\">\n <TSDocRemarks>\n {code`The \\`mode\\` is determined by the \\`MODE\\` environment variable, or falls back to the \\`NEXT_PUBLIC_VERCEL_ENV\\`, \\`NODE_ENV\\`, or defaults to \\`production\\`. While the value can potentially be any string, it is generally recommended to only allow a value in the following list:\n - \\`production\\`\n - \\`test\\`\n - \\`development\\`\n `}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n export\n const\n name=\"mode\"\n initializer={code`String(env.MODE) || \"production\"; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isProduction\"\n doc='Detect if the application is running in `\"production\"` mode'\n initializer={code`[\"prd\", \"prod\", \"production\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isTest\"\n doc='Detect if the application is running in `\"test\"` mode'\n initializer={code`[\"tst\", \"test\", \"testing\", \"stg\", \"stage\", \"staging\"].includes(mode.toLowerCase()) || env.TEST; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDevelopment\"\n doc='Detect if the application is running in `\"development\"` mode'\n initializer={code`[\"dev\", \"development\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDebug\"\n doc=\"Detect if the application is currently being debugged\"\n initializer={code`Boolean(isDevelopment && env.DEBUG); `}\n />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,UAAU;CAAC;CAAI;CAAM;CAAQ;AAAG;;;;;;;AAEtC,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;;;;AA+BA,SAAa,oBAAA;CACX,MAAA,WAAgB,cAA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,CAAA;GAAA,gBAAA,gBAAA;IACjB,UAAM;IACN,SAAM;IACN,MAAM;IACN,KAAK;IACL,aAAa,IAAC;GAChB,CAAC;GAAG,gBAAU,SAAA,CAAA,CAAA;GAAA,gBAAA,gBAAA;IACZ,UAAM;IACN,SAAM;IACN,MAAM;IACN,KAAK;IACL,aAAI,IAAA;GACN,CAAC;GAAA,gBAAA,SAAA,CAAA,CAAA;GAAA,gBAAA,gBAAA;IACA,UAAS;;IAET,MAAM;IACL,KAAC;IACD,aAAa,IAAC;GAChB,CAAC;GAAG,gBAAe,SAAA,CAAA,CAAA;GAAA,gBAAA,MAAA;IACjB,IAAI,OAAO;KACT,OAAI,QAAW,QAAC;IAClB;IACE;GACJ,CAAC;EAAC;CACJ,EACF,CAAC,CAAC;AACJ;AACA,WAAQ,SAAU;OAAA;CAAA;CAAA;CAAA;CAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"env-builtin.mjs","names":[],"sources":["../../src/components/env-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Children,\n code,\n computed,\n For,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n InterfaceDeclaration as BaseInterfaceDeclaration,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { refkey } from \"@powerlines/plugin-alloy/helpers/refkey\";\nimport type { ComponentProps } from \"@powerlines/plugin-alloy/types/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps,\n InterfaceDeclaration,\n InterfaceMember,\n ObjectDeclaration,\n TSDocSchemaProperty\n} from \"@powerlines/plugin-alloy/typescript/components\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport type { JsonSchemaProperty } from \"@powerlines/schema\";\nimport { getPropertiesList } from \"@powerlines/schema/helpers\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { loadEnvFromContext } from \"../helpers/load\";\nimport type { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Generates the environment configuration typescript definition for the Powerlines project.\n */\nexport function EnvTypeDefinition() {\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <>\n <InterfaceDeclaration\n name=\"UnprefixedEnv\"\n schema={context.env.config.schema}\n export\n />\n <Spacing />\n <TSDoc heading=\"The environment configuration object with prefixed keys.\">\n <TSDocRemarks>\n {`The \\`Env\\` type extends the \\`UnprefixedEnv\\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.`}\n </TSDocRemarks>\n </TSDoc>\n <BaseInterfaceDeclaration name=\"Env\" export extends=\"UnprefixedEnv\">\n <For\n each={getUnique(context.config.env.prefix).map(prefix =>\n prefix.replace(/_$/, \"\")\n )}\n doubleHardline>\n {prefix => (\n <For\n each={\n getPropertiesList(context.env.config.schema).filter(\n property => !property?.isIgnored\n ) ?? []\n }\n doubleHardline>\n {property => (\n <>\n <TSDocSchemaProperty schema={property} />\n <InterfaceMember\n name={`${prefix}_${property?.name}`}\n type={`UnprefixedEnv[\"${property?.name}\"]`}\n readOnly={property?.readOnly}\n />\n </>\n )}\n </For>\n )}\n </For>\n </BaseInterfaceDeclaration>\n <Spacing />\n </>\n );\n}\n\ninterface ConfigPropertyConditionalProps extends ComponentProps {\n context: EnvPluginContext;\n name: string;\n}\n\nfunction ConfigPropertyConditional(props: ConfigPropertyConditionalProps) {\n const [{ context, name }] = splitProps(props, [\"context\", \"name\"]);\n\n return code`propertyName === \"${name}\" || propertyName.replace(/^(${getUnique(\n context.config.env.prefix\n .sort((a, b) =>\n a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)\n )\n .map(prefix => `${prefix.replace(/_$/, \"\")}_`)\n ).join(\"|\")})/g, \"\").toLowerCase().replace(/[\\\\s\\\\-_]+/g, \"\") === \"${name\n .toLowerCase()\n .replace(/[\\s\\-_]+/g, \"\")}\"`;\n}\n\ninterface ConfigPropertyProps extends ComponentProps {\n index: number;\n context: EnvPluginContext;\n name: string;\n property: JsonSchemaProperty;\n}\n\nfunction ConfigPropertyGet(props: ConfigPropertyProps) {\n const [{ context, name, property, index }] = splitProps(props, [\n \"context\",\n \"name\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${name}\"];`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${name}\"];`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nfunction ConfigPropertySet(props: ConfigPropertyProps) {\n const [{ context, name, property, index }] = splitProps(props, [\n \"context\",\n \"name\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${name}\"] = newValue;\n return true;\n`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${name}\"] = newValue;\n return true;\n`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nexport interface EnvBuiltinProps extends Omit<BuiltinFileProps, \"id\"> {\n defaultConfig?: Children;\n}\n\nconst createEnvRefkey = refkey(\"createEnv\");\nconst envRefkey = refkey(\"env\");\n\n/**\n * Generates the environment configuration module for the Powerlines project.\n */\nexport function EnvBuiltin(props: EnvBuiltinProps) {\n const [{ defaultConfig, children }, rest] = splitProps(props, [\n \"defaultConfig\",\n \"children\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n const defaultValue = computed(\n () => context && loadEnvFromContext(context, process.env)\n );\n\n const reflectionGetProperties = computed(\n () =>\n getPropertiesList(context.env.config.schema)\n .filter(property => !property?.isIgnored)\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a?.name.localeCompare(b?.name)\n ) ?? []\n );\n const reflectionSetProperties = computed(\n () =>\n getPropertiesList(context.env.config.schema)\n .filter(property => !property?.isIgnored && !property?.readOnly)\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a?.name.localeCompare(b?.name)\n ) ?? []\n );\n\n return (\n <BuiltinFile\n id=\"env\"\n description=\"The environment configuration module provides an interface to define environment configuration parameters.\"\n {...rest}>\n <Show when={Boolean(context.env.config.schema)}>\n <EnvTypeDefinition defaultValue={defaultValue} />\n <Spacing />\n </Show>\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<Env>\"\n schema={context.env.config.schema}\n export\n const\n doc=\"The initial environment configuration object values for the runtime.\"\n />\n <Spacing />\n <TSDoc heading=\"Initializes the Powerlines environment configuration module.\">\n <TSDocRemarks>\n {`This function initializes the Powerlines environment configuration object.`}\n </TSDocRemarks>\n <TSDocParam name=\"environmentConfig\">\n {`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}\n </TSDocParam>\n <TSDocReturns>\n {`The initialized Powerlines configuration object.`}\n </TSDocReturns>\n </TSDoc>\n <Show when={Boolean(context?.entryPath)}>\n <FunctionDeclaration\n refkey={createEnvRefkey}\n async={false}\n export\n name=\"createEnv\"\n parameters={[\n {\n name: \"environmentConfig\",\n type: `Partial<Env>`,\n optional: false,\n default: \"{}\"\n }\n ]}\n returnType=\"Env\">\n {code`\n return new Proxy<Env>(\n deserializeEnv({\n ...initialEnv,\n ...environmentConfig\n } as Env),\n {\n get: (target: UnprefixedEnv, propertyName: string) => { `}\n <hbr />\n <For each={reflectionGetProperties.value}>\n {(property: JsonSchemaProperty, index: number) => (\n <ConfigPropertyGet\n index={index}\n context={context}\n name={property.name}\n property={property}\n />\n )}\n </For>\n {code`\n return undefined;\n }, `}\n\n <Spacing />\n {code` set: (target: UnprefixedEnv, propertyName: string, newValue: any) => { `}\n <hbr />\n <For each={reflectionSetProperties.value} ender={code` else `}>\n {(property: JsonSchemaProperty, index: number) => (\n <ConfigPropertySet\n index={index}\n context={context}\n name={property.name}\n property={property}\n />\n )}\n </For>\n\n <hbr />\n {code`return false;\n }\n }\n );\n`}\n </FunctionDeclaration>\n </Show>\n <Spacing />\n <TSDoc heading=\"The environment configuration object.\">\n <TSDocRemarks>\n {`This object provides access to the environment configuration parameters in the application runtime.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n refkey={envRefkey}\n name=\"env\"\n type=\"Env\"\n export\n const\n initializer={\n <>{code`createEnv(${defaultConfig || \"{}\"} as Partial<Env>);`}</>\n }\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isCI\"\n doc=\"Detect if the application is running in a continuous integration (CI) environment.\"\n initializer={code`Boolean(\n env.CI ||\n env.RUN_ID ||\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS || false\n ); `}\n />\n <Spacing />\n\n <TSDoc heading=\"Detect the \\`mode\\` of the current runtime environment.\">\n <TSDocRemarks>\n {code`The \\`mode\\` is determined by the \\`MODE\\` environment variable, or falls back to the \\`NEXT_PUBLIC_VERCEL_ENV\\`, \\`NODE_ENV\\`, or defaults to \\`production\\`. While the value can potentially be any string, it is generally recommended to only allow a value in the following list:\n - \\`production\\`\n - \\`test\\`\n - \\`development\\`\n `}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n export\n const\n name=\"mode\"\n initializer={code`String(env.MODE) || \"production\"; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isProduction\"\n doc='Detect if the application is running in `\"production\"` mode'\n initializer={code`[\"prd\", \"prod\", \"production\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isTest\"\n doc='Detect if the application is running in `\"test\"` mode'\n initializer={code`[\"tst\", \"test\", \"testing\", \"stg\", \"stage\", \"staging\"].includes(mode.toLowerCase()) || env.TEST; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDevelopment\"\n doc='Detect if the application is running in `\"development\"` mode'\n initializer={code`[\"dev\", \"development\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDebug\"\n doc=\"Detect if the application is currently being debugged\"\n initializer={code`Boolean(isDevelopment && env.DEBUG); `}\n />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,UAAU;CAAC;CAAI;CAAM;CAAQ;AAAG;;;;;;;AAEtC,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;;;;AA+BA,SAAa,oBAAA;CACX,MAAA,WAAgB,cAAA,IAAA,CAAA,CAAA,oBAAA,MAAA,CAAA,GAAA,cAAA;CAChB,OAAA;EAAA,gBAAoB,wBAAA;GACpB,MAAA;GACA,IAAA,SAAA;IACA,OAAA,QAAA,IAAA,OAAA;GACA;GACF,UAAO;EACL,CAAA;EAAA,gBAAK,SAAA,CAAA,CAAA;EAAA,gBAAA,OAAA;GACL,SAAU;GACV,IAAA,WAAY;IACZ,OAAA,gBAAA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AA,gBAAA;IACA,UAAS;;IAET,MAAM;IACL,KAAC;IACD,aAAa,IAAC;GAChB,CAAC;GAAG,gBAAe,SAAA,CAAA,CAAA;GAAA,gBAAA,MAAA;IACjB,IAAI,OAAO;KACT,OAAI,QAAW,QAAC;IAClB;IACE;GACJ,CAAC;EAAC;CACJ,EACF,CAAC,CAAC;AACJ;AACA,WAAQ,SAAU;OAAA;CAAA;CAAA;CAAA;CAAA;AAAA"}
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -7,9 +7,12 @@ const require_helpers_automd_generator = require('./automd-generator.cjs');
|
|
|
7
7
|
exports.env = require_helpers_automd_generator.env;
|
|
8
8
|
exports.extractEnv = require_helpers_schema.extractEnv;
|
|
9
9
|
exports.formatEnvField = require_helpers_source_file_env.formatEnvField;
|
|
10
|
+
exports.getCacheDirectory = require_helpers_schema.getCacheDirectory;
|
|
11
|
+
exports.getCacheFilePath = require_helpers_schema.getCacheFilePath;
|
|
10
12
|
exports.getDefaultSecretsTypeDefinition = require_helpers_schema.getDefaultSecretsTypeDefinition;
|
|
11
13
|
exports.getDefaultVarsTypeDefinition = require_helpers_schema.getDefaultVarsTypeDefinition;
|
|
12
14
|
exports.loadEnv = require_helpers_load.loadEnv;
|
|
13
15
|
exports.loadEnvFromContext = require_helpers_load.loadEnvFromContext;
|
|
14
16
|
exports.removeEnvPrefix = require_helpers_source_file_env.removeEnvPrefix;
|
|
15
|
-
exports.resolveRuntimeTypeFile = require_helpers_schema.resolveRuntimeTypeFile;
|
|
17
|
+
exports.resolveRuntimeTypeFile = require_helpers_schema.resolveRuntimeTypeFile;
|
|
18
|
+
exports.writeEnv = require_helpers_schema.writeEnv;
|