@powerlines/plugin-crypto 0.10.106 → 0.10.108

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 (184) hide show
  1. package/dist/index-BgAdqTbb.d.mts +1 -0
  2. package/dist/index-CEgs-Dz2.d.cts +1 -0
  3. package/dist/index.cjs +12056 -8
  4. package/dist/index.d.cts +12 -4
  5. package/dist/index.d.mts +12 -5
  6. package/dist/index.mjs +12018 -3
  7. package/dist/plugin-C3MaN5jp.mjs +1 -0
  8. package/dist/plugin-DHXHjv16.cjs +0 -0
  9. package/dist/plugin-Dhgjf-aI.d.mts +4441 -0
  10. package/dist/plugin-Dw1wCT6b.d.cts +4438 -0
  11. package/dist/types/index.cjs +2 -0
  12. package/dist/types/index.d.cts +2 -1
  13. package/dist/types/index.d.mts +2 -1
  14. package/dist/types/index.mjs +3 -0
  15. package/dist/types/plugin.cjs +1 -0
  16. package/dist/types/plugin.d.cts +1 -41
  17. package/dist/types/plugin.d.mts +1 -41
  18. package/dist/types/plugin.mjs +2 -0
  19. package/dist/types-CTUnla4x.mjs +1 -0
  20. package/dist/types-DHkg7xmX.cjs +0 -0
  21. package/package.json +5 -5
  22. package/dist/_virtual/rolldown_runtime.cjs +0 -37
  23. package/dist/_virtual/rolldown_runtime.mjs +0 -29
  24. package/dist/components/crypto.cjs +0 -147
  25. package/dist/components/crypto.d.cts +0 -13
  26. package/dist/components/crypto.d.mts +0 -13
  27. package/dist/components/crypto.mjs +0 -147
  28. package/dist/components/index.cjs +0 -1
  29. package/dist/components/index.d.mts +0 -1
  30. package/dist/components/index.mjs +0 -3
  31. package/dist/deepkit/schemas/reflection.cjs +0 -3998
  32. package/dist/deepkit/schemas/reflection.d.cts +0 -1560
  33. package/dist/deepkit/schemas/reflection.d.mts +0 -1560
  34. package/dist/deepkit/schemas/reflection.mjs +0 -3996
  35. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  36. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  37. package/dist/deepkit/src/capnp.cjs +0 -913
  38. package/dist/deepkit/src/capnp.mjs +0 -911
  39. package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
  40. package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
  41. package/dist/deepkit/src/reflect-type.cjs +0 -22
  42. package/dist/deepkit/src/reflect-type.mjs +0 -20
  43. package/dist/deepkit/src/resolve-reflections.cjs +0 -16
  44. package/dist/deepkit/src/resolve-reflections.mjs +0 -15
  45. package/dist/deepkit/src/transformer.cjs +0 -52
  46. package/dist/deepkit/src/transformer.mjs +0 -49
  47. package/dist/deepkit/src/transpile.cjs +0 -29
  48. package/dist/deepkit/src/transpile.mjs +0 -27
  49. package/dist/deepkit/src/types.d.cts +0 -10
  50. package/dist/deepkit/src/types.d.mts +0 -10
  51. package/dist/deepkit/src/utilities.cjs +0 -66
  52. package/dist/deepkit/src/utilities.mjs +0 -65
  53. package/dist/deepkit/src/vendor/type-compiler/index.cjs +0 -38
  54. package/dist/deepkit/src/vendor/type-compiler/index.mjs +0 -19
  55. package/dist/deepkit/src/vendor/type.cjs +0 -20
  56. package/dist/deepkit/src/vendor/type.d.cts +0 -7
  57. package/dist/deepkit/src/vendor/type.d.mts +0 -7
  58. package/dist/deepkit/src/vendor/type.mjs +0 -11
  59. package/dist/plugin-alloy/src/core/components/output.cjs +0 -38
  60. package/dist/plugin-alloy/src/core/components/output.mjs +0 -37
  61. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -20
  62. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -19
  63. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -60
  64. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -58
  65. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -60
  66. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -54
  67. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  68. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  69. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
  70. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
  71. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
  72. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
  73. package/dist/plugin-alloy/src/index.cjs +0 -90
  74. package/dist/plugin-alloy/src/index.mjs +0 -88
  75. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -7
  76. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -9
  77. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -5
  78. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -7
  79. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -17
  80. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
  81. package/dist/plugin-alloy/src/types/components.d.mts +0 -4
  82. package/dist/plugin-alloy/src/types/index.d.mts +0 -2
  83. package/dist/plugin-alloy/src/types/plugin.d.cts +0 -37
  84. package/dist/plugin-alloy/src/types/plugin.d.mts +0 -37
  85. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -47
  86. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -46
  87. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -75
  88. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -73
  89. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -359
  90. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -350
  91. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -143
  92. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -140
  93. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -53
  94. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -52
  95. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -94
  96. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -93
  97. package/dist/plugin-automd/src/index.cjs +0 -101
  98. package/dist/plugin-automd/src/index.mjs +0 -98
  99. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  100. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  101. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  102. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  103. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
  104. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
  105. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
  106. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
  107. package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
  108. package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
  109. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  110. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  111. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
  112. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
  113. package/dist/plugin-babel/src/helpers/options.cjs +0 -50
  114. package/dist/plugin-babel/src/helpers/options.mjs +0 -47
  115. package/dist/plugin-babel/src/index.cjs +0 -91
  116. package/dist/plugin-babel/src/index.mjs +0 -89
  117. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  118. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  119. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  120. package/dist/plugin-env/src/babel/index.cjs +0 -1
  121. package/dist/plugin-env/src/babel/index.mjs +0 -3
  122. package/dist/plugin-env/src/babel/plugin.cjs +0 -121
  123. package/dist/plugin-env/src/babel/plugin.mjs +0 -119
  124. package/dist/plugin-env/src/components/docs.cjs +0 -9
  125. package/dist/plugin-env/src/components/docs.mjs +0 -11
  126. package/dist/plugin-env/src/components/env.cjs +0 -487
  127. package/dist/plugin-env/src/components/env.mjs +0 -484
  128. package/dist/plugin-env/src/components/index.cjs +0 -2
  129. package/dist/plugin-env/src/components/index.mjs +0 -4
  130. package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -22
  131. package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -21
  132. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -55
  133. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -54
  134. package/dist/plugin-env/src/helpers/index.cjs +0 -6
  135. package/dist/plugin-env/src/helpers/index.mjs +0 -8
  136. package/dist/plugin-env/src/helpers/load.cjs +0 -83
  137. package/dist/plugin-env/src/helpers/load.mjs +0 -80
  138. package/dist/plugin-env/src/helpers/persistence.cjs +0 -200
  139. package/dist/plugin-env/src/helpers/persistence.mjs +0 -189
  140. package/dist/plugin-env/src/helpers/reflect.cjs +0 -125
  141. package/dist/plugin-env/src/helpers/reflect.mjs +0 -117
  142. package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -24
  143. package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -23
  144. package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -2
  145. package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -4
  146. package/dist/plugin-env/src/index.cjs +0 -172
  147. package/dist/plugin-env/src/index.mjs +0 -170
  148. package/dist/plugin-env/src/types/plugin.d.cts +0 -151
  149. package/dist/plugin-env/src/types/plugin.d.mts +0 -153
  150. package/dist/plugin-env/src/types/runtime.d.cts +0 -792
  151. package/dist/plugin-env/src/types/runtime.d.mts +0 -792
  152. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
  153. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
  154. package/dist/powerlines/src/lib/entry.cjs +0 -12
  155. package/dist/powerlines/src/lib/entry.mjs +0 -14
  156. package/dist/powerlines/src/lib/logger.cjs +0 -41
  157. package/dist/powerlines/src/lib/logger.mjs +0 -39
  158. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -35
  159. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -34
  160. package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
  161. package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
  162. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -30
  163. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -29
  164. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  165. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
  166. package/dist/powerlines/src/types/babel.d.cts +0 -22
  167. package/dist/powerlines/src/types/babel.d.mts +0 -22
  168. package/dist/powerlines/src/types/build.d.cts +0 -145
  169. package/dist/powerlines/src/types/build.d.mts +0 -147
  170. package/dist/powerlines/src/types/commands.d.cts +0 -8
  171. package/dist/powerlines/src/types/commands.d.mts +0 -9
  172. package/dist/powerlines/src/types/config.d.cts +0 -380
  173. package/dist/powerlines/src/types/config.d.mts +0 -381
  174. package/dist/powerlines/src/types/context.d.cts +0 -414
  175. package/dist/powerlines/src/types/context.d.mts +0 -416
  176. package/dist/powerlines/src/types/fs.d.cts +0 -486
  177. package/dist/powerlines/src/types/fs.d.mts +0 -486
  178. package/dist/powerlines/src/types/hooks.d.mts +0 -2
  179. package/dist/powerlines/src/types/plugin.d.cts +0 -231
  180. package/dist/powerlines/src/types/plugin.d.mts +0 -231
  181. package/dist/powerlines/src/types/resolved.d.cts +0 -82
  182. package/dist/powerlines/src/types/resolved.d.mts +0 -83
  183. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  184. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
@@ -1,484 +0,0 @@
1
- import { type_exports } from "../../../deepkit/src/vendor/type.mjs";
2
- import { usePowerlines } from "../../../plugin-alloy/src/core/contexts/context.mjs";
3
- import { refkey as refkey$1 } from "../../../plugin-alloy/src/helpers/refkey.mjs";
4
- import { TSDoc, TSDocExample, TSDocLink, TSDocParam, TSDocRemarks, TSDocReturns, TSDocThrows } from "../../../plugin-alloy/src/typescript/components/tsdoc.mjs";
5
- import { BuiltinFile } from "../../../plugin-alloy/src/typescript/components/builtin-file.mjs";
6
- import { TypeScriptInterface } from "../../../plugin-alloy/src/typescript/components/typescript-interface.mjs";
7
- import { TypescriptObject } from "../../../plugin-alloy/src/typescript/components/typescript-object.mjs";
8
- import { loadEnvFromContext } from "../helpers/load.mjs";
9
- import { createReflectionResource } from "../helpers/create-reflection-resource.mjs";
10
- import { For, Show, code, computed, splitProps } from "@alloy-js/core";
11
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
- import defu from "defu";
13
- import { titleCase } from "@stryke/string-format/title-case";
14
- import { isNull } from "@stryke/type-checks/is-null";
15
- import { ClassDeclaration, ClassMethod, ElseIfClause, FunctionDeclaration, IfStatement, NewExpression, TypeDeclaration, VarDeclaration } from "@alloy-js/typescript";
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
- }) });
89
- }
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;
114
- return true;
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$1("createEnv");
138
- const envRefkey = refkey$1("env");
139
- const envSerializerRefkey = refkey$1("EnvSerializer");
140
- /**
141
- * Generates the environment configuration module for the Powerlines project.
142
- */
143
- function EnvBuiltin(props) {
144
- const [{ defaultConfig, children }, rest] = splitProps(props, ["defaultConfig", "children"]);
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
- id: "env",
159
- description: "The Powerlines environment configuration module provides an interface to define environment configuration parameters.",
160
- ...rest,
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`
215
- super("env");
216
-
217
- this.deserializeRegistry.register(
218
- ReflectionKind.boolean,
219
- (type: Type, state: TemplateState) => {
220
- state.addSetter(
221
- \`typeof \${state.accessor.toString()} !== "boolean" ? \${state.accessor.toString()} === 1 || \${state.accessor.toString()} === "1" || \${state.accessor.toString()}.toLowerCase() === "t" || \${state.accessor.toString()}.toLowerCase() === "true" || \${state.accessor.toString()}.toLowerCase() === "y" || \${state.accessor.toString()}.toLowerCase() === "yes" : \${state.accessor.toString()}\`
222
- );
223
- }
224
- );
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`
308
- return new Proxy<Env>(
309
- deserializeEnv({
310
- ...initialEnv,
311
- ...environmentConfig
312
- }) as Env,
313
- {
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`
325
- return undefined;
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;
342
- }
343
- }
344
- );
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__ */ jsx(Fragment, { children: code`createEnv(${defaultConfig || "{}"} as Partial<Env>);` })
359
- }),
360
- /* @__PURE__ */ jsx("hbr", {}),
361
- /* @__PURE__ */ jsx("hbr", {}),
362
- /* @__PURE__ */ jsx(VarDeclaration, {
363
- export: true,
364
- const: true,
365
- name: "isCI",
366
- doc: "Detect if the application is running in a CI environment.",
367
- initializer: code`Boolean(
368
- env.CI ||
369
- env.RUN_ID ||
370
- env.AGOLA_GIT_REF ||
371
- env.AC_APPCIRCLE ||
372
- env.APPVEYOR ||
373
- env.CODEBUILD ||
374
- env.TF_BUILD ||
375
- env.bamboo_planKey ||
376
- env.BITBUCKET_COMMIT ||
377
- env.BITRISE_IO ||
378
- env.BUDDY_WORKSPACE_ID ||
379
- env.BUILDKITE ||
380
- env.CIRCLECI ||
381
- env.CIRRUS_CI ||
382
- env.CF_BUILD_ID ||
383
- env.CM_BUILD_ID ||
384
- env.CI_NAME ||
385
- env.DRONE ||
386
- env.DSARI ||
387
- env.EARTHLY_CI ||
388
- env.EAS_BUILD ||
389
- env.GERRIT_PROJECT ||
390
- env.GITEA_ACTIONS ||
391
- env.GITHUB_ACTIONS ||
392
- env.GITLAB_CI ||
393
- env.GOCD ||
394
- env.BUILDER_OUTPUT ||
395
- env.HARNESS_BUILD_ID ||
396
- env.JENKINS_URL ||
397
- env.LAYERCI ||
398
- env.MAGNUM ||
399
- env.NETLIFY ||
400
- env.NEVERCODE ||
401
- env.PROW_JOB_ID ||
402
- env.RELEASE_BUILD_ID ||
403
- env.RENDER ||
404
- env.SAILCI ||
405
- env.HUDSON ||
406
- env.SCREWDRIVER ||
407
- env.SEMAPHORE ||
408
- env.SOURCEHUT ||
409
- env.STRIDER ||
410
- env.TASK_ID ||
411
- env.RUN_ID ||
412
- env.TEAMCITY_VERSION ||
413
- env.TRAVIS ||
414
- env.VELA ||
415
- env.NOW_BUILDER ||
416
- env.APPCENTER_BUILD_ID ||
417
- env.CI_XCODE_PROJECT ||
418
- env.XCS || false
419
- );
420
- `
421
- }),
422
- /* @__PURE__ */ jsx("hbr", {}),
423
- /* @__PURE__ */ jsx("hbr", {}),
424
- /* @__PURE__ */ jsx(TSDoc, {
425
- heading: "Detect the \\`mode\\` of the current runtime environment.",
426
- children: /* @__PURE__ */ jsx(TSDocRemarks, { children: code`The \`mode\` is determined by the \`MODE\` environment variable, or falls back to the \`NEXT_PUBLIC_VERCEL_ENV\`, \`NODE_ENV\`, or defaults to \`production\`. While the value can potentially be any string, Storm Software generally only allows a value in the following list:
427
- - \`production\`
428
- - \`test\`
429
- - \`development\`` })
430
- }),
431
- /* @__PURE__ */ jsx(VarDeclaration, {
432
- export: true,
433
- const: true,
434
- name: "mode",
435
- initializer: code`String(env.MODE) || "production"; `
436
- }),
437
- /* @__PURE__ */ jsx("hbr", {}),
438
- /* @__PURE__ */ jsx("hbr", {}),
439
- /* @__PURE__ */ jsx(VarDeclaration, {
440
- export: true,
441
- const: true,
442
- name: "isProduction",
443
- doc: "Detect if the application is running in \\\"production\\\\\" mode",
444
- initializer: code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
445
- }),
446
- /* @__PURE__ */ jsx("hbr", {}),
447
- /* @__PURE__ */ jsx("hbr", {}),
448
- /* @__PURE__ */ jsx(VarDeclaration, {
449
- export: true,
450
- const: true,
451
- name: "isTest",
452
- doc: "Detect if the application is running in \"test\" mode",
453
- initializer: code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
454
- }),
455
- /* @__PURE__ */ jsx("hbr", {}),
456
- /* @__PURE__ */ jsx("hbr", {}),
457
- /* @__PURE__ */ jsx(VarDeclaration, {
458
- export: true,
459
- const: true,
460
- name: "isDevelopment",
461
- doc: "Detect if the application is running in \"development\" mode",
462
- initializer: code`["dev", "development"].includes(mode.toLowerCase()); `
463
- }),
464
- /* @__PURE__ */ jsx("hbr", {}),
465
- /* @__PURE__ */ jsx("hbr", {}),
466
- /* @__PURE__ */ jsx(VarDeclaration, {
467
- export: true,
468
- const: true,
469
- name: "isDebug",
470
- doc: "Detect if the application is running in \"debug\" mode",
471
- initializer: code`Boolean(isDevelopment && env.DEBUG); `
472
- }),
473
- /* @__PURE__ */ jsx("hbr", {}),
474
- /* @__PURE__ */ jsx("hbr", {}),
475
- /* @__PURE__ */ jsx(Show, {
476
- when: Boolean(children),
477
- children
478
- })
479
- ]
480
- });
481
- }
482
-
483
- //#endregion
484
- export { EnvBuiltin, EnvTypeDefinition };
@@ -1,2 +0,0 @@
1
- const require_env = require('./env.cjs');
2
- require('./docs.cjs');
@@ -1,4 +0,0 @@
1
- import { EnvBuiltin, EnvTypeDefinition } from "./env.mjs";
2
- import "./docs.mjs";
3
-
4
- export { };
@@ -1,22 +0,0 @@
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,21 +0,0 @@
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,55 +0,0 @@
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,54 +0,0 @@
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,6 +0,0 @@
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,8 +0,0 @@
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 { };