@powerlines/plugin-env 0.16.56 → 0.16.58
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/index.d.cts +2 -0
- package/dist/babel/index.d.mts +2 -0
- package/dist/babel/plugin.d.cts +9 -0
- package/dist/babel/plugin.d.cts.map +1 -0
- package/dist/babel/plugin.d.mts +9 -0
- package/dist/babel/plugin.d.mts.map +1 -0
- package/dist/babel/plugin.mjs +2 -1
- package/dist/babel/plugin.mjs.map +1 -0
- package/dist/components/docs.d.cts +25 -0
- package/dist/components/docs.d.cts.map +1 -0
- package/dist/components/docs.d.mts +25 -0
- package/dist/components/docs.d.mts.map +1 -0
- package/dist/components/docs.mjs +2 -1
- package/dist/components/docs.mjs.map +1 -0
- package/dist/components/env-builtin.d.cts +23 -0
- package/dist/components/env-builtin.d.cts.map +1 -0
- package/dist/components/env-builtin.d.mts +23 -0
- package/dist/components/env-builtin.d.mts.map +1 -0
- package/dist/components/env-builtin.mjs +2 -1
- package/dist/components/env-builtin.mjs.map +1 -0
- package/dist/components/index.d.cts +3 -0
- package/dist/components/index.d.mts +3 -0
- package/dist/helpers/automd-generator.d.cts +15 -0
- package/dist/helpers/automd-generator.d.cts.map +1 -0
- package/dist/helpers/automd-generator.d.mts +15 -0
- package/dist/helpers/automd-generator.d.mts.map +1 -0
- package/dist/helpers/automd-generator.mjs +2 -1
- package/dist/helpers/automd-generator.mjs.map +1 -0
- package/dist/helpers/create-reflection-resource.d.cts +14 -0
- package/dist/helpers/create-reflection-resource.d.cts.map +1 -0
- package/dist/helpers/create-reflection-resource.d.mts +14 -0
- package/dist/helpers/create-reflection-resource.d.mts.map +1 -0
- package/dist/helpers/create-reflection-resource.mjs +2 -1
- package/dist/helpers/create-reflection-resource.mjs.map +1 -0
- package/dist/helpers/docs-helper.d.cts +14 -0
- package/dist/helpers/docs-helper.d.cts.map +1 -0
- package/dist/helpers/docs-helper.d.mts +14 -0
- package/dist/helpers/docs-helper.d.mts.map +1 -0
- package/dist/helpers/docs-helper.mjs +2 -1
- package/dist/helpers/docs-helper.mjs.map +1 -0
- package/dist/helpers/index.d.cts +7 -0
- package/dist/helpers/index.d.mts +7 -0
- package/dist/helpers/load.d.cts +36 -0
- package/dist/helpers/load.d.cts.map +1 -0
- package/dist/helpers/load.d.mts +36 -0
- package/dist/helpers/load.d.mts.map +1 -0
- package/dist/helpers/load.mjs +2 -1
- package/dist/helpers/load.mjs.map +1 -0
- package/dist/helpers/persistence.d.cts +85 -0
- package/dist/helpers/persistence.d.cts.map +1 -0
- package/dist/helpers/persistence.d.mts +85 -0
- package/dist/helpers/persistence.d.mts.map +1 -0
- package/dist/helpers/persistence.mjs +2 -1
- package/dist/helpers/persistence.mjs.map +1 -0
- package/dist/helpers/reflect.d.cts +69 -0
- package/dist/helpers/reflect.d.cts.map +1 -0
- package/dist/helpers/reflect.d.mts +69 -0
- package/dist/helpers/reflect.d.mts.map +1 -0
- package/dist/helpers/reflect.mjs +2 -1
- package/dist/helpers/reflect.mjs.map +1 -0
- package/dist/helpers/source-file-env.d.cts +9 -0
- package/dist/helpers/source-file-env.d.cts.map +1 -0
- package/dist/helpers/source-file-env.d.mts +9 -0
- package/dist/helpers/source-file-env.d.mts.map +1 -0
- package/dist/helpers/source-file-env.mjs +2 -1
- package/dist/helpers/source-file-env.mjs.map +1 -0
- package/dist/helpers/template-helpers.d.cts +16 -0
- package/dist/helpers/template-helpers.d.cts.map +1 -0
- package/dist/helpers/template-helpers.d.mts +16 -0
- package/dist/helpers/template-helpers.d.mts.map +1 -0
- package/dist/helpers/template-helpers.mjs +2 -1
- package/dist/helpers/template-helpers.mjs.map +1 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +18 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/parse-type-definition.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/parse-type-definition.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/to-array.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/to-array.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-object.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-object.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-string.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-string.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/is-parent-path.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/is-parent-path.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/is-type.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/is-type.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/join-paths.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/join-paths.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/regex.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/regex.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/slash.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/slash.mjs.map +1 -0
- package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.2/node_modules/c12/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.2/node_modules/c12/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/js-yaml.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/js-yaml.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/json5.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/json5.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/smol-toml.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/smol-toml.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/json5.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/json5.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/toml.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/toml.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/yaml.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/yaml.mjs.map +1 -0
- package/dist/node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs +2 -1
- package/dist/node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs.map +1 -0
- package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.mjs +2 -1
- package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.mjs.map +1 -0
- package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/package.mjs +2 -1
- package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/package.mjs.map +1 -0
- package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +2 -1
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs.map +1 -0
- package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.mjs +2 -1
- package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.mjs.map +1 -0
- package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti.mjs +2 -1
- package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti.mjs.map +1 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +2 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs.map +1 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs +2 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs.map +1 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.mjs +2 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.mjs.map +1 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.mjs +2 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.mjs.map +1 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/lib/index.mjs +2 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/lib/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/nypm@0.6.5/node_modules/nypm/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/nypm@0.6.5/node_modules/nypm/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.mjs +2 -1
- package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +2 -1
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs.map +1 -0
- package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.mjs +2 -1
- package/dist/node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.mjs.map +1 -0
- package/dist/types/index.d.cts +3 -0
- package/dist/types/index.d.mts +3 -0
- package/dist/types/plugin.d.cts +168 -0
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +168 -0
- package/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.mjs +2 -1
- package/dist/types/plugin.mjs.map +1 -0
- package/dist/types/runtime.d.cts +792 -0
- package/dist/types/runtime.d.cts.map +1 -0
- package/dist/types/runtime.d.mts +792 -0
- package/dist/types/runtime.d.mts.map +1 -0
- package/dist/types/runtime.mjs +2 -1
- package/dist/types/runtime.mjs.map +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvPluginResolvedConfig } from "../types/plugin.cjs";
|
|
2
|
+
import "../index.cjs";
|
|
3
|
+
import * as _powerlines_plugin_babel0 from "@powerlines/plugin-babel";
|
|
4
|
+
|
|
5
|
+
//#region src/babel/plugin.d.ts
|
|
6
|
+
declare const envBabelPlugin: _powerlines_plugin_babel0.DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, Record<string, any>>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { envBabelPlugin };
|
|
9
|
+
//# sourceMappingURL=plugin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/babel/plugin.ts"],"sourcesContent":[],"mappings":";;;;;cAiCa,gBAAc,yBAAA,CAAA,kCAAA,iBA4M1B,uBAAA,GA5M0B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvPluginResolvedConfig } from "../types/plugin.mjs";
|
|
2
|
+
import "../index.mjs";
|
|
3
|
+
import * as _powerlines_plugin_babel0 from "@powerlines/plugin-babel";
|
|
4
|
+
|
|
5
|
+
//#region src/babel/plugin.d.ts
|
|
6
|
+
declare const envBabelPlugin: _powerlines_plugin_babel0.DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, Record<string, any>>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { envBabelPlugin };
|
|
9
|
+
//# sourceMappingURL=plugin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/babel/plugin.ts"],"sourcesContent":[],"mappings":";;;;;cAiCa,gBAAc,yBAAA,CAAA,kCAAA,iBA4M1B,uBAAA,GA5M0B"}
|
package/dist/babel/plugin.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/babel/plugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { NodePath } from \"@babel/core\";\nimport * as t from \"@babel/types\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport { createBabelPlugin } from \"@powerlines/plugin-babel/helpers/create-plugin\";\nimport { addImport } from \"@powerlines/plugin-babel/helpers/module-helpers\";\nimport { BabelPluginPass } from \"@powerlines/plugin-babel/types/config\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/*\n * The Powerlines - Environment Configuration Babel Plugin\n *\n * @param babel - The Babel core module\n * @returns The Babel plugin object\n */\nexport const envBabelPlugin = createBabelPlugin<EnvPluginContext>(\n \"env\",\n ({ log, context }) => {\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false,\n isUsingBuiltin = false\n ) {\n const envTypesAliasProperties = context.env.types.env\n ?.getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n if (node.name) {\n const prefix = context.config.env.prefix.find(\n pre =>\n node.name &&\n node.name.startsWith(pre) &&\n (context.env.types.env?.hasProperty(\n node.name.replace(`${pre}_`, \"\")\n ) ||\n envTypesAliasProperties.some(prop =>\n prop.getAlias().includes(node.name.replace(`${pre}_`, \"\"))\n ))\n );\n\n let name = node.name;\n if (prefix) {\n name = node.name.replace(`${prefix}_`, \"\");\n }\n\n log(\n LogLevelLabel.TRACE,\n `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n );\n\n if (\n context.env.types.env?.hasProperty(name) ||\n envTypesAliasProperties.some(prop => prop.getAlias().includes(name))\n ) {\n const envProperty = context.env.types.env.hasProperty(name)\n ? context.env.types.env.getProperty(name)\n : envTypesAliasProperties.find(prop =>\n prop.getAlias().includes(name)\n );\n if (!envProperty || envProperty.isIgnored()) {\n return;\n }\n\n if (!context.env.used.env.hasProperty(name)) {\n log(\n LogLevelLabel.DEBUG,\n `Adding \"${name}\" environment variables found in \"${\n pass.filename || \"unknown file\"\n }\" to used environment configuration reflection object.`\n );\n\n context.env.used.env.addProperty(envProperty.property);\n }\n\n if (context.config.env.inject && isInjectable) {\n let value = context.env.parsed?.[name];\n if (value === undefined) {\n const prefix = context.config.env.prefix.find(pre => {\n return context.env.parsed[`${pre.replace(/_$/g, \"\")}_${name}`];\n });\n if (prefix) {\n value =\n context.env.parsed[`${prefix.replace(/_$/g, \"\")}_${name}`];\n }\n }\n\n value ??= envProperty.getDefaultValue();\n\n if (envProperty.isValueRequired() && value === undefined) {\n throw new Error(\n `Environment variable \\`${name}\\` is not defined in the .env configuration files`\n );\n }\n\n return stringifyDefaultValue(envProperty, value);\n }\n } else if (context.config.env.validate) {\n throw new Error(\n `The \"${name}\" environment variable is not defined in the \\`env\\` type definition, but is used in the source code file ${\n pass.filename ? pass.filename : \"unknown\"\n }.\n\n The following environment configuration names are defined in the \\`env\\` type definition: \\n${context.env.types.env\n ?.getPropertyNames()\n .sort((a, b) => String(a).localeCompare(String(b)))\n .map(\n typeDef =>\n ` - ${String(typeDef)} ${\n envTypesAliasProperties.some(\n prop =>\n prop.getNameAsString() === String(typeDef) &&\n prop.getAlias().length > 0\n )\n ? `(Alias: ${envTypesAliasProperties\n ?.find(\n prop => prop.getNameAsString() === String(typeDef)\n )\n ?.getAlias()\n .join(\", \")})`\n : \"\"\n }`\n )\n .join(\n \"\\n\"\n )} \\n\\nUsing the following env prefix: \\n${context.config.env.prefix\n .map(prefix => ` - ${prefix}`)\n .join(\n \"\\n\"\n )} \\n\\nPlease check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \\n\\n`\n );\n } else if (pass.filename && isUsingBuiltin) {\n context.warn(\n `The \"${\n name\n }\" environment variable is used in the source code file ${\n pass.filename\n }, but is not defined in the \\`env\\` type definition. If this is intentional, you can ignore this warning. Otherwise, please check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code.`\n );\n }\n }\n\n return undefined;\n }\n\n return {\n visitor: {\n MemberExpression(\n path: NodePath<t.MemberExpression>,\n pass: BabelPluginPass\n ) {\n if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path\n .get(\"object\")\n ?.get(\"object\")\n ?.isIdentifier({ name: \"process\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // process.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path.get(\"object\")?.get(\"object\")?.isMetaProperty() &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // import.meta.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path.get(\"object\")?.isIdentifier({ name: \"env\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, true);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;;;;AAIA,SAAS,aAAa,IAAI,MAAM;AAC5B,IAAG,SAAS;AACZ,QAAO;;AA8BX,MAAa,kBAAU,kBAAA,IAAA,CAAA,OAAA,qBAAA,KAAA,CAAA,EAAA,kBAAA,OAAA,cAAA,EAAA,KAAA,cAAA;CACnB,SAAS,WAAW,MAAA,MAAA,eAAA,OAAA,iBAAA,OAAA;EAChB,MAAM,0BAAa,QAAA,IAAA,MAAA,KACb,eAAY,CACb,OAAO,cAAO,SAAA,KAAA,UAAA,CAAA,SAAA,GAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;AACrB,MAAA,KAAA,MAAA;GACM,MAAM,SAAS,QAAQ,OAAO,IAAI,OAAO,KAAK,cAAA,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aAAA,KAAA,IAAA,WAAA,EAAA;AACL,OAAI,CAAC,WAAW,KACZ;;AAGJ,QAAK,wBAAwB,OAAO,WAAW,OAAO;AACtD,aAAU,MAAC;IACP,QAAQ,GAAG,QAAQ,OAAO,aAAY,aAAA;IAC9C,MAAA;IACO,UAAA;IACF,CAAC;aAEG,KACJ,IAAI,SAAS,EACZ,IAAI,WAAW,EACnB,aAAA,EAAA,MAAA,OAAA,CAAA,IACE,KAAK,IAAI,SAAS,EAAE,IAAI,SAAS,EAAE,gBAAA,IACnC,KAAK,IAAI,WAAC,EAAA,cAAA,EAAA;GAEV,MAAI,aAAA,KAAA,IAAA,WAAA,EAAA;AACJ,OAAI,CAAC,WAAU,KACX;AAEP,cAAA,YAAA,MAAA,OAAA,MAAA;AACL,QAAA,wBAAA,OAAA,WAAA,OAAA;AACK,aAAA,MAAA;IACA,QAAA,GAAA,QAAA,OAAA,aAAA,aAAA;IACO,MAAM;IACN,UAAU;IACjB,CAAA;aAEQ,KAAK,IAAI,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC,IAC/D,KAAA,IAAA,WAAA,EAAA,cAAA,EAAA;GAES,MAAE,aAAA,KAAA,IAAA,WAAA,EAAA;AACH,OAAA,CAAA,WAAA,KACF;AAEG,cAAM,YAAA,MAAA,OAAA,KAAA;;IAEf;QAAA;EAAA;QAAA;EAAA;EAAA;EAAA;EAAA,CAAA,EACH,EACH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
3
|
+
import { MarkdownFileProps } from "@powerlines/plugin-alloy/markdown/components/markdown-file";
|
|
4
|
+
|
|
5
|
+
//#region src/components/docs.d.ts
|
|
6
|
+
interface EnvDocsFileProps extends Partial<MarkdownFileProps> {
|
|
7
|
+
/**
|
|
8
|
+
* The heading level offset to apply to the generated documentation.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This is useful when nesting the documentation within other markdown files.
|
|
12
|
+
*
|
|
13
|
+
* @defaultValue 0
|
|
14
|
+
*/
|
|
15
|
+
levelOffset?: number;
|
|
16
|
+
reflection: ReflectionClass<any>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Generates the environment configuration markdown documentation for the Powerlines project.
|
|
20
|
+
*/
|
|
21
|
+
declare function EnvDocsFile(props: EnvDocsFileProps): _alloy_js_core0.Children;
|
|
22
|
+
declare type __ΩEnvDocsFileProps = any[];
|
|
23
|
+
//#endregion
|
|
24
|
+
export { EnvDocsFile, EnvDocsFileProps, __ΩEnvDocsFileProps };
|
|
25
|
+
//# sourceMappingURL=docs.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":[],"mappings":";;;;;UAmCiB,gBAAA,SAAyB,QAAQ;;;AAAlD;;;;;AAiBA;;cANc;;;;;iBAME,WAAA,QAAmB,mBAAgB,eAAA,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
2
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
|
+
import { MarkdownFileProps } from "@powerlines/plugin-alloy/markdown/components/markdown-file";
|
|
4
|
+
|
|
5
|
+
//#region src/components/docs.d.ts
|
|
6
|
+
interface EnvDocsFileProps extends Partial<MarkdownFileProps> {
|
|
7
|
+
/**
|
|
8
|
+
* The heading level offset to apply to the generated documentation.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* This is useful when nesting the documentation within other markdown files.
|
|
12
|
+
*
|
|
13
|
+
* @defaultValue 0
|
|
14
|
+
*/
|
|
15
|
+
levelOffset?: number;
|
|
16
|
+
reflection: ReflectionClass<any>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Generates the environment configuration markdown documentation for the Powerlines project.
|
|
20
|
+
*/
|
|
21
|
+
declare function EnvDocsFile(props: EnvDocsFileProps): _alloy_js_core0.Children;
|
|
22
|
+
declare type __ΩEnvDocsFileProps = any[];
|
|
23
|
+
//#endregion
|
|
24
|
+
export { EnvDocsFile, EnvDocsFileProps, __ΩEnvDocsFileProps };
|
|
25
|
+
//# sourceMappingURL=docs.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":[],"mappings":";;;;;UAmCiB,gBAAA,SAAyB,QAAQ;;;AAAlD;;;;;AAiBA;;cANc;;;;;iBAME,WAAA,QAAmB,mBAAgB,eAAA,CAAA"}
|
package/dist/components/docs.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.mjs","names":["code","Show","Heading","Link","stringifyType","Spacing","usePowerlines","MarkdownFile","MarkdownTable","joinPaths","getDocsOutputPath","EnvDocsFile","props","levelOffset","reflection","rest","context","_$createComponent","_$mergeProps","path","children","level","when","packageJson","name","href","title","data","getProperties","filter","property","getNameAsString","sort","a","b","localeCompare","map","reflectionProperty","trim","description","getDescription","type","getType","replaceAll","defaultValue","hasDefault","String","getDefaultValue","includes","required","isValueRequired"],"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, Show } from \"@alloy-js/core\";\nimport { Heading, Link } from \"@alloy-js/markdown\";\nimport {\n ReflectionClass,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\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 { joinPaths } from \"@stryke/path/join\";\nimport { getDocsOutputPath } from \"../helpers/docs-helper\";\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 reflection: ReflectionClass<any>;\n}\n\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, reflection, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment Configuration</Heading>\n {code`Below is a list of environment variables used by the`}\n <Show when={!!context.packageJson.name}>\n <Link\n href={`https://www.npmjs.com/package/${context.packageJson.name}`}\n title={context.packageJson.name!}\n />\n </Show>\n {code`package. These values can be updated in the \\`.env\\` file in the root of the project.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Environment Variables</Heading>\n <Spacing />\n {code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`}\n <Spacing />\n <MarkdownTable\n data={\n reflection\n ?.getProperties()\n .filter(\n property =>\n property.getNameAsString() !== \"__POWERLINES_INJECTED__\"\n )\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n )\n .map(reflectionProperty => {\n return {\n name: reflectionProperty.getNameAsString().trim(),\n description: (reflectionProperty.getDescription() ?? \"\").trim(),\n type: stringifyType(reflectionProperty.getType())\n .trim()\n .replaceAll(\" | \", \", or \"),\n defaultValue: reflectionProperty.hasDefault()\n ? String(reflectionProperty.getDefaultValue())?.includes('\"')\n ? reflectionProperty.getDefaultValue()\n : `\\`${reflectionProperty.getDefaultValue()}\\``\n : \"\",\n required: reflectionProperty.isValueRequired() ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoDA,SAAgBW,YAAYC,OAAyB;CACnD,MAAM,EAAEC,cAAc,GAAGC,YAAY,GAAGC,SAASH;CAEjD,MAAMI,UAAUV,eAAiC;AAEjD,QAAAW,gBACGV,cAAYW,WAAA,EAAA,IACXC,OAAI;AAAA,SAAEV,UAAUC,kBAAkBM,QAAQ,EAAE,SAAS;IAAA,EACjDD,MAAI,EAAA,IAAAK,WAAA;AAAA,SAAA;GAAAH,gBACPf,SAAO;IAACmB,OAAO,IAAIR;IAAWO,UAAA;IAAA,CAAA;GAC9BpB,IAAI;GAAsDiB,gBAC1DhB,MAAI;IAAA,IAACqB,OAAI;AAAA,YAAE,CAAC,CAACN,QAAQO,YAAYC;;IAAI,IAAAJ,WAAA;AAAA,YAAAH,gBACnCd,MAAI;MAAA,IACHsB,OAAI;AAAA,cAAE,iCAAiCT,QAAQO,YAAYC;;MAAM,IACjEE,QAAK;AAAA,cAAEV,QAAQO,YAAYC;;MAAI,CAAA;;IAAA,CAAA;GAGlCxB,IAAI;GAAuFiB,gBAC3FZ,SAAO,EAAA,CAAA;GAAAY,gBACPf,SAAO;IAACmB,OAAO,IAAIR;IAAWO,UAAA;IAAA,CAAA;GAAAH,gBAC9BZ,SAAO,EAAA,CAAA;GACPL,IAAI;GAAwSiB,gBAC5SZ,SAAO,EAAA,CAAA;GAAAY,gBACPT,eAAa,EAAA,IACZmB,OAAI;AAAA,WACFb,YACIc,eAAe,CAChBC,QACCC,aACEA,SAASC,iBAAiB,KAAK,0BAClC,CACAC,MAAMC,GAAGC,MACRD,EAAEF,iBAAiB,CAACI,cAAcD,EAAEH,iBAAiB,CACvD,CAAC,CACAK,KAAIC,uBAAsB;AACzB,YAAO;MACLb,MAAMa,mBAAmBN,iBAAiB,CAACO,MAAM;MACjDC,cAAcF,mBAAmBG,gBAAgB,IAAI,IAAIF,MAAM;MAC/DG,MAAMrC,cAAciC,mBAAmBK,SAAS,CAAC,CAC9CJ,MAAM,CACNK,WAAW,OAAO,QAAQ;MAC7BC,cAAcP,mBAAmBQ,YAAY,GACzCC,OAAOT,mBAAmBU,iBAAiB,CAAC,EAAEC,SAAS,KAAI,GACzDX,mBAAmBU,iBAAiB,GACpC,KAAKV,mBAAmBU,iBAAiB,CAAA,MAC3C;MACJE,UAAUZ,mBAAmBa,iBAAiB,GAAG,KAAK;MACvD;MACD,IAAI,EAAE;MAAA,CAAA;GAAA;IAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core";
|
|
2
|
+
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
3
|
+
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
4
|
+
import { InterfaceDeclarationProps } from "@powerlines/plugin-alloy/typescript/components/interface-declaration";
|
|
5
|
+
|
|
6
|
+
//#region src/components/env-builtin.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generates the environment configuration typescript definition for the Powerlines project.
|
|
10
|
+
*/
|
|
11
|
+
declare function EnvTypeDefinition(props: Omit<InterfaceDeclarationProps, "name">): Children;
|
|
12
|
+
interface EnvBuiltinProps extends Omit<BuiltinFileProps, "id"> {
|
|
13
|
+
defaultConfig?: Children;
|
|
14
|
+
reflection: ReflectionClass<any>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generates the environment configuration module for the Powerlines project.
|
|
18
|
+
*/
|
|
19
|
+
declare function EnvBuiltin(props: EnvBuiltinProps): Children;
|
|
20
|
+
declare type __ΩEnvBuiltinProps = any[];
|
|
21
|
+
//#endregion
|
|
22
|
+
export { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps };
|
|
23
|
+
//# sourceMappingURL=env-builtin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-builtin.d.cts","names":[],"sources":["../../src/components/env-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;AAqEA;AACc,iBADE,iBAAA,CACF,KAAA,EAAL,IAAK,CAAA,yBAAA,EAAA,MAAA,CAAA,CAAA,EAAkC,QAAlC;AAAL,UAkLQ,eAAA,SAAwB,IAlLhC,CAkLqC,gBAlLrC,EAAA,IAAA,CAAA,CAAA;EAAuC,aAAA,CAAA,EAmL9B,QAnL8B;EAAA,UAAA,EAoLlC,eApLkC,CAAA,GAAA,CAAA;AAkLhD;;;;AAAyC,iBAYzB,UAAA,CAZyB,KAAA,EAYP,eAZO,CAAA,EAYQ,QAZR;AAAI,kCAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
2
|
+
import { Children } from "@alloy-js/core";
|
|
3
|
+
import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
4
|
+
import { InterfaceDeclarationProps } from "@powerlines/plugin-alloy/typescript/components/interface-declaration";
|
|
5
|
+
|
|
6
|
+
//#region src/components/env-builtin.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generates the environment configuration typescript definition for the Powerlines project.
|
|
10
|
+
*/
|
|
11
|
+
declare function EnvTypeDefinition(props: Omit<InterfaceDeclarationProps, "name">): Children;
|
|
12
|
+
interface EnvBuiltinProps extends Omit<BuiltinFileProps, "id"> {
|
|
13
|
+
defaultConfig?: Children;
|
|
14
|
+
reflection: ReflectionClass<any>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generates the environment configuration module for the Powerlines project.
|
|
18
|
+
*/
|
|
19
|
+
declare function EnvBuiltin(props: EnvBuiltinProps): Children;
|
|
20
|
+
declare type __ΩEnvBuiltinProps = any[];
|
|
21
|
+
//#endregion
|
|
22
|
+
export { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps };
|
|
23
|
+
//# sourceMappingURL=env-builtin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-builtin.d.mts","names":[],"sources":["../../src/components/env-builtin.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;AAqEA;AACc,iBADE,iBAAA,CACF,KAAA,EAAL,IAAK,CAAA,yBAAA,EAAA,MAAA,CAAA,CAAA,EAAkC,QAAlC;AAAL,UAkLQ,eAAA,SAAwB,IAlLhC,CAkLqC,gBAlLrC,EAAA,IAAA,CAAA,CAAA;EAAuC,aAAA,CAAA,EAmL9B,QAnL8B;EAAA,UAAA,EAoLlC,eApLkC,CAAA,GAAA,CAAA;AAkLhD;;;;AAAyC,iBAYzB,UAAA,CAZyB,KAAA,EAYP,eAZO,CAAA,EAYQ,QAZR;AAAI,kCAAA,GAAA,EAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-builtin.mjs","names":["code","computed","For","Show","splitProps","ClassDeclaration","ClassMethod","ElseIfClause","FunctionDeclaration","IfStatement","NewExpression","TypeDeclaration","VarDeclaration","ReflectionClass","ReflectionKind","Spacing","usePowerlines","refkey","BuiltinFile","InterfaceDeclaration","ObjectDeclaration","TSDoc","TSDocExample","TSDocLink","TSDocParam","TSDocRemarks","TSDocReturns","TSDocThrows","titleCase","defu","loadEnvFromContext","EnvTypeDefinition","props","defaultValue","reflection","context","_$createComponent","name","heading","children","config","env","prefix","map","replace","join","ConfigPropertyConditional","sort","a","b","startsWith","localeCompare","toLowerCase","ConfigPropertyGet","property","index","condition","getNameAsString","when","_$memo","getAlias","length","each","joiner","alias","ConfigPropertySet","createEnvRefkey","envRefkey","envSerializerRefkey","EnvBuiltin","defaultConfig","rest","process","envInstance","result","kind","objectLiteral","description","types","reflectionGetProperties","getProperties","filter","isIgnored","reflectionSetProperties","isReadonly","_$mergeProps","id","imports","Boolean","value","_$createIntrinsic","type","doc","initializer","args","target","entryPath","async","parameters","optional","default","returnType","ender"],"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 ClassDeclaration,\n ClassMethod,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n NewExpression,\n TypeDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport {\n ReflectionClass,\n ReflectionKind,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\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 { ComponentProps } from \"@powerlines/plugin-alloy/types/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { InterfaceDeclarationProps } from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport { InterfaceDeclaration } from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport { ObjectDeclaration } from \"@powerlines/plugin-alloy/typescript/components/object-declaration\";\nimport {\n TSDoc,\n TSDocExample,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns,\n TSDocThrows\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { loadEnvFromContext } from \"../helpers/load\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Generates the environment configuration typescript definition for the Powerlines project.\n */\nexport function EnvTypeDefinition(\n props: Omit<InterfaceDeclarationProps, \"name\">\n) {\n const [{ defaultValue, reflection }] = splitProps(props, [\n \"defaultValue\",\n \"reflection\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <>\n <InterfaceDeclaration\n name=\" EnvBase\"\n defaultValue={defaultValue}\n reflection={reflection}\n export={true}\n />\n <Spacing />\n <TSDoc heading=\"The environment configuration object with prefixed keys.\">\n <TSDocRemarks>\n {`The \\`Env\\` type extends the \\`EnvBase\\` 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 <TypeDeclaration name=\"Env\" export={true}>\n {code` {\n [Key in keyof EnvBase as Key ${context.config.env.prefix\n .map(prefix => `| \\`${prefix.replace(/_$/g, \"\")}_\\${Key}\\``)\n .join(\" \")}]: EnvBase[Key];\n}\n`}\n </TypeDeclaration>\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(/^(${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 property: ReflectionProperty;\n}\n\nfunction ConfigPropertyGet(props: ConfigPropertyProps) {\n const [{ context, property, index }] = splitProps(props, [\n \"context\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${property.getNameAsString()}\"];`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${property.getNameAsString()}\"];`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nfunction ConfigPropertySet(props: ConfigPropertyProps) {\n const [{ context, property, index }] = splitProps(props, [\n \"context\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${property.getNameAsString()}\"] = newValue;\n return true;\n`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${property.getNameAsString()}\"] = newValue;\n return true;\n`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nexport interface EnvBuiltinProps extends Omit<BuiltinFileProps, \"id\"> {\n defaultConfig?: Children;\n reflection: ReflectionClass<any>;\n}\n\nconst createEnvRefkey = refkey(\"createEnv\");\nconst envRefkey = refkey(\"env\");\nconst envSerializerRefkey = refkey(\"EnvSerializer\");\n\n/**\n * Generates the environment configuration module for the Powerlines project.\n */\nexport function EnvBuiltin(props: EnvBuiltinProps) {\n const [{ defaultConfig, reflection, children }, rest] = splitProps(props, [\n \"defaultConfig\",\n \"reflection\",\n \"children\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n const defaultValue = computed(\n () => context && loadEnvFromContext(context, process.env)\n );\n\n const envInstance = computed(() => {\n const result = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n description: `The initial environment configuration state for the ${titleCase(\n context?.config?.name\n )} project.`,\n types: []\n },\n reflection\n );\n\n return result;\n });\n\n const reflectionGetProperties = computed(\n () =>\n reflection\n ?.getProperties()\n .filter(property => !property.isIgnored())\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n ) ?? []\n );\n const reflectionSetProperties = computed(\n () =>\n reflection\n ?.getProperties()\n .filter(property => !property.isIgnored() && !property.isReadonly())\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\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 imports={defu(\n {\n \"@powerlines/deepkit/vendor/type\": [\n \"stringify\",\n \"serializer\",\n \"serializeFunction\",\n \"deserializeFunction\",\n \"ReflectionKind\",\n \"Serializer\",\n \"TemplateState\",\n \"Type\",\n \"TypeProperty\",\n \"TypePropertySignature\"\n ]\n },\n rest.imports ?? {}\n )}>\n <Show when={Boolean(reflection)}>\n <EnvTypeDefinition\n defaultValue={defaultValue.value}\n reflection={reflection}\n />\n <hbr />\n <hbr />\n </Show>\n\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<EnvBase>\"\n defaultValue={defaultValue}\n reflection={envInstance}\n export={true}\n const={true}\n doc=\"The initial environment configuration object values for the runtime.\"\n />\n <Spacing />\n\n <TSDoc heading=\"The environment configuration serializer for the Powerlines application.\">\n <TSDocLink>\n {`https://deepkit.io/docs/serialization/serializers`}\n </TSDocLink>\n <TSDocLink>\n {`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}\n </TSDocLink>\n <TSDocRemarks>\n {`This serializer is used to serialize and deserialize the Powerlines environment configuration.`}\n </TSDocRemarks>\n </TSDoc>\n <ClassDeclaration\n refkey={envSerializerRefkey}\n name=\"EnvSerializer\"\n extends=\"Serializer\"\n export={true}>\n <ClassMethod\n name=\"constructor\"\n public={true}\n doc=\"Initializes a new instance of the `EnvSerializer` class.\">\n {code`super(\"env\");\n\n this.deserializeRegistry.register(\n ReflectionKind.boolean,\n (type: Type, state: TemplateState) => {\n state.addSetter(\n \\`typeof \\${state.accessor.toString()} !== \"boolean\" ? \\${state.accessor.toString()} === 1 || \\${state.accessor.toString()} === \"1\" || \\${state.accessor.toString()}.toLowerCase() === \"t\" || \\${state.accessor.toString()}.toLowerCase() === \"true\" || \\${state.accessor.toString()}.toLowerCase() === \"y\" || \\${state.accessor.toString()}.toLowerCase() === \"yes\" : \\${state.accessor.toString()}\\`\n );\n }\n ); `}\n </ClassMethod>\n </ClassDeclaration>\n <Spacing />\n\n <TSDoc heading=\"A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.\">\n <TSDocLink>\n {`https://deepkit.io/docs/serialization/serializers`}\n </TSDocLink>\n <TSDocLink>\n {`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}\n </TSDocLink>\n <TSDocRemarks>\n {`This serializer is used to serialize and deserialize the Powerlines environment configuration.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n name=\"envSerializer\"\n export={false}\n const={true}\n initializer={<NewExpression args={[]} target=\"EnvSerializer\" />}\n />\n <Spacing />\n\n <TSDoc heading=\"Serialize a environment configuration object to JSON data objects (not a JSON string).\">\n <TSDocRemarks>\n {`The resulting JSON object can be stringified using \\`JSON.stringify()\\`.`}\n </TSDocRemarks>\n <TSDocExample>{`const json = serializeEnv(env);`}</TSDocExample>\n <TSDocThrows>\n {`ValidationError when serialization or validation fails.`}\n </TSDocThrows>\n </TSDoc>\n <VarDeclaration\n name=\"serializeEnv\"\n export={true}\n const={true}\n initializer={\"serializeFunction<EnvBase>(envSerializer)\"}\n />\n <Spacing />\n\n <TSDoc heading=\"Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.\">\n <TSDocRemarks>\n {`Types that are already correct will be used as-is.`}\n </TSDocRemarks>\n <TSDocExample>{`const env = deserializeEnv(json);`}</TSDocExample>\n <TSDocThrows>\n {`ValidationError when deserialization fails.`}\n </TSDocThrows>\n </TSDoc>\n <VarDeclaration\n name=\"deserializeEnv\"\n export={true}\n const={true}\n initializer=\"deserializeFunction<EnvBase>(envSerializer)\"\n />\n <Spacing />\n\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={true}\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: EnvBase, propertyName: string) => { `}\n <hbr />\n\n <For each={reflectionGetProperties}>\n {(property: ReflectionProperty, index: number) => (\n <ConfigPropertyGet\n index={index}\n context={context}\n property={property}\n />\n )}\n </For>\n {code`\n return undefined;\n }, `}\n\n <Spacing />\n {code` set: (target: EnvBase, propertyName: string, newValue: any) => { `}\n <hbr />\n\n <For each={reflectionSetProperties} ender={code` else `}>\n {(property: ReflectionProperty, index: number) => (\n <ConfigPropertySet\n index={index}\n context={context}\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 <hbr />\n\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={true}\n const={true}\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 />\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":";;;;;;;;;;;;;;;;;;;AAqEA,SAAgB+B,kBACdC,OACA;CACA,MAAM,CAAC,EAAEC,cAAcC,gBAAgB9B,WAAW4B,OAAO,CACvD,gBACA,aACD,CAAC;CAEF,MAAMG,UAAUnB,eAAiC;AAEjD,QAAA;EAAAoB,gBAEKjB,sBAAoB;GACnBkB,MAAI;GACUJ;GACFC;GAAU,UACd;GAAI,CAAA;EAAAE,gBAEbrB,SAAO,EAAA,CAAA;EAAAqB,gBACPf,OAAK;GAACiB,SAAO;GAAA,IAAAC,WAAA;AAAA,WAAAH,gBACXX,cAAY,EAAAc,UACV,iPAA+O,CAAA;;GAAA,CAAA;EAAAH,gBAGnPzB,iBAAe;GAAC0B,MAAI;GAAA,UAAe;GAAI,IAAAE,WAAA;AAAA,WACrCvC,IAAI;mCACsBmC,QAAQK,OAAOC,IAAIC,OAC/CC,KAAID,WAAU,OAAOA,OAAOE,QAAQ,OAAO,GAAG,CAAA,YAAa,CAC3DC,KAAK,IAAI,CAAA;;;;GAEf,CAAA;EAAAT,gBAEMrB,SAAO,EAAA,CAAA;EAAA;;AAUd,SAAS+B,0BAA0Bd,OAAuC;CACxE,MAAM,CAAC,EAAEG,SAASE,UAAUjC,WAAW4B,OAAO,CAAC,WAAW,OAAO,CAAC;AAElE,QAAOhC,IAAI,qBAAqBqC,KAAI,+BAAgCF,QAAQK,OAAOC,IAAIC,OACpFK,MAAMC,GAAGC,MACRD,EAAEE,WAAWD,EAAE,GAAG,KAAKA,EAAEC,WAAWF,EAAE,GAAG,IAAIA,EAAEG,cAAcF,EAC/D,CAAC,CACAN,KAAID,W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EAAA,CAAA;IAAAqB,gBAEPxB,gBAAc;KAAA,UAAA;KAAA,SAAA;KAGbyB,MAAI;KACJuD,KAAG;KACHC,aAAa7F,IAAI;KAAuC,CAAA;IAAAoC,gBAEzDrB,SAAO,EAAA,CAAA;IAAAqB,gBACPjC,MAAI;KAAA,IAACuD,OAAI;AAAA,aAAE8B,QAAQjD,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { EnvDocsFile, EnvDocsFileProps, __ΩEnvDocsFileProps } from "./docs.cjs";
|
|
2
|
+
import { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from "./env-builtin.cjs";
|
|
3
|
+
export { EnvBuiltin, EnvBuiltinProps, EnvDocsFile, EnvDocsFileProps, EnvTypeDefinition, __ΩEnvBuiltinProps, __ΩEnvDocsFileProps };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { EnvDocsFile, EnvDocsFileProps, __ΩEnvDocsFileProps } from "./docs.mjs";
|
|
2
|
+
import { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from "./env-builtin.mjs";
|
|
3
|
+
export { EnvBuiltin, EnvBuiltinProps, EnvDocsFile, EnvDocsFileProps, EnvTypeDefinition, __ΩEnvBuiltinProps, __ΩEnvDocsFileProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UnresolvedContext } from "powerlines";
|
|
2
|
+
import * as automd0 from "automd";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/automd-generator.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* AutoMD generator to generate environment variable documentation
|
|
8
|
+
*
|
|
9
|
+
* @param context - The generator context.
|
|
10
|
+
* @returns The generated documentation content.
|
|
11
|
+
*/
|
|
12
|
+
declare const env: (context: UnresolvedContext) => automd0.Generator;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { env };
|
|
15
|
+
//# sourceMappingURL=automd-generator.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automd-generator.d.cts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA4BA;;;cAAa,eAAgB,sBAAiB,OAAA,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UnresolvedContext } from "powerlines";
|
|
2
|
+
import * as automd0 from "automd";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/automd-generator.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* AutoMD generator to generate environment variable documentation
|
|
8
|
+
*
|
|
9
|
+
* @param context - The generator context.
|
|
10
|
+
* @returns The generated documentation content.
|
|
11
|
+
*/
|
|
12
|
+
declare const env: (context: UnresolvedContext) => automd0.Generator;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { env };
|
|
15
|
+
//# sourceMappingURL=automd-generator.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automd-generator.d.mts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA4BA;;;cAAa,eAAgB,sBAAiB,OAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n context.config.root,\n \"docs\",\n \"generated\",\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":";;;;;AAEA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;AA2BX,MAAa,MAAM,cAAE,YAAA,gBAAA;CACjB,MAAM;CACN,UAAU,aAAa,eAAA,WAAA;EACnB,MAAM,aAAA,UAAA,QAAA,OAAA,MAAA,QAAA,aAAA,SAAA;AACN,MAAI,CAAC,QAAM,GAAA,WAAA,WAAA,CACP,QAAG,EACR,UAAA;AAIC,SAAO,EACN,UAFM,MAAA,QAAA,GAAA,KAAA,WAAA,IAEN,IACH;;CAEL,CAAC,EAAE;OAAO;CAAsB;CAAW;CAAI;CAAQ,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EnvPluginContext } from "../types/plugin.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/create-reflection-resource.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a reflection resource for the environment configuration.
|
|
7
|
+
*
|
|
8
|
+
* @param _context - The environment plugin context.
|
|
9
|
+
* @returns A resource that provides the reflection of the environment configuration.
|
|
10
|
+
*/
|
|
11
|
+
declare function createReflection(_context: EnvPluginContext): {};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { createReflection };
|
|
14
|
+
//# sourceMappingURL=create-reflection-resource.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-reflection-resource.d.cts","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"sourcesContent":[],"mappings":";;;;;;AA0BA;;;;iBAAgB,gBAAA,WAA2B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EnvPluginContext } from "../types/plugin.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/create-reflection-resource.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a reflection resource for the environment configuration.
|
|
7
|
+
*
|
|
8
|
+
* @param _context - The environment plugin context.
|
|
9
|
+
* @returns A resource that provides the reflection of the environment configuration.
|
|
10
|
+
*/
|
|
11
|
+
declare function createReflection(_context: EnvPluginContext): {};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { createReflection };
|
|
14
|
+
//# sourceMappingURL=create-reflection-resource.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-reflection-resource.d.mts","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"sourcesContent":[],"mappings":";;;;;;AA0BA;;;;iBAAgB,gBAAA,WAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-reflection-resource.mjs","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Creates a reflection resource for the environment configuration.\n *\n * @param _context - The environment plugin context.\n * @returns A resource that provides the reflection of the environment configuration.\n */\nexport function createReflection(_context: EnvPluginContext) {\n // const defaultValue = computed(\n // () => context && loadEnvFromContext(context, process.env)\n // );\n\n return {};\n\n // return computed(() => {\n // result.getProperties().forEach(prop => {\n // const aliases = prop.getAlias();\n // aliases.filter(Boolean).forEach(alias => {\n // result.addProperty({\n // name: alias,\n // optional: prop.isOptional() ? true : undefined,\n // readonly: prop.isReadonly() ? true : undefined,\n // description: prop.getDescription(),\n // visibility: prop.getVisibility(),\n // type: prop.getType(),\n // default: prop.getDefaultValue(),\n // tags: {\n // hidden: prop.isHidden(),\n // ignore: prop.isIgnored(),\n // internal: prop.isInternal(),\n // alias: prop\n // .getAlias()\n // .filter(a => a !== alias)\n // .concat(prop.name),\n // title: prop.getTitle() || titleCase(prop.name),\n // readonly: prop.isReadonly(),\n // permission: prop.getPermission(),\n // domain: prop.getDomain()\n // }\n // });\n // });\n // });\n\n // result.getProperties().forEach(prop => {\n // prop.setDefaultValue(\n // (defaultValue.value as Record<string, any>)?.[prop.getNameAsString()] ??\n // prop\n // .getAlias()\n // .reduce(\n // (ret, alias) =>\n // ret ?? (defaultValue.value as Record<string, any>)?.[alias],\n // undefined\n // ) ??\n // prop.getDefaultValue()\n // );\n // });\n // });\n}\n"],"mappings":";;;;;;;;;;AAYI,QAAO,EAAE;;AA4Cb,iBAAiB,SAAS;OAAO;CAAK;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EnvPluginContext } from "../types/plugin.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/docs-helper.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Gets the output path for the generated environment documentation.
|
|
7
|
+
*
|
|
8
|
+
* @param context - The environment plugin context.
|
|
9
|
+
* @returns The output path for the generated environment documentation.
|
|
10
|
+
*/
|
|
11
|
+
declare function getDocsOutputPath(context: EnvPluginContext): string;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { getDocsOutputPath };
|
|
14
|
+
//# sourceMappingURL=docs-helper.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-helper.d.cts","names":[],"sources":["../../src/helpers/docs-helper.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;iBAAgB,iBAAA,UAA2B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EnvPluginContext } from "../types/plugin.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/docs-helper.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Gets the output path for the generated environment documentation.
|
|
7
|
+
*
|
|
8
|
+
* @param context - The environment plugin context.
|
|
9
|
+
* @returns The output path for the generated environment documentation.
|
|
10
|
+
*/
|
|
11
|
+
declare function getDocsOutputPath(context: EnvPluginContext): string;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { getDocsOutputPath };
|
|
14
|
+
//# sourceMappingURL=docs-helper.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-helper.d.mts","names":[],"sources":["../../src/helpers/docs-helper.ts"],"sourcesContent":[],"mappings":";;;;;;AA2BA;;;;iBAAgB,iBAAA,UAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-helper.mjs","names":[],"sources":["../../src/helpers/docs-helper.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Gets the output path for the generated environment documentation.\n *\n * @param context - The environment plugin context.\n * @returns The output path for the generated environment documentation.\n */\nexport function getDocsOutputPath(context: EnvPluginContext): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAE,kBAAA,SAAA;AACE,QAAO,UAAU,QAAQ,OAAO,MAAM,QAAQ,YAAY;;AAE9D,kBAAA,SAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createReflection } from "./create-reflection-resource.cjs";
|
|
2
|
+
import { loadEnv, loadEnvFromContext } from "./load.cjs";
|
|
3
|
+
import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection } from "./persistence.cjs";
|
|
4
|
+
import { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./reflect.cjs";
|
|
5
|
+
import { formatEnvField, removeEnvPrefix } from "./source-file-env.cjs";
|
|
6
|
+
import { createTemplateReflection } from "./template-helpers.cjs";
|
|
7
|
+
export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createReflection, createSecretsReflection, createTemplateReflection, formatEnvField, getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, loadEnv, loadEnvFromContext, mergeEnvReflections, mergeSecretsReflections, readEnvReflection, readEnvTypeReflection, readSecretsReflection, reflectEnv, reflectSecrets, removeEnvPrefix, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createReflection } from "./create-reflection-resource.mjs";
|
|
2
|
+
import { loadEnv, loadEnvFromContext } from "./load.mjs";
|
|
3
|
+
import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection } from "./persistence.mjs";
|
|
4
|
+
import { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./reflect.mjs";
|
|
5
|
+
import { formatEnvField, removeEnvPrefix } from "./source-file-env.mjs";
|
|
6
|
+
import { createTemplateReflection } from "./template-helpers.mjs";
|
|
7
|
+
export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createReflection, createSecretsReflection, createTemplateReflection, formatEnvField, getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, loadEnv, loadEnvFromContext, mergeEnvReflections, mergeSecretsReflections, readEnvReflection, readEnvTypeReflection, readSecretsReflection, reflectEnv, reflectSecrets, removeEnvPrefix, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvPluginOptions } from "../types/plugin.cjs";
|
|
2
|
+
import { DotenvParseOutput } from "@stryke/env/types";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/load.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves various dotenv configuration parameters from the context.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context to retrieve the dotenv configuration from.
|
|
10
|
+
* @param parsed - The parsed dotenv configuration.
|
|
11
|
+
* @returns An object containing the dotenv configuration.
|
|
12
|
+
*/
|
|
13
|
+
declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvParseOutput): {
|
|
14
|
+
APP_NAME: string | undefined;
|
|
15
|
+
APP_VERSION: string | undefined;
|
|
16
|
+
BUILD_ID: string;
|
|
17
|
+
BUILD_TIMESTAMP: string;
|
|
18
|
+
BUILD_CHECKSUM: string;
|
|
19
|
+
RELEASE_ID: string;
|
|
20
|
+
RELEASE_TAG: string;
|
|
21
|
+
DEFAULT_LOCALE: string | undefined;
|
|
22
|
+
DEFAULT_TIMEZONE: string | undefined;
|
|
23
|
+
LOG_LEVEL: "error" | "warn" | "info" | "debug" | null;
|
|
24
|
+
ERROR_URL: string | undefined;
|
|
25
|
+
ORGANIZATION: string | undefined;
|
|
26
|
+
PLATFORM: "node" | "browser" | "neutral";
|
|
27
|
+
MODE: "development" | "test" | "production";
|
|
28
|
+
TEST: boolean;
|
|
29
|
+
DEBUG: boolean;
|
|
30
|
+
STACKTRACE: boolean;
|
|
31
|
+
ENVIRONMENT: string;
|
|
32
|
+
};
|
|
33
|
+
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { loadEnv, loadEnvFromContext };
|
|
36
|
+
//# sourceMappingURL=load.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.cts","names":[],"sources":["../../src/helpers/load.ts"],"sourcesContent":[],"mappings":";;;;;;;AAgGA;AAoDA;;;;AAEsC,iBAtDtB,kBAAA,CAsDsB,OAAA,EArD3B,gBAqD2B,EAAA,MAAA,EApD5B,iBAoD4B,CAAA,EAAA;EAA2B,QAAA,EAAA,MAAA,GAAA,SAAA;EAAR,WAAA,EAAA,MAAA,GAAA,SAAA;EAAO,QAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;iBAF1C,qBACP,oBAAoB,4BACxB,2BAA2B,mBAAmB,QAAQ"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvPluginOptions } from "../types/plugin.mjs";
|
|
2
|
+
import { DotenvParseOutput } from "@stryke/env/types";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/load.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves various dotenv configuration parameters from the context.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context to retrieve the dotenv configuration from.
|
|
10
|
+
* @param parsed - The parsed dotenv configuration.
|
|
11
|
+
* @returns An object containing the dotenv configuration.
|
|
12
|
+
*/
|
|
13
|
+
declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvParseOutput): {
|
|
14
|
+
APP_NAME: string | undefined;
|
|
15
|
+
APP_VERSION: string | undefined;
|
|
16
|
+
BUILD_ID: string;
|
|
17
|
+
BUILD_TIMESTAMP: string;
|
|
18
|
+
BUILD_CHECKSUM: string;
|
|
19
|
+
RELEASE_ID: string;
|
|
20
|
+
RELEASE_TAG: string;
|
|
21
|
+
DEFAULT_LOCALE: string | undefined;
|
|
22
|
+
DEFAULT_TIMEZONE: string | undefined;
|
|
23
|
+
LOG_LEVEL: "error" | "warn" | "info" | "debug" | null;
|
|
24
|
+
ERROR_URL: string | undefined;
|
|
25
|
+
ORGANIZATION: string | undefined;
|
|
26
|
+
PLATFORM: "node" | "browser" | "neutral";
|
|
27
|
+
MODE: "development" | "test" | "production";
|
|
28
|
+
TEST: boolean;
|
|
29
|
+
DEBUG: boolean;
|
|
30
|
+
STACKTRACE: boolean;
|
|
31
|
+
ENVIRONMENT: string;
|
|
32
|
+
};
|
|
33
|
+
declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { loadEnv, loadEnvFromContext };
|
|
36
|
+
//# sourceMappingURL=load.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.mts","names":[],"sources":["../../src/helpers/load.ts"],"sourcesContent":[],"mappings":";;;;;;;AAgGA;AAoDA;;;;AAEsC,iBAtDtB,kBAAA,CAsDsB,OAAA,EArD3B,gBAqD2B,EAAA,MAAA,EApD5B,iBAoD4B,CAAA,EAAA;EAA2B,QAAA,EAAA,MAAA,GAAA,SAAA;EAAR,WAAA,EAAA,MAAA,GAAA,SAAA;EAAO,QAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;iBAF1C,qBACP,oBAAoB,4BACxB,2BAA2B,mBAAmB,QAAQ"}
|
package/dist/helpers/load.mjs
CHANGED