@powerlines/plugin-env 0.16.66 → 0.16.68

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 (142) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +0 -2
  2. package/dist/_virtual/_rolldown/runtime.mjs +2 -31
  3. package/dist/babel/plugin.cjs +83 -11
  4. package/dist/babel/plugin.mjs +83 -11
  5. package/dist/babel/plugin.mjs.map +1 -1
  6. package/dist/components/env-builtin.cjs +1 -1
  7. package/dist/components/env-builtin.mjs +1 -1
  8. package/dist/helpers/automd-generator.cjs +14 -4
  9. package/dist/helpers/automd-generator.d.mts +1 -1
  10. package/dist/helpers/automd-generator.mjs +14 -4
  11. package/dist/helpers/automd-generator.mjs.map +1 -1
  12. package/dist/helpers/create-reflection-resource.cjs +8 -0
  13. package/dist/helpers/create-reflection-resource.mjs +9 -0
  14. package/dist/helpers/create-reflection-resource.mjs.map +1 -1
  15. package/dist/helpers/docs-helper.cjs +8 -0
  16. package/dist/helpers/docs-helper.mjs +8 -0
  17. package/dist/helpers/docs-helper.mjs.map +1 -1
  18. package/dist/helpers/index.cjs +1 -0
  19. package/dist/helpers/index.mjs +2 -2
  20. package/dist/helpers/load.cjs +61 -10
  21. package/dist/helpers/load.mjs +60 -9
  22. package/dist/helpers/load.mjs.map +1 -1
  23. package/dist/helpers/persistence.cjs +108 -1
  24. package/dist/helpers/persistence.mjs +108 -1
  25. package/dist/helpers/persistence.mjs.map +1 -1
  26. package/dist/helpers/reflect.cjs +156 -3
  27. package/dist/helpers/reflect.mjs +156 -4
  28. package/dist/helpers/reflect.mjs.map +1 -1
  29. package/dist/helpers/source-file-env.cjs +34 -4
  30. package/dist/helpers/source-file-env.mjs +34 -4
  31. package/dist/helpers/source-file-env.mjs.map +1 -1
  32. package/dist/helpers/template-helpers.cjs +33 -5
  33. package/dist/helpers/template-helpers.mjs +33 -5
  34. package/dist/helpers/template-helpers.mjs.map +1 -1
  35. package/dist/types/index.cjs +11 -0
  36. package/dist/types/index.mjs +4 -1
  37. package/dist/types/plugin.cjs +137 -0
  38. package/dist/types/plugin.d.mts +4 -4
  39. package/dist/types/plugin.mjs +132 -1
  40. package/dist/types/plugin.mjs.map +1 -0
  41. package/dist/types/runtime.cjs +244 -0
  42. package/dist/types/runtime.mjs +242 -1
  43. package/dist/types/runtime.mjs.map +1 -0
  44. package/package.json +11 -26
  45. package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.2/node_modules/c12/dist/index.cjs +0 -346
  46. package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.2/node_modules/c12/dist/index.mjs +0 -347
  47. package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.2/node_modules/c12/dist/index.mjs.map +0 -1
  48. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.cjs +0 -23
  49. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs +0 -23
  50. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs.map +0 -1
  51. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.cjs +0 -10
  52. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs +0 -11
  53. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs.map +0 -1
  54. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/js-yaml.cjs +0 -1060
  55. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/js-yaml.mjs +0 -1060
  56. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/js-yaml.mjs.map +0 -1
  57. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/json5.cjs +0 -761
  58. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/json5.mjs +0 -761
  59. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/json5.mjs.map +0 -1
  60. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.cjs +0 -388
  61. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs +0 -388
  62. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs.map +0 -1
  63. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/smol-toml.cjs +0 -639
  64. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/smol-toml.mjs +0 -639
  65. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/smol-toml.mjs.map +0 -1
  66. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.cjs +0 -17
  67. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs +0 -15
  68. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs.map +0 -1
  69. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/json5.cjs +0 -13
  70. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/json5.mjs +0 -14
  71. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/json5.mjs.map +0 -1
  72. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.cjs +0 -11
  73. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs +0 -12
  74. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs.map +0 -1
  75. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/toml.cjs +0 -11
  76. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/toml.mjs +0 -12
  77. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/toml.mjs.map +0 -1
  78. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/yaml.cjs +0 -11
  79. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/yaml.mjs +0 -12
  80. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/yaml.mjs.map +0 -1
  81. package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.cjs +0 -46
  82. package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs +0 -46
  83. package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs.map +0 -1
  84. package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.cjs +0 -285
  85. package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.mjs +0 -283
  86. package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.mjs.map +0 -1
  87. package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/package.cjs +0 -71
  88. package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/package.mjs +0 -69
  89. package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/package.mjs.map +0 -1
  90. package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.cjs +0 -1013
  91. package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs +0 -1008
  92. package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs.map +0 -1
  93. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.cjs +0 -23
  94. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs +0 -10
  95. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs.map +0 -1
  96. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.cjs +0 -2695
  97. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +0 -2682
  98. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs.map +0 -1
  99. package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs +0 -4457
  100. package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.mjs +0 -4455
  101. package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.mjs.map +0 -1
  102. package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti.cjs +0 -29
  103. package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti.mjs +0 -30
  104. package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti.mjs.map +0 -1
  105. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.cjs +0 -181
  106. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +0 -177
  107. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs.map +0 -1
  108. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.cjs +0 -22
  109. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs +0 -18
  110. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs.map +0 -1
  111. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.cjs +0 -3967
  112. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs +0 -3963
  113. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs.map +0 -1
  114. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.cjs +0 -11766
  115. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.mjs +0 -11762
  116. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.mjs.map +0 -1
  117. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.cjs +0 -25
  118. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.mjs +0 -21
  119. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.mjs.map +0 -1
  120. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/lib/index.cjs +0 -20
  121. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/lib/index.mjs +0 -18
  122. package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/lib/index.mjs.map +0 -1
  123. package/dist/node_modules/.pnpm/nypm@0.6.5/node_modules/nypm/dist/index.cjs +0 -178
  124. package/dist/node_modules/.pnpm/nypm@0.6.5/node_modules/nypm/dist/index.mjs +0 -176
  125. package/dist/node_modules/.pnpm/nypm@0.6.5/node_modules/nypm/dist/index.mjs.map +0 -1
  126. package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.cjs +0 -13
  127. package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.mjs +0 -13
  128. package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.mjs.map +0 -1
  129. package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/index.cjs +0 -3
  130. package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/index.mjs +0 -3
  131. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs +0 -145
  132. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -139
  133. package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs.map +0 -1
  134. package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.cjs +0 -128
  135. package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs +0 -127
  136. package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs.map +0 -1
  137. package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.cjs +0 -138
  138. package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs +0 -137
  139. package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs.map +0 -1
  140. package/dist/node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.cjs +0 -629
  141. package/dist/node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.mjs +0 -628
  142. package/dist/node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.mjs.map +0 -1
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9
8
  var __copyProps = (to, from, except, desc) => {
10
9
  if (from && typeof from === "object" || typeof from === "function") {
11
10
  for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
@@ -27,5 +26,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
26
 
28
27
  //#endregion
29
28
 
30
- exports.__commonJSMin = __commonJSMin;
31
29
  exports.__toESM = __toESM;
@@ -1,32 +1,3 @@
1
- import { createRequire } from "node:module";
1
+ import "node:module";
2
2
 
3
- //#region \0rolldown/runtime.js
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
- key = keys[i];
15
- if (!__hasOwnProp.call(to, key) && key !== except) {
16
- __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
20
- }
21
- }
22
- }
23
- return to;
24
- };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: true
28
- }) : target, mod));
29
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
30
-
31
- //#endregion
32
- export { __commonJSMin, __require, __toESM };
3
+ export { };
@@ -1,21 +1,48 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_types_plugin = require('../types/plugin.cjs');
4
+ let _powerlines_plugin_babel_types_config = require("@powerlines/plugin-babel/types/config");
5
+ let _babel_core = require("@babel/core");
3
6
  let _powerlines_deepkit_utilities = require("@powerlines/deepkit/utilities");
4
7
  let _powerlines_plugin_babel_helpers_create_plugin = require("@powerlines/plugin-babel/helpers/create-plugin");
5
8
  let _powerlines_plugin_babel_helpers_module_helpers = require("@powerlines/plugin-babel/helpers/module-helpers");
6
9
  let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
7
10
 
8
11
  //#region src/babel/plugin.ts
9
- const envBabelPlugin = (0, _powerlines_plugin_babel_helpers_create_plugin.createBabelPlugin)("env", ({ log, context }) => {
12
+ function __assignType(fn, args) {
13
+ fn.__type = args;
14
+ return fn;
15
+ }
16
+ const envBabelPlugin = (_powerlines_plugin_babel_helpers_create_plugin.createBabelPlugin.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_babel_helpers_create_plugin.createBabelPlugin)("env", __assignType(({ log, context }) => {
10
17
  function extractEnv(node, pass, isInjectable = false, isUsingBuiltin = false) {
11
- const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0);
18
+ const envTypesAliasProperties = context.env.types.env?.getProperties().filter(__assignType((prop) => prop.getAlias().length > 0, [
19
+ "prop",
20
+ "",
21
+ "P\"2!\"/\""
22
+ ]));
12
23
  if (node.name) {
13
- const prefix = context.config.env.prefix.find((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")))));
24
+ const prefix = context.config.env.prefix.find(__assignType((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some(__assignType((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")), [
25
+ "prop",
26
+ "",
27
+ "P\"2!\"/\""
28
+ ]))), [
29
+ "pre",
30
+ "",
31
+ "P\"2!\"/\""
32
+ ]));
14
33
  let name = node.name;
15
34
  if (prefix) name = node.name.replace(`${prefix}_`, "");
16
35
  log(_storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
17
- if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name))) {
18
- const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find((prop) => prop.getAlias().includes(name));
36
+ if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some(__assignType((prop) => prop.getAlias().includes(name), [
37
+ "prop",
38
+ "",
39
+ "P\"2!\"/\""
40
+ ]))) {
41
+ const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find(__assignType((prop) => prop.getAlias().includes(name), [
42
+ "prop",
43
+ "",
44
+ "P\"2!\"/\""
45
+ ]));
19
46
  if (!envProperty || envProperty.isIgnored()) return;
20
47
  if (!context.env.used.env.hasProperty(name)) {
21
48
  log(_storm_software_config_tools_types.LogLevelLabel.DEBUG, `Adding "${name}" environment variables found in "${pass.filename || "unknown file"}" to used environment configuration reflection object.`);
@@ -24,9 +51,13 @@ const envBabelPlugin = (0, _powerlines_plugin_babel_helpers_create_plugin.create
24
51
  if (context.config.env.inject && isInjectable) {
25
52
  let value = context.env.parsed?.[name];
26
53
  if (value === void 0) {
27
- const prefix = context.config.env.prefix.find((pre) => {
54
+ const prefix = context.config.env.prefix.find(__assignType((pre) => {
28
55
  return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
29
- });
56
+ }, [
57
+ "pre",
58
+ "",
59
+ "P\"2!\"/\""
60
+ ]));
30
61
  if (prefix) value = context.env.parsed[`${prefix.replace(/_$/g, "")}_${name}`];
31
62
  }
32
63
  value ??= envProperty.getDefaultValue();
@@ -35,11 +66,41 @@ const envBabelPlugin = (0, _powerlines_plugin_babel_helpers_create_plugin.create
35
66
  }
36
67
  } else if (context.config.env.validate) throw new Error(`The "${name}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${pass.filename ? pass.filename : "unknown"}.
37
68
 
38
- The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort((a, b) => String(a).localeCompare(String(b))).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) => ` - ${prefix}`).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`);
69
+ The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort(__assignType((a, b) => String(a).localeCompare(String(b)), [
70
+ "a",
71
+ "b",
72
+ "",
73
+ "P\"2!\"2\"\"/#"
74
+ ])).map(__assignType((typeDef) => ` - ${String(typeDef)} ${envTypesAliasProperties.some(__assignType((prop) => prop.getNameAsString() === String(typeDef) && prop.getAlias().length > 0, [
75
+ "prop",
76
+ "",
77
+ "P\"2!\"/\""
78
+ ])) ? `(Alias: ${envTypesAliasProperties?.find(__assignType((prop) => prop.getNameAsString() === String(typeDef), [
79
+ "prop",
80
+ "",
81
+ "P\"2!\"/\""
82
+ ]))?.getAlias().join(", ")})` : ""}`, [
83
+ "typeDef",
84
+ "",
85
+ "P\"2!\"/\""
86
+ ])).join("\n")} \n\nUsing the following env prefix: \n${context.config.env.prefix.map(__assignType((prefix) => ` - ${prefix}`, [
87
+ "prefix",
88
+ "",
89
+ "P\"2!\"/\""
90
+ ])).join("\n")} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`);
39
91
  else if (pass.filename && isUsingBuiltin) context.warn(`The "${name}" environment variable is used in the source code file ${pass.filename}, but is not defined in the \`env\` type definition. If this is intentional, you can ignore this warning. Otherwise, please check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code.`);
40
92
  }
41
93
  }
42
- return { visitor: { MemberExpression(path, pass) {
94
+ extractEnv.__type = [
95
+ "node",
96
+ () => _powerlines_plugin_babel_types_config.__ΩBabelPluginPass,
97
+ "pass",
98
+ "isInjectable",
99
+ "isUsingBuiltin",
100
+ "extractEnv",
101
+ "P!2!n\"2#\"2$\"2%\"/&"
102
+ ];
103
+ return { visitor: { MemberExpression: __assignType(function MemberExpression(path, pass) {
43
104
  if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
44
105
  const identifier = path.get("property")?.node;
45
106
  if (!identifier.name) return;
@@ -65,8 +126,19 @@ const envBabelPlugin = (0, _powerlines_plugin_babel_helpers_create_plugin.create
65
126
  if (!identifier.name) return;
66
127
  extractEnv(identifier, pass, false, true);
67
128
  }
68
- } } };
69
- });
129
+ }, [
130
+ () => _babel_core.NodePath,
131
+ "path",
132
+ () => _powerlines_plugin_babel_types_config.__ΩBabelPluginPass,
133
+ "pass",
134
+ "MemberExpression",
135
+ "PP!7!2\"n#2$\"/%"
136
+ ]) } };
137
+ }, [
138
+ "param0",
139
+ "",
140
+ "P\"2!\"/\""
141
+ ])));
70
142
 
71
143
  //#endregion
72
144
  exports.envBabelPlugin = envBabelPlugin;
@@ -1,19 +1,46 @@
1
+ import { __ΩEnvPluginContext } from "../types/plugin.mjs";
2
+ import { __ΩBabelPluginPass } from "@powerlines/plugin-babel/types/config";
3
+ import { NodePath } from "@babel/core";
1
4
  import { stringifyDefaultValue } from "@powerlines/deepkit/utilities";
2
5
  import { createBabelPlugin } from "@powerlines/plugin-babel/helpers/create-plugin";
3
6
  import { addImport } from "@powerlines/plugin-babel/helpers/module-helpers";
4
7
  import { LogLevelLabel } from "@storm-software/config-tools/types";
5
8
 
6
9
  //#region src/babel/plugin.ts
7
- const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
10
+ function __assignType(fn, args) {
11
+ fn.__type = args;
12
+ return fn;
13
+ }
14
+ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!"]], createBabelPlugin("env", __assignType(({ log, context }) => {
8
15
  function extractEnv(node, pass, isInjectable = false, isUsingBuiltin = false) {
9
- const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0);
16
+ const envTypesAliasProperties = context.env.types.env?.getProperties().filter(__assignType((prop) => prop.getAlias().length > 0, [
17
+ "prop",
18
+ "",
19
+ "P\"2!\"/\""
20
+ ]));
10
21
  if (node.name) {
11
- const prefix = context.config.env.prefix.find((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")))));
22
+ const prefix = context.config.env.prefix.find(__assignType((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some(__assignType((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")), [
23
+ "prop",
24
+ "",
25
+ "P\"2!\"/\""
26
+ ]))), [
27
+ "pre",
28
+ "",
29
+ "P\"2!\"/\""
30
+ ]));
12
31
  let name = node.name;
13
32
  if (prefix) name = node.name.replace(`${prefix}_`, "");
14
33
  log(LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
15
- if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name))) {
16
- const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find((prop) => prop.getAlias().includes(name));
34
+ if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some(__assignType((prop) => prop.getAlias().includes(name), [
35
+ "prop",
36
+ "",
37
+ "P\"2!\"/\""
38
+ ]))) {
39
+ const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find(__assignType((prop) => prop.getAlias().includes(name), [
40
+ "prop",
41
+ "",
42
+ "P\"2!\"/\""
43
+ ]));
17
44
  if (!envProperty || envProperty.isIgnored()) return;
18
45
  if (!context.env.used.env.hasProperty(name)) {
19
46
  log(LogLevelLabel.DEBUG, `Adding "${name}" environment variables found in "${pass.filename || "unknown file"}" to used environment configuration reflection object.`);
@@ -22,9 +49,13 @@ const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
22
49
  if (context.config.env.inject && isInjectable) {
23
50
  let value = context.env.parsed?.[name];
24
51
  if (value === void 0) {
25
- const prefix = context.config.env.prefix.find((pre) => {
52
+ const prefix = context.config.env.prefix.find(__assignType((pre) => {
26
53
  return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
27
- });
54
+ }, [
55
+ "pre",
56
+ "",
57
+ "P\"2!\"/\""
58
+ ]));
28
59
  if (prefix) value = context.env.parsed[`${prefix.replace(/_$/g, "")}_${name}`];
29
60
  }
30
61
  value ??= envProperty.getDefaultValue();
@@ -33,11 +64,41 @@ const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
33
64
  }
34
65
  } else if (context.config.env.validate) throw new Error(`The "${name}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${pass.filename ? pass.filename : "unknown"}.
35
66
 
36
- The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort((a, b) => String(a).localeCompare(String(b))).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) => ` - ${prefix}`).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`);
67
+ The following environment configuration names are defined in the \`env\` type definition: \n${context.env.types.env?.getPropertyNames().sort(__assignType((a, b) => String(a).localeCompare(String(b)), [
68
+ "a",
69
+ "b",
70
+ "",
71
+ "P\"2!\"2\"\"/#"
72
+ ])).map(__assignType((typeDef) => ` - ${String(typeDef)} ${envTypesAliasProperties.some(__assignType((prop) => prop.getNameAsString() === String(typeDef) && prop.getAlias().length > 0, [
73
+ "prop",
74
+ "",
75
+ "P\"2!\"/\""
76
+ ])) ? `(Alias: ${envTypesAliasProperties?.find(__assignType((prop) => prop.getNameAsString() === String(typeDef), [
77
+ "prop",
78
+ "",
79
+ "P\"2!\"/\""
80
+ ]))?.getAlias().join(", ")})` : ""}`, [
81
+ "typeDef",
82
+ "",
83
+ "P\"2!\"/\""
84
+ ])).join("\n")} \n\nUsing the following env prefix: \n${context.config.env.prefix.map(__assignType((prefix) => ` - ${prefix}`, [
85
+ "prefix",
86
+ "",
87
+ "P\"2!\"/\""
88
+ ])).join("\n")} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`);
37
89
  else if (pass.filename && isUsingBuiltin) context.warn(`The "${name}" environment variable is used in the source code file ${pass.filename}, but is not defined in the \`env\` type definition. If this is intentional, you can ignore this warning. Otherwise, please check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code.`);
38
90
  }
39
91
  }
40
- return { visitor: { MemberExpression(path, pass) {
92
+ extractEnv.__type = [
93
+ "node",
94
+ () => __ΩBabelPluginPass,
95
+ "pass",
96
+ "isInjectable",
97
+ "isUsingBuiltin",
98
+ "extractEnv",
99
+ "P!2!n\"2#\"2$\"2%\"/&"
100
+ ];
101
+ return { visitor: { MemberExpression: __assignType(function MemberExpression(path, pass) {
41
102
  if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
42
103
  const identifier = path.get("property")?.node;
43
104
  if (!identifier.name) return;
@@ -63,8 +124,19 @@ const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
63
124
  if (!identifier.name) return;
64
125
  extractEnv(identifier, pass, false, true);
65
126
  }
66
- } } };
67
- });
127
+ }, [
128
+ () => NodePath,
129
+ "path",
130
+ () => __ΩBabelPluginPass,
131
+ "pass",
132
+ "MemberExpression",
133
+ "PP!7!2\"n#2$\"/%"
134
+ ]) } };
135
+ }, [
136
+ "param0",
137
+ "",
138
+ "P\"2!\"/\""
139
+ ])));
68
140
 
69
141
  //#endregion
70
142
  export { envBabelPlugin };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/babel/plugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { NodePath } from \"@babel/core\";\nimport * as t from \"@babel/types\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport { createBabelPlugin } from \"@powerlines/plugin-babel/helpers/create-plugin\";\nimport { addImport } from \"@powerlines/plugin-babel/helpers/module-helpers\";\nimport { BabelPluginPass } from \"@powerlines/plugin-babel/types/config\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/*\n * The Powerlines - Environment Configuration Babel Plugin\n *\n * @param babel - The Babel core module\n * @returns The Babel plugin object\n */\nexport const envBabelPlugin = createBabelPlugin<EnvPluginContext>(\n \"env\",\n ({ log, context }) => {\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false,\n isUsingBuiltin = false\n ) {\n const envTypesAliasProperties = context.env.types.env\n ?.getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n if (node.name) {\n const prefix = context.config.env.prefix.find(\n pre =>\n node.name &&\n node.name.startsWith(pre) &&\n (context.env.types.env?.hasProperty(\n node.name.replace(`${pre}_`, \"\")\n ) ||\n envTypesAliasProperties.some(prop =>\n prop.getAlias().includes(node.name.replace(`${pre}_`, \"\"))\n ))\n );\n\n let name = node.name;\n if (prefix) {\n name = node.name.replace(`${prefix}_`, \"\");\n }\n\n log(\n LogLevelLabel.TRACE,\n `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n );\n\n if (\n context.env.types.env?.hasProperty(name) ||\n envTypesAliasProperties.some(prop => prop.getAlias().includes(name))\n ) {\n const envProperty = context.env.types.env.hasProperty(name)\n ? context.env.types.env.getProperty(name)\n : envTypesAliasProperties.find(prop =>\n prop.getAlias().includes(name)\n );\n if (!envProperty || envProperty.isIgnored()) {\n return;\n }\n\n if (!context.env.used.env.hasProperty(name)) {\n log(\n LogLevelLabel.DEBUG,\n `Adding \"${name}\" environment variables found in \"${\n pass.filename || \"unknown file\"\n }\" to used environment configuration reflection object.`\n );\n\n context.env.used.env.addProperty(envProperty.property);\n }\n\n if (context.config.env.inject && isInjectable) {\n let value = context.env.parsed?.[name];\n if (value === undefined) {\n const prefix = context.config.env.prefix.find(pre => {\n return context.env.parsed[`${pre.replace(/_$/g, \"\")}_${name}`];\n });\n if (prefix) {\n value =\n context.env.parsed[`${prefix.replace(/_$/g, \"\")}_${name}`];\n }\n }\n\n value ??= envProperty.getDefaultValue();\n\n if (envProperty.isValueRequired() && value === undefined) {\n throw new Error(\n `Environment variable \\`${name}\\` is not defined in the .env configuration files`\n );\n }\n\n return stringifyDefaultValue(envProperty, value);\n }\n } else if (context.config.env.validate) {\n throw new Error(\n `The \"${name}\" environment variable is not defined in the \\`env\\` type definition, but is used in the source code file ${\n pass.filename ? pass.filename : \"unknown\"\n }.\n\n The following environment configuration names are defined in the \\`env\\` type definition: \\n${context.env.types.env\n ?.getPropertyNames()\n .sort((a, b) => String(a).localeCompare(String(b)))\n .map(\n typeDef =>\n ` - ${String(typeDef)} ${\n envTypesAliasProperties.some(\n prop =>\n prop.getNameAsString() === String(typeDef) &&\n prop.getAlias().length > 0\n )\n ? `(Alias: ${envTypesAliasProperties\n ?.find(\n prop => prop.getNameAsString() === String(typeDef)\n )\n ?.getAlias()\n .join(\", \")})`\n : \"\"\n }`\n )\n .join(\n \"\\n\"\n )} \\n\\nUsing the following env prefix: \\n${context.config.env.prefix\n .map(prefix => ` - ${prefix}`)\n .join(\n \"\\n\"\n )} \\n\\nPlease check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \\n\\n`\n );\n } else if (pass.filename && isUsingBuiltin) {\n context.warn(\n `The \"${\n name\n }\" environment variable is used in the source code file ${\n pass.filename\n }, but is not defined in the \\`env\\` type definition. If this is intentional, you can ignore this warning. Otherwise, please check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code.`\n );\n }\n }\n\n return undefined;\n }\n\n return {\n visitor: {\n MemberExpression(\n path: NodePath<t.MemberExpression>,\n pass: BabelPluginPass\n ) {\n if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path\n .get(\"object\")\n ?.get(\"object\")\n ?.isIdentifier({ name: \"process\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // process.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path.get(\"object\")?.get(\"object\")?.isMetaProperty() &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // import.meta.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path.get(\"object\")?.isIdentifier({ name: \"env\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, true);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;AAiCA,MAAa,iBAAiB,kBAC5B,QACC,EAAE,KAAK,cAAc;CACpB,SAAS,WACP,MACA,MACA,eAAe,OACf,iBAAiB,OACjB;EACA,MAAM,0BAA0B,QAAQ,IAAI,MAAM,KAC9C,eAAe,CAChB,QAAO,SAAQ,KAAK,UAAU,CAAC,SAAS,EAAE;AAE7C,MAAI,KAAK,MAAM;GACb,MAAM,SAAS,QAAQ,OAAO,IAAI,OAAO,MACvC,QACE,KAAK,QACL,KAAK,KAAK,WAAW,IAAI,KACxB,QAAQ,IAAI,MAAM,KAAK,YACtB,KAAK,KAAK,QAAQ,GAAG,IAAI,IAAI,GAAG,CACjC,IACC,wBAAwB,MAAK,SAC3B,KAAK,UAAU,CAAC,SAAS,KAAK,KAAK,QAAQ,GAAG,IAAI,IAAI,GAAG,CAAC,CAC3D,EACN;GAED,IAAI,OAAO,KAAK;AAChB,OAAI,OACF,QAAO,KAAK,KAAK,QAAQ,GAAG,OAAO,IAAI,GAAG;AAG5C,OACE,cAAc,OACd,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O;AACtD,aAAU,MAAM;IACd,QAAQ,GAAG,QAAQ,OAAO,aAAa,aAAa;IACpD,MAAM;IACN,UAAU;IACX,CAAC;aAEF,KAAK,IAAI,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC,IACjD,KAAK,IAAI,WAAW,EAAE,cAAc,EACpC;GAGA,MAAM,aAAa,KAAK,IAAI,WAAW,EAAE;AACzC,OAAI,CAAC,WAAW,KACd;AAGF,cAAW,YAAY,MAAM,OAAO,KAAK;;IAG9C,EACF;EAEJ"}
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/babel/plugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { NodePath } from \"@babel/core\";\nimport * as t from \"@babel/types\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport { createBabelPlugin } from \"@powerlines/plugin-babel/helpers/create-plugin\";\nimport { addImport } from \"@powerlines/plugin-babel/helpers/module-helpers\";\nimport { BabelPluginPass } from \"@powerlines/plugin-babel/types/config\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/*\n * The Powerlines - Environment Configuration Babel Plugin\n *\n * @param babel - The Babel core module\n * @returns The Babel plugin object\n */\nexport const envBabelPlugin = createBabelPlugin<EnvPluginContext>(\n \"env\",\n ({ log, context }) => {\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false,\n isUsingBuiltin = false\n ) {\n const envTypesAliasProperties = context.env.types.env\n ?.getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n if (node.name) {\n const prefix = context.config.env.prefix.find(\n pre =>\n node.name &&\n node.name.startsWith(pre) &&\n (context.env.types.env?.hasProperty(\n node.name.replace(`${pre}_`, \"\")\n ) ||\n envTypesAliasProperties.some(prop =>\n prop.getAlias().includes(node.name.replace(`${pre}_`, \"\"))\n ))\n );\n\n let name = node.name;\n if (prefix) {\n name = node.name.replace(`${prefix}_`, \"\");\n }\n\n log(\n LogLevelLabel.TRACE,\n `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n );\n\n if (\n context.env.types.env?.hasProperty(name) ||\n envTypesAliasProperties.some(prop => prop.getAlias().includes(name))\n ) {\n const envProperty = context.env.types.env.hasProperty(name)\n ? context.env.types.env.getProperty(name)\n : envTypesAliasProperties.find(prop =>\n prop.getAlias().includes(name)\n );\n if (!envProperty || envProperty.isIgnored()) {\n return;\n }\n\n if (!context.env.used.env.hasProperty(name)) {\n log(\n LogLevelLabel.DEBUG,\n `Adding \"${name}\" environment variables found in \"${\n pass.filename || \"unknown file\"\n }\" to used environment configuration reflection object.`\n );\n\n context.env.used.env.addProperty(envProperty.property);\n }\n\n if (context.config.env.inject && isInjectable) {\n let value = context.env.parsed?.[name];\n if (value === undefined) {\n const prefix = context.config.env.prefix.find(pre => {\n return context.env.parsed[`${pre.replace(/_$/g, \"\")}_${name}`];\n });\n if (prefix) {\n value =\n context.env.parsed[`${prefix.replace(/_$/g, \"\")}_${name}`];\n }\n }\n\n value ??= envProperty.getDefaultValue();\n\n if (envProperty.isValueRequired() && value === undefined) {\n throw new Error(\n `Environment variable \\`${name}\\` is not defined in the .env configuration files`\n );\n }\n\n return stringifyDefaultValue(envProperty, value);\n }\n } else if (context.config.env.validate) {\n throw new Error(\n `The \"${name}\" environment variable is not defined in the \\`env\\` type definition, but is used in the source code file ${\n pass.filename ? pass.filename : \"unknown\"\n }.\n\n The following environment configuration names are defined in the \\`env\\` type definition: \\n${context.env.types.env\n ?.getPropertyNames()\n .sort((a, b) => String(a).localeCompare(String(b)))\n .map(\n typeDef =>\n ` - ${String(typeDef)} ${\n envTypesAliasProperties.some(\n prop =>\n prop.getNameAsString() === String(typeDef) &&\n prop.getAlias().length > 0\n )\n ? `(Alias: ${envTypesAliasProperties\n ?.find(\n prop => prop.getNameAsString() === String(typeDef)\n )\n ?.getAlias()\n .join(\", \")})`\n : \"\"\n }`\n )\n .join(\n \"\\n\"\n )} \\n\\nUsing the following env prefix: \\n${context.config.env.prefix\n .map(prefix => ` - ${prefix}`)\n .join(\n \"\\n\"\n )} \\n\\nPlease check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \\n\\n`\n );\n } else if (pass.filename && isUsingBuiltin) {\n context.warn(\n `The \"${\n name\n }\" environment variable is used in the source code file ${\n pass.filename\n }, but is not defined in the \\`env\\` type definition. If this is intentional, you can ignore this warning. Otherwise, please check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code.`\n );\n }\n }\n\n return undefined;\n }\n\n return {\n visitor: {\n MemberExpression(\n path: NodePath<t.MemberExpression>,\n pass: BabelPluginPass\n ) {\n if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path\n .get(\"object\")\n ?.get(\"object\")\n ?.isIdentifier({ name: \"process\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // process.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path.get(\"object\")?.get(\"object\")?.isMetaProperty() &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // import.meta.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path.get(\"object\")?.isIdentifier({ name: \"env\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, true);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;AAC5B,IAAA,SAAW;AACd,QAAS;;AA8BV,MAAa,kBAAU,kBAAA,IAAA,CAAA,OAAA,qBAAA,KAAA,CAAA,EAAA,kBAAA,OAAA,cAAA,EAAA,KAAA,cAAA;CACnB,SAAS,WAAW,MAAA,MAAA,eAAA,OAAA,iBAAA,OAAA;EAClB,MAAM,0BAAe,QAAA,IAAA,MAAA,KACrB,eAAoB,CACpB,OAAc,cAAG,SAAA,KAAA,UAAA,CAAA,SAAA,GAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;AACjB,MAAA,KAAA,MAAA;GACM,MAAA,SAAA,QAAuB,OAAG,IAAQ,OAAI,KAAM,cAAA,QAAA,KAAA,QAC9C,KAAA,KAAc,WAAA,IAAA,KACR,QAAQ,IAAK,MAAA,KAAW,YAAW,KAAA,KAAA,QAAA,GAAA,IAAA,IAAA,GAAA,CAAA;;;;;;;;;GAEzC,IAAK,OAAM,KAAA;AACb,OAAM,OACC,QAAA,KAAA,KAAA,QAAA,GAAA,OAAA,IAAA,GAAA;AAEH,OAAI,cAAM,OAAe,wBAAE,KAAA,YAAA,KAAA,YAAA,eAAA,GAAA;AAC3B,OAAC,QAAW,IAAC,MAAS,KAAE,YAAW,KAAA,IACjC,wBAA0B,KAA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EAAA;GAEV,MAAI,aAAA,KAAA,IAAA,WAAA,EAAA;AACJ,OAAI,CAAC,WAAU,KACX;AAEP,cAAA,YAAA,MAAA,OAAA,MAAA;AACL,QAAA,wBAAA,OAAA,WAAA,OAAA;AACK,aAAA,MAAA;IACA,QAAA,GAAA,QAAA,OAAA,aAAA,aAAA;IACO,MAAK;IACL,UAAS;IAChB,CAAA;aAEQ,KAAC,IAAM,SAAW,EAAE,aAAa,EAAC,MAAO,OAAO,CAAC,IAC/D,KAAA,IAAA,WAAA,EAAA,cAAA,EAAA;GAEO,MAAI,aAAA,KAAA,IAAA,WAAA,EAAA;AACH,OAAA,CAAA,WAAA,KACL;AAEK,cAAA,YAAA,MAAA,OAAA,KAAA;;IAER;QAAA;EAAA;QAAA;EAAA;EAAA;EAAA;EAAA,CAAA,EACH,EACH"}
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  const require_helpers_load = require('../helpers/load.cjs');
4
- let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
5
4
  let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
5
+ let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
6
6
  let defu = require("defu");
7
7
  defu = require_runtime.__toESM(defu);
8
8
  let _alloy_js_core = require("@alloy-js/core");
@@ -1,6 +1,6 @@
1
1
  import { loadEnvFromContext } from "../helpers/load.mjs";
2
- import { titleCase } from "@stryke/string-format/title-case";
3
2
  import { ReflectionClass, ReflectionKind } from "@powerlines/deepkit/vendor/type";
3
+ import { titleCase } from "@stryke/string-format/title-case";
4
4
  import defu from "defu";
5
5
  import { For, Show, code, computed, splitProps } from "@alloy-js/core";
6
6
  import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
@@ -1,23 +1,33 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ let powerlines = require("powerlines");
3
4
  let _stryke_path_join_paths = require("@stryke/path/join-paths");
4
5
  let automd = require("automd");
5
6
 
6
7
  //#region src/helpers/automd-generator.ts
8
+ function __assignType(fn, args) {
9
+ fn.__type = args;
10
+ return fn;
11
+ }
7
12
  /**
8
13
  * AutoMD generator to generate environment variable documentation
9
14
  *
10
15
  * @param context - The generator context.
11
16
  * @returns The generated documentation content.
12
17
  */
13
- const env = (context) => (0, automd.defineGenerator)({
18
+ const env = __assignType((context) => (0, automd.defineGenerator)({
14
19
  name: "env",
15
- async generate() {
20
+ generate: __assignType(async function generate() {
16
21
  const envDocFile = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "docs", "generated", "env.md");
17
22
  if (!context.fs.existsSync(envDocFile)) return { contents: "" };
18
23
  return { contents: await context.fs.read(envDocFile) || "" };
19
- }
20
- });
24
+ }, ["generate", "P\"/!"])
25
+ }), [
26
+ () => powerlines.__ΩUnresolvedContext,
27
+ "context",
28
+ "",
29
+ "Pn!2\"\"/#"
30
+ ]);
21
31
 
22
32
  //#endregion
23
33
  exports.env = env;
@@ -1,5 +1,5 @@
1
- import * as automd from "automd";
2
1
  import { UnresolvedContext } from "powerlines";
2
+ import * as automd from "automd";
3
3
 
4
4
  //#region src/helpers/automd-generator.d.ts
5
5
  /**
@@ -1,21 +1,31 @@
1
+ import { __ΩUnresolvedContext } from "powerlines";
1
2
  import { joinPaths } from "@stryke/path/join-paths";
2
3
  import { defineGenerator } from "automd";
3
4
 
4
5
  //#region src/helpers/automd-generator.ts
6
+ function __assignType(fn, args) {
7
+ fn.__type = args;
8
+ return fn;
9
+ }
5
10
  /**
6
11
  * AutoMD generator to generate environment variable documentation
7
12
  *
8
13
  * @param context - The generator context.
9
14
  * @returns The generated documentation content.
10
15
  */
11
- const env = (context) => defineGenerator({
16
+ const env = __assignType((context) => defineGenerator({
12
17
  name: "env",
13
- async generate() {
18
+ generate: __assignType(async function generate() {
14
19
  const envDocFile = joinPaths(context.config.root, "docs", "generated", "env.md");
15
20
  if (!context.fs.existsSync(envDocFile)) return { contents: "" };
16
21
  return { contents: await context.fs.read(envDocFile) || "" };
17
- }
18
- });
22
+ }, ["generate", "P\"/!"])
23
+ }), [
24
+ () => __ΩUnresolvedContext,
25
+ "context",
26
+ "",
27
+ "Pn!2\"\"/#"
28
+ ]);
19
29
 
20
30
  //#endregion
21
31
  export { env };
@@ -1 +1 @@
1
- {"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n context.config.root,\n \"docs\",\n \"generated\",\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":";;;;;;;;;;AA4BA,MAAa,OAAO,YAClB,gBAAgB;CACd,MAAM;CACN,MAAM,WAAW;EACf,MAAM,aAAa,UACjB,QAAQ,OAAO,MACf,QACA,aACA,SACD;AAED,MAAI,CAAC,QAAQ,GAAG,WAAW,WAAW,CACpC,QAAO,EACL,UAAU,IACX;AAKH,SAAO,EACL,UAHe,MAAM,QAAQ,GAAG,KAAK,WAAW,IAG1B,IACvB;;CAEJ,CAAC"}
1
+ {"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n context.config.root,\n \"docs\",\n \"generated\",\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":";;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;AAE1B,QAAU;;;;;;;;AA2BX,MAAU,MAAS,cAAE,YAAA,gBAAA;CACjB,MAAE;CACF,UAAI,aAAmB,eAAA,WAAA;EACnB,MAAM,aAAA,UAAA,QAAA,OAAA,MAAA,QAAA,aAAA,SAAA;AACN,MAAC,CAAA,QAAU,GAAA,WAAA,WAAA,CACP,QAAG,EACR,UAAA;AAIC,SAAE,EACD,UAFM,MAAA,QAAA,GAAA,KAAA,WAAA,IAEN,IACH;;CAEL,CAAC,EAAE;OAAO;CAAkB;CAAe;CAAC;CAAW,CAAA"}
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_types_plugin = require('../types/plugin.cjs');
2
3
 
3
4
  //#region src/helpers/create-reflection-resource.ts
4
5
  /**
@@ -10,6 +11,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
10
11
  function createReflection(_context) {
11
12
  return {};
12
13
  }
14
+ createReflection.__type = [
15
+ () => require_types_plugin.__ΩEnvPluginContext,
16
+ "_context",
17
+ "createReflection",
18
+ "Creates a reflection resource for the environment configuration.",
19
+ "Pn!2\"\"/#?$"
20
+ ];
13
21
 
14
22
  //#endregion
15
23
  exports.createReflection = createReflection;
@@ -1,3 +1,5 @@
1
+ import { __ΩEnvPluginContext } from "../types/plugin.mjs";
2
+
1
3
  //#region src/helpers/create-reflection-resource.ts
2
4
  /**
3
5
  * Creates a reflection resource for the environment configuration.
@@ -8,6 +10,13 @@
8
10
  function createReflection(_context) {
9
11
  return {};
10
12
  }
13
+ createReflection.__type = [
14
+ () => __ΩEnvPluginContext,
15
+ "_context",
16
+ "createReflection",
17
+ "Creates a reflection resource for the environment configuration.",
18
+ "Pn!2\"\"/#?$"
19
+ ];
11
20
 
12
21
  //#endregion
13
22
  export { createReflection };
@@ -1 +1 @@
1
- {"version":3,"file":"create-reflection-resource.mjs","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Creates a reflection resource for the environment configuration.\n *\n * @param _context - The environment plugin context.\n * @returns A resource that provides the reflection of the environment configuration.\n */\nexport function createReflection(_context: EnvPluginContext) {\n // const defaultValue = computed(\n // () => context && loadEnvFromContext(context, process.env)\n // );\n\n return {};\n\n // return computed(() => {\n // result.getProperties().forEach(prop => {\n // const aliases = prop.getAlias();\n // aliases.filter(Boolean).forEach(alias => {\n // result.addProperty({\n // name: alias,\n // optional: prop.isOptional() ? true : undefined,\n // readonly: prop.isReadonly() ? true : undefined,\n // description: prop.getDescription(),\n // visibility: prop.getVisibility(),\n // type: prop.getType(),\n // default: prop.getDefaultValue(),\n // tags: {\n // hidden: prop.isHidden(),\n // ignore: prop.isIgnored(),\n // internal: prop.isInternal(),\n // alias: prop\n // .getAlias()\n // .filter(a => a !== alias)\n // .concat(prop.name),\n // title: prop.getTitle() || titleCase(prop.name),\n // readonly: prop.isReadonly(),\n // permission: prop.getPermission(),\n // domain: prop.getDomain()\n // }\n // });\n // });\n // });\n\n // result.getProperties().forEach(prop => {\n // prop.setDefaultValue(\n // (defaultValue.value as Record<string, any>)?.[prop.getNameAsString()] ??\n // prop\n // .getAlias()\n // .reduce(\n // (ret, alias) =>\n // ret ?? (defaultValue.value as Record<string, any>)?.[alias],\n // undefined\n // ) ??\n // prop.getDefaultValue()\n // );\n // });\n // });\n}\n"],"mappings":";;;;;;;AA0BA,SAAgB,iBAAiB,UAA4B;AAK3D,QAAO,EAAE"}
1
+ {"version":3,"file":"create-reflection-resource.mjs","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Creates a reflection resource for the environment configuration.\n *\n * @param _context - The environment plugin context.\n * @returns A resource that provides the reflection of the environment configuration.\n */\nexport function createReflection(_context: EnvPluginContext) {\n // const defaultValue = computed(\n // () => context && loadEnvFromContext(context, process.env)\n // );\n\n return {};\n\n // return computed(() => {\n // result.getProperties().forEach(prop => {\n // const aliases = prop.getAlias();\n // aliases.filter(Boolean).forEach(alias => {\n // result.addProperty({\n // name: alias,\n // optional: prop.isOptional() ? true : undefined,\n // readonly: prop.isReadonly() ? true : undefined,\n // description: prop.getDescription(),\n // visibility: prop.getVisibility(),\n // type: prop.getType(),\n // default: prop.getDefaultValue(),\n // tags: {\n // hidden: prop.isHidden(),\n // ignore: prop.isIgnored(),\n // internal: prop.isInternal(),\n // alias: prop\n // .getAlias()\n // .filter(a => a !== alias)\n // .concat(prop.name),\n // title: prop.getTitle() || titleCase(prop.name),\n // readonly: prop.isReadonly(),\n // permission: prop.getPermission(),\n // domain: prop.getDomain()\n // }\n // });\n // });\n // });\n\n // result.getProperties().forEach(prop => {\n // prop.setDefaultValue(\n // (defaultValue.value as Record<string, any>)?.[prop.getNameAsString()] ??\n // prop\n // .getAlias()\n // .reduce(\n // (ret, alias) =>\n // ret ?? (defaultValue.value as Record<string, any>)?.[alias],\n // undefined\n // ) ??\n // prop.getDefaultValue()\n // );\n // });\n // });\n}\n"],"mappings":";;;;;;;;;;AAYC,QAAU,EAAE;;AA4Cb,iBAAe,SAAQ;OAAK;CAAU;CAAA;CAAA;CAAA;CAAA"}
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_types_plugin = require('../types/plugin.cjs');
3
4
  let _stryke_path_join = require("@stryke/path/join");
4
5
 
5
6
  //#region src/helpers/docs-helper.ts
@@ -12,6 +13,13 @@ let _stryke_path_join = require("@stryke/path/join");
12
13
  function getDocsOutputPath(context) {
13
14
  return (0, _stryke_path_join.joinPaths)(context.config.root, "docs", "generated");
14
15
  }
16
+ getDocsOutputPath.__type = [
17
+ () => require_types_plugin.__ΩEnvPluginContext,
18
+ "context",
19
+ "getDocsOutputPath",
20
+ "Gets the output path for the generated environment documentation.",
21
+ "Pn!2\"&/#?$"
22
+ ];
15
23
 
16
24
  //#endregion
17
25
  exports.getDocsOutputPath = getDocsOutputPath;
@@ -1,3 +1,4 @@
1
+ import { __ΩEnvPluginContext } from "../types/plugin.mjs";
1
2
  import { joinPaths } from "@stryke/path/join";
2
3
 
3
4
  //#region src/helpers/docs-helper.ts
@@ -10,6 +11,13 @@ import { joinPaths } from "@stryke/path/join";
10
11
  function getDocsOutputPath(context) {
11
12
  return joinPaths(context.config.root, "docs", "generated");
12
13
  }
14
+ getDocsOutputPath.__type = [
15
+ () => __ΩEnvPluginContext,
16
+ "context",
17
+ "getDocsOutputPath",
18
+ "Gets the output path for the generated environment documentation.",
19
+ "Pn!2\"&/#?$"
20
+ ];
13
21
 
14
22
  //#endregion
15
23
  export { getDocsOutputPath };
@@ -1 +1 @@
1
- {"version":3,"file":"docs-helper.mjs","names":[],"sources":["../../src/helpers/docs-helper.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Gets the output path for the generated environment documentation.\n *\n * @param context - The environment plugin context.\n * @returns The output path for the generated environment documentation.\n */\nexport function getDocsOutputPath(context: EnvPluginContext): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgB,kBAAkB,SAAmC;AACnE,QAAO,UAAU,QAAQ,OAAO,MAAM,QAAQ,YAAY"}
1
+ {"version":3,"file":"docs-helper.mjs","names":[],"sources":["../../src/helpers/docs-helper.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Gets the output path for the generated environment documentation.\n *\n * @param context - The environment plugin context.\n * @returns The output path for the generated environment documentation.\n */\nexport function getDocsOutputPath(context: EnvPluginContext): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAE,kBAAA,SAAA;AACF,QAAO,UAAS,QAAA,OAAkB,MAAQ,QAAC,YAAmB;;AAE9D,kBAAA,SAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -8,6 +8,7 @@ const require_helpers_create_reflection_resource = require('./create-reflection-
8
8
 
9
9
  exports.BaseEnv = require_helpers_reflect.BaseEnv;
10
10
  exports.BaseSecrets = require_helpers_reflect.BaseSecrets;
11
+ exports.__ΩCreateEnvReflectionOptions = require_helpers_reflect.__ΩCreateEnvReflectionOptions;
11
12
  exports.createEnvReflection = require_helpers_reflect.createEnvReflection;
12
13
  exports.createReflection = require_helpers_create_reflection_resource.createReflection;
13
14
  exports.createSecretsReflection = require_helpers_reflect.createSecretsReflection;