@powerlines/plugin-crypto 0.10.95 → 0.10.97

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 (111) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +37 -1
  2. package/dist/_virtual/rolldown_runtime.mjs +29 -1
  3. package/dist/components/crypto.cjs +24 -10
  4. package/dist/components/crypto.mjs +24 -10
  5. package/dist/components/index.cjs +1 -1
  6. package/dist/components/index.mjs +3 -1
  7. package/dist/deepkit/schemas/reflection.cjs +3998 -1
  8. package/dist/deepkit/schemas/reflection.mjs +3996 -1
  9. package/dist/deepkit/schemas/reflection2.cjs +4112 -1
  10. package/dist/deepkit/schemas/reflection2.mjs +4110 -1
  11. package/dist/deepkit/src/capnp.cjs +913 -1
  12. package/dist/deepkit/src/capnp.mjs +911 -1
  13. package/dist/deepkit/src/esbuild-plugin.cjs +47 -4
  14. package/dist/deepkit/src/esbuild-plugin.mjs +46 -4
  15. package/dist/deepkit/src/reflect-type.cjs +22 -1
  16. package/dist/deepkit/src/reflect-type.mjs +20 -1
  17. package/dist/deepkit/src/resolve-reflections.cjs +16 -1
  18. package/dist/deepkit/src/resolve-reflections.mjs +15 -1
  19. package/dist/deepkit/src/transformer.cjs +52 -1
  20. package/dist/deepkit/src/transformer.mjs +49 -1
  21. package/dist/deepkit/src/transpile.cjs +29 -1
  22. package/dist/deepkit/src/transpile.mjs +27 -1
  23. package/dist/deepkit/src/utilities.cjs +66 -1
  24. package/dist/deepkit/src/utilities.mjs +65 -1
  25. package/dist/deepkit/src/vendor/type-compiler/index.cjs +38 -1
  26. package/dist/deepkit/src/vendor/type-compiler/index.mjs +19 -1
  27. package/dist/deepkit/src/vendor/type.cjs +20 -1
  28. package/dist/deepkit/src/vendor/type.mjs +11 -1
  29. package/dist/index.cjs +46 -1
  30. package/dist/index.mjs +41 -1
  31. package/dist/plugin-alloy/src/core/components/output.cjs +38 -1
  32. package/dist/plugin-alloy/src/core/components/output.mjs +37 -1
  33. package/dist/plugin-alloy/src/core/contexts/context.cjs +11 -1
  34. package/dist/plugin-alloy/src/core/contexts/context.mjs +10 -1
  35. package/dist/plugin-alloy/src/index.cjs +90 -2
  36. package/dist/plugin-alloy/src/index.mjs +88 -2
  37. package/dist/plugin-alloy/src/types/components.d.mts +1 -1
  38. package/dist/plugin-alloy/src/types/plugin.d.cts +3 -3
  39. package/dist/plugin-alloy/src/types/plugin.d.mts +3 -3
  40. package/dist/plugin-automd/src/index.cjs +101 -1
  41. package/dist/plugin-automd/src/index.mjs +98 -1
  42. package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -1
  43. package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -1
  44. package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -1
  45. package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -1
  46. package/dist/plugin-babel/src/helpers/filters.cjs +23 -1
  47. package/dist/plugin-babel/src/helpers/filters.mjs +21 -1
  48. package/dist/plugin-babel/src/helpers/index.cjs +5 -1
  49. package/dist/plugin-babel/src/helpers/index.mjs +7 -1
  50. package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -1
  51. package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -1
  52. package/dist/plugin-babel/src/helpers/options.cjs +50 -1
  53. package/dist/plugin-babel/src/helpers/options.mjs +47 -1
  54. package/dist/plugin-babel/src/index.cjs +91 -1
  55. package/dist/plugin-babel/src/index.mjs +89 -1
  56. package/dist/plugin-env/src/babel/index.cjs +1 -1
  57. package/dist/plugin-env/src/babel/index.mjs +3 -1
  58. package/dist/plugin-env/src/babel/plugin.cjs +120 -4
  59. package/dist/plugin-env/src/babel/plugin.mjs +118 -4
  60. package/dist/plugin-env/src/components/docs.cjs +9 -1
  61. package/dist/plugin-env/src/components/docs.mjs +11 -1
  62. package/dist/plugin-env/src/components/env.cjs +349 -11
  63. package/dist/plugin-env/src/components/env.mjs +347 -9
  64. package/dist/plugin-env/src/components/index.cjs +2 -1
  65. package/dist/plugin-env/src/components/index.mjs +4 -1
  66. package/dist/plugin-env/src/helpers/automd-generator.cjs +22 -1
  67. package/dist/plugin-env/src/helpers/automd-generator.mjs +21 -1
  68. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +55 -1
  69. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +54 -1
  70. package/dist/plugin-env/src/helpers/index.cjs +6 -1
  71. package/dist/plugin-env/src/helpers/index.mjs +8 -1
  72. package/dist/plugin-env/src/helpers/load.cjs +83 -1
  73. package/dist/plugin-env/src/helpers/load.mjs +80 -1
  74. package/dist/plugin-env/src/helpers/persistence.cjs +200 -1
  75. package/dist/plugin-env/src/helpers/persistence.mjs +189 -1
  76. package/dist/plugin-env/src/helpers/reflect.cjs +125 -1
  77. package/dist/plugin-env/src/helpers/reflect.mjs +117 -1
  78. package/dist/plugin-env/src/helpers/source-file-env.cjs +24 -1
  79. package/dist/plugin-env/src/helpers/source-file-env.mjs +23 -1
  80. package/dist/plugin-env/src/helpers/template-helpers.cjs +2 -1
  81. package/dist/plugin-env/src/helpers/template-helpers.mjs +4 -1
  82. package/dist/plugin-env/src/index.cjs +167 -5
  83. package/dist/plugin-env/src/index.mjs +165 -5
  84. package/dist/powerlines/src/lib/build/esbuild.cjs +102 -14
  85. package/dist/powerlines/src/lib/build/esbuild.mjs +100 -14
  86. package/dist/powerlines/src/lib/entry.cjs +12 -1
  87. package/dist/powerlines/src/lib/entry.mjs +14 -1
  88. package/dist/powerlines/src/lib/logger.cjs +41 -1
  89. package/dist/powerlines/src/lib/logger.mjs +39 -1
  90. package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -1
  91. package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -1
  92. package/dist/powerlines/src/lib/utilities/file-header.cjs +19 -7
  93. package/dist/powerlines/src/lib/utilities/file-header.mjs +18 -7
  94. package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -1
  95. package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -1
  96. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -1
  97. package/dist/powerlines/src/plugin-utils/paths.mjs +3 -1
  98. package/dist/powerlines/src/types/build.d.mts +2 -0
  99. package/dist/powerlines/src/types/config.d.mts +1 -1
  100. package/dist/powerlines/src/types/context.d.cts +43 -2
  101. package/dist/powerlines/src/types/context.d.mts +43 -2
  102. package/dist/powerlines/src/types/fs.d.cts +14 -0
  103. package/dist/powerlines/src/types/fs.d.mts +14 -0
  104. package/dist/powerlines/src/types/resolved.d.mts +1 -0
  105. package/dist/types/index.mjs +1 -1
  106. package/dist/types/plugin.mjs +1 -1
  107. package/package.json +6 -6
  108. package/dist/plugin-alloy/src/vendor/index.cjs +0 -1
  109. package/dist/plugin-alloy/src/vendor/index.d.cts +0 -7
  110. package/dist/plugin-alloy/src/vendor/index.d.mts +0 -7
  111. package/dist/plugin-alloy/src/vendor/index.mjs +0 -1
@@ -1,10 +1,217 @@
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{For as r,Show as i,code as a,computed as o,splitProps as s}from"@alloy-js/core";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import d from"defu";import{titleCase as f}from"@stryke/string-format/title-case";import{isNull as p}from"@stryke/type-checks/is-null";import{ClassDeclaration as m,ClassMethod as h,ElseIfClause as g,FunctionDeclaration as _,IfStatement as v,NewExpression as y,TypeDeclaration as b,VarDeclaration as x}from"@alloy-js/typescript";import{usePowerlines as S}from"@powerlines/alloy/core/contexts/context";import{refkey as C}from"@powerlines/alloy/helpers/refkey";import{BuiltinFile as w}from"@powerlines/alloy/typescript/components/builtin-file";import{TSDoc as T,TSDocExample as E,TSDocLink as D,TSDocParam as O,TSDocRemarks as k,TSDocReturns as A,TSDocThrows as j}from"@powerlines/alloy/typescript/components/tsdoc";import{TypeScriptInterface as M}from"@powerlines/alloy/typescript/components/typescript-interface";import{TypescriptObject as N}from"@powerlines/alloy/typescript/components/typescript-object";function P(e){let[{defaultValue:t,reflection:n}]=s(e,[`defaultValue`,`reflection`]),r=S();return u(c,{children:[l(M,{name:` EnvBase`,extends:[`EnvInterface`],defaultValue:t,reflection:n,export:!0}),l(`hbr`,{}),l(`hbr`,{}),l(b,{name:`Env`,export:!0,children:a` {
2
- [Key in keyof EnvBase as Key ${r?.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 { For, Show, code, computed, splitProps } from "@alloy-js/core";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
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 ../plugin-env/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 /* @__PURE__ */ jsxs(Fragment, { children: [
25
+ /* @__PURE__ */ jsx(TypeScriptInterface, {
26
+ name: " EnvBase",
27
+ extends: ["EnvInterface"],
28
+ defaultValue,
29
+ reflection,
30
+ export: true
31
+ }),
32
+ /* @__PURE__ */ jsx("hbr", {}),
33
+ /* @__PURE__ */ jsx("hbr", {}),
34
+ /* @__PURE__ */ jsx(TypeDeclaration, {
35
+ name: "Env",
36
+ export: true,
37
+ children: code` {
38
+ [Key in keyof EnvBase as Key ${context?.config.env.prefix.map((prefix) => `| \`${prefix.replace(/_$/g, "")}_\${Key}\``).join(" ")}]: EnvBase[Key];
39
+ }
40
+ `
41
+ })
42
+ ] });
43
+ }
44
+ function ConfigPropertyConditional(props) {
45
+ const [{ context, name }] = splitProps(props, ["context", "name"]);
46
+ if (!context) return null;
47
+ 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, "")}"`;
48
+ }
49
+ function ConfigPropertyGet(props) {
50
+ const [{ context, property, index }] = splitProps(props, [
51
+ "context",
52
+ "property",
53
+ "index"
54
+ ]);
55
+ if (!context) return null;
56
+ return /* @__PURE__ */ jsx(Fragment, { children: index === 0 ? /* @__PURE__ */ jsx(IfStatement, {
57
+ condition: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ConfigPropertyConditional, {
58
+ name: property.getNameAsString(),
59
+ context
60
+ }), /* @__PURE__ */ jsxs(Show, {
61
+ when: property.getAlias() && property.getAlias().length > 0,
62
+ children: [code` || `, /* @__PURE__ */ jsx(For, {
63
+ each: property.getAlias(),
64
+ joiner: code` || `,
65
+ children: (alias) => /* @__PURE__ */ jsx(ConfigPropertyConditional, {
66
+ name: alias,
67
+ context
68
+ })
69
+ })]
70
+ })] }),
71
+ children: code`return target["${property.getNameAsString()}"];`
72
+ }) : /* @__PURE__ */ jsx(ElseIfClause, {
73
+ condition: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ConfigPropertyConditional, {
74
+ name: property.getNameAsString(),
75
+ context
76
+ }), /* @__PURE__ */ jsxs(Show, {
77
+ when: property.getAlias() && property.getAlias().length > 0,
78
+ children: [code` || `, /* @__PURE__ */ jsx(For, {
79
+ each: property.getAlias(),
80
+ joiner: code` || `,
81
+ children: (alias) => /* @__PURE__ */ jsx(ConfigPropertyConditional, {
82
+ name: alias,
83
+ context
84
+ })
85
+ })]
86
+ })] }),
87
+ children: code`return target["${property.getNameAsString()}"];`
88
+ }) });
3
89
  }
4
- `})]})}function F(e){let[{context:t,name:n}]=s(e,[`context`,`name`]);return t?a`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 I(e){let[{context:t,property:n,index:o}]=s(e,[`context`,`property`,`index`]);return t?l(c,{children:l(o===0?v:g,{condition:u(c,{children:[l(F,{name:n.getNameAsString(),context:t}),u(i,{when:n.getAlias()&&n.getAlias().length>0,children:[a` || `,l(r,{each:n.getAlias(),joiner:a` || `,children:e=>l(F,{name:e,context:t})})]})]}),children:a`return target["${n.getNameAsString()}"];`})}):null}function L(e){let[{context:t,property:n,index:o}]=s(e,[`context`,`property`,`index`]);return t?l(c,{children:l(o===0?v:g,{condition:u(c,{children:[l(F,{name:n.getNameAsString(),context:t}),u(i,{when:n.getAlias()&&n.getAlias().length>0,children:[a` || `,l(r,{each:n.getAlias(),joiner:a` || `,children:e=>l(F,{name:e,context:t})})]})]}),children:a`
5
- target["${n.getNameAsString()}"] = newValue;
90
+ function ConfigPropertySet(props) {
91
+ const [{ context, property, index }] = splitProps(props, [
92
+ "context",
93
+ "property",
94
+ "index"
95
+ ]);
96
+ if (!context) return null;
97
+ return /* @__PURE__ */ jsx(Fragment, { children: index === 0 ? /* @__PURE__ */ jsx(IfStatement, {
98
+ condition: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ConfigPropertyConditional, {
99
+ name: property.getNameAsString(),
100
+ context
101
+ }), /* @__PURE__ */ jsxs(Show, {
102
+ when: property.getAlias() && property.getAlias().length > 0,
103
+ children: [code` || `, /* @__PURE__ */ jsx(For, {
104
+ each: property.getAlias(),
105
+ joiner: code` || `,
106
+ children: (alias) => /* @__PURE__ */ jsx(ConfigPropertyConditional, {
107
+ name: alias,
108
+ context
109
+ })
110
+ })]
111
+ })] }),
112
+ children: code`
113
+ target["${property.getNameAsString()}"] = newValue;
6
114
  return true;
7
- `})}):null}const R=C(`createEnv`),z=C(`env`),B=C(`EnvSerializer`);function V(g){let[{defaultConfig:v},b]=s(g,[`defaultConfig`]),C=S(),M=o(()=>C&&t(C,process.env)),F=n(C),V=o(()=>new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the ${f(C?.config?.name)} project.`,types:[]},F.data??void 0)),H=o(()=>F.data?.getProperties().filter(e=>!e.isIgnored()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]),U=o(()=>F.data?.getProperties().filter(e=>!e.isIgnored()&&!e.isReadonly()).sort((e,t)=>e.getNameAsString().localeCompare(t.getNameAsString()))??[]);return u(w,{...b,id:`env`,description:`The Powerlines environment configuration module provides an interface to define environment configuration parameters.`,imports:d({"@powerlines/deepkit/vendor/type":[`Type`,`stringify`,`serializer`,`serializeFunction`,`deserializeFunction`,`ReflectionKind`,`TemplateState`,`Serializer`,`TypeProperty`,`TypePropertySignature`],"@powerlines/plugin-env/types/runtime":[{name:`EnvInterface`}]},b.imports??{}),children:[u(i,{when:!p(F.data),children:[l(P,{defaultValue:M.value,reflection:F.data}),l(`hbr`,{}),l(`hbr`,{})]}),l(N,{name:`initialEnv`,type:`Partial<EnvBase>`,defaultValue:M,reflection:V,export:!0,const:!0}),l(`hbr`,{}),l(`hbr`,{}),u(T,{heading:`The environment configuration serializer for the Powerlines application.`,children:[l(D,{children:`https://deepkit.io/docs/serialization/serializers`}),l(D,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),l(k,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}),l(m,{refkey:B,name:`EnvSerializer`,extends:`Serializer`,export:!0,children:l(h,{name:`constructor`,public:!0,children:a`
115
+ `
116
+ }) : /* @__PURE__ */ jsx(ElseIfClause, {
117
+ condition: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ConfigPropertyConditional, {
118
+ name: property.getNameAsString(),
119
+ context
120
+ }), /* @__PURE__ */ jsxs(Show, {
121
+ when: property.getAlias() && property.getAlias().length > 0,
122
+ children: [code` || `, /* @__PURE__ */ jsx(For, {
123
+ each: property.getAlias(),
124
+ joiner: code` || `,
125
+ children: (alias) => /* @__PURE__ */ jsx(ConfigPropertyConditional, {
126
+ name: alias,
127
+ context
128
+ })
129
+ })]
130
+ })] }),
131
+ children: code`
132
+ target["${property.getNameAsString()}"] = newValue;
133
+ return true;
134
+ `
135
+ }) });
136
+ }
137
+ const createEnvRefkey = refkey("createEnv");
138
+ const envRefkey = refkey("env");
139
+ const envSerializerRefkey = refkey("EnvSerializer");
140
+ /**
141
+ * Generates the environment configuration module for the Powerlines project.
142
+ */
143
+ function EnvBuiltin(props) {
144
+ const [{ defaultConfig }, rest] = splitProps(props, ["defaultConfig"]);
145
+ const context = usePowerlines();
146
+ const defaultValue = computed(() => context && loadEnvFromContext(context, process.env));
147
+ const reflection = createReflectionResource(context);
148
+ const envInstance = computed(() => {
149
+ return new type_exports.ReflectionClass({
150
+ kind: type_exports.ReflectionKind.objectLiteral,
151
+ description: `The initial environment configuration state for the ${titleCase(context?.config?.name)} project.`,
152
+ types: []
153
+ }, reflection.data ?? void 0);
154
+ });
155
+ const reflectionGetProperties = computed(() => reflection.data?.getProperties().filter((property) => !property.isIgnored()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
156
+ const reflectionSetProperties = computed(() => reflection.data?.getProperties().filter((property) => !property.isIgnored() && !property.isReadonly()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
157
+ return /* @__PURE__ */ jsxs(BuiltinFile, {
158
+ ...rest,
159
+ id: "env",
160
+ description: "The Powerlines environment configuration module provides an interface to define environment configuration parameters.",
161
+ imports: defu({
162
+ "@powerlines/deepkit/vendor/type": [
163
+ "Type",
164
+ "stringify",
165
+ "serializer",
166
+ "serializeFunction",
167
+ "deserializeFunction",
168
+ "ReflectionKind",
169
+ "TemplateState",
170
+ "Serializer",
171
+ "TypeProperty",
172
+ "TypePropertySignature"
173
+ ],
174
+ "@powerlines/plugin-env/types/runtime": [{ name: "EnvInterface" }]
175
+ }, rest.imports ?? {}),
176
+ children: [
177
+ /* @__PURE__ */ jsxs(Show, {
178
+ when: !isNull(reflection.data),
179
+ children: [
180
+ /* @__PURE__ */ jsx(EnvTypeDefinition, {
181
+ defaultValue: defaultValue.value,
182
+ reflection: reflection.data
183
+ }),
184
+ /* @__PURE__ */ jsx("hbr", {}),
185
+ /* @__PURE__ */ jsx("hbr", {})
186
+ ]
187
+ }),
188
+ /* @__PURE__ */ jsx(TypescriptObject, {
189
+ name: "initialEnv",
190
+ type: "Partial<EnvBase>",
191
+ defaultValue,
192
+ reflection: envInstance,
193
+ export: true,
194
+ const: true
195
+ }),
196
+ /* @__PURE__ */ jsx("hbr", {}),
197
+ /* @__PURE__ */ jsx("hbr", {}),
198
+ /* @__PURE__ */ jsxs(TSDoc, {
199
+ heading: "The environment configuration serializer for the Powerlines application.",
200
+ children: [
201
+ /* @__PURE__ */ jsx(TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
202
+ /* @__PURE__ */ jsx(TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
203
+ /* @__PURE__ */ jsx(TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
204
+ ]
205
+ }),
206
+ /* @__PURE__ */ jsx(ClassDeclaration, {
207
+ refkey: envSerializerRefkey,
208
+ name: "EnvSerializer",
209
+ extends: "Serializer",
210
+ export: true,
211
+ children: /* @__PURE__ */ jsx(ClassMethod, {
212
+ name: "constructor",
213
+ public: true,
214
+ children: code`
8
215
  super("env");
9
216
 
10
217
  this.deserializeRegistry.register(
@@ -15,17 +222,148 @@ import{type_exports as e}from"../../../deepkit/src/vendor/type.mjs";import{loadE
15
222
  );
16
223
  }
17
224
  );
18
- `})}),l(`hbr`,{}),l(`hbr`,{}),u(T,{heading:`A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.`,children:[l(D,{children:`https://deepkit.io/docs/serialization/serializers`}),l(D,{children:`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}),l(k,{children:`This serializer is used to serialize and deserialize the Powerlines environment configuration.`})]}),l(x,{name:`envSerializer`,export:!1,const:!0,initializer:l(y,{args:[],target:`EnvSerializer`})}),l(`hbr`,{}),l(`hbr`,{}),u(T,{heading:`Serialize a environment configuration object to JSON data objects (not a JSON string).`,children:[l(k,{children:`The resulting JSON object can be stringified using JSON.stringify().`}),l(E,{children:`const json = serializeEnv(env);`}),l(j,{children:`ValidationError when serialization or validation fails.`})]}),l(x,{name:`serializeEnv`,export:!0,const:!0,initializer:`serializeFunction<EnvBase>(envSerializer)`}),l(`hbr`,{}),l(`hbr`,{}),u(T,{heading:`Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.`,children:[l(k,{children:`Types that are already correct will be used as-is.`}),l(E,{children:`const env = deserializeEnv(json);`}),l(j,{children:`ValidationError when deserialization fails.`})]}),l(x,{name:`deserializeEnv`,export:!0,const:!0,initializer:`deserializeFunction<EnvBase>(envSerializer)`}),l(`hbr`,{}),l(`hbr`,{}),u(T,{heading:`Initializes the Powerlines environment configuration module.`,children:[l(k,{children:`This function initializes the Powerlines environment configuration object.`}),l(O,{name:`environmentConfig`,children:`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}),l(A,{children:`The initialized Powerlines configuration object.`})]}),l(i,{when:!!C?.entryPath,children:u(_,{refkey:R,async:!1,export:!0,name:`createEnv`,parameters:[{name:`environmentConfig`,type:`Partial<Env>`,optional:!1,default:`{}`}],returnType:`Env`,children:[a`
225
+ `
226
+ })
227
+ }),
228
+ /* @__PURE__ */ jsx("hbr", {}),
229
+ /* @__PURE__ */ jsx("hbr", {}),
230
+ /* @__PURE__ */ jsxs(TSDoc, {
231
+ heading: "A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.",
232
+ children: [
233
+ /* @__PURE__ */ jsx(TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
234
+ /* @__PURE__ */ jsx(TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
235
+ /* @__PURE__ */ jsx(TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
236
+ ]
237
+ }),
238
+ /* @__PURE__ */ jsx(VarDeclaration, {
239
+ name: "envSerializer",
240
+ export: false,
241
+ const: true,
242
+ initializer: /* @__PURE__ */ jsx(NewExpression, {
243
+ args: [],
244
+ target: "EnvSerializer"
245
+ })
246
+ }),
247
+ /* @__PURE__ */ jsx("hbr", {}),
248
+ /* @__PURE__ */ jsx("hbr", {}),
249
+ /* @__PURE__ */ jsxs(TSDoc, {
250
+ heading: "Serialize a environment configuration object to JSON data objects (not a JSON string).",
251
+ children: [
252
+ /* @__PURE__ */ jsx(TSDocRemarks, { children: `The resulting JSON object can be stringified using JSON.stringify().` }),
253
+ /* @__PURE__ */ jsx(TSDocExample, { children: `const json = serializeEnv(env);` }),
254
+ /* @__PURE__ */ jsx(TSDocThrows, { children: `ValidationError when serialization or validation fails.` })
255
+ ]
256
+ }),
257
+ /* @__PURE__ */ jsx(VarDeclaration, {
258
+ name: "serializeEnv",
259
+ export: true,
260
+ const: true,
261
+ initializer: "serializeFunction<EnvBase>(envSerializer)"
262
+ }),
263
+ /* @__PURE__ */ jsx("hbr", {}),
264
+ /* @__PURE__ */ jsx("hbr", {}),
265
+ /* @__PURE__ */ jsxs(TSDoc, {
266
+ heading: "Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.",
267
+ children: [
268
+ /* @__PURE__ */ jsx(TSDocRemarks, { children: `Types that are already correct will be used as-is.` }),
269
+ /* @__PURE__ */ jsx(TSDocExample, { children: `const env = deserializeEnv(json);` }),
270
+ /* @__PURE__ */ jsx(TSDocThrows, { children: `ValidationError when deserialization fails.` })
271
+ ]
272
+ }),
273
+ /* @__PURE__ */ jsx(VarDeclaration, {
274
+ name: "deserializeEnv",
275
+ export: true,
276
+ const: true,
277
+ initializer: "deserializeFunction<EnvBase>(envSerializer)"
278
+ }),
279
+ /* @__PURE__ */ jsx("hbr", {}),
280
+ /* @__PURE__ */ jsx("hbr", {}),
281
+ /* @__PURE__ */ jsxs(TSDoc, {
282
+ heading: "Initializes the Powerlines environment configuration module.",
283
+ children: [
284
+ /* @__PURE__ */ jsx(TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
285
+ /* @__PURE__ */ jsx(TSDocParam, {
286
+ name: "environmentConfig",
287
+ children: `The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`
288
+ }),
289
+ /* @__PURE__ */ jsx(TSDocReturns, { children: `The initialized Powerlines configuration object.` })
290
+ ]
291
+ }),
292
+ /* @__PURE__ */ jsx(Show, {
293
+ when: Boolean(context?.entryPath),
294
+ children: /* @__PURE__ */ jsxs(FunctionDeclaration, {
295
+ refkey: createEnvRefkey,
296
+ async: false,
297
+ export: true,
298
+ name: "createEnv",
299
+ parameters: [{
300
+ name: "environmentConfig",
301
+ type: `Partial<Env>`,
302
+ optional: false,
303
+ default: "{}"
304
+ }],
305
+ returnType: "Env",
306
+ children: [
307
+ code`
19
308
  return new Proxy<Env>(
20
309
  deserializeEnv({
21
310
  ...initialEnv,
22
311
  ...environmentConfig
23
312
  }) as Env,
24
313
  {
25
- get: (target: EnvBase, propertyName: string) => { `,l(`hbr`,{}),l(r,{each:H,children:(e,t)=>l(I,{index:t,context:C,property:e})}),a`
314
+ get: (target: EnvBase, propertyName: string) => { `,
315
+ /* @__PURE__ */ jsx("hbr", {}),
316
+ /* @__PURE__ */ jsx(For, {
317
+ each: reflectionGetProperties,
318
+ children: (property, index) => /* @__PURE__ */ jsx(ConfigPropertyGet, {
319
+ index,
320
+ context,
321
+ property
322
+ })
323
+ }),
324
+ code`
26
325
  return undefined;
27
- }, `,l(`hbr`,{}),l(`hbr`,{}),a` set: (target: EnvBase, propertyName: string, newValue: any) => { `,l(`hbr`,{}),l(r,{each:U,ender:a` else `,children:(e,t)=>l(L,{index:t,context:C,property:e})}),l(`hbr`,{}),a`return false;
326
+ }, `,
327
+ /* @__PURE__ */ jsx("hbr", {}),
328
+ /* @__PURE__ */ jsx("hbr", {}),
329
+ code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,
330
+ /* @__PURE__ */ jsx("hbr", {}),
331
+ /* @__PURE__ */ jsx(For, {
332
+ each: reflectionSetProperties,
333
+ ender: code` else `,
334
+ children: (property, index) => /* @__PURE__ */ jsx(ConfigPropertySet, {
335
+ index,
336
+ context,
337
+ property
338
+ })
339
+ }),
340
+ /* @__PURE__ */ jsx("hbr", {}),
341
+ code`return false;
28
342
  }
29
343
  }
30
344
  );
31
- `]})}),l(`hbr`,{}),l(`hbr`,{}),l(`hbr`,{}),l(x,{refkey:z,name:`env`,type:`Env`,export:!0,const:!0,initializer:u(c,{children:[a`createEnv(`,v||`{}`,a` as Partial<Env>)`]})})]})}export{V as EnvBuiltin,P as EnvTypeDefinition};
345
+ `
346
+ ]
347
+ })
348
+ }),
349
+ /* @__PURE__ */ jsx("hbr", {}),
350
+ /* @__PURE__ */ jsx("hbr", {}),
351
+ /* @__PURE__ */ jsx("hbr", {}),
352
+ /* @__PURE__ */ jsx(VarDeclaration, {
353
+ refkey: envRefkey,
354
+ name: "env",
355
+ type: "Env",
356
+ export: true,
357
+ const: true,
358
+ initializer: /* @__PURE__ */ jsxs(Fragment, { children: [
359
+ code`createEnv(`,
360
+ defaultConfig || "{}",
361
+ code` as Partial<Env>)`
362
+ ] })
363
+ })
364
+ ]
365
+ });
366
+ }
367
+
368
+ //#endregion
369
+ export { EnvBuiltin, EnvTypeDefinition };
@@ -1 +1,2 @@
1
- const e=require(`./env.cjs`);require(`./docs.cjs`);
1
+ const require_env = require('./env.cjs');
2
+ require('./docs.cjs');
@@ -1 +1,4 @@
1
- import{EnvBuiltin as e,EnvTypeDefinition as t}from"./env.mjs";import"./docs.mjs";export{};
1
+ import { EnvBuiltin, EnvTypeDefinition } from "./env.mjs";
2
+ import "./docs.mjs";
3
+
4
+ export { };
@@ -1 +1,22 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join-paths`),n=require(`automd`);const r=e=>(0,n.defineGenerator)({name:`env`,async generate(){let n=(0,t.joinPaths)(e.config.projectRoot,`docs`,`generated`,`env.md`);return e.fs.existsSync(n)?{contents:await e.fs.read(n)||``}:{contents:``}}});exports.env=r;
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
3
+ let automd = require("automd");
4
+
5
+ //#region ../plugin-env/src/helpers/automd-generator.ts
6
+ /**
7
+ * AutoMD generator to generate environment variable documentation
8
+ *
9
+ * @param context - The generator context.
10
+ * @returns The generated documentation content.
11
+ */
12
+ const env = (context) => (0, automd.defineGenerator)({
13
+ name: "env",
14
+ async generate() {
15
+ const envDocFile = (0, __stryke_path_join_paths.joinPaths)(context.config.projectRoot, "docs", "generated", "env.md");
16
+ if (!context.fs.existsSync(envDocFile)) return { contents: "" };
17
+ return { contents: await context.fs.read(envDocFile) || "" };
18
+ }
19
+ });
20
+
21
+ //#endregion
22
+ exports.env = env;
@@ -1 +1,21 @@
1
- import{joinPaths as e}from"@stryke/path/join-paths";import{defineGenerator as t}from"automd";const n=n=>t({name:`env`,async generate(){let t=e(n.config.projectRoot,`docs`,`generated`,`env.md`);return n.fs.existsSync(t)?{contents:await n.fs.read(t)||``}:{contents:``}}});export{n as env};
1
+ import { joinPaths } from "@stryke/path/join-paths";
2
+ import { defineGenerator } from "automd";
3
+
4
+ //#region ../plugin-env/src/helpers/automd-generator.ts
5
+ /**
6
+ * AutoMD generator to generate environment variable documentation
7
+ *
8
+ * @param context - The generator context.
9
+ * @returns The generated documentation content.
10
+ */
11
+ const env = (context) => defineGenerator({
12
+ name: "env",
13
+ async generate() {
14
+ const envDocFile = joinPaths(context.config.projectRoot, "docs", "generated", "env.md");
15
+ if (!context.fs.existsSync(envDocFile)) return { contents: "" };
16
+ return { contents: await context.fs.read(envDocFile) || "" };
17
+ }
18
+ });
19
+
20
+ //#endregion
21
+ export { env };
@@ -1 +1,55 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../../../deepkit/src/vendor/type.cjs`),n=require(`./persistence.cjs`),r=require(`./load.cjs`);let i=require(`@alloy-js/core`),a=require(`@stryke/string-format/title-case`);function o(e){let o=(0,i.computed)(()=>e&&r.loadEnvFromContext(e,process.env));return(0,i.createResource)(async()=>{if(!e)return new t.type_exports.ReflectionClass({kind:t.type_exports.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the Powerlines project.`,types:[]});let r=await n.readEnvTypeReflection(e,`env`);return r.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{r.addProperty({name:t,optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,description:e.getDescription(),visibility:e.getVisibility(),type:e.getType(),default:e.getDefaultValue(),tags:{hidden:e.isHidden(),ignore:e.isIgnored(),internal:e.isInternal(),alias:e.getAlias().filter(e=>e!==t).concat(e.name),title:e.getTitle()||(0,a.titleCase)(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})})}),r.getProperties().forEach(e=>{e.setDefaultValue(o.value?.[e.getNameAsString()]??e.getAlias().reduce((e,t)=>e??o.value?.[t],void 0)??e.getDefaultValue())}),r})}exports.createReflectionResource=o;
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_type = require('../../../deepkit/src/vendor/type.cjs');
3
+ const require_persistence = require('./persistence.cjs');
4
+ const require_load = require('./load.cjs');
5
+ let __alloy_js_core = require("@alloy-js/core");
6
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
7
+
8
+ //#region ../plugin-env/src/helpers/create-reflection-resource.ts
9
+ /**
10
+ * Creates a reflection resource for the environment configuration.
11
+ *
12
+ * @param context - The environment plugin context.
13
+ * @returns A resource that provides the reflection of the environment configuration.
14
+ */
15
+ function createReflectionResource(context) {
16
+ const defaultValue = (0, __alloy_js_core.computed)(() => context && require_load.loadEnvFromContext(context, process.env));
17
+ return (0, __alloy_js_core.createResource)(async () => {
18
+ if (!context) return new require_type.type_exports.ReflectionClass({
19
+ kind: require_type.type_exports.ReflectionKind.objectLiteral,
20
+ description: `The initial environment configuration state for the Powerlines project.`,
21
+ types: []
22
+ });
23
+ const result = await require_persistence.readEnvTypeReflection(context, "env");
24
+ result.getProperties().forEach((prop) => {
25
+ prop.getAlias().filter(Boolean).forEach((alias) => {
26
+ result.addProperty({
27
+ name: alias,
28
+ optional: prop.isOptional() ? true : void 0,
29
+ readonly: prop.isReadonly() ? true : void 0,
30
+ description: prop.getDescription(),
31
+ visibility: prop.getVisibility(),
32
+ type: prop.getType(),
33
+ default: prop.getDefaultValue(),
34
+ tags: {
35
+ hidden: prop.isHidden(),
36
+ ignore: prop.isIgnored(),
37
+ internal: prop.isInternal(),
38
+ alias: prop.getAlias().filter((a) => a !== alias).concat(prop.name),
39
+ title: prop.getTitle() || (0, __stryke_string_format_title_case.titleCase)(prop.name),
40
+ readonly: prop.isReadonly(),
41
+ permission: prop.getPermission(),
42
+ domain: prop.getDomain()
43
+ }
44
+ });
45
+ });
46
+ });
47
+ result.getProperties().forEach((prop) => {
48
+ prop.setDefaultValue(defaultValue.value?.[prop.getNameAsString()] ?? prop.getAlias().reduce((ret, alias) => ret ?? defaultValue.value?.[alias], void 0) ?? prop.getDefaultValue());
49
+ });
50
+ return result;
51
+ });
52
+ }
53
+
54
+ //#endregion
55
+ exports.createReflectionResource = createReflectionResource;
@@ -1 +1,54 @@
1
- import{type_exports as e}from"../../../deepkit/src/vendor/type.mjs";import{readEnvTypeReflection as t}from"./persistence.mjs";import{loadEnvFromContext as n}from"./load.mjs";import{computed as r,createResource as i}from"@alloy-js/core";import{titleCase as a}from"@stryke/string-format/title-case";function o(o){let s=r(()=>o&&n(o,process.env));return i(async()=>{if(!o)return new e.ReflectionClass({kind:e.ReflectionKind.objectLiteral,description:`The initial environment configuration state for the Powerlines project.`,types:[]});let n=await t(o,`env`);return n.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{n.addProperty({name:t,optional:e.isOptional()?!0:void 0,readonly:e.isReadonly()?!0:void 0,description:e.getDescription(),visibility:e.getVisibility(),type:e.getType(),default:e.getDefaultValue(),tags:{hidden:e.isHidden(),ignore:e.isIgnored(),internal:e.isInternal(),alias:e.getAlias().filter(e=>e!==t).concat(e.name),title:e.getTitle()||a(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}})})}),n.getProperties().forEach(e=>{e.setDefaultValue(s.value?.[e.getNameAsString()]??e.getAlias().reduce((e,t)=>e??s.value?.[t],void 0)??e.getDefaultValue())}),n})}export{o as createReflectionResource};
1
+ import { type_exports } from "../../../deepkit/src/vendor/type.mjs";
2
+ import { readEnvTypeReflection } from "./persistence.mjs";
3
+ import { loadEnvFromContext } from "./load.mjs";
4
+ import { computed, createResource } from "@alloy-js/core";
5
+ import { titleCase } from "@stryke/string-format/title-case";
6
+
7
+ //#region ../plugin-env/src/helpers/create-reflection-resource.ts
8
+ /**
9
+ * Creates a reflection resource for the environment configuration.
10
+ *
11
+ * @param context - The environment plugin context.
12
+ * @returns A resource that provides the reflection of the environment configuration.
13
+ */
14
+ function createReflectionResource(context) {
15
+ const defaultValue = computed(() => context && loadEnvFromContext(context, process.env));
16
+ return createResource(async () => {
17
+ if (!context) return new type_exports.ReflectionClass({
18
+ kind: type_exports.ReflectionKind.objectLiteral,
19
+ description: `The initial environment configuration state for the Powerlines project.`,
20
+ types: []
21
+ });
22
+ const result = await readEnvTypeReflection(context, "env");
23
+ result.getProperties().forEach((prop) => {
24
+ prop.getAlias().filter(Boolean).forEach((alias) => {
25
+ result.addProperty({
26
+ name: alias,
27
+ optional: prop.isOptional() ? true : void 0,
28
+ readonly: prop.isReadonly() ? true : void 0,
29
+ description: prop.getDescription(),
30
+ visibility: prop.getVisibility(),
31
+ type: prop.getType(),
32
+ default: prop.getDefaultValue(),
33
+ tags: {
34
+ hidden: prop.isHidden(),
35
+ ignore: prop.isIgnored(),
36
+ internal: prop.isInternal(),
37
+ alias: prop.getAlias().filter((a) => a !== alias).concat(prop.name),
38
+ title: prop.getTitle() || titleCase(prop.name),
39
+ readonly: prop.isReadonly(),
40
+ permission: prop.getPermission(),
41
+ domain: prop.getDomain()
42
+ }
43
+ });
44
+ });
45
+ });
46
+ result.getProperties().forEach((prop) => {
47
+ prop.setDefaultValue(defaultValue.value?.[prop.getNameAsString()] ?? prop.getAlias().reduce((ret, alias) => ret ?? defaultValue.value?.[alias], void 0) ?? prop.getDefaultValue());
48
+ });
49
+ return result;
50
+ });
51
+ }
52
+
53
+ //#endregion
54
+ export { createReflectionResource };
@@ -1 +1,6 @@
1
- const e=require(`./reflect.cjs`),t=require(`./persistence.cjs`),n=require(`./source-file-env.cjs`),r=require(`./load.cjs`),i=require(`./create-reflection-resource.cjs`);require(`./template-helpers.cjs`);
1
+ const require_reflect = require('./reflect.cjs');
2
+ const require_persistence = require('./persistence.cjs');
3
+ const require_source_file_env = require('./source-file-env.cjs');
4
+ const require_load = require('./load.cjs');
5
+ const require_create_reflection_resource = require('./create-reflection-resource.cjs');
6
+ require('./template-helpers.cjs');
@@ -1 +1,8 @@
1
- import{BaseEnv as e,BaseSecrets as t,createEnvReflection as n,createSecretsReflection as r,mergeEnvReflections as i,mergeSecretsReflections as a,reflectEnv as o,reflectSecrets as s}from"./reflect.mjs";import{getEnvDefaultTypeDefinition as c,getEnvReflectionsPath as l,getEnvTypeReflectionsPath as u,getSecretsDefaultTypeDefinition as d,readEnvReflection as f,readEnvTypeReflection as p,readSecretsReflection as m,resolveRuntimeTypeFile as h,writeEnvReflection as g,writeEnvTypeReflection as _}from"./persistence.mjs";import{removeEnvPrefix as v}from"./source-file-env.mjs";import{loadEnv as y,loadEnvFromContext as b}from"./load.mjs";import{createReflectionResource as x}from"./create-reflection-resource.mjs";import"./template-helpers.mjs";export{};
1
+ import { BaseEnv, BaseSecrets, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./reflect.mjs";
2
+ import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvTypeReflection } from "./persistence.mjs";
3
+ import { removeEnvPrefix } from "./source-file-env.mjs";
4
+ import { loadEnv, loadEnvFromContext } from "./load.mjs";
5
+ import { createReflectionResource } from "./create-reflection-resource.mjs";
6
+ import "./template-helpers.mjs";
7
+
8
+ export { };