@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,589 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- const require_context = require('../../../plugin-alloy/src/core/contexts/context.cjs');
3
- const require_load = require('../helpers/load.cjs');
4
- const require_create_reflection_resource = require('../helpers/create-reflection-resource.cjs');
5
- const require_refkey = require('../../../plugin-alloy/src/helpers/refkey.cjs');
6
- const require_tsdoc = require('../../../plugin-alloy/src/typescript/components/tsdoc.cjs');
7
- const require_builtin_file = require('../../../plugin-alloy/src/typescript/components/builtin-file.cjs');
8
- const require_typescript_interface = require('../../../plugin-alloy/src/typescript/components/typescript-interface.cjs');
9
- const require_typescript_object = require('../../../plugin-alloy/src/typescript/components/typescript-object.cjs');
10
- let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
11
- let defu = require("defu");
12
- defu = require_rolldown_runtime.__toESM(defu);
13
- let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
14
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
15
- let __alloy_js_core = require("@alloy-js/core");
16
- let __stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
17
- let __alloy_js_typescript = require("@alloy-js/typescript");
18
-
19
- //#region ../plugin-env/src/components/env.tsx
20
- /**
21
- * Generates the environment configuration typescript definition for the Powerlines project.
22
- */
23
- function EnvTypeDefinition(props) {
24
- const [{ defaultValue, reflection }] = (0, __alloy_js_core.splitProps)(props, ["defaultValue", "reflection"]);
25
- const context = require_context.usePowerlinesSafe();
26
- if (!context) return null;
27
- return [
28
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_interface.TypeScriptInterface, {
29
- name: " EnvBase",
30
- defaultValue,
31
- reflection,
32
- "export": true
33
- }),
34
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
35
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
36
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDoc, {
37
- heading: "The environment configuration object with prefixed keys.",
38
- get children() {
39
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocRemarks, { children: `The \`Env\` type extends the \`EnvBase\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.` });
40
- }
41
- }),
42
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.TypeDeclaration, {
43
- name: "Env",
44
- "export": true,
45
- get children() {
46
- return __alloy_js_core.code` {
47
- [Key in keyof EnvBase as Key ${context.config.env.prefix.map((prefix) => `| \`${prefix.replace(/_$/g, "")}_\${Key}\``).join(" ")}]: EnvBase[Key];
48
- }
49
- `;
50
- }
51
- }),
52
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
53
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
54
- ];
55
- }
56
- function ConfigPropertyConditional(props) {
57
- const [{ context, name }] = (0, __alloy_js_core.splitProps)(props, ["context", "name"]);
58
- if (!context) return null;
59
- return __alloy_js_core.code`propertyName === "${name}" || propertyName.replace(/^(${context.config.env.prefix.sort((a, b) => a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)).map((prefix) => `${prefix.replace(/_$/, "")}_`).join("|")})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${name.toLowerCase().replace(/[\s\-_]+/g, "")}"`;
60
- }
61
- function ConfigPropertyGet(props) {
62
- const [{ context, property, index }] = (0, __alloy_js_core.splitProps)(props, [
63
- "context",
64
- "property",
65
- "index"
66
- ]);
67
- if (!context) return null;
68
- return [index === 0 ? (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
69
- get condition() {
70
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
71
- get name() {
72
- return property.getNameAsString();
73
- },
74
- context
75
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
76
- get when() {
77
- return (0, __alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
78
- },
79
- get children() {
80
- return [__alloy_js_core.code` || `, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
81
- get each() {
82
- return property.getAlias();
83
- },
84
- joiner: __alloy_js_core.code` || `,
85
- children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
86
- name: alias,
87
- context
88
- })
89
- })];
90
- }
91
- })];
92
- },
93
- get children() {
94
- return __alloy_js_core.code`return target["${property.getNameAsString()}"];`;
95
- }
96
- }) : (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
97
- get condition() {
98
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
99
- get name() {
100
- return property.getNameAsString();
101
- },
102
- context
103
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
104
- get when() {
105
- return (0, __alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
106
- },
107
- get children() {
108
- return [__alloy_js_core.code` || `, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
109
- get each() {
110
- return property.getAlias();
111
- },
112
- joiner: __alloy_js_core.code` || `,
113
- children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
114
- name: alias,
115
- context
116
- })
117
- })];
118
- }
119
- })];
120
- },
121
- get children() {
122
- return __alloy_js_core.code`return target["${property.getNameAsString()}"];`;
123
- }
124
- })];
125
- }
126
- function ConfigPropertySet(props) {
127
- const [{ context, property, index }] = (0, __alloy_js_core.splitProps)(props, [
128
- "context",
129
- "property",
130
- "index"
131
- ]);
132
- if (!context) return null;
133
- return [index === 0 ? (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
134
- get condition() {
135
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
136
- get name() {
137
- return property.getNameAsString();
138
- },
139
- context
140
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
141
- get when() {
142
- return (0, __alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
143
- },
144
- get children() {
145
- return [__alloy_js_core.code` || `, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
146
- get each() {
147
- return property.getAlias();
148
- },
149
- joiner: __alloy_js_core.code` || `,
150
- children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
151
- name: alias,
152
- context
153
- })
154
- })];
155
- }
156
- })];
157
- },
158
- get children() {
159
- return __alloy_js_core.code`
160
- target["${property.getNameAsString()}"] = newValue;
161
- return true;
162
- `;
163
- }
164
- }) : (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
165
- get condition() {
166
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
167
- get name() {
168
- return property.getNameAsString();
169
- },
170
- context
171
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
172
- get when() {
173
- return (0, __alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
174
- },
175
- get children() {
176
- return [__alloy_js_core.code` || `, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
177
- get each() {
178
- return property.getAlias();
179
- },
180
- joiner: __alloy_js_core.code` || `,
181
- children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
182
- name: alias,
183
- context
184
- })
185
- })];
186
- }
187
- })];
188
- },
189
- get children() {
190
- return __alloy_js_core.code`
191
- target["${property.getNameAsString()}"] = newValue;
192
- return true;
193
- `;
194
- }
195
- })];
196
- }
197
- const createEnvRefkey = require_refkey.refkey("createEnv");
198
- const envRefkey = require_refkey.refkey("env");
199
- const envSerializerRefkey = require_refkey.refkey("EnvSerializer");
200
- /**
201
- * Generates the environment configuration module for the Powerlines project.
202
- */
203
- function EnvBuiltin(props) {
204
- const [{ defaultConfig, children }, rest] = (0, __alloy_js_core.splitProps)(props, ["defaultConfig", "children"]);
205
- const context = require_context.usePowerlinesSafe();
206
- const defaultValue = (0, __alloy_js_core.computed)(() => context && require_load.loadEnvFromContext(context, process.env));
207
- const reflection = require_create_reflection_resource.createReflectionResource(context);
208
- const envInstance = (0, __alloy_js_core.computed)(() => {
209
- return new __powerlines_deepkit_vendor_type.ReflectionClass({
210
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
211
- description: `The initial environment configuration state for the ${(0, __stryke_string_format_title_case.titleCase)(context?.config?.name)} project.`,
212
- types: []
213
- }, reflection.data ?? void 0);
214
- });
215
- const reflectionGetProperties = (0, __alloy_js_core.computed)(() => reflection.data?.getProperties().filter((property) => !property.isIgnored()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
216
- const reflectionSetProperties = (0, __alloy_js_core.computed)(() => reflection.data?.getProperties().filter((property) => !property.isIgnored() && !property.isReadonly()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
217
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_builtin_file.BuiltinFile, (0, __alloy_js_core_jsx_runtime.mergeProps)({
218
- id: "env",
219
- description: "The environment configuration module provides an interface to define environment configuration parameters."
220
- }, rest, {
221
- get imports() {
222
- return (0, defu.default)({ "@powerlines/deepkit/vendor/type": [
223
- "stringify",
224
- "serializer",
225
- "serializeFunction",
226
- "deserializeFunction",
227
- "ReflectionKind",
228
- "Serializer",
229
- "TemplateState",
230
- "Type",
231
- "TypeProperty",
232
- "TypePropertySignature"
233
- ] }, rest.imports ?? {});
234
- },
235
- get children() {
236
- return [
237
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
238
- get when() {
239
- return !(0, __stryke_type_checks_is_null.isNull)(reflection.data);
240
- },
241
- get children() {
242
- return [
243
- (0, __alloy_js_core_jsx_runtime.createComponent)(EnvTypeDefinition, {
244
- get defaultValue() {
245
- return defaultValue.value;
246
- },
247
- get reflection() {
248
- return reflection.data;
249
- }
250
- }),
251
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
252
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
253
- ];
254
- }
255
- }),
256
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_typescript_object.TypescriptObject, {
257
- name: "initialEnv",
258
- type: "Partial<EnvBase>",
259
- defaultValue,
260
- reflection: envInstance,
261
- "export": true,
262
- "const": true,
263
- doc: "The initial environment configuration object values for the runtime."
264
- }),
265
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
266
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
267
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDoc, {
268
- heading: "The environment configuration serializer for the Powerlines application.",
269
- get children() {
270
- return [
271
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
272
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
273
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
274
- ];
275
- }
276
- }),
277
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ClassDeclaration, {
278
- refkey: envSerializerRefkey,
279
- name: "EnvSerializer",
280
- "extends": "Serializer",
281
- "export": true,
282
- get children() {
283
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ClassMethod, {
284
- name: "constructor",
285
- "public": true,
286
- doc: "Initializes a new instance of the `EnvSerializer` class.",
287
- children: __alloy_js_core.code`
288
- super("env");
289
-
290
- this.deserializeRegistry.register(
291
- ReflectionKind.boolean,
292
- (type: Type, state: TemplateState) => {
293
- state.addSetter(
294
- \`typeof \${state.accessor.toString()} !== "boolean" ? \${state.accessor.toString()} === 1 || \${state.accessor.toString()} === "1" || \${state.accessor.toString()}.toLowerCase() === "t" || \${state.accessor.toString()}.toLowerCase() === "true" || \${state.accessor.toString()}.toLowerCase() === "y" || \${state.accessor.toString()}.toLowerCase() === "yes" : \${state.accessor.toString()}\`
295
- );
296
- }
297
- );
298
- `
299
- });
300
- }
301
- }),
302
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
303
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
304
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDoc, {
305
- heading: "A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.",
306
- get children() {
307
- return [
308
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
309
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
310
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
311
- ];
312
- }
313
- }),
314
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
315
- name: "envSerializer",
316
- "export": false,
317
- "const": true,
318
- get initializer() {
319
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.NewExpression, {
320
- args: [],
321
- target: "EnvSerializer"
322
- });
323
- }
324
- }),
325
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
326
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
327
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDoc, {
328
- heading: "Serialize a environment configuration object to JSON data objects (not a JSON string).",
329
- get children() {
330
- return [
331
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocRemarks, { children: `The resulting JSON object can be stringified using \`JSON.stringify()\`.` }),
332
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocExample, { children: `const json = serializeEnv(env);` }),
333
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocThrows, { children: `ValidationError when serialization or validation fails.` })
334
- ];
335
- }
336
- }),
337
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
338
- name: "serializeEnv",
339
- "export": true,
340
- "const": true,
341
- initializer: "serializeFunction<EnvBase>(envSerializer)"
342
- }),
343
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
344
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
345
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDoc, {
346
- heading: "Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.",
347
- get children() {
348
- return [
349
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocRemarks, { children: `Types that are already correct will be used as-is.` }),
350
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocExample, { children: `const env = deserializeEnv(json);` }),
351
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocThrows, { children: `ValidationError when deserialization fails.` })
352
- ];
353
- }
354
- }),
355
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
356
- name: "deserializeEnv",
357
- "export": true,
358
- "const": true,
359
- initializer: "deserializeFunction<EnvBase>(envSerializer)"
360
- }),
361
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
362
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
363
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDoc, {
364
- heading: "Initializes the Powerlines environment configuration module.",
365
- get children() {
366
- return [
367
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
368
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocParam, {
369
- name: "environmentConfig",
370
- children: `The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`
371
- }),
372
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocReturns, { children: `The initialized Powerlines configuration object.` })
373
- ];
374
- }
375
- }),
376
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
377
- get when() {
378
- return Boolean(context?.entryPath);
379
- },
380
- get children() {
381
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
382
- refkey: createEnvRefkey,
383
- async: false,
384
- "export": true,
385
- name: "createEnv",
386
- parameters: [{
387
- name: "environmentConfig",
388
- type: `Partial<Env>`,
389
- optional: false,
390
- default: "{}"
391
- }],
392
- returnType: "Env",
393
- get children() {
394
- return [
395
- __alloy_js_core.code`
396
- return new Proxy<Env>(
397
- deserializeEnv({
398
- ...initialEnv,
399
- ...environmentConfig
400
- }) as Env,
401
- {
402
- get: (target: EnvBase, propertyName: string) => { `,
403
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
404
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
405
- each: reflectionGetProperties,
406
- children: (property, index) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyGet, {
407
- index,
408
- context,
409
- property
410
- })
411
- }),
412
- __alloy_js_core.code`
413
- return undefined;
414
- }, `,
415
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
416
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
417
- __alloy_js_core.code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,
418
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
419
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
420
- each: reflectionSetProperties,
421
- ender: __alloy_js_core.code` else `,
422
- children: (property, index) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertySet, {
423
- index,
424
- context,
425
- property
426
- })
427
- }),
428
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
429
- __alloy_js_core.code`return false;
430
- }
431
- }
432
- );
433
- `
434
- ];
435
- }
436
- });
437
- }
438
- }),
439
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
440
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
441
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
442
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDoc, {
443
- heading: "The environment configuration object.",
444
- get children() {
445
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocRemarks, { children: `This object provides access to the environment configuration parameters in the application runtime.` });
446
- }
447
- }),
448
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
449
- refkey: envRefkey,
450
- name: "env",
451
- type: "Env",
452
- "export": true,
453
- "const": true,
454
- get initializer() {
455
- return [__alloy_js_core.code`createEnv(${defaultConfig || "{}"} as Partial<Env>);`];
456
- }
457
- }),
458
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
459
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
460
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
461
- "export": true,
462
- "const": true,
463
- name: "isCI",
464
- doc: "Detect if the application is running in a continuous integration (CI) environment.",
465
- initializer: __alloy_js_core.code`Boolean(
466
- env.CI ||
467
- env.RUN_ID ||
468
- env.AGOLA_GIT_REF ||
469
- env.AC_APPCIRCLE ||
470
- env.APPVEYOR ||
471
- env.CODEBUILD ||
472
- env.TF_BUILD ||
473
- env.bamboo_planKey ||
474
- env.BITBUCKET_COMMIT ||
475
- env.BITRISE_IO ||
476
- env.BUDDY_WORKSPACE_ID ||
477
- env.BUILDKITE ||
478
- env.CIRCLECI ||
479
- env.CIRRUS_CI ||
480
- env.CF_BUILD_ID ||
481
- env.CM_BUILD_ID ||
482
- env.CI_NAME ||
483
- env.DRONE ||
484
- env.DSARI ||
485
- env.EARTHLY_CI ||
486
- env.EAS_BUILD ||
487
- env.GERRIT_PROJECT ||
488
- env.GITEA_ACTIONS ||
489
- env.GITHUB_ACTIONS ||
490
- env.GITLAB_CI ||
491
- env.GOCD ||
492
- env.BUILDER_OUTPUT ||
493
- env.HARNESS_BUILD_ID ||
494
- env.JENKINS_URL ||
495
- env.LAYERCI ||
496
- env.MAGNUM ||
497
- env.NETLIFY ||
498
- env.NEVERCODE ||
499
- env.PROW_JOB_ID ||
500
- env.RELEASE_BUILD_ID ||
501
- env.RENDER ||
502
- env.SAILCI ||
503
- env.HUDSON ||
504
- env.SCREWDRIVER ||
505
- env.SEMAPHORE ||
506
- env.SOURCEHUT ||
507
- env.STRIDER ||
508
- env.TASK_ID ||
509
- env.RUN_ID ||
510
- env.TEAMCITY_VERSION ||
511
- env.TRAVIS ||
512
- env.VELA ||
513
- env.NOW_BUILDER ||
514
- env.APPCENTER_BUILD_ID ||
515
- env.CI_XCODE_PROJECT ||
516
- env.XCS || false
517
- );
518
- `
519
- }),
520
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
521
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
522
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDoc, {
523
- heading: "Detect the \\`mode\\` of the current runtime environment.",
524
- get children() {
525
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc.TSDocRemarks, { children: __alloy_js_core.code`The \`mode\` is determined by the \`MODE\` environment variable, or falls back to the \`NEXT_PUBLIC_VERCEL_ENV\`, \`NODE_ENV\`, or defaults to \`production\`. While the value can potentially be any string, it is generally recommended to only allow a value in the following list:
526
- - \`production\`
527
- - \`test\`
528
- - \`development\`
529
- ` });
530
- }
531
- }),
532
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
533
- "export": true,
534
- "const": true,
535
- name: "mode",
536
- initializer: __alloy_js_core.code`String(env.MODE) || "production"; `
537
- }),
538
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
539
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
540
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
541
- "export": true,
542
- "const": true,
543
- name: "isProduction",
544
- doc: "Detect if the application is running in `\"production\"` mode",
545
- initializer: __alloy_js_core.code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
546
- }),
547
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
548
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
549
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
550
- "export": true,
551
- "const": true,
552
- name: "isTest",
553
- doc: "Detect if the application is running in `\"test\"` mode",
554
- initializer: __alloy_js_core.code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
555
- }),
556
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
557
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
558
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
559
- "export": true,
560
- "const": true,
561
- name: "isDevelopment",
562
- doc: "Detect if the application is running in `\"development\"` mode",
563
- initializer: __alloy_js_core.code`["dev", "development"].includes(mode.toLowerCase()); `
564
- }),
565
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
566
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
567
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
568
- "export": true,
569
- "const": true,
570
- name: "isDebug",
571
- doc: "Detect if the application is currently being debugged",
572
- initializer: __alloy_js_core.code`Boolean(isDevelopment && env.DEBUG); `
573
- }),
574
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
575
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
576
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
577
- get when() {
578
- return Boolean(children);
579
- },
580
- children
581
- })
582
- ];
583
- }
584
- }));
585
- }
586
-
587
- //#endregion
588
- exports.EnvBuiltin = EnvBuiltin;
589
- exports.EnvTypeDefinition = EnvTypeDefinition;
@@ -1,11 +0,0 @@
1
- import { BuiltinFileProps } from "../../../plugin-alloy/src/typescript/components/builtin-file.cjs";
2
- import "../../../plugin-alloy/src/typescript/components/typescript-interface.cjs";
3
- import { Children } from "@alloy-js/core";
4
-
5
- //#region ../plugin-env/src/components/env.d.ts
6
-
7
- interface EnvBuiltinProps extends Omit<BuiltinFileProps, "id"> {
8
- defaultConfig?: Children;
9
- }
10
- //#endregion
11
- export { EnvBuiltinProps };
@@ -1,11 +0,0 @@
1
- import { BuiltinFileProps } from "../../../plugin-alloy/src/typescript/components/builtin-file.mjs";
2
- import "../../../plugin-alloy/src/typescript/components/typescript-interface.mjs";
3
- import { Children } from "@alloy-js/core";
4
-
5
- //#region ../plugin-env/src/components/env.d.ts
6
-
7
- interface EnvBuiltinProps extends Omit<BuiltinFileProps, "id"> {
8
- defaultConfig?: Children;
9
- }
10
- //#endregion
11
- export { EnvBuiltinProps };