@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
@@ -0,0 +1,46 @@
1
+ import { type_d_exports } from "../deepkit/src/vendor/type.cjs";
2
+ import { EnvInterface, SecretsInterface } from "../types/runtime.cjs";
3
+ import { EnvPluginContext } from "../types/plugin.cjs";
4
+
5
+ //#region src/helpers/reflect.d.ts
6
+ declare function mergeEnvReflections(context: EnvPluginContext, reflections: type_d_exports.ReflectionClass<any>[]): type_d_exports.ReflectionClass<any>;
7
+ declare function mergeSecretsReflections(context: EnvPluginContext, reflections: type_d_exports.ReflectionClass<any>[]): type_d_exports.ReflectionClass<any>;
8
+ interface CreateEnvReflectionOptions {
9
+ type?: type_d_exports.TypeObjectLiteral | type_d_exports.TypeClass;
10
+ superReflection?: type_d_exports.ReflectionClass<any>;
11
+ }
12
+ declare class BaseEnv implements EnvInterface {
13
+ APP_NAME: string;
14
+ APP_VERSION: string;
15
+ BUILD_ID: string;
16
+ BUILD_TIMESTAMP: string;
17
+ BUILD_CHECKSUM: string;
18
+ RELEASE_ID: string;
19
+ RELEASE_TAG: string;
20
+ ORGANIZATION: string;
21
+ PLATFORM: "node" | "browser" | "neutral";
22
+ MODE: "development" | "test" | "production";
23
+ ENVIRONMENT: string;
24
+ DEBUG: boolean;
25
+ TEST: boolean;
26
+ MINIMAL: boolean;
27
+ NO_COLOR: boolean;
28
+ FORCE_COLOR: number | boolean;
29
+ FORCE_HYPERLINK: number | boolean;
30
+ STACKTRACE: boolean;
31
+ INCLUDE_ERROR_DATA: boolean;
32
+ ERROR_URL: string;
33
+ DEFAULT_TIMEZONE: string;
34
+ DEFAULT_LOCALE: string;
35
+ CI: boolean;
36
+ }
37
+ declare class BaseSecrets implements SecretsInterface {
38
+ ENCRYPTION_KEY: string;
39
+ }
40
+ declare function createEnvReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): type_d_exports.ReflectionClass<any>;
41
+ declare function createSecretsReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): type_d_exports.ReflectionClass<any>;
42
+ declare function reflectEnv(context: EnvPluginContext, file?: string, name?: string): Promise<type_d_exports.ReflectionClass<any>>;
43
+ declare function reflectSecrets(context: EnvPluginContext, file?: string, name?: string): Promise<type_d_exports.ReflectionClass<any>>;
44
+ declare type __ΩCreateEnvReflectionOptions = any[];
45
+ //#endregion
46
+ export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
@@ -0,0 +1,46 @@
1
+ import { type_d_exports } from "../deepkit/src/vendor/type.mjs";
2
+ import { EnvInterface, SecretsInterface } from "../types/runtime.mjs";
3
+ import { EnvPluginContext } from "../types/plugin.mjs";
4
+
5
+ //#region src/helpers/reflect.d.ts
6
+ declare function mergeEnvReflections(context: EnvPluginContext, reflections: type_d_exports.ReflectionClass<any>[]): type_d_exports.ReflectionClass<any>;
7
+ declare function mergeSecretsReflections(context: EnvPluginContext, reflections: type_d_exports.ReflectionClass<any>[]): type_d_exports.ReflectionClass<any>;
8
+ interface CreateEnvReflectionOptions {
9
+ type?: type_d_exports.TypeObjectLiteral | type_d_exports.TypeClass;
10
+ superReflection?: type_d_exports.ReflectionClass<any>;
11
+ }
12
+ declare class BaseEnv implements EnvInterface {
13
+ APP_NAME: string;
14
+ APP_VERSION: string;
15
+ BUILD_ID: string;
16
+ BUILD_TIMESTAMP: string;
17
+ BUILD_CHECKSUM: string;
18
+ RELEASE_ID: string;
19
+ RELEASE_TAG: string;
20
+ ORGANIZATION: string;
21
+ PLATFORM: "node" | "browser" | "neutral";
22
+ MODE: "development" | "test" | "production";
23
+ ENVIRONMENT: string;
24
+ DEBUG: boolean;
25
+ TEST: boolean;
26
+ MINIMAL: boolean;
27
+ NO_COLOR: boolean;
28
+ FORCE_COLOR: number | boolean;
29
+ FORCE_HYPERLINK: number | boolean;
30
+ STACKTRACE: boolean;
31
+ INCLUDE_ERROR_DATA: boolean;
32
+ ERROR_URL: string;
33
+ DEFAULT_TIMEZONE: string;
34
+ DEFAULT_LOCALE: string;
35
+ CI: boolean;
36
+ }
37
+ declare class BaseSecrets implements SecretsInterface {
38
+ ENCRYPTION_KEY: string;
39
+ }
40
+ declare function createEnvReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): type_d_exports.ReflectionClass<any>;
41
+ declare function createSecretsReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): type_d_exports.ReflectionClass<any>;
42
+ declare function reflectEnv(context: EnvPluginContext, file?: string, name?: string): Promise<type_d_exports.ReflectionClass<any>>;
43
+ declare function reflectSecrets(context: EnvPluginContext, file?: string, name?: string): Promise<type_d_exports.ReflectionClass<any>>;
44
+ declare type __ΩCreateEnvReflectionOptions = any[];
45
+ //#endregion
46
+ export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
@@ -0,0 +1 @@
1
+ import{type_exports as e}from"../deepkit/src/vendor/type.mjs";import{reflectType as t}from"../deepkit/src/reflect-type.mjs";import{getEnvDefaultTypeDefinition as n,getSecretsDefaultTypeDefinition as r,readEnvTypeReflection as i,readSecretsReflection as a}from"./persistence.mjs";import{isParentPath as o}from"@stryke/path/is-parent-path";import{titleCase as s}from"@stryke/string-format/title-case";import{joinPaths as c}from"@stryke/path/join-paths";function l(t,n){return p(t,{type:(0,e.merge)(n.map(e=>e.type))})}function u(t,n){return m(t,{type:(0,e.merge)(n.map(e=>e.type))})}var d=class{PLATFORM=`neutral`;MODE=`production`;DEBUG=!1;TEST=!1;MINIMAL=!1;NO_COLOR=!1;FORCE_COLOR=!1;FORCE_HYPERLINK=!1;STACKTRACE=!1;INCLUDE_ERROR_DATA=!1;CI=!1},f=class{};function p(t,n={}){let r=n.superReflection??new e.ReflectionClass({kind:e.ReflectionKind.class,description:`The base environment configuration definition for the ${s(t.config.name)} project.`,classType:d,types:[],implements:[{kind:e.ReflectionKind.objectLiteral,typeName:`EnvInterface`,description:`The environment configuration interface definition for the ${s(t.config.name)} project.`,types:[]}]});r.name=`Env`;let i=new e.ReflectionClass(n.type??{kind:e.ReflectionKind.objectLiteral,typeName:`Env`,description:`A schema describing the list of available environment variables that can be used by the ${t.config.name?`${s(t.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Env`,i}function m(t,n={}){let r=n.superReflection??new e.ReflectionClass({kind:e.ReflectionKind.class,description:`The base secrets configuration definition for the ${s(t.config.name)} project.`,classType:f,types:[],implements:[{kind:e.ReflectionKind.objectLiteral,typeName:`SecretsInterface`,description:`The secrets configuration interface definition for the ${s(t.config.name)} project.`,types:[]}]});r.name=`Secrets`;let i=new e.ReflectionClass(n.type??{kind:e.ReflectionKind.objectLiteral,typeName:`Secrets`,description:`A schema describing the list of available environment secrets that can be used by the ${t.config.name?`${s(t.config.name)} application`:`application`}.`,types:[]},r);return i.name=`Secrets`,i}async function h(r,a,s){let u;a&&(u=(0,e.resolveClassType)(await t(r,{file:o(a,r.workspaceConfig.workspaceRoot)?a:c(r.workspaceConfig.workspaceRoot,a),name:s},{skipNodeModulesBundle:!0})));let d=await t(r,await n(r));return l(r,[await i(r,`env`),u,(0,e.resolveClassType)(d)].filter(Boolean))}async function g(n,i,s){let l;i&&(l=(0,e.resolveClassType)(await t(n,{file:o(i,n.workspaceConfig.workspaceRoot)?i:c(n.workspaceConfig.workspaceRoot,i),name:s},{skipNodeModulesBundle:!0})));let d=await t(n,await r(n));return u(n,[await a(n),l,(0,e.resolveClassType)(d)].filter(Boolean))}export{d as BaseEnv,f as BaseSecrets,p as createEnvReflection,m as createSecretsReflection,l as mergeEnvReflections,u as mergeSecretsReflections,h as reflectEnv,g as reflectSecrets};
@@ -0,0 +1 @@
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/type-checks/is-string`),n=require(`@stryke/string-format/camel-case`),r=require(`@stryke/env/types`);function i(e){if((0,t.isString)(e)){let t=r.ENV_PREFIXES.reduce((e,t)=>(e.startsWith(t)&&(e=e.slice(t.length)),e),e.toUpperCase());for(;t.startsWith(`_`);)t=t.slice(1);return t}return Object.keys(e).reduce((t,n)=>{let r=i(n);return r&&(t[r]=e[n]),t},{})}function a(e){return(0,n.camelCase)(i(e))}exports.formatEnvField=a,exports.removeEnvPrefix=i;
@@ -0,0 +1,8 @@
1
+ import { DotenvParseOutput } from "@stryke/env/types";
2
+
3
+ //#region src/helpers/source-file-env.d.ts
4
+ type TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;
5
+ declare function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(env: TEnv): TReturned<TEnv>;
6
+ declare function formatEnvField(key: string): string;
7
+ //#endregion
8
+ export { formatEnvField, removeEnvPrefix };
@@ -0,0 +1,8 @@
1
+ import { DotenvParseOutput } from "@stryke/env/types";
2
+
3
+ //#region src/helpers/source-file-env.d.ts
4
+ type TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;
5
+ declare function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(env: TEnv): TReturned<TEnv>;
6
+ declare function formatEnvField(key: string): string;
7
+ //#endregion
8
+ export { formatEnvField, removeEnvPrefix };
@@ -0,0 +1 @@
1
+ import{isString as e}from"@stryke/type-checks/is-string";import{camelCase as t}from"@stryke/string-format/camel-case";import{ENV_PREFIXES as n}from"@stryke/env/types";function r(t){if(e(t)){let e=n.reduce((e,t)=>(e.startsWith(t)&&(e=e.slice(t.length)),e),t.toUpperCase());for(;e.startsWith(`_`);)e=e.slice(1);return e}return Object.keys(t).reduce((e,n)=>{let i=r(n);return i&&(e[i]=t[n]),e},{})}function i(e){return t(r(e))}export{i as formatEnvField,r as removeEnvPrefix};
@@ -0,0 +1 @@
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./persistence.cjs`);let n=require(`@stryke/string-format/title-case`);async function r(e,r){let i=await t.readEnvTypeReflection(e,r);return i.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{i.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()||(0,n.titleCase)(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})})}),i}exports.createTemplateReflection=r;
@@ -0,0 +1,15 @@
1
+ import { type_d_exports } from "../deepkit/src/vendor/type.cjs";
2
+ import { EnvPluginContext, EnvType } from "../types/plugin.cjs";
3
+
4
+ //#region src/helpers/template-helpers.d.ts
5
+
6
+ /**
7
+ * Creates the reflection data used when generating runtime template files.
8
+ *
9
+ * @param context - The context for the configuration plugin.
10
+ * @param name - The name of the configuration template.
11
+ * @returns The reflection for the specified configuration template.
12
+ */
13
+ declare function createTemplateReflection(context: EnvPluginContext, name?: EnvType): Promise<type_d_exports.ReflectionClass<any>>;
14
+ //#endregion
15
+ export { createTemplateReflection };
@@ -0,0 +1,15 @@
1
+ import { type_d_exports } from "../deepkit/src/vendor/type.mjs";
2
+ import { EnvPluginContext, EnvType } from "../types/plugin.mjs";
3
+
4
+ //#region src/helpers/template-helpers.d.ts
5
+
6
+ /**
7
+ * Creates the reflection data used when generating runtime template files.
8
+ *
9
+ * @param context - The context for the configuration plugin.
10
+ * @param name - The name of the configuration template.
11
+ * @returns The reflection for the specified configuration template.
12
+ */
13
+ declare function createTemplateReflection(context: EnvPluginContext, name?: EnvType): Promise<type_d_exports.ReflectionClass<any>>;
14
+ //#endregion
15
+ export { createTemplateReflection };
@@ -0,0 +1 @@
1
+ import{readEnvTypeReflection as e}from"./persistence.mjs";import{titleCase as t}from"@stryke/string-format/title-case";async function n(n,r){let i=await e(n,r);return i.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(n=>{i.addProperty({name:n,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!==n).concat(e.name),title:e.getTitle()||t(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})})}),i}export{n as createTemplateReflection};
package/dist/index.cjs CHANGED
@@ -1,14 +1,10 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./create-reflection-resource-BEDScc6f.cjs`),t=require(`./env-k_8Sz-kF.cjs`),n=require(`./docs--ddXDQBx.cjs`);require(`./components-C9bYrQVK.cjs`),require(`./plugin-D5qyQPqC.cjs`),require(`./runtime-Bisl_1Ja.cjs`),require(`./types-MYBaygjr.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@stryke/convert/to-array`),a=require(`@stryke/fs/is-file`),o=require(`@stryke/fs/list-files`),s=require(`@stryke/path/append`),c=require(`@stryke/path/is-type`),l=require(`@stryke/path/join-paths`),ee=require(`@stryke/path/replace`),u=require(`automd`),d=require(`c12`),f=require(`defu`);f=e.O(f);let p=require(`markdown-toc`);p=e.O(p);let m=require(`@babel/core`),h=require(`@storm-software/config-tools/types`),g=require(`@stryke/path/file-path-fns`),_=require(`@stryke/path/is-parent-path`),te=require(`@stryke/type-checks/is-set-object`),v=require(`@stryke/type-checks/is-function`);require(`@stryke/type-checks/is-object`);let y=require(`@stryke/type-checks/is-set-string`),b=require(`chalk`);b=e.O(b);let x=require(`@babel/generator`);x=e.O(x),require(`@babel/parser`);let S=require(`@babel/helper-plugin-utils`);require(`@storm-software/config-tools/logger`),require(`@storm-software/config-tools/utilities/colors`),require(`@stryke/helpers/noop`);let ne=require(`@stryke/string-format/kebab-case`),C=require(`@stryke/string-format/title-case`),w=require(`@babel/types`);w=e.O(w);let T=require(`@stryke/type-checks/is-string`),E=require(`@stryke/convert/parse-type-definition`),D=require(`@stryke/env/types`),O=require(`@stryke/fs/exists`),k=require(`@stryke/fs/helpers`),A=require(`@stryke/path/join`),j=require(`@stryke/string-format/constant-case`),M=require(`@stryke/capnp`);M=e.O(M);let N=require(`@stryke/helpers/get-unique`),P=require(`@stryke/json/storm-json`),re=require(`@stryke/type-checks/is-null`),ie=require(`@stryke/type-checks/is-undefined`),F=require(`@stryke/fs/buffer`),I=require(`node:fs`);const L=(e={})=>({name:`automd`,async config(){let t=await(0,u.loadConfig)((0,l.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot),e);return(!t.prefix||!Array.isArray(t.prefix))&&(t.prefix=(0,i.toArray)(t.prefix??[])),t.prefix.includes(`automd`)||t.prefix.push(`automd`),t.prefix.includes(`powerlines`)||t.prefix.push(`powerlines`),{automd:(0,f.default)(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&&!(0,i.toArray)(this.config.automd.prefix).includes(this.config.framework)&&(this.config.automd.prefix=(0,i.toArray)(this.config.automd.prefix).concat(this.config.framework)),this.config.automd.configFile){let{config:e}=await(0,d.loadConfig)({cwd:this.config.automd.dir,configFile:this.config.automd.configFile,defaults:{ignore:[`**/node_modules`,`**/dist`,`**/.*`],dir:this.config.automd.dir}});this.config.automd=(0,u.resolveConfig)((0,f.default)(this.config.automd,{...e,prefix:(0,i.toArray)(e.prefix??[])}))}this.config.automd.input=(await Promise.all((0,i.toArray)(this.config.automd.input).map(async e=>e.includes(`*`)?(0,o.listFiles)((0,c.isAbsolutePath)(e)?e:(0,s.appendPath)(e,this.config.projectRoot),{ignore:this.config.automd.ignore}):(0,c.isAbsolutePath)(e)?e:(0,s.appendPath)(e,this.config.projectRoot)))).flat(),this.config.automd.output&&!(0,c.isAbsolutePath)(this.config.automd.output)&&(this.config.automd.output=(0,s.appendPath)(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:(0,p.default)(e.block.md,{...t,maxdepth:t.maxDepth,first1:t.firstH1}).content}}})},async docs(){await Promise.all((0,i.toArray)(this.config.automd.input).map(async e=>{let t=await this.fs.read(e);if(t){let n=await(0,u.transform)(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((0,s.appendPath)(this.config.automd.output?(0,a.isDirectory)(this.config.automd.output)?(0,ee.replacePath)(e,this.config.automd.output):this.config.automd.output:e,this.config.projectRoot),n.contents)}}))}});var R=L;function z(e){return(0,y.isSetString)(e)?e:Array.isArray(e)&&e.length>0?z(e[0]):e.$$name||e.name?e.$$name||e.name:void 0}function B(e,t){return!!(z(t)&&e.some(e=>Array.isArray(e)&&z(e[0])===z(t)))}function V(e,t){try{return Array.isArray(t)&&t.length>0&&t[0]?(0,v.isFunction)(t[0])?t[0](e):t[0]:(0,v.isFunction)(t)?t(e):t}catch{return t[0]}}function H(e,t,n,r){if(Array.isArray(r)&&r.length>0&&r[0]){if(r.length>2&&r[2]&&(0,v.isFunction)(r[2])&&!r[2](t,n)){e.log(h.LogLevelLabel.TRACE,`Skipping filtered Babel plugin ${b.default.bold.cyanBright(z(r)||`unnamed`)} for ${n}`);return}return r.length>2?[V(e,r),r[1],r[2]]:[V(e,r),r[1],null]}return[V(e,r),{},null]}let U=x.default;`default`in U&&(U=U.default);const W=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#D8B4FE`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`,`#8B5CF6`],G=(e,t)=>(n,...r)=>e(n,` ${b.default.inverse.hex(W[t.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%W.length]||W[0])(` ${(0,C.titleCase)(t)} `)} ${r.join(` `)} `);function K(e,t){let n=n=>(0,S.declare)((r,i,a)=>{r.cache.using(()=>n.meta.checksum),r.assertVersion(`^7.0.0-0`);let o=G(n.log,e);o(h.LogLevelLabel.TRACE,`Initializing the ${b.default.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(h.LogLevelLabel.TRACE,`Completed initialization of the ${b.default.bold.cyanBright(e)} Babel plugin`),s});return n.$$name=e,n}function q(e,t){oe(e.scope.getProgramParent().path,t)}function J(e){return e.get(`specifiers`).filter(Boolean).every(e=>e?.isImportSpecifier())&&e.node.importKind!==`type`&&e.node.importKind!==`typeof`}function ae(e){let t=new Map;return e.traverse({ImportDeclaration(e){J(e)&&t.set(e.node.source.value,e)}}),t}function oe(e,t){ae(e).get(t.module)||e.unshiftContainer(`body`,w.importDeclaration([w.importSpecifier(w.identifier(t.name||t.imported),w.identifier(t.imported))],w.stringLiteral(t.module)))}const se=(e={})=>({name:`babel`,config(){if((0,te.isSetObject)(e))return{transform:{babel:e}}},configResolved:{order:`pre`,handler(){this.devDependencies[`@babel/core`]=`^7.28.4`,this.config.transform.babel=(0,f.default)(this.config.transform.babel??{},{plugins:[],presets:[]})}},async transform(t,n){if((0,_.isParentPath)(n,this.powerlinesPath)||t.includes(`/* @storm-ignore */`)||t.includes(`/* @storm-disable */`))return this.log(h.LogLevelLabel.TRACE,`Skipping Babel transformation for: ${n}`),{code:t,id:n};this.log(h.LogLevelLabel.TRACE,`Babel transforming file: ${n}`);let r=this.config.transform.babel.plugins.map(e=>H(this,t,n,e)).filter((e,t,n)=>e&&!B(n,e)),i=this.config.transform.babel.presets.map(e=>H(this,t,n,e)).filter((e,t,n)=>e&&!B(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((0,g.findFileExtensionSafe)(n))&&!B(r,`@babel/plugin-syntax-typescript`)&&!B(i,`@babel/preset-typescript`)&&r.unshift([`@babel/plugin-syntax-typescript`,{isTSX:(0,g.findFileExtension)(n)===`.tsx`}]);let a=await(0,m.transformAsync)(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],(0,f.default)(t.length>1&&t[1]?t[1]:{},{options:e})]:t).filter(Boolean),presets:i.map(t=>Array.isArray(t)&&t.length>=2?[t[0],(0,f.default)(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}}});var ce=se;function le(e,t){return X(e.type,t??e.getDefaultValue())}function Y(e){return`"${String(e).replaceAll(`"`,`\\"`)}"`}function X(t,n){return(0,ie.isUndefined)(n)?`undefined`:(0,re.isNull)(n)?`null`:t.kind===e.D.ReflectionKind.boolean?String(n).trim().toLowerCase()===`true`?`true`:`false`:t.kind===e.D.ReflectionKind.string||t.kind===e.D.ReflectionKind.literal&&(0,T.isString)(t.literal)?Y(n):t.kind===e.D.ReflectionKind.enum?ue(t).kind===e.D.ReflectionKind.string?Y(n):`${String(n)}`:t.kind===e.D.ReflectionKind.union?Z(t)?Y(n):`${String(n)}`:t.kind===e.D.ReflectionKind.array?Y(P.StormJSON.stringify(n)):t.kind===e.D.ReflectionKind.object||t.kind===e.D.ReflectionKind.objectLiteral?P.StormJSON.stringify(n):t.kind===e.D.ReflectionKind.property||t.kind===e.D.ReflectionKind.parameter?X(t.type,n):String(n)}function ue(t){if(t.kind!==e.D.ReflectionKind.enum)throw Error(`Expected a TypeEnum, but received ${t.kind}.`);let n=(0,N.getUniqueBy)(t.values.filter(e=>e!=null),t=>(0,T.isString)(t)?{kind:e.D.ReflectionKind.string}:{kind:e.D.ReflectionKind.number});if(n.length===0)throw Error(`No valid enum members could be found.`);return n[0]&&(0,T.isString)(n[0])?{kind:e.D.ReflectionKind.string}:{kind:e.D.ReflectionKind.number}}function de(t){if(t.kind===e.D.ReflectionKind.union&&t.types.length>0)return(0,N.getUniqueBy)(t.types,e=>e.kind);throw Error(`Expected a TypeUnion, but received ${t.kind}.`)}function Z(t){return de(t).some(t=>t.kind===e.D.ReflectionKind.string||t.kind===e.D.ReflectionKind.literal&&(0,T.isString)(t.literal))}const Q=K(`env`,({log:t,context:n})=>{function r(e,r,i=!1){let a=n.env.types.env?.getProperties().filter(e=>e.getAlias().length>0);if(e.name){let o=n.config.env.prefix.find(t=>e.name&&e.name.startsWith(t)&&(n.env.types.env?.hasProperty(e.name.replace(`${t}_`,``))||a.some(n=>n.getAlias().includes(e.name.replace(`${t}_`,``))))),s=e.name;if(o&&(s=e.name.replace(`${o}_`,``)),t(h.LogLevelLabel.TRACE,`Environment variable ${s} found in ${r.filename||`unknown file`}.`),n.env.types.env?.hasProperty(s)||a.some(e=>e.getAlias().includes(s))){let e=n.env.types.env.hasProperty(s)?n.env.types.env.getProperty(s):a.find(e=>e.getAlias().includes(s));if(!e||e.isIgnored())return;if(n.env.used.env.hasProperty(s)||n.env.used.env.addProperty(e.property),n.config.env.inject&&i){let t=n.env.parsed?.[s];if(t===void 0){let e=n.config.env.prefix.find(e=>n.env.parsed[`${e.replace(/_$/g,``)}_${s}`]);e&&(t=n.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 le(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 ${r.filename?r.filename:`unknown`}.
2
-
3
- The following environment configuration names are defined in the \`env\` type definition: \n${n.env.types.env?.getPropertyNames().sort((e,t)=>String(e).localeCompare(String(t))).map(e=>` - ${String(e)} ${a.some(t=>t.getNameAsString()===String(e)&&t.getAlias().length>0)?`(Alias: ${a?.find(t=>t.getNameAsString()===String(e))?.getAlias().join(`, `)})`:``}`).join(`
4
- `)} \n\nUsing the following env prefix: \n${n.config.env.prefix.map(e=>` - ${e}`).join(`
5
- `)} \n\nPlease check your \`env\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \n\n`)}}return{visitor:{MemberExpression(e,t){if(e.get(`object`)?.get(`property`)?.isIdentifier({name:`env`})&&e.get(`object`)?.get(`object`)?.isIdentifier({name:`$storm`})&&e.get(`property`)?.isIdentifier()){let n=e.get(`property`)?.node;r(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),q(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;r(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),q(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;r(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),q(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;r(n,t,!1),e.replaceWithSourceString(`env.${n.name}`),q(e,{module:`storm:env`,name:`env`,imported:`env`})}}},post(){t(h.LogLevelLabel.TRACE,`Adding environment variables from ${this.filename||`unknown file`} to env.json.`);let r=e.D.ReflectionClass.from({kind:e.D.ReflectionKind.objectLiteral,description:`An object containing the environment variables used by the application.`,types:[]}),i=e.s(n,`env`);i&&(0,I.existsSync)(i)&&(t(h.LogLevelLabel.TRACE,`Environment reflection file found at ${i}, reading existing reflection.`),r=(0,e.D.resolveClassType)((0,e.D.deserializeType)(e.E(new M.Message((0,F.readFileBufferSync)(i),!1).getRoot(e.T).types)))),t(h.LogLevelLabel.TRACE,`Adding new variables to env reflection at ${i}.`),r.getProperties().filter(e=>e.getNameAsString()&&!n.env.used.env.hasProperty(e.getNameAsString())).forEach(e=>{n.env.used.env.addProperty({...e,name:e.getNameAsString(),description:e.getDescription()??`The ${e.getNameAsString()} variable.`,default:e.getDefaultValue(),optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,visibility:e.getVisibility(),type:e.getType(),tags:e.getTags()})})}}}),fe=e=>(0,u.defineGenerator)({name:`env`,async generate(){let t=(0,l.joinPaths)(e.config.projectRoot,`docs`,`generated`,`env.md`);return e.fs.existsSync(t)?{contents:await e.fs.read(t)||``}:{contents:``}}});async function pe(t,n){let r=await e.d(t,n);return r.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{r.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()||(0,C.titleCase)(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})})}),r}const $=(n={})=>[ce(n.babel),{name:`env`,async config(){this.log(h.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,f.default)(n,{types:{},prefix:[]}),transform:{babel:{plugins:[Q]}}};if(t.env.types)t.env.types=(0,E.parseTypeDefinition)(t.env.types);else{this.log(h.LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let n=await e.o(this);t.env.types=(0,E.parseTypeDefinition)(`${n.file}#${n.name}`)}if(t.env.secrets)t.env.secrets=(0,E.parseTypeDefinition)(t.env.secrets);else{let n=await e.l(this);t.env.secrets=(0,E.parseTypeDefinition)(`${n.file}#${n.name}`)}return t.env.prefix=(0,i.toArray)(t.env.prefix??[]).reduce((e,t)=>{let n=(0,j.constantCase)(t);return e.includes(n)||e.push(n),e},[...D.ENV_PREFIXES,`POWERLINES_`]),t.env.prefix=t.env.prefix.reduce((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[]),t},async configResolved(){if(this.log(h.LogLevelLabel.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=(0,f.default)({parsed:await e.n(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&(0,O.existsSync)(e.c(this,`env`)))this.log(h.LogLevelLabel.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await e.d(this,`env`),(0,O.existsSync)(e.s(this,`env`))&&(this.env.used.env=await e.u(this)),(0,O.existsSync)(e.c(this,`secrets`))&&(this.env.types.secrets=await e.d(this,`secrets`)),(0,O.existsSync)(e.s(this,`secrets`))&&(this.env.used.secrets=await e.f(this));else{if(this.env.types.env=await e.C(this,this.config.env.types?.file?(0,_.isParentPath)(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:(0,A.joinPaths)(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 e.g(this,this.env.types.env,`env`),this.env.types.secrets=await e.w(this,this.config.env.secrets?.file?(0,_.isParentPath)(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:(0,A.joinPaths)(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 e.g(this,this.env.types.secrets,`secrets`),this.log(h.LogLevelLabel.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.n(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.D.ReflectionClass({kind:e.D.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 e.m(this,this.env.used.env,`env`),this.env.types.secrets&&(await e.g(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new e.D.ReflectionClass({kind:e.D.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 e.m(this,this.env.used.secrets,`secrets`))}},async prepare(){let e=this;return this.log(h.LogLevelLabel.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render((0,r.createComponent)(t.t,{get defaultConfig(){return e.config.env.defaultConfig}}))},async docs(){this.log(h.LogLevelLabel.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let t=(0,A.joinPaths)(this.config.projectRoot,`docs`,`generated`);(0,O.existsSync)(t)||await(0,k.createDirectory)(t);let n=await e.d(this,`env`),r=(0,A.joinPaths)(t,`env.md`);this.log(h.LogLevelLabel.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${(0,C.titleCase)(this.config.framework)||`Powerlines`} -->
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./deepkit/src/vendor/type.cjs`),n=require(`./plugin-alloy/src/index.cjs`),r=require(`./plugin-automd/src/index.cjs`),i=require(`./plugin-babel/src/index.cjs`),a=require(`./helpers/reflect.cjs`),o=require(`./helpers/persistence.cjs`),s=require(`./babel/plugin.cjs`),c=require(`./helpers/source-file-env.cjs`),l=require(`./helpers/load.cjs`),u=require(`./helpers/create-reflection-resource.cjs`),d=require(`./components/env.cjs`),f=require(`./helpers/automd-generator.cjs`);require(`./babel/index.cjs`);const p=require(`./components/docs.cjs`);require(`./components/index.cjs`);const m=require(`./helpers/template-helpers.cjs`);require(`./helpers/index.cjs`);let h=require(`@alloy-js/core/jsx-runtime`),g=require(`@storm-software/config-tools/types`),_=require(`@stryke/path/is-parent-path`),v=require(`defu`);v=e.__toESM(v);let y=require(`@stryke/convert/to-array`),b=require(`@stryke/path/join`),x=require(`@stryke/string-format/title-case`),S=require(`@stryke/convert/parse-type-definition`),C=require(`@stryke/env/types`),w=require(`@stryke/fs/exists`),T=require(`@stryke/fs/helpers`),E=require(`@stryke/string-format/constant-case`);const D=(e={})=>[n.default(e.alloy),i.default(e.babel),{name:`env`,async config(){this.log(g.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `env` build plugin.");let t={env:(0,v.default)(e,{types:{},prefix:[]}),transform:{babel:{plugins:[s.envBabelPlugin]}}};if(t.env.types)t.env.types=(0,S.parseTypeDefinition)(t.env.types);else{this.log(g.LogLevelLabel.WARN,"The `env.types` configuration parameter was not provided. Please ensure this is expected.");let e=await o.getEnvDefaultTypeDefinition(this);t.env.types=(0,S.parseTypeDefinition)(`${e.file}#${e.name}`)}if(t.env.secrets)t.env.secrets=(0,S.parseTypeDefinition)(t.env.secrets);else{let e=await o.getSecretsDefaultTypeDefinition(this);t.env.secrets=(0,S.parseTypeDefinition)(`${e.file}#${e.name}`)}return t.env.prefix=(0,y.toArray)(t.env.prefix??[]).reduce((e,t)=>{let n=(0,E.constantCase)(t);return e.includes(n)||e.push(n),e},[...C.ENV_PREFIXES,`POWERLINES_`]),t.env.prefix=t.env.prefix.reduce((e,t)=>(e.includes(t.replace(/_$/g,``))||e.push(t.replace(/_$/g,``)),e),[]),t},async configResolved(){if(this.log(g.LogLevelLabel.TRACE,`Environment plugin configuration has been resolved for the Powerlines project.`),this.config.env.inject??=this.config.projectType===`application`,this.env=(0,v.default)({parsed:await l.loadEnv(this,this.config.env)},this.env??{},{types:{env:{}},used:{env:{},secrets:{}},parsed:{},injected:{}}),this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&(0,w.existsSync)(o.getEnvTypeReflectionsPath(this,`env`)))this.log(g.LogLevelLabel.TRACE,`Skipping reflection initialization as the meta checksum has not changed.`),this.env.types.env=await o.readEnvTypeReflection(this,`env`),(0,w.existsSync)(o.getEnvReflectionsPath(this,`env`))&&(this.env.used.env=await o.readEnvReflection(this)),(0,w.existsSync)(o.getEnvTypeReflectionsPath(this,`secrets`))&&(this.env.types.secrets=await o.readEnvTypeReflection(this,`secrets`)),(0,w.existsSync)(o.getEnvReflectionsPath(this,`secrets`))&&(this.env.used.secrets=await o.readSecretsReflection(this));else{if(this.env.types.env=await a.reflectEnv(this,this.config.env.types?.file?(0,_.isParentPath)(this.config.env.types?.file,this.workspaceConfig.workspaceRoot)?this.config.env.types?.file:(0,b.joinPaths)(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 o.writeEnvTypeReflection(this,this.env.types.env,`env`),this.env.types.secrets=await a.reflectSecrets(this,this.config.env.secrets?.file?(0,_.isParentPath)(this.config.env.secrets?.file,this.workspaceConfig.workspaceRoot)?this.config.env.secrets?.file:(0,b.joinPaths)(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 o.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.log(g.LogLevelLabel.TRACE,`Resolved ${this.env.types.env.getProperties().length??0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length??0} secret configuration parameters`);let e=this.env.types.env.getProperties().filter(e=>e.getAlias().length>0);Object.entries(await l.loadEnv(this,this.config.env)).forEach(([t,n])=>{let r=this.config.env.prefix.reduce((e,n)=>t.replace(/_$/g,``).startsWith(n)?t.replace(/_$/g,``).slice(n.length):e,t),i=e.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 t.type_exports.ReflectionClass({kind:t.type_exports.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 o.writeEnvReflection(this,this.env.used.env,`env`),this.env.types.secrets&&(await o.writeEnvTypeReflection(this,this.env.types.secrets,`secrets`),this.env.used.secrets=new t.type_exports.ReflectionClass({kind:t.type_exports.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 o.writeEnvReflection(this,this.env.used.secrets,`secrets`))}},async prepare(){let e=this;return this.log(g.LogLevelLabel.TRACE,`Preparing the Environment runtime artifacts for the Powerlines project.`),this.render((0,h.createComponent)(d.EnvBuiltin,{get defaultConfig(){return e.config.env.defaultConfig}}))},async docs(){this.log(g.LogLevelLabel.TRACE,`Writing Environment documentation for the Powerlines project artifacts.`);let e=(0,b.joinPaths)(this.config.projectRoot,`docs`,`generated`);(0,w.existsSync)(e)||await(0,T.createDirectory)(e);let n=await o.readEnvTypeReflection(this,`env`),r=(0,b.joinPaths)(e,`env.md`);this.log(g.LogLevelLabel.TRACE,`Documenting environment variables configuration in "${r}"`),await this.fs.write(r,`<!-- Generated by ${(0,x.titleCase)(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(t=>`| ${t.getNameAsString().trim()} | ${(t.getDescription()?.replaceAll(`\r`,``)?.replaceAll(`
12
- `,``)??``).trim()} | ${(0,e.D.stringifyType)(t.getType()).trim().replaceAll(` | `,`, or `)} | ${t.hasDefault()?String(t.getDefaultValue())?.includes(`"`)?t.getDefaultValue():`\`${t.getDefaultValue()}\``:``} | ${t.isValueRequired()?``:`✔`} |`).join(`
7
+ ${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(`
8
+ `,``)??``).trim()} | ${(0,t.type_exports.stringifyType)(e.getType()).trim().replaceAll(` | `,`, or `)} | ${e.hasDefault()?String(e.getDefaultValue())?.includes(`"`)?e.getDefaultValue():`\`${e.getDefaultValue()}\``:``} | ${e.isValueRequired()?``:`✔`} |`).join(`
13
9
  `)}
14
- `)},async buildEnd(){let t=e.s(this,`env`);this.log(h.LogLevelLabel.TRACE,`Writing env reflection types to ${t}.`),await e.m(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:(0,f.default)(n.automd??{},{generators:{env:fe(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},R(n.automd)];var me=$;exports.BaseEnv=e._,exports.BaseSecrets=e.v,exports.EnvBuiltin=t.t,exports.EnvDocs=n.t,exports.EnvTypeDefinition=t.n,exports.createEnvReflection=e.y,exports.createReflectionResource=e.t,exports.createSecretsReflection=e.b,exports.createTemplateReflection=pe,exports.default=me,exports.envBabelPlugin=Q,exports.formatEnvField=e.i,exports.getEnvDefaultTypeDefinition=e.o,exports.getEnvReflectionsPath=e.s,exports.getEnvTypeReflectionsPath=e.c,exports.getSecretsDefaultTypeDefinition=e.l,exports.loadEnv=e.n,exports.loadEnvFromContext=e.r,exports.mergeEnvReflections=e.x,exports.mergeSecretsReflections=e.S,exports.plugin=$,exports.readEnvReflection=e.u,exports.readEnvTypeReflection=e.d,exports.readSecretsReflection=e.f,exports.reflectEnv=e.C,exports.reflectSecrets=e.w,exports.removeEnvPrefix=e.a,exports.resolveRuntimeTypeFile=e.p,exports.writeEnvReflection=e.m,exports.writeEnvReflectionSync=e.h,exports.writeEnvTypeReflection=e.g;
10
+ `)},async buildEnd(){let e=o.getEnvReflectionsPath(this,`env`);this.log(g.LogLevelLabel.TRACE,`Writing env reflection types to ${e}.`),await o.writeEnvReflection(this,this.env.used.env,`env`)}},{name:`env:automd-generator`,config(){return{automd:(0,v.default)(e.automd??{},{generators:{env:f.env(this)}})}}},{name:`env:vite`,vite:{configResolved(){return{envPrefix:this.config?.env?.prefix}}}},r.default(e.automd)];var O=D;exports.BaseEnv=a.BaseEnv,exports.BaseSecrets=a.BaseSecrets,exports.EnvBuiltin=d.EnvBuiltin,exports.EnvDocs=p.EnvDocs,exports.EnvTypeDefinition=d.EnvTypeDefinition,exports.createEnvReflection=a.createEnvReflection,exports.createReflectionResource=u.createReflectionResource,exports.createSecretsReflection=a.createSecretsReflection,exports.createTemplateReflection=m.createTemplateReflection,exports.default=O,exports.envBabelPlugin=s.envBabelPlugin,exports.formatEnvField=c.formatEnvField,exports.getEnvDefaultTypeDefinition=o.getEnvDefaultTypeDefinition,exports.getEnvReflectionsPath=o.getEnvReflectionsPath,exports.getEnvTypeReflectionsPath=o.getEnvTypeReflectionsPath,exports.getSecretsDefaultTypeDefinition=o.getSecretsDefaultTypeDefinition,exports.loadEnv=l.loadEnv,exports.loadEnvFromContext=l.loadEnvFromContext,exports.mergeEnvReflections=a.mergeEnvReflections,exports.mergeSecretsReflections=a.mergeSecretsReflections,exports.plugin=D,exports.readEnvReflection=o.readEnvReflection,exports.readEnvTypeReflection=o.readEnvTypeReflection,exports.readSecretsReflection=o.readSecretsReflection,exports.reflectEnv=a.reflectEnv,exports.reflectSecrets=a.reflectSecrets,exports.removeEnvPrefix=c.removeEnvPrefix,exports.resolveRuntimeTypeFile=o.resolveRuntimeTypeFile,exports.writeEnvReflection=o.writeEnvReflection,exports.writeEnvReflectionSync=o.writeEnvReflectionSync,exports.writeEnvTypeReflection=o.writeEnvTypeReflection;
package/dist/index.d.cts CHANGED
@@ -1,189 +1,18 @@
1
- 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-vBgCrEuY.cjs";
2
- import { t as EnvDocs } from "./docs-CdtUw4WA.cjs";
3
- import { i as __ΩEnvBuiltinProps, n as EnvBuiltinProps, r as EnvTypeDefinition, t as EnvBuiltin } from "./env-COWzTupf.cjs";
4
- import "./index-DWPDThxu.cjs";
5
- import { d as UnresolvedContext, i as __ΩSecretsInterface, l as Context, n as SecretsInterface, r as __ΩEnvInterface, t as EnvInterface } from "./runtime-rhT2IfSg.cjs";
6
- import "./index-B_e8BwCm.cjs";
7
- import * as _alloy_js_core0 from "@alloy-js/core";
8
- import * as powerlines0 from "powerlines";
1
+ import { EnvDocs } from "./components/docs.cjs";
2
+ import { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from "./components/env.cjs";
3
+ import { EnvInterface, SecretsInterface, __ΩEnvInterface, __ΩSecretsInterface } from "./types/runtime.cjs";
4
+ import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./types/plugin.cjs";
5
+ import { envBabelPlugin } from "./babel/plugin.cjs";
6
+ import "./babel/index.cjs";
7
+ import { createReflectionResource } from "./helpers/create-reflection-resource.cjs";
8
+ import { loadEnv, loadEnvFromContext } from "./helpers/load.cjs";
9
+ import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection } from "./helpers/persistence.cjs";
10
+ import { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./helpers/reflect.cjs";
11
+ import { formatEnvField, removeEnvPrefix } from "./helpers/source-file-env.cjs";
12
+ import { createTemplateReflection } from "./helpers/template-helpers.cjs";
13
+ import "./helpers/index.cjs";
9
14
  import { Plugin } from "powerlines";
10
- import { TypeDefinition } from "@stryke/types/configuration";
11
- import { DotenvParseOutput } from "@stryke/env/types";
12
15
 
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
16
  //#region src/index.d.ts
188
17
  /**
189
18
  * A Powerlines plugin to inject environment variables into the source code.