@powerlines/plugin-date 0.12.258 → 0.12.260

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 (163) hide show
  1. package/dist/components/date-fns.cjs +2 -3
  2. package/dist/components/date-fns.mjs +1 -1
  3. package/dist/components/dayjs.cjs +2 -3
  4. package/dist/components/dayjs.mjs +1 -1
  5. package/dist/components/luxon.cjs +2 -3
  6. package/dist/components/luxon.mjs +1 -1
  7. package/dist/components/moment.cjs +2 -3
  8. package/dist/components/moment.mjs +1 -1
  9. package/dist/deepkit/schemas/reflection.cjs +3998 -0
  10. package/dist/deepkit/schemas/reflection.mjs +3996 -0
  11. package/dist/deepkit/schemas/reflection2.cjs +4112 -0
  12. package/dist/deepkit/schemas/reflection2.mjs +4110 -0
  13. package/dist/deepkit/src/capnp.cjs +913 -0
  14. package/dist/deepkit/src/capnp.mjs +911 -0
  15. package/dist/deepkit/src/esbuild-plugin.cjs +47 -0
  16. package/dist/deepkit/src/esbuild-plugin.mjs +46 -0
  17. package/dist/deepkit/src/reflect-type.cjs +22 -0
  18. package/dist/deepkit/src/reflect-type.mjs +20 -0
  19. package/dist/deepkit/src/resolve-reflections.cjs +16 -0
  20. package/dist/deepkit/src/resolve-reflections.mjs +15 -0
  21. package/dist/deepkit/src/transformer.cjs +52 -0
  22. package/dist/deepkit/src/transformer.mjs +49 -0
  23. package/dist/deepkit/src/transpile.cjs +29 -0
  24. package/dist/deepkit/src/transpile.mjs +27 -0
  25. package/dist/deepkit/src/utilities.cjs +67 -0
  26. package/dist/deepkit/src/utilities.mjs +66 -0
  27. package/dist/index.cjs +5 -5
  28. package/dist/index.d.mts +1 -1
  29. package/dist/index.mjs +3 -3
  30. package/dist/plugin-alloy/src/core/components/output.cjs +36 -0
  31. package/dist/plugin-alloy/src/core/components/output.mjs +35 -0
  32. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +20 -0
  33. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +19 -0
  34. package/dist/plugin-alloy/src/core/components/source-file.cjs +60 -0
  35. package/dist/plugin-alloy/src/core/components/source-file.mjs +58 -0
  36. package/dist/plugin-alloy/src/core/contexts/context.cjs +38 -0
  37. package/dist/plugin-alloy/src/core/contexts/context.mjs +34 -0
  38. package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
  39. package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
  40. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +46 -0
  41. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +42 -0
  42. package/dist/plugin-alloy/src/helpers/refkey.cjs +16 -0
  43. package/dist/plugin-alloy/src/helpers/refkey.mjs +15 -0
  44. package/dist/plugin-alloy/src/index.cjs +102 -0
  45. package/dist/plugin-alloy/src/index.mjs +100 -0
  46. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +89 -0
  47. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +88 -0
  48. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +33 -0
  49. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +32 -0
  50. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +18 -0
  51. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +17 -0
  52. package/dist/plugin-alloy/src/types/components.d.mts +3 -0
  53. package/dist/plugin-alloy/src/types/index.d.mts +2 -0
  54. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +52 -0
  55. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +51 -0
  56. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +78 -0
  57. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +76 -0
  58. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +364 -0
  59. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +355 -0
  60. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +157 -0
  61. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +154 -0
  62. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +57 -0
  63. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +56 -0
  64. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +94 -0
  65. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +93 -0
  66. package/dist/plugin-automd/src/index.cjs +101 -0
  67. package/dist/plugin-automd/src/index.mjs +98 -0
  68. package/dist/{packages/plugin-automd → plugin-automd}/src/types/plugin.d.mts +3 -1
  69. package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -0
  70. package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -0
  71. package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -0
  72. package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -0
  73. package/dist/plugin-babel/src/helpers/filters.cjs +23 -0
  74. package/dist/plugin-babel/src/helpers/filters.mjs +21 -0
  75. package/dist/plugin-babel/src/helpers/index.cjs +5 -0
  76. package/dist/plugin-babel/src/helpers/index.mjs +7 -0
  77. package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -0
  78. package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -0
  79. package/dist/plugin-babel/src/helpers/options.cjs +49 -0
  80. package/dist/plugin-babel/src/helpers/options.mjs +46 -0
  81. package/dist/plugin-babel/src/index.cjs +85 -0
  82. package/dist/plugin-babel/src/index.mjs +83 -0
  83. package/dist/plugin-babel/src/types/index.d.mts +1 -0
  84. package/dist/plugin-env/src/babel/index.cjs +1 -0
  85. package/dist/plugin-env/src/babel/index.mjs +3 -0
  86. package/dist/plugin-env/src/babel/plugin.cjs +70 -0
  87. package/dist/plugin-env/src/babel/plugin.mjs +69 -0
  88. package/dist/plugin-env/src/components/docs.cjs +60 -0
  89. package/dist/plugin-env/src/components/docs.mjs +59 -0
  90. package/dist/plugin-env/src/components/env.cjs +497 -0
  91. package/dist/plugin-env/src/components/env.mjs +494 -0
  92. package/dist/plugin-env/src/components/index.cjs +2 -0
  93. package/dist/plugin-env/src/components/index.mjs +4 -0
  94. package/dist/plugin-env/src/helpers/automd-generator.cjs +22 -0
  95. package/dist/plugin-env/src/helpers/automd-generator.mjs +21 -0
  96. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +55 -0
  97. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +54 -0
  98. package/dist/plugin-env/src/helpers/docs-helper.cjs +16 -0
  99. package/dist/plugin-env/src/helpers/docs-helper.mjs +15 -0
  100. package/dist/plugin-env/src/helpers/index.cjs +6 -0
  101. package/dist/plugin-env/src/helpers/index.mjs +8 -0
  102. package/dist/plugin-env/src/helpers/load.cjs +84 -0
  103. package/dist/plugin-env/src/helpers/load.mjs +81 -0
  104. package/dist/plugin-env/src/helpers/persistence.cjs +201 -0
  105. package/dist/plugin-env/src/helpers/persistence.mjs +190 -0
  106. package/dist/plugin-env/src/helpers/reflect.cjs +125 -0
  107. package/dist/plugin-env/src/helpers/reflect.mjs +117 -0
  108. package/dist/plugin-env/src/helpers/source-file-env.cjs +24 -0
  109. package/dist/plugin-env/src/helpers/source-file-env.mjs +23 -0
  110. package/dist/plugin-env/src/helpers/template-helpers.cjs +2 -0
  111. package/dist/plugin-env/src/helpers/template-helpers.mjs +4 -0
  112. package/dist/plugin-env/src/index.cjs +174 -0
  113. package/dist/plugin-env/src/index.mjs +172 -0
  114. package/dist/{packages/plugin-env → plugin-env}/src/types/plugin.d.mts +3 -1
  115. package/dist/{packages/powerlines → powerlines}/src/internal/helpers/hooks.d.mts +2 -0
  116. package/dist/powerlines/src/lib/build/esbuild.cjs +93 -0
  117. package/dist/powerlines/src/lib/build/esbuild.mjs +91 -0
  118. package/dist/powerlines/src/lib/constants/environments.cjs +6 -0
  119. package/dist/powerlines/src/lib/constants/environments.mjs +5 -0
  120. package/dist/powerlines/src/lib/entry.cjs +11 -0
  121. package/dist/powerlines/src/lib/entry.mjs +13 -0
  122. package/dist/powerlines/src/lib/logger.cjs +41 -0
  123. package/dist/powerlines/src/lib/logger.mjs +39 -0
  124. package/dist/powerlines/src/lib/unplugin/helpers.cjs +3 -0
  125. package/dist/powerlines/src/lib/unplugin/helpers.mjs +5 -0
  126. package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +66 -0
  127. package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +65 -0
  128. package/dist/powerlines/src/lib/unplugin/plugin.cjs +46 -0
  129. package/dist/powerlines/src/lib/unplugin/plugin.mjs +45 -0
  130. package/dist/powerlines/src/lib/utilities/bundle.cjs +42 -0
  131. package/dist/powerlines/src/lib/utilities/bundle.mjs +40 -0
  132. package/dist/powerlines/src/lib/utilities/file-header.cjs +22 -0
  133. package/dist/powerlines/src/lib/utilities/file-header.mjs +21 -0
  134. package/dist/powerlines/src/lib/utilities/resolve.cjs +50 -0
  135. package/dist/powerlines/src/lib/utilities/resolve.mjs +49 -0
  136. package/dist/powerlines/src/lib/utilities/source-file.cjs +5 -0
  137. package/dist/powerlines/src/lib/utilities/source-file.mjs +5 -0
  138. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
  139. package/dist/powerlines/src/plugin-utils/paths.mjs +3 -0
  140. package/dist/powerlines/src/types/build.cjs +21 -0
  141. package/dist/{packages/powerlines → powerlines}/src/types/build.d.mts +6 -6
  142. package/dist/powerlines/src/types/build.mjs +21 -0
  143. package/dist/{packages/powerlines → powerlines}/src/types/commands.d.mts +1 -0
  144. package/dist/{packages/powerlines → powerlines}/src/types/config.d.mts +3 -2
  145. package/dist/{packages/powerlines → powerlines}/src/types/context.d.mts +2 -2
  146. package/dist/{packages/powerlines → powerlines}/src/types/plugin.d.mts +1 -1
  147. package/dist/{packages/powerlines → powerlines}/src/types/tsconfig.d.mts +1 -1
  148. package/dist/{packages/powerlines → powerlines}/src/types/unplugin.d.mts +2 -1
  149. package/dist/types/plugin.d.mts +1 -1
  150. package/package.json +4 -4
  151. package/dist/node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.cjs +0 -43
  152. package/dist/node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs +0 -42
  153. /package/dist/{packages/deepkit → deepkit}/schemas/reflection.d.mts +0 -0
  154. /package/dist/{packages/deepkit → deepkit}/src/types.d.mts +0 -0
  155. /package/dist/{packages/plugin-alloy → plugin-alloy}/src/types/plugin.d.mts +0 -0
  156. /package/dist/{packages/plugin-automd → plugin-automd}/src/types/toc.d.mts +0 -0
  157. /package/dist/{packages/plugin-babel → plugin-babel}/src/types/plugin.d.mts +0 -0
  158. /package/dist/{packages/plugin-env → plugin-env}/src/types/runtime.d.mts +0 -0
  159. /package/dist/{packages/powerlines → powerlines}/src/types/api.d.mts +0 -0
  160. /package/dist/{packages/powerlines → powerlines}/src/types/babel.d.mts +0 -0
  161. /package/dist/{packages/powerlines → powerlines}/src/types/fs.d.mts +0 -0
  162. /package/dist/{packages/powerlines → powerlines}/src/types/hooks.d.mts +0 -0
  163. /package/dist/{packages/powerlines → powerlines}/src/types/resolved.d.mts +0 -0
@@ -0,0 +1,355 @@
1
+ import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
2
+ import { stringifyDefaultValue } from "../../../../deepkit/src/utilities.mjs";
3
+ import { For, List, Prose, Show, childrenArray, splitProps } from "@alloy-js/core";
4
+ import { isSetString } from "@stryke/type-checks/is-set-string";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { isUndefined } from "@stryke/type-checks/is-undefined";
7
+
8
+ //#region ../plugin-alloy/src/typescript/components/tsdoc.tsx
9
+ /**
10
+ * Generates a TypeScript interface for the given reflection class.
11
+ */
12
+ function TSDoc(props) {
13
+ const [{ children, heading }] = splitProps(props, ["children", "heading"]);
14
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
15
+ "/**",
16
+ /* @__PURE__ */ jsxs("align", {
17
+ string: " * ",
18
+ children: [
19
+ /* @__PURE__ */ jsx("hbr", {}),
20
+ /* @__PURE__ */ jsxs(Show, {
21
+ when: !isUndefined(heading),
22
+ children: [
23
+ heading,
24
+ /* @__PURE__ */ jsx("hbr", {}),
25
+ /* @__PURE__ */ jsx(Show, {
26
+ when: !isUndefined(children) && childrenArray(() => children).length > 0,
27
+ children: /* @__PURE__ */ jsx("hbr", {})
28
+ })
29
+ ]
30
+ }),
31
+ /* @__PURE__ */ jsx(Show, {
32
+ when: !isUndefined(children) && childrenArray(() => children).length > 0,
33
+ children: /* @__PURE__ */ jsx(List, { children: childrenArray(() => children) })
34
+ })
35
+ ]
36
+ }),
37
+ /* @__PURE__ */ jsx("hbr", {}),
38
+ ` */`,
39
+ /* @__PURE__ */ jsx("hbr", {})
40
+ ] });
41
+ }
42
+ /**
43
+ * Create a TSDoc `@<props.tag>` tag.
44
+ */
45
+ function TSDocTag(props) {
46
+ const [{ children, tag }] = splitProps(props, ["children", "tag"]);
47
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
48
+ `@${tag} `,
49
+ /* @__PURE__ */ jsx(Show, {
50
+ when: Boolean(children),
51
+ children: /* @__PURE__ */ jsx("align", {
52
+ width: 2,
53
+ children: /* @__PURE__ */ jsx(Prose, { children })
54
+ })
55
+ }),
56
+ /* @__PURE__ */ jsx("hbr", {})
57
+ ] });
58
+ }
59
+ /**
60
+ * Create a TSDoc `@title` tag.
61
+ */
62
+ function TSDocTitle(props) {
63
+ const [{ children }, rest] = splitProps(props, ["children"]);
64
+ return /* @__PURE__ */ jsx(TSDocTag, {
65
+ ...rest,
66
+ tag: "title",
67
+ children
68
+ });
69
+ }
70
+ /**
71
+ * Create a TSDoc `@domain` tag.
72
+ */
73
+ function TSDocDomain(props) {
74
+ const [{ children }, rest] = splitProps(props, ["children"]);
75
+ return /* @__PURE__ */ jsx(TSDocTag, {
76
+ ...rest,
77
+ tag: "domain",
78
+ children
79
+ });
80
+ }
81
+ /**
82
+ * Create a TSDoc `@alias` tag.
83
+ */
84
+ function TSDocAlias(props) {
85
+ const [{ children }, rest] = splitProps(props, ["children"]);
86
+ return /* @__PURE__ */ jsx(TSDocTag, {
87
+ ...rest,
88
+ tag: "alias",
89
+ children
90
+ });
91
+ }
92
+ /**
93
+ * Create a TSDoc `@permission` tag.
94
+ */
95
+ function TSDocPermission(props) {
96
+ const [{ children }, rest] = splitProps(props, ["children"]);
97
+ return /* @__PURE__ */ jsx(TSDocTag, {
98
+ ...rest,
99
+ tag: "permission",
100
+ children
101
+ });
102
+ }
103
+ /**
104
+ * Create a TSDoc `@defaultValue` tag.
105
+ */
106
+ function TSDocDefaultValue(props) {
107
+ const [{ type, defaultValue }] = splitProps(props, ["type", "defaultValue"]);
108
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
109
+ "@defaultValue ",
110
+ /* @__PURE__ */ jsx(Show, {
111
+ when: !isUndefined(defaultValue),
112
+ children: /* @__PURE__ */ jsx("align", {
113
+ width: 2,
114
+ children: /* @__PURE__ */ jsx(Prose, { children: stringifyDefaultValue(type, defaultValue) })
115
+ })
116
+ }),
117
+ /* @__PURE__ */ jsx("hbr", {})
118
+ ] });
119
+ }
120
+ /**
121
+ * Create a TSDoc `@remarks` tag.
122
+ */
123
+ function TSDocRemarks(props) {
124
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
125
+ "@remarks ",
126
+ /* @__PURE__ */ jsx("hbr", {}),
127
+ /* @__PURE__ */ jsx(List, {
128
+ hardline: true,
129
+ children: childrenArray(() => props.children)
130
+ })
131
+ ] });
132
+ }
133
+ /**
134
+ * Create a TSDoc `@see` tag.
135
+ */
136
+ function TSDocLink(props) {
137
+ return /* @__PURE__ */ jsx(TSDocTag, {
138
+ ...props,
139
+ tag: "see"
140
+ });
141
+ }
142
+ /**
143
+ * Create a TSDoc `@example` tag.
144
+ */
145
+ function TSDocExample(props) {
146
+ const [{ tsx, fenced = true, language, children }] = splitProps(props, [
147
+ "tsx",
148
+ "fenced",
149
+ "language",
150
+ "children"
151
+ ]);
152
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
153
+ "@example ",
154
+ /* @__PURE__ */ jsx("hbr", {}),
155
+ /* @__PURE__ */ jsxs(Show, {
156
+ when: fenced,
157
+ children: [
158
+ "```",
159
+ language || (tsx ? "tsx" : "ts"),
160
+ /* @__PURE__ */ jsx("hbr", {})
161
+ ]
162
+ }),
163
+ children,
164
+ /* @__PURE__ */ jsxs(Show, {
165
+ when: fenced,
166
+ children: [/* @__PURE__ */ jsx("hbr", {}), "```"]
167
+ })
168
+ ] });
169
+ }
170
+ /**
171
+ * Create a TSDoc `@readonly` tag.
172
+ */
173
+ function TSDocReadonly() {
174
+ return /* @__PURE__ */ jsx(TSDocTag, { tag: "readonly" });
175
+ }
176
+ /**
177
+ * Create a TSDoc `@internal` tag.
178
+ */
179
+ function TSDocInternal() {
180
+ return /* @__PURE__ */ jsx(TSDocTag, { tag: "internal" });
181
+ }
182
+ /**
183
+ * Create a TSDoc `@ignore` tag.
184
+ */
185
+ function TSDocIgnore() {
186
+ return /* @__PURE__ */ jsx(TSDocTag, { tag: "ignore" });
187
+ }
188
+ /**
189
+ * Create a TSDoc `@hidden` tag.
190
+ */
191
+ function TSDocHidden() {
192
+ return /* @__PURE__ */ jsx(TSDocTag, { tag: "hidden" });
193
+ }
194
+ /**
195
+ * Generates a TypeScript interface property for the given reflection class.
196
+ */
197
+ function TSDocAttributesTags(props) {
198
+ const [{ type, title, alias, permission, domain, readonly, internal, ignore, hidden, defaultValue }] = splitProps(props, [
199
+ "type",
200
+ "title",
201
+ "alias",
202
+ "permission",
203
+ "domain",
204
+ "readonly",
205
+ "internal",
206
+ "ignore",
207
+ "hidden",
208
+ "defaultValue"
209
+ ]);
210
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
211
+ /* @__PURE__ */ jsx(Show, {
212
+ when: isSetString(title?.trim()),
213
+ children: /* @__PURE__ */ jsx(TSDocTitle, { children: title })
214
+ }),
215
+ /* @__PURE__ */ jsx(Show, {
216
+ when: !isUndefined(alias) && alias.length > 0 && alias.some((a) => isSetString(a?.trim())),
217
+ children: /* @__PURE__ */ jsx(For, {
218
+ each: alias?.filter((a) => isSetString(a?.trim())) ?? [],
219
+ children: (alias$1) => /* @__PURE__ */ jsx(TSDocAlias, { children: alias$1 })
220
+ })
221
+ }),
222
+ /* @__PURE__ */ jsx(Show, {
223
+ when: isSetString(domain?.trim()),
224
+ children: /* @__PURE__ */ jsx(TSDocDomain, { children: domain })
225
+ }),
226
+ /* @__PURE__ */ jsx(Show, {
227
+ when: !isUndefined(permission) && permission.length > 0 && permission.some((p) => isSetString(p?.trim())),
228
+ children: /* @__PURE__ */ jsx(For, {
229
+ each: permission?.filter((p) => isSetString(p?.trim())) ?? [],
230
+ children: (permission$1) => /* @__PURE__ */ jsx(TSDocPermission, { children: permission$1 })
231
+ })
232
+ }),
233
+ /* @__PURE__ */ jsx(Show, {
234
+ when: readonly === true,
235
+ children: /* @__PURE__ */ jsx(TSDocReadonly, {})
236
+ }),
237
+ /* @__PURE__ */ jsx(Show, {
238
+ when: internal === true,
239
+ children: /* @__PURE__ */ jsx(TSDocInternal, {})
240
+ }),
241
+ /* @__PURE__ */ jsx(Show, {
242
+ when: ignore === true,
243
+ children: /* @__PURE__ */ jsx(TSDocIgnore, {})
244
+ }),
245
+ /* @__PURE__ */ jsx(Show, {
246
+ when: hidden === true,
247
+ children: /* @__PURE__ */ jsx(TSDocHidden, {})
248
+ }),
249
+ /* @__PURE__ */ jsx(Show, {
250
+ when: !isUndefined(type) && !isUndefined(defaultValue),
251
+ children: /* @__PURE__ */ jsx(TSDocDefaultValue, {
252
+ type,
253
+ defaultValue
254
+ })
255
+ })
256
+ ] });
257
+ }
258
+ /**
259
+ * Create a TSDoc parameter set off with `@param`.
260
+ */
261
+ function TSDocParam(props) {
262
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
263
+ "@param ",
264
+ /* @__PURE__ */ jsx(TSDocParamName, {
265
+ name: props.name,
266
+ optional: props.optional,
267
+ defaultValue: props.defaultValue
268
+ }),
269
+ /* @__PURE__ */ jsx(TSDocParamDescription, { children: props.children })
270
+ ] });
271
+ }
272
+ function TSDocParamName(props) {
273
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
274
+ /* @__PURE__ */ jsx(Show, {
275
+ when: props.optional,
276
+ children: "["
277
+ }),
278
+ props.name,
279
+ /* @__PURE__ */ jsxs(Show, {
280
+ when: Boolean(props.defaultValue),
281
+ children: ["=", props.defaultValue]
282
+ }),
283
+ /* @__PURE__ */ jsx(Show, {
284
+ when: props.optional,
285
+ children: "]"
286
+ })
287
+ ] });
288
+ }
289
+ function TSDocParamDescription(props) {
290
+ return /* @__PURE__ */ jsxs(Show, {
291
+ when: Boolean(props.children),
292
+ children: [" - ", /* @__PURE__ */ jsx("align", {
293
+ width: 2,
294
+ children: /* @__PURE__ */ jsx(Prose, { children: props.children })
295
+ })]
296
+ });
297
+ }
298
+ /**
299
+ * Create a TSDoc `@returns` tag.
300
+ */
301
+ function TSDocReturns(props) {
302
+ return /* @__PURE__ */ jsx(TSDocTag, {
303
+ ...props,
304
+ tag: "returns"
305
+ });
306
+ }
307
+ /**
308
+ * Create a TSDoc `@throws` tag.
309
+ */
310
+ function TSDocThrows(props) {
311
+ return /* @__PURE__ */ jsx(TSDocTag, {
312
+ ...props,
313
+ tag: "throws"
314
+ });
315
+ }
316
+ /**
317
+ * Generates a TSDoc `@module` tag for the given module name.
318
+ */
319
+ function TSDocModule(props) {
320
+ const [{ children, name, prefix }] = splitProps(props, [
321
+ "children",
322
+ "name",
323
+ "prefix"
324
+ ]);
325
+ const context = usePowerlinesSafe();
326
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
327
+ "/**",
328
+ /* @__PURE__ */ jsxs("align", {
329
+ string: " * ",
330
+ children: [
331
+ /* @__PURE__ */ jsx("hbr", {}),
332
+ /* @__PURE__ */ jsxs(Show, {
333
+ when: Boolean(children),
334
+ children: [
335
+ /* @__PURE__ */ jsx(List, {
336
+ hardline: true,
337
+ children: childrenArray(() => children)
338
+ }),
339
+ /* @__PURE__ */ jsx("hbr", {}),
340
+ /* @__PURE__ */ jsx("hbr", {})
341
+ ]
342
+ }),
343
+ "@module ",
344
+ prefix || context?.config?.framework || "powerlines",
345
+ ":",
346
+ name
347
+ ]
348
+ }),
349
+ /* @__PURE__ */ jsx("hbr", {}),
350
+ ` */`
351
+ ] });
352
+ }
353
+
354
+ //#endregion
355
+ export { TSDoc, TSDocAttributesTags, TSDocExample, TSDocLink, TSDocModule, TSDocParam, TSDocRemarks, TSDocReturns, TSDocThrows };
@@ -0,0 +1,157 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ const require_context = require('../../core/contexts/context.cjs');
3
+ const require_single_line_comment = require('../../core/components/single-line-comment.cjs');
4
+ const require_source_file = require('../../core/components/source-file.cjs');
5
+ let __alloy_js_core = require("@alloy-js/core");
6
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
7
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
8
+ let react_jsx_runtime = require("react/jsx-runtime");
9
+ let __stryke_path_append = require("@stryke/path/append");
10
+ let __alloy_js_typescript = require("@alloy-js/typescript");
11
+ let __stryke_type_checks_is_boolean = require("@stryke/type-checks/is-boolean");
12
+
13
+ //#region ../plugin-alloy/src/typescript/components/typescript-file.tsx
14
+ /**
15
+ * A base component representing a Powerlines generated Typescript source file.
16
+ *
17
+ * @param props - The properties for the source file.
18
+ * @returns The rendered source file component.
19
+ */
20
+ function TypescriptFile(props) {
21
+ const [{ children, path, imports, builtinImports, tsx, header, hashbang }, rest] = (0, __alloy_js_core.splitProps)(props, [
22
+ "children",
23
+ "path",
24
+ "imports",
25
+ "builtinImports",
26
+ "tsx",
27
+ "header",
28
+ "hashbang"
29
+ ]);
30
+ const directoryContext = (0, __alloy_js_core.useContext)(__alloy_js_core.SourceDirectoryContext);
31
+ const sdData = (0, __alloy_js_typescript.getSourceDirectoryData)(directoryContext);
32
+ const modulePath = (0, __stryke_path_append.appendPath)(path, directoryContext.path);
33
+ const scope = new __alloy_js_typescript.TSModuleScope(modulePath, (0, __alloy_js_core.useScope)());
34
+ sdData.modules.add(scope);
35
+ const pkg = (0, __alloy_js_core.useContext)(__alloy_js_typescript.PackageContext);
36
+ if (pkg) pkg.scope.addModule(scope);
37
+ if (props.export) {
38
+ if (pkg) if ((0, __stryke_type_checks_is_boolean.isBoolean)(props.export)) pkg.scope.addExport(modulePath, scope);
39
+ else pkg.scope.addExport(props.export, scope);
40
+ }
41
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.SourceFileContext.Provider, {
42
+ value: { scope },
43
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Scope, {
44
+ value: scope,
45
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_source_file.SourceFile, {
46
+ ...rest,
47
+ path: modulePath,
48
+ header: header ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypescriptFileHeader, {
49
+ hashbang,
50
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypescriptFileHeaderImports, {
51
+ imports,
52
+ builtinImports,
53
+ scope
54
+ })
55
+ }),
56
+ filetype: tsx ? "tsx" : "typescript",
57
+ children
58
+ })
59
+ })
60
+ });
61
+ }
62
+ /**
63
+ * Renders the header for a Powerlines Typescript source file.
64
+ *
65
+ * @param props - The properties for the source file header.
66
+ * @returns The rendered source file header.
67
+ */
68
+ function TypescriptFileHeader(props) {
69
+ const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
70
+ const context = require_context.usePowerlinesSafe();
71
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
72
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
73
+ when: Boolean(hashbang),
74
+ children: [hashbang === true ? __alloy_js_core.code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})]
75
+ }),
76
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
77
+ when: Boolean(header),
78
+ children: [header, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})]
79
+ }),
80
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
81
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
82
+ when: Boolean(disableEslint),
83
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, {
84
+ variant: "slash-star",
85
+ children: "eslint-disable"
86
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})]
87
+ }),
88
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
89
+ when: Boolean(disablePrettier),
90
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, {
91
+ variant: "slash-star",
92
+ children: "prettier-ignore"
93
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})]
94
+ }),
95
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
96
+ when: Boolean(disableBiome),
97
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, { children: "biome-ignore lint: disable" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})]
98
+ }),
99
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
100
+ when: Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome),
101
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})
102
+ }),
103
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
104
+ when: Boolean(children),
105
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})] })
106
+ }),
107
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, { children: `Generated by ${(0, __stryke_string_format_title_case.titleCase)(context?.config?.framework) || "Powerlines"}` }),
108
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
109
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, { children: __alloy_js_core.code`NOTE: Do not edit this file manually - it will be overwritten automatically` }),
110
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})
111
+ ] });
112
+ }
113
+ /**
114
+ * Renders the header for a Powerlines Typescript source file.
115
+ *
116
+ * @param props - The properties for the source file header.
117
+ * @returns The rendered source file header.
118
+ */
119
+ function TypescriptFileHeaderImports(props) {
120
+ const { imports, builtinImports } = props;
121
+ const context = require_context.usePowerlinesSafe();
122
+ const sourceFile = (0, __alloy_js_typescript.useSourceFile)();
123
+ const scope = props.scope ?? sourceFile.scope;
124
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
125
+ when: scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0 || !!builtinImports && Object.keys(builtinImports).length > 0,
126
+ children: [
127
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
128
+ when: !!imports && Object.keys(imports).length > 0,
129
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.For, {
130
+ each: Object.entries(imports ?? {}),
131
+ hardline: true,
132
+ children: ([module$1, importItem]) => {
133
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: __alloy_js_core.code`import ${importItem === null ? "" : (0, __stryke_type_checks_is_string.isString)(importItem) ? importItem : ` ${importItem.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (importItem.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && importItem.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (importItem.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${importItem.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} from "${module$1}";` });
134
+ }
135
+ })
136
+ }),
137
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
138
+ when: builtinImports && Object.keys(builtinImports).length > 0,
139
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.For, {
140
+ each: Object.entries(builtinImports ?? {}),
141
+ hardline: true,
142
+ children: ([module$1, importItem]) => __alloy_js_core.code`import ${importItem === null ? "" : (0, __stryke_type_checks_is_string.isString)(importItem) ? importItem : ` ${importItem.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (importItem.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && importItem.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (importItem.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${importItem.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} from "${module$1.includes(":") ? module$1 : `${context?.config?.framework || "powerlines"}:${module$1}`}";`
143
+ })
144
+ }),
145
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
146
+ when: scope.importedModules.size > 0,
147
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.ImportStatements, { records: scope.importedModules })
148
+ }),
149
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})
150
+ ]
151
+ });
152
+ }
153
+
154
+ //#endregion
155
+ exports.TypescriptFile = TypescriptFile;
156
+ exports.TypescriptFileHeader = TypescriptFileHeader;
157
+ exports.TypescriptFileHeaderImports = TypescriptFileHeaderImports;
@@ -0,0 +1,154 @@
1
+ import { usePowerlinesSafe } from "../../core/contexts/context.mjs";
2
+ import { SingleLineComment } from "../../core/components/single-line-comment.mjs";
3
+ import { SourceFile } from "../../core/components/source-file.mjs";
4
+ import { For, Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
5
+ import { titleCase } from "@stryke/string-format/title-case";
6
+ import { isString } from "@stryke/type-checks/is-string";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { appendPath } from "@stryke/path/append";
9
+ import { ImportStatements, PackageContext, SourceFileContext as SourceFileContext$1, TSModuleScope, getSourceDirectoryData, useSourceFile } from "@alloy-js/typescript";
10
+ import { isBoolean } from "@stryke/type-checks/is-boolean";
11
+
12
+ //#region ../plugin-alloy/src/typescript/components/typescript-file.tsx
13
+ /**
14
+ * A base component representing a Powerlines generated Typescript source file.
15
+ *
16
+ * @param props - The properties for the source file.
17
+ * @returns The rendered source file component.
18
+ */
19
+ function TypescriptFile(props) {
20
+ const [{ children, path, imports, builtinImports, tsx, header, hashbang }, rest] = splitProps(props, [
21
+ "children",
22
+ "path",
23
+ "imports",
24
+ "builtinImports",
25
+ "tsx",
26
+ "header",
27
+ "hashbang"
28
+ ]);
29
+ const directoryContext = useContext(SourceDirectoryContext);
30
+ const sdData = getSourceDirectoryData(directoryContext);
31
+ const modulePath = appendPath(path, directoryContext.path);
32
+ const scope = new TSModuleScope(modulePath, useScope());
33
+ sdData.modules.add(scope);
34
+ const pkg = useContext(PackageContext);
35
+ if (pkg) pkg.scope.addModule(scope);
36
+ if (props.export) {
37
+ if (pkg) if (isBoolean(props.export)) pkg.scope.addExport(modulePath, scope);
38
+ else pkg.scope.addExport(props.export, scope);
39
+ }
40
+ return /* @__PURE__ */ jsx(SourceFileContext$1.Provider, {
41
+ value: { scope },
42
+ children: /* @__PURE__ */ jsx(Scope, {
43
+ value: scope,
44
+ children: /* @__PURE__ */ jsx(SourceFile, {
45
+ ...rest,
46
+ path: modulePath,
47
+ header: header ?? /* @__PURE__ */ jsx(TypescriptFileHeader, {
48
+ hashbang,
49
+ children: /* @__PURE__ */ jsx(TypescriptFileHeaderImports, {
50
+ imports,
51
+ builtinImports,
52
+ scope
53
+ })
54
+ }),
55
+ filetype: tsx ? "tsx" : "typescript",
56
+ children
57
+ })
58
+ })
59
+ });
60
+ }
61
+ /**
62
+ * Renders the header for a Powerlines Typescript source file.
63
+ *
64
+ * @param props - The properties for the source file header.
65
+ * @returns The rendered source file header.
66
+ */
67
+ function TypescriptFileHeader(props) {
68
+ const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
69
+ const context = usePowerlinesSafe();
70
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
71
+ /* @__PURE__ */ jsxs(Show, {
72
+ when: Boolean(hashbang),
73
+ children: [hashbang === true ? code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang, /* @__PURE__ */ jsx("hbr", {})]
74
+ }),
75
+ /* @__PURE__ */ jsxs(Show, {
76
+ when: Boolean(header),
77
+ children: [header, /* @__PURE__ */ jsx("hbr", {})]
78
+ }),
79
+ /* @__PURE__ */ jsx("hbr", {}),
80
+ /* @__PURE__ */ jsxs(Show, {
81
+ when: Boolean(disableEslint),
82
+ children: [/* @__PURE__ */ jsx(SingleLineComment, {
83
+ variant: "slash-star",
84
+ children: "eslint-disable"
85
+ }), /* @__PURE__ */ jsx("hbr", {})]
86
+ }),
87
+ /* @__PURE__ */ jsxs(Show, {
88
+ when: Boolean(disablePrettier),
89
+ children: [/* @__PURE__ */ jsx(SingleLineComment, {
90
+ variant: "slash-star",
91
+ children: "prettier-ignore"
92
+ }), /* @__PURE__ */ jsx("hbr", {})]
93
+ }),
94
+ /* @__PURE__ */ jsxs(Show, {
95
+ when: Boolean(disableBiome),
96
+ children: [/* @__PURE__ */ jsx(SingleLineComment, { children: "biome-ignore lint: disable" }), /* @__PURE__ */ jsx("hbr", {})]
97
+ }),
98
+ /* @__PURE__ */ jsx(Show, {
99
+ when: Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome),
100
+ children: /* @__PURE__ */ jsx("hbr", {})
101
+ }),
102
+ /* @__PURE__ */ jsx(Show, {
103
+ when: Boolean(children),
104
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [children, /* @__PURE__ */ jsx("hbr", {})] })
105
+ }),
106
+ /* @__PURE__ */ jsx(SingleLineComment, { children: `Generated by ${titleCase(context?.config?.framework) || "Powerlines"}` }),
107
+ /* @__PURE__ */ jsx("hbr", {}),
108
+ /* @__PURE__ */ jsx(SingleLineComment, { children: code`NOTE: Do not edit this file manually - it will be overwritten automatically` }),
109
+ /* @__PURE__ */ jsx("hbr", {})
110
+ ] });
111
+ }
112
+ /**
113
+ * Renders the header for a Powerlines Typescript source file.
114
+ *
115
+ * @param props - The properties for the source file header.
116
+ * @returns The rendered source file header.
117
+ */
118
+ function TypescriptFileHeaderImports(props) {
119
+ const { imports, builtinImports } = props;
120
+ const context = usePowerlinesSafe();
121
+ const sourceFile = useSourceFile();
122
+ const scope = props.scope ?? sourceFile.scope;
123
+ return /* @__PURE__ */ jsxs(Show, {
124
+ when: scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0 || !!builtinImports && Object.keys(builtinImports).length > 0,
125
+ children: [
126
+ /* @__PURE__ */ jsx(Show, {
127
+ when: !!imports && Object.keys(imports).length > 0,
128
+ children: /* @__PURE__ */ jsx(For, {
129
+ each: Object.entries(imports ?? {}),
130
+ hardline: true,
131
+ children: ([module, importItem]) => {
132
+ return /* @__PURE__ */ jsx(Fragment, { children: code`import ${importItem === null ? "" : isString(importItem) ? importItem : ` ${importItem.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (importItem.filter((i) => !isString(i) && i.default).length > 0 && importItem.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (importItem.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${importItem.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} from "${module}";` });
133
+ }
134
+ })
135
+ }),
136
+ /* @__PURE__ */ jsx(Show, {
137
+ when: builtinImports && Object.keys(builtinImports).length > 0,
138
+ children: /* @__PURE__ */ jsx(For, {
139
+ each: Object.entries(builtinImports ?? {}),
140
+ hardline: true,
141
+ children: ([module, importItem]) => code`import ${importItem === null ? "" : isString(importItem) ? importItem : ` ${importItem.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (importItem.filter((i) => !isString(i) && i.default).length > 0 && importItem.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (importItem.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${importItem.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} `} from "${module.includes(":") ? module : `${context?.config?.framework || "powerlines"}:${module}`}";`
142
+ })
143
+ }),
144
+ /* @__PURE__ */ jsx(Show, {
145
+ when: scope.importedModules.size > 0,
146
+ children: /* @__PURE__ */ jsx(ImportStatements, { records: scope.importedModules })
147
+ }),
148
+ /* @__PURE__ */ jsx("hbr", {})
149
+ ]
150
+ });
151
+ }
152
+
153
+ //#endregion
154
+ export { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports };