@powerlines/plugin-env 0.14.8 → 0.14.10

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 (245) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +1 -0
  2. package/dist/{chunk-D1UamjDs.mjs → _virtual/rolldown_runtime.mjs} +1 -1
  3. package/dist/babel/index.cjs +1 -0
  4. package/dist/babel/index.d.cts +1 -0
  5. package/dist/babel/index.d.mts +1 -0
  6. package/dist/babel/index.mjs +1 -0
  7. package/dist/babel/plugin.cjs +5 -0
  8. package/dist/babel/plugin.d.cts +8 -0
  9. package/dist/babel/plugin.d.mts +8 -0
  10. package/dist/babel/plugin.mjs +5 -0
  11. package/dist/components/docs.cjs +1 -1
  12. package/dist/components/docs.d.cts +8 -1
  13. package/dist/components/docs.d.mts +8 -1
  14. package/dist/components/docs.mjs +1 -1
  15. package/dist/components/env.cjs +34 -1
  16. package/dist/components/env.d.cts +19 -1
  17. package/dist/components/env.d.mts +19 -1
  18. package/dist/components/env.mjs +31 -1
  19. package/dist/components/index.cjs +1 -1
  20. package/dist/components/index.d.cts +2 -3
  21. package/dist/components/index.d.mts +2 -3
  22. package/dist/components/index.mjs +1 -1
  23. package/dist/deepkit/schemas/reflection.cjs +1 -0
  24. package/dist/{plugin-vBgCrEuY.d.cts → deepkit/schemas/reflection.d.cts} +1 -260
  25. package/dist/{plugin-D9GLc9S_.d.mts → deepkit/schemas/reflection.d.mts} +1 -261
  26. package/dist/deepkit/schemas/reflection.mjs +1 -0
  27. package/dist/deepkit/schemas/reflection2.cjs +1 -0
  28. package/dist/deepkit/schemas/reflection2.mjs +1 -0
  29. package/dist/deepkit/src/capnp.cjs +1 -0
  30. package/dist/deepkit/src/capnp.mjs +1 -0
  31. package/dist/deepkit/src/esbuild-plugin.cjs +4 -0
  32. package/dist/deepkit/src/esbuild-plugin.mjs +4 -0
  33. package/dist/deepkit/src/reflect-type.cjs +1 -0
  34. package/dist/deepkit/src/reflect-type.mjs +1 -0
  35. package/dist/deepkit/src/resolve-reflections.cjs +1 -0
  36. package/dist/deepkit/src/resolve-reflections.mjs +1 -0
  37. package/dist/deepkit/src/transformer.cjs +1 -0
  38. package/dist/deepkit/src/transformer.mjs +1 -0
  39. package/dist/deepkit/src/transpile.cjs +1 -0
  40. package/dist/deepkit/src/transpile.mjs +1 -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/utilities.cjs +1 -0
  44. package/dist/deepkit/src/utilities.mjs +1 -0
  45. package/dist/deepkit/src/vendor/core.cjs +1 -0
  46. package/dist/deepkit/src/vendor/core.mjs +1 -0
  47. package/dist/deepkit/src/vendor/type-compiler/index.cjs +1 -0
  48. package/dist/deepkit/src/vendor/type-compiler/index.mjs +1 -0
  49. package/dist/deepkit/src/vendor/type.cjs +1 -0
  50. package/dist/deepkit/src/vendor/type.d.cts +7 -0
  51. package/dist/deepkit/src/vendor/type.d.mts +7 -0
  52. package/dist/deepkit/src/vendor/type.mjs +1 -0
  53. package/dist/helpers/automd-generator.cjs +1 -0
  54. package/dist/helpers/automd-generator.mjs +1 -0
  55. package/dist/helpers/create-reflection-resource.cjs +1 -0
  56. package/dist/helpers/create-reflection-resource.d.cts +15 -0
  57. package/dist/helpers/create-reflection-resource.d.mts +15 -0
  58. package/dist/helpers/create-reflection-resource.mjs +1 -0
  59. package/dist/helpers/index.cjs +1 -0
  60. package/dist/helpers/index.d.cts +6 -0
  61. package/dist/helpers/index.d.mts +6 -0
  62. package/dist/helpers/index.mjs +1 -0
  63. package/dist/helpers/load.cjs +1 -0
  64. package/dist/helpers/load.d.cts +35 -0
  65. package/dist/helpers/load.d.mts +35 -0
  66. package/dist/helpers/load.mjs +1 -0
  67. package/dist/helpers/persistence.cjs +1 -0
  68. package/dist/helpers/persistence.d.cts +84 -0
  69. package/dist/helpers/persistence.d.mts +84 -0
  70. package/dist/helpers/persistence.mjs +1 -0
  71. package/dist/helpers/reflect.cjs +1 -0
  72. package/dist/helpers/reflect.d.cts +46 -0
  73. package/dist/helpers/reflect.d.mts +46 -0
  74. package/dist/helpers/reflect.mjs +1 -0
  75. package/dist/helpers/source-file-env.cjs +1 -0
  76. package/dist/helpers/source-file-env.d.cts +8 -0
  77. package/dist/helpers/source-file-env.d.mts +8 -0
  78. package/dist/helpers/source-file-env.mjs +1 -0
  79. package/dist/helpers/template-helpers.cjs +1 -0
  80. package/dist/helpers/template-helpers.d.cts +15 -0
  81. package/dist/helpers/template-helpers.d.mts +15 -0
  82. package/dist/helpers/template-helpers.mjs +1 -0
  83. package/dist/index.cjs +4 -8
  84. package/dist/index.d.cts +13 -184
  85. package/dist/index.d.mts +15 -184
  86. package/dist/index.mjs +4 -8
  87. package/dist/plugin-alloy/src/core/components/index.cjs +1 -0
  88. package/dist/plugin-alloy/src/core/components/index.mjs +1 -0
  89. package/dist/plugin-alloy/src/core/components/output.cjs +1 -0
  90. package/dist/plugin-alloy/src/core/components/output.mjs +1 -0
  91. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +1 -0
  92. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +1 -0
  93. package/dist/plugin-alloy/src/core/components/source-file.cjs +1 -0
  94. package/dist/plugin-alloy/src/core/components/source-file.mjs +1 -0
  95. package/dist/plugin-alloy/src/core/contexts/context.cjs +1 -0
  96. package/dist/plugin-alloy/src/core/contexts/context.mjs +1 -0
  97. package/dist/plugin-alloy/src/core/contexts/index.cjs +1 -0
  98. package/dist/plugin-alloy/src/core/contexts/index.mjs +1 -0
  99. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +1 -0
  100. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +1 -0
  101. package/dist/plugin-alloy/src/core/index.cjs +1 -0
  102. package/dist/plugin-alloy/src/core/index.mjs +1 -0
  103. package/dist/plugin-alloy/src/helpers/capnp.cjs +1 -0
  104. package/dist/plugin-alloy/src/helpers/capnp.mjs +1 -0
  105. package/dist/plugin-alloy/src/helpers/create-builtin.cjs +1 -0
  106. package/dist/plugin-alloy/src/helpers/create-builtin.mjs +1 -0
  107. package/dist/plugin-alloy/src/helpers/index.cjs +1 -0
  108. package/dist/plugin-alloy/src/helpers/index.mjs +1 -0
  109. package/dist/plugin-alloy/src/helpers/refkey.cjs +1 -0
  110. package/dist/plugin-alloy/src/helpers/refkey.mjs +1 -0
  111. package/dist/plugin-alloy/src/helpers/typescript.cjs +1 -0
  112. package/dist/plugin-alloy/src/helpers/typescript.mjs +1 -0
  113. package/dist/plugin-alloy/src/index.cjs +2 -0
  114. package/dist/plugin-alloy/src/index.mjs +2 -0
  115. package/dist/plugin-alloy/src/markdown/components/index.cjs +1 -0
  116. package/dist/plugin-alloy/src/markdown/components/index.mjs +1 -0
  117. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +1 -0
  118. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +1 -0
  119. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +1 -0
  120. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +1 -0
  121. package/dist/plugin-alloy/src/markdown/contexts/index.cjs +1 -0
  122. package/dist/plugin-alloy/src/markdown/contexts/index.mjs +1 -0
  123. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +1 -0
  124. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +1 -0
  125. package/dist/plugin-alloy/src/markdown/index.cjs +1 -0
  126. package/dist/plugin-alloy/src/markdown/index.mjs +1 -0
  127. package/dist/plugin-alloy/src/types/components.d.mts +5 -0
  128. package/dist/plugin-alloy/src/types/index.d.mts +2 -0
  129. package/dist/plugin-alloy/src/types/plugin.d.cts +38 -0
  130. package/dist/plugin-alloy/src/types/plugin.d.mts +38 -0
  131. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +1 -0
  132. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +1 -0
  133. package/dist/plugin-alloy/src/typescript/components/dynamic-import-statement.cjs +1 -0
  134. package/dist/plugin-alloy/src/typescript/components/dynamic-import-statement.mjs +1 -0
  135. package/dist/plugin-alloy/src/typescript/components/entry-file.cjs +1 -0
  136. package/dist/plugin-alloy/src/typescript/components/entry-file.mjs +1 -0
  137. package/dist/plugin-alloy/src/typescript/components/index.cjs +1 -0
  138. package/dist/plugin-alloy/src/typescript/components/index.mjs +1 -0
  139. package/dist/plugin-alloy/src/typescript/components/record-expression.cjs +1 -0
  140. package/dist/plugin-alloy/src/typescript/components/record-expression.mjs +1 -0
  141. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +1 -0
  142. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +1 -0
  143. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +1 -0
  144. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +1 -0
  145. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +1 -0
  146. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +1 -0
  147. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +1 -0
  148. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +1 -0
  149. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +1 -0
  150. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +1 -0
  151. package/dist/plugin-alloy/src/typescript/index.cjs +1 -0
  152. package/dist/plugin-alloy/src/typescript/index.mjs +1 -0
  153. package/dist/plugin-automd/src/index.cjs +1 -0
  154. package/dist/plugin-automd/src/index.mjs +1 -0
  155. package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
  156. package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
  157. package/dist/plugin-automd/src/types/toc.d.cts +33 -0
  158. package/dist/plugin-automd/src/types/toc.d.mts +33 -0
  159. package/dist/plugin-babel/src/helpers/ast-utils.cjs +1 -0
  160. package/dist/plugin-babel/src/helpers/ast-utils.mjs +1 -0
  161. package/dist/plugin-babel/src/helpers/create-plugin.cjs +1 -0
  162. package/dist/plugin-babel/src/helpers/create-plugin.mjs +1 -0
  163. package/dist/plugin-babel/src/helpers/filters.cjs +1 -0
  164. package/dist/plugin-babel/src/helpers/filters.mjs +1 -0
  165. package/dist/plugin-babel/src/helpers/index.cjs +1 -0
  166. package/dist/plugin-babel/src/helpers/index.mjs +1 -0
  167. package/dist/plugin-babel/src/helpers/module-helpers.cjs +1 -0
  168. package/dist/plugin-babel/src/helpers/module-helpers.mjs +1 -0
  169. package/dist/plugin-babel/src/helpers/options.cjs +1 -0
  170. package/dist/plugin-babel/src/helpers/options.mjs +1 -0
  171. package/dist/plugin-babel/src/index.cjs +1 -0
  172. package/dist/plugin-babel/src/index.mjs +1 -0
  173. package/dist/plugin-babel/src/types/index.d.mts +1 -0
  174. package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
  175. package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
  176. package/dist/powerlines/src/lib/build/esbuild.cjs +14 -0
  177. package/dist/powerlines/src/lib/build/esbuild.mjs +14 -0
  178. package/dist/powerlines/src/lib/entry.cjs +1 -0
  179. package/dist/powerlines/src/lib/entry.mjs +1 -0
  180. package/dist/powerlines/src/lib/logger.cjs +1 -0
  181. package/dist/powerlines/src/lib/logger.mjs +1 -0
  182. package/dist/powerlines/src/lib/utilities/bundle.cjs +1 -0
  183. package/dist/powerlines/src/lib/utilities/bundle.mjs +1 -0
  184. package/dist/powerlines/src/lib/utilities/file-header.cjs +1 -0
  185. package/dist/powerlines/src/lib/utilities/file-header.mjs +1 -0
  186. package/dist/powerlines/src/lib/utilities/resolve.cjs +1 -0
  187. package/dist/powerlines/src/lib/utilities/resolve.mjs +1 -0
  188. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
  189. package/dist/powerlines/src/plugin-utils/paths.mjs +1 -0
  190. package/dist/powerlines/src/types/babel.d.cts +22 -0
  191. package/dist/powerlines/src/types/babel.d.mts +22 -0
  192. package/dist/powerlines/src/types/build.d.cts +145 -0
  193. package/dist/powerlines/src/types/build.d.mts +147 -0
  194. package/dist/powerlines/src/types/commands.d.cts +8 -0
  195. package/dist/powerlines/src/types/commands.d.mts +9 -0
  196. package/dist/powerlines/src/types/config.d.cts +368 -0
  197. package/dist/powerlines/src/types/config.d.mts +369 -0
  198. package/dist/powerlines/src/types/context.d.cts +373 -0
  199. package/dist/powerlines/src/types/context.d.mts +375 -0
  200. package/dist/powerlines/src/types/fs.d.cts +458 -0
  201. package/dist/powerlines/src/types/fs.d.mts +458 -0
  202. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  203. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  204. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  205. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  206. package/dist/powerlines/src/types/resolved.d.mts +83 -0
  207. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  208. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  209. package/dist/types/index.cjs +0 -1
  210. package/dist/types/index.d.cts +2 -3
  211. package/dist/types/index.d.mts +2 -3
  212. package/dist/types/index.mjs +1 -1
  213. package/dist/types/plugin.cjs +0 -1
  214. package/dist/types/plugin.d.cts +156 -2
  215. package/dist/types/plugin.d.mts +158 -2
  216. package/dist/types/plugin.mjs +1 -1
  217. package/dist/types/runtime.cjs +0 -1
  218. package/dist/types/runtime.d.cts +793 -1
  219. package/dist/types/runtime.d.mts +793 -1
  220. package/dist/types/runtime.mjs +1 -1
  221. package/package.json +13 -20
  222. package/dist/components-ByVHjWXF.mjs +0 -1
  223. package/dist/components-C9bYrQVK.cjs +0 -0
  224. package/dist/create-reflection-resource-B9d8LEWF.mjs +0 -17
  225. package/dist/create-reflection-resource-BEDScc6f.cjs +0 -17
  226. package/dist/docs--ddXDQBx.cjs +0 -1
  227. package/dist/docs-CKCRAUnO.d.mts +0 -9
  228. package/dist/docs-CdtUw4WA.d.cts +0 -9
  229. package/dist/docs-DwPacakH.mjs +0 -1
  230. package/dist/env-COWzTupf.d.cts +0 -20
  231. package/dist/env-CdR46Bis.mjs +0 -31
  232. package/dist/env-DqPOEUEu.d.mts +0 -20
  233. package/dist/env-k_8Sz-kF.cjs +0 -34
  234. package/dist/index-B_e8BwCm.d.cts +0 -1
  235. package/dist/index-CW2WHUXP.d.mts +0 -1
  236. package/dist/index-DCQ5Y2ED.d.mts +0 -1
  237. package/dist/index-DWPDThxu.d.cts +0 -1
  238. package/dist/plugin-CyRU_Pln.mjs +0 -1
  239. package/dist/plugin-D5qyQPqC.cjs +0 -0
  240. package/dist/runtime-Bisl_1Ja.cjs +0 -0
  241. package/dist/runtime-CRLPiOqf.d.mts +0 -2499
  242. package/dist/runtime-g_eXGBBi.mjs +0 -1
  243. package/dist/runtime-rhT2IfSg.d.cts +0 -2497
  244. package/dist/types-DMh7K7VC.mjs +0 -1
  245. package/dist/types-MYBaygjr.cjs +0 -0
package/dist/index.d.mts CHANGED
@@ -1,189 +1,20 @@
1
- import { t as EnvDocs } from "./docs-CKCRAUnO.mjs";
2
- import { i as __ΩEnvBuiltinProps, n as EnvBuiltinProps, r as EnvTypeDefinition, t as EnvBuiltin } from "./env-DqPOEUEu.mjs";
3
- import "./index-CW2WHUXP.mjs";
4
- import { a as EnvType, c as __ΩEnvPluginResolvedConfig, d as type_d_exports, i as EnvPluginUserConfig, l as __ΩEnvPluginUserConfig, n as EnvPluginOptions, o as __ΩEnvPluginContext, r as EnvPluginResolvedConfig, s as __ΩEnvPluginOptions, t as EnvPluginContext, u as __ΩEnvType } from "./plugin-D9GLc9S_.mjs";
5
- import { d as UnresolvedContext, i as __ΩSecretsInterface, l as Context, n as SecretsInterface, r as __ΩEnvInterface, t as EnvInterface } from "./runtime-CRLPiOqf.mjs";
6
- import "./index-DCQ5Y2ED.mjs";
7
- import { DotenvParseOutput } from "@stryke/env/types";
8
- import * as _alloy_js_core0 from "@alloy-js/core";
9
- import * as powerlines0 from "powerlines";
1
+ import { EnvDocs } from "./components/docs.mjs";
2
+ import { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from "./components/env.mjs";
3
+ import "./components/index.mjs";
4
+ import { EnvInterface, SecretsInterface, __ΩEnvInterface, __ΩSecretsInterface } from "./types/runtime.mjs";
5
+ import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./types/plugin.mjs";
6
+ import { envBabelPlugin } from "./babel/plugin.mjs";
7
+ import "./babel/index.mjs";
8
+ import { createReflectionResource } from "./helpers/create-reflection-resource.mjs";
9
+ import { loadEnv, loadEnvFromContext } from "./helpers/load.mjs";
10
+ import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection } from "./helpers/persistence.mjs";
11
+ import { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./helpers/reflect.mjs";
12
+ import { formatEnvField, removeEnvPrefix } from "./helpers/source-file-env.mjs";
13
+ import { createTemplateReflection } from "./helpers/template-helpers.mjs";
14
+ import "./helpers/index.mjs";
15
+ import "./types/index.mjs";
10
16
  import { Plugin } from "powerlines";
11
- import { TypeDefinition } from "@stryke/types/configuration";
12
17
 
13
- //#region src/babel/plugin.d.ts
14
- declare const envBabelPlugin: powerlines0.DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, Record<string, any>>;
15
- //#endregion
16
- //#region src/helpers/create-reflection-resource.d.ts
17
- /**
18
- * Creates a reflection resource for the environment configuration.
19
- *
20
- * @param context - The environment plugin context.
21
- * @returns A resource that provides the reflection of the environment configuration.
22
- */
23
- declare function createReflectionResource(context?: EnvPluginContext): _alloy_js_core0.Resource<type_d_exports.ReflectionClass<Record<string, any>>>;
24
- //#endregion
25
- //#region src/helpers/load.d.ts
26
- /**
27
- * Retrieves various dotenv configuration parameters from the context.
28
- *
29
- * @param context - The context to retrieve the dotenv configuration from.
30
- * @param parsed - The parsed dotenv configuration.
31
- * @returns An object containing the dotenv configuration.
32
- */
33
- declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvParseOutput): {
34
- APP_NAME: string | undefined;
35
- APP_VERSION: string | undefined;
36
- BUILD_ID: string;
37
- BUILD_TIMESTAMP: string;
38
- BUILD_CHECKSUM: string;
39
- RELEASE_ID: string;
40
- RELEASE_TAG: string;
41
- DEFAULT_LOCALE: string | undefined;
42
- DEFAULT_TIMEZONE: string | undefined;
43
- LOG_LEVEL: "error" | "warn" | "info" | "debug" | "trace" | null;
44
- ERROR_URL: string | undefined;
45
- ORGANIZATION: string | undefined;
46
- PLATFORM: "node" | "browser" | "neutral" | undefined;
47
- MODE: "test" | "development" | "production" | undefined;
48
- DEBUG: boolean;
49
- STACKTRACE: boolean;
50
- ENVIRONMENT: powerlines0.EnvironmentResolvedConfig;
51
- };
52
- declare function loadEnv<TEnv extends DotenvParseOutput = DotenvParseOutput>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv>;
53
- //#endregion
54
- //#region src/helpers/persistence.d.ts
55
- /**
56
- * Resolves the runtime type definition file for the environment variables.
57
- *
58
- * @param context - The plugin context.
59
- * @returns The runtime type definition file for the environment variables.
60
- */
61
- declare function resolveRuntimeTypeFile(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<string>;
62
- /**
63
- * Gets the default type definition for the environment variables.
64
- *
65
- * @param context - The plugin context.
66
- * @returns The default type definition for the environment variables.
67
- */
68
- declare function getEnvDefaultTypeDefinition(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<TypeDefinition>;
69
- /** Gets the default type definition for the environment secrets.
70
- *
71
- * @param context - The plugin context.
72
- * @returns The default type definition for the environment secrets.
73
- */
74
- declare function getSecretsDefaultTypeDefinition(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<TypeDefinition>;
75
- /**
76
- * Gets the path to the environment type reflections.
77
- *
78
- * @param context - The plugin context.
79
- * @param name - The name of the type reflections.
80
- * @returns The path to the environment type reflections.
81
- */
82
- declare function getEnvTypeReflectionsPath(context: Context<EnvPluginResolvedConfig>, name?: EnvType): string;
83
- /**
84
- * Reads the environment type reflection from the file system.
85
- *
86
- * @param context - The plugin context.
87
- * @param name - The name of the type reflections.
88
- * @returns The environment type reflection.
89
- */
90
- declare function readEnvTypeReflection(context: EnvPluginContext, name?: EnvType): Promise<type_d_exports.ReflectionClass<any>>;
91
- /**
92
- * Writes the environment type reflection to the file system.
93
- *
94
- * @param context - The plugin context.
95
- * @param reflection - The environment type reflection to write.
96
- * @param name - The name of the type reflections.
97
- */
98
- declare function writeEnvTypeReflection(context: EnvPluginContext, reflection: type_d_exports.ReflectionClass<any>, name?: EnvType): Promise<void>;
99
- declare function getEnvReflectionsPath(context: EnvPluginContext, name: EnvType): string;
100
- /**
101
- * Reads the environment reflection data from the file system.
102
- *
103
- * @param context - The plugin context.
104
- * @returns The environment reflection data.
105
- */
106
- declare function readEnvReflection(context: EnvPluginContext): Promise<type_d_exports.ReflectionClass<any>>;
107
- /**
108
- * Reads the secret environment reflection data from the file system.
109
- *
110
- * @param context - The plugin context.
111
- * @returns The environment reflection data.
112
- */
113
- declare function readSecretsReflection(context: EnvPluginContext): Promise<type_d_exports.ReflectionClass<any>>;
114
- /**
115
- * Writes the environment reflection data to the file system.
116
- *
117
- * @param context - The plugin context.
118
- * @param reflection - The reflection data to write.
119
- * @param name - The name of the reflection (either "env" or "secrets").
120
- */
121
- declare function writeEnvReflection(context: EnvPluginContext, reflection: type_d_exports.ReflectionClass<any>, name?: EnvType): Promise<void>;
122
- /**
123
- * Writes the environment reflection data to the file system.
124
- *
125
- * @param context - The plugin context.
126
- * @param reflection - The reflection data to write.
127
- * @param name - The name of the reflection (either "env" or "secrets").
128
- */
129
- declare function writeEnvReflectionSync(context: EnvPluginContext, reflection: type_d_exports.ReflectionClass<any>, name?: EnvType): void;
130
- //#endregion
131
- //#region src/helpers/reflect.d.ts
132
- declare function mergeEnvReflections(context: EnvPluginContext, reflections: type_d_exports.ReflectionClass<any>[]): type_d_exports.ReflectionClass<any>;
133
- declare function mergeSecretsReflections(context: EnvPluginContext, reflections: type_d_exports.ReflectionClass<any>[]): type_d_exports.ReflectionClass<any>;
134
- interface CreateEnvReflectionOptions {
135
- type?: type_d_exports.TypeObjectLiteral | type_d_exports.TypeClass;
136
- superReflection?: type_d_exports.ReflectionClass<any>;
137
- }
138
- declare class BaseEnv implements EnvInterface {
139
- APP_NAME: string;
140
- APP_VERSION: string;
141
- BUILD_ID: string;
142
- BUILD_TIMESTAMP: string;
143
- BUILD_CHECKSUM: string;
144
- RELEASE_ID: string;
145
- RELEASE_TAG: string;
146
- ORGANIZATION: string;
147
- PLATFORM: "node" | "browser" | "neutral";
148
- MODE: "development" | "test" | "production";
149
- ENVIRONMENT: string;
150
- DEBUG: boolean;
151
- TEST: boolean;
152
- MINIMAL: boolean;
153
- NO_COLOR: boolean;
154
- FORCE_COLOR: number | boolean;
155
- FORCE_HYPERLINK: number | boolean;
156
- STACKTRACE: boolean;
157
- INCLUDE_ERROR_DATA: boolean;
158
- ERROR_URL: string;
159
- DEFAULT_TIMEZONE: string;
160
- DEFAULT_LOCALE: string;
161
- CI: boolean;
162
- }
163
- declare class BaseSecrets implements SecretsInterface {
164
- ENCRYPTION_KEY: string;
165
- }
166
- declare function createEnvReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): type_d_exports.ReflectionClass<any>;
167
- declare function createSecretsReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): type_d_exports.ReflectionClass<any>;
168
- declare function reflectEnv(context: EnvPluginContext, file?: string, name?: string): Promise<type_d_exports.ReflectionClass<any>>;
169
- declare function reflectSecrets(context: EnvPluginContext, file?: string, name?: string): Promise<type_d_exports.ReflectionClass<any>>;
170
- declare type __ΩCreateEnvReflectionOptions = any[];
171
- //#endregion
172
- //#region src/helpers/source-file-env.d.ts
173
- type TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;
174
- declare function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(env: TEnv): TReturned<TEnv>;
175
- declare function formatEnvField(key: string): string;
176
- //#endregion
177
- //#region src/helpers/template-helpers.d.ts
178
- /**
179
- * Creates the reflection data used when generating runtime template files.
180
- *
181
- * @param context - The context for the configuration plugin.
182
- * @param name - The name of the configuration template.
183
- * @returns The reflection for the specified configuration template.
184
- */
185
- declare function createTemplateReflection(context: EnvPluginContext, name?: EnvType): Promise<type_d_exports.ReflectionClass<any>>;
186
- //#endregion
187
18
  //#region src/index.d.ts
188
19
  /**
189
20
  * A Powerlines plugin to inject environment variables into the source code.
package/dist/index.mjs CHANGED
@@ -1,14 +1,10 @@
1
- import{C as e,D as t,E as n,S as r,T as i,_ as a,a as o,b as s,c,d as l,f as u,g as d,h as ee,i as te,l as f,m as p,n as m,o as h,p as ne,r as g,s as _,t as re,u as v,v as ie,w as y,x as ae,y as oe}from"./create-reflection-resource-B9d8LEWF.mjs";import{n as b,t as x}from"./env-CdR46Bis.mjs";import{t as se}from"./docs-DwPacakH.mjs";import"./components-ByVHjWXF.mjs";import"./plugin-CyRU_Pln.mjs";import"./runtime-g_eXGBBi.mjs";import"./types-DMh7K7VC.mjs";import{createComponent as ce}from"@alloy-js/core/jsx-runtime";import{toArray as S}from"@stryke/convert/to-array";import{isDirectory as le}from"@stryke/fs/is-file";import{listFiles as ue}from"@stryke/fs/list-files";import{appendPath as C}from"@stryke/path/append";import{isAbsolutePath as w}from"@stryke/path/is-type";import{joinPaths as T}from"@stryke/path/join-paths";import{replacePath as de}from"@stryke/path/replace";import{defineGenerator as fe,loadConfig as pe,resolveConfig as me,transform as he}from"automd";import{loadConfig as ge}from"c12";import E from"defu";import _e from"markdown-toc";import{transformAsync as ve}from"@babel/core";import{LogLevelLabel as D}from"@storm-software/config-tools/types";import{findFileExtension as ye,findFileExtensionSafe as be}from"@stryke/path/file-path-fns";import{isParentPath as O}from"@stryke/path/is-parent-path";import{isSetObject as k}from"@stryke/type-checks/is-set-object";import{isFunction as A}from"@stryke/type-checks/is-function";import"@stryke/type-checks/is-object";import{isSetString as j}from"@stryke/type-checks/is-set-string";import M from"chalk";import N from"@babel/generator";import"@babel/parser";import{declare as xe}from"@babel/helper-plugin-utils";import"@storm-software/config-tools/logger";import"@storm-software/config-tools/utilities/colors";import"@stryke/helpers/noop";import{kebabCase as Se}from"@stryke/string-format/kebab-case";import{titleCase as P}from"@stryke/string-format/title-case";import*as F from"@babel/types";import{isString as I}from"@stryke/type-checks/is-string";import{parseTypeDefinition as L}from"@stryke/convert/parse-type-definition";import{ENV_PREFIXES as Ce}from"@stryke/env/types";import{existsSync as R}from"@stryke/fs/exists";import{createDirectory as we}from"@stryke/fs/helpers";import{joinPaths as z}from"@stryke/path/join";import{constantCase as Te}from"@stryke/string-format/constant-case";import*as Ee from"@stryke/capnp";import{getUniqueBy as B}from"@stryke/helpers/get-unique";import{StormJSON as V}from"@stryke/json/storm-json";import{isNull as De}from"@stryke/type-checks/is-null";import{isUndefined as Oe}from"@stryke/type-checks/is-undefined";import{readFileBufferSync as ke}from"@stryke/fs/buffer";import{existsSync as Ae}from"node:fs";var je=(e={})=>({name:`automd`,async config(){let t=await pe(T(this.workspaceConfig.workspaceRoot,this.config.projectRoot),e);return(!t.prefix||!Array.isArray(t.prefix))&&(t.prefix=S(t.prefix??[])),t.prefix.includes(`automd`)||t.prefix.push(`automd`),t.prefix.includes(`powerlines`)||t.prefix.push(`powerlines`),{automd:E(t??{},{configFile:e.configFile,allowIssues:!0,dir:this.config.projectRoot,watch:!1,input:`README.md`,toc:{maxDepth:6,bullets:`-`}})}},async configResolved(){if(this.config.framework&&!S(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=S(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await ge({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=me(E(this.config.automd,{...e,prefix:S(e.prefix??[])}))}this.config.automd.input=(await Promise.all(S(this.config.automd.input).map(async e=>e.includes(`*`)?ue(w(e)?e:C(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):w(e)?e:C(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!w(this.config.automd.output)&&(this.config.automd.output=C(this.config.automd.output,this.config.projectRoot)),this.config.automd.generators??={},this.config.automd.toc!==!1&&(this.config.automd.generators.toc??={name:`toc`,generate:e=>{let t=this.config.automd.toc??{};return{contents:_e(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all(S(this.config.automd.input).map(async e=>{let t=await this.fs.read(e);if(t){let n=await he(t,this.config.automd);if(n.hasIssues&&this.config.automd.allowIssues===!1)throw Error(`AutoMD found issues in file "${e}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);n.hasChanged&&await this.fs.write(C(this.config.automd.output?le(this.config.automd.output)?de(e,this.config.automd.output):this.config.automd.output:e,this.config.projectRoot),n.contents)}}))}});function H(e){return j(e)?e:Array.isArray(e)&&e.length>0?H(e[0]):e.$$name||e.name?e.$$name||e.name:void 0}function U(e,t){return!!(H(t)&&e.some(e=>Array.isArray(e)&&H(e[0])===H(t)))}function W(e,t){try{return Array.isArray(t)&&t.length>0&&t[0]?A(t[0])?t[0](e):t[0]:A(t)?t(e):t}catch{return t[0]}}function G(e,t,n,r){if(Array.isArray(r)&&r.length>0&&r[0]){if(r.length>2&&r[2]&&A(r[2])&&!r[2](t,n)){e.log(D.TRACE,`Skipping filtered Babel plugin ${M.bold.cyanBright(H(r)||`unnamed`)} for ${n}`);return}return r.length>2?[W(e,r),r[1],r[2]]:[W(e,r),r[1],null]}return[W(e,r),{},null]}let K=N;`default`in K&&(K=K.default);const q=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#D8B4FE`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`,`#8B5CF6`],Me=(e,t)=>(n,...r)=>e(n,` ${M.inverse.hex(q[t.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%q.length]||q[0])(` ${P(t)} `)} ${r.join(` `)} `);function Ne(e,t){let n=n=>xe((r,i,a)=>{r.cache.using(()=>n.meta.checksum),r.assertVersion(`^7.0.0-0`);let o=Me(n.log,e);o(D.TRACE,`Initializing the ${M.bold.cyanBright(e)} Babel plugin`);let s=t({log:o,name:e,api:r,options:i,context:n,dirname:a});return s.name=e,o(D.TRACE,`Completed initialization of the ${M.bold.cyanBright(e)} Babel plugin`),s});return n.$$name=e,n}function J(e,t){Ie(e.scope.getProgramParent().path,t)}function Pe(e){return e.get(`specifiers`).filter(Boolean).every(e=>e?.isImportSpecifier())&&e.node.importKind!==`type`&&e.node.importKind!==`typeof`}function Fe(e){let t=new Map;return e.traverse({ImportDeclaration(e){Pe(e)&&t.set(e.node.source.value,e)}}),t}function Ie(e,t){Fe(e).get(t.module)||e.unshiftContainer(`body`,F.importDeclaration([F.importSpecifier(F.identifier(t.name||t.imported),F.identifier(t.imported))],F.stringLiteral(t.module)))}var Le=(e={})=>({name:`babel`,config(){if(k(e))return{transform:{babel:e}}},configResolved:{order:`pre`,handler(){this.devDependencies[`@babel/core`]=`^7.28.4`,this.config.transform.babel=E(this.config.transform.babel??{},{plugins:[],presets:[]})}},async transform(t,n){if(O(n,this.powerlinesPath)||t.includes(`/* @storm-ignore */`)||t.includes(`/* @storm-disable */`))return this.log(D.TRACE,`Skipping Babel transformation for: ${n}`),{code:t,id:n};this.log(D.TRACE,`Babel transforming file: ${n}`);let r=this.config.transform.babel.plugins.map(e=>G(this,t,n,e)).filter((e,t,n)=>e&&!U(n,e)),i=this.config.transform.babel.presets.map(e=>G(this,t,n,e)).filter((e,t,n)=>e&&!U(n,e));if(Array.isArray(r)&&r.length===0&&Array.isArray(i)&&i.length===0)return{code:t,id:n};[`ts`,`cts`,`mts`,`tsx`].includes(be(n))&&!U(r,`@babel/plugin-syntax-typescript`)&&!U(i,`@babel/preset-typescript`)&&r.unshift([`@babel/plugin-syntax-typescript`,{isTSX:ye(n)===`.tsx`}]);let a=await ve(t,{highlightCode:!0,code:!0,ast:!1,cloneInputAst:!1,comments:!0,sourceType:`module`,configFile:!1,babelrc:!1,envName:this.config.mode,caller:{name:this.config.framework},...this.config.transform.babel??{},filename:n,plugins:r.map(t=>Array.isArray(t)&&t.length>=2?[t[0],E(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean),presets:i.map(t=>Array.isArray(t)&&t.length>=2?[t[0],E(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean)});if(!a?.code)throw Error(`Powerlines - Babel plugin failed to compile ${n}`);return{code:a.code,id:n}}});function Re(e,t){return X(e.type,t??e.getDefaultValue())}function Y(e){return`"${String(e).replaceAll(`"`,`\\"`)}"`}function X(e,n){return Oe(n)?`undefined`:De(n)?`null`:e.kind===t.ReflectionKind.boolean?String(n).trim().toLowerCase()===`true`?`true`:`false`:e.kind===t.ReflectionKind.string||e.kind===t.ReflectionKind.literal&&I(e.literal)?Y(n):e.kind===t.ReflectionKind.enum?ze(e).kind===t.ReflectionKind.string?Y(n):`${String(n)}`:e.kind===t.ReflectionKind.union?Be(e)?Y(n):`${String(n)}`:e.kind===t.ReflectionKind.array?Y(V.stringify(n)):e.kind===t.ReflectionKind.object||e.kind===t.ReflectionKind.objectLiteral?V.stringify(n):e.kind===t.ReflectionKind.property||e.kind===t.ReflectionKind.parameter?X(e.type,n):String(n)}function ze(e){if(e.kind!==t.ReflectionKind.enum)throw Error(`Expected a TypeEnum, but received ${e.kind}.`);let n=B(e.values.filter(e=>e!=null),e=>I(e)?{kind:t.ReflectionKind.string}:{kind:t.ReflectionKind.number});if(n.length===0)throw Error(`No valid enum members could be found.`);return n[0]&&I(n[0])?{kind:t.ReflectionKind.string}:{kind:t.ReflectionKind.number}}function Z(e){if(e.kind===t.ReflectionKind.union&&e.types.length>0)return B(e.types,e=>e.kind);throw Error(`Expected a TypeUnion, but received ${e.kind}.`)}function Be(e){return Z(e).some(e=>e.kind===t.ReflectionKind.string||e.kind===t.ReflectionKind.literal&&I(e.literal))}const Q=Ne(`env`,({log:e,context:r})=>{function a(t,n,i=!1){let a=r.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(t.name){let o=r.config.env.prefix.find(e=>t.name&&t.name.startsWith(e)&&(r.env.types.env?.hasProperty(t.name.replace(`${e}_`,``))||a.some(n=>n.getAlias().includes(t.name.replace(`${e}_`,``))))),s=t.name;if(o&&(s=t.name.replace(`${o}_`,``)),e(D.TRACE,`Environment variable ${s} found in ${n.filename||`unknown file`}.`),r.env.types.env?.hasProperty(s)||a.some(e=>e.getAlias().includes(s))){let e=r.env.types.env.hasProperty(s)?r.env.types.env.getProperty(s):a.find(e=>e.getAlias().includes(s));if(!e||e.isIgnored())return;if(r.env.used.env.hasProperty(s)||r.env.used.env.addProperty(e.property),r.config.env.inject&&i){let t=r.env.parsed?.[s];if(t===void 0){let e=r.config.env.prefix.find(e=>r.env.parsed[`${e.replace(/_$/g,``)}_${s}`]);e&&(t=r.env.parsed[`${e.replace(/_$/g,``)}_${s}`])}if(t??=e.getDefaultValue(),e.isValueRequired()&&t===void 0)throw Error(`Environment variable \`${s}\` is not defined in the .env configuration files`);return Re(e,t)}}else throw Error(`The "${s}" environment variable is not defined in the \`env\` type definition, but is used in the source code file ${n.filename?n.filename:`unknown`}.
2
-
3
- The following environment configuration names are defined in the \`env\` type definition: \n${r.env.types.env?.getPropertyNames().sort((e,t)=>String(e).localeCompare(String(t))).map(e=>` - ${String(e)} ${a.some(t=>t.getNameAsString()===String(e)&&t.getAlias().length>0)?`(Alias: ${a?.find(t=>t.getNameAsString()===String(e))?.getAlias().join(`, `)})`:``}`).join(`
4
- `)} \n\nUsing the following env prefix: \n${r.config.env.prefix.map(e=>` - ${e}`).join(`
5
- `)} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`)}}return{visitor:{MemberExpression(e,t){if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`$storm`})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;a(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),J(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isCallExpression({callee:{name:`useStorm`,type:`Identifier`}})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;a(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),J(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`process`})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;if(!n.name)return;a(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),J(e,{module:`storm:env`,name:`env`,imported:`env`})}else if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isMetaProperty()&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;if(!n.name)return;a(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),J(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){e(D.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let a=t.ReflectionClass.from({kind:t.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),o=_(r,`env`);o&&Ae(o)&&(e(D.TRACE,`Environment reflection file found at ${o}, reading existing reflection.`),a=(0,t.resolveClassType)((0,t.deserializeType)(n(new Ee.Message(ke(o),!1).getRoot(i).types)))),e(D.TRACE,`Adding new variables to env reflection at ${o}.`),a.getProperties().filter(e=>e.getNameAsString()&&!r.env.used.env.hasProperty(e.getNameAsString())).forEach(e=>{r.env.used.env.addProperty({...e,name:e.getNameAsString(),description:e.getDescription()??`The ${e.getNameAsString()} variable.`,default:e.getDefaultValue(),optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,visibility:e.getVisibility(),type:e.getType(),tags:e.getTags()})})}}}),Ve=e=>fe({name:`env`,async generate(){let t=T(e.config.projectRoot,`docs`,`generated`,`env.md`);return e.fs.existsSync(t)?{contents:await e.fs.read(t)||``}:{contents:``}}});async function He(e,t){let n=await l(e,t);return n.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{n.addProperty({name:t,optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,description:e.getDescription(),visibility:e.getVisibility(),type:e.getType(),default:e.getDefaultValue(),tags:{hidden:e.isHidden(),ignore:e.isIgnored(),internal:e.isInternal(),alias:e.getAlias().filter(e=>e!==t).concat(e.name),title:e.getTitle()||P(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})})}),n}const $=(n={})=>[Le(n.babel),{name:`env`,async config(){this.log(D.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let e={env:E(n,{types:{},prefix:[]}),transform:{babel:{plugins:[Q]}}};if(e.env.types)e.env.types=L(e.env.types);else{this.log(D.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let t=await h(this);e.env.types=L(`${t.file}#${t.name}`)}if(e.env.secrets)e.env.secrets=L(e.env.secrets);else{let t=await f(this);e.env.secrets=L(`${t.file}#${t.name}`)}return e.env.prefix=S(e.env.prefix??[]).reduce((e,t)=>{let n=Te(t);return e.includes(n)||e.push(n),e},[...Ce,`POWERLINES_`]),e.env.prefix=e.env.prefix.reduce((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[]),e},async configResolved(){if(this.log(D.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=E({parsed:await m(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&R(c(this,`env`)))this.log(D.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await l(this,`env`),R(_(this,`env`))&&(this.env.used.env=await v(this)),R(c(this,`secrets`))&&(this.env.types.secrets=await l(this,`secrets`)),R(_(this,`secrets`))&&(this.env.used.secrets=await u(this));else{if(this.env.types.env=await e(this,this.config.env.types?.file?O(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:z(this.config.projectRoot,this.config.env.types?.file):void 0,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(await d(this,this.env.types.env,`env`),this.env.types.secrets=await y(this,this.config.env.secrets?.file?O(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:z(this.config.projectRoot,this.config.env.secrets?.file):void 0,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);await d(this,this.env.types.secrets,`secrets`),this.log(D.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let n=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await m(this,this.config.env)).forEach(([e,t])=>{let r=this.config.env.prefix.reduce((t,n)=>e.replace(/_$/g,``).startsWith(n)?e.replace(/_$/g,``).slice(n.length):t,e),i=n.find(e=>e?.getAlias().reverse().includes(r));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(t)}),this.env.used.env=new t.ReflectionClass({kind:t.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.env),await p(this,this.env.used.env,`env`),this.env.types.secrets&&(await d(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new t.ReflectionClass({kind:t.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.secrets),await p(this,this.env.used.secrets,`secrets`))}},async prepare(){let e=this;return this.log(D.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render(ce(x,{get defaultConfig(){return e.config.env.defaultConfig}}))},async docs(){this.log(D.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let e=z(this.config.projectRoot,`docs`,`generated`);R(e)||await we(e);let n=await l(this,`env`),r=z(e,`env.md`);this.log(D.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${P(this.config.framework)||`Powerlines`} -->
1
+ import{type_exports as e}from"./deepkit/src/vendor/type.mjs";import t from"./plugin-alloy/src/index.mjs";import n from"./plugin-automd/src/index.mjs";import r from"./plugin-babel/src/index.mjs";import{BaseEnv as i,BaseSecrets as a,createEnvReflection as o,createSecretsReflection as s,mergeEnvReflections as c,mergeSecretsReflections as l,reflectEnv as u,reflectSecrets as d}from"./helpers/reflect.mjs";import{getEnvDefaultTypeDefinition as f,getEnvReflectionsPath as p,getEnvTypeReflectionsPath as m,getSecretsDefaultTypeDefinition as h,readEnvReflection as g,readEnvTypeReflection as _,readSecretsReflection as v,resolveRuntimeTypeFile as y,writeEnvReflection as b,writeEnvReflectionSync as x,writeEnvTypeReflection as S}from"./helpers/persistence.mjs";import{envBabelPlugin as C}from"./babel/plugin.mjs";import{formatEnvField as w,removeEnvPrefix as T}from"./helpers/source-file-env.mjs";import{loadEnv as E,loadEnvFromContext as D}from"./helpers/load.mjs";import{createReflectionResource as O}from"./helpers/create-reflection-resource.mjs";import{EnvBuiltin as k,EnvTypeDefinition as A}from"./components/env.mjs";import{env as j}from"./helpers/automd-generator.mjs";import"./babel/index.mjs";import{EnvDocs as M}from"./components/docs.mjs";import"./components/index.mjs";import{createTemplateReflection as N}from"./helpers/template-helpers.mjs";import"./helpers/index.mjs";import{createComponent as P}from"@alloy-js/core/jsx-runtime";import{LogLevelLabel as F}from"@storm-software/config-tools/types";import{isParentPath as I}from"@stryke/path/is-parent-path";import L from"defu";import{toArray as R}from"@stryke/convert/to-array";import{joinPaths as z}from"@stryke/path/join";import{titleCase as B}from"@stryke/string-format/title-case";import{parseTypeDefinition as V}from"@stryke/convert/parse-type-definition";import{ENV_PREFIXES as H}from"@stryke/env/types";import{existsSync as U}from"@stryke/fs/exists";import{createDirectory as W}from"@stryke/fs/helpers";import{constantCase as G}from"@stryke/string-format/constant-case";const K=(i={})=>[t(i.alloy),r(i.babel),{name:`env`,async config(){this.log(F.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let e={env:L(i,{types:{},prefix:[]}),transform:{babel:{plugins:[C]}}};if(e.env.types)e.env.types=V(e.env.types);else{this.log(F.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let t=await f(this);e.env.types=V(`${t.file}#${t.name}`)}if(e.env.secrets)e.env.secrets=V(e.env.secrets);else{let t=await h(this);e.env.secrets=V(`${t.file}#${t.name}`)}return e.env.prefix=R(e.env.prefix??[]).reduce((e,t)=>{let n=G(t);return e.includes(n)||e.push(n),e},[...H,`POWERLINES_`]),e.env.prefix=e.env.prefix.reduce((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[]),e},async configResolved(){if(this.log(F.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=L({parsed:await E(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&U(m(this,`env`)))this.log(F.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await _(this,`env`),U(p(this,`env`))&&(this.env.used.env=await g(this)),U(m(this,`secrets`))&&(this.env.types.secrets=await _(this,`secrets`)),U(p(this,`secrets`))&&(this.env.used.secrets=await v(this));else{if(this.env.types.env=await u(this,this.config.env.types?.file?I(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:z(this.config.projectRoot,this.config.env.types?.file):void 0,this.config.env.types?.name),!this.env.types.env)throw Error(`Failed to find the environment configuration type reflection in the context.`);if(await S(this,this.env.types.env,`env`),this.env.types.secrets=await d(this,this.config.env.secrets?.file?I(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:z(this.config.projectRoot,this.config.env.secrets?.file):void 0,this.config.env.secrets?.name),!this.env.types.secrets)throw Error(`Failed to find the secrets configuration type reflection in the context.`);await S(this,this.env.types.secrets,`secrets`),this.log(F.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let t=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await E(this,this.config.env)).forEach(([e,n])=>{let r=this.config.env.prefix.reduce((t,n)=>e.replace(/_$/g,``).startsWith(n)?e.replace(/_$/g,``).slice(n.length):t,e),i=t.find(e=>e?.getAlias().reverse().includes(r));(this.env.types.env?.hasProperty(r)||i)&&this.env.types.env.getProperty(r).setDefaultValue(n)}),this.env.used.env=new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,typeName:`Env`,description:`An object containing the environment configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.env),await b(this,this.env.used.env,`env`),this.env.types.secrets&&(await S(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`An object containing the secret configuration parameters used by the ${this.config.name?`${this.config.name} application`:`application`}.`,types:[]},this.env.types.secrets),await b(this,this.env.used.secrets,`secrets`))}},async prepare(){let e=this;return this.log(F.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render(P(k,{get defaultConfig(){return e.config.env.defaultConfig}}))},async docs(){this.log(F.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let t=z(this.config.projectRoot,`docs`,`generated`);U(t)||await W(t);let n=await _(this,`env`),r=z(t,`env.md`);this.log(F.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${B(this.config.framework)||`Powerlines`} -->
6
2
 
7
3
  Below is a list of environment variables used by the [${this.packageJson.name}](https://www.npmjs.com/package/${this.packageJson.name}) package. These values can be updated in the \`.env\` file in the root of the project. The variables in the list below are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.
8
4
 
9
5
  | Name | Description | Type | Default Value | Required |
10
6
  | ---- | ----------- | ---- | ------------- | :------: |
11
- ${n.getProperties().filter(e=>e.getNameAsString()!==`__POWERLINES_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(e=>`| ${e.getNameAsString().trim()} | ${(e.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
12
- `,``)??``).trim()} | ${(0,t.stringifyType)(e.getType()).trim().replaceAll(` | `,`, or `)} | ${e.hasDefault()?String(e.getDefaultValue())?.includes(`"`)?e.getDefaultValue():`\`${e.getDefaultValue()}\``:``} | ${e.isValueRequired()?``:`✔`} |`).join(`
7
+ ${n.getProperties().filter(e=>e.getNameAsString()!==`__POWERLINES_INJECTED__`).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString())).map(t=>`| ${t.getNameAsString().trim()} | ${(t.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
8
+ `,``)??``).trim()} | ${(0,e.stringifyType)(t.getType()).trim().replaceAll(` | `,`, or `)} | ${t.hasDefault()?String(t.getDefaultValue())?.includes(`"`)?t.getDefaultValue():`\`${t.getDefaultValue()}\``:``} | ${t.isValueRequired()?``:`✔`} |`).join(`
13
9
  `)}
14
- `)},async buildEnd(){let e=_(this,`env`);this.log(D.TRACE,`Writing env reflection types to ${e}.`),await p(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:E(n.automd??{},{generators:{env:Ve(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},je(n.automd)];var Ue=$;export{a as BaseEnv,ie as BaseSecrets,x as EnvBuiltin,se as EnvDocs,b as EnvTypeDefinition,oe as createEnvReflection,re as createReflectionResource,s as createSecretsReflection,He as createTemplateReflection,Ue as default,Q as envBabelPlugin,te as formatEnvField,h as getEnvDefaultTypeDefinition,_ as getEnvReflectionsPath,c as getEnvTypeReflectionsPath,f as getSecretsDefaultTypeDefinition,m as loadEnv,g as loadEnvFromContext,ae as mergeEnvReflections,r as mergeSecretsReflections,$ as plugin,v as readEnvReflection,l as readEnvTypeReflection,u as readSecretsReflection,e as reflectEnv,y as reflectSecrets,o as removeEnvPrefix,ne as resolveRuntimeTypeFile,p as writeEnvReflection,ee as writeEnvReflectionSync,d as writeEnvTypeReflection};
10
+ `)},async buildEnd(){let e=p(this,`env`);this.log(F.TRACE,`Writing env reflection types to ${e}.`),await b(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:L(i.automd??{},{generators:{env:j(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},n(i.automd)];var q=K;export{i as BaseEnv,a as BaseSecrets,k as EnvBuiltin,M as EnvDocs,A as EnvTypeDefinition,o as createEnvReflection,O as createReflectionResource,s as createSecretsReflection,N as createTemplateReflection,q as default,C as envBabelPlugin,w as formatEnvField,f as getEnvDefaultTypeDefinition,p as getEnvReflectionsPath,m as getEnvTypeReflectionsPath,h as getSecretsDefaultTypeDefinition,E as loadEnv,D as loadEnvFromContext,c as mergeEnvReflections,l as mergeSecretsReflections,K as plugin,g as readEnvReflection,_ as readEnvTypeReflection,v as readSecretsReflection,u as reflectEnv,d as reflectSecrets,T as removeEnvPrefix,y as resolveRuntimeTypeFile,b as writeEnvReflection,x as writeEnvReflectionSync,S as writeEnvTypeReflection};
@@ -0,0 +1 @@
1
+ const e=require(`./output.cjs`);require(`./single-line-comment.cjs`),require(`./source-file.cjs`);
@@ -0,0 +1 @@
1
+ import{Output as e}from"./output.mjs";import"./single-line-comment.mjs";import"./source-file.mjs";export{};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../contexts/context.cjs`);let n=require(`@alloy-js/core/jsx-runtime`),r=require(`@alloy-js/core`),i=require(`@stryke/path/replace`);function a(e){let[{children:a,context:o,basePath:s},c]=(0,r.splitProps)(e,[`children`,`context`,`basePath`]),l=(0,r.ref)(o),u=(0,r.computed)(()=>s?(0,i.replacePath)(s,l.value.workspaceConfig.workspaceRoot):l.value.workspaceConfig.workspaceRoot);return(0,n.createComponent)(r.Output,(0,n.mergeProps)(c,{get basePath(){return u.value},get children(){return(0,n.createComponent)(t.PowerlinesContext.Provider,{value:{ref:l},get children(){return(0,n.createComponent)(r.Show,{get when(){return!!l.value},children:a})}})}}))}exports.Output=a;
@@ -0,0 +1 @@
1
+ import{PowerlinesContext as e}from"../contexts/context.mjs";import{createComponent as t,mergeProps as n}from"@alloy-js/core/jsx-runtime";import{Output as r,Show as i,computed as a,ref as o,splitProps as s}from"@alloy-js/core";import{replacePath as c}from"@stryke/path/replace";function l(l){let[{children:u,context:d,basePath:f},p]=s(l,[`children`,`context`,`basePath`]),m=o(d),h=a(()=>f?c(f,m.value.workspaceConfig.workspaceRoot):m.value.workspaceConfig.workspaceRoot);return t(r,n(p,{get basePath(){return h.value},get children(){return t(e.Provider,{value:{ref:m},get children(){return t(i,{get when(){return!!m.value},children:u})}})}}))}export{l as Output};
@@ -0,0 +1 @@
1
+ let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`);
@@ -0,0 +1 @@
1
+ import{createComponent as e,createIntrinsic as t}from"@alloy-js/core/jsx-runtime";import"@alloy-js/core";export{};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@alloy-js/core/jsx-runtime`),n=require(`@alloy-js/core`),r=require(`@stryke/path/append`),i=require(`defu`);i=e.__toESM(i);
@@ -0,0 +1 @@
1
+ import{createComponent as e,createIntrinsic as t}from"@alloy-js/core/jsx-runtime";import{Show as n,splitProps as r}from"@alloy-js/core";import{appendPath as i}from"@stryke/path/append";import a from"defu";export{};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@alloy-js/core`);const n=(0,t.createContext)();exports.PowerlinesContext=n;
@@ -0,0 +1 @@
1
+ import{createContext as e}from"@alloy-js/core";const t=e();export{t as PowerlinesContext};
@@ -0,0 +1 @@
1
+ const e=require(`./context.cjs`);require(`./reflection.cjs`);
@@ -0,0 +1 @@
1
+ import{PowerlinesContext as e}from"./context.mjs";import"./reflection.mjs";export{};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@alloy-js/core`);const n=(0,t.createContext)(),r=(0,t.createNamedContext)(`reflection-property`),i=(0,t.createNamedContext)(`reflection-method`),a=(0,t.createNamedContext)(`reflection-parameter`);
@@ -0,0 +1 @@
1
+ import{createContext as e,createNamedContext as t}from"@alloy-js/core";e(),t(`reflection-property`),t(`reflection-method`),t(`reflection-parameter`);export{};
@@ -0,0 +1 @@
1
+ const e=require(`./contexts/context.cjs`),t=require(`./components/output.cjs`);require(`./components/index.cjs`),require(`./contexts/index.cjs`);
@@ -0,0 +1 @@
1
+ import{PowerlinesContext as e}from"./contexts/context.mjs";import{Output as t}from"./components/output.mjs";import"./components/index.mjs";import"./contexts/index.mjs";export{};
@@ -0,0 +1 @@
1
+ const e=require(`../../../_virtual/rolldown_runtime.cjs`);require(`../../../deepkit/src/vendor/type.cjs`),require(`../../../deepkit/src/utilities.cjs`),require(`../../../deepkit/src/vendor/core.cjs`),require(`../../../powerlines/src/lib/utilities/file-header.cjs`);let t=require(`defu`);t=e.__toESM(t);let n=require(`@stryke/helpers/get-unique`),r=require(`@stryke/type-checks/is-null`),i=require(`@stryke/type-checks/is-string`),a=require(`@stryke/type-checks/is-undefined`);require(`@stryke/capnp/compile`),require(`@stryke/capnp/helpers`);let o=require(`@stryke/convert/to-array`);require(`@stryke/json`);let s=require(`@stryke/path/join`),c=require(`@stryke/string-format/camel-case`);require(`@stryke/string-format/get-words`),require(`@stryke/string-format/pascal-case`);let l=require(`@stryke/string-format/title-case`);require(`@stryke/type-checks/is-bigint`),require(`@stryke/type-checks/is-number`);let u=require(`node:child_process`),d=require(`node:util`);const f=1024*1e6,p=(0,d.promisify)(u.exec);
@@ -0,0 +1 @@
1
+ import"../../../deepkit/src/vendor/type.mjs";import"../../../deepkit/src/utilities.mjs";import"../../../deepkit/src/vendor/core.mjs";import"../../../powerlines/src/lib/utilities/file-header.mjs";import e from"defu";import{getUniqueBy as t}from"@stryke/helpers/get-unique";import{isNull as n}from"@stryke/type-checks/is-null";import{isString as r}from"@stryke/type-checks/is-string";import{isUndefined as i}from"@stryke/type-checks/is-undefined";import"@stryke/capnp/compile";import"@stryke/capnp/helpers";import{toArray as a}from"@stryke/convert/to-array";import"@stryke/json";import{joinPaths as o}from"@stryke/path/join";import{camelCase as s}from"@stryke/string-format/camel-case";import"@stryke/string-format/get-words";import"@stryke/string-format/pascal-case";import{titleCase as c}from"@stryke/string-format/title-case";import"@stryke/type-checks/is-bigint";import"@stryke/type-checks/is-number";import{exec as l}from"node:child_process";import{promisify as u}from"node:util";u(l);export{};
@@ -0,0 +1 @@
1
+ let e=require(`@alloy-js/typescript`);
@@ -0,0 +1 @@
1
+ import"@alloy-js/typescript";export{};
@@ -0,0 +1 @@
1
+ require(`./capnp.cjs`),require(`./create-builtin.cjs`),require(`./refkey.cjs`),require(`./typescript.cjs`);
@@ -0,0 +1 @@
1
+ import"./capnp.mjs";import"./create-builtin.mjs";import"./refkey.mjs";import"./typescript.mjs";export{};
@@ -0,0 +1 @@
1
+ let e=require(`@alloy-js/core`);
@@ -0,0 +1 @@
1
+ import"@alloy-js/core";export{};
@@ -0,0 +1 @@
1
+ require(`../../../deepkit/src/utilities.cjs`);let e=require(`@stryke/type-checks/is-undefined`),t=require(`@stryke/string-format/camel-case`),n=require(`@stryke/string-format/title-case`);
@@ -0,0 +1 @@
1
+ import"../../../deepkit/src/utilities.mjs";import{isUndefined as e}from"@stryke/type-checks/is-undefined";import{camelCase as t}from"@stryke/string-format/camel-case";import{titleCase as n}from"@stryke/string-format/title-case";export{};
@@ -0,0 +1,2 @@
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./core/contexts/context.cjs`),n=require(`./core/components/output.cjs`);require(`./core/index.cjs`),require(`./helpers/index.cjs`),require(`./markdown/index.cjs`),require(`./typescript/index.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/core`),a=require(`@alloy-js/rollup-plugin`);a=e.__toESM(a);let o=require(`@storm-software/config-tools/types`),s=require(`@stryke/json/storm-json`),c=require(`@stryke/path/is-parent-path`),l=require(`@stryke/path/replace`),u=require(`@stryke/type-checks/is-set-string`),d=require(`prettier/doc.js`);const f=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[(0,a.default)()]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,s.StormJSON.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let t=this,a=(0,i.renderTree)((0,r.createComponent)(n.Output,{context:t,get basePath(){return t.workspaceConfig.workspaceRoot},children:e}));await m(this,a,this.config.alloy)}}}}];var p=f;async function m(e,t,n={}){await(0,i.flushJobsAsync)();let r,a=async(t,s)=>{if(!Array.isArray(s))return;let u=async e=>{for(let t of s)await a(e,t)},d=(0,i.getContextForRenderNode)(s);if(!d)return u(t);if(d.meta?.directory){let e={kind:`directory`,path:d.meta.directory.path,contents:[]};t?t.contents.push(e):r=e,await u(e)}else if(d.meta?.sourceFile){if(!t)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let r;if(d.meta?.builtin){if(!d.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");e.log(o.LogLevelLabel.TRACE,`Rendering built-in runtime module with ID: ${d.meta.builtin.id}`),r={kind:`builtin`,id:d.meta.builtin.id,path:(0,l.replacePath)(d.meta.sourceFile.path,e.builtinsPath),filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,s,n)}}else d.meta?.entry||(0,c.isParentPath)(e.entryPath,d.meta.sourceFile.path)?(e.log(o.LogLevelLabel.TRACE,`Rendering entry module at path: ${d.meta.sourceFile.path}`),r={kind:`entry`,typeDefinition:d.meta.entry?.typeDefinition,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,s,n)}):(e.log(o.LogLevelLabel.TRACE,`Rendering source file at path: ${d.meta.sourceFile.path}`),r={kind:`file`,path:d.meta.sourceFile.path,filetype:d.meta.sourceFile.filetype,preset:d.meta.output?.mode,contents:await h(e,s,n)});t.contents.push(r)}else if(d.meta?.copyFile){if(!t)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(o.LogLevelLabel.TRACE,`Processing copy file operation from "${d.meta.copyFile.sourcePath}" to "${d.meta.copyFile.path}"`),!d.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!d.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");t.contents.push({kind:`file`,path:d.meta.copyFile.path,sourcePath:d.meta.copyFile.sourcePath,preset:d.meta.output?.preset})}else await u(t)};await a(void 0,t);let s=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await s(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!(0,u.isSetString)(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&(0,u.isSetString)(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await s(e,r)}async function h(e,t,n={}){n.printWidth??=160,n.tabWidth??=2,n.useTabs??=!1,n.insertFinalNewLine??=!0,await(0,i.flushJobsAsync)();let r=d.printer.printDocToString(g(t),n).formatted;return n.insertFinalNewLine&&!r.endsWith(`
2
+ `)?`${r}\n`:r}function g(e){let t=[];for(let n of e)if(typeof n==`string`){let e=n.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));t.push(e)}else (0,i.isPrintHook)(n)?t.push(n.print(n.subtree,g)):t.push(g(n));return t}exports.default=p;
@@ -0,0 +1,2 @@
1
+ import{PowerlinesContext as e}from"./core/contexts/context.mjs";import{Output as t}from"./core/components/output.mjs";import"./core/index.mjs";import"./helpers/index.mjs";import"./markdown/index.mjs";import"./typescript/index.mjs";import{createComponent as n}from"@alloy-js/core/jsx-runtime";import{flushJobsAsync as r,getContextForRenderNode as i,isPrintHook as a,renderTree as o}from"@alloy-js/core";import s from"@alloy-js/rollup-plugin";import{LogLevelLabel as c}from"@storm-software/config-tools/types";import{StormJSON as l}from"@stryke/json/storm-json";import{isParentPath as u}from"@stryke/path/is-parent-path";import{replacePath as d}from"@stryke/path/replace";import{isSetString as f}from"@stryke/type-checks/is-set-string";import{printer as p}from"prettier/doc.js";var m=(e={})=>[{name:`alloy:config`,config(){return{alloy:{typescript:!0,...e},build:{inputOptions:{transform:{jsx:{runtime:`classic`,pragma:`Alloy.createElement`,importSource:`@alloy-js/core`}}},plugins:[s()]}}},async configResolved(){(this.tsconfig.tsconfigJson.compilerOptions?.jsx!==`preserve`||this.tsconfig.tsconfigJson.compilerOptions?.jsxImportSource!==`@alloy-js/core`)&&(this.tsconfig.tsconfigJson.compilerOptions??={},this.tsconfig.tsconfigJson.compilerOptions.jsx!==`preserve`&&(this.tsconfig.tsconfigJson.compilerOptions.jsx=`preserve`),this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource!==`@alloy-js/core`&&(this.tsconfig.tsconfigJson.compilerOptions.jsxImportSource=`@alloy-js/core`),await this.fs.write(this.tsconfig.tsconfigFilePath,l.stringify(this.tsconfig.tsconfigJson))),this.dependencies[`@alloy-js/core`]=`^0.22.0`,this.config.alloy?.typescript!==!1&&(this.dependencies[`@alloy-js/typescript`]=`^0.22.0`),this.config.alloy?.json===!0&&(this.dependencies[`@alloy-js/json`]=`^0.22.0`),this.config.alloy?.markdown===!0&&(this.dependencies[`@alloy-js/markdown`]=`^0.22.0`)}},{name:`alloy:update-context`,configResolved:{order:`pre`,async handler(){this.render=async e=>{let r=this,i=o(n(t,{context:r,get basePath(){return r.workspaceConfig.workspaceRoot},children:e}));await h(this,i,this.config.alloy)}}}}];async function h(e,t,n={}){await r();let a,o=async(t,r)=>{if(!Array.isArray(r))return;let s=async e=>{for(let t of r)await o(e,t)},l=i(r);if(!l)return s(t);if(l.meta?.directory){let e={kind:`directory`,path:l.meta.directory.path,contents:[]};t?t.contents.push(e):a=e,await s(e)}else if(l.meta?.sourceFile){if(!t)throw Error(`Source file doesn't have parent directory. Make sure you have used the Output component.`);let i;if(l.meta?.builtin){if(!l.meta.builtin.id)throw Error("Built-in runtime module doesn't have an ID. Make sure you have used the `<BuiltinFile />` component.");e.log(c.TRACE,`Rendering built-in runtime module with ID: ${l.meta.builtin.id}`),i={kind:`builtin`,id:l.meta.builtin.id,path:d(l.meta.sourceFile.path,e.builtinsPath),filetype:l.meta.sourceFile.filetype,preset:l.meta.output?.mode,contents:await g(e,r,n)}}else l.meta?.entry||u(e.entryPath,l.meta.sourceFile.path)?(e.log(c.TRACE,`Rendering entry module at path: ${l.meta.sourceFile.path}`),i={kind:`entry`,typeDefinition:l.meta.entry?.typeDefinition,path:l.meta.sourceFile.path,filetype:l.meta.sourceFile.filetype,preset:l.meta.output?.mode,contents:await g(e,r,n)}):(e.log(c.TRACE,`Rendering source file at path: ${l.meta.sourceFile.path}`),i={kind:`file`,path:l.meta.sourceFile.path,filetype:l.meta.sourceFile.filetype,preset:l.meta.output?.mode,contents:await g(e,r,n)});t.contents.push(i)}else if(l.meta?.copyFile){if(!t)throw Error(`Copy file doesn't have parent directory. Make sure you have used the Output component.`);if(e.log(c.TRACE,`Processing copy file operation from "${l.meta.copyFile.sourcePath}" to "${l.meta.copyFile.path}"`),!l.meta.copyFile.sourcePath)throw Error("Copy file doesn't have a source path. Make sure you have provided a `sourcePath` property to the `meta.copyFile` context.");if(!l.meta.copyFile.path)throw Error("Copy file doesn't have a destination path. Make sure you have provided a `path` property to the `meta.copyFile` context.");t.contents.push({kind:`file`,path:l.meta.copyFile.path,sourcePath:l.meta.copyFile.sourcePath,preset:l.meta.output?.preset})}else await s(t)};await o(void 0,t);let s=async(e,t)=>{for(let n of t.contents)if(n.kind===`directory`)await s(e,n);else if(n.kind===`builtin`)await e.emitBuiltin(n.contents,n.id,n.path);else if(n.kind===`entry`)await e.emitEntry(n.contents,n.path,n.typeDefinition);else if(n.kind===`file`)if(`sourcePath`in n&&n.sourcePath){if(!e.fs.existsSync(n.sourcePath))throw Error(`Source file "${n.sourcePath}" for copy operation does not exist.`);let t=await e.fs.read(n.sourcePath);if(!f(t))throw Error(`Source file "${n.sourcePath}" for copy operation is empty.`);await e.fs.write(n.path,t)}else if(`contents`in n&&f(n.contents))await e.fs.write(n.path,n.contents);else throw Error(`Unexpected output extracted from the render tree: \n\n${JSON.stringify(n,null,2)}`)};await s(e,a)}async function g(e,t,n={}){n.printWidth??=160,n.tabWidth??=2,n.useTabs??=!1,n.insertFinalNewLine??=!0,await r();let i=p.printDocToString(_(t),n).formatted;return n.insertFinalNewLine&&!i.endsWith(`
2
+ `)?`${i}\n`:i}function _(e){let t=[];for(let n of e)if(typeof n==`string`){let e=n.split(/\r?\n/).flatMap((e,t,n)=>(n.length-1,[e]));t.push(e)}else a(n)?t.push(n.print(n.subtree,_)):t.push(_(n));return t}export{m as default};
@@ -0,0 +1 @@
1
+ require(`./markdown-file.cjs`),require(`./markdown-table.cjs`);
@@ -0,0 +1 @@
1
+ import"./markdown-file.mjs";import"./markdown-table.mjs";export{};
@@ -0,0 +1 @@
1
+ require(`../../core/contexts/context.cjs`),require(`../../core/components/single-line-comment.cjs`),require(`../../core/components/source-file.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@stryke/string-format/title-case`),r=require(`@alloy-js/markdown`);
@@ -0,0 +1 @@
1
+ import"../../core/contexts/context.mjs";import"../../core/components/single-line-comment.mjs";import"../../core/components/source-file.mjs";import{createComponent as e,createIntrinsic as t,mergeProps as n}from"@alloy-js/core/jsx-runtime";import{Show as r,code as i,splitProps as a}from"@alloy-js/core";import{titleCase as o}from"@stryke/string-format/title-case";import{Link as s}from"@alloy-js/markdown";export{};
@@ -0,0 +1 @@
1
+ require(`../contexts/markdown-table.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@stryke/type-checks/is-undefined`),r=require(`@stryke/string-format/title-case`);
@@ -0,0 +1 @@
1
+ import"../contexts/markdown-table.mjs";import{createComponent as e,mergeProps as t}from"@alloy-js/core/jsx-runtime";import{Show as n,code as r,computed as i,splitProps as a}from"@alloy-js/core";import{isUndefined as o}from"@stryke/type-checks/is-undefined";import{titleCase as s}from"@stryke/string-format/title-case";export{};
@@ -0,0 +1 @@
1
+ require(`./markdown-table.cjs`);
@@ -0,0 +1 @@
1
+ import"./markdown-table.mjs";export{};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@alloy-js/core`);const n=(0,t.createNamedContext)(`markdown-table-column`,{}),r=(0,t.createContext)({columns:[],data:[]});
@@ -0,0 +1 @@
1
+ import{createContext as e,createNamedContext as t}from"@alloy-js/core";t(`markdown-table-column`,{}),e({columns:[],data:[]});export{};
@@ -0,0 +1 @@
1
+ require(`./components/index.cjs`),require(`./contexts/index.cjs`);
@@ -0,0 +1 @@
1
+ import"./components/index.mjs";import"./contexts/index.mjs";export{};
@@ -0,0 +1,5 @@
1
+ import "../../../powerlines/src/types/fs.mjs";
2
+ import "../../../powerlines/src/types/resolved.mjs";
3
+ import { Children } from "@alloy-js/core/jsx-runtime";
4
+ import "@alloy-js/core";
5
+ import "@alloy-js/typescript";
@@ -0,0 +1,2 @@
1
+ import "./components.mjs";
2
+ import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "./plugin.mjs";
@@ -0,0 +1,38 @@
1
+ import { PluginContext } from "../../../powerlines/src/types/context.cjs";
2
+ import { UserConfig } from "../../../powerlines/src/types/config.cjs";
3
+ import { ResolvedConfig } from "../../../powerlines/src/types/resolved.cjs";
4
+ import { PrintTreeOptions } from "@alloy-js/core";
5
+ import { Children as Children$1 } from "@alloy-js/core/jsx-runtime";
6
+
7
+ //#region ../plugin-alloy/src/types/plugin.d.ts
8
+ type AlloyPluginOptions = Partial<PrintTreeOptions> & {
9
+ /**
10
+ * If true, the Alloy framework is used to generate Typescript output files.
11
+ *
12
+ * @defaultValue true
13
+ */
14
+ typescript?: boolean;
15
+ /**
16
+ * If true, the Alloy framework is used to generate JSON output files.
17
+ *
18
+ * @defaultValue false
19
+ */
20
+ json?: boolean;
21
+ /**
22
+ * If true, the Alloy framework is used to generate Markdown output files.
23
+ *
24
+ * @defaultValue false
25
+ */
26
+ markdown?: boolean;
27
+ };
28
+ type AlloyPluginUserConfig = UserConfig & {
29
+ alloy?: AlloyPluginOptions;
30
+ };
31
+ type AlloyPluginResolvedConfig = ResolvedConfig & {
32
+ alloy: AlloyPluginOptions;
33
+ };
34
+ type AlloyPluginContext<TResolvedConfig extends AlloyPluginResolvedConfig = AlloyPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
35
+ render: <TContext extends AlloyPluginContext>(this: TContext, children: Children$1) => Promise<void>;
36
+ };
37
+ //#endregion
38
+ export { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig };
@@ -0,0 +1,38 @@
1
+ import { PluginContext } from "../../../powerlines/src/types/context.mjs";
2
+ import { UserConfig } from "../../../powerlines/src/types/config.mjs";
3
+ import { ResolvedConfig } from "../../../powerlines/src/types/resolved.mjs";
4
+ import { Children } from "@alloy-js/core/jsx-runtime";
5
+ import { PrintTreeOptions } from "@alloy-js/core";
6
+
7
+ //#region ../plugin-alloy/src/types/plugin.d.ts
8
+ type AlloyPluginOptions = Partial<PrintTreeOptions> & {
9
+ /**
10
+ * If true, the Alloy framework is used to generate Typescript output files.
11
+ *
12
+ * @defaultValue true
13
+ */
14
+ typescript?: boolean;
15
+ /**
16
+ * If true, the Alloy framework is used to generate JSON output files.
17
+ *
18
+ * @defaultValue false
19
+ */
20
+ json?: boolean;
21
+ /**
22
+ * If true, the Alloy framework is used to generate Markdown output files.
23
+ *
24
+ * @defaultValue false
25
+ */
26
+ markdown?: boolean;
27
+ };
28
+ type AlloyPluginUserConfig = UserConfig & {
29
+ alloy?: AlloyPluginOptions;
30
+ };
31
+ type AlloyPluginResolvedConfig = ResolvedConfig & {
32
+ alloy: AlloyPluginOptions;
33
+ };
34
+ type AlloyPluginContext<TResolvedConfig extends AlloyPluginResolvedConfig = AlloyPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
35
+ render: <TContext extends AlloyPluginContext>(this: TContext, children: Children) => Promise<void>;
36
+ };
37
+ //#endregion
38
+ export { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig };
@@ -0,0 +1 @@
1
+ require(`./tsdoc.cjs`),require(`./typescript-file.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`);
@@ -0,0 +1 @@
1
+ import"./tsdoc.mjs";import"./typescript-file.mjs";import{createComponent as e,mergeProps as t}from"@alloy-js/core/jsx-runtime";import{splitProps as n}from"@alloy-js/core";export{};
@@ -0,0 +1 @@
1
+ let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@alloy-js/typescript`);
@@ -0,0 +1 @@
1
+ import{createComponent as e,mergeProps as t}from"@alloy-js/core/jsx-runtime";import{code as n}from"@alloy-js/core";import{VarDeclaration as r}from"@alloy-js/typescript";export{};
@@ -0,0 +1 @@
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);require(`../../core/contexts/context.cjs`),require(`./typescript-file.cjs`);let t=require(`@alloy-js/core/jsx-runtime`),n=require(`@alloy-js/core`),r=require(`defu`);r=e.__toESM(r);let i=require(`@stryke/path/join-paths`);
@@ -0,0 +1 @@
1
+ import"../../core/contexts/context.mjs";import"./typescript-file.mjs";import{createComponent as e,mergeProps as t}from"@alloy-js/core/jsx-runtime";import{computed as n,splitProps as r}from"@alloy-js/core";import i from"defu";import{joinPaths as a}from"@stryke/path/join-paths";export{};
@@ -0,0 +1 @@
1
+ require(`./tsdoc.cjs`),require(`./typescript-file.cjs`),require(`./builtin-file.cjs`),require(`./dynamic-import-statement.cjs`),require(`./entry-file.cjs`),require(`./record-expression.cjs`),require(`./tsdoc-reflection.cjs`),require(`./typescript-interface.cjs`),require(`./typescript-object.cjs`);
@@ -0,0 +1 @@
1
+ import"./tsdoc.mjs";import"./typescript-file.mjs";import"./builtin-file.mjs";import"./dynamic-import-statement.mjs";import"./entry-file.mjs";import"./record-expression.mjs";import"./tsdoc-reflection.mjs";import"./typescript-interface.mjs";import"./typescript-object.mjs";export{};
@@ -0,0 +1 @@
1
+ let e=require(`@alloy-js/core`);
@@ -0,0 +1 @@
1
+ import{code as e}from"@alloy-js/core";export{};
@@ -0,0 +1 @@
1
+ require(`../../core/contexts/reflection.cjs`),require(`./tsdoc.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/type-checks/is-string`),i=require(`@stryke/type-checks/is-undefined`),a=require(`@stryke/string-format/title-case`);
@@ -0,0 +1 @@
1
+ import"../../core/contexts/reflection.mjs";import"./tsdoc.mjs";import{createComponent as e,memo as t,mergeProps as n}from"@alloy-js/core/jsx-runtime";import{Show as r,code as i,computed as a,splitProps as o}from"@alloy-js/core";import{isSetString as s}from"@stryke/type-checks/is-set-string";import{isString as c}from"@stryke/type-checks/is-string";import{isUndefined as l}from"@stryke/type-checks/is-undefined";import{titleCase as u}from"@stryke/string-format/title-case";export{};
@@ -0,0 +1 @@
1
+ require(`../../core/contexts/context.cjs`),require(`../../../../deepkit/src/utilities.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/type-checks/is-undefined`);