@powerlines/plugin-nodejs 0.1.117 → 0.1.118

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 (194) hide show
  1. package/dist/components/env.cjs +14 -14
  2. package/dist/components/env.d.cts +1 -1
  3. package/dist/components/env.d.mts +1 -1
  4. package/dist/components/env.mjs +6 -6
  5. package/dist/index.cjs +8 -6
  6. package/dist/index.d.cts +1 -1
  7. package/dist/index.d.mts +1 -1
  8. package/dist/index.mjs +5 -5
  9. package/dist/types/plugin.d.cts +2 -2
  10. package/dist/types/plugin.d.mts +2 -2
  11. package/package.json +6 -6
  12. package/dist/deepkit/schemas/reflection.cjs +0 -3998
  13. package/dist/deepkit/schemas/reflection.d.cts +0 -1560
  14. package/dist/deepkit/schemas/reflection.d.mts +0 -1560
  15. package/dist/deepkit/schemas/reflection.mjs +0 -3996
  16. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  17. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  18. package/dist/deepkit/src/capnp.cjs +0 -913
  19. package/dist/deepkit/src/capnp.mjs +0 -911
  20. package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
  21. package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
  22. package/dist/deepkit/src/reflect-type.cjs +0 -22
  23. package/dist/deepkit/src/reflect-type.mjs +0 -20
  24. package/dist/deepkit/src/resolve-reflections.cjs +0 -16
  25. package/dist/deepkit/src/resolve-reflections.mjs +0 -15
  26. package/dist/deepkit/src/transformer.cjs +0 -52
  27. package/dist/deepkit/src/transformer.mjs +0 -49
  28. package/dist/deepkit/src/transpile.cjs +0 -29
  29. package/dist/deepkit/src/transpile.mjs +0 -27
  30. package/dist/deepkit/src/types.d.cts +0 -10
  31. package/dist/deepkit/src/types.d.mts +0 -10
  32. package/dist/deepkit/src/utilities.cjs +0 -67
  33. package/dist/deepkit/src/utilities.mjs +0 -66
  34. package/dist/plugin-alloy/src/core/components/output.cjs +0 -43
  35. package/dist/plugin-alloy/src/core/components/output.mjs +0 -42
  36. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -22
  37. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -21
  38. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -64
  39. package/dist/plugin-alloy/src/core/components/source-file.d.cts +0 -23
  40. package/dist/plugin-alloy/src/core/components/source-file.d.mts +0 -23
  41. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -62
  42. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -49
  43. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -44
  44. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  45. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  46. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
  47. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
  48. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
  49. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
  50. package/dist/plugin-alloy/src/index.cjs +0 -105
  51. package/dist/plugin-alloy/src/index.mjs +0 -103
  52. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -115
  53. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -114
  54. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -39
  55. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -38
  56. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -18
  57. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
  58. package/dist/plugin-alloy/src/types/components.d.cts +0 -20
  59. package/dist/plugin-alloy/src/types/components.d.mts +0 -21
  60. package/dist/plugin-alloy/src/types/index.d.cts +0 -2
  61. package/dist/plugin-alloy/src/types/index.d.mts +0 -2
  62. package/dist/plugin-alloy/src/types/plugin.d.cts +0 -36
  63. package/dist/plugin-alloy/src/types/plugin.d.mts +0 -36
  64. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -62
  65. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +0 -26
  66. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +0 -26
  67. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -61
  68. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -131
  69. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -129
  70. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -451
  71. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +0 -37
  72. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +0 -37
  73. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -442
  74. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -216
  75. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +0 -16
  76. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +0 -16
  77. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -213
  78. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -72
  79. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +0 -4
  80. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +0 -4
  81. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -71
  82. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -124
  83. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -123
  84. package/dist/plugin-automd/src/index.cjs +0 -101
  85. package/dist/plugin-automd/src/index.mjs +0 -98
  86. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  87. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  88. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  89. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  90. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
  91. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
  92. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
  93. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
  94. package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
  95. package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
  96. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  97. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  98. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
  99. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
  100. package/dist/plugin-babel/src/helpers/options.cjs +0 -49
  101. package/dist/plugin-babel/src/helpers/options.mjs +0 -46
  102. package/dist/plugin-babel/src/index.cjs +0 -85
  103. package/dist/plugin-babel/src/index.mjs +0 -83
  104. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  105. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  106. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  107. package/dist/plugin-env/src/babel/index.cjs +0 -1
  108. package/dist/plugin-env/src/babel/index.mjs +0 -3
  109. package/dist/plugin-env/src/babel/plugin.cjs +0 -70
  110. package/dist/plugin-env/src/babel/plugin.mjs +0 -69
  111. package/dist/plugin-env/src/components/docs.cjs +0 -70
  112. package/dist/plugin-env/src/components/docs.mjs +0 -69
  113. package/dist/plugin-env/src/components/env.cjs +0 -589
  114. package/dist/plugin-env/src/components/env.d.cts +0 -11
  115. package/dist/plugin-env/src/components/env.d.mts +0 -11
  116. package/dist/plugin-env/src/components/env.mjs +0 -586
  117. package/dist/plugin-env/src/components/index.cjs +0 -2
  118. package/dist/plugin-env/src/components/index.mjs +0 -4
  119. package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -22
  120. package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -21
  121. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -55
  122. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -54
  123. package/dist/plugin-env/src/helpers/docs-helper.cjs +0 -16
  124. package/dist/plugin-env/src/helpers/docs-helper.mjs +0 -15
  125. package/dist/plugin-env/src/helpers/index.cjs +0 -6
  126. package/dist/plugin-env/src/helpers/index.mjs +0 -8
  127. package/dist/plugin-env/src/helpers/load.cjs +0 -84
  128. package/dist/plugin-env/src/helpers/load.mjs +0 -81
  129. package/dist/plugin-env/src/helpers/persistence.cjs +0 -201
  130. package/dist/plugin-env/src/helpers/persistence.mjs +0 -190
  131. package/dist/plugin-env/src/helpers/reflect.cjs +0 -125
  132. package/dist/plugin-env/src/helpers/reflect.mjs +0 -117
  133. package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -24
  134. package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -23
  135. package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -2
  136. package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -4
  137. package/dist/plugin-env/src/index.cjs +0 -177
  138. package/dist/plugin-env/src/index.mjs +0 -175
  139. package/dist/plugin-env/src/types/plugin.d.cts +0 -149
  140. package/dist/plugin-env/src/types/plugin.d.mts +0 -150
  141. package/dist/plugin-env/src/types/runtime.d.cts +0 -789
  142. package/dist/plugin-env/src/types/runtime.d.mts +0 -789
  143. package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -47
  144. package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -49
  145. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -93
  146. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -91
  147. package/dist/powerlines/src/lib/constants/environments.cjs +0 -6
  148. package/dist/powerlines/src/lib/constants/environments.mjs +0 -5
  149. package/dist/powerlines/src/lib/entry.cjs +0 -11
  150. package/dist/powerlines/src/lib/entry.mjs +0 -13
  151. package/dist/powerlines/src/lib/logger.cjs +0 -41
  152. package/dist/powerlines/src/lib/logger.mjs +0 -39
  153. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -38
  154. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -35
  155. package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -3
  156. package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -5
  157. package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +0 -66
  158. package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +0 -65
  159. package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -46
  160. package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -45
  161. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -42
  162. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -40
  163. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -50
  164. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -49
  165. package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -5
  166. package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -5
  167. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  168. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
  169. package/dist/powerlines/src/types/api.d.cts +0 -104
  170. package/dist/powerlines/src/types/api.d.mts +0 -104
  171. package/dist/powerlines/src/types/babel.d.cts +0 -22
  172. package/dist/powerlines/src/types/babel.d.mts +0 -22
  173. package/dist/powerlines/src/types/build.cjs +0 -21
  174. package/dist/powerlines/src/types/build.d.cts +0 -185
  175. package/dist/powerlines/src/types/build.d.mts +0 -185
  176. package/dist/powerlines/src/types/build.mjs +0 -21
  177. package/dist/powerlines/src/types/commands.d.cts +0 -8
  178. package/dist/powerlines/src/types/commands.d.mts +0 -9
  179. package/dist/powerlines/src/types/config.d.cts +0 -435
  180. package/dist/powerlines/src/types/config.d.mts +0 -436
  181. package/dist/powerlines/src/types/context.d.cts +0 -514
  182. package/dist/powerlines/src/types/context.d.mts +0 -514
  183. package/dist/powerlines/src/types/fs.d.cts +0 -486
  184. package/dist/powerlines/src/types/fs.d.mts +0 -486
  185. package/dist/powerlines/src/types/hooks.d.cts +0 -32
  186. package/dist/powerlines/src/types/hooks.d.mts +0 -32
  187. package/dist/powerlines/src/types/plugin.d.cts +0 -205
  188. package/dist/powerlines/src/types/plugin.d.mts +0 -205
  189. package/dist/powerlines/src/types/resolved.d.cts +0 -94
  190. package/dist/powerlines/src/types/resolved.d.mts +0 -94
  191. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  192. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
  193. package/dist/powerlines/src/types/unplugin.d.cts +0 -22
  194. package/dist/powerlines/src/types/unplugin.d.mts +0 -23
@@ -1,125 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- const require_reflect_type = require('../../../deepkit/src/reflect-type.cjs');
3
- const require_persistence = require('./persistence.cjs');
4
- let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
5
- let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
6
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
7
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
8
-
9
- //#region ../plugin-env/src/helpers/reflect.ts
10
- function mergeEnvReflections(context, reflections) {
11
- return createEnvReflection(context, { type: (0, __powerlines_deepkit_vendor_type.merge)(reflections.map((reflection) => reflection.type)) });
12
- }
13
- function mergeSecretsReflections(context, reflections) {
14
- return createSecretsReflection(context, { type: (0, __powerlines_deepkit_vendor_type.merge)(reflections.map((reflection) => reflection.type)) });
15
- }
16
- var BaseEnv = class {
17
- APP_NAME;
18
- APP_VERSION;
19
- BUILD_ID;
20
- BUILD_TIMESTAMP;
21
- BUILD_CHECKSUM;
22
- RELEASE_ID;
23
- RELEASE_TAG;
24
- ORGANIZATION;
25
- PLATFORM = "neutral";
26
- MODE = "production";
27
- ENVIRONMENT;
28
- DEBUG = false;
29
- TEST = false;
30
- MINIMAL = false;
31
- NO_COLOR = false;
32
- FORCE_COLOR = false;
33
- FORCE_HYPERLINK = false;
34
- STACKTRACE = false;
35
- INCLUDE_ERROR_DATA = false;
36
- ERROR_URL;
37
- DEFAULT_TIMEZONE;
38
- DEFAULT_LOCALE;
39
- CI = false;
40
- };
41
- var BaseSecrets = class {
42
- ENCRYPTION_KEY;
43
- };
44
- function createEnvReflection(context, options = {}) {
45
- const parent = options.superReflection ?? new __powerlines_deepkit_vendor_type.ReflectionClass({
46
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.class,
47
- description: `The base environment configuration definition for the ${(0, __stryke_string_format_title_case.titleCase)(context.config.name)} project.`,
48
- classType: BaseEnv,
49
- types: [],
50
- implements: [{
51
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
52
- typeName: "EnvInterface",
53
- description: `The environment configuration interface definition for the ${(0, __stryke_string_format_title_case.titleCase)(context.config.name)} project.`,
54
- types: []
55
- }]
56
- });
57
- parent.name = "Env";
58
- const result = new __powerlines_deepkit_vendor_type.ReflectionClass(options.type ?? {
59
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
60
- typeName: "Env",
61
- description: `A schema describing the list of available environment variables that can be used by the ${context.config.name ? `${(0, __stryke_string_format_title_case.titleCase)(context.config.name)} application` : "application"}.`,
62
- types: []
63
- }, parent);
64
- result.name = "Env";
65
- return result;
66
- }
67
- function createSecretsReflection(context, options = {}) {
68
- const parent = options.superReflection ?? new __powerlines_deepkit_vendor_type.ReflectionClass({
69
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.class,
70
- description: `The base secrets configuration definition for the ${(0, __stryke_string_format_title_case.titleCase)(context.config.name)} project.`,
71
- classType: BaseSecrets,
72
- types: [],
73
- implements: [{
74
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
75
- typeName: "SecretsInterface",
76
- description: `The secrets configuration interface definition for the ${(0, __stryke_string_format_title_case.titleCase)(context.config.name)} project.`,
77
- types: []
78
- }]
79
- });
80
- parent.name = "Secrets";
81
- const result = new __powerlines_deepkit_vendor_type.ReflectionClass(options.type ?? {
82
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
83
- typeName: "Secrets",
84
- description: `A schema describing the list of available environment secrets that can be used by the ${context.config.name ? `${(0, __stryke_string_format_title_case.titleCase)(context.config.name)} application` : "application"}.`,
85
- types: []
86
- }, parent);
87
- result.name = "Secrets";
88
- return result;
89
- }
90
- async function reflectEnv(context, file, name) {
91
- let config;
92
- if (file) config = (0, __powerlines_deepkit_vendor_type.resolveClassType)(await require_reflect_type.reflectType(context, {
93
- file: !(0, __stryke_path_is_parent_path.isParentPath)(file, context.workspaceConfig.workspaceRoot) ? (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, file) : file,
94
- name
95
- }));
96
- const defaultConfigType = await require_reflect_type.reflectType(context, await require_persistence.getEnvDefaultTypeDefinition(context));
97
- return mergeEnvReflections(context, [
98
- await require_persistence.readEnvTypeReflection(context, "env"),
99
- config,
100
- (0, __powerlines_deepkit_vendor_type.resolveClassType)(defaultConfigType)
101
- ].filter(Boolean));
102
- }
103
- async function reflectSecrets(context, file, name) {
104
- let config;
105
- if (file) config = (0, __powerlines_deepkit_vendor_type.resolveClassType)(await require_reflect_type.reflectType(context, {
106
- file: !(0, __stryke_path_is_parent_path.isParentPath)(file, context.workspaceConfig.workspaceRoot) ? (0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, file) : file,
107
- name
108
- }));
109
- const defaultSecretsType = await require_reflect_type.reflectType(context, await require_persistence.getSecretsDefaultTypeDefinition(context));
110
- return mergeSecretsReflections(context, [
111
- await require_persistence.readSecretsReflection(context),
112
- config,
113
- (0, __powerlines_deepkit_vendor_type.resolveClassType)(defaultSecretsType)
114
- ].filter(Boolean));
115
- }
116
-
117
- //#endregion
118
- exports.BaseEnv = BaseEnv;
119
- exports.BaseSecrets = BaseSecrets;
120
- exports.createEnvReflection = createEnvReflection;
121
- exports.createSecretsReflection = createSecretsReflection;
122
- exports.mergeEnvReflections = mergeEnvReflections;
123
- exports.mergeSecretsReflections = mergeSecretsReflections;
124
- exports.reflectEnv = reflectEnv;
125
- exports.reflectSecrets = reflectSecrets;
@@ -1,117 +0,0 @@
1
- import { reflectType } from "../../../deepkit/src/reflect-type.mjs";
2
- import { getEnvDefaultTypeDefinition, getSecretsDefaultTypeDefinition, readEnvTypeReflection, readSecretsReflection } from "./persistence.mjs";
3
- import { isParentPath } from "@stryke/path/is-parent-path";
4
- import { titleCase } from "@stryke/string-format/title-case";
5
- import { ReflectionClass, ReflectionKind, merge, resolveClassType } from "@powerlines/deepkit/vendor/type";
6
- import { joinPaths } from "@stryke/path/join-paths";
7
-
8
- //#region ../plugin-env/src/helpers/reflect.ts
9
- function mergeEnvReflections(context, reflections) {
10
- return createEnvReflection(context, { type: merge(reflections.map((reflection) => reflection.type)) });
11
- }
12
- function mergeSecretsReflections(context, reflections) {
13
- return createSecretsReflection(context, { type: merge(reflections.map((reflection) => reflection.type)) });
14
- }
15
- var BaseEnv = class {
16
- APP_NAME;
17
- APP_VERSION;
18
- BUILD_ID;
19
- BUILD_TIMESTAMP;
20
- BUILD_CHECKSUM;
21
- RELEASE_ID;
22
- RELEASE_TAG;
23
- ORGANIZATION;
24
- PLATFORM = "neutral";
25
- MODE = "production";
26
- ENVIRONMENT;
27
- DEBUG = false;
28
- TEST = false;
29
- MINIMAL = false;
30
- NO_COLOR = false;
31
- FORCE_COLOR = false;
32
- FORCE_HYPERLINK = false;
33
- STACKTRACE = false;
34
- INCLUDE_ERROR_DATA = false;
35
- ERROR_URL;
36
- DEFAULT_TIMEZONE;
37
- DEFAULT_LOCALE;
38
- CI = false;
39
- };
40
- var BaseSecrets = class {
41
- ENCRYPTION_KEY;
42
- };
43
- function createEnvReflection(context, options = {}) {
44
- const parent = options.superReflection ?? new ReflectionClass({
45
- kind: ReflectionKind.class,
46
- description: `The base environment configuration definition for the ${titleCase(context.config.name)} project.`,
47
- classType: BaseEnv,
48
- types: [],
49
- implements: [{
50
- kind: ReflectionKind.objectLiteral,
51
- typeName: "EnvInterface",
52
- description: `The environment configuration interface definition for the ${titleCase(context.config.name)} project.`,
53
- types: []
54
- }]
55
- });
56
- parent.name = "Env";
57
- const result = new ReflectionClass(options.type ?? {
58
- kind: ReflectionKind.objectLiteral,
59
- typeName: "Env",
60
- description: `A schema describing the list of available environment variables that can be used by the ${context.config.name ? `${titleCase(context.config.name)} application` : "application"}.`,
61
- types: []
62
- }, parent);
63
- result.name = "Env";
64
- return result;
65
- }
66
- function createSecretsReflection(context, options = {}) {
67
- const parent = options.superReflection ?? new ReflectionClass({
68
- kind: ReflectionKind.class,
69
- description: `The base secrets configuration definition for the ${titleCase(context.config.name)} project.`,
70
- classType: BaseSecrets,
71
- types: [],
72
- implements: [{
73
- kind: ReflectionKind.objectLiteral,
74
- typeName: "SecretsInterface",
75
- description: `The secrets configuration interface definition for the ${titleCase(context.config.name)} project.`,
76
- types: []
77
- }]
78
- });
79
- parent.name = "Secrets";
80
- const result = new ReflectionClass(options.type ?? {
81
- kind: ReflectionKind.objectLiteral,
82
- typeName: "Secrets",
83
- description: `A schema describing the list of available environment secrets that can be used by the ${context.config.name ? `${titleCase(context.config.name)} application` : "application"}.`,
84
- types: []
85
- }, parent);
86
- result.name = "Secrets";
87
- return result;
88
- }
89
- async function reflectEnv(context, file, name) {
90
- let config;
91
- if (file) config = resolveClassType(await reflectType(context, {
92
- file: !isParentPath(file, context.workspaceConfig.workspaceRoot) ? joinPaths(context.workspaceConfig.workspaceRoot, file) : file,
93
- name
94
- }));
95
- const defaultConfigType = await reflectType(context, await getEnvDefaultTypeDefinition(context));
96
- return mergeEnvReflections(context, [
97
- await readEnvTypeReflection(context, "env"),
98
- config,
99
- resolveClassType(defaultConfigType)
100
- ].filter(Boolean));
101
- }
102
- async function reflectSecrets(context, file, name) {
103
- let config;
104
- if (file) config = resolveClassType(await reflectType(context, {
105
- file: !isParentPath(file, context.workspaceConfig.workspaceRoot) ? joinPaths(context.workspaceConfig.workspaceRoot, file) : file,
106
- name
107
- }));
108
- const defaultSecretsType = await reflectType(context, await getSecretsDefaultTypeDefinition(context));
109
- return mergeSecretsReflections(context, [
110
- await readSecretsReflection(context),
111
- config,
112
- resolveClassType(defaultSecretsType)
113
- ].filter(Boolean));
114
- }
115
-
116
- //#endregion
117
- export { BaseEnv, BaseSecrets, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
@@ -1,24 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
3
- let __stryke_env_types = require("@stryke/env/types");
4
- let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
5
-
6
- //#region ../plugin-env/src/helpers/source-file-env.ts
7
- function removeEnvPrefix(env) {
8
- if ((0, __stryke_type_checks_is_string.isString)(env)) {
9
- let name = __stryke_env_types.ENV_PREFIXES.reduce((ret, prefix) => {
10
- if (ret.startsWith(prefix)) ret = ret.slice(prefix.length);
11
- return ret;
12
- }, env.toUpperCase());
13
- while (name.startsWith("_")) name = name.slice(1);
14
- return name;
15
- }
16
- return Object.keys(env).reduce((ret, key) => {
17
- const name = removeEnvPrefix(key);
18
- if (name) ret[name] = env[key];
19
- return ret;
20
- }, {});
21
- }
22
-
23
- //#endregion
24
- exports.removeEnvPrefix = removeEnvPrefix;
@@ -1,23 +0,0 @@
1
- import { isString } from "@stryke/type-checks/is-string";
2
- import { ENV_PREFIXES } from "@stryke/env/types";
3
- import { camelCase } from "@stryke/string-format/camel-case";
4
-
5
- //#region ../plugin-env/src/helpers/source-file-env.ts
6
- function removeEnvPrefix(env) {
7
- if (isString(env)) {
8
- let name = ENV_PREFIXES.reduce((ret, prefix) => {
9
- if (ret.startsWith(prefix)) ret = ret.slice(prefix.length);
10
- return ret;
11
- }, env.toUpperCase());
12
- while (name.startsWith("_")) name = name.slice(1);
13
- return name;
14
- }
15
- return Object.keys(env).reduce((ret, key) => {
16
- const name = removeEnvPrefix(key);
17
- if (name) ret[name] = env[key];
18
- return ret;
19
- }, {});
20
- }
21
-
22
- //#endregion
23
- export { removeEnvPrefix };
@@ -1,2 +0,0 @@
1
- require('./persistence.cjs');
2
- let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
@@ -1,4 +0,0 @@
1
- import "./persistence.mjs";
2
- import { titleCase } from "@stryke/string-format/title-case";
3
-
4
- export { };
@@ -1,177 +0,0 @@
1
- const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
- const require_index = require('../../plugin-babel/src/index.cjs');
3
- const require_index$1 = require('../../plugin-alloy/src/index.cjs');
4
- const require_index$2 = require('../../plugin-automd/src/index.cjs');
5
- const require_plugin = require('./babel/plugin.cjs');
6
- const require_source_file_env = require('./helpers/source-file-env.cjs');
7
- const require_load = require('./helpers/load.cjs');
8
- const require_reflect = require('./helpers/reflect.cjs');
9
- const require_persistence = require('./helpers/persistence.cjs');
10
- const require_create_reflection_resource = require('./helpers/create-reflection-resource.cjs');
11
- const require_docs_helper = require('./helpers/docs-helper.cjs');
12
- const require_docs = require('./components/docs.cjs');
13
- const require_env = require('./components/env.cjs');
14
- const require_automd_generator = require('./helpers/automd-generator.cjs');
15
- require('./babel/index.cjs');
16
- require('./components/index.cjs');
17
- require('./helpers/index.cjs');
18
- let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
19
- let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
20
- let defu = require("defu");
21
- defu = require_rolldown_runtime.__toESM(defu);
22
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
23
- let __stryke_convert_to_array = require("@stryke/convert/to-array");
24
- let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
25
- let __stryke_env_types = require("@stryke/env/types");
26
- let __stryke_fs_exists = require("@stryke/fs/exists");
27
- let __stryke_path_join = require("@stryke/path/join");
28
- let __stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
29
-
30
- //#region ../plugin-env/src/index.tsx
31
- /**
32
- * A Powerlines plugin to inject environment variables into the source code.
33
- */
34
- const plugin = (options = {}) => {
35
- return [
36
- require_index$1.default(options.alloy),
37
- require_index.default(options.babel),
38
- {
39
- name: "env",
40
- async config() {
41
- this.debug("Providing default configuration for the Powerlines `env` build plugin.");
42
- const config = {
43
- env: (0, defu.default)(options, {
44
- types: {},
45
- prefix: []
46
- }),
47
- transform: { babel: { plugins: [require_plugin.envBabelPlugin] } }
48
- };
49
- if (config.env.types) config.env.types = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(config.env.types);
50
- else {
51
- this.warn("The `env.types` configuration parameter was not provided. Please ensure this is expected.");
52
- const envDefaultTypeDefinition = await require_persistence.getEnvDefaultTypeDefinition(this);
53
- config.env.types = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(`${envDefaultTypeDefinition.file}#${envDefaultTypeDefinition.name}`);
54
- }
55
- if (config.env.secrets) config.env.secrets = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(config.env.secrets);
56
- else {
57
- const secretsDefaultTypeDefinition = await require_persistence.getSecretsDefaultTypeDefinition(this);
58
- config.env.secrets = (0, __stryke_convert_parse_type_definition.parseTypeDefinition)(`${secretsDefaultTypeDefinition.file}#${secretsDefaultTypeDefinition.name}`);
59
- }
60
- config.env.prefix = (0, __stryke_convert_to_array.toArray)(config.env.prefix ?? []).reduce((ret, prefix) => {
61
- const formattedPrefix = (0, __stryke_string_format_constant_case.constantCase)(prefix);
62
- if (!ret.includes(formattedPrefix)) ret.push(formattedPrefix);
63
- return ret;
64
- }, [
65
- ...__stryke_env_types.ENV_PREFIXES,
66
- "POWERLINES_",
67
- this.config.framework && this.config.framework !== "powerlines" && `${(0, __stryke_string_format_constant_case.constantCase)(this.config.framework)}_`
68
- ].filter(Boolean));
69
- config.env.prefix = (0, __stryke_convert_to_array.toArray)(config.env.prefix).reduce((ret, prefix) => {
70
- if (!ret.includes(prefix.replace(/_$/g, ""))) ret.push(prefix.replace(/_$/g, ""));
71
- return ret;
72
- }, []);
73
- return config;
74
- },
75
- async configResolved() {
76
- this.debug(`Environment plugin configuration has been resolved for the Powerlines project.`);
77
- this.env = (0, defu.default)({ parsed: await require_load.loadEnv(this, this.config.env) }, this.env ?? {}, {
78
- types: { env: {} },
79
- used: {
80
- env: {},
81
- secrets: {}
82
- },
83
- parsed: {},
84
- injected: {}
85
- });
86
- if (this.config.command !== "prepare" && !this.config.skipCache && this.persistedMeta?.checksum === this.meta.checksum && (0, __stryke_fs_exists.existsSync)(require_persistence.getEnvTypeReflectionsPath(this, "env"))) {
87
- this.debug(`Skipping reflection initialization as the meta checksum has not changed.`);
88
- this.env.types.env = await require_persistence.readEnvTypeReflection(this, "env");
89
- if ((0, __stryke_fs_exists.existsSync)(require_persistence.getEnvReflectionsPath(this, "env"))) this.env.used.env = await require_persistence.readEnvReflection(this);
90
- if ((0, __stryke_fs_exists.existsSync)(require_persistence.getEnvTypeReflectionsPath(this, "secrets"))) this.env.types.secrets = await require_persistence.readEnvTypeReflection(this, "secrets");
91
- if ((0, __stryke_fs_exists.existsSync)(require_persistence.getEnvReflectionsPath(this, "secrets"))) this.env.used.secrets = await require_persistence.readSecretsReflection(this);
92
- } else {
93
- this.debug(`Starting environment configuration reflection initialization.`);
94
- this.env.types.env = await require_reflect.reflectEnv(this, this.config.env.types?.file ? (0, __stryke_path_is_parent_path.isParentPath)(this.config.env.types?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.types?.file : (0, __stryke_path_join.joinPaths)(this.config.projectRoot, this.config.env.types?.file) : void 0, this.config.env.types?.name);
95
- if (!this.env.types.env) throw new Error("Failed to find the environment configuration type reflection in the context.");
96
- await require_persistence.writeEnvTypeReflection(this, this.env.types.env, "env");
97
- this.env.types.secrets = await require_reflect.reflectSecrets(this, this.config.env.secrets?.file ? (0, __stryke_path_is_parent_path.isParentPath)(this.config.env.secrets?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.secrets?.file : (0, __stryke_path_join.joinPaths)(this.config.projectRoot, this.config.env.secrets?.file) : void 0, this.config.env.secrets?.name);
98
- if (!this.env.types.secrets) throw new Error("Failed to find the secrets configuration type reflection in the context.");
99
- await require_persistence.writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
100
- this.debug(`Resolved ${this.env.types.env.getProperties().length ?? 0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length ?? 0} secret configuration parameters`);
101
- const envWithAlias = this.env.types.env.getProperties().filter((prop) => prop.getAlias().length > 0);
102
- Object.entries(await require_load.loadEnv(this, this.config.env)).forEach(([key, value]) => {
103
- const unprefixedKey = this.config.env.prefix.reduce((ret, prefix) => {
104
- if (key.replace(/_$/g, "").startsWith(prefix)) return key.replace(/_$/g, "").slice(prefix.length);
105
- return ret;
106
- }, key);
107
- const aliasKey = envWithAlias.find((prop) => prop?.getAlias().reverse().includes(unprefixedKey));
108
- if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) this.env.types.env.getProperty(unprefixedKey).setDefaultValue(value);
109
- });
110
- this.env.used.env = new __powerlines_deepkit_vendor_type.ReflectionClass({
111
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
112
- typeName: "Env",
113
- description: `An object containing the environment configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
114
- types: []
115
- }, this.env.types.env);
116
- await require_persistence.writeEnvReflection(this, this.env.used.env, "env");
117
- if (this.env.types.secrets) {
118
- await require_persistence.writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
119
- this.env.used.secrets = new __powerlines_deepkit_vendor_type.ReflectionClass({
120
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
121
- typeName: "Secrets",
122
- description: `An object containing the secret configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
123
- types: []
124
- }, this.env.types.secrets);
125
- await require_persistence.writeEnvReflection(this, this.env.used.secrets, "secrets");
126
- }
127
- }
128
- },
129
- async prepare() {
130
- const _self$ = this;
131
- this.debug(`Preparing the Environment runtime artifacts for the Powerlines project.`);
132
- return this.render((0, __alloy_js_core_jsx_runtime.createComponent)(require_env.EnvBuiltin, { get defaultConfig() {
133
- return _self$.config.env.defaultConfig;
134
- } }));
135
- },
136
- transform: {
137
- order: "post",
138
- async handler() {
139
- if (this.env.used.env.getProperties().length > 0) {
140
- this.trace(`Persisting used environment configuration reflections to ${require_persistence.getEnvReflectionsPath(this, "env")}.`);
141
- await require_persistence.writeEnvReflection(this, this.env.used.env, "env");
142
- }
143
- if (this.env.used.secrets.getProperties().length > 0) {
144
- this.trace(`Persisting used secret configuration reflections to ${require_persistence.getEnvReflectionsPath(this, "secrets")}.`);
145
- await require_persistence.writeEnvReflection(this, this.env.used.secrets, "secrets");
146
- }
147
- }
148
- },
149
- async docs() {
150
- this.debug(`Documenting environment variables configuration values in "${(0, __stryke_path_join.joinPaths)(require_docs_helper.getDocsOutputPath(this), "env.md")}"`);
151
- return this.render((0, __alloy_js_core_jsx_runtime.createComponent)(require_docs.EnvDocsFile, { levelOffset: 0 }));
152
- },
153
- async buildEnd() {
154
- const reflectionPath = require_persistence.getEnvReflectionsPath(this, "env");
155
- this.debug(`Writing env reflection types to ${reflectionPath}.`);
156
- await require_persistence.writeEnvReflection(this, this.env.used.env, "env");
157
- }
158
- },
159
- {
160
- name: "env:automd-generator",
161
- config() {
162
- return { automd: (0, defu.default)(options.automd ?? {}, { generators: { "env": require_automd_generator.env(this) } }) };
163
- }
164
- },
165
- {
166
- name: "env:vite",
167
- vite: { configResolved() {
168
- return { envPrefix: this.config?.env?.prefix };
169
- } }
170
- },
171
- require_index$2.default(options.automd)
172
- ];
173
- };
174
- var src_default$3 = plugin;
175
-
176
- //#endregion
177
- exports.default = src_default$3;
@@ -1,175 +0,0 @@
1
- import src_default$2 from "../../plugin-babel/src/index.mjs";
2
- import src_default from "../../plugin-alloy/src/index.mjs";
3
- import src_default$1 from "../../plugin-automd/src/index.mjs";
4
- import { envBabelPlugin } from "./babel/plugin.mjs";
5
- import { removeEnvPrefix } from "./helpers/source-file-env.mjs";
6
- import { loadEnv, loadEnvFromContext } from "./helpers/load.mjs";
7
- import { BaseEnv, BaseSecrets, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./helpers/reflect.mjs";
8
- import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvTypeReflection } from "./helpers/persistence.mjs";
9
- import { createReflectionResource } from "./helpers/create-reflection-resource.mjs";
10
- import { getDocsOutputPath } from "./helpers/docs-helper.mjs";
11
- import { EnvDocsFile } from "./components/docs.mjs";
12
- import { EnvBuiltin, EnvTypeDefinition } from "./components/env.mjs";
13
- import { env } from "./helpers/automd-generator.mjs";
14
- import "./babel/index.mjs";
15
- import "./components/index.mjs";
16
- import "./helpers/index.mjs";
17
- import { createComponent } from "@alloy-js/core/jsx-runtime";
18
- import { isParentPath } from "@stryke/path/is-parent-path";
19
- import defu from "defu";
20
- import { ReflectionClass, ReflectionKind } from "@powerlines/deepkit/vendor/type";
21
- import { toArray } from "@stryke/convert/to-array";
22
- import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
23
- import { ENV_PREFIXES } from "@stryke/env/types";
24
- import { existsSync } from "@stryke/fs/exists";
25
- import { joinPaths } from "@stryke/path/join";
26
- import { constantCase } from "@stryke/string-format/constant-case";
27
-
28
- //#region ../plugin-env/src/index.tsx
29
- /**
30
- * A Powerlines plugin to inject environment variables into the source code.
31
- */
32
- const plugin = (options = {}) => {
33
- return [
34
- src_default(options.alloy),
35
- src_default$2(options.babel),
36
- {
37
- name: "env",
38
- async config() {
39
- this.debug("Providing default configuration for the Powerlines `env` build plugin.");
40
- const config = {
41
- env: defu(options, {
42
- types: {},
43
- prefix: []
44
- }),
45
- transform: { babel: { plugins: [envBabelPlugin] } }
46
- };
47
- if (config.env.types) config.env.types = parseTypeDefinition(config.env.types);
48
- else {
49
- this.warn("The `env.types` configuration parameter was not provided. Please ensure this is expected.");
50
- const envDefaultTypeDefinition = await getEnvDefaultTypeDefinition(this);
51
- config.env.types = parseTypeDefinition(`${envDefaultTypeDefinition.file}#${envDefaultTypeDefinition.name}`);
52
- }
53
- if (config.env.secrets) config.env.secrets = parseTypeDefinition(config.env.secrets);
54
- else {
55
- const secretsDefaultTypeDefinition = await getSecretsDefaultTypeDefinition(this);
56
- config.env.secrets = parseTypeDefinition(`${secretsDefaultTypeDefinition.file}#${secretsDefaultTypeDefinition.name}`);
57
- }
58
- config.env.prefix = toArray(config.env.prefix ?? []).reduce((ret, prefix) => {
59
- const formattedPrefix = constantCase(prefix);
60
- if (!ret.includes(formattedPrefix)) ret.push(formattedPrefix);
61
- return ret;
62
- }, [
63
- ...ENV_PREFIXES,
64
- "POWERLINES_",
65
- this.config.framework && this.config.framework !== "powerlines" && `${constantCase(this.config.framework)}_`
66
- ].filter(Boolean));
67
- config.env.prefix = toArray(config.env.prefix).reduce((ret, prefix) => {
68
- if (!ret.includes(prefix.replace(/_$/g, ""))) ret.push(prefix.replace(/_$/g, ""));
69
- return ret;
70
- }, []);
71
- return config;
72
- },
73
- async configResolved() {
74
- this.debug(`Environment plugin configuration has been resolved for the Powerlines project.`);
75
- this.env = defu({ parsed: await loadEnv(this, this.config.env) }, this.env ?? {}, {
76
- types: { env: {} },
77
- used: {
78
- env: {},
79
- secrets: {}
80
- },
81
- parsed: {},
82
- injected: {}
83
- });
84
- if (this.config.command !== "prepare" && !this.config.skipCache && this.persistedMeta?.checksum === this.meta.checksum && existsSync(getEnvTypeReflectionsPath(this, "env"))) {
85
- this.debug(`Skipping reflection initialization as the meta checksum has not changed.`);
86
- this.env.types.env = await readEnvTypeReflection(this, "env");
87
- if (existsSync(getEnvReflectionsPath(this, "env"))) this.env.used.env = await readEnvReflection(this);
88
- if (existsSync(getEnvTypeReflectionsPath(this, "secrets"))) this.env.types.secrets = await readEnvTypeReflection(this, "secrets");
89
- if (existsSync(getEnvReflectionsPath(this, "secrets"))) this.env.used.secrets = await readSecretsReflection(this);
90
- } else {
91
- this.debug(`Starting environment configuration reflection initialization.`);
92
- this.env.types.env = await reflectEnv(this, this.config.env.types?.file ? isParentPath(this.config.env.types?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.types?.file : joinPaths(this.config.projectRoot, this.config.env.types?.file) : void 0, this.config.env.types?.name);
93
- if (!this.env.types.env) throw new Error("Failed to find the environment configuration type reflection in the context.");
94
- await writeEnvTypeReflection(this, this.env.types.env, "env");
95
- this.env.types.secrets = await reflectSecrets(this, this.config.env.secrets?.file ? isParentPath(this.config.env.secrets?.file, this.workspaceConfig.workspaceRoot) ? this.config.env.secrets?.file : joinPaths(this.config.projectRoot, this.config.env.secrets?.file) : void 0, this.config.env.secrets?.name);
96
- if (!this.env.types.secrets) throw new Error("Failed to find the secrets configuration type reflection in the context.");
97
- await writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
98
- this.debug(`Resolved ${this.env.types.env.getProperties().length ?? 0} environment configuration parameters and ${this.env.types.secrets?.getProperties().length ?? 0} secret configuration parameters`);
99
- const envWithAlias = this.env.types.env.getProperties().filter((prop) => prop.getAlias().length > 0);
100
- Object.entries(await loadEnv(this, this.config.env)).forEach(([key, value]) => {
101
- const unprefixedKey = this.config.env.prefix.reduce((ret, prefix) => {
102
- if (key.replace(/_$/g, "").startsWith(prefix)) return key.replace(/_$/g, "").slice(prefix.length);
103
- return ret;
104
- }, key);
105
- const aliasKey = envWithAlias.find((prop) => prop?.getAlias().reverse().includes(unprefixedKey));
106
- if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) this.env.types.env.getProperty(unprefixedKey).setDefaultValue(value);
107
- });
108
- this.env.used.env = new ReflectionClass({
109
- kind: ReflectionKind.objectLiteral,
110
- typeName: "Env",
111
- description: `An object containing the environment configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
112
- types: []
113
- }, this.env.types.env);
114
- await writeEnvReflection(this, this.env.used.env, "env");
115
- if (this.env.types.secrets) {
116
- await writeEnvTypeReflection(this, this.env.types.secrets, "secrets");
117
- this.env.used.secrets = new ReflectionClass({
118
- kind: ReflectionKind.objectLiteral,
119
- typeName: "Secrets",
120
- description: `An object containing the secret configuration parameters used by the ${this.config.name ? `${this.config.name} application` : "application"}.`,
121
- types: []
122
- }, this.env.types.secrets);
123
- await writeEnvReflection(this, this.env.used.secrets, "secrets");
124
- }
125
- }
126
- },
127
- async prepare() {
128
- const _self$ = this;
129
- this.debug(`Preparing the Environment runtime artifacts for the Powerlines project.`);
130
- return this.render(createComponent(EnvBuiltin, { get defaultConfig() {
131
- return _self$.config.env.defaultConfig;
132
- } }));
133
- },
134
- transform: {
135
- order: "post",
136
- async handler() {
137
- if (this.env.used.env.getProperties().length > 0) {
138
- this.trace(`Persisting used environment configuration reflections to ${getEnvReflectionsPath(this, "env")}.`);
139
- await writeEnvReflection(this, this.env.used.env, "env");
140
- }
141
- if (this.env.used.secrets.getProperties().length > 0) {
142
- this.trace(`Persisting used secret configuration reflections to ${getEnvReflectionsPath(this, "secrets")}.`);
143
- await writeEnvReflection(this, this.env.used.secrets, "secrets");
144
- }
145
- }
146
- },
147
- async docs() {
148
- this.debug(`Documenting environment variables configuration values in "${joinPaths(getDocsOutputPath(this), "env.md")}"`);
149
- return this.render(createComponent(EnvDocsFile, { levelOffset: 0 }));
150
- },
151
- async buildEnd() {
152
- const reflectionPath = getEnvReflectionsPath(this, "env");
153
- this.debug(`Writing env reflection types to ${reflectionPath}.`);
154
- await writeEnvReflection(this, this.env.used.env, "env");
155
- }
156
- },
157
- {
158
- name: "env:automd-generator",
159
- config() {
160
- return { automd: defu(options.automd ?? {}, { generators: { "env": env(this) } }) };
161
- }
162
- },
163
- {
164
- name: "env:vite",
165
- vite: { configResolved() {
166
- return { envPrefix: this.config?.env?.prefix };
167
- } }
168
- },
169
- src_default$1(options.automd)
170
- ];
171
- };
172
- var src_default$3 = plugin;
173
-
174
- //#endregion
175
- export { src_default$3 as default };