@powerlines/plugin-nodejs 0.1.0 → 0.1.1

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 (199) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/components/env.cjs +188 -2
  3. package/dist/components/env.d.cts +9 -2
  4. package/dist/components/env.d.mts +9 -2
  5. package/dist/components/env.mjs +185 -1
  6. package/dist/components/index.cjs +2 -3
  7. package/dist/components/index.d.cts +1 -3
  8. package/dist/components/index.d.mts +1 -3
  9. package/dist/components/index.mjs +1 -2
  10. package/dist/deepkit/schemas/reflection.cjs +3940 -0
  11. package/dist/{plugin-D7kBf19k.d.cts → deepkit/schemas/reflection.d.cts} +1 -1078
  12. package/dist/{plugin-JL1BtFku.d.mts → deepkit/schemas/reflection.d.mts} +59 -1136
  13. package/dist/deepkit/schemas/reflection.mjs +3938 -0
  14. package/dist/deepkit/schemas/reflection2.cjs +4112 -0
  15. package/dist/deepkit/schemas/reflection2.mjs +4110 -0
  16. package/dist/deepkit/src/capnp.cjs +913 -0
  17. package/dist/deepkit/src/capnp.mjs +911 -0
  18. package/dist/deepkit/src/esbuild-plugin.cjs +47 -0
  19. package/dist/deepkit/src/esbuild-plugin.mjs +46 -0
  20. package/dist/deepkit/src/reflect-type.cjs +22 -0
  21. package/dist/deepkit/src/reflect-type.mjs +20 -0
  22. package/dist/deepkit/src/resolve-reflections.cjs +16 -0
  23. package/dist/deepkit/src/resolve-reflections.mjs +15 -0
  24. package/dist/deepkit/src/transformer.cjs +52 -0
  25. package/dist/deepkit/src/transformer.mjs +49 -0
  26. package/dist/deepkit/src/transpile.cjs +29 -0
  27. package/dist/deepkit/src/transpile.mjs +27 -0
  28. package/dist/deepkit/src/types.d.cts +10 -0
  29. package/dist/deepkit/src/types.d.mts +10 -0
  30. package/dist/deepkit/src/utilities.cjs +66 -0
  31. package/dist/deepkit/src/utilities.mjs +65 -0
  32. package/dist/index.cjs +14 -813
  33. package/dist/index.d.cts +5 -5
  34. package/dist/index.d.mts +5 -5
  35. package/dist/index.mjs +11 -803
  36. package/dist/plugin-alloy/src/core/components/output.cjs +45 -0
  37. package/dist/plugin-alloy/src/core/components/output.mjs +44 -0
  38. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +22 -0
  39. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +21 -0
  40. package/dist/plugin-alloy/src/core/components/source-file.cjs +64 -0
  41. package/dist/plugin-alloy/src/core/components/source-file.d.cts +23 -0
  42. package/dist/plugin-alloy/src/core/components/source-file.d.mts +23 -0
  43. package/dist/plugin-alloy/src/core/components/source-file.mjs +62 -0
  44. package/dist/plugin-alloy/src/core/contexts/context.cjs +60 -0
  45. package/dist/plugin-alloy/src/core/contexts/context.mjs +54 -0
  46. package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
  47. package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
  48. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +46 -0
  49. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +42 -0
  50. package/dist/plugin-alloy/src/helpers/refkey.cjs +16 -0
  51. package/dist/plugin-alloy/src/helpers/refkey.mjs +15 -0
  52. package/dist/plugin-alloy/src/index.cjs +93 -0
  53. package/dist/plugin-alloy/src/index.mjs +91 -0
  54. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +7 -0
  55. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +9 -0
  56. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +5 -0
  57. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +7 -0
  58. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +17 -0
  59. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +17 -0
  60. package/dist/plugin-alloy/src/types/components.d.cts +22 -0
  61. package/dist/plugin-alloy/src/types/components.d.mts +24 -0
  62. package/dist/plugin-alloy/src/types/index.d.mts +2 -0
  63. package/dist/plugin-alloy/src/types/plugin.d.cts +37 -0
  64. package/dist/plugin-alloy/src/types/plugin.d.mts +37 -0
  65. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +57 -0
  66. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +25 -0
  67. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +26 -0
  68. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +56 -0
  69. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +126 -0
  70. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +124 -0
  71. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +442 -0
  72. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +27 -0
  73. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +28 -0
  74. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +433 -0
  75. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +194 -0
  76. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +14 -0
  77. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +15 -0
  78. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +191 -0
  79. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +68 -0
  80. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +1 -0
  81. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +4 -0
  82. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +67 -0
  83. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +124 -0
  84. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +123 -0
  85. package/dist/plugin-automd/src/index.cjs +101 -0
  86. package/dist/plugin-automd/src/index.mjs +98 -0
  87. package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
  88. package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
  89. package/dist/plugin-automd/src/types/toc.d.cts +33 -0
  90. package/dist/plugin-automd/src/types/toc.d.mts +33 -0
  91. package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -0
  92. package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -0
  93. package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -0
  94. package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -0
  95. package/dist/plugin-babel/src/helpers/filters.cjs +23 -0
  96. package/dist/plugin-babel/src/helpers/filters.mjs +21 -0
  97. package/dist/plugin-babel/src/helpers/index.cjs +5 -0
  98. package/dist/plugin-babel/src/helpers/index.mjs +7 -0
  99. package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -0
  100. package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -0
  101. package/dist/plugin-babel/src/helpers/options.cjs +50 -0
  102. package/dist/plugin-babel/src/helpers/options.mjs +47 -0
  103. package/dist/plugin-babel/src/index.cjs +91 -0
  104. package/dist/plugin-babel/src/index.mjs +89 -0
  105. package/dist/plugin-babel/src/types/index.d.mts +1 -0
  106. package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
  107. package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
  108. package/dist/plugin-env/src/babel/index.cjs +1 -0
  109. package/dist/plugin-env/src/babel/index.mjs +3 -0
  110. package/dist/plugin-env/src/babel/plugin.cjs +121 -0
  111. package/dist/plugin-env/src/babel/plugin.mjs +119 -0
  112. package/dist/plugin-env/src/components/docs.cjs +9 -0
  113. package/dist/plugin-env/src/components/docs.mjs +11 -0
  114. package/dist/plugin-env/src/components/env.cjs +575 -0
  115. package/dist/plugin-env/src/components/env.d.cts +11 -0
  116. package/dist/plugin-env/src/components/env.d.mts +11 -0
  117. package/dist/plugin-env/src/components/env.mjs +572 -0
  118. package/dist/plugin-env/src/components/index.cjs +2 -0
  119. package/dist/plugin-env/src/components/index.mjs +4 -0
  120. package/dist/plugin-env/src/helpers/automd-generator.cjs +22 -0
  121. package/dist/plugin-env/src/helpers/automd-generator.mjs +21 -0
  122. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +55 -0
  123. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +54 -0
  124. package/dist/plugin-env/src/helpers/index.cjs +6 -0
  125. package/dist/plugin-env/src/helpers/index.mjs +8 -0
  126. package/dist/plugin-env/src/helpers/load.cjs +83 -0
  127. package/dist/plugin-env/src/helpers/load.mjs +80 -0
  128. package/dist/plugin-env/src/helpers/persistence.cjs +199 -0
  129. package/dist/plugin-env/src/helpers/persistence.mjs +188 -0
  130. package/dist/plugin-env/src/helpers/reflect.cjs +111 -0
  131. package/dist/plugin-env/src/helpers/reflect.mjs +103 -0
  132. package/dist/plugin-env/src/helpers/source-file-env.cjs +24 -0
  133. package/dist/plugin-env/src/helpers/source-file-env.mjs +23 -0
  134. package/dist/plugin-env/src/helpers/template-helpers.cjs +2 -0
  135. package/dist/plugin-env/src/helpers/template-helpers.mjs +4 -0
  136. package/dist/plugin-env/src/index.cjs +175 -0
  137. package/dist/plugin-env/src/index.mjs +173 -0
  138. package/dist/plugin-env/src/types/plugin.d.cts +151 -0
  139. package/dist/plugin-env/src/types/plugin.d.mts +153 -0
  140. package/dist/plugin-env/src/types/runtime.d.cts +792 -0
  141. package/dist/plugin-env/src/types/runtime.d.mts +792 -0
  142. package/dist/powerlines/src/lib/build/esbuild.cjs +102 -0
  143. package/dist/powerlines/src/lib/build/esbuild.mjs +100 -0
  144. package/dist/powerlines/src/lib/entry.cjs +12 -0
  145. package/dist/powerlines/src/lib/entry.mjs +14 -0
  146. package/dist/powerlines/src/lib/logger.cjs +41 -0
  147. package/dist/powerlines/src/lib/logger.mjs +39 -0
  148. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +38 -0
  149. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +35 -0
  150. package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -0
  151. package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -0
  152. package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -0
  153. package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -0
  154. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
  155. package/dist/powerlines/src/plugin-utils/paths.mjs +3 -0
  156. package/dist/powerlines/src/types/babel.d.cts +22 -0
  157. package/dist/powerlines/src/types/babel.d.mts +22 -0
  158. package/dist/powerlines/src/types/build.d.cts +145 -0
  159. package/dist/powerlines/src/types/build.d.mts +145 -0
  160. package/dist/powerlines/src/types/commands.d.cts +8 -0
  161. package/dist/powerlines/src/types/commands.d.mts +9 -0
  162. package/dist/powerlines/src/types/config.d.cts +387 -0
  163. package/dist/powerlines/src/types/config.d.mts +388 -0
  164. package/dist/powerlines/src/types/context.d.cts +414 -0
  165. package/dist/powerlines/src/types/context.d.mts +416 -0
  166. package/dist/powerlines/src/types/fs.d.cts +486 -0
  167. package/dist/powerlines/src/types/fs.d.mts +486 -0
  168. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  169. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  170. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  171. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  172. package/dist/powerlines/src/types/resolved.d.mts +82 -0
  173. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  174. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  175. package/dist/types/index.cjs +0 -2
  176. package/dist/types/index.d.cts +1 -3
  177. package/dist/types/index.d.mts +1 -3
  178. package/dist/types/index.mjs +0 -3
  179. package/dist/types/plugin.cjs +0 -1
  180. package/dist/types/plugin.d.cts +22 -2
  181. package/dist/types/plugin.d.mts +22 -2
  182. package/dist/types/plugin.mjs +0 -2
  183. package/package.json +6 -6
  184. package/dist/components-BWLXb7a2.cjs +0 -0
  185. package/dist/components-CXZYcH4q.d.mts +0 -1816
  186. package/dist/components-kh0CpIG2.mjs +0 -1
  187. package/dist/env-CAhIy_H3.cjs +0 -11713
  188. package/dist/env-CUyFiniR.d.cts +0 -107
  189. package/dist/env-IF4XhMjG.mjs +0 -11570
  190. package/dist/env-sRb-Y8mJ.d.mts +0 -89
  191. package/dist/index-CUbWeWHc.d.mts +0 -1
  192. package/dist/index-D6CnpA_r.d.cts +0 -1
  193. package/dist/index-DL0uimUT.d.mts +0 -1
  194. package/dist/index-DWPDThxu.d.cts +0 -1
  195. package/dist/plugin-ifZVa20V.mjs +0 -1
  196. package/dist/plugin-pBKbb5K9.cjs +0 -0
  197. package/dist/resolved-zsx09G03.d.cts +0 -1795
  198. package/dist/types-U3zd8PTP.mjs +0 -1
  199. package/dist/types-o3zWarRp.cjs +0 -0
@@ -0,0 +1,151 @@
1
+ import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "../../../plugin-babel/src/types/plugin.cjs";
2
+ import { Reflection } from "../../../deepkit/src/types.cjs";
3
+ import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "../../../plugin-alloy/src/types/plugin.cjs";
4
+ import { AutoMDPluginOptions } from "../../../plugin-automd/src/types/plugin.cjs";
5
+ import { EnvInterface, SecretsInterface } from "./runtime.cjs";
6
+ import { DotenvConfiguration, TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
7
+ import { Children } from "@alloy-js/core/jsx-runtime";
8
+ import { DotenvParseOutput } from "@stryke/env/types";
9
+
10
+ //#region ../plugin-env/src/types/plugin.d.ts
11
+ type EnvPluginOptions = Omit<DotenvConfiguration, "types"> & {
12
+ /**
13
+ * A path to the type definition for the expected env configuration parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#ConfigConfiguration"`.
14
+ */
15
+ types?: TypeDefinitionParameter;
16
+ /**
17
+ * A path to the type definition for the expected env secret parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#ConfigSecrets"`.
18
+ */
19
+ secrets?: TypeDefinitionParameter;
20
+ /**
21
+ * An additional prefix (or list of additional prefixes) to apply to the environment variables
22
+ *
23
+ * @remarks
24
+ * By default, the plugin will use the `POWERLINES_` prefix. This option is useful for avoiding conflicts with other environment variables.
25
+ */
26
+ prefix?: string | string[];
27
+ /**
28
+ * Should the plugin inject the env variables in the source code with their values?
29
+ *
30
+ * @remarks
31
+ * This option is set to `true` when building an application project.
32
+ *
33
+ * @defaultValue false
34
+ */
35
+ inject?: boolean;
36
+ /**
37
+ * The default configuration to use when loading environment variables.
38
+ *
39
+ * @remarks
40
+ * This configuration is used as the base configuration when loading environment variables, and will be overridden by any values found in the `.env` file or the process environment.
41
+ */
42
+ defaultConfig?: Children;
43
+ /**
44
+ * Babel configuration options to use when injecting environment variables into the source code.
45
+ *
46
+ * @remarks
47
+ * This option allows you to customize the Babel transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Babel settings.
48
+ */
49
+ babel?: BabelPluginOptions;
50
+ /**
51
+ * AutoMD configuration options to allow injecting environment variables documentation into a markdown file such as a README.md.
52
+ *
53
+ * @remarks
54
+ * The README.md file should contain the `<!-- automd:env --><!-- /automd -->` comment block where the documentation will be injected.
55
+ */
56
+ automd?: AutoMDPluginOptions;
57
+ /**
58
+ * Alloy configuration options to use when injecting environment variables into the source code.
59
+ *
60
+ * @remarks
61
+ * This option allows you to customize the Alloy transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Alloy settings.
62
+ */
63
+ alloy?: AlloyPluginOptions;
64
+ };
65
+ type EnvPluginUserConfig = BabelPluginUserConfig & AlloyPluginUserConfig & {
66
+ env: EnvPluginOptions;
67
+ };
68
+ type EnvPluginResolvedConfig = BabelPluginResolvedConfig & AlloyPluginResolvedConfig & {
69
+ env: Required<Pick<DotenvConfiguration, "additionalFiles">> & Required<Pick<EnvPluginOptions, "defaultConfig">> & {
70
+ /**
71
+ * The type definition for the expected env variable parameters
72
+ *
73
+ * @remarks
74
+ * This value is parsed from the {@link EnvPluginOptions.types} option.
75
+ */
76
+ types: TypeDefinition;
77
+ /**
78
+ * The type definition for the expected env secret parameters
79
+ *
80
+ * @remarks
81
+ * This value is parsed from the {@link EnvPluginOptions.secrets} option.
82
+ */
83
+ secrets: TypeDefinition;
84
+ /**
85
+ * Should the plugin inject the env variables in the source code with their values?
86
+ *
87
+ * @remarks
88
+ * This value is the result of reflecting the {@link EnvPluginOptions.inject} option.
89
+ */
90
+ inject: EnvPluginOptions["inject"];
91
+ /**
92
+ * The prefix used for environment variables
93
+ *
94
+ * @remarks
95
+ * This value is used to filter environment variables that are loaded from the .env file and the process environment.
96
+ */
97
+ prefix: string[];
98
+ };
99
+ };
100
+ interface EnvPluginContext<TResolvedConfig extends EnvPluginResolvedConfig = EnvPluginResolvedConfig> extends BabelPluginContext<TResolvedConfig>, AlloyPluginContext<TResolvedConfig> {
101
+ env: {
102
+ /**
103
+ * The type definitions reflection for the env variables and secrets
104
+ *
105
+ * @remarks
106
+ * These reflections contains the structure of the expected environment variables and secrets as defined by the type definitions provided in the plugin configuration.
107
+ */
108
+ types: {
109
+ /**
110
+ * The type definitions for the expected env variables
111
+ */
112
+ env: Reflection;
113
+ /**
114
+ * The type definitions for the expected env secrets
115
+ */
116
+ secrets: Reflection;
117
+ };
118
+ /**
119
+ * The current **used** environment variables and secrets reflection
120
+ *
121
+ * @remarks
122
+ * This reflection contains the structure of the current environment variables and secrets as defined during the plugin initialization by extracting the values from the source code.
123
+ */
124
+ used: {
125
+ /**
126
+ * The current env variables reflection
127
+ */
128
+ env: Reflection<EnvInterface>;
129
+ /**
130
+ * The current env secrets reflection
131
+ */
132
+ secrets: Reflection<SecretsInterface>;
133
+ };
134
+ /**
135
+ * The parsed .env configuration object
136
+ *
137
+ * @remarks
138
+ * This value is the result of loading the .env configuration file found in the project root directory and merging it with the values provided at {@link EnvPluginOptions.values}
139
+ */
140
+ parsed: DotenvParseOutput;
141
+ /**
142
+ * The injected environment variables and secrets reflection
143
+ *
144
+ * @remarks
145
+ * This reflection contains the structure of the injected environment variables and secrets that were injected into the source code during the build process.
146
+ */
147
+ injected: Reflection;
148
+ };
149
+ }
150
+ //#endregion
151
+ export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig };
@@ -0,0 +1,153 @@
1
+ import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "../../../plugin-babel/src/types/plugin.mjs";
2
+ import { Reflection } from "../../../deepkit/src/types.mjs";
3
+ import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "../../../plugin-alloy/src/types/plugin.mjs";
4
+ import "../../../plugin-alloy/src/types/index.mjs";
5
+ import { AutoMDPluginOptions } from "../../../plugin-automd/src/types/plugin.mjs";
6
+ import "../../../plugin-babel/src/types/index.mjs";
7
+ import { EnvInterface, SecretsInterface } from "./runtime.mjs";
8
+ import { Children } from "@alloy-js/core/jsx-runtime";
9
+ import { DotenvParseOutput } from "@stryke/env/types";
10
+ import { DotenvConfiguration, TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
11
+
12
+ //#region ../plugin-env/src/types/plugin.d.ts
13
+ type EnvPluginOptions = Omit<DotenvConfiguration, "types"> & {
14
+ /**
15
+ * A path to the type definition for the expected env configuration parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#ConfigConfiguration"`.
16
+ */
17
+ types?: TypeDefinitionParameter;
18
+ /**
19
+ * A path to the type definition for the expected env secret parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#ConfigSecrets"`.
20
+ */
21
+ secrets?: TypeDefinitionParameter;
22
+ /**
23
+ * An additional prefix (or list of additional prefixes) to apply to the environment variables
24
+ *
25
+ * @remarks
26
+ * By default, the plugin will use the `POWERLINES_` prefix. This option is useful for avoiding conflicts with other environment variables.
27
+ */
28
+ prefix?: string | string[];
29
+ /**
30
+ * Should the plugin inject the env variables in the source code with their values?
31
+ *
32
+ * @remarks
33
+ * This option is set to `true` when building an application project.
34
+ *
35
+ * @defaultValue false
36
+ */
37
+ inject?: boolean;
38
+ /**
39
+ * The default configuration to use when loading environment variables.
40
+ *
41
+ * @remarks
42
+ * This configuration is used as the base configuration when loading environment variables, and will be overridden by any values found in the `.env` file or the process environment.
43
+ */
44
+ defaultConfig?: Children;
45
+ /**
46
+ * Babel configuration options to use when injecting environment variables into the source code.
47
+ *
48
+ * @remarks
49
+ * This option allows you to customize the Babel transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Babel settings.
50
+ */
51
+ babel?: BabelPluginOptions;
52
+ /**
53
+ * AutoMD configuration options to allow injecting environment variables documentation into a markdown file such as a README.md.
54
+ *
55
+ * @remarks
56
+ * The README.md file should contain the `<!-- automd:env --><!-- /automd -->` comment block where the documentation will be injected.
57
+ */
58
+ automd?: AutoMDPluginOptions;
59
+ /**
60
+ * Alloy configuration options to use when injecting environment variables into the source code.
61
+ *
62
+ * @remarks
63
+ * This option allows you to customize the Alloy transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Alloy settings.
64
+ */
65
+ alloy?: AlloyPluginOptions;
66
+ };
67
+ type EnvPluginUserConfig = BabelPluginUserConfig & AlloyPluginUserConfig & {
68
+ env: EnvPluginOptions;
69
+ };
70
+ type EnvPluginResolvedConfig = BabelPluginResolvedConfig & AlloyPluginResolvedConfig & {
71
+ env: Required<Pick<DotenvConfiguration, "additionalFiles">> & Required<Pick<EnvPluginOptions, "defaultConfig">> & {
72
+ /**
73
+ * The type definition for the expected env variable parameters
74
+ *
75
+ * @remarks
76
+ * This value is parsed from the {@link EnvPluginOptions.types} option.
77
+ */
78
+ types: TypeDefinition;
79
+ /**
80
+ * The type definition for the expected env secret parameters
81
+ *
82
+ * @remarks
83
+ * This value is parsed from the {@link EnvPluginOptions.secrets} option.
84
+ */
85
+ secrets: TypeDefinition;
86
+ /**
87
+ * Should the plugin inject the env variables in the source code with their values?
88
+ *
89
+ * @remarks
90
+ * This value is the result of reflecting the {@link EnvPluginOptions.inject} option.
91
+ */
92
+ inject: EnvPluginOptions["inject"];
93
+ /**
94
+ * The prefix used for environment variables
95
+ *
96
+ * @remarks
97
+ * This value is used to filter environment variables that are loaded from the .env file and the process environment.
98
+ */
99
+ prefix: string[];
100
+ };
101
+ };
102
+ interface EnvPluginContext<TResolvedConfig extends EnvPluginResolvedConfig = EnvPluginResolvedConfig> extends BabelPluginContext<TResolvedConfig>, AlloyPluginContext<TResolvedConfig> {
103
+ env: {
104
+ /**
105
+ * The type definitions reflection for the env variables and secrets
106
+ *
107
+ * @remarks
108
+ * These reflections contains the structure of the expected environment variables and secrets as defined by the type definitions provided in the plugin configuration.
109
+ */
110
+ types: {
111
+ /**
112
+ * The type definitions for the expected env variables
113
+ */
114
+ env: Reflection;
115
+ /**
116
+ * The type definitions for the expected env secrets
117
+ */
118
+ secrets: Reflection;
119
+ };
120
+ /**
121
+ * The current **used** environment variables and secrets reflection
122
+ *
123
+ * @remarks
124
+ * This reflection contains the structure of the current environment variables and secrets as defined during the plugin initialization by extracting the values from the source code.
125
+ */
126
+ used: {
127
+ /**
128
+ * The current env variables reflection
129
+ */
130
+ env: Reflection<EnvInterface>;
131
+ /**
132
+ * The current env secrets reflection
133
+ */
134
+ secrets: Reflection<SecretsInterface>;
135
+ };
136
+ /**
137
+ * The parsed .env configuration object
138
+ *
139
+ * @remarks
140
+ * This value is the result of loading the .env configuration file found in the project root directory and merging it with the values provided at {@link EnvPluginOptions.values}
141
+ */
142
+ parsed: DotenvParseOutput;
143
+ /**
144
+ * The injected environment variables and secrets reflection
145
+ *
146
+ * @remarks
147
+ * This reflection contains the structure of the injected environment variables and secrets that were injected into the source code during the build process.
148
+ */
149
+ injected: Reflection;
150
+ };
151
+ }
152
+ //#endregion
153
+ export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig };