@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.
- package/dist/_virtual/rolldown_runtime.cjs +37 -1
- package/dist/_virtual/rolldown_runtime.mjs +29 -1
- package/dist/components/crypto.cjs +24 -10
- package/dist/components/crypto.mjs +24 -10
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.mjs +3 -1
- package/dist/deepkit/schemas/reflection.cjs +3998 -1
- package/dist/deepkit/schemas/reflection.mjs +3996 -1
- package/dist/deepkit/schemas/reflection2.cjs +4112 -1
- package/dist/deepkit/schemas/reflection2.mjs +4110 -1
- package/dist/deepkit/src/capnp.cjs +913 -1
- package/dist/deepkit/src/capnp.mjs +911 -1
- package/dist/deepkit/src/esbuild-plugin.cjs +47 -4
- package/dist/deepkit/src/esbuild-plugin.mjs +46 -4
- package/dist/deepkit/src/reflect-type.cjs +22 -1
- package/dist/deepkit/src/reflect-type.mjs +20 -1
- package/dist/deepkit/src/resolve-reflections.cjs +16 -1
- package/dist/deepkit/src/resolve-reflections.mjs +15 -1
- package/dist/deepkit/src/transformer.cjs +52 -1
- package/dist/deepkit/src/transformer.mjs +49 -1
- package/dist/deepkit/src/transpile.cjs +29 -1
- package/dist/deepkit/src/transpile.mjs +27 -1
- package/dist/deepkit/src/utilities.cjs +66 -1
- package/dist/deepkit/src/utilities.mjs +65 -1
- package/dist/deepkit/src/vendor/type-compiler/index.cjs +38 -1
- package/dist/deepkit/src/vendor/type-compiler/index.mjs +19 -1
- package/dist/deepkit/src/vendor/type.cjs +20 -1
- package/dist/deepkit/src/vendor/type.mjs +11 -1
- package/dist/index.cjs +46 -1
- package/dist/index.mjs +41 -1
- package/dist/plugin-alloy/src/core/components/output.cjs +38 -1
- package/dist/plugin-alloy/src/core/components/output.mjs +37 -1
- package/dist/plugin-alloy/src/core/contexts/context.cjs +11 -1
- package/dist/plugin-alloy/src/core/contexts/context.mjs +10 -1
- package/dist/plugin-alloy/src/index.cjs +90 -2
- package/dist/plugin-alloy/src/index.mjs +88 -2
- package/dist/plugin-alloy/src/types/components.d.mts +1 -1
- package/dist/plugin-alloy/src/types/plugin.d.cts +3 -3
- package/dist/plugin-alloy/src/types/plugin.d.mts +3 -3
- package/dist/plugin-automd/src/index.cjs +101 -1
- package/dist/plugin-automd/src/index.mjs +98 -1
- package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -1
- package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -1
- package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -1
- package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -1
- package/dist/plugin-babel/src/helpers/filters.cjs +23 -1
- package/dist/plugin-babel/src/helpers/filters.mjs +21 -1
- package/dist/plugin-babel/src/helpers/index.cjs +5 -1
- package/dist/plugin-babel/src/helpers/index.mjs +7 -1
- package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -1
- package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -1
- package/dist/plugin-babel/src/helpers/options.cjs +50 -1
- package/dist/plugin-babel/src/helpers/options.mjs +47 -1
- package/dist/plugin-babel/src/index.cjs +91 -1
- package/dist/plugin-babel/src/index.mjs +89 -1
- package/dist/plugin-env/src/babel/index.cjs +1 -1
- package/dist/plugin-env/src/babel/index.mjs +3 -1
- package/dist/plugin-env/src/babel/plugin.cjs +120 -4
- package/dist/plugin-env/src/babel/plugin.mjs +118 -4
- package/dist/plugin-env/src/components/docs.cjs +9 -1
- package/dist/plugin-env/src/components/docs.mjs +11 -1
- package/dist/plugin-env/src/components/env.cjs +349 -11
- package/dist/plugin-env/src/components/env.mjs +347 -9
- package/dist/plugin-env/src/components/index.cjs +2 -1
- package/dist/plugin-env/src/components/index.mjs +4 -1
- package/dist/plugin-env/src/helpers/automd-generator.cjs +22 -1
- package/dist/plugin-env/src/helpers/automd-generator.mjs +21 -1
- package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +55 -1
- package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +54 -1
- package/dist/plugin-env/src/helpers/index.cjs +6 -1
- package/dist/plugin-env/src/helpers/index.mjs +8 -1
- package/dist/plugin-env/src/helpers/load.cjs +83 -1
- package/dist/plugin-env/src/helpers/load.mjs +80 -1
- package/dist/plugin-env/src/helpers/persistence.cjs +200 -1
- package/dist/plugin-env/src/helpers/persistence.mjs +189 -1
- package/dist/plugin-env/src/helpers/reflect.cjs +125 -1
- package/dist/plugin-env/src/helpers/reflect.mjs +117 -1
- package/dist/plugin-env/src/helpers/source-file-env.cjs +24 -1
- package/dist/plugin-env/src/helpers/source-file-env.mjs +23 -1
- package/dist/plugin-env/src/helpers/template-helpers.cjs +2 -1
- package/dist/plugin-env/src/helpers/template-helpers.mjs +4 -1
- package/dist/plugin-env/src/index.cjs +167 -5
- package/dist/plugin-env/src/index.mjs +165 -5
- package/dist/powerlines/src/lib/build/esbuild.cjs +102 -14
- package/dist/powerlines/src/lib/build/esbuild.mjs +100 -14
- package/dist/powerlines/src/lib/entry.cjs +12 -1
- package/dist/powerlines/src/lib/entry.mjs +14 -1
- package/dist/powerlines/src/lib/logger.cjs +41 -1
- package/dist/powerlines/src/lib/logger.mjs +39 -1
- package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -1
- package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -1
- package/dist/powerlines/src/lib/utilities/file-header.cjs +19 -7
- package/dist/powerlines/src/lib/utilities/file-header.mjs +18 -7
- package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -1
- package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -1
- package/dist/powerlines/src/plugin-utils/paths.cjs +1 -1
- package/dist/powerlines/src/plugin-utils/paths.mjs +3 -1
- package/dist/powerlines/src/types/build.d.mts +2 -0
- package/dist/powerlines/src/types/config.d.mts +1 -1
- package/dist/powerlines/src/types/context.d.cts +43 -2
- package/dist/powerlines/src/types/context.d.mts +43 -2
- package/dist/powerlines/src/types/fs.d.cts +14 -0
- package/dist/powerlines/src/types/fs.d.mts +14 -0
- package/dist/powerlines/src/types/resolved.d.mts +1 -0
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +6 -6
- package/dist/plugin-alloy/src/vendor/index.cjs +0 -1
- package/dist/plugin-alloy/src/vendor/index.d.cts +0 -7
- package/dist/plugin-alloy/src/vendor/index.d.mts +0 -7
- package/dist/plugin-alloy/src/vendor/index.mjs +0 -1
|
@@ -1,13 +1,219 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
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
|
-
|
|
5
|
-
|
|
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
|
-
`
|
|
8
|
-
|
|
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
|
-
`
|
|
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
|
-
`
|
|
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) => { `,
|
|
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
|
-
}, `,
|
|
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
|
-
`
|
|
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;
|