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