@powerlines/plugin-env 0.14.21 → 0.14.23

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 (128) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +37 -1
  2. package/dist/_virtual/rolldown_runtime.mjs +29 -1
  3. package/dist/babel/index.cjs +1 -1
  4. package/dist/babel/index.mjs +3 -1
  5. package/dist/babel/plugin.cjs +120 -4
  6. package/dist/babel/plugin.d.cts +2 -3
  7. package/dist/babel/plugin.d.mts +3 -2
  8. package/dist/babel/plugin.mjs +118 -4
  9. package/dist/components/docs.cjs +71 -1
  10. package/dist/components/docs.mjs +70 -1
  11. package/dist/components/env.cjs +432 -11
  12. package/dist/components/env.mjs +430 -9
  13. package/dist/components/index.cjs +6 -1
  14. package/dist/components/index.mjs +4 -1
  15. package/dist/deepkit/schemas/reflection.cjs +3940 -1
  16. package/dist/deepkit/schemas/reflection.mjs +3938 -1
  17. package/dist/deepkit/schemas/reflection2.cjs +4112 -1
  18. package/dist/deepkit/schemas/reflection2.mjs +4110 -1
  19. package/dist/deepkit/src/capnp.cjs +913 -1
  20. package/dist/deepkit/src/capnp.mjs +911 -1
  21. package/dist/deepkit/src/esbuild-plugin.cjs +47 -4
  22. package/dist/deepkit/src/esbuild-plugin.mjs +46 -4
  23. package/dist/deepkit/src/reflect-type.cjs +22 -1
  24. package/dist/deepkit/src/reflect-type.mjs +20 -1
  25. package/dist/deepkit/src/resolve-reflections.cjs +16 -1
  26. package/dist/deepkit/src/resolve-reflections.mjs +15 -1
  27. package/dist/deepkit/src/transformer.cjs +52 -1
  28. package/dist/deepkit/src/transformer.mjs +49 -1
  29. package/dist/deepkit/src/transpile.cjs +29 -1
  30. package/dist/deepkit/src/transpile.mjs +27 -1
  31. package/dist/deepkit/src/utilities.cjs +66 -1
  32. package/dist/deepkit/src/utilities.mjs +65 -1
  33. package/dist/deepkit/src/vendor/type-compiler/index.cjs +38 -1
  34. package/dist/deepkit/src/vendor/type-compiler/index.mjs +19 -1
  35. package/dist/deepkit/src/vendor/type.cjs +20 -1
  36. package/dist/deepkit/src/vendor/type.mjs +11 -1
  37. package/dist/helpers/automd-generator.cjs +22 -1
  38. package/dist/helpers/automd-generator.mjs +21 -1
  39. package/dist/helpers/create-reflection-resource.cjs +55 -1
  40. package/dist/helpers/create-reflection-resource.mjs +54 -1
  41. package/dist/helpers/index.cjs +6 -1
  42. package/dist/helpers/index.mjs +8 -1
  43. package/dist/helpers/load.cjs +83 -1
  44. package/dist/helpers/load.d.cts +2 -2
  45. package/dist/helpers/load.d.mts +3 -2
  46. package/dist/helpers/load.mjs +80 -1
  47. package/dist/helpers/persistence.cjs +214 -1
  48. package/dist/helpers/persistence.d.cts +1 -1
  49. package/dist/helpers/persistence.d.mts +1 -1
  50. package/dist/helpers/persistence.mjs +202 -1
  51. package/dist/helpers/reflect.cjs +111 -1
  52. package/dist/helpers/reflect.mjs +103 -1
  53. package/dist/helpers/source-file-env.cjs +28 -1
  54. package/dist/helpers/source-file-env.mjs +26 -1
  55. package/dist/helpers/template-helpers.cjs +42 -1
  56. package/dist/helpers/template-helpers.mjs +41 -1
  57. package/dist/index.cjs +203 -5
  58. package/dist/index.d.cts +1 -3
  59. package/dist/index.d.mts +2 -1
  60. package/dist/index.mjs +170 -5
  61. package/dist/plugin-alloy/src/core/components/output.cjs +45 -1
  62. package/dist/plugin-alloy/src/core/components/output.mjs +44 -1
  63. package/dist/plugin-alloy/src/core/contexts/context.cjs +11 -1
  64. package/dist/plugin-alloy/src/core/contexts/context.mjs +10 -1
  65. package/dist/plugin-alloy/src/index.cjs +93 -1
  66. package/dist/plugin-alloy/src/index.mjs +91 -1
  67. package/dist/plugin-alloy/src/types/plugin.d.cts +2 -2
  68. package/dist/plugin-alloy/src/types/plugin.d.mts +2 -2
  69. package/dist/plugin-automd/src/index.cjs +101 -1
  70. package/dist/plugin-automd/src/index.mjs +98 -1
  71. package/dist/plugin-automd/src/types/plugin.d.mts +2 -2
  72. package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -1
  73. package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -1
  74. package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -1
  75. package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -1
  76. package/dist/plugin-babel/src/helpers/filters.cjs +23 -1
  77. package/dist/plugin-babel/src/helpers/filters.mjs +21 -1
  78. package/dist/plugin-babel/src/helpers/index.cjs +5 -1
  79. package/dist/plugin-babel/src/helpers/index.mjs +7 -1
  80. package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -1
  81. package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -1
  82. package/dist/plugin-babel/src/helpers/options.cjs +50 -1
  83. package/dist/plugin-babel/src/helpers/options.mjs +47 -1
  84. package/dist/plugin-babel/src/index.cjs +91 -1
  85. package/dist/plugin-babel/src/index.mjs +89 -1
  86. package/dist/plugin-babel/src/types/plugin.d.cts +2 -2
  87. package/dist/plugin-babel/src/types/plugin.d.mts +2 -2
  88. package/dist/powerlines/schemas/fs.d.mts +1 -0
  89. package/dist/powerlines/src/api.d.mts +7 -0
  90. package/dist/powerlines/src/index.d.mts +12 -0
  91. package/dist/powerlines/src/internal/helpers/hooks.d.mts +5 -0
  92. package/dist/powerlines/src/lib/build/esbuild.cjs +102 -14
  93. package/dist/powerlines/src/lib/build/esbuild.mjs +100 -14
  94. package/dist/powerlines/src/lib/entry.cjs +12 -1
  95. package/dist/powerlines/src/lib/entry.mjs +14 -1
  96. package/dist/powerlines/src/lib/logger.cjs +41 -1
  97. package/dist/powerlines/src/lib/logger.mjs +39 -1
  98. package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -1
  99. package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -1
  100. package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -1
  101. package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -1
  102. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -1
  103. package/dist/powerlines/src/plugin-utils/paths.mjs +3 -1
  104. package/dist/powerlines/src/types/api.d.mts +5 -0
  105. package/dist/powerlines/src/types/babel.d.cts +3 -2
  106. package/dist/powerlines/src/types/babel.d.mts +3 -2
  107. package/dist/powerlines/src/types/commands.d.cts +1 -1
  108. package/dist/powerlines/src/types/commands.d.mts +2 -2
  109. package/dist/powerlines/src/types/config.d.cts +5 -5
  110. package/dist/powerlines/src/types/config.d.mts +6 -6
  111. package/dist/powerlines/src/types/context.d.cts +28 -4
  112. package/dist/powerlines/src/types/context.d.mts +30 -6
  113. package/dist/powerlines/src/types/fs.d.cts +1 -1
  114. package/dist/powerlines/src/types/fs.d.mts +1 -1
  115. package/dist/powerlines/src/types/index.d.mts +12 -0
  116. package/dist/powerlines/src/types/plugin.d.cts +3 -3
  117. package/dist/powerlines/src/types/plugin.d.mts +4 -4
  118. package/dist/powerlines/src/types/resolved.d.cts +1 -1
  119. package/dist/powerlines/src/types/resolved.d.mts +2 -2
  120. package/dist/powerlines/src/types/tsconfig.d.mts +1 -1
  121. package/dist/powerlines/src/types/unplugin.d.mts +7 -0
  122. package/dist/types/index.mjs +1 -1
  123. package/dist/types/plugin.d.cts +1 -1
  124. package/dist/types/plugin.mjs +1 -1
  125. package/dist/types/runtime.mjs +1 -1
  126. package/package.json +16 -16
  127. package/dist/babel/index.d.cts +0 -1
  128. package/dist/helpers/index.d.cts +0 -6
@@ -1,13 +1,282 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/vendor/type.cjs`),n=require(`../helpers/load.cjs`),r=require(`../helpers/create-reflection-resource.cjs`);let i=require(`@alloy-js/core/jsx-runtime`),a=require(`@alloy-js/core`),o=require(`defu`);o=e.__toESM(o);let s=require(`@stryke/string-format/title-case`),c=require(`@stryke/type-checks/is-null`),l=require(`@alloy-js/typescript`),u=require(`@powerlines/alloy/core/contexts/context`),d=require(`@powerlines/alloy/helpers/refkey`),f=require(`@powerlines/alloy/typescript/components/builtin-file`),p=require(`@powerlines/alloy/typescript/components/tsdoc`),m=require(`@powerlines/alloy/typescript/components/typescript-interface`),h=require(`@powerlines/alloy/typescript/components/typescript-object`);function g(e){let[{defaultValue:t,reflection:n}]=(0,a.splitProps)(e,[`defaultValue`,`reflection`]),r=(0,u.usePowerlines)();return[(0,i.createComponent)(m.TypeScriptInterface,{name:` EnvBase`,extends:[`EnvInterface`],defaultValue:t,reflection:n,export:!0}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(l.TypeDeclaration,{name:`Env`,export:!0,get children(){return a.code` {
2
- [Key in keyof EnvBase as Key ${r?.config.env.prefix.map(e=>`| \`${e.replace(/_$/g,``)}_\${Key}\``).join(` `)}]: EnvBase[Key];
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_type = require('../deepkit/src/vendor/type.cjs');
3
+ const require_load = require('../helpers/load.cjs');
4
+ const require_create_reflection_resource = require('../helpers/create-reflection-resource.cjs');
5
+ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
+ let __alloy_js_core = require("@alloy-js/core");
7
+ let defu = require("defu");
8
+ defu = require_rolldown_runtime.__toESM(defu);
9
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
10
+ let __stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
11
+ let __alloy_js_typescript = require("@alloy-js/typescript");
12
+ let __powerlines_alloy_core_contexts_context = require("@powerlines/alloy/core/contexts/context");
13
+ let __powerlines_alloy_helpers_refkey = require("@powerlines/alloy/helpers/refkey");
14
+ let __powerlines_alloy_typescript_components_builtin_file = require("@powerlines/alloy/typescript/components/builtin-file");
15
+ let __powerlines_alloy_typescript_components_tsdoc = require("@powerlines/alloy/typescript/components/tsdoc");
16
+ let __powerlines_alloy_typescript_components_typescript_interface = require("@powerlines/alloy/typescript/components/typescript-interface");
17
+ let __powerlines_alloy_typescript_components_typescript_object = require("@powerlines/alloy/typescript/components/typescript-object");
18
+
19
+ //#region 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 = (0, __powerlines_alloy_core_contexts_context.usePowerlines)();
26
+ return [
27
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_typescript_interface.TypeScriptInterface, {
28
+ name: " EnvBase",
29
+ "extends": ["EnvInterface"],
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)(__alloy_js_typescript.TypeDeclaration, {
37
+ name: "Env",
38
+ "export": true,
39
+ get children() {
40
+ return __alloy_js_core.code` {
41
+ [Key in keyof EnvBase as Key ${context?.config.env.prefix.map((prefix) => `| \`${prefix.replace(/_$/g, "")}_\${Key}\``).join(" ")}]: EnvBase[Key];
42
+ }
43
+ `;
44
+ }
45
+ })
46
+ ];
47
+ }
48
+ function ConfigPropertyConditional(props) {
49
+ const [{ context, name }] = (0, __alloy_js_core.splitProps)(props, ["context", "name"]);
50
+ if (!context) return null;
51
+ 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, "")}"`;
52
+ }
53
+ function ConfigPropertyGet(props) {
54
+ const [{ context, property, index }] = (0, __alloy_js_core.splitProps)(props, [
55
+ "context",
56
+ "property",
57
+ "index"
58
+ ]);
59
+ if (!context) return null;
60
+ return [index === 0 ? (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
61
+ get condition() {
62
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
63
+ get name() {
64
+ return property.getNameAsString();
65
+ },
66
+ context
67
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
68
+ get when() {
69
+ return (0, __alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
70
+ },
71
+ get children() {
72
+ return [__alloy_js_core.code` || `, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
73
+ get each() {
74
+ return property.getAlias();
75
+ },
76
+ joiner: __alloy_js_core.code` || `,
77
+ children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
78
+ name: alias,
79
+ context
80
+ })
81
+ })];
82
+ }
83
+ })];
84
+ },
85
+ get children() {
86
+ return __alloy_js_core.code`return target["${property.getNameAsString()}"];`;
87
+ }
88
+ }) : (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
89
+ get condition() {
90
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
91
+ get name() {
92
+ return property.getNameAsString();
93
+ },
94
+ context
95
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
96
+ get when() {
97
+ return (0, __alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
98
+ },
99
+ get children() {
100
+ return [__alloy_js_core.code` || `, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
101
+ get each() {
102
+ return property.getAlias();
103
+ },
104
+ joiner: __alloy_js_core.code` || `,
105
+ children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
106
+ name: alias,
107
+ context
108
+ })
109
+ })];
110
+ }
111
+ })];
112
+ },
113
+ get children() {
114
+ return __alloy_js_core.code`return target["${property.getNameAsString()}"];`;
115
+ }
116
+ })];
3
117
  }
4
- `}})]}function _(e){let[{context:t,name:n}]=(0,a.splitProps)(e,[`context`,`name`]);return t?a.code`propertyName === "${n}" || propertyName.replace(/^(${t.config.env.prefix.sort((e,t)=>e.startsWith(t)?-1:t.startsWith(e)?1:e.localeCompare(t)).map(e=>`${e.replace(/_$/,``)}_`).join(`|`)})/g, "").toLowerCase().replace(/[\\s\\-_]+/g, "") === "${n.toLowerCase().replace(/[\s\-_]+/g,``)}"`:null}function v(e){let[{context:t,property:n,index:r}]=(0,a.splitProps)(e,[`context`,`property`,`index`]);return t?[r===0?(0,i.createComponent)(l.IfStatement,{get condition(){return[(0,i.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,i.createComponent)(a.Show,{get when(){return(0,i.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[a.code` || `,(0,i.createComponent)(a.For,{get each(){return n.getAlias()},joiner:a.code` || `,children:e=>(0,i.createComponent)(_,{name:e,context:t})})]}})]},get children(){return a.code`return target["${n.getNameAsString()}"];`}}):(0,i.createComponent)(l.ElseIfClause,{get condition(){return[(0,i.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,i.createComponent)(a.Show,{get when(){return(0,i.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[a.code` || `,(0,i.createComponent)(a.For,{get each(){return n.getAlias()},joiner:a.code` || `,children:e=>(0,i.createComponent)(_,{name:e,context:t})})]}})]},get children(){return a.code`return target["${n.getNameAsString()}"];`}})]:null}function y(e){let[{context:t,property:n,index:r}]=(0,a.splitProps)(e,[`context`,`property`,`index`]);return t?[r===0?(0,i.createComponent)(l.IfStatement,{get condition(){return[(0,i.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,i.createComponent)(a.Show,{get when(){return(0,i.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[a.code` || `,(0,i.createComponent)(a.For,{get each(){return n.getAlias()},joiner:a.code` || `,children:e=>(0,i.createComponent)(_,{name:e,context:t})})]}})]},get children(){return a.code`
5
- target["${n.getNameAsString()}"] = newValue;
118
+ function ConfigPropertySet(props) {
119
+ const [{ context, property, index }] = (0, __alloy_js_core.splitProps)(props, [
120
+ "context",
121
+ "property",
122
+ "index"
123
+ ]);
124
+ if (!context) return null;
125
+ return [index === 0 ? (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
126
+ get condition() {
127
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
128
+ get name() {
129
+ return property.getNameAsString();
130
+ },
131
+ context
132
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
133
+ get when() {
134
+ return (0, __alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
135
+ },
136
+ get children() {
137
+ return [__alloy_js_core.code` || `, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
138
+ get each() {
139
+ return property.getAlias();
140
+ },
141
+ joiner: __alloy_js_core.code` || `,
142
+ children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
143
+ name: alias,
144
+ context
145
+ })
146
+ })];
147
+ }
148
+ })];
149
+ },
150
+ get children() {
151
+ return __alloy_js_core.code`
152
+ target["${property.getNameAsString()}"] = newValue;
6
153
  return true;
7
- `}}):(0,i.createComponent)(l.ElseIfClause,{get condition(){return[(0,i.createComponent)(_,{get name(){return n.getNameAsString()},context:t}),(0,i.createComponent)(a.Show,{get when(){return(0,i.memo)(()=>!!n.getAlias())()&&n.getAlias().length>0},get children(){return[a.code` || `,(0,i.createComponent)(a.For,{get each(){return n.getAlias()},joiner:a.code` || `,children:e=>(0,i.createComponent)(_,{name:e,context:t})})]}})]},get children(){return a.code`
8
- target["${n.getNameAsString()}"] = newValue;
154
+ `;
155
+ }
156
+ }) : (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
157
+ get condition() {
158
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
159
+ get name() {
160
+ return property.getNameAsString();
161
+ },
162
+ context
163
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
164
+ get when() {
165
+ return (0, __alloy_js_core_jsx_runtime.memo)(() => !!property.getAlias())() && property.getAlias().length > 0;
166
+ },
167
+ get children() {
168
+ return [__alloy_js_core.code` || `, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
169
+ get each() {
170
+ return property.getAlias();
171
+ },
172
+ joiner: __alloy_js_core.code` || `,
173
+ children: (alias) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyConditional, {
174
+ name: alias,
175
+ context
176
+ })
177
+ })];
178
+ }
179
+ })];
180
+ },
181
+ get children() {
182
+ return __alloy_js_core.code`
183
+ target["${property.getNameAsString()}"] = newValue;
9
184
  return true;
10
- `}})]:null}const b=(0,d.refkey)(`createEnv`),x=(0,d.refkey)(`env`),S=(0,d.refkey)(`EnvSerializer`);function C(e){let[{defaultConfig:d},m]=(0,a.splitProps)(e,[`defaultConfig`]),_=(0,u.usePowerlines)(),C=(0,a.computed)(()=>_&&n.loadEnvFromContext(_,process.env)),w=r.createReflectionResource(_),T=(0,a.computed)(()=>new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${(0,s.titleCase)(_?.config?.name)} project.`,types:[]},w.data??void 0)),E=(0,a.computed)(()=>w.data?.getProperties().filter(e=>!e.isIgnored()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]),D=(0,a.computed)(()=>w.data?.getProperties().filter(e=>!e.isIgnored()&&!e.isReadonly()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]);return(0,i.createComponent)(f.BuiltinFile,(0,i.mergeProps)(m,{id:`env`,description:`The Powerlines environment configuration module provides an interface to define environment configuration parameters.`,get imports(){return(0,o.default)({"@powerlines/deepkit/vendor/type":[`Type`,`stringify`,`serializer`,`serializeFunction`,`deserializeFunction`,`ReflectionKind`,`TemplateState`,`Serializer`,`TypeProperty`,`TypePropertySignature`],"@powerlines/plugin-env/types/runtime":[{name:`EnvInterface`}]},m.imports??{})},get children(){return[(0,i.createComponent)(a.Show,{get when(){return!(0,c.isNull)(w.data)},get children(){return[(0,i.createComponent)(g,{get defaultValue(){return C.value},get reflection(){return w.data}}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{})]}}),(0,i.createComponent)(h.TypescriptObject,{name:`initialEnv`,type:`Partial<EnvBase>`,defaultValue:C,reflection:T,export:!0,const:!0}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(p.TSDoc,{heading:`The environment configuration serializer for the Powerlines application.`,get children(){return[(0,i.createComponent)(p.TSDocLink,{children:`https://deepkit.io/docs/serialization/serializers`}),(0,i.createComponent)(p.TSDocLink,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),(0,i.createComponent)(p.TSDocRemarks,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}}),(0,i.createComponent)(l.ClassDeclaration,{refkey:S,name:`EnvSerializer`,extends:`Serializer`,export:!0,get children(){return(0,i.createComponent)(l.ClassMethod,{name:`constructor`,public:!0,children:a.code`
185
+ `;
186
+ }
187
+ })];
188
+ }
189
+ const createEnvRefkey = (0, __powerlines_alloy_helpers_refkey.refkey)("createEnv");
190
+ const envRefkey = (0, __powerlines_alloy_helpers_refkey.refkey)("env");
191
+ const envSerializerRefkey = (0, __powerlines_alloy_helpers_refkey.refkey)("EnvSerializer");
192
+ /**
193
+ * Generates the environment configuration module for the Powerlines project.
194
+ */
195
+ function EnvBuiltin(props) {
196
+ const [{ defaultConfig }, rest] = (0, __alloy_js_core.splitProps)(props, ["defaultConfig"]);
197
+ const context = (0, __powerlines_alloy_core_contexts_context.usePowerlines)();
198
+ const defaultValue = (0, __alloy_js_core.computed)(() => context && require_load.loadEnvFromContext(context, process.env));
199
+ const reflection = require_create_reflection_resource.createReflectionResource(context);
200
+ const envInstance = (0, __alloy_js_core.computed)(() => {
201
+ return new require_type.type_exports.ReflectionClass({
202
+ kind: require_type.type_exports.ReflectionKind.objectLiteral,
203
+ description: `The initial environment configuration state for the ${(0, __stryke_string_format_title_case.titleCase)(context?.config?.name)} project.`,
204
+ types: []
205
+ }, reflection.data ?? void 0);
206
+ });
207
+ const reflectionGetProperties = (0, __alloy_js_core.computed)(() => reflection.data?.getProperties().filter((property) => !property.isIgnored()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
208
+ const reflectionSetProperties = (0, __alloy_js_core.computed)(() => reflection.data?.getProperties().filter((property) => !property.isIgnored() && !property.isReadonly()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
209
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_builtin_file.BuiltinFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
210
+ id: "env",
211
+ description: "The Powerlines environment configuration module provides an interface to define environment configuration parameters.",
212
+ get imports() {
213
+ return (0, defu.default)({
214
+ "@powerlines/deepkit/vendor/type": [
215
+ "Type",
216
+ "stringify",
217
+ "serializer",
218
+ "serializeFunction",
219
+ "deserializeFunction",
220
+ "ReflectionKind",
221
+ "TemplateState",
222
+ "Serializer",
223
+ "TypeProperty",
224
+ "TypePropertySignature"
225
+ ],
226
+ "@powerlines/plugin-env/types/runtime": [{ name: "EnvInterface" }]
227
+ }, rest.imports ?? {});
228
+ },
229
+ get children() {
230
+ return [
231
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
232
+ get when() {
233
+ return !(0, __stryke_type_checks_is_null.isNull)(reflection.data);
234
+ },
235
+ get children() {
236
+ return [
237
+ (0, __alloy_js_core_jsx_runtime.createComponent)(EnvTypeDefinition, {
238
+ get defaultValue() {
239
+ return defaultValue.value;
240
+ },
241
+ get reflection() {
242
+ return reflection.data;
243
+ }
244
+ }),
245
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
246
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
247
+ ];
248
+ }
249
+ }),
250
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_typescript_object.TypescriptObject, {
251
+ name: "initialEnv",
252
+ type: "Partial<EnvBase>",
253
+ defaultValue,
254
+ reflection: envInstance,
255
+ "export": true,
256
+ "const": true
257
+ }),
258
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
259
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
260
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDoc, {
261
+ heading: "The environment configuration serializer for the Powerlines application.",
262
+ get children() {
263
+ return [
264
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
265
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
266
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
267
+ ];
268
+ }
269
+ }),
270
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ClassDeclaration, {
271
+ refkey: envSerializerRefkey,
272
+ name: "EnvSerializer",
273
+ "extends": "Serializer",
274
+ "export": true,
275
+ get children() {
276
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ClassMethod, {
277
+ name: "constructor",
278
+ "public": true,
279
+ children: __alloy_js_core.code`
11
280
  super("env");
12
281
 
13
282
  this.deserializeRegistry.register(
@@ -18,17 +287,169 @@ const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../deepkit/src/ve
18
287
  );
19
288
  }
20
289
  );
21
- `})}}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(p.TSDoc,{heading:`A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.`,get children(){return[(0,i.createComponent)(p.TSDocLink,{children:`https://deepkit.io/docs/serialization/serializers`}),(0,i.createComponent)(p.TSDocLink,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),(0,i.createComponent)(p.TSDocRemarks,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}}),(0,i.createComponent)(l.VarDeclaration,{name:`envSerializer`,export:!1,const:!0,get initializer(){return(0,i.createComponent)(l.NewExpression,{args:[],target:`EnvSerializer`})}}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(p.TSDoc,{heading:`Serialize a environment configuration object to JSON data objects (not a JSON string).`,get children(){return[(0,i.createComponent)(p.TSDocRemarks,{children:`The resulting JSON object can be stringified using JSON.stringify().`}),(0,i.createComponent)(p.TSDocExample,{children:`const json = serializeEnv(env);`}),(0,i.createComponent)(p.TSDocThrows,{children:`ValidationError when serialization or validation fails.`})]}}),(0,i.createComponent)(l.VarDeclaration,{name:`serializeEnv`,export:!0,const:!0,initializer:`serializeFunction<EnvBase>(envSerializer)`}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(p.TSDoc,{heading:`Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.`,get children(){return[(0,i.createComponent)(p.TSDocRemarks,{children:`Types that are already correct will be used as-is.`}),(0,i.createComponent)(p.TSDocExample,{children:`const env = deserializeEnv(json);`}),(0,i.createComponent)(p.TSDocThrows,{children:`ValidationError when deserialization fails.`})]}}),(0,i.createComponent)(l.VarDeclaration,{name:`deserializeEnv`,export:!0,const:!0,initializer:`deserializeFunction<EnvBase>(envSerializer)`}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(p.TSDoc,{heading:`Initializes the Powerlines environment configuration module.`,get children(){return[(0,i.createComponent)(p.TSDocRemarks,{children:`This function initializes the Powerlines environment configuration object.`}),(0,i.createComponent)(p.TSDocParam,{name:`environmentConfig`,children:`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}),(0,i.createComponent)(p.TSDocReturns,{children:`The initialized Powerlines configuration object.`})]}}),(0,i.createComponent)(a.Show,{get when(){return!!_?.entryPath},get children(){return(0,i.createComponent)(l.FunctionDeclaration,{refkey:b,async:!1,export:!0,name:`createEnv`,parameters:[{name:`environmentConfig`,type:`Partial<Env>`,optional:!1,default:`{}`}],returnType:`Env`,get children(){return[a.code`
290
+ `
291
+ });
292
+ }
293
+ }),
294
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
295
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
296
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDoc, {
297
+ heading: "A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.",
298
+ get children() {
299
+ return [
300
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
301
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
302
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
303
+ ];
304
+ }
305
+ }),
306
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
307
+ name: "envSerializer",
308
+ "export": false,
309
+ "const": true,
310
+ get initializer() {
311
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.NewExpression, {
312
+ args: [],
313
+ target: "EnvSerializer"
314
+ });
315
+ }
316
+ }),
317
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
318
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
319
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDoc, {
320
+ heading: "Serialize a environment configuration object to JSON data objects (not a JSON string).",
321
+ get children() {
322
+ return [
323
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `The resulting JSON object can be stringified using JSON.stringify().` }),
324
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocExample, { children: `const json = serializeEnv(env);` }),
325
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocThrows, { children: `ValidationError when serialization or validation fails.` })
326
+ ];
327
+ }
328
+ }),
329
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
330
+ name: "serializeEnv",
331
+ "export": true,
332
+ "const": true,
333
+ initializer: "serializeFunction<EnvBase>(envSerializer)"
334
+ }),
335
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
336
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
337
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDoc, {
338
+ heading: "Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.",
339
+ get children() {
340
+ return [
341
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `Types that are already correct will be used as-is.` }),
342
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocExample, { children: `const env = deserializeEnv(json);` }),
343
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocThrows, { children: `ValidationError when deserialization fails.` })
344
+ ];
345
+ }
346
+ }),
347
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
348
+ name: "deserializeEnv",
349
+ "export": true,
350
+ "const": true,
351
+ initializer: "deserializeFunction<EnvBase>(envSerializer)"
352
+ }),
353
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
354
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
355
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDoc, {
356
+ heading: "Initializes the Powerlines environment configuration module.",
357
+ get children() {
358
+ return [
359
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
360
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocParam, {
361
+ name: "environmentConfig",
362
+ children: `The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`
363
+ }),
364
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_alloy_typescript_components_tsdoc.TSDocReturns, { children: `The initialized Powerlines configuration object.` })
365
+ ];
366
+ }
367
+ }),
368
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
369
+ get when() {
370
+ return Boolean(context?.entryPath);
371
+ },
372
+ get children() {
373
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
374
+ refkey: createEnvRefkey,
375
+ async: false,
376
+ "export": true,
377
+ name: "createEnv",
378
+ parameters: [{
379
+ name: "environmentConfig",
380
+ type: `Partial<Env>`,
381
+ optional: false,
382
+ default: "{}"
383
+ }],
384
+ returnType: "Env",
385
+ get children() {
386
+ return [
387
+ __alloy_js_core.code`
22
388
  return new Proxy<Env>(
23
389
  deserializeEnv({
24
390
  ...initialEnv,
25
391
  ...environmentConfig
26
392
  }) as Env,
27
393
  {
28
- get: (target: EnvBase, propertyName: string) => { `,(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(a.For,{each:E,children:(e,t)=>(0,i.createComponent)(v,{index:t,context:_,property:e})}),a.code`
394
+ get: (target: EnvBase, propertyName: string) => { `,
395
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
396
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
397
+ each: reflectionGetProperties,
398
+ children: (property, index) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyGet, {
399
+ index,
400
+ context,
401
+ property
402
+ })
403
+ }),
404
+ __alloy_js_core.code`
29
405
  return undefined;
30
- }, `,(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),a.code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(a.For,{each:D,ender:a.code` else `,children:(e,t)=>(0,i.createComponent)(y,{index:t,context:_,property:e})}),(0,i.createIntrinsic)(`hbr`,{}),a.code`return false;
406
+ }, `,
407
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
408
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
409
+ __alloy_js_core.code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,
410
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
411
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
412
+ each: reflectionSetProperties,
413
+ ender: __alloy_js_core.code` else `,
414
+ children: (property, index) => (0, __alloy_js_core_jsx_runtime.createComponent)(ConfigPropertySet, {
415
+ index,
416
+ context,
417
+ property
418
+ })
419
+ }),
420
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
421
+ __alloy_js_core.code`return false;
31
422
  }
32
423
  }
33
424
  );
34
- `]}})}}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createIntrinsic)(`hbr`,{}),(0,i.createComponent)(l.VarDeclaration,{refkey:x,name:`env`,type:`Env`,export:!0,const:!0,get initializer(){return[a.code`createEnv(`,d||`{}`,a.code` as Partial<Env>)`]}})]}}))}exports.EnvBuiltin=C,exports.EnvTypeDefinition=g;
425
+ `
426
+ ];
427
+ }
428
+ });
429
+ }
430
+ }),
431
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
432
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
433
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
434
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
435
+ refkey: envRefkey,
436
+ name: "env",
437
+ type: "Env",
438
+ "export": true,
439
+ "const": true,
440
+ get initializer() {
441
+ return [
442
+ __alloy_js_core.code`createEnv(`,
443
+ defaultConfig || "{}",
444
+ __alloy_js_core.code` as Partial<Env>)`
445
+ ];
446
+ }
447
+ })
448
+ ];
449
+ }
450
+ }));
451
+ }
452
+
453
+ //#endregion
454
+ exports.EnvBuiltin = EnvBuiltin;
455
+ exports.EnvTypeDefinition = EnvTypeDefinition;