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