@powerlines/plugin-react 0.1.132 → 0.1.133

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 (210) hide show
  1. package/dist/components/index.cjs +3 -2
  2. package/dist/components/index.d.cts +3 -1
  3. package/dist/components/index.d.mts +4 -1
  4. package/dist/components/index.mjs +2 -1
  5. package/dist/components/react-optimized.cjs +2 -48
  6. package/dist/components/react-optimized.d.cts +2 -13
  7. package/dist/components/react-optimized.d.mts +3 -13
  8. package/dist/components/react-optimized.mjs +1 -45
  9. package/dist/components-BWLXb7a2.cjs +0 -0
  10. package/dist/{plugin-alloy/src/types/components.d.cts → components-Bs3-ohmM.d.mts} +2 -1
  11. package/dist/components-D-mbfYAe.mjs +1 -0
  12. package/dist/index-B8OHl-c_.d.mts +1 -0
  13. package/dist/index-CFG0_wK4.d.cts +1 -0
  14. package/dist/index-DNLi60D-.d.mts +1 -0
  15. package/dist/index-_wQ5ClJU.d.cts +1 -0
  16. package/dist/index.cjs +11298 -19
  17. package/dist/index.d.cts +7 -5
  18. package/dist/index.d.mts +8 -6
  19. package/dist/index.mjs +11282 -9
  20. package/dist/{deepkit/schemas/reflection.d.mts → plugin-BaOVS_rV.d.cts} +331 -1
  21. package/dist/{deepkit/schemas/reflection.d.cts → plugin-D7LpFbdk.d.mts} +389 -59
  22. package/dist/plugin-jZ9N9Mz-.mjs +1 -0
  23. package/dist/plugin-pBKbb5K9.cjs +0 -0
  24. package/dist/react-optimized-BpFTLlx0.mjs +937 -0
  25. package/dist/react-optimized-C_OVnrX3.d.cts +105 -0
  26. package/dist/react-optimized-Kv14o38g.cjs +1078 -0
  27. package/dist/react-optimized-oMkTiRKU.d.mts +88 -0
  28. package/dist/resolved-BmaQR2AE.d.mts +1789 -0
  29. package/dist/resolved-DaJ9lL_Z.d.cts +1788 -0
  30. package/dist/runtime-BKY6WvHV.mjs +1 -0
  31. package/dist/{plugin-env/src/types/runtime.d.mts → runtime-BjubXOjV.d.mts} +2 -2
  32. package/dist/runtime-Bp9G0scd.cjs +0 -0
  33. package/dist/{plugin-env/src/types/runtime.d.cts → runtime-CAI6R3zb.d.cts} +2 -2
  34. package/dist/runtime-DWYeFyQG.d.cts +15 -0
  35. package/dist/runtime-YmyzXCJq.d.mts +15 -0
  36. package/dist/types/index.cjs +3 -0
  37. package/dist/types/index.d.cts +5 -2
  38. package/dist/types/index.d.mts +6 -2
  39. package/dist/types/index.mjs +4 -0
  40. package/dist/types/plugin.cjs +1 -0
  41. package/dist/types/plugin.d.cts +3 -72
  42. package/dist/types/plugin.d.mts +4 -72
  43. package/dist/types/plugin.mjs +2 -0
  44. package/dist/types/runtime.cjs +1 -0
  45. package/dist/types/runtime.d.cts +3 -14
  46. package/dist/types/runtime.d.mts +3 -14
  47. package/dist/types/runtime.mjs +2 -0
  48. package/dist/types--fVOUYBq.mjs +1 -0
  49. package/dist/types-a8gm_IaQ.cjs +0 -0
  50. package/package.json +5 -5
  51. package/dist/_virtual/rolldown_runtime.cjs +0 -37
  52. package/dist/_virtual/rolldown_runtime.mjs +0 -29
  53. package/dist/deepkit/schemas/reflection.cjs +0 -3940
  54. package/dist/deepkit/schemas/reflection.mjs +0 -3938
  55. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  56. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  57. package/dist/deepkit/src/capnp.cjs +0 -913
  58. package/dist/deepkit/src/capnp.mjs +0 -911
  59. package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
  60. package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
  61. package/dist/deepkit/src/reflect-type.cjs +0 -22
  62. package/dist/deepkit/src/reflect-type.mjs +0 -20
  63. package/dist/deepkit/src/resolve-reflections.cjs +0 -16
  64. package/dist/deepkit/src/resolve-reflections.mjs +0 -15
  65. package/dist/deepkit/src/transformer.cjs +0 -52
  66. package/dist/deepkit/src/transformer.mjs +0 -49
  67. package/dist/deepkit/src/transpile.cjs +0 -29
  68. package/dist/deepkit/src/transpile.mjs +0 -27
  69. package/dist/deepkit/src/types.d.cts +0 -10
  70. package/dist/deepkit/src/types.d.mts +0 -10
  71. package/dist/deepkit/src/utilities.cjs +0 -66
  72. package/dist/deepkit/src/utilities.mjs +0 -65
  73. package/dist/deepkit/src/vendor/type-compiler/index.cjs +0 -38
  74. package/dist/deepkit/src/vendor/type-compiler/index.mjs +0 -19
  75. package/dist/deepkit/src/vendor/type.cjs +0 -20
  76. package/dist/deepkit/src/vendor/type.d.cts +0 -7
  77. package/dist/deepkit/src/vendor/type.d.mts +0 -7
  78. package/dist/deepkit/src/vendor/type.mjs +0 -11
  79. package/dist/plugin-alloy/src/core/components/output.cjs +0 -45
  80. package/dist/plugin-alloy/src/core/components/output.mjs +0 -44
  81. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -22
  82. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -21
  83. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -64
  84. package/dist/plugin-alloy/src/core/components/source-file.d.cts +0 -23
  85. package/dist/plugin-alloy/src/core/components/source-file.d.mts +0 -23
  86. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -62
  87. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -60
  88. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -54
  89. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  90. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  91. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
  92. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
  93. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
  94. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
  95. package/dist/plugin-alloy/src/index.cjs +0 -93
  96. package/dist/plugin-alloy/src/index.mjs +0 -91
  97. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -7
  98. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -9
  99. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -5
  100. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -7
  101. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -17
  102. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
  103. package/dist/plugin-alloy/src/types/components.d.mts +0 -25
  104. package/dist/plugin-alloy/src/types/index.d.mts +0 -2
  105. package/dist/plugin-alloy/src/types/plugin.d.cts +0 -37
  106. package/dist/plugin-alloy/src/types/plugin.d.mts +0 -37
  107. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -57
  108. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +0 -25
  109. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +0 -26
  110. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -56
  111. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -126
  112. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -124
  113. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -442
  114. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +0 -27
  115. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +0 -28
  116. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -433
  117. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -194
  118. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +0 -14
  119. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +0 -15
  120. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -191
  121. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -68
  122. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -67
  123. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -124
  124. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -123
  125. package/dist/plugin-automd/src/index.cjs +0 -101
  126. package/dist/plugin-automd/src/index.mjs +0 -98
  127. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  128. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  129. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  130. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  131. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
  132. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
  133. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
  134. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
  135. package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
  136. package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
  137. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  138. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  139. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
  140. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
  141. package/dist/plugin-babel/src/helpers/options.cjs +0 -50
  142. package/dist/plugin-babel/src/helpers/options.mjs +0 -47
  143. package/dist/plugin-babel/src/index.cjs +0 -91
  144. package/dist/plugin-babel/src/index.mjs +0 -89
  145. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  146. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  147. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  148. package/dist/plugin-env/src/babel/index.cjs +0 -1
  149. package/dist/plugin-env/src/babel/index.mjs +0 -3
  150. package/dist/plugin-env/src/babel/plugin.cjs +0 -121
  151. package/dist/plugin-env/src/babel/plugin.mjs +0 -119
  152. package/dist/plugin-env/src/components/docs.cjs +0 -9
  153. package/dist/plugin-env/src/components/docs.mjs +0 -11
  154. package/dist/plugin-env/src/components/env.cjs +0 -575
  155. package/dist/plugin-env/src/components/env.mjs +0 -572
  156. package/dist/plugin-env/src/components/index.cjs +0 -2
  157. package/dist/plugin-env/src/components/index.mjs +0 -4
  158. package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -22
  159. package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -21
  160. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -55
  161. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -54
  162. package/dist/plugin-env/src/helpers/index.cjs +0 -6
  163. package/dist/plugin-env/src/helpers/index.mjs +0 -8
  164. package/dist/plugin-env/src/helpers/load.cjs +0 -83
  165. package/dist/plugin-env/src/helpers/load.mjs +0 -80
  166. package/dist/plugin-env/src/helpers/persistence.cjs +0 -200
  167. package/dist/plugin-env/src/helpers/persistence.mjs +0 -189
  168. package/dist/plugin-env/src/helpers/reflect.cjs +0 -111
  169. package/dist/plugin-env/src/helpers/reflect.mjs +0 -103
  170. package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -24
  171. package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -23
  172. package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -2
  173. package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -4
  174. package/dist/plugin-env/src/index.cjs +0 -175
  175. package/dist/plugin-env/src/index.mjs +0 -173
  176. package/dist/plugin-env/src/types/plugin.d.cts +0 -151
  177. package/dist/plugin-env/src/types/plugin.d.mts +0 -153
  178. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
  179. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
  180. package/dist/powerlines/src/lib/entry.cjs +0 -12
  181. package/dist/powerlines/src/lib/entry.mjs +0 -14
  182. package/dist/powerlines/src/lib/logger.cjs +0 -41
  183. package/dist/powerlines/src/lib/logger.mjs +0 -39
  184. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -38
  185. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -35
  186. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -35
  187. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -34
  188. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -30
  189. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -29
  190. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  191. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
  192. package/dist/powerlines/src/types/babel.d.cts +0 -22
  193. package/dist/powerlines/src/types/babel.d.mts +0 -22
  194. package/dist/powerlines/src/types/build.d.cts +0 -145
  195. package/dist/powerlines/src/types/build.d.mts +0 -145
  196. package/dist/powerlines/src/types/commands.d.cts +0 -8
  197. package/dist/powerlines/src/types/commands.d.mts +0 -9
  198. package/dist/powerlines/src/types/config.d.cts +0 -380
  199. package/dist/powerlines/src/types/config.d.mts +0 -381
  200. package/dist/powerlines/src/types/context.d.cts +0 -414
  201. package/dist/powerlines/src/types/context.d.mts +0 -416
  202. package/dist/powerlines/src/types/fs.d.cts +0 -486
  203. package/dist/powerlines/src/types/fs.d.mts +0 -486
  204. package/dist/powerlines/src/types/hooks.d.mts +0 -2
  205. package/dist/powerlines/src/types/plugin.d.cts +0 -231
  206. package/dist/powerlines/src/types/plugin.d.mts +0 -231
  207. package/dist/powerlines/src/types/resolved.d.cts +0 -82
  208. package/dist/powerlines/src/types/resolved.d.mts +0 -82
  209. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  210. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
@@ -1,191 +0,0 @@
1
- import { usePowerlines } 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 { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
5
- import { titleCase } from "@stryke/string-format/title-case";
6
- import { isString } from "@stryke/type-checks/is-string";
7
- import { Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
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, tsx, header, hashbang }, rest] = splitProps(props, [
21
- "children",
22
- "path",
23
- "imports",
24
- "tsx",
25
- "header",
26
- "hashbang"
27
- ]);
28
- const directoryContext = useContext(SourceDirectoryContext);
29
- const sdData = getSourceDirectoryData(directoryContext);
30
- const modulePath = appendPath(path, directoryContext.path);
31
- const scope = new TSModuleScope(modulePath, useScope());
32
- sdData.modules.add(scope);
33
- const pkg = useContext(PackageContext);
34
- if (pkg) pkg.scope.addModule(scope);
35
- if (props.export) {
36
- if (pkg) if (isBoolean(props.export)) pkg.scope.addExport(modulePath, scope);
37
- else pkg.scope.addExport(props.export, scope);
38
- }
39
- return createComponent(SourceFileContext$1.Provider, {
40
- value: { scope },
41
- get children() {
42
- return createComponent(Scope, {
43
- value: scope,
44
- get children() {
45
- return createComponent(SourceFile, mergeProps(rest, {
46
- path: modulePath,
47
- get header() {
48
- return header ?? createComponent(TypescriptFileHeader, {
49
- hashbang,
50
- get children() {
51
- return createComponent(TypescriptFileHeaderImports, {
52
- imports,
53
- scope
54
- });
55
- }
56
- });
57
- },
58
- filetype: tsx ? "tsx" : "typescript",
59
- children
60
- }));
61
- }
62
- });
63
- }
64
- });
65
- }
66
- /**
67
- * Renders the header for a Powerlines Typescript source file.
68
- *
69
- * @param props - The properties for the source file header.
70
- * @returns The rendered source file header.
71
- */
72
- function TypescriptFileHeader(props) {
73
- const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
74
- const context = usePowerlines();
75
- return [
76
- createComponent(Show, {
77
- get when() {
78
- return Boolean(hashbang);
79
- },
80
- get children() {
81
- return [memo(() => hashbang === true ? code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang), createIntrinsic("hbr", {})];
82
- }
83
- }),
84
- createComponent(Show, {
85
- get when() {
86
- return Boolean(header);
87
- },
88
- get children() {
89
- return [header, createIntrinsic("hbr", {})];
90
- }
91
- }),
92
- createIntrinsic("hbr", {}),
93
- createComponent(Show, {
94
- get when() {
95
- return Boolean(disableEslint);
96
- },
97
- get children() {
98
- return [createComponent(SingleLineComment, {
99
- variant: "slash-star",
100
- children: "eslint-disable"
101
- }), createIntrinsic("hbr", {})];
102
- }
103
- }),
104
- createComponent(Show, {
105
- get when() {
106
- return Boolean(disablePrettier);
107
- },
108
- get children() {
109
- return [createComponent(SingleLineComment, {
110
- variant: "slash-star",
111
- children: "prettier-ignore"
112
- }), createIntrinsic("hbr", {})];
113
- }
114
- }),
115
- createComponent(Show, {
116
- get when() {
117
- return Boolean(disableBiome);
118
- },
119
- get children() {
120
- return [createComponent(SingleLineComment, { children: "biome-ignore lint: disable" }), createIntrinsic("hbr", {})];
121
- }
122
- }),
123
- createComponent(Show, {
124
- get when() {
125
- return Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome);
126
- },
127
- get children() {
128
- return createIntrinsic("hbr", {});
129
- }
130
- }),
131
- createComponent(Show, {
132
- get when() {
133
- return Boolean(children);
134
- },
135
- get children() {
136
- return [children, createIntrinsic("hbr", {})];
137
- }
138
- }),
139
- createComponent(SingleLineComment, { get children() {
140
- return code`Generated by ${titleCase(context?.config.framework) || "Powerlines"}`;
141
- } }),
142
- createIntrinsic("hbr", {}),
143
- createComponent(SingleLineComment, { children: code`NOTE: Do not edit this file manually - it will be overwritten automatically by the "prepare" command` }),
144
- createIntrinsic("hbr", {})
145
- ];
146
- }
147
- /**
148
- * Renders the header for a Powerlines Typescript source file.
149
- *
150
- * @param props - The properties for the source file header.
151
- * @returns The rendered source file header.
152
- */
153
- function TypescriptFileHeaderImports(props) {
154
- const { imports } = props;
155
- const context = usePowerlines();
156
- const sourceFile = useSourceFile();
157
- const scope = props.scope ?? sourceFile.scope;
158
- return createComponent(Show, {
159
- get when() {
160
- return scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0;
161
- },
162
- get children() {
163
- return [
164
- createComponent(Show, {
165
- get when() {
166
- return !!imports && Object.keys(imports).length > 0;
167
- },
168
- get children() {
169
- return Object.entries(imports ?? {}).filter(([key]) => key !== "$builtins").concat(imports && imports.$builtins ? Object.entries(imports.$builtins).map(([key, entry]) => [key.includes(":") ? key : `${context.config.output.builtinPrefix}:${key}`, entry]) : []).map(([module, imported]) => {
170
- return code`import ${imported === null ? "" : imported.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (imported.filter((i) => !isString(i) && i.default).length > 0 && imported.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (imported.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${imported.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} from "${module}";`;
171
- });
172
- }
173
- }),
174
- createComponent(Show, {
175
- get when() {
176
- return scope.importedModules.size > 0;
177
- },
178
- get children() {
179
- return createComponent(ImportStatements, { get records() {
180
- return scope.importedModules;
181
- } });
182
- }
183
- }),
184
- createIntrinsic("hbr", {})
185
- ];
186
- }
187
- });
188
- }
189
-
190
- //#endregion
191
- export { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports };
@@ -1,68 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
- const require_type = require('../../../../deepkit/src/vendor/type.cjs');
3
- const require_reflection = require('../../core/contexts/reflection.cjs');
4
- const require_tsdoc_reflection = require('./tsdoc-reflection.cjs');
5
- let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
7
- let __alloy_js_core = require("@alloy-js/core");
8
- let __alloy_js_typescript = require("@alloy-js/typescript");
9
- let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
10
-
11
- //#region ../plugin-alloy/src/typescript/components/typescript-interface.tsx
12
- /**
13
- * Generates a TypeScript interface for the given reflection class.
14
- */
15
- function TypeScriptInterface(props) {
16
- const [{ name, reflection }, rest] = (0, __alloy_js_core.splitProps)(props, ["name", "reflection"]);
17
- const interfaceName = (0, __alloy_js_core.computed)(() => (0, __stryke_string_format_pascal_case.pascalCase)(((0, __stryke_type_checks_is_string.isString)(name) ? name : name.toString()) || reflection.getName()));
18
- const properties = reflection.getProperties().filter((item) => !item.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1);
19
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_reflection.ReflectionClassContext.Provider, {
20
- value: { reflection },
21
- get children() {
22
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc_reflection.TSDocReflectionClass, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceDeclaration, (0, __alloy_js_core_jsx_runtime.mergeProps)({
23
- "export": true,
24
- get name() {
25
- return interfaceName.value;
26
- }
27
- }, rest, { get children() {
28
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
29
- each: properties,
30
- doubleHardline: true,
31
- semicolon: true,
32
- children: (prop) => (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptInterfaceProperty, { property: prop })
33
- });
34
- } }))];
35
- }
36
- });
37
- }
38
- /**
39
- * Generates a TypeScript interface property for the given reflection class.
40
- */
41
- function TypescriptInterfaceProperty(props) {
42
- const [{ property }, rest] = (0, __alloy_js_core.splitProps)(props, ["property"]);
43
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_reflection.ReflectionPropertyContext.Provider, {
44
- value: property,
45
- get children() {
46
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc_reflection.TSDocReflectionProperty, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.InterfaceMember, (0, __alloy_js_core_jsx_runtime.mergeProps)({
47
- get name() {
48
- return property.getNameAsString();
49
- },
50
- get readonly() {
51
- return property.isReadonly();
52
- },
53
- get optional() {
54
- return property.isOptional();
55
- },
56
- get nullish() {
57
- return property.isNullable();
58
- },
59
- get type() {
60
- return (0, require_type.type_exports.stringifyType)(property.getType());
61
- }
62
- }, rest))];
63
- }
64
- });
65
- }
66
-
67
- //#endregion
68
- exports.TypeScriptInterface = TypeScriptInterface;
@@ -1,67 +0,0 @@
1
- import { type_exports } from "../../../../deepkit/src/vendor/type.mjs";
2
- import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
3
- import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
4
- import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
5
- import { isString } from "@stryke/type-checks/is-string";
6
- import { For, computed, splitProps } from "@alloy-js/core";
7
- import { InterfaceDeclaration, InterfaceMember } from "@alloy-js/typescript";
8
- import { pascalCase } from "@stryke/string-format/pascal-case";
9
-
10
- //#region ../plugin-alloy/src/typescript/components/typescript-interface.tsx
11
- /**
12
- * Generates a TypeScript interface for the given reflection class.
13
- */
14
- function TypeScriptInterface(props) {
15
- const [{ name, reflection }, rest] = splitProps(props, ["name", "reflection"]);
16
- const interfaceName = computed(() => pascalCase((isString(name) ? name : name.toString()) || reflection.getName()));
17
- const properties = reflection.getProperties().filter((item) => !item.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1);
18
- return createComponent(ReflectionClassContext.Provider, {
19
- value: { reflection },
20
- get children() {
21
- return [createComponent(TSDocReflectionClass, {}), createComponent(InterfaceDeclaration, mergeProps({
22
- "export": true,
23
- get name() {
24
- return interfaceName.value;
25
- }
26
- }, rest, { get children() {
27
- return createComponent(For, {
28
- each: properties,
29
- doubleHardline: true,
30
- semicolon: true,
31
- children: (prop) => createComponent(TypescriptInterfaceProperty, { property: prop })
32
- });
33
- } }))];
34
- }
35
- });
36
- }
37
- /**
38
- * Generates a TypeScript interface property for the given reflection class.
39
- */
40
- function TypescriptInterfaceProperty(props) {
41
- const [{ property }, rest] = splitProps(props, ["property"]);
42
- return createComponent(ReflectionPropertyContext.Provider, {
43
- value: property,
44
- get children() {
45
- return [createComponent(TSDocReflectionProperty, {}), createComponent(InterfaceMember, mergeProps({
46
- get name() {
47
- return property.getNameAsString();
48
- },
49
- get readonly() {
50
- return property.isReadonly();
51
- },
52
- get optional() {
53
- return property.isOptional();
54
- },
55
- get nullish() {
56
- return property.isNullable();
57
- },
58
- get type() {
59
- return (0, type_exports.stringifyType)(property.getType());
60
- }
61
- }, rest))];
62
- }
63
- });
64
- }
65
-
66
- //#endregion
67
- export { TypeScriptInterface };
@@ -1,124 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
- const require_utilities = require('../../../../deepkit/src/utilities.cjs');
3
- const require_reflection = require('../../core/contexts/reflection.cjs');
4
- const require_tsdoc_reflection = require('./tsdoc-reflection.cjs');
5
- let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
7
- let __alloy_js_core = require("@alloy-js/core");
8
- let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
9
- let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
10
- let __alloy_js_typescript = require("@alloy-js/typescript");
11
- let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
12
-
13
- //#region ../plugin-alloy/src/typescript/components/typescript-object.tsx
14
- /**
15
- * Generates a TypeScript object for the given reflection class.
16
- */
17
- function TypescriptObject(props) {
18
- if (!props.reflection?.value) return null;
19
- const objectName = (0, __alloy_js_core.computed)(() => (0, __stryke_string_format_camel_case.camelCase)(((0, __stryke_type_checks_is_string.isString)(props.name) ? props.name : props.name.toString()) || props.reflection.value.getName()));
20
- const objectType = (0, __alloy_js_core.computed)(() => props.type || (0, __stryke_string_format_pascal_case.pascalCase)(props.reflection.value.getName()));
21
- const properties = (0, __alloy_js_core.computed)(() => props.reflection.value.getProperties().filter((item) => !item.isIgnored() && !(0, __stryke_type_checks_is_undefined.isUndefined)(props.defaultValue?.value?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
22
- if ((0, __stryke_type_checks_is_undefined.isUndefined)(ret) && !(0, __stryke_type_checks_is_undefined.isUndefined)(props.defaultValue?.value?.[alias])) return props.defaultValue?.value?.[alias];
23
- return ret;
24
- }, void 0) ?? item.getDefaultValue())).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1));
25
- const TypeSymbolSlot = (0, __alloy_js_core.createSymbolSlot)();
26
- const ValueTypeSymbolSlot = (0, __alloy_js_core.createSymbolSlot)();
27
- const sym = (0, __alloy_js_typescript.createValueSymbol)(props.name, {
28
- refkeys: props.refkey,
29
- default: props.default,
30
- export: props.export,
31
- metadata: props.metadata,
32
- tsFlags: props.nullish ? __alloy_js_typescript.TSSymbolFlags.Nullish : __alloy_js_typescript.TSSymbolFlags.None,
33
- type: props.type ? TypeSymbolSlot.firstSymbol : void 0,
34
- namePolicy: (0, __alloy_js_typescript.useTSNamePolicy)().for("variable")
35
- });
36
- if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
37
- const keyword = props.var ? "var" : props.let ? "let" : "const";
38
- const type = props.type ? (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.TypeRefContext, { get children() {
39
- return [": ", (0, __alloy_js_core_jsx_runtime.createComponent)(TypeSymbolSlot, { get children() {
40
- return props.type;
41
- } })];
42
- } }) : void 0;
43
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
44
- get when() {
45
- return !!props.reflection.value;
46
- },
47
- get children() {
48
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_reflection.ReflectionClassContext.Provider, {
49
- get value() {
50
- return {
51
- reflection: props.reflection.value,
52
- override: {
53
- name: objectName.value,
54
- type: objectType.value,
55
- defaultValue: props.defaultValue?.value
56
- }
57
- };
58
- },
59
- get children() {
60
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
61
- get when() {
62
- return !!objectName.value && !!objectType.value;
63
- },
64
- get children() {
65
- return [(0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc_reflection.TSDocReflectionClass, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Declaration, {
66
- symbol: sym,
67
- get children() {
68
- return [
69
- (0, __alloy_js_core_jsx_runtime.memo)(() => props.export ? "export " : ""),
70
- (0, __alloy_js_core_jsx_runtime.memo)(() => props.default ? "default " : ""),
71
- keyword,
72
- " ",
73
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Name, {}),
74
- type,
75
- " =",
76
- " ",
77
- (0, __alloy_js_core_jsx_runtime.createComponent)(ValueTypeSymbolSlot, { get children() {
78
- return props.initializer ?? props.children ?? (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ObjectExpression, { get children() {
79
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
80
- get each() {
81
- return properties.value ?? [];
82
- },
83
- comma: true,
84
- doubleHardline: true,
85
- children: (prop) => (0, __alloy_js_core_jsx_runtime.createComponent)(TypescriptObjectProperty, { property: prop })
86
- });
87
- } });
88
- } })
89
- ];
90
- }
91
- })];
92
- }
93
- }), (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})];
94
- }
95
- });
96
- }
97
- });
98
- }
99
- /**
100
- * Generates a TypeScript object property for the given reflection class.
101
- */
102
- function TypescriptObjectProperty(props) {
103
- const [{ property }] = (0, __alloy_js_core.splitProps)(props, ["property"]);
104
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_reflection.ReflectionPropertyContext.Provider, {
105
- value: property,
106
- get children() {
107
- return [
108
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_tsdoc_reflection.TSDocReflectionProperty, {}),
109
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ObjectProperty, {
110
- get name() {
111
- return property.getNameAsString();
112
- },
113
- get value() {
114
- return require_utilities.stringifyDefaultValue(property);
115
- }
116
- }),
117
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
118
- ];
119
- }
120
- });
121
- }
122
-
123
- //#endregion
124
- exports.TypescriptObject = TypescriptObject;
@@ -1,123 +0,0 @@
1
- import { stringifyDefaultValue } from "../../../../deepkit/src/utilities.mjs";
2
- import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
3
- import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
4
- import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
5
- import { isString } from "@stryke/type-checks/is-string";
6
- import { Declaration, For, Name, Show, computed, createSymbolSlot, splitProps } from "@alloy-js/core";
7
- import { isUndefined } from "@stryke/type-checks/is-undefined";
8
- import { camelCase } from "@stryke/string-format/camel-case";
9
- import { ObjectExpression, ObjectProperty, TSSymbolFlags, TypeRefContext, createValueSymbol, useTSNamePolicy } from "@alloy-js/typescript";
10
- import { pascalCase } from "@stryke/string-format/pascal-case";
11
-
12
- //#region ../plugin-alloy/src/typescript/components/typescript-object.tsx
13
- /**
14
- * Generates a TypeScript object for the given reflection class.
15
- */
16
- function TypescriptObject(props) {
17
- if (!props.reflection?.value) return null;
18
- const objectName = computed(() => camelCase((isString(props.name) ? props.name : props.name.toString()) || props.reflection.value.getName()));
19
- const objectType = computed(() => props.type || pascalCase(props.reflection.value.getName()));
20
- const properties = computed(() => props.reflection.value.getProperties().filter((item) => !item.isIgnored() && !isUndefined(props.defaultValue?.value?.[item.getNameAsString()] ?? item.getAlias().reduce((ret, alias) => {
21
- if (isUndefined(ret) && !isUndefined(props.defaultValue?.value?.[alias])) return props.defaultValue?.value?.[alias];
22
- return ret;
23
- }, void 0) ?? item.getDefaultValue())).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? a.getNameAsString().localeCompare(b.getNameAsString()) : a.isReadonly() ? 1 : -1));
24
- const TypeSymbolSlot = createSymbolSlot();
25
- const ValueTypeSymbolSlot = createSymbolSlot();
26
- const sym = createValueSymbol(props.name, {
27
- refkeys: props.refkey,
28
- default: props.default,
29
- export: props.export,
30
- metadata: props.metadata,
31
- tsFlags: props.nullish ? TSSymbolFlags.Nullish : TSSymbolFlags.None,
32
- type: props.type ? TypeSymbolSlot.firstSymbol : void 0,
33
- namePolicy: useTSNamePolicy().for("variable")
34
- });
35
- if (!props.type) ValueTypeSymbolSlot.moveMembersTo(sym);
36
- const keyword = props.var ? "var" : props.let ? "let" : "const";
37
- const type = props.type ? createComponent(TypeRefContext, { get children() {
38
- return [": ", createComponent(TypeSymbolSlot, { get children() {
39
- return props.type;
40
- } })];
41
- } }) : void 0;
42
- return createComponent(Show, {
43
- get when() {
44
- return !!props.reflection.value;
45
- },
46
- get children() {
47
- return createComponent(ReflectionClassContext.Provider, {
48
- get value() {
49
- return {
50
- reflection: props.reflection.value,
51
- override: {
52
- name: objectName.value,
53
- type: objectType.value,
54
- defaultValue: props.defaultValue?.value
55
- }
56
- };
57
- },
58
- get children() {
59
- return [createComponent(Show, {
60
- get when() {
61
- return !!objectName.value && !!objectType.value;
62
- },
63
- get children() {
64
- return [createComponent(TSDocReflectionClass, {}), createComponent(Declaration, {
65
- symbol: sym,
66
- get children() {
67
- return [
68
- memo(() => props.export ? "export " : ""),
69
- memo(() => props.default ? "default " : ""),
70
- keyword,
71
- " ",
72
- createComponent(Name, {}),
73
- type,
74
- " =",
75
- " ",
76
- createComponent(ValueTypeSymbolSlot, { get children() {
77
- return props.initializer ?? props.children ?? createComponent(ObjectExpression, { get children() {
78
- return createComponent(For, {
79
- get each() {
80
- return properties.value ?? [];
81
- },
82
- comma: true,
83
- doubleHardline: true,
84
- children: (prop) => createComponent(TypescriptObjectProperty, { property: prop })
85
- });
86
- } });
87
- } })
88
- ];
89
- }
90
- })];
91
- }
92
- }), createIntrinsic("hbr", {})];
93
- }
94
- });
95
- }
96
- });
97
- }
98
- /**
99
- * Generates a TypeScript object property for the given reflection class.
100
- */
101
- function TypescriptObjectProperty(props) {
102
- const [{ property }] = splitProps(props, ["property"]);
103
- return createComponent(ReflectionPropertyContext.Provider, {
104
- value: property,
105
- get children() {
106
- return [
107
- createComponent(TSDocReflectionProperty, {}),
108
- createComponent(ObjectProperty, {
109
- get name() {
110
- return property.getNameAsString();
111
- },
112
- get value() {
113
- return stringifyDefaultValue(property);
114
- }
115
- }),
116
- createIntrinsic("hbr", {})
117
- ];
118
- }
119
- });
120
- }
121
-
122
- //#endregion
123
- export { TypescriptObject };
@@ -1,101 +0,0 @@
1
- const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
- let defu = require("defu");
3
- defu = require_rolldown_runtime.__toESM(defu);
4
- let __stryke_path_replace = require("@stryke/path/replace");
5
- let __stryke_convert_to_array = require("@stryke/convert/to-array");
6
- let __stryke_fs_is_file = require("@stryke/fs/is-file");
7
- let __stryke_fs_list_files = require("@stryke/fs/list-files");
8
- let __stryke_path_append = require("@stryke/path/append");
9
- let __stryke_path_is_type = require("@stryke/path/is-type");
10
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
11
- let automd = require("automd");
12
- let c12 = require("c12");
13
- let markdown_toc = require("markdown-toc");
14
- markdown_toc = require_rolldown_runtime.__toESM(markdown_toc);
15
-
16
- //#region ../plugin-automd/src/index.ts
17
- /**
18
- * AutoMD Plugin
19
- *
20
- * @remarks
21
- * A Powerlines plugin to use the AutoMD markdown transformer during the prepare task.
22
- *
23
- * @see https://automd.unjs.io/
24
- *
25
- * @param options - The plugin options.
26
- * @returns A Powerlines plugin instance.
27
- */
28
- const plugin = (options = {}) => {
29
- return {
30
- name: "automd",
31
- async config() {
32
- const config = await (0, automd.loadConfig)((0, __stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot), options);
33
- if (!config.prefix || !Array.isArray(config.prefix)) config.prefix = (0, __stryke_convert_to_array.toArray)(config.prefix ?? []);
34
- if (!config.prefix.includes("automd")) config.prefix.push("automd");
35
- if (!config.prefix.includes("powerlines")) config.prefix.push("powerlines");
36
- return { automd: (0, defu.default)(config ?? {}, {
37
- configFile: options.configFile,
38
- allowIssues: true,
39
- dir: this.config.projectRoot,
40
- watch: false,
41
- input: "README.md",
42
- toc: {
43
- maxDepth: 6,
44
- bullets: "-"
45
- }
46
- }) };
47
- },
48
- async configResolved() {
49
- if (this.config.framework && !(0, __stryke_convert_to_array.toArray)(this.config.automd.prefix).includes(this.config.framework)) this.config.automd.prefix = (0, __stryke_convert_to_array.toArray)(this.config.automd.prefix).concat(this.config.framework);
50
- if (this.config.automd.configFile) {
51
- const { config } = await (0, c12.loadConfig)({
52
- cwd: this.config.automd.dir,
53
- configFile: this.config.automd.configFile,
54
- defaults: {
55
- ignore: [
56
- "**/node_modules",
57
- "**/dist",
58
- "**/.*"
59
- ],
60
- dir: this.config.automd.dir
61
- }
62
- });
63
- this.config.automd = (0, automd.resolveConfig)((0, defu.default)(this.config.automd, {
64
- ...config,
65
- prefix: (0, __stryke_convert_to_array.toArray)(config.prefix ?? [])
66
- }));
67
- }
68
- this.config.automd.input = (await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(async (input) => {
69
- if (input.includes("*")) return (0, __stryke_fs_list_files.listFiles)((0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot), { ignore: this.config.automd.ignore });
70
- return (0, __stryke_path_is_type.isAbsolutePath)(input) ? input : (0, __stryke_path_append.appendPath)(input, this.config.projectRoot);
71
- }))).flat();
72
- if (this.config.automd.output && !(0, __stryke_path_is_type.isAbsolutePath)(this.config.automd.output)) this.config.automd.output = (0, __stryke_path_append.appendPath)(this.config.automd.output, this.config.projectRoot);
73
- this.config.automd.generators ??= {};
74
- if (this.config.automd.toc !== false) this.config.automd.generators.toc ??= {
75
- name: "toc",
76
- generate: (ctx) => {
77
- const opts = this.config.automd.toc ?? {};
78
- return { contents: (0, markdown_toc.default)(ctx.block.md, {
79
- ...opts,
80
- maxdepth: opts.maxDepth,
81
- first1: opts.firstH1
82
- }).content };
83
- }
84
- };
85
- },
86
- async docs() {
87
- await Promise.all((0, __stryke_convert_to_array.toArray)(this.config.automd.input).map(async (input) => {
88
- const contents = await this.fs.read(input);
89
- if (contents) {
90
- const result = await (0, automd.transform)(contents, this.config.automd);
91
- if (result.hasIssues && this.config.automd.allowIssues === false) throw new Error(`AutoMD found issues in file "${input}". Please resolve the issues or set \`allowIssues\` to true in the plugin configuration to ignore them.`);
92
- if (result.hasChanged) await this.fs.write((0, __stryke_path_append.appendPath)(this.config.automd.output ? (0, __stryke_fs_is_file.isDirectory)(this.config.automd.output) ? (0, __stryke_path_replace.replacePath)(input, this.config.automd.output) : this.config.automd.output : input, this.config.projectRoot), result.contents);
93
- }
94
- }));
95
- }
96
- };
97
- };
98
- var src_default = plugin;
99
-
100
- //#endregion
101
- exports.default = src_default;