@powerlines/plugin-env 0.15.4 → 0.15.6

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 (264) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/babel/index.cjs +1 -0
  3. package/dist/babel/index.d.cts +1 -0
  4. package/dist/babel/index.d.mts +1 -0
  5. package/dist/babel/index.mjs +3 -0
  6. package/dist/babel/plugin.cjs +200 -0
  7. package/dist/babel/plugin.d.cts +8 -0
  8. package/dist/babel/plugin.d.mts +9 -0
  9. package/dist/babel/plugin.mjs +198 -0
  10. package/dist/components/docs.cjs +70 -3
  11. package/dist/components/docs.d.cts +8 -1
  12. package/dist/components/docs.d.mts +8 -1
  13. package/dist/components/docs.mjs +68 -2
  14. package/dist/components/env.cjs +574 -4
  15. package/dist/components/env.d.cts +19 -2
  16. package/dist/components/env.d.mts +19 -3
  17. package/dist/components/env.mjs +570 -2
  18. package/dist/components/index.cjs +5 -7
  19. package/dist/components/index.d.cts +2 -4
  20. package/dist/components/index.d.mts +2 -5
  21. package/dist/components/index.mjs +2 -4
  22. package/dist/deepkit/schemas/reflection.cjs +5368 -0
  23. package/dist/{plugin-BwuEBScL.d.cts → deepkit/schemas/reflection.d.cts} +1 -268
  24. package/dist/{plugin-BaInAuAh.d.mts → deepkit/schemas/reflection.d.mts} +59 -326
  25. package/dist/deepkit/schemas/reflection.mjs +5365 -0
  26. package/dist/deepkit/schemas/reflection2.cjs +4112 -0
  27. package/dist/deepkit/schemas/reflection2.mjs +4110 -0
  28. package/dist/deepkit/src/capnp.cjs +1692 -0
  29. package/dist/deepkit/src/capnp.mjs +1690 -0
  30. package/dist/deepkit/src/esbuild-plugin.cjs +99 -0
  31. package/dist/deepkit/src/esbuild-plugin.mjs +98 -0
  32. package/dist/deepkit/src/reflect-type.cjs +40 -0
  33. package/dist/deepkit/src/reflect-type.mjs +38 -0
  34. package/dist/deepkit/src/resolve-reflections.cjs +23 -0
  35. package/dist/deepkit/src/resolve-reflections.mjs +22 -0
  36. package/dist/deepkit/src/transformer.cjs +92 -0
  37. package/dist/deepkit/src/transformer.mjs +89 -0
  38. package/dist/deepkit/src/transpile.cjs +39 -0
  39. package/dist/deepkit/src/transpile.mjs +37 -0
  40. package/dist/deepkit/src/types.cjs +22 -0
  41. package/dist/deepkit/src/types.d.cts +10 -0
  42. package/dist/deepkit/src/types.d.mts +10 -0
  43. package/dist/deepkit/src/types.mjs +21 -0
  44. package/dist/deepkit/src/utilities.cjs +182 -0
  45. package/dist/deepkit/src/utilities.mjs +181 -0
  46. package/dist/helpers/automd-generator.cjs +32 -0
  47. package/dist/helpers/automd-generator.mjs +31 -0
  48. package/dist/helpers/create-reflection-resource.cjs +98 -0
  49. package/dist/helpers/create-reflection-resource.d.cts +15 -0
  50. package/dist/helpers/create-reflection-resource.d.mts +15 -0
  51. package/dist/helpers/create-reflection-resource.mjs +97 -0
  52. package/dist/helpers/index.cjs +6 -0
  53. package/dist/helpers/index.d.cts +6 -0
  54. package/dist/helpers/index.d.mts +6 -0
  55. package/dist/helpers/index.mjs +8 -0
  56. package/dist/helpers/load.cjs +134 -0
  57. package/dist/helpers/load.d.cts +35 -0
  58. package/dist/helpers/load.d.mts +36 -0
  59. package/dist/helpers/load.mjs +131 -0
  60. package/dist/helpers/persistence.cjs +320 -0
  61. package/dist/helpers/persistence.d.cts +84 -0
  62. package/dist/helpers/persistence.d.mts +84 -0
  63. package/dist/helpers/persistence.mjs +308 -0
  64. package/dist/helpers/reflect.cjs +263 -0
  65. package/dist/helpers/reflect.d.cts +46 -0
  66. package/dist/helpers/reflect.d.mts +46 -0
  67. package/dist/helpers/reflect.mjs +254 -0
  68. package/dist/helpers/source-file-env.cjs +58 -0
  69. package/dist/helpers/source-file-env.d.cts +8 -0
  70. package/dist/helpers/source-file-env.d.mts +8 -0
  71. package/dist/helpers/source-file-env.mjs +56 -0
  72. package/dist/helpers/template-helpers.cjs +70 -0
  73. package/dist/helpers/template-helpers.d.cts +15 -0
  74. package/dist/helpers/template-helpers.d.mts +15 -0
  75. package/dist/helpers/template-helpers.mjs +69 -0
  76. package/dist/index.cjs +82 -696
  77. package/dist/index.d.cts +16 -185
  78. package/dist/index.d.mts +17 -190
  79. package/dist/index.mjs +31 -648
  80. package/dist/plugin-alloy/src/core/components/output.cjs +45 -0
  81. package/dist/plugin-alloy/src/core/components/output.mjs +44 -0
  82. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +22 -0
  83. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +21 -0
  84. package/dist/plugin-alloy/src/core/components/source-file.cjs +64 -0
  85. package/dist/plugin-alloy/src/core/components/source-file.d.cts +23 -0
  86. package/dist/plugin-alloy/src/core/components/source-file.d.mts +23 -0
  87. package/dist/plugin-alloy/src/core/components/source-file.mjs +62 -0
  88. package/dist/plugin-alloy/src/core/contexts/context.cjs +136 -0
  89. package/dist/plugin-alloy/src/core/contexts/context.mjs +128 -0
  90. package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
  91. package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
  92. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +110 -0
  93. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +101 -0
  94. package/dist/plugin-alloy/src/helpers/refkey.cjs +23 -0
  95. package/dist/plugin-alloy/src/helpers/refkey.mjs +22 -0
  96. package/dist/plugin-alloy/src/index.cjs +93 -0
  97. package/dist/plugin-alloy/src/index.mjs +91 -0
  98. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +115 -0
  99. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +114 -0
  100. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +39 -0
  101. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +38 -0
  102. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +72 -0
  103. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +71 -0
  104. package/dist/plugin-alloy/src/types/components.cjs +22 -0
  105. package/dist/plugin-alloy/src/types/components.d.cts +22 -0
  106. package/dist/{components-8W0Zgj0y.d.mts → plugin-alloy/src/types/components.d.mts} +2 -1
  107. package/dist/plugin-alloy/src/types/components.mjs +21 -0
  108. package/dist/plugin-alloy/src/types/index.d.mts +2 -0
  109. package/dist/plugin-alloy/src/types/plugin.cjs +55 -0
  110. package/dist/plugin-alloy/src/types/plugin.d.cts +37 -0
  111. package/dist/plugin-alloy/src/types/plugin.d.mts +37 -0
  112. package/dist/plugin-alloy/src/types/plugin.mjs +52 -0
  113. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +57 -0
  114. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +25 -0
  115. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +26 -0
  116. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +56 -0
  117. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +126 -0
  118. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +124 -0
  119. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +442 -0
  120. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +27 -0
  121. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +28 -0
  122. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +433 -0
  123. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +194 -0
  124. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +14 -0
  125. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +15 -0
  126. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +191 -0
  127. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +68 -0
  128. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +11 -0
  129. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +12 -0
  130. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +67 -0
  131. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +124 -0
  132. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +123 -0
  133. package/dist/plugin-automd/src/index.cjs +127 -0
  134. package/dist/plugin-automd/src/index.mjs +124 -0
  135. package/dist/plugin-automd/src/types/plugin.cjs +47 -0
  136. package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
  137. package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
  138. package/dist/plugin-automd/src/types/plugin.mjs +47 -0
  139. package/dist/plugin-automd/src/types/toc.cjs +26 -0
  140. package/dist/plugin-automd/src/types/toc.d.cts +33 -0
  141. package/dist/plugin-automd/src/types/toc.d.mts +33 -0
  142. package/dist/plugin-automd/src/types/toc.mjs +25 -0
  143. package/dist/plugin-babel/src/helpers/ast-utils.cjs +74 -0
  144. package/dist/plugin-babel/src/helpers/ast-utils.mjs +70 -0
  145. package/dist/plugin-babel/src/helpers/create-plugin.cjs +71 -0
  146. package/dist/plugin-babel/src/helpers/create-plugin.mjs +69 -0
  147. package/dist/plugin-babel/src/helpers/filters.cjs +158 -0
  148. package/dist/plugin-babel/src/helpers/filters.mjs +154 -0
  149. package/dist/plugin-babel/src/helpers/index.cjs +5 -0
  150. package/dist/plugin-babel/src/helpers/index.mjs +7 -0
  151. package/dist/plugin-babel/src/helpers/module-helpers.cjs +200 -0
  152. package/dist/plugin-babel/src/helpers/module-helpers.mjs +192 -0
  153. package/dist/plugin-babel/src/helpers/options.cjs +74 -0
  154. package/dist/plugin-babel/src/helpers/options.mjs +71 -0
  155. package/dist/plugin-babel/src/index.cjs +134 -0
  156. package/dist/plugin-babel/src/index.mjs +132 -0
  157. package/dist/plugin-babel/src/types/index.d.mts +1 -0
  158. package/dist/plugin-babel/src/types/plugin.cjs +42 -0
  159. package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
  160. package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
  161. package/dist/plugin-babel/src/types/plugin.mjs +39 -0
  162. package/dist/powerlines/schemas/fs.d.mts +1 -0
  163. package/dist/powerlines/src/api.d.mts +7 -0
  164. package/dist/powerlines/src/index.d.mts +12 -0
  165. package/dist/powerlines/src/internal/helpers/hooks.cjs +119 -0
  166. package/dist/powerlines/src/internal/helpers/hooks.d.mts +5 -0
  167. package/dist/powerlines/src/internal/helpers/hooks.mjs +118 -0
  168. package/dist/powerlines/src/lib/build/esbuild.cjs +161 -0
  169. package/dist/powerlines/src/lib/build/esbuild.mjs +159 -0
  170. package/dist/powerlines/src/lib/entry.cjs +203 -0
  171. package/dist/powerlines/src/lib/entry.mjs +201 -0
  172. package/dist/powerlines/src/lib/logger.cjs +108 -0
  173. package/dist/powerlines/src/lib/logger.mjs +106 -0
  174. package/dist/powerlines/src/lib/utilities/bundle.cjs +67 -0
  175. package/dist/powerlines/src/lib/utilities/bundle.mjs +66 -0
  176. package/dist/powerlines/src/lib/utilities/resolve.cjs +49 -0
  177. package/dist/powerlines/src/lib/utilities/resolve.mjs +48 -0
  178. package/dist/powerlines/src/plugin-utils/paths.cjs +46 -0
  179. package/dist/powerlines/src/plugin-utils/paths.mjs +45 -0
  180. package/dist/powerlines/src/types/api.cjs +1 -0
  181. package/dist/powerlines/src/types/api.d.mts +5 -0
  182. package/dist/powerlines/src/types/api.mjs +3 -0
  183. package/dist/powerlines/src/types/babel.cjs +156 -0
  184. package/dist/powerlines/src/types/babel.d.cts +23 -0
  185. package/dist/powerlines/src/types/babel.d.mts +23 -0
  186. package/dist/powerlines/src/types/babel.mjs +147 -0
  187. package/dist/powerlines/src/types/build.cjs +105 -0
  188. package/dist/powerlines/src/types/build.d.cts +145 -0
  189. package/dist/powerlines/src/types/build.d.mts +147 -0
  190. package/dist/powerlines/src/types/build.mjs +101 -0
  191. package/dist/powerlines/src/types/commands.cjs +16 -0
  192. package/dist/powerlines/src/types/commands.d.cts +8 -0
  193. package/dist/powerlines/src/types/commands.d.mts +9 -0
  194. package/dist/powerlines/src/types/commands.mjs +15 -0
  195. package/dist/powerlines/src/types/config.cjs +306 -0
  196. package/dist/powerlines/src/types/config.d.cts +387 -0
  197. package/dist/powerlines/src/types/config.d.mts +388 -0
  198. package/dist/powerlines/src/types/config.mjs +293 -0
  199. package/dist/powerlines/src/types/context.cjs +324 -0
  200. package/dist/powerlines/src/types/context.d.cts +414 -0
  201. package/dist/powerlines/src/types/context.d.mts +416 -0
  202. package/dist/powerlines/src/types/context.mjs +311 -0
  203. package/dist/powerlines/src/types/fs.cjs +78 -0
  204. package/dist/powerlines/src/types/fs.d.cts +486 -0
  205. package/dist/powerlines/src/types/fs.d.mts +486 -0
  206. package/dist/powerlines/src/types/fs.mjs +75 -0
  207. package/dist/powerlines/src/types/hooks.cjs +52 -0
  208. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  209. package/dist/powerlines/src/types/hooks.mjs +48 -0
  210. package/dist/powerlines/src/types/index.cjs +11 -0
  211. package/dist/powerlines/src/types/index.d.mts +12 -0
  212. package/dist/powerlines/src/types/index.mjs +13 -0
  213. package/dist/powerlines/src/types/plugin.cjs +249 -0
  214. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  215. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  216. package/dist/powerlines/src/types/plugin.mjs +240 -0
  217. package/dist/powerlines/src/types/resolved.cjs +153 -0
  218. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  219. package/dist/powerlines/src/types/resolved.d.mts +83 -0
  220. package/dist/powerlines/src/types/resolved.mjs +148 -0
  221. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  222. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  223. package/dist/powerlines/src/types/unplugin.cjs +1 -0
  224. package/dist/powerlines/src/types/unplugin.d.mts +7 -0
  225. package/dist/powerlines/src/types/unplugin.mjs +3 -0
  226. package/dist/types/index.cjs +10 -3
  227. package/dist/types/index.d.cts +2 -4
  228. package/dist/types/index.d.mts +2 -5
  229. package/dist/types/index.mjs +3 -4
  230. package/dist/types/plugin.cjs +133 -1
  231. package/dist/types/plugin.d.cts +156 -3
  232. package/dist/types/plugin.d.mts +158 -4
  233. package/dist/types/plugin.mjs +128 -2
  234. package/dist/types/runtime.cjs +242 -1
  235. package/dist/types/runtime.d.cts +793 -2
  236. package/dist/types/runtime.d.mts +793 -2
  237. package/dist/types/runtime.mjs +240 -2
  238. package/package.json +13 -9
  239. package/dist/components-C9bYrQVK.cjs +0 -0
  240. package/dist/components-CNIQFfeK.mjs +0 -1
  241. package/dist/create-reflection-resource-BNYxBgW2.mjs +0 -9846
  242. package/dist/create-reflection-resource-BWYhmX7O.cjs +0 -10085
  243. package/dist/docs-5r844zC1.d.mts +0 -9
  244. package/dist/docs-B66b9li3.mjs +0 -219
  245. package/dist/docs-_MmTNBQX.d.cts +0 -9
  246. package/dist/docs-hBlKCRWK.cjs +0 -224
  247. package/dist/env-BPodCdD1.d.cts +0 -116
  248. package/dist/env-IQvgnabX.mjs +0 -1578
  249. package/dist/env-cO4BUDn1.cjs +0 -1596
  250. package/dist/env-zhzvpUI5.d.mts +0 -98
  251. package/dist/index-BXxhKmeA.d.mts +0 -1
  252. package/dist/index-Cc7fCJU9.d.mts +0 -1
  253. package/dist/index-CqdNToYT.d.cts +0 -1
  254. package/dist/index-DWPDThxu.d.cts +0 -1
  255. package/dist/plugin-D3B5E_Hg.mjs +0 -1
  256. package/dist/plugin-D5qyQPqC.cjs +0 -0
  257. package/dist/resolved-BZG2cwRG.d.cts +0 -1789
  258. package/dist/resolved-V5COsfDu.d.mts +0 -1791
  259. package/dist/runtime-Bisl_1Ja.cjs +0 -0
  260. package/dist/runtime-Q8Ni8SeN.d.cts +0 -794
  261. package/dist/runtime-azNoeKr-.mjs +0 -1
  262. package/dist/runtime-qZ0Z2kEd.d.mts +0 -794
  263. package/dist/types-DwElXV6q.mjs +0 -1
  264. package/dist/types-MYBaygjr.cjs +0 -0
package/dist/index.cjs CHANGED
@@ -1,669 +1,47 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_create_reflection_resource = require('./create-reflection-resource-BWYhmX7O.cjs');
3
- const require_env = require('./env-cO4BUDn1.cjs');
4
- const require_docs = require('./docs-hBlKCRWK.cjs');
5
- require('./components-C9bYrQVK.cjs');
6
- require('./plugin-D5qyQPqC.cjs');
7
- require('./runtime-Bisl_1Ja.cjs');
8
- require('./types-MYBaygjr.cjs');
2
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
+ const require_index = require('./plugin-alloy/src/index.cjs');
4
+ const require_index$1 = require('./plugin-automd/src/index.cjs');
5
+ const require_index$2 = require('./plugin-babel/src/index.cjs');
6
+ const require_types_runtime = require('./types/runtime.cjs');
7
+ const require_types_plugin = require('./types/plugin.cjs');
8
+ const require_reflect = require('./helpers/reflect.cjs');
9
+ const require_persistence = require('./helpers/persistence.cjs');
10
+ const require_plugin = require('./babel/plugin.cjs');
11
+ const require_source_file_env = require('./helpers/source-file-env.cjs');
12
+ const require_load = require('./helpers/load.cjs');
13
+ const require_create_reflection_resource = require('./helpers/create-reflection-resource.cjs');
14
+ const require_components_env = require('./components/env.cjs');
15
+ const require_automd_generator = require('./helpers/automd-generator.cjs');
16
+ require('./babel/index.cjs');
17
+ const require_components_docs = require('./components/docs.cjs');
18
+ require('./components/index.cjs');
19
+ const require_template_helpers = require('./helpers/template-helpers.cjs');
20
+ require('./helpers/index.cjs');
21
+ require('./types/index.cjs');
9
22
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
10
23
  let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
11
- let __alloy_js_core = require("@alloy-js/core");
12
- let __alloy_js_rollup_plugin = require("@alloy-js/rollup-plugin");
13
- __alloy_js_rollup_plugin = require_create_reflection_resource.__toESM(__alloy_js_rollup_plugin);
14
- let __stryke_json_storm_json = require("@stryke/json/storm-json");
15
- let __stryke_path_replace = require("@stryke/path/replace");
16
24
  let __stryke_convert_to_array = require("@stryke/convert/to-array");
17
- let __stryke_fs_is_file = require("@stryke/fs/is-file");
18
- let __stryke_fs_list_files = require("@stryke/fs/list-files");
19
- let __stryke_path_append = require("@stryke/path/append");
20
- let __stryke_path_is_type = require("@stryke/path/is-type");
21
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
22
- let automd = require("automd");
23
- let c12 = require("c12");
24
25
  let defu = require("defu");
25
- defu = require_create_reflection_resource.__toESM(defu);
26
- let markdown_toc = require("markdown-toc");
27
- markdown_toc = require_create_reflection_resource.__toESM(markdown_toc);
28
- let __babel_core = require("@babel/core");
26
+ defu = require_rolldown_runtime.__toESM(defu);
29
27
  let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
30
- let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
31
28
  let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
32
- let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
33
- let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
34
- require("@stryke/type-checks/is-object");
35
- let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
36
- let chalk = require("chalk");
37
- chalk = require_create_reflection_resource.__toESM(chalk);
38
- let __babel_generator = require("@babel/generator");
39
- __babel_generator = require_create_reflection_resource.__toESM(__babel_generator);
40
- require("@babel/parser");
41
- let __babel_helper_plugin_utils = require("@babel/helper-plugin-utils");
42
- require("@storm-software/config-tools/logger");
43
- require("@storm-software/config-tools/utilities/colors");
44
- require("@stryke/helpers/noop");
45
- let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
46
29
  let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
47
- let __babel_types = require("@babel/types");
48
- __babel_types = require_create_reflection_resource.__toESM(__babel_types);
49
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
50
30
  let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
51
31
  let __stryke_env_types = require("@stryke/env/types");
52
32
  let __stryke_fs_exists = require("@stryke/fs/exists");
53
33
  let __stryke_fs_helpers = require("@stryke/fs/helpers");
54
34
  let __stryke_path_join = require("@stryke/path/join");
55
35
  let __stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
56
- let __stryke_capnp = require("@stryke/capnp");
57
- __stryke_capnp = require_create_reflection_resource.__toESM(__stryke_capnp);
58
- let __stryke_fs_buffer = require("@stryke/fs/buffer");
59
- let node_fs = require("node:fs");
60
36
 
61
- //#region ../plugin-alloy/src/core/components/output.tsx
62
- /**
63
- * Output component for rendering the Powerlines plugin's output files via templates.
64
- */
65
- function Output(props) {
66
- const [{ children, context, meta, basePath }, rest] = (0, __alloy_js_core.splitProps)(props, [
67
- "children",
68
- "context",
69
- "meta",
70
- "basePath"
71
- ]);
72
- const contextRef = (0, __alloy_js_core.ref)(context);
73
- const metaRef = (0, __alloy_js_core.ref)(meta ?? {});
74
- const basePathRef = (0, __alloy_js_core.computed)(() => basePath ? (0, __stryke_path_replace.replacePath)(basePath, contextRef.value.workspaceConfig.workspaceRoot) : contextRef.value.workspaceConfig.workspaceRoot);
75
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Output, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
76
- get basePath() {
77
- return basePathRef.value;
78
- },
79
- get children() {
80
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_create_reflection_resource.PowerlinesContext.Provider, {
81
- value: {
82
- ref: contextRef,
83
- meta: metaRef
84
- },
85
- get children() {
86
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
87
- get when() {
88
- return Boolean(contextRef.value);
89
- },
90
- children
91
- });
92
- }
93
- });
94
- }
95
- }));
96
- }
97
-
98
- //#endregion
99
- //#region ../plugin-alloy/src/index.tsx
100
- /**
101
- * Alloy-js plugin for Powerlines.
102
- *
103
- * @param options - The Alloy-js plugin user configuration options.
104
- * @returns A Powerlines plugin that integrates Alloy-js transformations.
105
- */
106
- const plugin$3 = (options = {}) => {
107
- return [{
108
- name: "alloy:config",
109
- config() {
110
- return {
111
- alloy: {
112
- typescript: true,
113
- ...options
114
- },
115
- build: {
116
- inputOptions: { transform: { jsx: {
117
- runtime: "classic",
118
- pragma: "Alloy.createElement",
119
- importSource: "@alloy-js/core"
120
- } } },
121
- plugins: [(0, __alloy_js_rollup_plugin.default)()]
122
- }
123
- };
124
- },
125
- async configResolved() {
126
- if (this.tsconfig.tsconfigJson.compilerOptions?.jsx !== "preserve" || this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource !== "@alloy-js/core") {
127
- this.tsconfig.tsconfigJson.compilerOptions ??= {};
128
- if (this.tsconfig.tsconfigJson.compilerOptions.jsx !== "preserve") this.tsconfig.tsconfigJson.compilerOptions.jsx = "preserve";
129
- if (this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource !== "@alloy-js/core") this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource = "@alloy-js/core";
130
- await this.fs.write(this.tsconfig.tsconfigFilePath, __stryke_json_storm_json.StormJSON.stringify(this.tsconfig.tsconfigJson));
131
- }
132
- this.dependencies["@alloy-js/core"] = "^0.22.0";
133
- if (this.config.alloy?.typescript !== false) this.dependencies["@alloy-js/typescript"] = "^0.22.0";
134
- if (this.config.alloy?.json === true) this.dependencies["@alloy-js/json"] = "^0.22.0";
135
- if (this.config.alloy?.markdown === true) this.dependencies["@alloy-js/markdown"] = "^0.22.0";
136
- }
137
- }, {
138
- name: "alloy:update-context",
139
- configResolved: {
140
- order: "pre",
141
- async handler() {
142
- this.render = async (children) => {
143
- const _self$ = this;
144
- const meta = {};
145
- await (0, __alloy_js_core.traverseOutput)(await (0, __alloy_js_core.renderAsync)((0, __alloy_js_core_jsx_runtime.createComponent)(Output, {
146
- context: _self$,
147
- meta,
148
- get basePath() {
149
- return _self$.workspaceConfig.workspaceRoot;
150
- },
151
- children
152
- })), {
153
- visitDirectory: (directory) => {
154
- if (this.fs.existsSync(directory.path)) return;
155
- this.fs.mkdirSync(directory.path);
156
- },
157
- visitFile: (file) => {
158
- if ("contents" in file) {
159
- const metadata = meta[file.path] ?? {};
160
- if (metadata.kind === "builtin") {
161
- if (!metadata.id) throw new Error(`Built-in file "${file.path}" is missing its ID in the render metadata.`);
162
- this.emitBuiltinSync(file.contents, metadata.id, file.path, {
163
- skipFormat: metadata.skipFormat,
164
- storage: metadata.storage
165
- });
166
- } else if (metadata.kind === "entry") this.emitEntrySync(file.contents, file.path, {
167
- skipFormat: metadata.skipFormat,
168
- storage: metadata.storage,
169
- ...metadata.typeDefinition ?? {}
170
- });
171
- else this.emitSync(file.contents, file.path, metadata);
172
- } else this.fs.copySync(file.sourcePath, file.path);
173
- }
174
- });
175
- };
176
- }
177
- }
178
- }];
179
- };
180
- var src_default$1 = plugin$3;
181
-
182
- //#endregion
183
- //#region ../plugin-automd/src/index.ts
184
- /**
185
- * AutoMD Plugin
186
- *
187
- * @remarks
188
- * A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
189
- *
190
- * @see https://automd.unjs.io/
191
- *
192
- * @param options - The plugin options.
193
- * @returns A Powerlines plugin instance.
194
- */
195
- const plugin$2 = (options = {}) => {
196
- return {
197
- name: "automd",
198
- async config() {
199
- const config = await (0, automd.loadConfig)((0, __stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot), options);
200
- if (!config.prefix || !Array.isArray(config.prefix)) config.prefix = (0, __stryke_convert_to_array.toArray)(config.prefix ?? []);
201
- if (!config.prefix.includes("automd")) config.prefix.push("automd");
202
- if (!config.prefix.includes("powerlines")) config.prefix.push("powerlines");
203
- return { automd: (0, defu.default)(config ?? {}, {
204
- configFile: options.configFile,
205
- allowIssues: true,
206
- dir: this.config.projectRoot,
207
- watch: false,
208
- input: "README.md",
209
- toc: {
210
- maxDepth: 6,
211
- bullets: "-"
212
- }
213
- }) };
214
- },
215
- async configResolved() {
216
- if (this.config.framework && !(0, __stryke_convert_to_array.toArray)(this.config.automd.prefix).includes(this.config.framework)) this.config.automd.prefix = (0, __stryke_convert_to_array.toArray)(this.config.automd.prefix).concat(this.config.framework);
217
- if (this.config.automd.configFile) {
218
- const { config } = await (0, c12.loadConfig)({
219
- cwd: this.config.automd.dir,
220
- configFile: this.config.automd.configFile,
221
- defaults: {
222
- ignore: [
223
- "**/node_modules",
224
- "**/dist",
225
- "**/.*"
226
- ],
227
- dir: this.config.automd.dir
228
- }
229
- });
230
- this.config.automd = (0, automd.resolveConfig)((0, defu.default)(this.config.automd, {
231
- ...config,
232
- prefix: (0, __stryke_convert_to_array.toArray)(config.prefix ?? [])
233
- }));
234
- }
235
- this.config.automd.input = (await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(async (input) => {
236
- if (input.includes("*")) return (0, __stryke_fs_list_files.listFiles)((0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot), { ignore: this.config.automd.ignore });
237
- return (0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot);
238
- }))).flat();
239
- if (this.config.automd.output && !(0, __stryke_path_is_type.isAbsolutePath)(this.config.automd.output)) this.config.automd.output = (0, __stryke_path_append.appendPath)(this.config.automd.output, this.config.projectRoot);
240
- this.config.automd.generators ??= {};
241
- if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
242
- name: "toc",
243
- generate: (ctx) => {
244
- const opts = this.config.automd.toc ?? {};
245
- return { contents: (0, markdown_toc.default)(ctx.block.md, {
246
- ...opts,
247
- maxdepth: opts.maxDepth,
248
- first1: opts.firstH1
249
- }).content };
250
- }
251
- };
252
- },
253
- async docs() {
254
- await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(async (input) => {
255
- const contents = await this.fs.read(input);
256
- if (contents) {
257
- const result = await (0, automd.transform)(contents, this.config.automd);
258
- if (result.hasIssues && this.config.automd.allowIssues === false) throw new Error(`AutoMD found issues in file "${input}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);
259
- if (result.hasChanged) await this.fs.write((0, __stryke_path_append.appendPath)(this.config.automd.output ? (0, __stryke_fs_is_file.isDirectory)(this.config.automd.output) ? (0, __stryke_path_replace.replacePath)(input, this.config.automd.output) : this.config.automd.output : input, this.config.projectRoot), result.contents);
260
- }
261
- }));
262
- }
263
- };
264
- };
265
- var src_default$2 = plugin$2;
266
-
267
- //#endregion
268
- //#region ../plugin-babel/src/helpers/filters.ts
269
- function getPluginName(plugin$4) {
270
- return (0, __stryke_type_checks_is_set_string.isSetString)(plugin$4) ? plugin$4 : Array.isArray(plugin$4) && plugin$4.length > 0 ? getPluginName(plugin$4[0]) : plugin$4.$$name || plugin$4.name ? plugin$4.$$name || plugin$4.name : void 0;
271
- }
272
- /**
273
- * Check if a Babel plugin is a duplicate of another plugin in the list.
274
- *
275
- * @param plugins - The list of existing Babel plugins.
276
- * @param plugin - The Babel plugin to check for duplicates.
277
- * @returns True if the plugin is a duplicate, false otherwise.
278
- */
279
- function isDuplicatePlugin(plugins, plugin$4) {
280
- return !!(getPluginName(plugin$4) && plugins.some((existing) => Array.isArray(existing) && getPluginName(existing[0]) === getPluginName(plugin$4)));
281
- }
282
-
283
- //#endregion
284
- //#region ../plugin-babel/src/helpers/options.ts
285
- function resolvePluginFunction(context, plugin$4) {
286
- try {
287
- return Array.isArray(plugin$4) && plugin$4.length > 0 && plugin$4[0] ? (0, __stryke_type_checks_is_function.isFunction)(plugin$4[0]) ? plugin$4[0](context) : plugin$4[0] : (0, __stryke_type_checks_is_function.isFunction)(plugin$4) ? plugin$4(context) : plugin$4;
288
- } catch {
289
- return plugin$4[0];
290
- }
291
- }
292
- /**
293
- * Resolve the [Babel](https://babeljs.io/) plugin.
294
- *
295
- * @param context - The context for the transformation.
296
- * @param code - The code to be transformed.
297
- * @param id - The ID of the source file.
298
- * @param plugin - The Babel plugin to resolve.
299
- * @returns The resolved Babel plugin options, or undefined if the plugin is filtered out.
300
- */
301
- function resolveBabelPlugin(context, code, id, plugin$4) {
302
- if (Array.isArray(plugin$4) && plugin$4.length > 0 && plugin$4[0]) {
303
- if (plugin$4.length > 2 && plugin$4[2] && (0, __stryke_type_checks_is_function.isFunction)(plugin$4[2]) && !plugin$4[2](code, id)) {
304
- context.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Skipping filtered Babel plugin ${chalk.default.bold.cyanBright(getPluginName(plugin$4) || "unnamed")} for ${id}`);
305
- return;
306
- }
307
- return plugin$4.length > 2 ? [
308
- resolvePluginFunction(context, plugin$4),
309
- plugin$4[1],
310
- plugin$4[2]
311
- ] : [
312
- resolvePluginFunction(context, plugin$4),
313
- plugin$4[1],
314
- null
315
- ];
316
- }
317
- return [
318
- resolvePluginFunction(context, plugin$4),
319
- {},
320
- null
321
- ];
322
- }
323
-
324
- //#endregion
325
- //#region ../plugin-babel/src/helpers/ast-utils.ts
326
- let generate = __babel_generator.default;
327
- if ("default" in generate) generate = generate.default;
328
-
329
- //#endregion
330
- //#region ../powerlines/src/lib/logger.ts
331
- const BADGE_COLORS = [
332
- "#00A0DD",
333
- "#6FCE4E",
334
- "#FBBF24",
335
- "#F43F5E",
336
- "#3B82F6",
337
- "#A855F7",
338
- "#469592",
339
- "#288EDF",
340
- "#D8B4FE",
341
- "#10B981",
342
- "#EF4444",
343
- "#F0EC56",
344
- "#F472B6",
345
- "#22D3EE",
346
- "#EAB308",
347
- "#84CC16",
348
- "#F87171",
349
- "#0EA5E9",
350
- "#D946EF",
351
- "#FACC15",
352
- "#34D399",
353
- "#8B5CF6"
354
- ];
355
- const extendLog = (logFn, name) => {
356
- return (type, ...args) => logFn(type, ` ${chalk.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${(0, __stryke_string_format_title_case.titleCase)(name)} `)} ${args.join(" ")} `);
357
- };
358
-
359
- //#endregion
360
- //#region ../plugin-babel/src/helpers/create-plugin.ts
361
- /**
362
- * Create a Babel plugin using the provided builder function.
363
- *
364
- * @param name - The name of the plugin.
365
- * @param builder - The builder function that defines the plugin behavior.
366
- * @returns A Babel plugin declaration.
367
- */
368
- function createBabelPlugin(name, builder) {
369
- const plugin$4 = (context) => {
370
- return (0, __babel_helper_plugin_utils.declare)((api, options, dirname) => {
371
- api.cache.using(() => context.meta.checksum);
372
- api.assertVersion("^7.0.0-0");
373
- const log = extendLog(context.log, name);
374
- log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Initializing the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
375
- const result = builder({
376
- log,
377
- name,
378
- api,
379
- options,
380
- context,
381
- dirname
382
- });
383
- result.name = name;
384
- log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Completed initialization of the ${chalk.default.bold.cyanBright(name)} Babel plugin`);
385
- return result;
386
- });
387
- };
388
- plugin$4.$$name = name;
389
- return plugin$4;
390
- }
391
-
392
- //#endregion
393
- //#region ../plugin-babel/src/helpers/module-helpers.ts
394
- /**
395
- * Adds an import to the program if it doesn't already exist.
396
- *
397
- * @param path - The current NodePath in the AST.
398
- * @param specifier - The import specifier.
399
- */
400
- function addImport(path, specifier) {
401
- addImportsToProgram(path.scope.getProgramParent().path, specifier);
402
- }
403
- function isNonNamespacedImport(importDeclPath) {
404
- return importDeclPath.get("specifiers").filter(Boolean).every((specifier) => specifier?.isImportSpecifier()) && importDeclPath.node.importKind !== "type" && importDeclPath.node.importKind !== "typeof";
405
- }
406
- function getExistingImports(program) {
407
- const existingImports = /* @__PURE__ */ new Map();
408
- program.traverse({ ImportDeclaration(path) {
409
- if (isNonNamespacedImport(path)) existingImports.set(path.node.source.value, path);
410
- } });
411
- return existingImports;
412
- }
413
- function addImportsToProgram(path, specifier) {
414
- /**
415
- * If an existing import of this module exists (ie \`import \{ ... \} from
416
- * '<moduleName>'\`), inject new imported specifiers into the list of
417
- * destructured variables.
418
- */
419
- if (!getExistingImports(path).get(specifier.module)) path.unshiftContainer("body", __babel_types.importDeclaration([__babel_types.importSpecifier(__babel_types.identifier(specifier.name || specifier.imported), __babel_types.identifier(specifier.imported))], __babel_types.stringLiteral(specifier.module)));
420
- }
421
-
422
- //#endregion
423
- //#region ../plugin-babel/src/index.ts
424
- /**
425
- * Babel plugin for Powerlines.
426
- *
427
- * @param options - The Babel plugin user configuration options.
428
- * @returns A Powerlines plugin that integrates Babel transformations.
429
- */
430
- const plugin$1 = (options = {}) => {
431
- return {
432
- name: "babel",
433
- config() {
434
- if (!(0, __stryke_type_checks_is_set_object.isSetObject)(options)) return;
435
- return { transform: { babel: options } };
436
- },
437
- configResolved: {
438
- order: "pre",
439
- handler() {
440
- this.devDependencies["@babel/core"] = "^7.28.4";
441
- this.config.transform.babel = (0, defu.default)(this.config.transform.babel ?? {}, {
442
- plugins: [],
443
- presets: []
444
- });
445
- }
446
- },
447
- async transform(code, id) {
448
- if ((0, __stryke_path_is_parent_path.isParentPath)(id, this.powerlinesPath) || code.includes("/* @storm-ignore */") || code.includes("/* @storm-disable */")) {
449
- this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Skipping Babel transformation for: ${id}`);
450
- return {
451
- code,
452
- id
453
- };
454
- }
455
- this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Babel transforming file: ${id}`);
456
- const plugins = this.config.transform.babel.plugins.map((plugin$4) => resolveBabelPlugin(this, code, id, plugin$4)).filter((plugin$4, _, arr) => plugin$4 && !isDuplicatePlugin(arr, plugin$4));
457
- const presets = this.config.transform.babel.presets.map((preset) => resolveBabelPlugin(this, code, id, preset)).filter((preset, _, arr) => preset && !isDuplicatePlugin(arr, preset));
458
- if (Array.isArray(plugins) && plugins.length === 0 && Array.isArray(presets) && presets.length === 0) return {
459
- code,
460
- id
461
- };
462
- if ([
463
- "ts",
464
- "cts",
465
- "mts",
466
- "tsx"
467
- ].includes((0, __stryke_path_file_path_fns.findFileExtensionSafe)(id)) && !isDuplicatePlugin(plugins, "@babel/plugin-syntax-typescript") && !isDuplicatePlugin(presets, "@babel/preset-typescript")) plugins.unshift(["@babel/plugin-syntax-typescript", { isTSX: (0, __stryke_path_file_path_fns.findFileExtension)(id) === ".tsx" }]);
468
- const result = await (0, __babel_core.transformAsync)(code, {
469
- highlightCode: true,
470
- code: true,
471
- ast: false,
472
- cloneInputAst: false,
473
- comments: true,
474
- sourceType: "module",
475
- configFile: false,
476
- babelrc: false,
477
- envName: this.config.mode,
478
- caller: { name: this.config.framework },
479
- ...this.config.transform.babel ?? {},
480
- filename: id,
481
- plugins: plugins.map((plugin$4) => {
482
- return Array.isArray(plugin$4) && plugin$4.length >= 2 ? [plugin$4[0], (0, defu.default)(plugin$4.length > 1 && plugin$4[1] ? plugin$4[1] : {}, { options })] : plugin$4;
483
- }).filter(Boolean),
484
- presets: presets.map((preset) => {
485
- return Array.isArray(preset) && preset.length >= 2 ? [preset[0], (0, defu.default)(preset.length > 1 && preset[1] ? preset[1] : {}, { options })] : preset;
486
- }).filter(Boolean)
487
- });
488
- if (!result?.code) throw new Error(`Powerlines - Babel plugin failed to compile ${id}`);
489
- return {
490
- code: result.code,
491
- id
492
- };
493
- }
494
- };
495
- };
496
- var src_default$3 = plugin$1;
497
-
498
- //#endregion
499
- //#region src/babel/plugin.ts
500
- const envBabelPlugin = createBabelPlugin("env", ({ log, context }) => {
501
- function extractEnv(node, pass, isInjectable = false) {
502
- const envTypesAliasProperties = context.env.types.env?.getProperties().filter((prop) => prop.getAlias().length > 0);
503
- if (node.name) {
504
- 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}_`, "")))));
505
- let name = node.name;
506
- if (prefix) name = node.name.replace(`${prefix}_`, "");
507
- log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
508
- if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some((prop) => prop.getAlias().includes(name))) {
509
- const envProperty = context.env.types.env.hasProperty(name) ? context.env.types.env.getProperty(name) : envTypesAliasProperties.find((prop) => prop.getAlias().includes(name));
510
- if (!envProperty || envProperty.isIgnored()) return;
511
- if (!context.env.used.env.hasProperty(name)) context.env.used.env.addProperty(envProperty.property);
512
- if (context.config.env.inject && isInjectable) {
513
- let value = context.env.parsed?.[name];
514
- if (value === void 0) {
515
- const prefix$1 = context.config.env.prefix.find((pre) => {
516
- return context.env.parsed[`${pre.replace(/_$/g, "")}_${name}`];
517
- });
518
- if (prefix$1) value = context.env.parsed[`${prefix$1.replace(/_$/g, "")}_${name}`];
519
- }
520
- value ??= envProperty.getDefaultValue();
521
- if (envProperty.isValueRequired() && value === void 0) throw new Error(`Environment variable \`${name}\` is not defined in the .env configuration files`);
522
- return require_env.stringifyDefaultValue(envProperty, value);
523
- }
524
- } 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"}.
525
-
526
- 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`);
527
- }
528
- }
529
- return {
530
- visitor: { MemberExpression(path, pass) {
531
- if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "$storm" }) && path.get("property")?.isIdentifier()) {
532
- const identifier = path.get("property")?.node;
533
- extractEnv(identifier, pass, false);
534
- path.replaceWithSourceString(`env.${identifier.name}`);
535
- addImport(path, {
536
- module: "storm:env",
537
- name: "env",
538
- imported: "env"
539
- });
540
- } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isCallExpression({ callee: {
541
- name: "useStorm",
542
- type: "Identifier"
543
- } }) && path.get("property")?.isIdentifier()) {
544
- const identifier = path.get("property")?.node;
545
- extractEnv(identifier, pass, false);
546
- path.replaceWithSourceString(`env.${identifier.name}`);
547
- addImport(path, {
548
- module: "storm:env",
549
- name: "env",
550
- imported: "env"
551
- });
552
- } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isIdentifier({ name: "process" }) && path.get("property")?.isIdentifier()) {
553
- const identifier = path.get("property")?.node;
554
- if (!identifier.name) return;
555
- extractEnv(identifier, pass, false);
556
- path.replaceWithSourceString(`env.${identifier.name}`);
557
- addImport(path, {
558
- module: "storm:env",
559
- name: "env",
560
- imported: "env"
561
- });
562
- } else if (path.get("object")?.get("property")?.isIdentifier({ name: "env" }) && path.get("object")?.get("object")?.isMetaProperty() && path.get("property")?.isIdentifier()) {
563
- const identifier = path.get("property")?.node;
564
- if (!identifier.name) return;
565
- extractEnv(identifier, pass, false);
566
- path.replaceWithSourceString(`env.${identifier.name}`);
567
- addImport(path, {
568
- module: "storm:env",
569
- name: "env",
570
- imported: "env"
571
- });
572
- }
573
- } },
574
- post() {
575
- log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Adding environment variables from ${this.filename || "unknown file"} to env.json.`);
576
- let persistedEnv = __powerlines_deepkit_vendor_type.ReflectionClass.from({
577
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
578
- description: `An object containing the environment variables used by the application.`,
579
- types: []
580
- });
581
- const reflectionPath = require_create_reflection_resource.getEnvReflectionsPath(context, "env");
582
- if (reflectionPath && (0, node_fs.existsSync)(reflectionPath)) {
583
- log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment reflection file found at ${reflectionPath}, reading existing reflection.`);
584
- persistedEnv = (0, __powerlines_deepkit_vendor_type.resolveClassType)((0, __powerlines_deepkit_vendor_type.deserializeType)(require_create_reflection_resource.convertFromCapnp(new __stryke_capnp.Message((0, __stryke_fs_buffer.readFileBufferSync)(reflectionPath), false).getRoot(require_create_reflection_resource.SerializedTypes).types)));
585
- }
586
- log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Adding new variables to env reflection at ${reflectionPath}.`);
587
- persistedEnv.getProperties().filter((property) => property.getNameAsString() && !context.env.used.env.hasProperty(property.getNameAsString())).forEach((property) => {
588
- context.env.used.env.addProperty({
589
- ...property,
590
- name: property.getNameAsString(),
591
- description: property.getDescription() ?? `The ${property.getNameAsString()} variable.`,
592
- default: property.getDefaultValue(),
593
- optional: property.isOptional() ? true : void 0,
594
- readonly: property.isReadonly() ? true : void 0,
595
- visibility: property.getVisibility(),
596
- type: property.getType(),
597
- tags: property.getTags()
598
- });
599
- });
600
- }
601
- };
602
- });
603
-
604
- //#endregion
605
- //#region src/helpers/automd-generator.ts
606
- /**
607
- * AutoMD generator to generate environment variable documentation
608
- *
609
- * @param context - The generator context.
610
- * @returns The generated documentation content.
611
- */
612
- const env = (context) => (0, automd.defineGenerator)({
613
- name: "env",
614
- async generate() {
615
- const envDocFile = (0, __stryke_path_join_paths.joinPaths)(context.config.projectRoot, "docs", "generated", "env.md");
616
- if (!context.fs.existsSync(envDocFile)) return { contents: "" };
617
- return { contents: await context.fs.read(envDocFile) || "" };
618
- }
619
- });
620
-
621
- //#endregion
622
- //#region src/helpers/template-helpers.ts
623
- /**
624
- * Creates the reflection data used when generating runtime template files.
625
- *
626
- * @param context - The context for the configuration plugin.
627
- * @param name - The name of the configuration template.
628
- * @returns The reflection for the specified configuration template.
629
- */
630
- async function createTemplateReflection(context, name) {
631
- const reflection = await require_create_reflection_resource.readEnvTypeReflection(context, name);
632
- reflection.getProperties().forEach((prop) => {
633
- prop.getAlias().filter(Boolean).forEach((alias) => {
634
- reflection.addProperty({
635
- name: alias,
636
- optional: prop.isOptional() ? true : void 0,
637
- readonly: prop.isReadonly() ? true : void 0,
638
- description: prop.getDescription(),
639
- visibility: prop.getVisibility(),
640
- type: prop.getType(),
641
- default: prop.getDefaultValue(),
642
- tags: {
643
- hidden: prop.isHidden(),
644
- ignore: prop.isIgnored(),
645
- internal: prop.isInternal(),
646
- alias: prop.getAlias().filter((a) => a !== alias).concat(prop.name),
647
- title: prop.getTitle() || (0, __stryke_string_format_title_case.titleCase)(prop.name),
648
- readonly: prop.isReadonly(),
649
- permission: prop.getPermission(),
650
- domain: prop.getDomain()
651
- }
652
- });
653
- });
654
- });
655
- return reflection;
656
- }
657
-
658
- //#endregion
659
37
  //#region src/index.tsx
660
38
  /**
661
39
  * A Powerlines plugin to inject environment variables into the source code.
662
40
  */
663
41
  const plugin = (options = {}) => {
664
42
  return [
665
- src_default$1(options.alloy),
666
- src_default$3(options.babel),
43
+ require_index.default(options.alloy),
44
+ require_index$2.default(options.babel),
667
45
  {
668
46
  name: "env",
669
47
  async config() {
@@ -673,17 +51,17 @@ const plugin = (options = {}) => {
673
51
  types: {},
674
52
  prefix: []
675
53
  }),
676
- transform: { babel: { plugins: [envBabelPlugin] } }
54
+ transform: { babel: { plugins: [require_plugin.envBabelPlugin] } }
677
55
  };
678
56
  if (config.env.types) config.env.types = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(config.env.types);
679
57
  else {
680
58
  this.log(__storm_software_config_tools_types.LogLevelLabel.WARN, "The `env.types` configuration parameter was not provided. Please ensure this is expected.");
681
- const envDefaultTypeDefinition = await require_create_reflection_resource.getEnvDefaultTypeDefinition(this);
59
+ const envDefaultTypeDefinition = await require_persistence.getEnvDefaultTypeDefinition(this);
682
60
  config.env.types = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(`${envDefaultTypeDefinition.file}#${envDefaultTypeDefinition.name}`);
683
61
  }
684
62
  if (config.env.secrets) config.env.secrets = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(config.env.secrets);
685
63
  else {
686
- const secretsDefaultTypeDefinition = await require_create_reflection_resource.getSecretsDefaultTypeDefinition(this);
64
+ const secretsDefaultTypeDefinition = await require_persistence.getSecretsDefaultTypeDefinition(this);
687
65
  config.env.secrets = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(`${secretsDefaultTypeDefinition.file}#${secretsDefaultTypeDefinition.name}`);
688
66
  }
689
67
  config.env.prefix = (0, __stryke_convert_to_array.toArray)(config.env.prefix ?? []).reduce((ret, prefix) => {
@@ -700,7 +78,7 @@ const plugin = (options = {}) => {
700
78
  async configResolved() {
701
79
  this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment plugin configuration has been resolved for the Powerlines project.`);
702
80
  this.config.env.inject ??= this.config.projectType === "application";
703
- this.env = (0, defu.default)({ parsed: await require_create_reflection_resource.loadEnv(this, this.config.env) }, this.env ?? {}, {
81
+ this.env = (0, defu.default)({ parsed: await require_load.loadEnv(this, this.config.env) }, this.env ?? {}, {
704
82
  types: { env: {} },
705
83
  used: {
706
84
  env: {},
@@ -709,22 +87,22 @@ const plugin = (options = {}) => {
709
87
  parsed: {},
710
88
  injected: {}
711
89
  });
712
- if (this.config.command !== "prepare" && this.persistedMeta?.checksum === this.meta.checksum && (0, __stryke_fs_exists.existsSync)(require_create_reflection_resource.getEnvTypeReflectionsPath(this, "env"))) {
90
+ if (this.config.command !== "prepare" && this.persistedMeta?.checksum === this.meta.checksum && (0, __stryke_fs_exists.existsSync)(require_persistence.getEnvTypeReflectionsPath(this, "env"))) {
713
91
  this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Skipping reflection initialization as the meta checksum has not changed.`);
714
- this.env.types.env = await require_create_reflection_resource.readEnvTypeReflection(this, "env");
715
- if ((0, __stryke_fs_exists.existsSync)(require_create_reflection_resource.getEnvReflectionsPath(this, "env"))) this.env.used.env = await require_create_reflection_resource.readEnvReflection(this);
716
- if ((0, __stryke_fs_exists.existsSync)(require_create_reflection_resource.getEnvTypeReflectionsPath(this, "secrets"))) this.env.types.secrets = await require_create_reflection_resource.readEnvTypeReflection(this, "secrets");
717
- if ((0, __stryke_fs_exists.existsSync)(require_create_reflection_resource.getEnvReflectionsPath(this, "secrets"))) this.env.used.secrets = await require_create_reflection_resource.readSecretsReflection(this);
92
+ this.env.types.env = await require_persistence.readEnvTypeReflection(this, "env");
93
+ if ((0, __stryke_fs_exists.existsSync)(require_persistence.getEnvReflectionsPath(this, "env"))) this.env.used.env = await require_persistence.readEnvReflection(this);
94
+ if ((0, __stryke_fs_exists.existsSync)(require_persistence.getEnvTypeReflectionsPath(this, "secrets"))) this.env.types.secrets = await require_persistence.readEnvTypeReflection(this, "secrets");
95
+ if ((0, __stryke_fs_exists.existsSync)(require_persistence.getEnvReflectionsPath(this, "secrets"))) this.env.used.secrets = await require_persistence.readSecretsReflection(this);
718
96
  } else {
719
- this.env.types.env = await require_create_reflection_resource.reflectEnv(this, this.config.env.types?.file ? (0, __stryke_path_is_parent_path.isParentPath)(this.config.env.types?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.types?.file : (0, __stryke_path_join.joinPaths)(this.config.projectRoot, this.config.env.types?.file) : void 0, this.config.env.types?.name);
97
+ this.env.types.env = await require_reflect.reflectEnv(this, this.config.env.types?.file ? (0, __stryke_path_is_parent_path.isParentPath)(this.config.env.types?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.types?.file : (0, __stryke_path_join.joinPaths)(this.config.projectRoot, this.config.env.types?.file) : void 0, this.config.env.types?.name);
720
98
  if (!this.env.types.env) throw new Error("Failed to find the environment configuration type reflection in the context.");
721
- await require_create_reflection_resource.writeEnvTypeReflection(this, this.env.types.env, "env");
722
- this.env.types.secrets = await require_create_reflection_resource.reflectSecrets(this, this.config.env.secrets?.file ? (0, __stryke_path_is_parent_path.isParentPath)(this.config.env.secrets?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.secrets?.file : (0, __stryke_path_join.joinPaths)(this.config.projectRoot, this.config.env.secrets?.file) : void 0, this.config.env.secrets?.name);
99
+ await require_persistence.writeEnvTypeReflection(this, this.env.types.env, "env");
100
+ this.env.types.secrets = await require_reflect.reflectSecrets(this, this.config.env.secrets?.file ? (0, __stryke_path_is_parent_path.isParentPath)(this.config.env.secrets?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.secrets?.file : (0, __stryke_path_join.joinPaths)(this.config.projectRoot, this.config.env.secrets?.file) : void 0, this.config.env.secrets?.name);
723
101
  if (!this.env.types.secrets) throw new Error("Failed to find the secrets configuration type reflection in the context.");
724
- await require_create_reflection_resource.writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
102
+ await require_persistence.writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
725
103
  this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Resolved ${this.env.types.env.getProperties().length ?? 0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length ?? 0} secret configuration parameters`);
726
104
  const envWithAlias = this.env.types.env.getProperties().filter((prop) => prop.getAlias().length > 0);
727
- Object.entries(await require_create_reflection_resource.loadEnv(this, this.config.env)).forEach(([key, value]) => {
105
+ Object.entries(await require_load.loadEnv(this, this.config.env)).forEach(([key, value]) => {
728
106
  const unprefixedKey = this.config.env.prefix.reduce((ret, prefix) => {
729
107
  if (key.replace(/_$/g, "").startsWith(prefix)) return key.replace(/_$/g, "").slice(prefix.length);
730
108
  return ret;
@@ -738,23 +116,23 @@ const plugin = (options = {}) => {
738
116
  description: `An object containing the environment configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
739
117
  types: []
740
118
  }, this.env.types.env);
741
- await require_create_reflection_resource.writeEnvReflection(this, this.env.used.env, "env");
119
+ await require_persistence.writeEnvReflection(this, this.env.used.env, "env");
742
120
  if (this.env.types.secrets) {
743
- await require_create_reflection_resource.writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
121
+ await require_persistence.writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
744
122
  this.env.used.secrets = new __powerlines_deepkit_vendor_type.ReflectionClass({
745
123
  kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
746
124
  typeName: "Secrets",
747
125
  description: `An object containing the secret configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
748
126
  types: []
749
127
  }, this.env.types.secrets);
750
- await require_create_reflection_resource.writeEnvReflection(this, this.env.used.secrets, "secrets");
128
+ await require_persistence.writeEnvReflection(this, this.env.used.secrets, "secrets");
751
129
  }
752
130
  }
753
131
  },
754
132
  async prepare() {
755
133
  const _self$ = this;
756
134
  this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Preparing the Environment runtime artifacts for the Powerlines project.`);
757
- return this.render((0, __alloy_js_core_jsx_runtime.createComponent)(require_env.EnvBuiltin, { get defaultConfig() {
135
+ return this.render((0, __alloy_js_core_jsx_runtime.createComponent)(require_components_env.EnvBuiltin, { get defaultConfig() {
758
136
  return _self$.config.env.defaultConfig;
759
137
  } }));
760
138
  },
@@ -762,7 +140,7 @@ const plugin = (options = {}) => {
762
140
  this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, "Writing Environment documentation for the Powerlines project artifacts.");
763
141
  const outputPath = (0, __stryke_path_join.joinPaths)(this.config.projectRoot, "docs", "generated");
764
142
  if (!(0, __stryke_fs_exists.existsSync)(outputPath)) await (0, __stryke_fs_helpers.createDirectory)(outputPath);
765
- const reflection = await require_create_reflection_resource.readEnvTypeReflection(this, "env");
143
+ const reflection = await require_persistence.readEnvTypeReflection(this, "env");
766
144
  const envDocFile = (0, __stryke_path_join.joinPaths)(outputPath, "env.md");
767
145
  this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Documenting environment variables configuration in "${envDocFile}"`);
768
146
  await this.fs.write(envDocFile, `<!-- Generated by ${(0, __stryke_string_format_title_case.titleCase)(this.config.framework) || "Powerlines"} -->
@@ -777,15 +155,15 @@ ${reflection.getProperties().filter((property) => property.getNameAsString() !==
777
155
  `);
778
156
  },
779
157
  async buildEnd() {
780
- const reflectionPath = require_create_reflection_resource.getEnvReflectionsPath(this, "env");
158
+ const reflectionPath = require_persistence.getEnvReflectionsPath(this, "env");
781
159
  this.log(__storm_software_config_tools_types.LogLevelLabel.TRACE, `Writing env reflection types to ${reflectionPath}.`);
782
- await require_create_reflection_resource.writeEnvReflection(this, this.env.used.env, "env");
160
+ await require_persistence.writeEnvReflection(this, this.env.used.env, "env");
783
161
  }
784
162
  },
785
163
  {
786
164
  name: "env:automd-generator",
787
165
  config() {
788
- return { automd: (0, defu.default)(options.automd ?? {}, { generators: { "env": env(this) } }) };
166
+ return { automd: (0, defu.default)(options.automd ?? {}, { generators: { "env": require_automd_generator.env(this) } }) };
789
167
  }
790
168
  },
791
169
  {
@@ -794,40 +172,48 @@ ${reflection.getProperties().filter((property) => property.getNameAsString() !==
794
172
  return { envPrefix: this.config?.env?.prefix };
795
173
  } }
796
174
  },
797
- src_default$2(options.automd)
175
+ require_index$1.default(options.automd)
798
176
  ];
799
177
  };
800
178
  var src_default = plugin;
801
179
 
802
180
  //#endregion
803
- exports.BaseEnv = require_create_reflection_resource.BaseEnv;
804
- exports.BaseSecrets = require_create_reflection_resource.BaseSecrets;
805
- exports.EnvBuiltin = require_env.EnvBuiltin;
806
- exports.EnvDocs = require_docs.EnvDocs;
807
- exports.EnvTypeDefinition = require_env.EnvTypeDefinition;
808
- exports.createEnvReflection = require_create_reflection_resource.createEnvReflection;
181
+ exports.BaseEnv = require_reflect.BaseEnv;
182
+ exports.BaseSecrets = require_reflect.BaseSecrets;
183
+ exports.EnvBuiltin = require_components_env.EnvBuiltin;
184
+ exports.EnvDocs = require_components_docs.EnvDocs;
185
+ exports.EnvTypeDefinition = require_components_env.EnvTypeDefinition;
186
+ exports.__ΩCreateEnvReflectionOptions = require_reflect.__ΩCreateEnvReflectionOptions;
187
+ exports.__ΩEnvInterface = require_types_runtime.__ΩEnvInterface;
188
+ exports.__ΩEnvPluginContext = require_types_plugin.__ΩEnvPluginContext;
189
+ exports.__ΩEnvPluginOptions = require_types_plugin.__ΩEnvPluginOptions;
190
+ exports.__ΩEnvPluginResolvedConfig = require_types_plugin.__ΩEnvPluginResolvedConfig;
191
+ exports.__ΩEnvPluginUserConfig = require_types_plugin.__ΩEnvPluginUserConfig;
192
+ exports.__ΩEnvType = require_types_plugin.__ΩEnvType;
193
+ exports.__ΩSecretsInterface = require_types_runtime.__ΩSecretsInterface;
194
+ exports.createEnvReflection = require_reflect.createEnvReflection;
809
195
  exports.createReflectionResource = require_create_reflection_resource.createReflectionResource;
810
- exports.createSecretsReflection = require_create_reflection_resource.createSecretsReflection;
811
- exports.createTemplateReflection = createTemplateReflection;
196
+ exports.createSecretsReflection = require_reflect.createSecretsReflection;
197
+ exports.createTemplateReflection = require_template_helpers.createTemplateReflection;
812
198
  exports.default = src_default;
813
- exports.envBabelPlugin = envBabelPlugin;
814
- exports.formatEnvField = require_create_reflection_resource.formatEnvField;
815
- exports.getEnvDefaultTypeDefinition = require_create_reflection_resource.getEnvDefaultTypeDefinition;
816
- exports.getEnvReflectionsPath = require_create_reflection_resource.getEnvReflectionsPath;
817
- exports.getEnvTypeReflectionsPath = require_create_reflection_resource.getEnvTypeReflectionsPath;
818
- exports.getSecretsDefaultTypeDefinition = require_create_reflection_resource.getSecretsDefaultTypeDefinition;
819
- exports.loadEnv = require_create_reflection_resource.loadEnv;
820
- exports.loadEnvFromContext = require_create_reflection_resource.loadEnvFromContext;
821
- exports.mergeEnvReflections = require_create_reflection_resource.mergeEnvReflections;
822
- exports.mergeSecretsReflections = require_create_reflection_resource.mergeSecretsReflections;
199
+ exports.envBabelPlugin = require_plugin.envBabelPlugin;
200
+ exports.formatEnvField = require_source_file_env.formatEnvField;
201
+ exports.getEnvDefaultTypeDefinition = require_persistence.getEnvDefaultTypeDefinition;
202
+ exports.getEnvReflectionsPath = require_persistence.getEnvReflectionsPath;
203
+ exports.getEnvTypeReflectionsPath = require_persistence.getEnvTypeReflectionsPath;
204
+ exports.getSecretsDefaultTypeDefinition = require_persistence.getSecretsDefaultTypeDefinition;
205
+ exports.loadEnv = require_load.loadEnv;
206
+ exports.loadEnvFromContext = require_load.loadEnvFromContext;
207
+ exports.mergeEnvReflections = require_reflect.mergeEnvReflections;
208
+ exports.mergeSecretsReflections = require_reflect.mergeSecretsReflections;
823
209
  exports.plugin = plugin;
824
- exports.readEnvReflection = require_create_reflection_resource.readEnvReflection;
825
- exports.readEnvTypeReflection = require_create_reflection_resource.readEnvTypeReflection;
826
- exports.readSecretsReflection = require_create_reflection_resource.readSecretsReflection;
827
- exports.reflectEnv = require_create_reflection_resource.reflectEnv;
828
- exports.reflectSecrets = require_create_reflection_resource.reflectSecrets;
829
- exports.removeEnvPrefix = require_create_reflection_resource.removeEnvPrefix;
830
- exports.resolveRuntimeTypeFile = require_create_reflection_resource.resolveRuntimeTypeFile;
831
- exports.writeEnvReflection = require_create_reflection_resource.writeEnvReflection;
832
- exports.writeEnvReflectionSync = require_create_reflection_resource.writeEnvReflectionSync;
833
- exports.writeEnvTypeReflection = require_create_reflection_resource.writeEnvTypeReflection;
210
+ exports.readEnvReflection = require_persistence.readEnvReflection;
211
+ exports.readEnvTypeReflection = require_persistence.readEnvTypeReflection;
212
+ exports.readSecretsReflection = require_persistence.readSecretsReflection;
213
+ exports.reflectEnv = require_reflect.reflectEnv;
214
+ exports.reflectSecrets = require_reflect.reflectSecrets;
215
+ exports.removeEnvPrefix = require_source_file_env.removeEnvPrefix;
216
+ exports.resolveRuntimeTypeFile = require_persistence.resolveRuntimeTypeFile;
217
+ exports.writeEnvReflection = require_persistence.writeEnvReflection;
218
+ exports.writeEnvReflectionSync = require_persistence.writeEnvReflectionSync;
219
+ exports.writeEnvTypeReflection = require_persistence.writeEnvTypeReflection;