@powerlines/plugin-date 0.12.142 → 0.12.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 (198) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/components/date-fns.cjs +527 -0
  3. package/dist/components/date-fns.d.cts +13 -0
  4. package/dist/components/date-fns.d.mts +13 -0
  5. package/dist/components/date-fns.mjs +527 -0
  6. package/dist/components/dayjs.cjs +472 -0
  7. package/dist/components/dayjs.d.cts +13 -0
  8. package/dist/components/dayjs.d.mts +13 -0
  9. package/dist/components/dayjs.mjs +472 -0
  10. package/dist/components/index.cjs +4 -0
  11. package/dist/components/index.d.cts +4 -0
  12. package/dist/components/index.d.mts +4 -0
  13. package/dist/components/index.mjs +6 -0
  14. package/dist/components/luxon.cjs +476 -0
  15. package/dist/components/luxon.d.cts +13 -0
  16. package/dist/components/luxon.d.mts +13 -0
  17. package/dist/components/luxon.mjs +476 -0
  18. package/dist/components/moment.cjs +462 -0
  19. package/dist/components/moment.d.cts +13 -0
  20. package/dist/components/moment.d.mts +13 -0
  21. package/dist/components/moment.mjs +462 -0
  22. package/dist/deepkit/schemas/reflection.cjs +3998 -0
  23. package/dist/deepkit/schemas/reflection.d.cts +1560 -0
  24. package/dist/deepkit/schemas/reflection.d.mts +1560 -0
  25. package/dist/deepkit/schemas/reflection.mjs +3996 -0
  26. package/dist/deepkit/schemas/reflection2.cjs +4112 -0
  27. package/dist/deepkit/schemas/reflection2.mjs +4110 -0
  28. package/dist/deepkit/src/capnp.cjs +913 -0
  29. package/dist/deepkit/src/capnp.mjs +911 -0
  30. package/dist/deepkit/src/esbuild-plugin.cjs +47 -0
  31. package/dist/deepkit/src/esbuild-plugin.mjs +46 -0
  32. package/dist/deepkit/src/reflect-type.cjs +22 -0
  33. package/dist/deepkit/src/reflect-type.mjs +20 -0
  34. package/dist/deepkit/src/resolve-reflections.cjs +16 -0
  35. package/dist/deepkit/src/resolve-reflections.mjs +15 -0
  36. package/dist/deepkit/src/transformer.cjs +52 -0
  37. package/dist/deepkit/src/transformer.mjs +49 -0
  38. package/dist/deepkit/src/transpile.cjs +29 -0
  39. package/dist/deepkit/src/transpile.mjs +27 -0
  40. package/dist/deepkit/src/types.d.cts +10 -0
  41. package/dist/deepkit/src/types.d.mts +10 -0
  42. package/dist/deepkit/src/utilities.cjs +66 -0
  43. package/dist/deepkit/src/utilities.mjs +65 -0
  44. package/dist/index.cjs +17 -13844
  45. package/dist/index.d.cts +9 -40
  46. package/dist/index.d.mts +9 -40
  47. package/dist/index.mjs +6 -13800
  48. package/dist/plugin-alloy/src/core/components/output.cjs +38 -0
  49. package/dist/plugin-alloy/src/core/components/output.mjs +37 -0
  50. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +20 -0
  51. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +19 -0
  52. package/dist/plugin-alloy/src/core/components/source-file.cjs +60 -0
  53. package/dist/plugin-alloy/src/core/components/source-file.mjs +58 -0
  54. package/dist/plugin-alloy/src/core/contexts/context.cjs +60 -0
  55. package/dist/plugin-alloy/src/core/contexts/context.mjs +54 -0
  56. package/dist/plugin-alloy/src/core/contexts/index.cjs +2 -0
  57. package/dist/plugin-alloy/src/core/contexts/index.mjs +4 -0
  58. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +46 -0
  59. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +42 -0
  60. package/dist/plugin-alloy/src/helpers/refkey.cjs +16 -0
  61. package/dist/plugin-alloy/src/helpers/refkey.mjs +15 -0
  62. package/dist/plugin-alloy/src/index.cjs +90 -0
  63. package/dist/plugin-alloy/src/index.mjs +88 -0
  64. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +7 -0
  65. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +9 -0
  66. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +5 -0
  67. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +7 -0
  68. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +17 -0
  69. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +17 -0
  70. package/dist/plugin-alloy/src/types/components.d.mts +3 -0
  71. package/dist/plugin-alloy/src/types/index.d.mts +2 -0
  72. package/dist/plugin-alloy/src/types/plugin.d.cts +37 -0
  73. package/dist/plugin-alloy/src/types/plugin.d.mts +37 -0
  74. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +47 -0
  75. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +46 -0
  76. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +75 -0
  77. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +73 -0
  78. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +359 -0
  79. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +350 -0
  80. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +143 -0
  81. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +140 -0
  82. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +53 -0
  83. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +52 -0
  84. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +94 -0
  85. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +93 -0
  86. package/dist/plugin-automd/src/index.cjs +101 -0
  87. package/dist/plugin-automd/src/index.mjs +98 -0
  88. package/dist/plugin-automd/src/types/plugin.d.cts +38 -0
  89. package/dist/plugin-automd/src/types/plugin.d.mts +40 -0
  90. package/dist/plugin-automd/src/types/toc.d.cts +33 -0
  91. package/dist/plugin-automd/src/types/toc.d.mts +33 -0
  92. package/dist/plugin-babel/src/helpers/ast-utils.cjs +10 -0
  93. package/dist/plugin-babel/src/helpers/ast-utils.mjs +9 -0
  94. package/dist/plugin-babel/src/helpers/create-plugin.cjs +41 -0
  95. package/dist/plugin-babel/src/helpers/create-plugin.mjs +39 -0
  96. package/dist/plugin-babel/src/helpers/filters.cjs +23 -0
  97. package/dist/plugin-babel/src/helpers/filters.mjs +21 -0
  98. package/dist/plugin-babel/src/helpers/index.cjs +5 -0
  99. package/dist/plugin-babel/src/helpers/index.mjs +7 -0
  100. package/dist/plugin-babel/src/helpers/module-helpers.cjs +38 -0
  101. package/dist/plugin-babel/src/helpers/module-helpers.mjs +35 -0
  102. package/dist/plugin-babel/src/helpers/options.cjs +50 -0
  103. package/dist/plugin-babel/src/helpers/options.mjs +47 -0
  104. package/dist/plugin-babel/src/index.cjs +91 -0
  105. package/dist/plugin-babel/src/index.mjs +89 -0
  106. package/dist/plugin-babel/src/types/index.d.mts +1 -0
  107. package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
  108. package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
  109. package/dist/plugin-env/src/babel/index.cjs +1 -0
  110. package/dist/plugin-env/src/babel/index.mjs +3 -0
  111. package/dist/plugin-env/src/babel/plugin.cjs +121 -0
  112. package/dist/plugin-env/src/babel/plugin.mjs +119 -0
  113. package/dist/plugin-env/src/components/docs.cjs +9 -0
  114. package/dist/plugin-env/src/components/docs.mjs +11 -0
  115. package/dist/plugin-env/src/components/env.cjs +487 -0
  116. package/dist/plugin-env/src/components/env.mjs +484 -0
  117. package/dist/plugin-env/src/components/index.cjs +2 -0
  118. package/dist/plugin-env/src/components/index.mjs +4 -0
  119. package/dist/plugin-env/src/helpers/automd-generator.cjs +22 -0
  120. package/dist/plugin-env/src/helpers/automd-generator.mjs +21 -0
  121. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +55 -0
  122. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +54 -0
  123. package/dist/plugin-env/src/helpers/index.cjs +6 -0
  124. package/dist/plugin-env/src/helpers/index.mjs +8 -0
  125. package/dist/plugin-env/src/helpers/load.cjs +83 -0
  126. package/dist/plugin-env/src/helpers/load.mjs +80 -0
  127. package/dist/plugin-env/src/helpers/persistence.cjs +199 -0
  128. package/dist/plugin-env/src/helpers/persistence.mjs +188 -0
  129. package/dist/plugin-env/src/helpers/reflect.cjs +125 -0
  130. package/dist/plugin-env/src/helpers/reflect.mjs +117 -0
  131. package/dist/plugin-env/src/helpers/source-file-env.cjs +24 -0
  132. package/dist/plugin-env/src/helpers/source-file-env.mjs +23 -0
  133. package/dist/plugin-env/src/helpers/template-helpers.cjs +2 -0
  134. package/dist/plugin-env/src/helpers/template-helpers.mjs +4 -0
  135. package/dist/plugin-env/src/index.cjs +172 -0
  136. package/dist/plugin-env/src/index.mjs +170 -0
  137. package/dist/plugin-env/src/types/plugin.d.cts +151 -0
  138. package/dist/plugin-env/src/types/plugin.d.mts +153 -0
  139. package/dist/plugin-env/src/types/runtime.d.cts +792 -0
  140. package/dist/plugin-env/src/types/runtime.d.mts +792 -0
  141. package/dist/powerlines/src/lib/build/esbuild.cjs +102 -0
  142. package/dist/powerlines/src/lib/build/esbuild.mjs +100 -0
  143. package/dist/powerlines/src/lib/entry.cjs +12 -0
  144. package/dist/powerlines/src/lib/entry.mjs +14 -0
  145. package/dist/powerlines/src/lib/logger.cjs +41 -0
  146. package/dist/powerlines/src/lib/logger.mjs +39 -0
  147. package/dist/powerlines/src/lib/utilities/bundle.cjs +35 -0
  148. package/dist/powerlines/src/lib/utilities/bundle.mjs +34 -0
  149. package/dist/powerlines/src/lib/utilities/file-header.cjs +22 -0
  150. package/dist/powerlines/src/lib/utilities/file-header.mjs +21 -0
  151. package/dist/powerlines/src/lib/utilities/resolve.cjs +30 -0
  152. package/dist/powerlines/src/lib/utilities/resolve.mjs +29 -0
  153. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
  154. package/dist/powerlines/src/plugin-utils/paths.mjs +3 -0
  155. package/dist/powerlines/src/types/babel.d.cts +22 -0
  156. package/dist/powerlines/src/types/babel.d.mts +22 -0
  157. package/dist/powerlines/src/types/build.d.cts +145 -0
  158. package/dist/powerlines/src/types/build.d.mts +145 -0
  159. package/dist/powerlines/src/types/commands.d.cts +8 -0
  160. package/dist/powerlines/src/types/commands.d.mts +9 -0
  161. package/dist/powerlines/src/types/config.d.cts +387 -0
  162. package/dist/powerlines/src/types/config.d.mts +388 -0
  163. package/dist/powerlines/src/types/context.d.cts +414 -0
  164. package/dist/powerlines/src/types/context.d.mts +416 -0
  165. package/dist/powerlines/src/types/fs.d.cts +486 -0
  166. package/dist/powerlines/src/types/fs.d.mts +486 -0
  167. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  168. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  169. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  170. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  171. package/dist/powerlines/src/types/resolved.d.mts +82 -0
  172. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  173. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  174. package/dist/types/index.cjs +0 -3
  175. package/dist/types/index.d.cts +2 -3
  176. package/dist/types/index.d.mts +2 -3
  177. package/dist/types/index.mjs +0 -4
  178. package/dist/types/plugin.cjs +0 -1
  179. package/dist/types/plugin.d.cts +42 -1
  180. package/dist/types/plugin.d.mts +42 -1
  181. package/dist/types/plugin.mjs +0 -2
  182. package/dist/types/runtime.cjs +0 -1
  183. package/dist/types/runtime.d.cts +710 -1
  184. package/dist/types/runtime.d.mts +710 -1
  185. package/dist/types/runtime.mjs +0 -2
  186. package/package.json +5 -5
  187. package/dist/index-CA4VvAY_.d.mts +0 -1
  188. package/dist/index-CmCelmEL.d.cts +0 -1
  189. package/dist/plugin-BUfZ6cT1.d.cts +0 -4432
  190. package/dist/plugin-CuNMs4r-.d.mts +0 -4434
  191. package/dist/plugin-DHXHjv16.cjs +0 -0
  192. package/dist/plugin-ufqFO5xS.mjs +0 -1
  193. package/dist/runtime-B7WoCmC4.mjs +0 -1
  194. package/dist/runtime-B8LVkjWB.d.cts +0 -711
  195. package/dist/runtime-CiYq8JJ6.d.mts +0 -711
  196. package/dist/runtime-D4zTdSwv.cjs +0 -0
  197. package/dist/types-BReKsBV6.mjs +0 -1
  198. package/dist/types-CBTc19th.cjs +0 -0
@@ -0,0 +1,143 @@
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 react_jsx_runtime = require("react/jsx-runtime");
7
+ let __stryke_path_append = require("@stryke/path/append");
8
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
9
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
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 /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.SourceFileContext.Provider, {
41
+ value: { scope },
42
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Scope, {
43
+ value: scope,
44
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_source_file.SourceFile, {
45
+ ...rest,
46
+ path: modulePath,
47
+ header: header ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypescriptFileHeader, {
48
+ hashbang,
49
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypescriptFileHeaderImports, {
50
+ imports,
51
+ scope
52
+ })
53
+ }),
54
+ filetype: tsx ? "tsx" : "typescript",
55
+ children
56
+ })
57
+ })
58
+ });
59
+ }
60
+ /**
61
+ * Renders the header for a Powerlines Typescript source file.
62
+ *
63
+ * @param props - The properties for the source file header.
64
+ * @returns The rendered source file header.
65
+ */
66
+ function TypescriptFileHeader(props) {
67
+ const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
68
+ const context = require_context.usePowerlines();
69
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
70
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
71
+ when: Boolean(hashbang),
72
+ 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", {})]
73
+ }),
74
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
75
+ when: Boolean(header),
76
+ children: [header, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})]
77
+ }),
78
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
79
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
80
+ when: Boolean(disableEslint),
81
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, {
82
+ variant: "slash-star",
83
+ children: "eslint-disable"
84
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})]
85
+ }),
86
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
87
+ when: Boolean(disablePrettier),
88
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, {
89
+ variant: "slash-star",
90
+ children: "prettier-ignore"
91
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})]
92
+ }),
93
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
94
+ when: Boolean(disableBiome),
95
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, { children: "biome-ignore lint: disable" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})]
96
+ }),
97
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
98
+ when: Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome),
99
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})
100
+ }),
101
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
102
+ when: Boolean(children),
103
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})] })
104
+ }),
105
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_single_line_comment.SingleLineComment, { children: __alloy_js_core.code`Generated by ${(0, __stryke_string_format_title_case.titleCase)(context?.config.framework) || "Powerlines"}` }),
106
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
107
+ /* @__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 by the "prepare" command` }),
108
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})
109
+ ] });
110
+ }
111
+ /**
112
+ * Renders the header for a Powerlines Typescript source file.
113
+ *
114
+ * @param props - The properties for the source file header.
115
+ * @returns The rendered source file header.
116
+ */
117
+ function TypescriptFileHeaderImports(props) {
118
+ const { imports } = props;
119
+ const context = require_context.usePowerlines();
120
+ const sourceFile = (0, __alloy_js_typescript.useSourceFile)();
121
+ const scope = props.scope ?? sourceFile.scope;
122
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
123
+ when: scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0,
124
+ children: [
125
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
126
+ when: !!imports && Object.keys(imports).length > 0,
127
+ children: 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$1, imported]) => {
128
+ return __alloy_js_core.code`import ${imported === null ? "" : imported.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (imported.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && imported.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (imported.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${imported.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} from "${module$1}";`;
129
+ })
130
+ }),
131
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
132
+ when: scope.importedModules.size > 0,
133
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.ImportStatements, { records: scope.importedModules })
134
+ }),
135
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})
136
+ ]
137
+ });
138
+ }
139
+
140
+ //#endregion
141
+ exports.TypescriptFile = TypescriptFile;
142
+ exports.TypescriptFileHeader = TypescriptFileHeader;
143
+ exports.TypescriptFileHeaderImports = TypescriptFileHeaderImports;
@@ -0,0 +1,140 @@
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 { Scope, Show, SourceDirectoryContext, code, splitProps, useContext, useScope } from "@alloy-js/core";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { appendPath } from "@stryke/path/append";
7
+ import { titleCase } from "@stryke/string-format/title-case";
8
+ import { isString } from "@stryke/type-checks/is-string";
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 /* @__PURE__ */ jsx(SourceFileContext$1.Provider, {
40
+ value: { scope },
41
+ children: /* @__PURE__ */ jsx(Scope, {
42
+ value: scope,
43
+ children: /* @__PURE__ */ jsx(SourceFile, {
44
+ ...rest,
45
+ path: modulePath,
46
+ header: header ?? /* @__PURE__ */ jsx(TypescriptFileHeader, {
47
+ hashbang,
48
+ children: /* @__PURE__ */ jsx(TypescriptFileHeaderImports, {
49
+ imports,
50
+ scope
51
+ })
52
+ }),
53
+ filetype: tsx ? "tsx" : "typescript",
54
+ children
55
+ })
56
+ })
57
+ });
58
+ }
59
+ /**
60
+ * Renders the header for a Powerlines Typescript source file.
61
+ *
62
+ * @param props - The properties for the source file header.
63
+ * @returns The rendered source file header.
64
+ */
65
+ function TypescriptFileHeader(props) {
66
+ const { header, hashbang, disableEslint = true, disableBiome = true, disablePrettier = false, children } = props;
67
+ const context = usePowerlines();
68
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
69
+ /* @__PURE__ */ jsxs(Show, {
70
+ when: Boolean(hashbang),
71
+ children: [hashbang === true ? code`#!/usr/bin/env ${context?.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node` : hashbang, /* @__PURE__ */ jsx("hbr", {})]
72
+ }),
73
+ /* @__PURE__ */ jsxs(Show, {
74
+ when: Boolean(header),
75
+ children: [header, /* @__PURE__ */ jsx("hbr", {})]
76
+ }),
77
+ /* @__PURE__ */ jsx("hbr", {}),
78
+ /* @__PURE__ */ jsxs(Show, {
79
+ when: Boolean(disableEslint),
80
+ children: [/* @__PURE__ */ jsx(SingleLineComment, {
81
+ variant: "slash-star",
82
+ children: "eslint-disable"
83
+ }), /* @__PURE__ */ jsx("hbr", {})]
84
+ }),
85
+ /* @__PURE__ */ jsxs(Show, {
86
+ when: Boolean(disablePrettier),
87
+ children: [/* @__PURE__ */ jsx(SingleLineComment, {
88
+ variant: "slash-star",
89
+ children: "prettier-ignore"
90
+ }), /* @__PURE__ */ jsx("hbr", {})]
91
+ }),
92
+ /* @__PURE__ */ jsxs(Show, {
93
+ when: Boolean(disableBiome),
94
+ children: [/* @__PURE__ */ jsx(SingleLineComment, { children: "biome-ignore lint: disable" }), /* @__PURE__ */ jsx("hbr", {})]
95
+ }),
96
+ /* @__PURE__ */ jsx(Show, {
97
+ when: Boolean(disableEslint) || Boolean(disablePrettier) || Boolean(disableBiome),
98
+ children: /* @__PURE__ */ jsx("hbr", {})
99
+ }),
100
+ /* @__PURE__ */ jsx(Show, {
101
+ when: Boolean(children),
102
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [children, /* @__PURE__ */ jsx("hbr", {})] })
103
+ }),
104
+ /* @__PURE__ */ jsx(SingleLineComment, { children: code`Generated by ${titleCase(context?.config.framework) || "Powerlines"}` }),
105
+ /* @__PURE__ */ jsx("hbr", {}),
106
+ /* @__PURE__ */ jsx(SingleLineComment, { children: code`NOTE: Do not edit this file manually - it will be overwritten automatically by the "prepare" command` }),
107
+ /* @__PURE__ */ jsx("hbr", {})
108
+ ] });
109
+ }
110
+ /**
111
+ * Renders the header for a Powerlines Typescript source file.
112
+ *
113
+ * @param props - The properties for the source file header.
114
+ * @returns The rendered source file header.
115
+ */
116
+ function TypescriptFileHeaderImports(props) {
117
+ const { imports } = props;
118
+ const context = usePowerlines();
119
+ const sourceFile = useSourceFile();
120
+ const scope = props.scope ?? sourceFile.scope;
121
+ return /* @__PURE__ */ jsxs(Show, {
122
+ when: scope.importedModules.size > 0 || !!imports && Object.keys(imports).length > 0,
123
+ children: [
124
+ /* @__PURE__ */ jsx(Show, {
125
+ when: !!imports && Object.keys(imports).length > 0,
126
+ children: 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]) => {
127
+ 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}";`;
128
+ })
129
+ }),
130
+ /* @__PURE__ */ jsx(Show, {
131
+ when: scope.importedModules.size > 0,
132
+ children: /* @__PURE__ */ jsx(ImportStatements, { records: scope.importedModules })
133
+ }),
134
+ /* @__PURE__ */ jsx("hbr", {})
135
+ ]
136
+ });
137
+ }
138
+
139
+ //#endregion
140
+ export { TypescriptFile, TypescriptFileHeader, TypescriptFileHeaderImports };
@@ -0,0 +1,53 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.cjs');
2
+ const require_reflection = require('../../core/contexts/reflection.cjs');
3
+ const require_tsdoc_reflection = require('./tsdoc-reflection.cjs');
4
+ let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
5
+ let __alloy_js_core = require("@alloy-js/core");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
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 /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_reflection.ReflectionClassContext.Provider, {
20
+ value: { reflection },
21
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionClass, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.InterfaceDeclaration, {
22
+ export: true,
23
+ name: interfaceName.value,
24
+ ...rest,
25
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.For, {
26
+ each: properties,
27
+ doubleHardline: true,
28
+ semicolon: true,
29
+ children: (prop) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypescriptInterfaceProperty, { property: prop })
30
+ })
31
+ })]
32
+ });
33
+ }
34
+ /**
35
+ * Generates a TypeScript interface property for the given reflection class.
36
+ */
37
+ function TypescriptInterfaceProperty(props) {
38
+ const [{ property }, rest] = (0, __alloy_js_core.splitProps)(props, ["property"]);
39
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_reflection.ReflectionPropertyContext.Provider, {
40
+ value: property,
41
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionProperty, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.InterfaceMember, {
42
+ name: property.getNameAsString(),
43
+ readonly: property.isReadonly(),
44
+ optional: property.isOptional(),
45
+ nullish: property.isNullable(),
46
+ type: (0, __powerlines_deepkit_vendor_type.stringifyType)(property.getType()),
47
+ ...rest
48
+ })]
49
+ });
50
+ }
51
+
52
+ //#endregion
53
+ exports.TypeScriptInterface = TypeScriptInterface;
@@ -0,0 +1,52 @@
1
+ import { ReflectionClassContext, ReflectionPropertyContext } from "../../core/contexts/reflection.mjs";
2
+ import { TSDocReflectionClass, TSDocReflectionProperty } from "./tsdoc-reflection.mjs";
3
+ import { stringifyType } from "@powerlines/deepkit/vendor/type";
4
+ import { For, computed, splitProps } from "@alloy-js/core";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { isString } from "@stryke/type-checks/is-string";
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 /* @__PURE__ */ jsxs(ReflectionClassContext.Provider, {
19
+ value: { reflection },
20
+ children: [/* @__PURE__ */ jsx(TSDocReflectionClass, {}), /* @__PURE__ */ jsx(InterfaceDeclaration, {
21
+ export: true,
22
+ name: interfaceName.value,
23
+ ...rest,
24
+ children: /* @__PURE__ */ jsx(For, {
25
+ each: properties,
26
+ doubleHardline: true,
27
+ semicolon: true,
28
+ children: (prop) => /* @__PURE__ */ jsx(TypescriptInterfaceProperty, { property: prop })
29
+ })
30
+ })]
31
+ });
32
+ }
33
+ /**
34
+ * Generates a TypeScript interface property for the given reflection class.
35
+ */
36
+ function TypescriptInterfaceProperty(props) {
37
+ const [{ property }, rest] = splitProps(props, ["property"]);
38
+ return /* @__PURE__ */ jsxs(ReflectionPropertyContext.Provider, {
39
+ value: property,
40
+ children: [/* @__PURE__ */ jsx(TSDocReflectionProperty, {}), /* @__PURE__ */ jsx(InterfaceMember, {
41
+ name: property.getNameAsString(),
42
+ readonly: property.isReadonly(),
43
+ optional: property.isOptional(),
44
+ nullish: property.isNullable(),
45
+ type: stringifyType(property.getType()),
46
+ ...rest
47
+ })]
48
+ });
49
+ }
50
+
51
+ //#endregion
52
+ export { TypeScriptInterface };
@@ -0,0 +1,94 @@
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 = require("@alloy-js/core");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
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 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_typescript.TypeRefContext, { children: [": ", /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypeSymbolSlot, { children: props.type })] }) : void 0;
39
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
40
+ when: !!props.reflection.value,
41
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_reflection.ReflectionClassContext.Provider, {
42
+ value: {
43
+ reflection: props.reflection.value,
44
+ override: {
45
+ name: objectName.value,
46
+ type: objectType.value,
47
+ defaultValue: props.defaultValue?.value
48
+ }
49
+ },
50
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
51
+ when: !!objectName.value && !!objectType.value,
52
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionClass, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Declaration, {
53
+ symbol: sym,
54
+ children: [
55
+ props.export ? "export " : "",
56
+ props.default ? "default " : "",
57
+ keyword,
58
+ " ",
59
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Name, {}),
60
+ type,
61
+ " =",
62
+ " ",
63
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ValueTypeSymbolSlot, { children: props.initializer ?? props.children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.ObjectExpression, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.For, {
64
+ each: properties.value ?? [],
65
+ comma: true,
66
+ doubleHardline: true,
67
+ children: (prop) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TypescriptObjectProperty, { property: prop })
68
+ }) }) })
69
+ ]
70
+ })]
71
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})]
72
+ })
73
+ });
74
+ }
75
+ /**
76
+ * Generates a TypeScript object property for the given reflection class.
77
+ */
78
+ function TypescriptObjectProperty(props) {
79
+ const [{ property }] = (0, __alloy_js_core.splitProps)(props, ["property"]);
80
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_reflection.ReflectionPropertyContext.Provider, {
81
+ value: property,
82
+ children: [
83
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc_reflection.TSDocReflectionProperty, {}),
84
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.ObjectProperty, {
85
+ name: property.getNameAsString(),
86
+ value: require_utilities.stringifyDefaultValue(property)
87
+ }),
88
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})
89
+ ]
90
+ });
91
+ }
92
+
93
+ //#endregion
94
+ exports.TypescriptObject = TypescriptObject;
@@ -0,0 +1,93 @@
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 { Declaration, For, Name, Show, computed, createSymbolSlot, splitProps } from "@alloy-js/core";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { isString } from "@stryke/type-checks/is-string";
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 ? /* @__PURE__ */ jsxs(TypeRefContext, { children: [": ", /* @__PURE__ */ jsx(TypeSymbolSlot, { children: props.type })] }) : void 0;
38
+ return /* @__PURE__ */ jsx(Show, {
39
+ when: !!props.reflection.value,
40
+ children: /* @__PURE__ */ jsxs(ReflectionClassContext.Provider, {
41
+ value: {
42
+ reflection: props.reflection.value,
43
+ override: {
44
+ name: objectName.value,
45
+ type: objectType.value,
46
+ defaultValue: props.defaultValue?.value
47
+ }
48
+ },
49
+ children: [/* @__PURE__ */ jsxs(Show, {
50
+ when: !!objectName.value && !!objectType.value,
51
+ children: [/* @__PURE__ */ jsx(TSDocReflectionClass, {}), /* @__PURE__ */ jsxs(Declaration, {
52
+ symbol: sym,
53
+ children: [
54
+ props.export ? "export " : "",
55
+ props.default ? "default " : "",
56
+ keyword,
57
+ " ",
58
+ /* @__PURE__ */ jsx(Name, {}),
59
+ type,
60
+ " =",
61
+ " ",
62
+ /* @__PURE__ */ jsx(ValueTypeSymbolSlot, { children: props.initializer ?? props.children ?? /* @__PURE__ */ jsx(ObjectExpression, { children: /* @__PURE__ */ jsx(For, {
63
+ each: properties.value ?? [],
64
+ comma: true,
65
+ doubleHardline: true,
66
+ children: (prop) => /* @__PURE__ */ jsx(TypescriptObjectProperty, { property: prop })
67
+ }) }) })
68
+ ]
69
+ })]
70
+ }), /* @__PURE__ */ jsx("hbr", {})]
71
+ })
72
+ });
73
+ }
74
+ /**
75
+ * Generates a TypeScript object property for the given reflection class.
76
+ */
77
+ function TypescriptObjectProperty(props) {
78
+ const [{ property }] = splitProps(props, ["property"]);
79
+ return /* @__PURE__ */ jsxs(ReflectionPropertyContext.Provider, {
80
+ value: property,
81
+ children: [
82
+ /* @__PURE__ */ jsx(TSDocReflectionProperty, {}),
83
+ /* @__PURE__ */ jsx(ObjectProperty, {
84
+ name: property.getNameAsString(),
85
+ value: stringifyDefaultValue(property)
86
+ }),
87
+ /* @__PURE__ */ jsx("hbr", {})
88
+ ]
89
+ });
90
+ }
91
+
92
+ //#endregion
93
+ export { TypescriptObject };