@powerlines/plugin-react 0.1.142 → 0.1.144

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