@powerlines/plugin-date 0.12.260 → 0.12.261

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/components/date-fns.cjs +3 -2
  2. package/dist/components/date-fns.mjs +1 -1
  3. package/dist/components/dayjs.cjs +3 -2
  4. package/dist/components/dayjs.mjs +1 -1
  5. package/dist/components/luxon.cjs +3 -2
  6. package/dist/components/luxon.mjs +1 -1
  7. package/dist/components/moment.cjs +3 -2
  8. package/dist/components/moment.mjs +1 -1
  9. package/dist/index.cjs +3 -2
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs +2 -2
  13. package/dist/types/plugin.d.cts +1 -1
  14. package/dist/types/plugin.d.mts +1 -1
  15. package/package.json +4 -4
  16. package/dist/deepkit/schemas/reflection.cjs +0 -3998
  17. package/dist/deepkit/schemas/reflection.d.cts +0 -1560
  18. package/dist/deepkit/schemas/reflection.d.mts +0 -1560
  19. package/dist/deepkit/schemas/reflection.mjs +0 -3996
  20. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  21. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  22. package/dist/deepkit/src/capnp.cjs +0 -913
  23. package/dist/deepkit/src/capnp.mjs +0 -911
  24. package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
  25. package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
  26. package/dist/deepkit/src/reflect-type.cjs +0 -22
  27. package/dist/deepkit/src/reflect-type.mjs +0 -20
  28. package/dist/deepkit/src/resolve-reflections.cjs +0 -16
  29. package/dist/deepkit/src/resolve-reflections.mjs +0 -15
  30. package/dist/deepkit/src/transformer.cjs +0 -52
  31. package/dist/deepkit/src/transformer.mjs +0 -49
  32. package/dist/deepkit/src/transpile.cjs +0 -29
  33. package/dist/deepkit/src/transpile.mjs +0 -27
  34. package/dist/deepkit/src/types.d.cts +0 -10
  35. package/dist/deepkit/src/types.d.mts +0 -10
  36. package/dist/deepkit/src/utilities.cjs +0 -67
  37. package/dist/deepkit/src/utilities.mjs +0 -66
  38. package/dist/plugin-alloy/src/core/components/output.cjs +0 -36
  39. package/dist/plugin-alloy/src/core/components/output.mjs +0 -35
  40. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -20
  41. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -19
  42. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -60
  43. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -58
  44. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -38
  45. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -34
  46. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  47. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  48. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
  49. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
  50. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
  51. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
  52. package/dist/plugin-alloy/src/index.cjs +0 -102
  53. package/dist/plugin-alloy/src/index.mjs +0 -100
  54. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -89
  55. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -88
  56. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -33
  57. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -32
  58. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -18
  59. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
  60. package/dist/plugin-alloy/src/types/components.d.mts +0 -3
  61. package/dist/plugin-alloy/src/types/index.d.mts +0 -2
  62. package/dist/plugin-alloy/src/types/plugin.d.cts +0 -36
  63. package/dist/plugin-alloy/src/types/plugin.d.mts +0 -36
  64. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -52
  65. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -51
  66. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -78
  67. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -76
  68. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -364
  69. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -355
  70. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -157
  71. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -154
  72. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -57
  73. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -56
  74. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -94
  75. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -93
  76. package/dist/plugin-automd/src/index.cjs +0 -101
  77. package/dist/plugin-automd/src/index.mjs +0 -98
  78. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  79. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  80. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  81. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  82. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
  83. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
  84. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
  85. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
  86. package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
  87. package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
  88. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  89. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  90. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
  91. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
  92. package/dist/plugin-babel/src/helpers/options.cjs +0 -49
  93. package/dist/plugin-babel/src/helpers/options.mjs +0 -46
  94. package/dist/plugin-babel/src/index.cjs +0 -85
  95. package/dist/plugin-babel/src/index.mjs +0 -83
  96. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  97. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  98. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  99. package/dist/plugin-env/src/babel/index.cjs +0 -1
  100. package/dist/plugin-env/src/babel/index.mjs +0 -3
  101. package/dist/plugin-env/src/babel/plugin.cjs +0 -70
  102. package/dist/plugin-env/src/babel/plugin.mjs +0 -69
  103. package/dist/plugin-env/src/components/docs.cjs +0 -60
  104. package/dist/plugin-env/src/components/docs.mjs +0 -59
  105. package/dist/plugin-env/src/components/env.cjs +0 -497
  106. package/dist/plugin-env/src/components/env.mjs +0 -494
  107. package/dist/plugin-env/src/components/index.cjs +0 -2
  108. package/dist/plugin-env/src/components/index.mjs +0 -4
  109. package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -22
  110. package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -21
  111. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -55
  112. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -54
  113. package/dist/plugin-env/src/helpers/docs-helper.cjs +0 -16
  114. package/dist/plugin-env/src/helpers/docs-helper.mjs +0 -15
  115. package/dist/plugin-env/src/helpers/index.cjs +0 -6
  116. package/dist/plugin-env/src/helpers/index.mjs +0 -8
  117. package/dist/plugin-env/src/helpers/load.cjs +0 -84
  118. package/dist/plugin-env/src/helpers/load.mjs +0 -81
  119. package/dist/plugin-env/src/helpers/persistence.cjs +0 -201
  120. package/dist/plugin-env/src/helpers/persistence.mjs +0 -190
  121. package/dist/plugin-env/src/helpers/reflect.cjs +0 -125
  122. package/dist/plugin-env/src/helpers/reflect.mjs +0 -117
  123. package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -24
  124. package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -23
  125. package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -2
  126. package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -4
  127. package/dist/plugin-env/src/index.cjs +0 -174
  128. package/dist/plugin-env/src/index.mjs +0 -172
  129. package/dist/plugin-env/src/types/plugin.d.cts +0 -148
  130. package/dist/plugin-env/src/types/plugin.d.mts +0 -150
  131. package/dist/plugin-env/src/types/runtime.d.cts +0 -789
  132. package/dist/plugin-env/src/types/runtime.d.mts +0 -789
  133. package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -47
  134. package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -49
  135. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -93
  136. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -91
  137. package/dist/powerlines/src/lib/constants/environments.cjs +0 -6
  138. package/dist/powerlines/src/lib/constants/environments.mjs +0 -5
  139. package/dist/powerlines/src/lib/entry.cjs +0 -11
  140. package/dist/powerlines/src/lib/entry.mjs +0 -13
  141. package/dist/powerlines/src/lib/logger.cjs +0 -41
  142. package/dist/powerlines/src/lib/logger.mjs +0 -39
  143. package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -3
  144. package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -5
  145. package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +0 -66
  146. package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +0 -65
  147. package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -46
  148. package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -45
  149. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -42
  150. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -40
  151. package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
  152. package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
  153. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -50
  154. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -49
  155. package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -5
  156. package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -5
  157. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  158. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
  159. package/dist/powerlines/src/types/api.d.cts +0 -104
  160. package/dist/powerlines/src/types/api.d.mts +0 -104
  161. package/dist/powerlines/src/types/babel.d.cts +0 -22
  162. package/dist/powerlines/src/types/babel.d.mts +0 -22
  163. package/dist/powerlines/src/types/build.cjs +0 -21
  164. package/dist/powerlines/src/types/build.d.cts +0 -185
  165. package/dist/powerlines/src/types/build.d.mts +0 -185
  166. package/dist/powerlines/src/types/build.mjs +0 -21
  167. package/dist/powerlines/src/types/commands.d.cts +0 -8
  168. package/dist/powerlines/src/types/commands.d.mts +0 -9
  169. package/dist/powerlines/src/types/config.d.cts +0 -435
  170. package/dist/powerlines/src/types/config.d.mts +0 -436
  171. package/dist/powerlines/src/types/context.d.cts +0 -514
  172. package/dist/powerlines/src/types/context.d.mts +0 -514
  173. package/dist/powerlines/src/types/fs.d.cts +0 -486
  174. package/dist/powerlines/src/types/fs.d.mts +0 -486
  175. package/dist/powerlines/src/types/hooks.d.cts +0 -32
  176. package/dist/powerlines/src/types/hooks.d.mts +0 -32
  177. package/dist/powerlines/src/types/plugin.d.cts +0 -205
  178. package/dist/powerlines/src/types/plugin.d.mts +0 -205
  179. package/dist/powerlines/src/types/resolved.d.cts +0 -94
  180. package/dist/powerlines/src/types/resolved.d.mts +0 -94
  181. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  182. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
  183. package/dist/powerlines/src/types/unplugin.d.cts +0 -22
  184. package/dist/powerlines/src/types/unplugin.d.mts +0 -23
@@ -1,494 +0,0 @@
1
- import { usePowerlinesSafe } from "../../../plugin-alloy/src/core/contexts/context.mjs";
2
- import { loadEnvFromContext } from "../helpers/load.mjs";
3
- import { createReflectionResource } from "../helpers/create-reflection-resource.mjs";
4
- import { refkey as refkey$1 } from "../../../plugin-alloy/src/helpers/refkey.mjs";
5
- import { TSDoc, TSDocExample, TSDocLink, TSDocParam, TSDocRemarks, TSDocReturns, TSDocThrows } from "../../../plugin-alloy/src/typescript/components/tsdoc.mjs";
6
- import { BuiltinFile } from "../../../plugin-alloy/src/typescript/components/builtin-file.mjs";
7
- import { TypeScriptInterface } from "../../../plugin-alloy/src/typescript/components/typescript-interface.mjs";
8
- import { TypescriptObject } from "../../../plugin-alloy/src/typescript/components/typescript-object.mjs";
9
- import { ReflectionClass, ReflectionKind } from "@powerlines/deepkit/vendor/type";
10
- import { For, Show, code, computed, splitProps } from "@alloy-js/core";
11
- import defu from "defu";
12
- import { titleCase } from "@stryke/string-format/title-case";
13
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
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 = usePowerlinesSafe();
24
- if (!context) return null;
25
- return /* @__PURE__ */ jsxs(Fragment, { children: [
26
- /* @__PURE__ */ jsx(TypeScriptInterface, {
27
- name: " EnvBase",
28
- defaultValue,
29
- reflection,
30
- export: true
31
- }),
32
- /* @__PURE__ */ jsx("hbr", {}),
33
- /* @__PURE__ */ jsx("hbr", {}),
34
- /* @__PURE__ */ jsx(TSDoc, {
35
- heading: "The environment configuration object with prefixed keys.",
36
- children: /* @__PURE__ */ jsx(TSDocRemarks, { children: `The \`Env\` type extends the \`EnvBase\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.` })
37
- }),
38
- /* @__PURE__ */ jsx(TypeDeclaration, {
39
- name: "Env",
40
- export: true,
41
- children: code` {
42
- [Key in keyof EnvBase as Key ${context.config.env.prefix.map((prefix) => `| \`${prefix.replace(/_$/g, "")}_\${Key}\``).join(" ")}]: EnvBase[Key];
43
- }
44
- `
45
- }),
46
- /* @__PURE__ */ jsx("hbr", {}),
47
- /* @__PURE__ */ jsx("hbr", {})
48
- ] });
49
- }
50
- function ConfigPropertyConditional(props) {
51
- const [{ context, name }] = splitProps(props, ["context", "name"]);
52
- if (!context) return null;
53
- 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, "")}"`;
54
- }
55
- function ConfigPropertyGet(props) {
56
- const [{ context, property, index }] = splitProps(props, [
57
- "context",
58
- "property",
59
- "index"
60
- ]);
61
- if (!context) return null;
62
- return /* @__PURE__ */ jsx(Fragment, { children: index === 0 ? /* @__PURE__ */ jsx(IfStatement, {
63
- condition: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ConfigPropertyConditional, {
64
- name: property.getNameAsString(),
65
- context
66
- }), /* @__PURE__ */ jsxs(Show, {
67
- when: property.getAlias() && property.getAlias().length > 0,
68
- children: [code` || `, /* @__PURE__ */ jsx(For, {
69
- each: property.getAlias(),
70
- joiner: code` || `,
71
- children: (alias) => /* @__PURE__ */ jsx(ConfigPropertyConditional, {
72
- name: alias,
73
- context
74
- })
75
- })]
76
- })] }),
77
- children: code`return target["${property.getNameAsString()}"];`
78
- }) : /* @__PURE__ */ jsx(ElseIfClause, {
79
- condition: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ConfigPropertyConditional, {
80
- name: property.getNameAsString(),
81
- context
82
- }), /* @__PURE__ */ jsxs(Show, {
83
- when: property.getAlias() && property.getAlias().length > 0,
84
- children: [code` || `, /* @__PURE__ */ jsx(For, {
85
- each: property.getAlias(),
86
- joiner: code` || `,
87
- children: (alias) => /* @__PURE__ */ jsx(ConfigPropertyConditional, {
88
- name: alias,
89
- context
90
- })
91
- })]
92
- })] }),
93
- children: code`return target["${property.getNameAsString()}"];`
94
- }) });
95
- }
96
- function ConfigPropertySet(props) {
97
- const [{ context, property, index }] = splitProps(props, [
98
- "context",
99
- "property",
100
- "index"
101
- ]);
102
- if (!context) return null;
103
- return /* @__PURE__ */ jsx(Fragment, { children: index === 0 ? /* @__PURE__ */ jsx(IfStatement, {
104
- condition: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ConfigPropertyConditional, {
105
- name: property.getNameAsString(),
106
- context
107
- }), /* @__PURE__ */ jsxs(Show, {
108
- when: property.getAlias() && property.getAlias().length > 0,
109
- children: [code` || `, /* @__PURE__ */ jsx(For, {
110
- each: property.getAlias(),
111
- joiner: code` || `,
112
- children: (alias) => /* @__PURE__ */ jsx(ConfigPropertyConditional, {
113
- name: alias,
114
- context
115
- })
116
- })]
117
- })] }),
118
- children: code`
119
- target["${property.getNameAsString()}"] = newValue;
120
- return true;
121
- `
122
- }) : /* @__PURE__ */ jsx(ElseIfClause, {
123
- condition: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ConfigPropertyConditional, {
124
- name: property.getNameAsString(),
125
- context
126
- }), /* @__PURE__ */ jsxs(Show, {
127
- when: property.getAlias() && property.getAlias().length > 0,
128
- children: [code` || `, /* @__PURE__ */ jsx(For, {
129
- each: property.getAlias(),
130
- joiner: code` || `,
131
- children: (alias) => /* @__PURE__ */ jsx(ConfigPropertyConditional, {
132
- name: alias,
133
- context
134
- })
135
- })]
136
- })] }),
137
- children: code`
138
- target["${property.getNameAsString()}"] = newValue;
139
- return true;
140
- `
141
- }) });
142
- }
143
- const createEnvRefkey = refkey$1("createEnv");
144
- const envRefkey = refkey$1("env");
145
- const envSerializerRefkey = refkey$1("EnvSerializer");
146
- /**
147
- * Generates the environment configuration module for the Powerlines project.
148
- */
149
- function EnvBuiltin(props) {
150
- const [{ defaultConfig, children }, rest] = splitProps(props, ["defaultConfig", "children"]);
151
- const context = usePowerlinesSafe();
152
- const defaultValue = computed(() => context && loadEnvFromContext(context, process.env));
153
- const reflection = createReflectionResource(context);
154
- const envInstance = computed(() => {
155
- return new ReflectionClass({
156
- kind: ReflectionKind.objectLiteral,
157
- description: `The initial environment configuration state for the ${titleCase(context?.config?.name)} project.`,
158
- types: []
159
- }, reflection.data ?? void 0);
160
- });
161
- const reflectionGetProperties = computed(() => reflection.data?.getProperties().filter((property) => !property.isIgnored()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
162
- const reflectionSetProperties = computed(() => reflection.data?.getProperties().filter((property) => !property.isIgnored() && !property.isReadonly()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())) ?? []);
163
- return /* @__PURE__ */ jsxs(BuiltinFile, {
164
- id: "env",
165
- description: "The environment configuration module provides an interface to define environment configuration parameters.",
166
- ...rest,
167
- imports: defu({ "@powerlines/deepkit/vendor/type": [
168
- "stringify",
169
- "serializer",
170
- "serializeFunction",
171
- "deserializeFunction",
172
- "ReflectionKind",
173
- "Serializer",
174
- "TemplateState",
175
- "Type",
176
- "TypeProperty",
177
- "TypePropertySignature"
178
- ] }, rest.imports ?? {}),
179
- children: [
180
- /* @__PURE__ */ jsxs(Show, {
181
- when: !isNull(reflection.data),
182
- children: [
183
- /* @__PURE__ */ jsx(EnvTypeDefinition, {
184
- defaultValue: defaultValue.value,
185
- reflection: reflection.data
186
- }),
187
- /* @__PURE__ */ jsx("hbr", {}),
188
- /* @__PURE__ */ jsx("hbr", {})
189
- ]
190
- }),
191
- /* @__PURE__ */ jsx(TypescriptObject, {
192
- name: "initialEnv",
193
- type: "Partial<EnvBase>",
194
- defaultValue,
195
- reflection: envInstance,
196
- export: true,
197
- const: true,
198
- doc: "The initial environment configuration object values for the runtime."
199
- }),
200
- /* @__PURE__ */ jsx("hbr", {}),
201
- /* @__PURE__ */ jsx("hbr", {}),
202
- /* @__PURE__ */ jsxs(TSDoc, {
203
- heading: "The environment configuration serializer for the Powerlines application.",
204
- children: [
205
- /* @__PURE__ */ jsx(TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
206
- /* @__PURE__ */ jsx(TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
207
- /* @__PURE__ */ jsx(TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
208
- ]
209
- }),
210
- /* @__PURE__ */ jsx(ClassDeclaration, {
211
- refkey: envSerializerRefkey,
212
- name: "EnvSerializer",
213
- extends: "Serializer",
214
- export: true,
215
- children: /* @__PURE__ */ jsx(ClassMethod, {
216
- name: "constructor",
217
- public: true,
218
- doc: "Initializes a new instance of the `EnvSerializer` class.",
219
- children: code`
220
- super("env");
221
-
222
- this.deserializeRegistry.register(
223
- ReflectionKind.boolean,
224
- (type: Type, state: TemplateState) => {
225
- state.addSetter(
226
- \`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()}\`
227
- );
228
- }
229
- );
230
- `
231
- })
232
- }),
233
- /* @__PURE__ */ jsx("hbr", {}),
234
- /* @__PURE__ */ jsx("hbr", {}),
235
- /* @__PURE__ */ jsxs(TSDoc, {
236
- heading: "A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.",
237
- children: [
238
- /* @__PURE__ */ jsx(TSDocLink, { children: `https://deepkit.io/docs/serialization/serializers` }),
239
- /* @__PURE__ */ jsx(TSDocLink, { children: `https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918` }),
240
- /* @__PURE__ */ jsx(TSDocRemarks, { children: `This serializer is used to serialize and deserialize the Powerlines environment configuration.` })
241
- ]
242
- }),
243
- /* @__PURE__ */ jsx(VarDeclaration, {
244
- name: "envSerializer",
245
- export: false,
246
- const: true,
247
- initializer: /* @__PURE__ */ jsx(NewExpression, {
248
- args: [],
249
- target: "EnvSerializer"
250
- })
251
- }),
252
- /* @__PURE__ */ jsx("hbr", {}),
253
- /* @__PURE__ */ jsx("hbr", {}),
254
- /* @__PURE__ */ jsxs(TSDoc, {
255
- heading: "Serialize a environment configuration object to JSON data objects (not a JSON string).",
256
- children: [
257
- /* @__PURE__ */ jsx(TSDocRemarks, { children: `The resulting JSON object can be stringified using \`JSON.stringify()\`.` }),
258
- /* @__PURE__ */ jsx(TSDocExample, { children: `const json = serializeEnv(env);` }),
259
- /* @__PURE__ */ jsx(TSDocThrows, { children: `ValidationError when serialization or validation fails.` })
260
- ]
261
- }),
262
- /* @__PURE__ */ jsx(VarDeclaration, {
263
- name: "serializeEnv",
264
- export: true,
265
- const: true,
266
- initializer: "serializeFunction<EnvBase>(envSerializer)"
267
- }),
268
- /* @__PURE__ */ jsx("hbr", {}),
269
- /* @__PURE__ */ jsx("hbr", {}),
270
- /* @__PURE__ */ jsxs(TSDoc, {
271
- heading: "Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.",
272
- children: [
273
- /* @__PURE__ */ jsx(TSDocRemarks, { children: `Types that are already correct will be used as-is.` }),
274
- /* @__PURE__ */ jsx(TSDocExample, { children: `const env = deserializeEnv(json);` }),
275
- /* @__PURE__ */ jsx(TSDocThrows, { children: `ValidationError when deserialization fails.` })
276
- ]
277
- }),
278
- /* @__PURE__ */ jsx(VarDeclaration, {
279
- name: "deserializeEnv",
280
- export: true,
281
- const: true,
282
- initializer: "deserializeFunction<EnvBase>(envSerializer)"
283
- }),
284
- /* @__PURE__ */ jsx("hbr", {}),
285
- /* @__PURE__ */ jsx("hbr", {}),
286
- /* @__PURE__ */ jsxs(TSDoc, {
287
- heading: "Initializes the Powerlines environment configuration module.",
288
- children: [
289
- /* @__PURE__ */ jsx(TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
290
- /* @__PURE__ */ jsx(TSDocParam, {
291
- name: "environmentConfig",
292
- children: `The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`
293
- }),
294
- /* @__PURE__ */ jsx(TSDocReturns, { children: `The initialized Powerlines configuration object.` })
295
- ]
296
- }),
297
- /* @__PURE__ */ jsx(Show, {
298
- when: Boolean(context?.entryPath),
299
- children: /* @__PURE__ */ jsxs(FunctionDeclaration, {
300
- refkey: createEnvRefkey,
301
- async: false,
302
- export: true,
303
- name: "createEnv",
304
- parameters: [{
305
- name: "environmentConfig",
306
- type: `Partial<Env>`,
307
- optional: false,
308
- default: "{}"
309
- }],
310
- returnType: "Env",
311
- children: [
312
- code`
313
- return new Proxy<Env>(
314
- deserializeEnv({
315
- ...initialEnv,
316
- ...environmentConfig
317
- }) as Env,
318
- {
319
- get: (target: EnvBase, propertyName: string) => { `,
320
- /* @__PURE__ */ jsx("hbr", {}),
321
- /* @__PURE__ */ jsx(For, {
322
- each: reflectionGetProperties,
323
- children: (property, index) => /* @__PURE__ */ jsx(ConfigPropertyGet, {
324
- index,
325
- context,
326
- property
327
- })
328
- }),
329
- code`
330
- return undefined;
331
- }, `,
332
- /* @__PURE__ */ jsx("hbr", {}),
333
- /* @__PURE__ */ jsx("hbr", {}),
334
- code` set: (target: EnvBase, propertyName: string, newValue: any) => { `,
335
- /* @__PURE__ */ jsx("hbr", {}),
336
- /* @__PURE__ */ jsx(For, {
337
- each: reflectionSetProperties,
338
- ender: code` else `,
339
- children: (property, index) => /* @__PURE__ */ jsx(ConfigPropertySet, {
340
- index,
341
- context,
342
- property
343
- })
344
- }),
345
- /* @__PURE__ */ jsx("hbr", {}),
346
- code`return false;
347
- }
348
- }
349
- );
350
- `
351
- ]
352
- })
353
- }),
354
- /* @__PURE__ */ jsx("hbr", {}),
355
- /* @__PURE__ */ jsx("hbr", {}),
356
- /* @__PURE__ */ jsx("hbr", {}),
357
- /* @__PURE__ */ jsx(TSDoc, {
358
- heading: "The environment configuration object.",
359
- children: /* @__PURE__ */ jsx(TSDocRemarks, { children: `This object provides access to the environment configuration parameters in the application runtime.` })
360
- }),
361
- /* @__PURE__ */ jsx(VarDeclaration, {
362
- refkey: envRefkey,
363
- name: "env",
364
- type: "Env",
365
- export: true,
366
- const: true,
367
- initializer: /* @__PURE__ */ jsx(Fragment, { children: code`createEnv(${defaultConfig || "{}"} as Partial<Env>);` })
368
- }),
369
- /* @__PURE__ */ jsx("hbr", {}),
370
- /* @__PURE__ */ jsx("hbr", {}),
371
- /* @__PURE__ */ jsx(VarDeclaration, {
372
- export: true,
373
- const: true,
374
- name: "isCI",
375
- doc: "Detect if the application is running in a continuous integration (CI) environment.",
376
- initializer: code`Boolean(
377
- env.CI ||
378
- env.RUN_ID ||
379
- env.AGOLA_GIT_REF ||
380
- env.AC_APPCIRCLE ||
381
- env.APPVEYOR ||
382
- env.CODEBUILD ||
383
- env.TF_BUILD ||
384
- env.bamboo_planKey ||
385
- env.BITBUCKET_COMMIT ||
386
- env.BITRISE_IO ||
387
- env.BUDDY_WORKSPACE_ID ||
388
- env.BUILDKITE ||
389
- env.CIRCLECI ||
390
- env.CIRRUS_CI ||
391
- env.CF_BUILD_ID ||
392
- env.CM_BUILD_ID ||
393
- env.CI_NAME ||
394
- env.DRONE ||
395
- env.DSARI ||
396
- env.EARTHLY_CI ||
397
- env.EAS_BUILD ||
398
- env.GERRIT_PROJECT ||
399
- env.GITEA_ACTIONS ||
400
- env.GITHUB_ACTIONS ||
401
- env.GITLAB_CI ||
402
- env.GOCD ||
403
- env.BUILDER_OUTPUT ||
404
- env.HARNESS_BUILD_ID ||
405
- env.JENKINS_URL ||
406
- env.LAYERCI ||
407
- env.MAGNUM ||
408
- env.NETLIFY ||
409
- env.NEVERCODE ||
410
- env.PROW_JOB_ID ||
411
- env.RELEASE_BUILD_ID ||
412
- env.RENDER ||
413
- env.SAILCI ||
414
- env.HUDSON ||
415
- env.SCREWDRIVER ||
416
- env.SEMAPHORE ||
417
- env.SOURCEHUT ||
418
- env.STRIDER ||
419
- env.TASK_ID ||
420
- env.RUN_ID ||
421
- env.TEAMCITY_VERSION ||
422
- env.TRAVIS ||
423
- env.VELA ||
424
- env.NOW_BUILDER ||
425
- env.APPCENTER_BUILD_ID ||
426
- env.CI_XCODE_PROJECT ||
427
- env.XCS || false
428
- );
429
- `
430
- }),
431
- /* @__PURE__ */ jsx("hbr", {}),
432
- /* @__PURE__ */ jsx("hbr", {}),
433
- /* @__PURE__ */ jsx(TSDoc, {
434
- heading: "Detect the \\`mode\\` of the current runtime environment.",
435
- 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, it is generally recommended to only allow a value in the following list:
436
- - \`production\`
437
- - \`test\`
438
- - \`development\`
439
- ` })
440
- }),
441
- /* @__PURE__ */ jsx(VarDeclaration, {
442
- export: true,
443
- const: true,
444
- name: "mode",
445
- initializer: code`String(env.MODE) || "production"; `
446
- }),
447
- /* @__PURE__ */ jsx("hbr", {}),
448
- /* @__PURE__ */ jsx("hbr", {}),
449
- /* @__PURE__ */ jsx(VarDeclaration, {
450
- export: true,
451
- const: true,
452
- name: "isProduction",
453
- doc: "Detect if the application is running in `\"production\"` mode",
454
- initializer: code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
455
- }),
456
- /* @__PURE__ */ jsx("hbr", {}),
457
- /* @__PURE__ */ jsx("hbr", {}),
458
- /* @__PURE__ */ jsx(VarDeclaration, {
459
- export: true,
460
- const: true,
461
- name: "isTest",
462
- doc: "Detect if the application is running in `\"test\"` mode",
463
- initializer: code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
464
- }),
465
- /* @__PURE__ */ jsx("hbr", {}),
466
- /* @__PURE__ */ jsx("hbr", {}),
467
- /* @__PURE__ */ jsx(VarDeclaration, {
468
- export: true,
469
- const: true,
470
- name: "isDevelopment",
471
- doc: "Detect if the application is running in `\"development\"` mode",
472
- initializer: code`["dev", "development"].includes(mode.toLowerCase()); `
473
- }),
474
- /* @__PURE__ */ jsx("hbr", {}),
475
- /* @__PURE__ */ jsx("hbr", {}),
476
- /* @__PURE__ */ jsx(VarDeclaration, {
477
- export: true,
478
- const: true,
479
- name: "isDebug",
480
- doc: "Detect if the application is currently being debugged",
481
- initializer: code`Boolean(isDevelopment && env.DEBUG); `
482
- }),
483
- /* @__PURE__ */ jsx("hbr", {}),
484
- /* @__PURE__ */ jsx("hbr", {}),
485
- /* @__PURE__ */ jsx(Show, {
486
- when: Boolean(children),
487
- children
488
- })
489
- ]
490
- });
491
- }
492
-
493
- //#endregion
494
- export { EnvBuiltin, EnvTypeDefinition };
@@ -1,2 +0,0 @@
1
- const require_docs = require('./docs.cjs');
2
- const require_env = require('./env.cjs');
@@ -1,4 +0,0 @@
1
- import { EnvDocsFile } from "./docs.mjs";
2
- import { EnvBuiltin, EnvTypeDefinition } from "./env.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_load = require('./load.cjs');
3
- const require_persistence = require('./persistence.cjs');
4
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
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 __powerlines_deepkit_vendor_type.ReflectionClass({
19
- kind: __powerlines_deepkit_vendor_type.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 { loadEnvFromContext } from "./load.mjs";
2
- import { readEnvTypeReflection } from "./persistence.mjs";
3
- import { ReflectionClass, ReflectionKind } from "@powerlines/deepkit/vendor/type";
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 ReflectionClass({
18
- kind: 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,16 +0,0 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
- let __stryke_path_join = require("@stryke/path/join");
3
-
4
- //#region ../plugin-env/src/helpers/docs-helper.ts
5
- /**
6
- * Gets the output path for the generated environment documentation.
7
- *
8
- * @param context - The environment plugin context.
9
- * @returns The output path for the generated environment documentation.
10
- */
11
- function getDocsOutputPath(context) {
12
- return (0, __stryke_path_join.joinPaths)(context.config.projectRoot, "docs", "generated");
13
- }
14
-
15
- //#endregion
16
- exports.getDocsOutputPath = getDocsOutputPath;