@powerlines/plugin-env 0.14.20 → 0.14.22

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.
Files changed (135) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +37 -1
  2. package/dist/_virtual/rolldown_runtime.mjs +29 -1
  3. package/dist/babel/index.cjs +1 -1
  4. package/dist/babel/index.mjs +3 -1
  5. package/dist/babel/plugin.cjs +120 -4
  6. package/dist/babel/plugin.d.cts +2 -3
  7. package/dist/babel/plugin.d.mts +3 -2
  8. package/dist/babel/plugin.mjs +118 -4
  9. package/dist/components/docs.cjs +71 -1
  10. package/dist/components/docs.d.cts +3 -1
  11. package/dist/components/docs.mjs +70 -1
  12. package/dist/components/env.cjs +432 -11
  13. package/dist/components/env.d.cts +1 -0
  14. package/dist/components/env.mjs +430 -9
  15. package/dist/components/index.cjs +6 -1
  16. package/dist/components/index.mjs +4 -1
  17. package/dist/deepkit/schemas/reflection.cjs +3940 -1
  18. package/dist/deepkit/schemas/reflection.mjs +3938 -1
  19. package/dist/deepkit/schemas/reflection2.cjs +4112 -1
  20. package/dist/deepkit/schemas/reflection2.mjs +4110 -1
  21. package/dist/deepkit/src/capnp.cjs +913 -1
  22. package/dist/deepkit/src/capnp.mjs +911 -1
  23. package/dist/deepkit/src/esbuild-plugin.cjs +47 -4
  24. package/dist/deepkit/src/esbuild-plugin.mjs +46 -4
  25. package/dist/deepkit/src/reflect-type.cjs +22 -1
  26. package/dist/deepkit/src/reflect-type.mjs +20 -1
  27. package/dist/deepkit/src/resolve-reflections.cjs +16 -1
  28. package/dist/deepkit/src/resolve-reflections.mjs +15 -1
  29. package/dist/deepkit/src/transformer.cjs +52 -1
  30. package/dist/deepkit/src/transformer.mjs +49 -1
  31. package/dist/deepkit/src/transpile.cjs +29 -1
  32. package/dist/deepkit/src/transpile.mjs +27 -1
  33. package/dist/deepkit/src/utilities.cjs +66 -1
  34. package/dist/deepkit/src/utilities.mjs +65 -1
  35. package/dist/deepkit/src/vendor/type-compiler/index.cjs +38 -1
  36. package/dist/deepkit/src/vendor/type-compiler/index.mjs +19 -1
  37. package/dist/deepkit/src/vendor/type.cjs +20 -1
  38. package/dist/deepkit/src/vendor/type.mjs +11 -1
  39. package/dist/helpers/automd-generator.cjs +22 -1
  40. package/dist/helpers/automd-generator.mjs +21 -1
  41. package/dist/helpers/create-reflection-resource.cjs +55 -1
  42. package/dist/helpers/create-reflection-resource.d.cts +2 -1
  43. package/dist/helpers/create-reflection-resource.mjs +54 -1
  44. package/dist/helpers/index.cjs +6 -1
  45. package/dist/helpers/index.mjs +8 -1
  46. package/dist/helpers/load.cjs +83 -1
  47. package/dist/helpers/load.d.cts +2 -2
  48. package/dist/helpers/load.d.mts +3 -2
  49. package/dist/helpers/load.mjs +80 -1
  50. package/dist/helpers/persistence.cjs +214 -1
  51. package/dist/helpers/persistence.d.cts +1 -1
  52. package/dist/helpers/persistence.d.mts +1 -1
  53. package/dist/helpers/persistence.mjs +202 -1
  54. package/dist/helpers/reflect.cjs +111 -1
  55. package/dist/helpers/reflect.mjs +103 -1
  56. package/dist/helpers/source-file-env.cjs +28 -1
  57. package/dist/helpers/source-file-env.mjs +26 -1
  58. package/dist/helpers/template-helpers.cjs +42 -1
  59. package/dist/helpers/template-helpers.mjs +41 -1
  60. package/dist/index.cjs +203 -5
  61. package/dist/index.d.cts +1 -3
  62. package/dist/index.d.mts +2 -1
  63. package/dist/index.mjs +170 -5
  64. package/dist/plugin-alloy/src/core/components/output.cjs +45 -1
  65. package/dist/plugin-alloy/src/core/components/output.mjs +44 -1
  66. package/dist/plugin-alloy/src/core/contexts/context.cjs +11 -1
  67. package/dist/plugin-alloy/src/core/contexts/context.mjs +10 -1
  68. package/dist/plugin-alloy/src/index.cjs +93 -2
  69. package/dist/plugin-alloy/src/index.mjs +91 -2
  70. package/dist/plugin-alloy/src/types/components.d.mts +1 -1
  71. package/dist/plugin-alloy/src/types/plugin.d.cts +3 -2
  72. package/dist/plugin-alloy/src/types/plugin.d.mts +5 -5
  73. package/dist/plugin-automd/src/index.cjs +101 -1
  74. package/dist/plugin-automd/src/index.mjs +98 -1
  75. package/dist/plugin-automd/src/types/plugin.d.mts +2 -2
  76. package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -1
  77. package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -1
  78. package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -1
  79. package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -1
  80. package/dist/plugin-babel/src/helpers/filters.cjs +23 -1
  81. package/dist/plugin-babel/src/helpers/filters.mjs +21 -1
  82. package/dist/plugin-babel/src/helpers/index.cjs +5 -1
  83. package/dist/plugin-babel/src/helpers/index.mjs +7 -1
  84. package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -1
  85. package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -1
  86. package/dist/plugin-babel/src/helpers/options.cjs +50 -1
  87. package/dist/plugin-babel/src/helpers/options.mjs +47 -1
  88. package/dist/plugin-babel/src/index.cjs +91 -1
  89. package/dist/plugin-babel/src/index.mjs +89 -1
  90. package/dist/plugin-babel/src/types/plugin.d.cts +2 -2
  91. package/dist/plugin-babel/src/types/plugin.d.mts +2 -2
  92. package/dist/powerlines/schemas/fs.d.mts +1 -0
  93. package/dist/powerlines/src/api.d.mts +7 -0
  94. package/dist/powerlines/src/index.d.mts +12 -0
  95. package/dist/powerlines/src/internal/helpers/hooks.d.mts +5 -0
  96. package/dist/powerlines/src/lib/build/esbuild.cjs +102 -14
  97. package/dist/powerlines/src/lib/build/esbuild.mjs +100 -14
  98. package/dist/powerlines/src/lib/entry.cjs +12 -1
  99. package/dist/powerlines/src/lib/entry.mjs +14 -1
  100. package/dist/powerlines/src/lib/logger.cjs +41 -1
  101. package/dist/powerlines/src/lib/logger.mjs +39 -1
  102. package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -1
  103. package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -1
  104. package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -1
  105. package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -1
  106. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -1
  107. package/dist/powerlines/src/plugin-utils/paths.mjs +3 -1
  108. package/dist/powerlines/src/types/api.d.mts +5 -0
  109. package/dist/powerlines/src/types/babel.d.cts +3 -2
  110. package/dist/powerlines/src/types/babel.d.mts +3 -2
  111. package/dist/powerlines/src/types/commands.d.cts +1 -1
  112. package/dist/powerlines/src/types/commands.d.mts +2 -2
  113. package/dist/powerlines/src/types/config.d.cts +5 -5
  114. package/dist/powerlines/src/types/config.d.mts +7 -7
  115. package/dist/powerlines/src/types/context.d.cts +44 -3
  116. package/dist/powerlines/src/types/context.d.mts +46 -5
  117. package/dist/powerlines/src/types/fs.d.cts +15 -1
  118. package/dist/powerlines/src/types/fs.d.mts +15 -1
  119. package/dist/powerlines/src/types/index.d.mts +12 -0
  120. package/dist/powerlines/src/types/plugin.d.cts +3 -3
  121. package/dist/powerlines/src/types/plugin.d.mts +4 -4
  122. package/dist/powerlines/src/types/resolved.d.cts +1 -1
  123. package/dist/powerlines/src/types/resolved.d.mts +2 -2
  124. package/dist/powerlines/src/types/tsconfig.d.mts +1 -1
  125. package/dist/powerlines/src/types/unplugin.d.mts +7 -0
  126. package/dist/types/index.mjs +1 -1
  127. package/dist/types/plugin.d.cts +1 -0
  128. package/dist/types/plugin.mjs +1 -1
  129. package/dist/types/runtime.mjs +1 -1
  130. package/package.json +15 -15
  131. package/dist/babel/index.d.cts +0 -1
  132. package/dist/helpers/index.d.cts +0 -6
  133. package/dist/plugin-alloy/src/vendor/index.cjs +0 -1
  134. package/dist/plugin-alloy/src/vendor/index.d.mts +0 -7
  135. package/dist/plugin-alloy/src/vendor/index.mjs +0 -1
@@ -1 +1,37 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(e,n,r,i)=>{i&&(t(e,Symbol.toStringTag,{value:`Module`}),r&&t(r,Symbol.toStringTag,{value:`Module`})),o(e,n,`default`),r&&o(r,n,`default`)},c=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__reExport=s,exports.__toESM=c;
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __reExport = (target, mod, secondTarget, symbols) => {
23
+ if (symbols) {
24
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
25
+ secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
26
+ }
27
+ __copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
28
+ };
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+
34
+ //#endregion
35
+
36
+ exports.__reExport = __reExport;
37
+ exports.__toESM = __toESM;
@@ -1 +1,29 @@
1
- var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},a=(t,n,r,a)=>{a&&(e(t,Symbol.toStringTag,{value:`Module`}),r&&e(r,Symbol.toStringTag,{value:`Module`})),i(t,n,`default`),r&&i(r,n,`default`)};export{a as __reExport};
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
9
+ key = keys[i];
10
+ if (!__hasOwnProp.call(to, key) && key !== except) {
11
+ __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ }
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget, symbols) => {
21
+ if (symbols) {
22
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
23
+ secondTarget && __defProp(secondTarget, Symbol.toStringTag, { value: "Module" });
24
+ }
25
+ __copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default");
26
+ };
27
+
28
+ //#endregion
29
+ export { __reExport };
@@ -1 +1 @@
1
- const e=require(`./plugin.cjs`);
1
+ const require_plugin = require('./plugin.cjs');
@@ -1 +1,3 @@
1
- import{envBabelPlugin as e}from"./plugin.mjs";export{};
1
+ import { envBabelPlugin } from "./plugin.mjs";
2
+
3
+ export { };
@@ -1,5 +1,121 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../plugin-babel/src/helpers/create-plugin.cjs`),r=require(`../plugin-babel/src/helpers/module-helpers.cjs`),i=require(`../deepkit/src/capnp.cjs`),a=require(`../deepkit/schemas/reflection2.cjs`),o=require(`../deepkit/src/utilities.cjs`),s=require(`../helpers/persistence.cjs`);let c=require(`@storm-software/config-tools/types`),l=require(`@stryke/capnp`);l=e.__toESM(l);let u=require(`@stryke/fs/buffer`),d=require(`node:fs`);const f=n.createBabelPlugin(`env`,({log:e,context:n})=>{function f(t,r,i=!1){let a=n.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(t.name){let s=n.config.env.prefix.find(e=>t.name&&t.name.startsWith(e)&&(n.env.types.env?.hasProperty(t.name.replace(`${e}_`,``))||a.some(n=>n.getAlias().includes(t.name.replace(`${e}_`,``))))),l=t.name;if(s&&(l=t.name.replace(`${s}_`,``)),e(c.LogLevelLabel.TRACE,`Environment variable ${l} found in ${r.filename||`unknown file`}.`),n.env.types.env?.hasProperty(l)||a.some(e=>e.getAlias().includes(l))){let e=n.env.types.env.hasProperty(l)?n.env.types.env.getProperty(l):a.find(e=>e.getAlias().includes(l));if(!e||e.isIgnored())return;if(n.env.used.env.hasProperty(l)||n.env.used.env.addProperty(e.property),n.config.env.inject&&i){let t=n.env.parsed?.[l];if(t===void 0){let e=n.config.env.prefix.find(e=>n.env.parsed[`${e.replace(/_$/g,``)}_${l}`]);e&&(t=n.env.parsed[`${e.replace(/_$/g,``)}_${l}`])}if(t??=e.getDefaultValue(),e.isValueRequired()&&t===void 0)throw Error(`Environment variable \`${l}\` is not defined in the .env configuration files`);return o.stringifyDefaultValue(e,t)}}else throw Error(`The "${l}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${r.filename?r.filename:`unknown`}.
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_type = require('../deepkit/src/vendor/type.cjs');
3
+ const require_create_plugin = require('../plugin-babel/src/helpers/create-plugin.cjs');
4
+ const require_module_helpers = require('../plugin-babel/src/helpers/module-helpers.cjs');
5
+ const require_capnp = require('../deepkit/src/capnp.cjs');
6
+ const require_reflection = require('../deepkit/schemas/reflection2.cjs');
7
+ const require_utilities = require('../deepkit/src/utilities.cjs');
8
+ const require_persistence = require('../helpers/persistence.cjs');
9
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
10
+ let __stryke_capnp = require("@stryke/capnp");
11
+ __stryke_capnp = require_rolldown_runtime.__toESM(__stryke_capnp);
12
+ let __stryke_fs_buffer = require("@stryke/fs/buffer");
13
+ let node_fs = require("node:fs");
2
14
 
3
- The following environment configuration names are defined in the \`env\` type definition: \n${n.env.types.env?.getPropertyNames().sort((e,t)=>String(e).localeCompare(String(t))).map(e=>` - ${String(e)} ${a.some(t=>t.getNameAsString()===String(e)&&t.getAlias().length>0)?`(Alias: ${a?.find(t=>t.getNameAsString()===String(e))?.getAlias().join(`, `)})`:``}`).join(`
4
- `)} \n\nUsing the following env prefix: \n${n.config.env.prefix.map(e=>` - ${e}`).join(`
5
- `)} \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`)}}return{visitor:{MemberExpression(e,t){if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`$storm`})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),r.addImport(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isCallExpression({callee:{name:`useStorm`,type:`Identifier`}})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),r.addImport(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`process`})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;if(!n.name)return;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),r.addImport(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isMetaProperty()&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;if(!n.name)return;f(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),r.addImport(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){e(c.LogLevelLabel.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let r=t.type_exports.ReflectionClass.from({kind:t.type_exports.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),o=s.getEnvReflectionsPath(n,`env`);o&&(0,d.existsSync)(o)&&(e(c.LogLevelLabel.TRACE,`Environment reflection file found at ${o}, reading existing reflection.`),r=(0,t.type_exports.resolveClassType)((0,t.type_exports.deserializeType)(i.convertFromCapnp(new l.Message((0,u.readFileBufferSync)(o),!1).getRoot(a.SerializedTypes).types)))),e(c.LogLevelLabel.TRACE,`Adding new variables to env reflection at ${o}.`),r.getProperties().filter(e=>e.getNameAsString()&&!n.env.used.env.hasProperty(e.getNameAsString())).forEach(e=>{n.env.used.env.addProperty({...e,name:e.getNameAsString(),description:e.getDescription()??`The ${e.getNameAsString()} variable.`,default:e.getDefaultValue(),optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,visibility:e.getVisibility(),type:e.getType(),tags:e.getTags()})})}}});exports.envBabelPlugin=f;
15
+ //#region src/babel/plugin.ts
16
+ const envBabelPlugin = require_create_plugin.createBabelPlugin("env", ({ log, context }) => {
17
+ function extractEnv(node, pass, isInjectable = false) {
18
+ const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0);
19
+ if (node.name) {
20
+ const prefix = context.config.env.prefix.find((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")))));
21
+ let name = node.name;
22
+ if (prefix) name = node.name.replace(`${prefix}_`, "");
23
+ log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
24
+ if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name))) {
25
+ const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find((prop) => prop.getAlias().includes(name));
26
+ if (!envProperty || envProperty.isIgnored()) return;
27
+ if (!context.env.used.env.hasProperty(name)) context.env.used.env.addProperty(envProperty.property);
28
+ if (context.config.env.inject && isInjectable) {
29
+ let value = context.env.parsed?.[name];
30
+ if (value === void 0) {
31
+ const prefix$1 = context.config.env.prefix.find((pre) => {
32
+ return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
33
+ });
34
+ if (prefix$1) value = context.env.parsed[`${prefix$1.replace(/_$/g, "")}_${name}`];
35
+ }
36
+ value ??= envProperty.getDefaultValue();
37
+ if (envProperty.isValueRequired() && value === void 0) throw new Error(`Environment variable \`${name}\` is not defined in the .env configuration files`);
38
+ return require_utilities.stringifyDefaultValue(envProperty, value);
39
+ }
40
+ } else throw new Error(`The "${name}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${pass.filename ? pass.filename : "unknown"}.
41
+
42
+ The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort((a, b) => String(a).localeCompare(String(b))).map((typeDef) => ` - ${String(typeDef)} ${envTypesAliasProperties.some((prop) => prop.getNameAsString() === String(typeDef) && prop.getAlias().length > 0) ? `(Alias: ${envTypesAliasProperties?.find((prop) => prop.getNameAsString() === String(typeDef))?.getAlias().join(", ")})` : ""}`).join("\n")} \n\nUsing the following env prefix: \n${context.config.env.prefix.map((prefix$1) => ` - ${prefix$1}`).join("\n")} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`);
43
+ }
44
+ }
45
+ return {
46
+ visitor: { MemberExpression(path, pass) {
47
+ if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "$storm" }) && path.get("property")?.isIdentifier()) {
48
+ const identifier = path.get("property")?.node;
49
+ extractEnv(identifier, pass, false);
50
+ path.replaceWithSourceString(`env.${identifier.name}`);
51
+ require_module_helpers.addImport(path, {
52
+ module: "storm:env",
53
+ name: "env",
54
+ imported: "env"
55
+ });
56
+ } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isCallExpression({ callee: {
57
+ name: "useStorm",
58
+ type: "Identifier"
59
+ } }) && path.get("property")?.isIdentifier()) {
60
+ const identifier = path.get("property")?.node;
61
+ extractEnv(identifier, pass, false);
62
+ path.replaceWithSourceString(`env.${identifier.name}`);
63
+ require_module_helpers.addImport(path, {
64
+ module: "storm:env",
65
+ name: "env",
66
+ imported: "env"
67
+ });
68
+ } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
69
+ const identifier = path.get("property")?.node;
70
+ if (!identifier.name) return;
71
+ extractEnv(identifier, pass, false);
72
+ path.replaceWithSourceString(`env.${identifier.name}`);
73
+ require_module_helpers.addImport(path, {
74
+ module: "storm:env",
75
+ name: "env",
76
+ imported: "env"
77
+ });
78
+ } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isMetaProperty() && path.get("property")?.isIdentifier()) {
79
+ const identifier = path.get("property")?.node;
80
+ if (!identifier.name) return;
81
+ extractEnv(identifier, pass, false);
82
+ path.replaceWithSourceString(`env.${identifier.name}`);
83
+ require_module_helpers.addImport(path, {
84
+ module: "storm:env",
85
+ name: "env",
86
+ imported: "env"
87
+ });
88
+ }
89
+ } },
90
+ post() {
91
+ log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Adding environment variables from ${this.filename || "unknown file"} to env.json.`);
92
+ let persistedEnv = require_type.type_exports.ReflectionClass.from({
93
+ kind: require_type.type_exports.ReflectionKind.objectLiteral,
94
+ description: `An object containing the environment variables used by the application.`,
95
+ types: []
96
+ });
97
+ const reflectionPath = require_persistence.getEnvReflectionsPath(context, "env");
98
+ if (reflectionPath && (0, node_fs.existsSync)(reflectionPath)) {
99
+ log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment reflection file found at ${reflectionPath}, reading existing reflection.`);
100
+ persistedEnv = (0, require_type.type_exports.resolveClassType)((0, require_type.type_exports.deserializeType)(require_capnp.convertFromCapnp(new __stryke_capnp.Message((0, __stryke_fs_buffer.readFileBufferSync)(reflectionPath), false).getRoot(require_reflection.SerializedTypes).types)));
101
+ }
102
+ log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Adding new variables to env reflection at ${reflectionPath}.`);
103
+ persistedEnv.getProperties().filter((property) => property.getNameAsString() && !context.env.used.env.hasProperty(property.getNameAsString())).forEach((property) => {
104
+ context.env.used.env.addProperty({
105
+ ...property,
106
+ name: property.getNameAsString(),
107
+ description: property.getDescription() ?? `The ${property.getNameAsString()} variable.`,
108
+ default: property.getDefaultValue(),
109
+ optional: property.isOptional() ? true : void 0,
110
+ readonly: property.isReadonly() ? true : void 0,
111
+ visibility: property.getVisibility(),
112
+ type: property.getType(),
113
+ tags: property.getTags()
114
+ });
115
+ });
116
+ }
117
+ };
118
+ });
119
+
120
+ //#endregion
121
+ exports.envBabelPlugin = envBabelPlugin;
@@ -1,8 +1,7 @@
1
+ import { DeclareBabelTransformPluginReturn } from "../powerlines/src/types/babel.cjs";
1
2
  import { EnvPluginContext, EnvPluginResolvedConfig } from "../types/plugin.cjs";
2
- import "../index.cjs";
3
- import * as powerlines0 from "powerlines";
4
3
 
5
4
  //#region src/babel/plugin.d.ts
6
- declare const envBabelPlugin: powerlines0.DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, Record<string, any>>;
5
+ declare const envBabelPlugin: DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, Record<string, any>>;
7
6
  //#endregion
8
7
  export { envBabelPlugin };
@@ -1,8 +1,9 @@
1
+ import { DeclareBabelTransformPluginReturn } from "../powerlines/src/types/babel.mjs";
2
+ import "../powerlines/src/index.mjs";
1
3
  import { EnvPluginContext, EnvPluginResolvedConfig } from "../types/plugin.mjs";
2
4
  import "../index.mjs";
3
- import * as powerlines0 from "powerlines";
4
5
 
5
6
  //#region src/babel/plugin.d.ts
6
- declare const envBabelPlugin: powerlines0.DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, Record<string, any>>;
7
+ declare const envBabelPlugin: DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, Record<string, any>>;
7
8
  //#endregion
8
9
  export { envBabelPlugin };
@@ -1,5 +1,119 @@
1
- import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{createBabelPlugin as t}from"../plugin-babel/src/helpers/create-plugin.mjs";import{addImport as n}from"../plugin-babel/src/helpers/module-helpers.mjs";import{convertFromCapnp as r}from"../deepkit/src/capnp.mjs";import{SerializedTypes as i}from"../deepkit/schemas/reflection2.mjs";import{stringifyDefaultValue as a}from"../deepkit/src/utilities.mjs";import{getEnvReflectionsPath as o}from"../helpers/persistence.mjs";import{LogLevelLabel as s}from"@storm-software/config-tools/types";import*as c from"@stryke/capnp";import{readFileBufferSync as l}from"@stryke/fs/buffer";import{existsSync as u}from"node:fs";const d=t(`env`,({log:t,context:d})=>{function f(e,n,r=!1){let i=d.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(e.name){let o=d.config.env.prefix.find(t=>e.name&&e.name.startsWith(t)&&(d.env.types.env?.hasProperty(e.name.replace(`${t}_`,``))||i.some(n=>n.getAlias().includes(e.name.replace(`${t}_`,``))))),c=e.name;if(o&&(c=e.name.replace(`${o}_`,``)),t(s.TRACE,`Environment variable ${c} found in ${n.filename||`unknown file`}.`),d.env.types.env?.hasProperty(c)||i.some(e=>e.getAlias().includes(c))){let e=d.env.types.env.hasProperty(c)?d.env.types.env.getProperty(c):i.find(e=>e.getAlias().includes(c));if(!e||e.isIgnored())return;if(d.env.used.env.hasProperty(c)||d.env.used.env.addProperty(e.property),d.config.env.inject&&r){let t=d.env.parsed?.[c];if(t===void 0){let e=d.config.env.prefix.find(e=>d.env.parsed[`${e.replace(/_$/g,``)}_${c}`]);e&&(t=d.env.parsed[`${e.replace(/_$/g,``)}_${c}`])}if(t??=e.getDefaultValue(),e.isValueRequired()&&t===void 0)throw Error(`Environment variable \`${c}\` is not defined in the .env configuration files`);return a(e,t)}}else throw Error(`The "${c}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${n.filename?n.filename:`unknown`}.
1
+ import { type_exports } from "../deepkit/src/vendor/type.mjs";
2
+ import { createBabelPlugin } from "../plugin-babel/src/helpers/create-plugin.mjs";
3
+ import { addImport } from "../plugin-babel/src/helpers/module-helpers.mjs";
4
+ import { convertFromCapnp } from "../deepkit/src/capnp.mjs";
5
+ import { SerializedTypes } from "../deepkit/schemas/reflection2.mjs";
6
+ import { stringifyDefaultValue } from "../deepkit/src/utilities.mjs";
7
+ import { getEnvReflectionsPath } from "../helpers/persistence.mjs";
8
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
9
+ import * as capnp from "@stryke/capnp";
10
+ import { readFileBufferSync } from "@stryke/fs/buffer";
11
+ import { existsSync } from "node:fs";
2
12
 
3
- The following environment configuration names are defined in the \`env\` type definition: \n${d.env.types.env?.getPropertyNames().sort((e,t)=>String(e).localeCompare(String(t))).map(e=>` - ${String(e)} ${i.some(t=>t.getNameAsString()===String(e)&&t.getAlias().length>0)?`(Alias: ${i?.find(t=>t.getNameAsString()===String(e))?.getAlias().join(`, `)})`:``}`).join(`
4
- `)} \n\nUsing the following env prefix: \n${d.config.env.prefix.map(e=>` - ${e}`).join(`
5
- `)} \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`)}}return{visitor:{MemberExpression(e,t){if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`$storm`})&&e.get(`property`)?.isIdentifier()){let r=e.get(`property`)?.node;f(r,t,!1),e.replaceWithSourceString(`env.${r.name}`),n(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isCallExpression({callee:{name:`useStorm`,type:`Identifier`}})&&e.get(`property`)?.isIdentifier()){let r=e.get(`property`)?.node;f(r,t,!1),e.replaceWithSourceString(`env.${r.name}`),n(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`process`})&&e.get(`property`)?.isIdentifier()){let r=e.get(`property`)?.node;if(!r.name)return;f(r,t,!1),e.replaceWithSourceString(`env.${r.name}`),n(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isMetaProperty()&&e.get(`property`)?.isIdentifier()){let r=e.get(`property`)?.node;if(!r.name)return;f(r,t,!1),e.replaceWithSourceString(`env.${r.name}`),n(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){t(s.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let n=e.ReflectionClass.from({kind:e.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),a=o(d,`env`);a&&u(a)&&(t(s.TRACE,`Environment reflection file found at ${a}, reading existing reflection.`),n=(0,e.resolveClassType)((0,e.deserializeType)(r(new c.Message(l(a),!1).getRoot(i).types)))),t(s.TRACE,`Adding new variables to env reflection at ${a}.`),n.getProperties().filter(e=>e.getNameAsString()&&!d.env.used.env.hasProperty(e.getNameAsString())).forEach(e=>{d.env.used.env.addProperty({...e,name:e.getNameAsString(),description:e.getDescription()??`The ${e.getNameAsString()} variable.`,default:e.getDefaultValue(),optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,visibility:e.getVisibility(),type:e.getType(),tags:e.getTags()})})}}});export{d as envBabelPlugin};
13
+ //#region src/babel/plugin.ts
14
+ const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
15
+ function extractEnv(node, pass, isInjectable = false) {
16
+ const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0);
17
+ if (node.name) {
18
+ const prefix = context.config.env.prefix.find((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")))));
19
+ let name = node.name;
20
+ if (prefix) name = node.name.replace(`${prefix}_`, "");
21
+ log(LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
22
+ if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name))) {
23
+ const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find((prop) => prop.getAlias().includes(name));
24
+ if (!envProperty || envProperty.isIgnored()) return;
25
+ if (!context.env.used.env.hasProperty(name)) context.env.used.env.addProperty(envProperty.property);
26
+ if (context.config.env.inject && isInjectable) {
27
+ let value = context.env.parsed?.[name];
28
+ if (value === void 0) {
29
+ const prefix$1 = context.config.env.prefix.find((pre) => {
30
+ return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
31
+ });
32
+ if (prefix$1) value = context.env.parsed[`${prefix$1.replace(/_$/g, "")}_${name}`];
33
+ }
34
+ value ??= envProperty.getDefaultValue();
35
+ if (envProperty.isValueRequired() && value === void 0) throw new Error(`Environment variable \`${name}\` is not defined in the .env configuration files`);
36
+ return stringifyDefaultValue(envProperty, value);
37
+ }
38
+ } else throw new Error(`The "${name}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${pass.filename ? pass.filename : "unknown"}.
39
+
40
+ The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort((a, b) => String(a).localeCompare(String(b))).map((typeDef) => ` - ${String(typeDef)} ${envTypesAliasProperties.some((prop) => prop.getNameAsString() === String(typeDef) && prop.getAlias().length > 0) ? `(Alias: ${envTypesAliasProperties?.find((prop) => prop.getNameAsString() === String(typeDef))?.getAlias().join(", ")})` : ""}`).join("\n")} \n\nUsing the following env prefix: \n${context.config.env.prefix.map((prefix$1) => ` - ${prefix$1}`).join("\n")} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`);
41
+ }
42
+ }
43
+ return {
44
+ visitor: { MemberExpression(path, pass) {
45
+ if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "$storm" }) && path.get("property")?.isIdentifier()) {
46
+ const identifier = path.get("property")?.node;
47
+ extractEnv(identifier, pass, false);
48
+ path.replaceWithSourceString(`env.${identifier.name}`);
49
+ addImport(path, {
50
+ module: "storm:env",
51
+ name: "env",
52
+ imported: "env"
53
+ });
54
+ } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isCallExpression({ callee: {
55
+ name: "useStorm",
56
+ type: "Identifier"
57
+ } }) && path.get("property")?.isIdentifier()) {
58
+ const identifier = path.get("property")?.node;
59
+ extractEnv(identifier, pass, false);
60
+ path.replaceWithSourceString(`env.${identifier.name}`);
61
+ addImport(path, {
62
+ module: "storm:env",
63
+ name: "env",
64
+ imported: "env"
65
+ });
66
+ } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
67
+ const identifier = path.get("property")?.node;
68
+ if (!identifier.name) return;
69
+ extractEnv(identifier, pass, false);
70
+ path.replaceWithSourceString(`env.${identifier.name}`);
71
+ addImport(path, {
72
+ module: "storm:env",
73
+ name: "env",
74
+ imported: "env"
75
+ });
76
+ } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isMetaProperty() && path.get("property")?.isIdentifier()) {
77
+ const identifier = path.get("property")?.node;
78
+ if (!identifier.name) return;
79
+ extractEnv(identifier, pass, false);
80
+ path.replaceWithSourceString(`env.${identifier.name}`);
81
+ addImport(path, {
82
+ module: "storm:env",
83
+ name: "env",
84
+ imported: "env"
85
+ });
86
+ }
87
+ } },
88
+ post() {
89
+ log(LogLevelLabel.TRACE, `Adding environment variables from ${this.filename || "unknown file"} to env.json.`);
90
+ let persistedEnv = type_exports.ReflectionClass.from({
91
+ kind: type_exports.ReflectionKind.objectLiteral,
92
+ description: `An object containing the environment variables used by the application.`,
93
+ types: []
94
+ });
95
+ const reflectionPath = getEnvReflectionsPath(context, "env");
96
+ if (reflectionPath && existsSync(reflectionPath)) {
97
+ log(LogLevelLabel.TRACE, `Environment reflection file found at ${reflectionPath}, reading existing reflection.`);
98
+ persistedEnv = (0, type_exports.resolveClassType)((0, type_exports.deserializeType)(convertFromCapnp(new capnp.Message(readFileBufferSync(reflectionPath), false).getRoot(SerializedTypes).types)));
99
+ }
100
+ log(LogLevelLabel.TRACE, `Adding new variables to env reflection at ${reflectionPath}.`);
101
+ persistedEnv.getProperties().filter((property) => property.getNameAsString() && !context.env.used.env.hasProperty(property.getNameAsString())).forEach((property) => {
102
+ context.env.used.env.addProperty({
103
+ ...property,
104
+ name: property.getNameAsString(),
105
+ description: property.getDescription() ?? `The ${property.getNameAsString()} variable.`,
106
+ default: property.getDefaultValue(),
107
+ optional: property.isOptional() ? true : void 0,
108
+ readonly: property.isReadonly() ? true : void 0,
109
+ visibility: property.getVisibility(),
110
+ type: property.getType(),
111
+ tags: property.getTags()
112
+ });
113
+ });
114
+ }
115
+ };
116
+ });
117
+
118
+ //#endregion
119
+ export { envBabelPlugin };
@@ -1 +1,71 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../helpers/create-reflection-resource.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/core`),a=require(`@stryke/path/join`),o=require(`@powerlines/alloy/core/contexts/context`),s=require(`@alloy-js/markdown`),c=require(`@powerlines/alloy/markdown/components/markdown-file`),l=require(`@powerlines/alloy/markdown/components/markdown-table`);function u(){let e=(0,o.usePowerlines)();if(!e)return null;let u=n.createReflectionResource(e);return(0,r.createComponent)(c.MarkdownFile,{get path(){return(0,a.joinPaths)(e.config.projectRoot,`docs`,`generated`,`env.md`)},get children(){return[(0,r.createComponent)(s.Heading,{level:1,children:`Environment Configuration`}),i.code`Below is a list of environment variables used by the`,(0,r.createComponent)(i.Show,{get when(){return!!e?.packageJson.name},get children(){return(0,r.createComponent)(s.Link,{get href(){return`https://www.npmjs.com/package/${e?.packageJson.name}`},get title(){return e.packageJson.name}})}}),i.code`package. These values can be updated in the \`.env\` file in the root of the project.`,(0,r.createIntrinsic)(`hbr`,{}),(0,r.createComponent)(s.Heading,{level:2,children:`Environment Variables`}),i.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.`,(0,r.createIntrinsic)(`hbr`,{}),(0,r.createComponent)(l.MarkdownTable,{get data(){return u.data?.getProperties().filter(e=>e.getNameAsString()!==`__STORM_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(e=>({name:e.getNameAsString().trim(),description:(e.getDescription()??``).trim(),type:(0,t.type_exports.stringifyType)(e.getType()).trim().replaceAll(` | `,`, or `),defaultValue:e.hasDefault()?String(e.getDefaultValue())?.includes(`"`)?e.getDefaultValue():`\`${e.getDefaultValue()}\``:``,required:e.isValueRequired()?``:`✔`}))??[]}})]}})}exports.EnvDocs=u;
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_type = require('../deepkit/src/vendor/type.cjs');
3
+ const require_create_reflection_resource = require('../helpers/create-reflection-resource.cjs');
4
+ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
+ let __alloy_js_core = require("@alloy-js/core");
6
+ let __stryke_path_join = require("@stryke/path/join");
7
+ let __powerlines_alloy_core_contexts_context = require("@powerlines/alloy/core/contexts/context");
8
+ let __alloy_js_markdown = require("@alloy-js/markdown");
9
+ let __powerlines_alloy_markdown_components_markdown_file = require("@powerlines/alloy/markdown/components/markdown-file");
10
+ let __powerlines_alloy_markdown_components_markdown_table = require("@powerlines/alloy/markdown/components/markdown-table");
11
+
12
+ //#region src/components/docs.tsx
13
+ /**
14
+ * Generates the environment configuration markdown documentation for the Powerlines project.
15
+ */
16
+ function EnvDocs() {
17
+ const context = (0, __powerlines_alloy_core_contexts_context.usePowerlines)();
18
+ if (!context) return null;
19
+ const reflection = require_create_reflection_resource.createReflectionResource(context);
20
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_markdown_components_markdown_file.MarkdownFile, {
21
+ get path() {
22
+ return (0, __stryke_path_join.joinPaths)(context.config.projectRoot, "docs", "generated", "env.md");
23
+ },
24
+ get children() {
25
+ return [
26
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_markdown.Heading, {
27
+ level: 1,
28
+ children: "Environment Configuration"
29
+ }),
30
+ __alloy_js_core.code`Below is a list of environment variables used by the`,
31
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
32
+ get when() {
33
+ return !!context?.packageJson.name;
34
+ },
35
+ get children() {
36
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_markdown.Link, {
37
+ get href() {
38
+ return `https://www.npmjs.com/package/${context?.packageJson.name}`;
39
+ },
40
+ get title() {
41
+ return context.packageJson.name;
42
+ }
43
+ });
44
+ }
45
+ }),
46
+ __alloy_js_core.code`package. These values can be updated in the \`.env\` file in the root of the project.`,
47
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
48
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_markdown.Heading, {
49
+ level: 2,
50
+ children: "Environment Variables"
51
+ }),
52
+ __alloy_js_core.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.`,
53
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
54
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_markdown_components_markdown_table.MarkdownTable, { get data() {
55
+ return reflection.data?.getProperties().filter((property) => property.getNameAsString() !== "__STORM_INJECTED__").sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())).map((reflectionProperty) => {
56
+ return {
57
+ name: reflectionProperty.getNameAsString().trim(),
58
+ description: (reflectionProperty.getDescription() ?? "").trim(),
59
+ type: (0, require_type.type_exports.stringifyType)(reflectionProperty.getType()).trim().replaceAll(" | ", ", or "),
60
+ defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
61
+ required: reflectionProperty.isValueRequired() ? "" : "✔"
62
+ };
63
+ }) ?? [];
64
+ } })
65
+ ];
66
+ }
67
+ });
68
+ }
69
+
70
+ //#endregion
71
+ exports.EnvDocs = EnvDocs;
@@ -1,7 +1,9 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+
1
3
  //#region src/components/docs.d.ts
2
4
  /**
3
5
  * Generates the environment configuration markdown documentation for the Powerlines project.
4
6
  */
5
- declare function EnvDocs(): void 0;
7
+ declare function EnvDocs(): _alloy_js_core0.Children;
6
8
  //#endregion
7
9
  export { EnvDocs };
@@ -1 +1,70 @@
1
- import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{createReflectionResource as t}from"../helpers/create-reflection-resource.mjs";import{createComponent as n,createIntrinsic as r}from"@alloy-js/core/jsx-runtime";import{Show as i,code as a}from"@alloy-js/core";import{joinPaths as o}from"@stryke/path/join";import{usePowerlines as s}from"@powerlines/alloy/core/contexts/context";import{Heading as c,Link as l}from"@alloy-js/markdown";import{MarkdownFile as u}from"@powerlines/alloy/markdown/components/markdown-file";import{MarkdownTable as d}from"@powerlines/alloy/markdown/components/markdown-table";function f(){let f=s();if(!f)return null;let p=t(f);return n(u,{get path(){return o(f.config.projectRoot,`docs`,`generated`,`env.md`)},get children(){return[n(c,{level:1,children:`Environment Configuration`}),a`Below is a list of environment variables used by the`,n(i,{get when(){return!!f?.packageJson.name},get children(){return n(l,{get href(){return`https://www.npmjs.com/package/${f?.packageJson.name}`},get title(){return f.packageJson.name}})}}),a`package. These values can be updated in the \`.env\` file in the root of the project.`,r(`hbr`,{}),n(c,{level:2,children:`Environment Variables`}),a`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.`,r(`hbr`,{}),n(d,{get data(){return p.data?.getProperties().filter(e=>e.getNameAsString()!==`__STORM_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(t=>({name:t.getNameAsString().trim(),description:(t.getDescription()??``).trim(),type:(0,e.stringifyType)(t.getType()).trim().replaceAll(` | `,`, or `),defaultValue:t.hasDefault()?String(t.getDefaultValue())?.includes(`"`)?t.getDefaultValue():`\`${t.getDefaultValue()}\``:``,required:t.isValueRequired()?``:`✔`}))??[]}})]}})}export{f as EnvDocs};
1
+ import { type_exports } from "../deepkit/src/vendor/type.mjs";
2
+ import { createReflectionResource } from "../helpers/create-reflection-resource.mjs";
3
+ import { createComponent, createIntrinsic } from "@alloy-js/core/jsx-runtime";
4
+ import { Show, code } from "@alloy-js/core";
5
+ import { joinPaths } from "@stryke/path/join";
6
+ import { usePowerlines } from "@powerlines/alloy/core/contexts/context";
7
+ import { Heading, Link } from "@alloy-js/markdown";
8
+ import { MarkdownFile } from "@powerlines/alloy/markdown/components/markdown-file";
9
+ import { MarkdownTable } from "@powerlines/alloy/markdown/components/markdown-table";
10
+
11
+ //#region src/components/docs.tsx
12
+ /**
13
+ * Generates the environment configuration markdown documentation for the Powerlines project.
14
+ */
15
+ function EnvDocs() {
16
+ const context = usePowerlines();
17
+ if (!context) return null;
18
+ const reflection = createReflectionResource(context);
19
+ return createComponent(MarkdownFile, {
20
+ get path() {
21
+ return joinPaths(context.config.projectRoot, "docs", "generated", "env.md");
22
+ },
23
+ get children() {
24
+ return [
25
+ createComponent(Heading, {
26
+ level: 1,
27
+ children: "Environment Configuration"
28
+ }),
29
+ code`Below is a list of environment variables used by the`,
30
+ createComponent(Show, {
31
+ get when() {
32
+ return !!context?.packageJson.name;
33
+ },
34
+ get children() {
35
+ return createComponent(Link, {
36
+ get href() {
37
+ return `https://www.npmjs.com/package/${context?.packageJson.name}`;
38
+ },
39
+ get title() {
40
+ return context.packageJson.name;
41
+ }
42
+ });
43
+ }
44
+ }),
45
+ code`package. These values can be updated in the \`.env\` file in the root of the project.`,
46
+ createIntrinsic("hbr", {}),
47
+ createComponent(Heading, {
48
+ level: 2,
49
+ children: "Environment Variables"
50
+ }),
51
+ 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.`,
52
+ createIntrinsic("hbr", {}),
53
+ createComponent(MarkdownTable, { get data() {
54
+ return reflection.data?.getProperties().filter((property) => property.getNameAsString() !== "__STORM_INJECTED__").sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())).map((reflectionProperty) => {
55
+ return {
56
+ name: reflectionProperty.getNameAsString().trim(),
57
+ description: (reflectionProperty.getDescription() ?? "").trim(),
58
+ type: (0, type_exports.stringifyType)(reflectionProperty.getType()).trim().replaceAll(" | ", ", or "),
59
+ defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
60
+ required: reflectionProperty.isValueRequired() ? "" : "✔"
61
+ };
62
+ }) ?? [];
63
+ } })
64
+ ];
65
+ }
66
+ });
67
+ }
68
+
69
+ //#endregion
70
+ export { EnvDocs };