@gtkx/codegen 0.21.0

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 (340) hide show
  1. package/LICENSE +373 -0
  2. package/dist/dsl/context.d.ts +104 -0
  3. package/dist/dsl/context.d.ts.map +1 -0
  4. package/dist/dsl/context.js +140 -0
  5. package/dist/dsl/context.js.map +1 -0
  6. package/dist/dsl/emit.d.ts +28 -0
  7. package/dist/dsl/emit.d.ts.map +1 -0
  8. package/dist/dsl/emit.js +41 -0
  9. package/dist/dsl/emit.js.map +1 -0
  10. package/dist/dsl/identifier.d.ts +28 -0
  11. package/dist/dsl/identifier.d.ts.map +1 -0
  12. package/dist/dsl/identifier.js +45 -0
  13. package/dist/dsl/identifier.js.map +1 -0
  14. package/dist/dsl/imports.d.ts +58 -0
  15. package/dist/dsl/imports.d.ts.map +1 -0
  16. package/dist/dsl/imports.js +107 -0
  17. package/dist/dsl/imports.js.map +1 -0
  18. package/dist/dsl/module.d.ts +53 -0
  19. package/dist/dsl/module.d.ts.map +1 -0
  20. package/dist/dsl/module.js +76 -0
  21. package/dist/dsl/module.js.map +1 -0
  22. package/dist/ffi/pipeline.d.ts +19 -0
  23. package/dist/ffi/pipeline.d.ts.map +1 -0
  24. package/dist/ffi/pipeline.js +107 -0
  25. package/dist/ffi/pipeline.js.map +1 -0
  26. package/dist/fingerprint.d.ts +30 -0
  27. package/dist/fingerprint.d.ts.map +1 -0
  28. package/dist/fingerprint.js +33 -0
  29. package/dist/fingerprint.js.map +1 -0
  30. package/dist/gi-store.d.ts +34 -0
  31. package/dist/gi-store.d.ts.map +1 -0
  32. package/dist/gi-store.js +154 -0
  33. package/dist/gi-store.js.map +1 -0
  34. package/dist/gir/boxed.d.ts +66 -0
  35. package/dist/gir/boxed.d.ts.map +1 -0
  36. package/dist/gir/boxed.js +49 -0
  37. package/dist/gir/boxed.js.map +1 -0
  38. package/dist/gir/callback.d.ts +15 -0
  39. package/dist/gir/callback.d.ts.map +1 -0
  40. package/dist/gir/callback.js +17 -0
  41. package/dist/gir/callback.js.map +1 -0
  42. package/dist/gir/class.d.ts +49 -0
  43. package/dist/gir/class.d.ts.map +1 -0
  44. package/dist/gir/class.js +42 -0
  45. package/dist/gir/class.js.map +1 -0
  46. package/dist/gir/enum.d.ts +39 -0
  47. package/dist/gir/enum.d.ts.map +1 -0
  48. package/dist/gir/enum.js +24 -0
  49. package/dist/gir/enum.js.map +1 -0
  50. package/dist/gir/field.d.ts +27 -0
  51. package/dist/gir/field.d.ts.map +1 -0
  52. package/dist/gir/field.js +19 -0
  53. package/dist/gir/field.js.map +1 -0
  54. package/dist/gir/function.d.ts +47 -0
  55. package/dist/gir/function.d.ts.map +1 -0
  56. package/dist/gir/function.js +28 -0
  57. package/dist/gir/function.js.map +1 -0
  58. package/dist/gir/namespace.d.ts +65 -0
  59. package/dist/gir/namespace.d.ts.map +1 -0
  60. package/dist/gir/namespace.js +60 -0
  61. package/dist/gir/namespace.js.map +1 -0
  62. package/dist/gir/parameter.d.ts +82 -0
  63. package/dist/gir/parameter.d.ts.map +1 -0
  64. package/dist/gir/parameter.js +66 -0
  65. package/dist/gir/parameter.js.map +1 -0
  66. package/dist/gir/parse.d.ts +78 -0
  67. package/dist/gir/parse.d.ts.map +1 -0
  68. package/dist/gir/parse.js +155 -0
  69. package/dist/gir/parse.js.map +1 -0
  70. package/dist/gir/primitives.d.ts +36 -0
  71. package/dist/gir/primitives.d.ts.map +1 -0
  72. package/dist/gir/primitives.js +109 -0
  73. package/dist/gir/primitives.js.map +1 -0
  74. package/dist/gir/property.d.ts +29 -0
  75. package/dist/gir/property.d.ts.map +1 -0
  76. package/dist/gir/property.js +16 -0
  77. package/dist/gir/property.js.map +1 -0
  78. package/dist/gir/qualified-name.d.ts +37 -0
  79. package/dist/gir/qualified-name.d.ts.map +1 -0
  80. package/dist/gir/qualified-name.js +39 -0
  81. package/dist/gir/qualified-name.js.map +1 -0
  82. package/dist/gir/qualify.d.ts +32 -0
  83. package/dist/gir/qualify.d.ts.map +1 -0
  84. package/dist/gir/qualify.js +60 -0
  85. package/dist/gir/qualify.js.map +1 -0
  86. package/dist/gir/repository.d.ts +82 -0
  87. package/dist/gir/repository.d.ts.map +1 -0
  88. package/dist/gir/repository.js +122 -0
  89. package/dist/gir/repository.js.map +1 -0
  90. package/dist/gir/signal.d.ts +22 -0
  91. package/dist/gir/signal.d.ts.map +1 -0
  92. package/dist/gir/signal.js +20 -0
  93. package/dist/gir/signal.js.map +1 -0
  94. package/dist/gir/size.d.ts +67 -0
  95. package/dist/gir/size.d.ts.map +1 -0
  96. package/dist/gir/size.js +87 -0
  97. package/dist/gir/size.js.map +1 -0
  98. package/dist/gir/type-ref.d.ts +79 -0
  99. package/dist/gir/type-ref.d.ts.map +1 -0
  100. package/dist/gir/type-ref.js +101 -0
  101. package/dist/gir/type-ref.js.map +1 -0
  102. package/dist/index.d.ts +12 -0
  103. package/dist/index.d.ts.map +1 -0
  104. package/dist/index.js +12 -0
  105. package/dist/index.js.map +1 -0
  106. package/dist/jsx-store.d.ts +22 -0
  107. package/dist/jsx-store.d.ts.map +1 -0
  108. package/dist/jsx-store.js +40 -0
  109. package/dist/jsx-store.js.map +1 -0
  110. package/dist/react/compounds-meta.d.ts +18 -0
  111. package/dist/react/compounds-meta.d.ts.map +1 -0
  112. package/dist/react/compounds-meta.js +93 -0
  113. package/dist/react/compounds-meta.js.map +1 -0
  114. package/dist/react/compounds.d.ts +27 -0
  115. package/dist/react/compounds.d.ts.map +1 -0
  116. package/dist/react/compounds.js +164 -0
  117. package/dist/react/compounds.js.map +1 -0
  118. package/dist/react/internal.d.ts +14 -0
  119. package/dist/react/internal.d.ts.map +1 -0
  120. package/dist/react/internal.js +79 -0
  121. package/dist/react/internal.js.map +1 -0
  122. package/dist/react/jsx.d.ts +22 -0
  123. package/dist/react/jsx.d.ts.map +1 -0
  124. package/dist/react/jsx.js +134 -0
  125. package/dist/react/jsx.js.map +1 -0
  126. package/dist/react/pipeline.d.ts +13 -0
  127. package/dist/react/pipeline.d.ts.map +1 -0
  128. package/dist/react/pipeline.js +25 -0
  129. package/dist/react/pipeline.js.map +1 -0
  130. package/dist/react/props.d.ts +38 -0
  131. package/dist/react/props.d.ts.map +1 -0
  132. package/dist/react/props.js +231 -0
  133. package/dist/react/props.js.map +1 -0
  134. package/dist/react/slot-props.d.ts +10 -0
  135. package/dist/react/slot-props.d.ts.map +1 -0
  136. package/dist/react/slot-props.js +56 -0
  137. package/dist/react/slot-props.js.map +1 -0
  138. package/dist/react/widgets.d.ts +83 -0
  139. package/dist/react/widgets.d.ts.map +1 -0
  140. package/dist/react/widgets.js +152 -0
  141. package/dist/react/widgets.js.map +1 -0
  142. package/dist/runner.d.ts +55 -0
  143. package/dist/runner.d.ts.map +1 -0
  144. package/dist/runner.js +60 -0
  145. package/dist/runner.js.map +1 -0
  146. package/dist/store-fs.d.ts +109 -0
  147. package/dist/store-fs.d.ts.map +1 -0
  148. package/dist/store-fs.js +98 -0
  149. package/dist/store-fs.js.map +1 -0
  150. package/dist/transpile.d.ts +32 -0
  151. package/dist/transpile.d.ts.map +1 -0
  152. package/dist/transpile.js +63 -0
  153. package/dist/transpile.js.map +1 -0
  154. package/dist/typecheck-store.d.ts +41 -0
  155. package/dist/typecheck-store.d.ts.map +1 -0
  156. package/dist/typecheck-store.js +102 -0
  157. package/dist/typecheck-store.js.map +1 -0
  158. package/dist/writers/alias.d.ts +13 -0
  159. package/dist/writers/alias.d.ts.map +1 -0
  160. package/dist/writers/alias.js +17 -0
  161. package/dist/writers/alias.js.map +1 -0
  162. package/dist/writers/async.d.ts +22 -0
  163. package/dist/writers/async.d.ts.map +1 -0
  164. package/dist/writers/async.js +48 -0
  165. package/dist/writers/async.js.map +1 -0
  166. package/dist/writers/boxed-constructor.d.ts +26 -0
  167. package/dist/writers/boxed-constructor.d.ts.map +1 -0
  168. package/dist/writers/boxed-constructor.js +85 -0
  169. package/dist/writers/boxed-constructor.js.map +1 -0
  170. package/dist/writers/boxed-field-accessor.d.ts +18 -0
  171. package/dist/writers/boxed-field-accessor.d.ts.map +1 -0
  172. package/dist/writers/boxed-field-accessor.js +260 -0
  173. package/dist/writers/boxed-field-accessor.js.map +1 -0
  174. package/dist/writers/boxed-layout.d.ts +27 -0
  175. package/dist/writers/boxed-layout.d.ts.map +1 -0
  176. package/dist/writers/boxed-layout.js +128 -0
  177. package/dist/writers/boxed-layout.js.map +1 -0
  178. package/dist/writers/boxed.d.ts +20 -0
  179. package/dist/writers/boxed.d.ts.map +1 -0
  180. package/dist/writers/boxed.js +71 -0
  181. package/dist/writers/boxed.js.map +1 -0
  182. package/dist/writers/callables.d.ts +124 -0
  183. package/dist/writers/callables.d.ts.map +1 -0
  184. package/dist/writers/callables.js +283 -0
  185. package/dist/writers/callables.js.map +1 -0
  186. package/dist/writers/callback.d.ts +16 -0
  187. package/dist/writers/callback.d.ts.map +1 -0
  188. package/dist/writers/callback.js +38 -0
  189. package/dist/writers/callback.js.map +1 -0
  190. package/dist/writers/class-struct-record.d.ts +31 -0
  191. package/dist/writers/class-struct-record.d.ts.map +1 -0
  192. package/dist/writers/class-struct-record.js +67 -0
  193. package/dist/writers/class-struct-record.js.map +1 -0
  194. package/dist/writers/class-struct.d.ts +22 -0
  195. package/dist/writers/class-struct.d.ts.map +1 -0
  196. package/dist/writers/class-struct.js +85 -0
  197. package/dist/writers/class-struct.js.map +1 -0
  198. package/dist/writers/class.d.ts +16 -0
  199. package/dist/writers/class.d.ts.map +1 -0
  200. package/dist/writers/class.js +307 -0
  201. package/dist/writers/class.js.map +1 -0
  202. package/dist/writers/constant.d.ts +15 -0
  203. package/dist/writers/constant.d.ts.map +1 -0
  204. package/dist/writers/constant.js +23 -0
  205. package/dist/writers/constant.js.map +1 -0
  206. package/dist/writers/constants.d.ts +15 -0
  207. package/dist/writers/constants.d.ts.map +1 -0
  208. package/dist/writers/constants.js +23 -0
  209. package/dist/writers/constants.js.map +1 -0
  210. package/dist/writers/constructor-props.d.ts +32 -0
  211. package/dist/writers/constructor-props.d.ts.map +1 -0
  212. package/dist/writers/constructor-props.js +110 -0
  213. package/dist/writers/constructor-props.js.map +1 -0
  214. package/dist/writers/enum.d.ts +21 -0
  215. package/dist/writers/enum.d.ts.map +1 -0
  216. package/dist/writers/enum.js +48 -0
  217. package/dist/writers/enum.js.map +1 -0
  218. package/dist/writers/function.d.ts +40 -0
  219. package/dist/writers/function.d.ts.map +1 -0
  220. package/dist/writers/function.js +127 -0
  221. package/dist/writers/function.js.map +1 -0
  222. package/dist/writers/gtype-binding.d.ts +19 -0
  223. package/dist/writers/gtype-binding.d.ts.map +1 -0
  224. package/dist/writers/gtype-binding.js +40 -0
  225. package/dist/writers/gtype-binding.js.map +1 -0
  226. package/dist/writers/inheritance.d.ts +48 -0
  227. package/dist/writers/inheritance.d.ts.map +1 -0
  228. package/dist/writers/inheritance.js +90 -0
  229. package/dist/writers/inheritance.js.map +1 -0
  230. package/dist/writers/interface.d.ts +16 -0
  231. package/dist/writers/interface.d.ts.map +1 -0
  232. package/dist/writers/interface.js +155 -0
  233. package/dist/writers/interface.js.map +1 -0
  234. package/dist/writers/method.d.ts +150 -0
  235. package/dist/writers/method.d.ts.map +1 -0
  236. package/dist/writers/method.js +510 -0
  237. package/dist/writers/method.js.map +1 -0
  238. package/dist/writers/param-classify.d.ts +93 -0
  239. package/dist/writers/param-classify.d.ts.map +1 -0
  240. package/dist/writers/param-classify.js +163 -0
  241. package/dist/writers/param-classify.js.map +1 -0
  242. package/dist/writers/property-accessor.d.ts +19 -0
  243. package/dist/writers/property-accessor.d.ts.map +1 -0
  244. package/dist/writers/property-accessor.js +117 -0
  245. package/dist/writers/property-accessor.js.map +1 -0
  246. package/dist/writers/registration.d.ts +27 -0
  247. package/dist/writers/registration.d.ts.map +1 -0
  248. package/dist/writers/registration.js +30 -0
  249. package/dist/writers/registration.js.map +1 -0
  250. package/dist/writers/return-wrap.d.ts +39 -0
  251. package/dist/writers/return-wrap.d.ts.map +1 -0
  252. package/dist/writers/return-wrap.js +152 -0
  253. package/dist/writers/return-wrap.js.map +1 -0
  254. package/dist/writers/runtime-override.d.ts +18 -0
  255. package/dist/writers/runtime-override.d.ts.map +1 -0
  256. package/dist/writers/runtime-override.js +44 -0
  257. package/dist/writers/runtime-override.js.map +1 -0
  258. package/dist/writers/signal.d.ts +21 -0
  259. package/dist/writers/signal.d.ts.map +1 -0
  260. package/dist/writers/signal.js +260 -0
  261. package/dist/writers/signal.js.map +1 -0
  262. package/dist/writers/ts-type.d.ts +50 -0
  263. package/dist/writers/ts-type.d.ts.map +1 -0
  264. package/dist/writers/ts-type.js +75 -0
  265. package/dist/writers/ts-type.js.map +1 -0
  266. package/dist/writers/types-ts.d.ts +27 -0
  267. package/dist/writers/types-ts.d.ts.map +1 -0
  268. package/dist/writers/types-ts.js +97 -0
  269. package/dist/writers/types-ts.js.map +1 -0
  270. package/dist/writers/value.d.ts +89 -0
  271. package/dist/writers/value.d.ts.map +1 -0
  272. package/dist/writers/value.js +402 -0
  273. package/dist/writers/value.js.map +1 -0
  274. package/package.json +55 -0
  275. package/src/dsl/context.ts +146 -0
  276. package/src/dsl/emit.ts +42 -0
  277. package/src/dsl/identifier.ts +52 -0
  278. package/src/dsl/imports.ts +109 -0
  279. package/src/dsl/module.ts +75 -0
  280. package/src/ffi/pipeline.ts +113 -0
  281. package/src/fingerprint.ts +50 -0
  282. package/src/gi-store.ts +199 -0
  283. package/src/gir/boxed.ts +94 -0
  284. package/src/gir/callback.ts +26 -0
  285. package/src/gir/class.ts +79 -0
  286. package/src/gir/enum.ts +55 -0
  287. package/src/gir/field.ts +40 -0
  288. package/src/gir/function.ts +67 -0
  289. package/src/gir/namespace.ts +118 -0
  290. package/src/gir/parameter.ts +120 -0
  291. package/src/gir/parse.ts +171 -0
  292. package/src/gir/primitives.ts +137 -0
  293. package/src/gir/property.ts +39 -0
  294. package/src/gir/qualified-name.ts +55 -0
  295. package/src/gir/qualify.ts +64 -0
  296. package/src/gir/repository.ts +149 -0
  297. package/src/gir/signal.ts +36 -0
  298. package/src/gir/size.ts +129 -0
  299. package/src/gir/type-ref.ts +180 -0
  300. package/src/index.ts +16 -0
  301. package/src/jsx-store.ts +53 -0
  302. package/src/react/compounds-meta.ts +99 -0
  303. package/src/react/compounds.ts +204 -0
  304. package/src/react/internal.ts +91 -0
  305. package/src/react/jsx.ts +155 -0
  306. package/src/react/pipeline.ts +29 -0
  307. package/src/react/props.ts +307 -0
  308. package/src/react/slot-props.ts +57 -0
  309. package/src/react/widgets.ts +185 -0
  310. package/src/runner.ts +89 -0
  311. package/src/store-fs.ts +157 -0
  312. package/src/transpile.ts +80 -0
  313. package/src/typecheck-store.ts +136 -0
  314. package/src/writers/alias.ts +19 -0
  315. package/src/writers/async.ts +44 -0
  316. package/src/writers/boxed-constructor.ts +105 -0
  317. package/src/writers/boxed-field-accessor.ts +306 -0
  318. package/src/writers/boxed-layout.ts +166 -0
  319. package/src/writers/boxed.ts +77 -0
  320. package/src/writers/callables.ts +339 -0
  321. package/src/writers/callback.ts +40 -0
  322. package/src/writers/class-struct-record.ts +75 -0
  323. package/src/writers/class-struct.ts +96 -0
  324. package/src/writers/class.ts +384 -0
  325. package/src/writers/constant.ts +29 -0
  326. package/src/writers/constructor-props.ts +130 -0
  327. package/src/writers/enum.ts +53 -0
  328. package/src/writers/function.ts +136 -0
  329. package/src/writers/gtype-binding.ts +48 -0
  330. package/src/writers/inheritance.ts +104 -0
  331. package/src/writers/interface.ts +168 -0
  332. package/src/writers/method.ts +678 -0
  333. package/src/writers/param-classify.ts +178 -0
  334. package/src/writers/property-accessor.ts +139 -0
  335. package/src/writers/registration.ts +42 -0
  336. package/src/writers/return-wrap.ts +180 -0
  337. package/src/writers/runtime-override.ts +59 -0
  338. package/src/writers/signal.ts +318 -0
  339. package/src/writers/ts-type.ts +115 -0
  340. package/src/writers/value.ts +485 -0
@@ -0,0 +1,20 @@
1
+ import type { ModuleContext } from "../dsl/context.js";
2
+ import type { GirBoxed } from "../gir/boxed.js";
3
+ /**
4
+ * Emits a class declaration plus optional boxed registration for a
5
+ * `<record>`, `<union>`, or `<glib:boxed>`.
6
+ *
7
+ * Walks constructors, static functions, and methods just like
8
+ * {@link emitClass}, attaching them to the boxed class. Field accessors
9
+ * and construction metadata are emitted by their dedicated writers.
10
+ *
11
+ * Vtable records (`glib:is-gtype-struct-for`) are skipped here — they are
12
+ * consumed by the owning class's vtable registration. Class- and
13
+ * interface-struct records (`GTypeClass`, `GEnumClass`, …) are likewise skipped
14
+ * as they are runtime vtables rather than marshallable values.
15
+ *
16
+ * @param context - The module context
17
+ * @param boxed - The boxed to emit
18
+ */
19
+ export declare const emitBoxed: (context: ModuleContext, boxed: GirBoxed) => void;
20
+ //# sourceMappingURL=boxed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boxed.d.ts","sourceRoot":"","sources":["../../src/writers/boxed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAShD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,SAAS,GAAI,SAAS,aAAa,EAAE,OAAO,QAAQ,KAAG,IA2BnE,CAAC"}
@@ -0,0 +1,71 @@
1
+ import { indent } from "../dsl/emit.js";
2
+ import { renderBoxedConstructor, renderBoxedConstructorPropsInterface } from "./boxed-constructor.js";
3
+ import { renderBoxedFieldAccessor } from "./boxed-field-accessor.js";
4
+ import { computeBoxedFieldSlots } from "./boxed-layout.js";
5
+ import { dedupeCallables, emitBindings, renderPlainTypeMembers } from "./callables.js";
6
+ import { isClassStructRecord } from "./class-struct-record.js";
7
+ import { renderGetTypeReference } from "./gtype-binding.js";
8
+ import { appendNativeClassRegistration } from "./registration.js";
9
+ /**
10
+ * Emits a class declaration plus optional boxed registration for a
11
+ * `<record>`, `<union>`, or `<glib:boxed>`.
12
+ *
13
+ * Walks constructors, static functions, and methods just like
14
+ * {@link emitClass}, attaching them to the boxed class. Field accessors
15
+ * and construction metadata are emitted by their dedicated writers.
16
+ *
17
+ * Vtable records (`glib:is-gtype-struct-for`) are skipped here — they are
18
+ * consumed by the owning class's vtable registration. Class- and
19
+ * interface-struct records (`GTypeClass`, `GEnumClass`, …) are likewise skipped
20
+ * as they are runtime vtables rather than marshallable values.
21
+ *
22
+ * @param context - The module context
23
+ * @param boxed - The boxed to emit
24
+ */
25
+ export const emitBoxed = (context, boxed) => {
26
+ if (!boxed.introspectable)
27
+ return;
28
+ if (boxed.kind === "vtable")
29
+ return;
30
+ if (boxed.name.length === 0)
31
+ return;
32
+ if (isClassStructRecord(context.namespace.name, boxed))
33
+ return;
34
+ const className = boxed.name;
35
+ const callables = {
36
+ constructors: dedupeCallables(boxed.constructors),
37
+ functions: dedupeCallables(boxed.functions),
38
+ methods: dedupeCallables(boxed.methods),
39
+ };
40
+ emitBindings(context, callables);
41
+ const members = renderBoxedMembers(context, boxed, className, callables);
42
+ const body = members.map((member) => indent(member, 1)).join("\n\n");
43
+ context.module.appendDeclaration(`export class ${className} {\n${body}\n}`);
44
+ context.module.appendDeclaration(renderBoxedConstructorPropsInterface(context, boxed, className));
45
+ const getTypeRef = boxed.glibGetType === undefined
46
+ ? undefined
47
+ : renderGetTypeReference(context, boxed.glibGetType, boxed.glibTypeName);
48
+ appendNativeClassRegistration(context, {
49
+ className,
50
+ role: "boxed",
51
+ getTypeRef,
52
+ });
53
+ };
54
+ const renderBoxedMembers = (context, boxed, className, callables) => {
55
+ const { members, claimedNames } = renderPlainTypeMembers({
56
+ context,
57
+ className,
58
+ callables,
59
+ hasGType: boxed.glibGetType !== undefined,
60
+ wrap: "boxed",
61
+ });
62
+ members.unshift(renderBoxedConstructor(context, boxed, className));
63
+ const { slots } = computeBoxedFieldSlots(context, boxed.fields, boxed.isUnion);
64
+ for (const slot of slots) {
65
+ const block = renderBoxedFieldAccessor(context, slot, claimedNames, boxed.fields);
66
+ if (block !== undefined)
67
+ members.push(block);
68
+ }
69
+ return members;
70
+ };
71
+ //# sourceMappingURL=boxed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boxed.js","sourceRoot":"","sources":["../../src/writers/boxed.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,sBAAsB,EAAE,oCAAoC,EAAE,MAAM,wBAAwB,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAkB,eAAe,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACvG,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAElE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAsB,EAAE,KAAe,EAAQ,EAAE;IACvE,IAAI,CAAC,KAAK,CAAC,cAAc;QAAE,OAAO;IAClC,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO;IACpC,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IACpC,IAAI,mBAAmB,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,OAAO;IAC/D,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC;IAC7B,MAAM,SAAS,GAAc;QACzB,YAAY,EAAE,eAAe,CAAC,KAAK,CAAC,YAAY,CAAC;QACjD,SAAS,EAAE,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC;QAC3C,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC;KAC1C,CAAC;I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E,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/E,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,wBAAwB,CAAC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAClF,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC"}
@@ -0,0 +1,124 @@
1
+ import type { ModuleContext } from "../dsl/context.js";
2
+ import type { GirFunction } from "../gir/function.js";
3
+ /**
4
+ * Constructors, static functions, and instance methods of a class, interface,
5
+ * or boxed record.
6
+ */
7
+ export type Callables = {
8
+ readonly constructors: readonly GirFunction[];
9
+ readonly functions: readonly GirFunction[];
10
+ readonly methods: readonly GirFunction[];
11
+ };
12
+ /**
13
+ * Drops callables that lack a `c:identifier` or repeat one already retained.
14
+ *
15
+ * GIR sometimes lists the same callable twice (e.g. as both a class function
16
+ * and a constructor); the C identifier is the canonical key.
17
+ *
18
+ * @param callables - The raw GIR callables
19
+ */
20
+ export declare const dedupeCallables: (callables: readonly GirFunction[]) => readonly GirFunction[];
21
+ /**
22
+ * Appends the top-level `const fn = t.fn(...)` binding for every introspectable
23
+ * callable that has a C identifier and is not shadowed.
24
+ *
25
+ * @param context - The module context
26
+ * @param callables - The callables to bind
27
+ */
28
+ /**
29
+ * Appends the top-level `const fn = t.fn(...)` binding for a single callable,
30
+ * deduplicated by its C identifier. Used when flattening interface and
31
+ * prerequisite methods onto a type one at a time.
32
+ *
33
+ * @param context - The module context
34
+ * @param method - The callable to bind
35
+ */
36
+ export declare const appendMethodBinding: (context: ModuleContext, method: GirFunction) => void;
37
+ export declare const emitBindings: (context: ModuleContext, callables: Callables) => void;
38
+ /**
39
+ * How a type's static `<constructor>` factories wrap their result:
40
+ *
41
+ * - `"gobject"` — resolve the wrapper from the runtime GLib type (a class).
42
+ * - `"interface"` — resolve the runtime type, falling back to the closest
43
+ * registered ancestor that implements the interface, then the interface itself.
44
+ * - `"boxed"` — wrap as the exact value-type class (boxed records).
45
+ */
46
+ export type ConstructorWrap = "gobject" | "interface" | "boxed";
47
+ /**
48
+ * Renders an instance method body for a GIR `<method>`.
49
+ *
50
+ * Hand-written runtime overrides (e.g. `g_value_get_boxed`) short-circuit the
51
+ * usual FFI call body with a throwing stub that the runtime replaces on the
52
+ * prototype at module load.
53
+ *
54
+ * Returns `undefined` for non-emittable callables.
55
+ *
56
+ * @param context - The module context
57
+ * @param callable - The GIR method callable
58
+ */
59
+ export declare const renderInstanceMethod: (context: ModuleContext, callable: GirFunction, nameOverride?: string) => string | undefined;
60
+ /**
61
+ * Inputs for {@link appendShadowedAliases}.
62
+ */
63
+ export type ShadowedAliasOptions = {
64
+ readonly context: ModuleContext;
65
+ /** The full list of method callables. */
66
+ readonly methods: readonly GirFunction[];
67
+ /** Lookup table for shadower resolution. */
68
+ readonly methodByName: ReadonlyMap<string, GirFunction>;
69
+ /** The accumulating members list to append to. */
70
+ readonly members: string[];
71
+ /** Set of names already emitted on the class body. */
72
+ readonly claimedNames: Set<string>;
73
+ };
74
+ /**
75
+ * Appends shadowed-method aliases for every callable in `methods` whose
76
+ * shadower is introspectable.
77
+ *
78
+ * Records each emitted alias name in `claimedNames` so subsequent renderers
79
+ * can detect collisions.
80
+ *
81
+ * @param options - {@link ShadowedAliasOptions}
82
+ */
83
+ export declare const appendShadowedAliases: (options: ShadowedAliasOptions) => void;
84
+ /**
85
+ * Indexes a list of method callables by their GIR name for shadower lookup.
86
+ */
87
+ export declare const indexMethodsByName: (methods: readonly GirFunction[]) => ReadonlyMap<string, GirFunction>;
88
+ /**
89
+ * Renders the shared head of a class/interface/boxed body: every `static`
90
+ * constructor factory and every `static` namespace function on the same type.
91
+ *
92
+ * @param context - The module context
93
+ * @param callables - The class's emittable callables
94
+ * @param ownerClassName - The local PascalCase class name
95
+ * @param wrap - How static constructors lift their result to a wrapper
96
+ */
97
+ export declare const renderStaticHead: (context: ModuleContext, callables: Callables, ownerClassName: string, wrap: ConstructorWrap) => readonly string[];
98
+ /**
99
+ * Inputs for {@link renderPlainTypeMembers}.
100
+ */
101
+ export type PlainTypeMembersOptions = {
102
+ readonly context: ModuleContext;
103
+ readonly className: string;
104
+ readonly callables: Callables;
105
+ /** Whether to prepend `declare __gtype__: number;`. */
106
+ readonly hasGType: boolean;
107
+ /** How static constructors lift their result to a wrapper. */
108
+ readonly wrap: ConstructorWrap;
109
+ };
110
+ /**
111
+ * Renders the shared head of an interface or boxed class body — `__gtype__`
112
+ * declaration (optional), statics, plain instance methods, and
113
+ * shadowed-method aliases — plus the `claimedNames` set populated by those
114
+ * renderers.
115
+ *
116
+ * Callers append the constructor, property accessors, field accessors, and
117
+ * signal members on top of the returned members list. The class writer takes
118
+ * a different path because it has to consult inherited signatures.
119
+ */
120
+ export declare const renderPlainTypeMembers: (options: PlainTypeMembersOptions) => {
121
+ readonly members: string[];
122
+ readonly claimedNames: Set<string>;
123
+ };
124
+ //# sourceMappingURL=callables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callables.d.ts","sourceRoot":"","sources":["../../src/writers/callables.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMtD;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACpB,QAAQ,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,SAAS,WAAW,EAAE,CAAC;IAC3C,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;CAC5C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,WAAW,SAAS,WAAW,EAAE,KAAG,SAAS,WAAW,EAUvF,CAAC;AAEF;;;;;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,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;CAClC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,GAC/B,SAAS,uBAAuB,KACjC;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAUlE,CAAC"}
@@ -0,0 +1,283 @@
1
+ import { toCamelCase } from "@gtkx/utils";
2
+ import { indent } from "../dsl/emit.js";
3
+ import { callableReferencesClassStruct } from "./class-struct-record.js";
4
+ import { renderFnExpression } from "./function.js";
5
+ import { methodExportName, renderMethodBody, renderMethodReturnType, renderMethodSignature } from "./method.js";
6
+ import { renderRuntimeOverride } from "./runtime-override.js";
7
+ /**
8
+ * Drops callables that lack a `c:identifier` or repeat one already retained.
9
+ *
10
+ * GIR sometimes lists the same callable twice (e.g. as both a class function
11
+ * and a constructor); the C identifier is the canonical key.
12
+ *
13
+ * @param callables - The raw GIR callables
14
+ */
15
+ export const dedupeCallables = (callables) => {
16
+ const seen = new Set();
17
+ const result = [];
18
+ for (const callable of callables) {
19
+ if (callable.cIdentifier === undefined)
20
+ continue;
21
+ if (seen.has(callable.cIdentifier))
22
+ continue;
23
+ seen.add(callable.cIdentifier);
24
+ result.push(callable);
25
+ }
26
+ return result;
27
+ };
28
+ /**
29
+ * Appends the top-level `const fn = t.fn(...)` binding for every introspectable
30
+ * callable that has a C identifier and is not shadowed.
31
+ *
32
+ * @param context - The module context
33
+ * @param callables - The callables to bind
34
+ */
35
+ /**
36
+ * Appends the top-level `const fn = t.fn(...)` binding for a single callable,
37
+ * deduplicated by its C identifier. Used when flattening interface and
38
+ * prerequisite methods onto a type one at a time.
39
+ *
40
+ * @param context - The module context
41
+ * @param method - The callable to bind
42
+ */
43
+ export const appendMethodBinding = (context, method) => {
44
+ if (method.cIdentifier === undefined)
45
+ return;
46
+ if (callableReferencesClassStruct(context, method))
47
+ return;
48
+ const expression = renderFnExpression(context, method);
49
+ if (expression === undefined)
50
+ return;
51
+ context.module.appendBinding(`const ${method.cIdentifier} = ${expression};`, method.cIdentifier);
52
+ };
53
+ export const emitBindings = (context, callables) => {
54
+ const all = [...callables.constructors, ...callables.functions, ...callables.methods];
55
+ for (const callable of all) {
56
+ if (!callable.introspectable)
57
+ continue;
58
+ if (callable.shadowedBy !== undefined)
59
+ continue;
60
+ if (callable.cIdentifier === undefined)
61
+ continue;
62
+ if (callableReferencesClassStruct(context, callable))
63
+ continue;
64
+ const expression = renderFnExpression(context, callable);
65
+ if (expression === undefined)
66
+ continue;
67
+ context.module.appendBinding(`const ${callable.cIdentifier} = ${expression};`, callable.cIdentifier);
68
+ }
69
+ };
70
+ /**
71
+ * Renders a `static <name>(...): Owner` factory method for a GIR `<constructor>`.
72
+ *
73
+ * Returns `undefined` for non-introspectable, shadowed, identifier-less, or
74
+ * `constructor`-named entries.
75
+ *
76
+ * @param context - The module context
77
+ * @param callable - The GIR constructor callable
78
+ * @param ownerClassName - The local class name that wraps the result
79
+ * @param wrap - How the result is lifted to its JavaScript wrapper
80
+ */
81
+ const renderConstructorStatic = (context, callable, ownerClassName, wrap) => {
82
+ if (!isEmittableCallable(context, callable))
83
+ return undefined;
84
+ const name = constructorMemberName(callable.name);
85
+ if (name === undefined)
86
+ return undefined;
87
+ const cIdentifier = callable.cIdentifier;
88
+ if (cIdentifier === undefined)
89
+ return undefined;
90
+ const signature = renderMethodSignature(context, callable);
91
+ const body = renderMethodBody(context, callable, {
92
+ bindingExpression: cIdentifier,
93
+ isStatic: true,
94
+ returnAs: wrap === "gobject" ? { via: "gobject" } : { via: wrap, className: ownerClassName },
95
+ });
96
+ return `static ${name}(${signature}): ${ownerClassName} {\n${indent(body, 1)}\n}`;
97
+ };
98
+ /**
99
+ * Renders a `static <name>(...): Return` member for a GIR `<function>`.
100
+ *
101
+ * Returns `undefined` when the callable cannot be emitted on a class body.
102
+ *
103
+ * @param context - The module context
104
+ * @param callable - The GIR function callable
105
+ */
106
+ const renderStaticMember = (context, callable) => {
107
+ if (!isEmittableCallable(context, callable))
108
+ return undefined;
109
+ const cIdentifier = callable.cIdentifier;
110
+ if (cIdentifier === undefined)
111
+ return undefined;
112
+ const name = toCamelCase(callable.name);
113
+ if (name === "constructor")
114
+ return undefined;
115
+ const signature = renderMethodSignature(context, callable);
116
+ const returnType = renderMethodReturnType(context, callable);
117
+ const body = renderMethodBody(context, callable, { bindingExpression: cIdentifier, isStatic: true });
118
+ return `static ${name}(${signature}): ${returnType} {\n${indent(body, 1)}\n}`;
119
+ };
120
+ /**
121
+ * Renders an instance method body for a GIR `<method>`.
122
+ *
123
+ * Hand-written runtime overrides (e.g. `g_value_get_boxed`) short-circuit the
124
+ * usual FFI call body with a throwing stub that the runtime replaces on the
125
+ * prototype at module load.
126
+ *
127
+ * Returns `undefined` for non-emittable callables.
128
+ *
129
+ * @param context - The module context
130
+ * @param callable - The GIR method callable
131
+ */
132
+ export const renderInstanceMethod = (context, callable, nameOverride) => {
133
+ if (!isEmittableCallable(context, callable))
134
+ return undefined;
135
+ const cIdentifier = callable.cIdentifier;
136
+ if (cIdentifier === undefined)
137
+ return undefined;
138
+ const name = nameOverride ?? methodExportName(callable);
139
+ if (name === "constructor")
140
+ return undefined;
141
+ const override = renderRuntimeOverride(callable, name);
142
+ if (override !== undefined)
143
+ return override;
144
+ const signature = renderMethodSignature(context, callable);
145
+ const returnType = renderMethodReturnType(context, callable);
146
+ const body = renderMethodBody(context, callable, { bindingExpression: cIdentifier, isStatic: false });
147
+ return `${name}(${signature}): ${returnType} {\n${indent(body, 1)}\n}`;
148
+ };
149
+ /**
150
+ * Renders the legacy-name alias of a method that has been shadowed by a
151
+ * variadic or kebab-cased successor.
152
+ *
153
+ * Returns `undefined` when the alias collides with `constructor` or the
154
+ * shadower lacks a C identifier.
155
+ *
156
+ * @param context - The module context
157
+ * @param original - The shadowed callable whose name should remain reachable
158
+ * @param shadower - The callable the alias dispatches into
159
+ */
160
+ const renderInstanceAlias = (context, original, shadower) => {
161
+ if (shadower.cIdentifier === undefined)
162
+ return undefined;
163
+ const aliasName = toCamelCase(original.name);
164
+ if (aliasName === "constructor")
165
+ return undefined;
166
+ const signature = renderMethodSignature(context, shadower);
167
+ const returnType = renderMethodReturnType(context, shadower);
168
+ const body = renderMethodBody(context, shadower, { bindingExpression: shadower.cIdentifier, isStatic: false });
169
+ return `${aliasName}(${signature}): ${returnType} {\n${indent(body, 1)}\n}`;
170
+ };
171
+ /**
172
+ * Appends shadowed-method aliases for every callable in `methods` whose
173
+ * shadower is introspectable.
174
+ *
175
+ * Records each emitted alias name in `claimedNames` so subsequent renderers
176
+ * can detect collisions.
177
+ *
178
+ * @param options - {@link ShadowedAliasOptions}
179
+ */
180
+ export const appendShadowedAliases = (options) => {
181
+ const { context, methods, methodByName, members, claimedNames } = options;
182
+ for (const callable of methods) {
183
+ if (callable.shadowedBy === undefined)
184
+ continue;
185
+ if (callable.introspectable)
186
+ continue;
187
+ const shadower = methodByName.get(callable.shadowedBy);
188
+ if (shadower === undefined || !shadower.introspectable)
189
+ continue;
190
+ const aliasName = toCamelCase(callable.name);
191
+ if (claimedNames.has(aliasName))
192
+ continue;
193
+ const block = renderInstanceAlias(context, callable, shadower);
194
+ if (block !== undefined) {
195
+ members.push(block);
196
+ claimedNames.add(aliasName);
197
+ }
198
+ }
199
+ };
200
+ /**
201
+ * Indexes a list of method callables by their GIR name for shadower lookup.
202
+ */
203
+ export const indexMethodsByName = (methods) => {
204
+ const map = new Map();
205
+ for (const callable of methods)
206
+ map.set(callable.name, callable);
207
+ return map;
208
+ };
209
+ const isEmittableCallable = (context, callable) => callable.introspectable &&
210
+ callable.shadowedBy === undefined &&
211
+ callable.cIdentifier !== undefined &&
212
+ !callableReferencesClassStruct(context, callable);
213
+ const constructorMemberName = (girName) => {
214
+ const camel = toCamelCase(girName);
215
+ if (camel === "constructor")
216
+ return undefined;
217
+ return camel;
218
+ };
219
+ /**
220
+ * Renders the shared head of a class/interface/boxed body: every `static`
221
+ * constructor factory and every `static` namespace function on the same type.
222
+ *
223
+ * @param context - The module context
224
+ * @param callables - The class's emittable callables
225
+ * @param ownerClassName - The local PascalCase class name
226
+ * @param wrap - How static constructors lift their result to a wrapper
227
+ */
228
+ export const renderStaticHead = (context, callables, ownerClassName, wrap) => {
229
+ const blocks = [];
230
+ for (const callable of callables.constructors) {
231
+ const block = renderConstructorStatic(context, callable, ownerClassName, wrap);
232
+ if (block !== undefined)
233
+ blocks.push(block);
234
+ }
235
+ for (const callable of callables.functions) {
236
+ const block = renderStaticMember(context, callable);
237
+ if (block !== undefined)
238
+ blocks.push(block);
239
+ }
240
+ return blocks;
241
+ };
242
+ /**
243
+ * Renders the plain instance methods of a class/interface/boxed body, the
244
+ * variant that does NOT consult inherited-signature conflicts. Used for
245
+ * interfaces and boxed records that do not extend other widget shapes.
246
+ *
247
+ * Records each emitted method name in `claimedNames` so subsequent property
248
+ * and signal-method renderers can detect collisions.
249
+ */
250
+ const renderPlainInstanceMethods = (context, methods, claimedNames) => {
251
+ const blocks = [];
252
+ for (const callable of methods) {
253
+ const block = renderInstanceMethod(context, callable);
254
+ if (block === undefined)
255
+ continue;
256
+ blocks.push(block);
257
+ claimedNames.add(methodExportName(callable));
258
+ }
259
+ return blocks;
260
+ };
261
+ /**
262
+ * Renders the shared head of an interface or boxed class body — `__gtype__`
263
+ * declaration (optional), statics, plain instance methods, and
264
+ * shadowed-method aliases — plus the `claimedNames` set populated by those
265
+ * renderers.
266
+ *
267
+ * Callers append the constructor, property accessors, field accessors, and
268
+ * signal members on top of the returned members list. The class writer takes
269
+ * a different path because it has to consult inherited signatures.
270
+ */
271
+ export const renderPlainTypeMembers = (options) => {
272
+ const { context, className, callables, hasGType, wrap } = options;
273
+ const members = [];
274
+ if (hasGType)
275
+ members.push("declare __gtype__: number;");
276
+ const claimedNames = new Set();
277
+ members.push(...renderStaticHead(context, callables, className, wrap));
278
+ members.push(...renderPlainInstanceMethods(context, callables.methods, claimedNames));
279
+ const methodByName = indexMethodsByName(callables.methods);
280
+ appendShadowedAliases({ context, methods: callables.methods, methodByName, members, claimedNames });
281
+ return { members, claimedNames };
282
+ };
283
+ //# sourceMappingURL=callables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callables.js","sourceRoot":"","sources":["../../src/writers/callables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAChH,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAY9D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAiC,EAA0B,EAAE;IACzF,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QAC/B,IAAI,QAAQ,CAAC,WAAW,KAAK,SAAS;YAAE,SAAS;QACjD,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC;YAAE,SAAS;QAC7C,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC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,CAClC,OAAgC,EACkC,EAAE;IACpE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAClE,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,QAAQ;QAAE,OAAO,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACvE,OAAO,CAAC,IAAI,CAAC,GAAG,0BAA0B,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IACtF,MAAM,YAAY,GAAG,kBAAkB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC3D,qBAAqB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;IACpG,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;AACrC,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { ModuleContext } from "../dsl/context.js";
2
+ import type { GirCallback } from "../gir/callback.js";
3
+ /**
4
+ * Emits an `export type` alias for a top-level GIR `<callback>`.
5
+ *
6
+ * The callback is surfaced under its GIR `name` verbatim with a fully typed
7
+ * call signature: input parameters follow {@link renderMethodSignature} (the
8
+ * folded `user_data`/`GDestroyNotify` slots are dropped) and the return follows
9
+ * {@link renderMethodReturnType}, so out-parameters tuple into the return the
10
+ * same way a method's would.
11
+ *
12
+ * @param context - The module context
13
+ * @param callback - The callback to emit
14
+ */
15
+ export declare const emitCallback: (context: ModuleContext, callback: GirCallback) => void;
16
+ //# sourceMappingURL=callback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../../src/writers/callback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAmBtD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,aAAa,EAAE,UAAU,WAAW,KAAG,IAO5E,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { renderMethodReturnType, renderMethodSignature } from "./method.js";
2
+ const callbackAsFunction = (callback) => ({
3
+ kind: "function",
4
+ name: callback.name,
5
+ cIdentifier: undefined,
6
+ throws: false,
7
+ introspectable: callback.introspectable,
8
+ shadows: undefined,
9
+ shadowedBy: undefined,
10
+ movedTo: undefined,
11
+ instance: undefined,
12
+ parameters: callback.parameters,
13
+ returnValue: callback.returnValue,
14
+ invoker: undefined,
15
+ });
16
+ /**
17
+ * Emits an `export type` alias for a top-level GIR `<callback>`.
18
+ *
19
+ * The callback is surfaced under its GIR `name` verbatim with a fully typed
20
+ * call signature: input parameters follow {@link renderMethodSignature} (the
21
+ * folded `user_data`/`GDestroyNotify` slots are dropped) and the return follows
22
+ * {@link renderMethodReturnType}, so out-parameters tuple into the return the
23
+ * same way a method's would.
24
+ *
25
+ * @param context - The module context
26
+ * @param callback - The callback to emit
27
+ */
28
+ export const emitCallback = (context, callback) => {
29
+ if (!callback.introspectable)
30
+ return;
31
+ if (callback.name.length === 0)
32
+ return;
33
+ const fn = callbackAsFunction(callback);
34
+ const signature = renderMethodSignature(context, fn);
35
+ const returnType = renderMethodReturnType(context, fn);
36
+ context.module.appendDeclaration(`export type ${callback.name} = (${signature}) => ${returnType};`);
37
+ };
38
+ //# sourceMappingURL=callback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callback.js","sourceRoot":"","sources":["../../src/writers/callback.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,kBAAkB,GAAG,CAAC,QAAqB,EAAe,EAAE,CAAC,CAAC;IAChE,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,QAAQ,CAAC,IAAI;IACnB,WAAW,EAAE,SAAS;IACtB,MAAM,EAAE,KAAK;IACb,cAAc,EAAE,QAAQ,CAAC,cAAc;IACvC,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,SAAS;IACrB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,QAAQ,CAAC,UAAU;IAC/B,WAAW,EAAE,QAAQ,CAAC,WAAW;IACjC,OAAO,EAAE,SAAS;CACrB,CAAC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAsB,EAAE,QAAqB,EAAQ,EAAE;IAChF,IAAI,CAAC,QAAQ,CAAC,cAAc;QAAE,OAAO;IACrC,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IACvC,MAAM,EAAE,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,SAAS,GAAG,qBAAqB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,sBAAsB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACvD,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,eAAe,QAAQ,CAAC,IAAI,OAAO,SAAS,QAAQ,UAAU,GAAG,CAAC,CAAC;AACxG,CAAC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { ModuleContext } from "../dsl/context.js";
2
+ import type { GirBoxed } from "../gir/boxed.js";
3
+ import type { GirFunction } from "../gir/function.js";
4
+ import type { GirTypeRef } from "../gir/type-ref.js";
5
+ /**
6
+ * Reports whether a `<record>` is a GObject class- or interface-struct — the
7
+ * runtime vtable of a type rather than a marshallable value. These are never
8
+ * constructed or passed by value from JavaScript, so codegen emits neither the
9
+ * record nor any binding that references it.
10
+ *
11
+ * @param namespaceName - The namespace the record lives in
12
+ * @param boxed - The record under consideration
13
+ */
14
+ export declare const isClassStructRecord: (namespaceName: string, boxed: GirBoxed) => boolean;
15
+ /**
16
+ * Reports whether a type reference resolves to a class/interface-struct record,
17
+ * following array and list element types.
18
+ *
19
+ * @param context - The module context
20
+ * @param ref - The type reference, or `undefined`
21
+ */
22
+ export declare const typeRefIsClassStruct: (context: ModuleContext, ref: GirTypeRef | undefined) => boolean;
23
+ /**
24
+ * Reports whether a callable's return type or any parameter resolves to a
25
+ * class/interface-struct record, so its binding and wrapper can be dropped.
26
+ *
27
+ * @param context - The module context
28
+ * @param fn - The callable
29
+ */
30
+ export declare const callableReferencesClassStruct: (context: ModuleContext, fn: GirFunction) => boolean;
31
+ //# sourceMappingURL=class-struct-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-struct-record.d.ts","sourceRoot":"","sources":["../../src/writers/class-struct-record.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAiBrD;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,eAAe,MAAM,EAAE,OAAO,QAAQ,KAAG,OAO5E,CAAC;AAmBF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,aAAa,EAAE,KAAK,UAAU,GAAG,SAAS,KAAG,OACzD,CAAC;AAEnC;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,GAAI,SAAS,aAAa,EAAE,IAAI,WAAW,KAAG,OAER,CAAC"}