@gtkx/codegen 0.21.0 → 1.0.0-rc.2

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 (756) hide show
  1. package/README.md +173 -0
  2. package/dist/analysis/descriptor-render.d.ts +25 -0
  3. package/dist/analysis/descriptor-render.d.ts.map +1 -0
  4. package/dist/analysis/descriptor-render.js +420 -0
  5. package/dist/analysis/descriptor-render.js.map +1 -0
  6. package/dist/analysis/descriptor.d.ts +62 -0
  7. package/dist/analysis/descriptor.d.ts.map +1 -0
  8. package/dist/analysis/descriptor.js +127 -0
  9. package/dist/analysis/descriptor.js.map +1 -0
  10. package/dist/analysis/inheritance.d.ts +38 -0
  11. package/dist/analysis/inheritance.d.ts.map +1 -0
  12. package/dist/analysis/inheritance.js +248 -0
  13. package/dist/analysis/inheritance.js.map +1 -0
  14. package/dist/analysis/param-structure.d.ts +27 -0
  15. package/dist/analysis/param-structure.d.ts.map +1 -0
  16. package/dist/analysis/param-structure.js +158 -0
  17. package/dist/analysis/param-structure.js.map +1 -0
  18. package/dist/analysis/ts-type.d.ts +20 -0
  19. package/dist/analysis/ts-type.d.ts.map +1 -0
  20. package/dist/analysis/ts-type.js +111 -0
  21. package/dist/analysis/ts-type.js.map +1 -0
  22. package/dist/compile.d.ts +18 -0
  23. package/dist/compile.d.ts.map +1 -0
  24. package/dist/compile.js +130 -0
  25. package/dist/compile.js.map +1 -0
  26. package/dist/docs/api-reference.d.ts +67 -0
  27. package/dist/docs/api-reference.d.ts.map +1 -0
  28. package/dist/docs/api-reference.js +372 -0
  29. package/dist/docs/api-reference.js.map +1 -0
  30. package/dist/docs/element-page.d.ts +12 -0
  31. package/dist/docs/element-page.d.ts.map +1 -0
  32. package/dist/docs/element-page.js +156 -0
  33. package/dist/docs/element-page.js.map +1 -0
  34. package/dist/docs/pipeline.d.ts +26 -0
  35. package/dist/docs/pipeline.d.ts.map +1 -0
  36. package/dist/docs/pipeline.js +156 -0
  37. package/dist/docs/pipeline.js.map +1 -0
  38. package/dist/docs/render.d.ts +34 -0
  39. package/dist/docs/render.d.ts.map +1 -0
  40. package/dist/docs/render.js +143 -0
  41. package/dist/docs/render.js.map +1 -0
  42. package/dist/docs/symbol-page.d.ts +41 -0
  43. package/dist/docs/symbol-page.d.ts.map +1 -0
  44. package/dist/docs/symbol-page.js +380 -0
  45. package/dist/docs/symbol-page.js.map +1 -0
  46. package/dist/fingerprint.d.ts +31 -28
  47. package/dist/fingerprint.d.ts.map +1 -1
  48. package/dist/fingerprint.js +84 -19
  49. package/dist/fingerprint.js.map +1 -1
  50. package/dist/gi.d.ts +13 -0
  51. package/dist/gi.d.ts.map +1 -0
  52. package/dist/gi.js +21 -0
  53. package/dist/gi.js.map +1 -0
  54. package/dist/gir/ancestry.d.ts +10 -0
  55. package/dist/gir/ancestry.d.ts.map +1 -0
  56. package/dist/gir/ancestry.js +26 -0
  57. package/dist/gir/ancestry.js.map +1 -0
  58. package/dist/gir/callback.d.ts +8 -14
  59. package/dist/gir/callback.d.ts.map +1 -1
  60. package/dist/gir/callback.js +16 -16
  61. package/dist/gir/callback.js.map +1 -1
  62. package/dist/gir/class.d.ts +25 -44
  63. package/dist/gir/class.d.ts.map +1 -1
  64. package/dist/gir/class.js +16 -26
  65. package/dist/gir/class.js.map +1 -1
  66. package/dist/gir/enum.d.ts +16 -34
  67. package/dist/gir/enum.d.ts.map +1 -1
  68. package/dist/gir/enum.js +10 -16
  69. package/dist/gir/enum.js.map +1 -1
  70. package/dist/gir/field.d.ts +16 -24
  71. package/dist/gir/field.d.ts.map +1 -1
  72. package/dist/gir/field.js +35 -18
  73. package/dist/gir/field.js.map +1 -1
  74. package/dist/gir/function.d.ts +15 -43
  75. package/dist/gir/function.d.ts.map +1 -1
  76. package/dist/gir/function.js +26 -23
  77. package/dist/gir/function.js.map +1 -1
  78. package/dist/gir/gir-path.d.ts +3 -0
  79. package/dist/gir/gir-path.d.ts.map +1 -0
  80. package/dist/gir/gir-path.js +57 -0
  81. package/dist/gir/gir-path.js.map +1 -0
  82. package/dist/gir/libraries.d.ts +5 -0
  83. package/dist/gir/libraries.d.ts.map +1 -0
  84. package/dist/gir/libraries.js +74 -0
  85. package/dist/gir/libraries.js.map +1 -0
  86. package/dist/gir/library.d.ts +43 -0
  87. package/dist/gir/library.d.ts.map +1 -0
  88. package/dist/gir/library.js +242 -0
  89. package/dist/gir/library.js.map +1 -0
  90. package/dist/gir/namespace.d.ts +40 -54
  91. package/dist/gir/namespace.d.ts.map +1 -1
  92. package/dist/gir/namespace.js +51 -40
  93. package/dist/gir/namespace.js.map +1 -1
  94. package/dist/gir/nullable-overrides.d.ts +3 -0
  95. package/dist/gir/nullable-overrides.d.ts.map +1 -0
  96. package/dist/gir/nullable-overrides.js +5 -0
  97. package/dist/gir/nullable-overrides.js.map +1 -0
  98. package/dist/gir/parameter.d.ts +34 -76
  99. package/dist/gir/parameter.d.ts.map +1 -1
  100. package/dist/gir/parameter.js +47 -59
  101. package/dist/gir/parameter.js.map +1 -1
  102. package/dist/gir/parse.d.ts +12 -77
  103. package/dist/gir/parse.d.ts.map +1 -1
  104. package/dist/gir/parse.js +65 -103
  105. package/dist/gir/parse.js.map +1 -1
  106. package/dist/gir/primitives.d.ts +5 -35
  107. package/dist/gir/primitives.d.ts.map +1 -1
  108. package/dist/gir/primitives.js +21 -36
  109. package/dist/gir/primitives.js.map +1 -1
  110. package/dist/gir/property.d.ts +18 -26
  111. package/dist/gir/property.d.ts.map +1 -1
  112. package/dist/gir/property.js +16 -12
  113. package/dist/gir/property.js.map +1 -1
  114. package/dist/gir/record.d.ts +28 -0
  115. package/dist/gir/record.d.ts.map +1 -0
  116. package/dist/gir/record.js +26 -0
  117. package/dist/gir/record.js.map +1 -0
  118. package/dist/gir/size.d.ts +15 -61
  119. package/dist/gir/size.d.ts.map +1 -1
  120. package/dist/gir/size.js +49 -72
  121. package/dist/gir/size.js.map +1 -1
  122. package/dist/gir/type-id.d.ts +51 -0
  123. package/dist/gir/type-id.d.ts.map +1 -0
  124. package/dist/gir/type-id.js +12 -0
  125. package/dist/gir/type-id.js.map +1 -0
  126. package/dist/gir/type-ref.d.ts +4 -77
  127. package/dist/gir/type-ref.d.ts.map +1 -1
  128. package/dist/gir/type-ref.js +58 -77
  129. package/dist/gir/type-ref.js.map +1 -1
  130. package/dist/gir/type.d.ts +34 -0
  131. package/dist/gir/type.d.ts.map +1 -0
  132. package/dist/gir/type.js +2 -0
  133. package/dist/gir/type.js.map +1 -0
  134. package/dist/index.d.ts +7 -11
  135. package/dist/index.d.ts.map +1 -1
  136. package/dist/index.js +6 -11
  137. package/dist/index.js.map +1 -1
  138. package/dist/jsx.d.ts +26 -0
  139. package/dist/jsx.d.ts.map +1 -0
  140. package/dist/jsx.js +40 -0
  141. package/dist/jsx.js.map +1 -0
  142. package/dist/khronos/args.d.ts +30 -0
  143. package/dist/khronos/args.d.ts.map +1 -0
  144. package/dist/khronos/args.js +171 -0
  145. package/dist/khronos/args.js.map +1 -0
  146. package/dist/khronos/jsdoc.d.ts +21 -0
  147. package/dist/khronos/jsdoc.d.ts.map +1 -0
  148. package/dist/khronos/jsdoc.js +72 -0
  149. package/dist/khronos/jsdoc.js.map +1 -0
  150. package/dist/khronos/model.d.ts +38 -0
  151. package/dist/khronos/model.d.ts.map +1 -0
  152. package/dist/khronos/model.js +167 -0
  153. package/dist/khronos/model.js.map +1 -0
  154. package/dist/khronos/modules.d.ts +12 -0
  155. package/dist/khronos/modules.d.ts.map +1 -0
  156. package/dist/khronos/modules.js +73 -0
  157. package/dist/khronos/modules.js.map +1 -0
  158. package/dist/khronos/param-pair.d.ts +11 -0
  159. package/dist/khronos/param-pair.d.ts.map +1 -0
  160. package/dist/khronos/param-pair.js +6 -0
  161. package/dist/khronos/param-pair.js.map +1 -0
  162. package/dist/khronos/parse.d.ts +8 -0
  163. package/dist/khronos/parse.d.ts.map +1 -0
  164. package/dist/khronos/parse.js +62 -0
  165. package/dist/khronos/parse.js.map +1 -0
  166. package/dist/khronos/pipeline.d.ts +24 -0
  167. package/dist/khronos/pipeline.d.ts.map +1 -0
  168. package/dist/khronos/pipeline.js +223 -0
  169. package/dist/khronos/pipeline.js.map +1 -0
  170. package/dist/khronos/plan.d.ts +81 -0
  171. package/dist/khronos/plan.d.ts.map +1 -0
  172. package/dist/khronos/plan.js +200 -0
  173. package/dist/khronos/plan.js.map +1 -0
  174. package/dist/khronos/render.d.ts +17 -0
  175. package/dist/khronos/render.d.ts.map +1 -0
  176. package/dist/khronos/render.js +205 -0
  177. package/dist/khronos/render.js.map +1 -0
  178. package/dist/khronos/select.d.ts +15 -0
  179. package/dist/khronos/select.d.ts.map +1 -0
  180. package/dist/khronos/select.js +56 -0
  181. package/dist/khronos/select.js.map +1 -0
  182. package/dist/react/element-config.d.ts +17 -0
  183. package/dist/react/element-config.d.ts.map +1 -0
  184. package/dist/react/element-config.js +61 -0
  185. package/dist/react/element-config.js.map +1 -0
  186. package/dist/runner.d.ts +38 -49
  187. package/dist/runner.d.ts.map +1 -1
  188. package/dist/runner.js +81 -54
  189. package/dist/runner.js.map +1 -1
  190. package/dist/store/compile-store.d.ts +11 -0
  191. package/dist/store/compile-store.d.ts.map +1 -0
  192. package/dist/store/compile-store.js +40 -0
  193. package/dist/store/compile-store.js.map +1 -0
  194. package/dist/store/gi/async.d.ts +5 -0
  195. package/dist/store/gi/async.d.ts.map +1 -0
  196. package/dist/store/gi/async.js +45 -0
  197. package/dist/store/gi/async.js.map +1 -0
  198. package/dist/store/gi/callables.d.ts +42 -0
  199. package/dist/store/gi/callables.d.ts.map +1 -0
  200. package/dist/store/gi/callables.js +264 -0
  201. package/dist/store/gi/callables.js.map +1 -0
  202. package/dist/store/gi/callback.d.ts +5 -0
  203. package/dist/store/gi/callback.d.ts.map +1 -0
  204. package/dist/store/gi/callback.js +17 -0
  205. package/dist/store/gi/callback.js.map +1 -0
  206. package/dist/store/gi/class-struct-record.d.ts +10 -0
  207. package/dist/store/gi/class-struct-record.d.ts.map +1 -0
  208. package/dist/store/gi/class-struct-record.js +52 -0
  209. package/dist/store/gi/class-struct-record.js.map +1 -0
  210. package/dist/store/gi/class.d.ts +5 -0
  211. package/dist/store/gi/class.d.ts.map +1 -0
  212. package/dist/store/gi/class.js +208 -0
  213. package/dist/store/gi/class.js.map +1 -0
  214. package/dist/store/gi/companion.d.ts +5 -0
  215. package/dist/store/gi/companion.d.ts.map +1 -0
  216. package/dist/store/gi/companion.js +16 -0
  217. package/dist/store/gi/companion.js.map +1 -0
  218. package/dist/store/gi/constant.d.ts +6 -0
  219. package/dist/store/gi/constant.d.ts.map +1 -0
  220. package/dist/store/gi/constant.js +35 -0
  221. package/dist/store/gi/constant.js.map +1 -0
  222. package/dist/store/gi/constructor-props.d.ts +6 -0
  223. package/dist/store/gi/constructor-props.d.ts.map +1 -0
  224. package/dist/store/gi/constructor-props.js +71 -0
  225. package/dist/store/gi/constructor-props.js.map +1 -0
  226. package/dist/store/gi/enum.d.ts +6 -0
  227. package/dist/store/gi/enum.d.ts.map +1 -0
  228. package/dist/store/gi/enum.js +41 -0
  229. package/dist/store/gi/enum.js.map +1 -0
  230. package/dist/store/gi/function.d.ts +9 -0
  231. package/dist/store/gi/function.d.ts.map +1 -0
  232. package/dist/store/gi/function.js +114 -0
  233. package/dist/store/gi/function.js.map +1 -0
  234. package/dist/store/gi/gtype-binding.d.ts +10 -0
  235. package/dist/store/gi/gtype-binding.d.ts.map +1 -0
  236. package/dist/store/gi/gtype-binding.js +24 -0
  237. package/dist/store/gi/gtype-binding.js.map +1 -0
  238. package/dist/store/gi/interface.d.ts +5 -0
  239. package/dist/store/gi/interface.d.ts.map +1 -0
  240. package/dist/store/gi/interface.js +117 -0
  241. package/dist/store/gi/interface.js.map +1 -0
  242. package/dist/store/gi/item-comparators.d.ts +7 -0
  243. package/dist/store/gi/item-comparators.d.ts.map +1 -0
  244. package/dist/store/gi/item-comparators.js +88 -0
  245. package/dist/store/gi/item-comparators.js.map +1 -0
  246. package/dist/store/gi/method.d.ts +24 -0
  247. package/dist/store/gi/method.d.ts.map +1 -0
  248. package/dist/store/gi/method.js +336 -0
  249. package/dist/store/gi/method.js.map +1 -0
  250. package/dist/store/gi/param-marshal.d.ts +10 -0
  251. package/dist/store/gi/param-marshal.d.ts.map +1 -0
  252. package/dist/store/gi/param-marshal.js +50 -0
  253. package/dist/store/gi/param-marshal.js.map +1 -0
  254. package/dist/store/gi/pipeline.d.ts +5 -0
  255. package/dist/store/gi/pipeline.d.ts.map +1 -0
  256. package/dist/store/gi/pipeline.js +95 -0
  257. package/dist/store/gi/pipeline.js.map +1 -0
  258. package/dist/store/gi/properties.d.ts +6 -0
  259. package/dist/store/gi/properties.d.ts.map +1 -0
  260. package/dist/store/gi/properties.js +32 -0
  261. package/dist/store/gi/properties.js.map +1 -0
  262. package/dist/store/gi/property-accessor.d.ts +27 -0
  263. package/dist/store/gi/property-accessor.d.ts.map +1 -0
  264. package/dist/store/gi/property-accessor.js +158 -0
  265. package/dist/store/gi/property-accessor.js.map +1 -0
  266. package/dist/store/gi/record-constructor.d.ts +6 -0
  267. package/dist/store/gi/record-constructor.d.ts.map +1 -0
  268. package/dist/store/gi/record-constructor.js +76 -0
  269. package/dist/store/gi/record-constructor.js.map +1 -0
  270. package/dist/store/gi/record-field-accessor.d.ts +25 -0
  271. package/dist/store/gi/record-field-accessor.d.ts.map +1 -0
  272. package/dist/store/gi/record-field-accessor.js +360 -0
  273. package/dist/store/gi/record-field-accessor.js.map +1 -0
  274. package/dist/store/gi/record-layout.d.ts +15 -0
  275. package/dist/store/gi/record-layout.d.ts.map +1 -0
  276. package/dist/store/gi/record-layout.js +132 -0
  277. package/dist/store/gi/record-layout.js.map +1 -0
  278. package/dist/store/gi/record.d.ts +5 -0
  279. package/dist/store/gi/record.d.ts.map +1 -0
  280. package/dist/store/gi/record.js +65 -0
  281. package/dist/store/gi/record.js.map +1 -0
  282. package/dist/store/gi/registration.d.ts +16 -0
  283. package/dist/store/gi/registration.d.ts.map +1 -0
  284. package/dist/store/gi/registration.js +21 -0
  285. package/dist/store/gi/registration.js.map +1 -0
  286. package/dist/store/gi/return-wrap.d.ts +10 -0
  287. package/dist/store/gi/return-wrap.d.ts.map +1 -0
  288. package/dist/store/gi/return-wrap.js +67 -0
  289. package/dist/store/gi/return-wrap.js.map +1 -0
  290. package/dist/store/gi/runtime-override.d.ts +4 -0
  291. package/dist/store/gi/runtime-override.d.ts.map +1 -0
  292. package/dist/store/gi/runtime-override.js +32 -0
  293. package/dist/store/gi/runtime-override.js.map +1 -0
  294. package/dist/store/gi/signal.d.ts +6 -0
  295. package/dist/store/gi/signal.d.ts.map +1 -0
  296. package/dist/store/gi/signal.js +280 -0
  297. package/dist/store/gi/signal.js.map +1 -0
  298. package/dist/store/gi/vtable.d.ts +5 -0
  299. package/dist/store/gi/vtable.d.ts.map +1 -0
  300. package/dist/store/gi/vtable.js +108 -0
  301. package/dist/store/gi/vtable.js.map +1 -0
  302. package/dist/store/gi-store.d.ts +10 -0
  303. package/dist/store/gi-store.d.ts.map +1 -0
  304. package/dist/store/gi-store.js +59 -0
  305. package/dist/store/gi-store.js.map +1 -0
  306. package/dist/store/jsx/element-components.d.ts +23 -0
  307. package/dist/store/jsx/element-components.d.ts.map +1 -0
  308. package/dist/store/jsx/element-components.js +86 -0
  309. package/dist/store/jsx/element-components.js.map +1 -0
  310. package/dist/store/jsx/element-prop-imports.d.ts +17 -0
  311. package/dist/store/jsx/element-prop-imports.d.ts.map +1 -0
  312. package/dist/store/jsx/element-prop-imports.js +15 -0
  313. package/dist/store/jsx/element-prop-imports.js.map +1 -0
  314. package/dist/store/jsx/element-prop-types.d.ts +10 -0
  315. package/dist/store/jsx/element-prop-types.d.ts.map +1 -0
  316. package/dist/store/jsx/element-prop-types.js +41 -0
  317. package/dist/store/jsx/element-prop-types.js.map +1 -0
  318. package/dist/store/jsx/gir-index.d.ts +16 -0
  319. package/dist/store/jsx/gir-index.d.ts.map +1 -0
  320. package/dist/store/jsx/gir-index.js +33 -0
  321. package/dist/store/jsx/gir-index.js.map +1 -0
  322. package/dist/store/jsx/intrinsic-elements.d.ts +27 -0
  323. package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -0
  324. package/dist/store/jsx/intrinsic-elements.js +128 -0
  325. package/dist/store/jsx/intrinsic-elements.js.map +1 -0
  326. package/dist/store/jsx/jsx.d.ts +16 -0
  327. package/dist/store/jsx/jsx.d.ts.map +1 -0
  328. package/dist/store/jsx/jsx.js +242 -0
  329. package/dist/store/jsx/jsx.js.map +1 -0
  330. package/dist/store/jsx/metadata.d.ts +4 -0
  331. package/dist/store/jsx/metadata.d.ts.map +1 -0
  332. package/dist/store/jsx/metadata.js +253 -0
  333. package/dist/store/jsx/metadata.js.map +1 -0
  334. package/dist/store/jsx/pipeline.d.ts +21 -0
  335. package/dist/store/jsx/pipeline.d.ts.map +1 -0
  336. package/dist/store/jsx/pipeline.js +81 -0
  337. package/dist/store/jsx/pipeline.js.map +1 -0
  338. package/dist/store/jsx/props.d.ts +33 -0
  339. package/dist/store/jsx/props.d.ts.map +1 -0
  340. package/dist/store/jsx/props.js +158 -0
  341. package/dist/store/jsx/props.js.map +1 -0
  342. package/dist/store/jsx-store.d.ts +7 -0
  343. package/dist/store/jsx-store.d.ts.map +1 -0
  344. package/dist/store/jsx-store.js +26 -0
  345. package/dist/store/jsx-store.js.map +1 -0
  346. package/dist/store/store-fs.d.ts +43 -0
  347. package/dist/store/store-fs.d.ts.map +1 -0
  348. package/dist/store/store-fs.js +73 -0
  349. package/dist/store/store-fs.js.map +1 -0
  350. package/dist/writer/context.d.ts +17 -0
  351. package/dist/writer/context.d.ts.map +1 -0
  352. package/dist/writer/context.js +50 -0
  353. package/dist/writer/context.js.map +1 -0
  354. package/dist/writer/doc.d.ts +3 -0
  355. package/dist/writer/doc.d.ts.map +1 -0
  356. package/dist/writer/doc.js +18 -0
  357. package/dist/writer/doc.js.map +1 -0
  358. package/dist/writer/emit.d.ts +9 -0
  359. package/dist/writer/emit.d.ts.map +1 -0
  360. package/dist/writer/emit.js +24 -0
  361. package/dist/writer/emit.js.map +1 -0
  362. package/dist/writer/gtk-doc.d.ts +3 -0
  363. package/dist/writer/gtk-doc.d.ts.map +1 -0
  364. package/dist/writer/gtk-doc.js +78 -0
  365. package/dist/writer/gtk-doc.js.map +1 -0
  366. package/dist/writer/imports.d.ts +12 -0
  367. package/dist/writer/imports.d.ts.map +1 -0
  368. package/dist/writer/imports.js +61 -0
  369. package/dist/writer/imports.js.map +1 -0
  370. package/dist/writer/module.d.ts +16 -0
  371. package/dist/writer/module.d.ts.map +1 -0
  372. package/dist/writer/module.js +53 -0
  373. package/dist/writer/module.js.map +1 -0
  374. package/dist/xml.d.ts +4 -0
  375. package/dist/xml.d.ts.map +1 -0
  376. package/dist/xml.js +10 -0
  377. package/dist/xml.js.map +1 -0
  378. package/overrides/cairo/context.ts.ejs +1269 -0
  379. package/overrides/cairo/font-face.ts.ejs +151 -0
  380. package/overrides/cairo/font-options.ts.ejs +199 -0
  381. package/overrides/cairo/image-surface.ts.ejs +132 -0
  382. package/overrides/cairo/index.ts.ejs +22 -0
  383. package/overrides/cairo/matrix.ts.ejs +171 -0
  384. package/overrides/cairo/pattern.ts.ejs +476 -0
  385. package/overrides/cairo/recording-surface.ts.ejs +102 -0
  386. package/overrides/cairo/region.ts.ejs +237 -0
  387. package/overrides/cairo/scaled-font.ts.ejs +330 -0
  388. package/overrides/cairo/surface.ts.ejs +296 -0
  389. package/overrides/gdk/index.ts.ejs +2 -0
  390. package/overrides/gdk/rgba.ts.ejs +11 -0
  391. package/overrides/gobject/index.ts.ejs +29 -0
  392. package/overrides/gobject/object.ts.ejs +51 -0
  393. package/overrides/gobject/value.ts.ejs +17 -0
  394. package/overrides/graphene/index.ts.ejs +2 -0
  395. package/overrides/graphene/structs.ts.ejs +37 -0
  396. package/package.json +21 -15
  397. package/src/analysis/descriptor-render.ts +723 -0
  398. package/src/analysis/descriptor.ts +300 -0
  399. package/src/analysis/inheritance.ts +430 -0
  400. package/src/analysis/param-structure.ts +258 -0
  401. package/src/analysis/ts-type.ts +174 -0
  402. package/src/compile.ts +179 -0
  403. package/src/docs/api-reference.ts +557 -0
  404. package/src/docs/element-page.ts +281 -0
  405. package/src/docs/pipeline.ts +241 -0
  406. package/src/docs/render.ts +255 -0
  407. package/src/docs/symbol-page.ts +589 -0
  408. package/src/fingerprint.ts +144 -35
  409. package/src/gi.ts +26 -0
  410. package/src/gir/ancestry.ts +53 -0
  411. package/src/gir/callback.ts +22 -24
  412. package/src/gir/class.ts +39 -61
  413. package/src/gir/enum.ts +25 -41
  414. package/src/gir/field.ts +51 -37
  415. package/src/gir/function.ts +44 -59
  416. package/src/gir/gir-path.ts +73 -0
  417. package/src/gir/libraries.ts +102 -0
  418. package/src/gir/library.ts +351 -0
  419. package/src/gir/namespace.ts +109 -88
  420. package/src/gir/nullable-overrides.ts +5 -0
  421. package/src/gir/parameter.ts +111 -102
  422. package/src/gir/parse.ts +124 -121
  423. package/src/gir/primitives.ts +43 -63
  424. package/src/gir/property.ts +33 -33
  425. package/src/gir/record.ts +55 -0
  426. package/src/gir/size.ts +93 -107
  427. package/src/gir/type-id.ts +64 -0
  428. package/src/gir/type-ref.ts +77 -146
  429. package/src/gir/type.ts +18 -0
  430. package/src/index.ts +27 -15
  431. package/src/jsx.ts +70 -0
  432. package/src/khronos/args.ts +271 -0
  433. package/src/khronos/jsdoc.ts +114 -0
  434. package/src/khronos/model.ts +267 -0
  435. package/src/khronos/modules.ts +115 -0
  436. package/src/khronos/param-pair.ts +14 -0
  437. package/src/khronos/parse.ts +86 -0
  438. package/src/khronos/pipeline.ts +337 -0
  439. package/src/khronos/plan.ts +340 -0
  440. package/src/khronos/registry/LICENSE +202 -0
  441. package/src/khronos/registry/gl.xml +47748 -0
  442. package/src/khronos/render.ts +330 -0
  443. package/src/khronos/select.ts +97 -0
  444. package/src/react/element-config.ts +91 -0
  445. package/src/runner.ts +153 -80
  446. package/src/store/compile-store.ts +55 -0
  447. package/src/store/gi/async.ts +69 -0
  448. package/src/store/gi/callables.ts +518 -0
  449. package/src/store/gi/callback.ts +24 -0
  450. package/src/store/gi/class-struct-record.ts +72 -0
  451. package/src/store/gi/class.ts +334 -0
  452. package/src/store/gi/companion.ts +22 -0
  453. package/src/store/gi/constant.ts +58 -0
  454. package/src/store/gi/constructor-props.ts +108 -0
  455. package/src/store/gi/enum.ts +64 -0
  456. package/src/store/gi/function.ts +173 -0
  457. package/src/store/gi/gtype-binding.ts +46 -0
  458. package/src/store/gi/interface.ts +222 -0
  459. package/src/store/gi/item-comparators.ts +138 -0
  460. package/src/store/gi/method.ts +634 -0
  461. package/src/store/gi/param-marshal.ts +71 -0
  462. package/src/store/gi/pipeline.ts +135 -0
  463. package/src/store/gi/properties.ts +50 -0
  464. package/src/store/gi/property-accessor.ts +302 -0
  465. package/src/store/gi/record-constructor.ts +119 -0
  466. package/src/store/gi/record-field-accessor.ts +607 -0
  467. package/src/store/gi/record-layout.ts +221 -0
  468. package/src/store/gi/record.ts +89 -0
  469. package/src/store/gi/registration.ts +44 -0
  470. package/src/store/gi/return-wrap.ts +100 -0
  471. package/src/store/gi/runtime-override.ts +46 -0
  472. package/src/store/gi/signal.ts +450 -0
  473. package/src/store/gi/vtable.ts +175 -0
  474. package/src/store/gi-store.ts +92 -0
  475. package/src/store/jsx/element-components.ts +152 -0
  476. package/src/store/jsx/element-prop-imports.ts +24 -0
  477. package/src/store/jsx/element-prop-types.ts +59 -0
  478. package/src/store/jsx/gir-index.ts +62 -0
  479. package/src/store/jsx/intrinsic-elements.ts +262 -0
  480. package/src/store/jsx/jsx.ts +408 -0
  481. package/src/store/jsx/metadata.ts +385 -0
  482. package/src/store/jsx/pipeline.ts +145 -0
  483. package/src/store/jsx/props.ts +274 -0
  484. package/src/store/jsx-store.ts +39 -0
  485. package/src/store/store-fs.ts +128 -0
  486. package/src/writer/context.ts +67 -0
  487. package/src/writer/doc.ts +25 -0
  488. package/src/writer/emit.ts +35 -0
  489. package/src/writer/gtk-doc.ts +101 -0
  490. package/src/writer/imports.ts +94 -0
  491. package/src/writer/module.ts +69 -0
  492. package/src/xml.ts +12 -0
  493. package/LICENSE +0 -373
  494. package/dist/dsl/context.d.ts +0 -104
  495. package/dist/dsl/context.d.ts.map +0 -1
  496. package/dist/dsl/context.js +0 -140
  497. package/dist/dsl/context.js.map +0 -1
  498. package/dist/dsl/emit.d.ts +0 -28
  499. package/dist/dsl/emit.d.ts.map +0 -1
  500. package/dist/dsl/emit.js +0 -41
  501. package/dist/dsl/emit.js.map +0 -1
  502. package/dist/dsl/identifier.d.ts +0 -28
  503. package/dist/dsl/identifier.d.ts.map +0 -1
  504. package/dist/dsl/identifier.js +0 -45
  505. package/dist/dsl/identifier.js.map +0 -1
  506. package/dist/dsl/imports.d.ts +0 -58
  507. package/dist/dsl/imports.d.ts.map +0 -1
  508. package/dist/dsl/imports.js +0 -107
  509. package/dist/dsl/imports.js.map +0 -1
  510. package/dist/dsl/module.d.ts +0 -53
  511. package/dist/dsl/module.d.ts.map +0 -1
  512. package/dist/dsl/module.js +0 -76
  513. package/dist/dsl/module.js.map +0 -1
  514. package/dist/ffi/pipeline.d.ts +0 -19
  515. package/dist/ffi/pipeline.d.ts.map +0 -1
  516. package/dist/ffi/pipeline.js +0 -107
  517. package/dist/ffi/pipeline.js.map +0 -1
  518. package/dist/gi-store.d.ts +0 -34
  519. package/dist/gi-store.d.ts.map +0 -1
  520. package/dist/gi-store.js +0 -154
  521. package/dist/gi-store.js.map +0 -1
  522. package/dist/gir/boxed.d.ts +0 -66
  523. package/dist/gir/boxed.d.ts.map +0 -1
  524. package/dist/gir/boxed.js +0 -49
  525. package/dist/gir/boxed.js.map +0 -1
  526. package/dist/gir/qualified-name.d.ts +0 -37
  527. package/dist/gir/qualified-name.d.ts.map +0 -1
  528. package/dist/gir/qualified-name.js +0 -39
  529. package/dist/gir/qualified-name.js.map +0 -1
  530. package/dist/gir/qualify.d.ts +0 -32
  531. package/dist/gir/qualify.d.ts.map +0 -1
  532. package/dist/gir/qualify.js +0 -60
  533. package/dist/gir/qualify.js.map +0 -1
  534. package/dist/gir/repository.d.ts +0 -82
  535. package/dist/gir/repository.d.ts.map +0 -1
  536. package/dist/gir/repository.js +0 -122
  537. package/dist/gir/repository.js.map +0 -1
  538. package/dist/gir/signal.d.ts +0 -22
  539. package/dist/gir/signal.d.ts.map +0 -1
  540. package/dist/gir/signal.js +0 -20
  541. package/dist/gir/signal.js.map +0 -1
  542. package/dist/jsx-store.d.ts +0 -22
  543. package/dist/jsx-store.d.ts.map +0 -1
  544. package/dist/jsx-store.js +0 -40
  545. package/dist/jsx-store.js.map +0 -1
  546. package/dist/react/compounds-meta.d.ts +0 -18
  547. package/dist/react/compounds-meta.d.ts.map +0 -1
  548. package/dist/react/compounds-meta.js +0 -93
  549. package/dist/react/compounds-meta.js.map +0 -1
  550. package/dist/react/compounds.d.ts +0 -27
  551. package/dist/react/compounds.d.ts.map +0 -1
  552. package/dist/react/compounds.js +0 -164
  553. package/dist/react/compounds.js.map +0 -1
  554. package/dist/react/internal.d.ts +0 -14
  555. package/dist/react/internal.d.ts.map +0 -1
  556. package/dist/react/internal.js +0 -79
  557. package/dist/react/internal.js.map +0 -1
  558. package/dist/react/jsx.d.ts +0 -22
  559. package/dist/react/jsx.d.ts.map +0 -1
  560. package/dist/react/jsx.js +0 -134
  561. package/dist/react/jsx.js.map +0 -1
  562. package/dist/react/pipeline.d.ts +0 -13
  563. package/dist/react/pipeline.d.ts.map +0 -1
  564. package/dist/react/pipeline.js +0 -25
  565. package/dist/react/pipeline.js.map +0 -1
  566. package/dist/react/props.d.ts +0 -38
  567. package/dist/react/props.d.ts.map +0 -1
  568. package/dist/react/props.js +0 -231
  569. package/dist/react/props.js.map +0 -1
  570. package/dist/react/slot-props.d.ts +0 -10
  571. package/dist/react/slot-props.d.ts.map +0 -1
  572. package/dist/react/slot-props.js +0 -56
  573. package/dist/react/slot-props.js.map +0 -1
  574. package/dist/react/widgets.d.ts +0 -83
  575. package/dist/react/widgets.d.ts.map +0 -1
  576. package/dist/react/widgets.js +0 -152
  577. package/dist/react/widgets.js.map +0 -1
  578. package/dist/store-fs.d.ts +0 -109
  579. package/dist/store-fs.d.ts.map +0 -1
  580. package/dist/store-fs.js +0 -98
  581. package/dist/store-fs.js.map +0 -1
  582. package/dist/transpile.d.ts +0 -32
  583. package/dist/transpile.d.ts.map +0 -1
  584. package/dist/transpile.js +0 -63
  585. package/dist/transpile.js.map +0 -1
  586. package/dist/typecheck-store.d.ts +0 -41
  587. package/dist/typecheck-store.d.ts.map +0 -1
  588. package/dist/typecheck-store.js +0 -102
  589. package/dist/typecheck-store.js.map +0 -1
  590. package/dist/writers/alias.d.ts +0 -13
  591. package/dist/writers/alias.d.ts.map +0 -1
  592. package/dist/writers/alias.js +0 -17
  593. package/dist/writers/alias.js.map +0 -1
  594. package/dist/writers/async.d.ts +0 -22
  595. package/dist/writers/async.d.ts.map +0 -1
  596. package/dist/writers/async.js +0 -48
  597. package/dist/writers/async.js.map +0 -1
  598. package/dist/writers/boxed-constructor.d.ts +0 -26
  599. package/dist/writers/boxed-constructor.d.ts.map +0 -1
  600. package/dist/writers/boxed-constructor.js +0 -85
  601. package/dist/writers/boxed-constructor.js.map +0 -1
  602. package/dist/writers/boxed-field-accessor.d.ts +0 -18
  603. package/dist/writers/boxed-field-accessor.d.ts.map +0 -1
  604. package/dist/writers/boxed-field-accessor.js +0 -260
  605. package/dist/writers/boxed-field-accessor.js.map +0 -1
  606. package/dist/writers/boxed-layout.d.ts +0 -27
  607. package/dist/writers/boxed-layout.d.ts.map +0 -1
  608. package/dist/writers/boxed-layout.js +0 -128
  609. package/dist/writers/boxed-layout.js.map +0 -1
  610. package/dist/writers/boxed.d.ts +0 -20
  611. package/dist/writers/boxed.d.ts.map +0 -1
  612. package/dist/writers/boxed.js +0 -71
  613. package/dist/writers/boxed.js.map +0 -1
  614. package/dist/writers/callables.d.ts +0 -124
  615. package/dist/writers/callables.d.ts.map +0 -1
  616. package/dist/writers/callables.js +0 -283
  617. package/dist/writers/callables.js.map +0 -1
  618. package/dist/writers/callback.d.ts +0 -16
  619. package/dist/writers/callback.d.ts.map +0 -1
  620. package/dist/writers/callback.js +0 -38
  621. package/dist/writers/callback.js.map +0 -1
  622. package/dist/writers/class-struct-record.d.ts +0 -31
  623. package/dist/writers/class-struct-record.d.ts.map +0 -1
  624. package/dist/writers/class-struct-record.js +0 -67
  625. package/dist/writers/class-struct-record.js.map +0 -1
  626. package/dist/writers/class-struct.d.ts +0 -22
  627. package/dist/writers/class-struct.d.ts.map +0 -1
  628. package/dist/writers/class-struct.js +0 -85
  629. package/dist/writers/class-struct.js.map +0 -1
  630. package/dist/writers/class.d.ts +0 -16
  631. package/dist/writers/class.d.ts.map +0 -1
  632. package/dist/writers/class.js +0 -307
  633. package/dist/writers/class.js.map +0 -1
  634. package/dist/writers/constant.d.ts +0 -15
  635. package/dist/writers/constant.d.ts.map +0 -1
  636. package/dist/writers/constant.js +0 -23
  637. package/dist/writers/constant.js.map +0 -1
  638. package/dist/writers/constants.d.ts +0 -15
  639. package/dist/writers/constants.d.ts.map +0 -1
  640. package/dist/writers/constants.js +0 -23
  641. package/dist/writers/constants.js.map +0 -1
  642. package/dist/writers/constructor-props.d.ts +0 -32
  643. package/dist/writers/constructor-props.d.ts.map +0 -1
  644. package/dist/writers/constructor-props.js +0 -110
  645. package/dist/writers/constructor-props.js.map +0 -1
  646. package/dist/writers/enum.d.ts +0 -21
  647. package/dist/writers/enum.d.ts.map +0 -1
  648. package/dist/writers/enum.js +0 -48
  649. package/dist/writers/enum.js.map +0 -1
  650. package/dist/writers/function.d.ts +0 -40
  651. package/dist/writers/function.d.ts.map +0 -1
  652. package/dist/writers/function.js +0 -127
  653. package/dist/writers/function.js.map +0 -1
  654. package/dist/writers/gtype-binding.d.ts +0 -19
  655. package/dist/writers/gtype-binding.d.ts.map +0 -1
  656. package/dist/writers/gtype-binding.js +0 -40
  657. package/dist/writers/gtype-binding.js.map +0 -1
  658. package/dist/writers/inheritance.d.ts +0 -48
  659. package/dist/writers/inheritance.d.ts.map +0 -1
  660. package/dist/writers/inheritance.js +0 -90
  661. package/dist/writers/inheritance.js.map +0 -1
  662. package/dist/writers/interface.d.ts +0 -16
  663. package/dist/writers/interface.d.ts.map +0 -1
  664. package/dist/writers/interface.js +0 -155
  665. package/dist/writers/interface.js.map +0 -1
  666. package/dist/writers/method.d.ts +0 -150
  667. package/dist/writers/method.d.ts.map +0 -1
  668. package/dist/writers/method.js +0 -510
  669. package/dist/writers/method.js.map +0 -1
  670. package/dist/writers/param-classify.d.ts +0 -93
  671. package/dist/writers/param-classify.d.ts.map +0 -1
  672. package/dist/writers/param-classify.js +0 -163
  673. package/dist/writers/param-classify.js.map +0 -1
  674. package/dist/writers/property-accessor.d.ts +0 -19
  675. package/dist/writers/property-accessor.d.ts.map +0 -1
  676. package/dist/writers/property-accessor.js +0 -117
  677. package/dist/writers/property-accessor.js.map +0 -1
  678. package/dist/writers/registration.d.ts +0 -27
  679. package/dist/writers/registration.d.ts.map +0 -1
  680. package/dist/writers/registration.js +0 -30
  681. package/dist/writers/registration.js.map +0 -1
  682. package/dist/writers/return-wrap.d.ts +0 -39
  683. package/dist/writers/return-wrap.d.ts.map +0 -1
  684. package/dist/writers/return-wrap.js +0 -152
  685. package/dist/writers/return-wrap.js.map +0 -1
  686. package/dist/writers/runtime-override.d.ts +0 -18
  687. package/dist/writers/runtime-override.d.ts.map +0 -1
  688. package/dist/writers/runtime-override.js +0 -44
  689. package/dist/writers/runtime-override.js.map +0 -1
  690. package/dist/writers/signal.d.ts +0 -21
  691. package/dist/writers/signal.d.ts.map +0 -1
  692. package/dist/writers/signal.js +0 -260
  693. package/dist/writers/signal.js.map +0 -1
  694. package/dist/writers/ts-type.d.ts +0 -50
  695. package/dist/writers/ts-type.d.ts.map +0 -1
  696. package/dist/writers/ts-type.js +0 -75
  697. package/dist/writers/ts-type.js.map +0 -1
  698. package/dist/writers/types-ts.d.ts +0 -27
  699. package/dist/writers/types-ts.d.ts.map +0 -1
  700. package/dist/writers/types-ts.js +0 -97
  701. package/dist/writers/types-ts.js.map +0 -1
  702. package/dist/writers/value.d.ts +0 -89
  703. package/dist/writers/value.d.ts.map +0 -1
  704. package/dist/writers/value.js +0 -402
  705. package/dist/writers/value.js.map +0 -1
  706. package/src/dsl/context.ts +0 -146
  707. package/src/dsl/emit.ts +0 -42
  708. package/src/dsl/identifier.ts +0 -52
  709. package/src/dsl/imports.ts +0 -109
  710. package/src/dsl/module.ts +0 -75
  711. package/src/ffi/pipeline.ts +0 -113
  712. package/src/gi-store.ts +0 -199
  713. package/src/gir/boxed.ts +0 -94
  714. package/src/gir/qualified-name.ts +0 -55
  715. package/src/gir/qualify.ts +0 -64
  716. package/src/gir/repository.ts +0 -149
  717. package/src/gir/signal.ts +0 -36
  718. package/src/jsx-store.ts +0 -53
  719. package/src/react/compounds-meta.ts +0 -99
  720. package/src/react/compounds.ts +0 -204
  721. package/src/react/internal.ts +0 -91
  722. package/src/react/jsx.ts +0 -155
  723. package/src/react/pipeline.ts +0 -29
  724. package/src/react/props.ts +0 -307
  725. package/src/react/slot-props.ts +0 -57
  726. package/src/react/widgets.ts +0 -185
  727. package/src/store-fs.ts +0 -157
  728. package/src/transpile.ts +0 -80
  729. package/src/typecheck-store.ts +0 -136
  730. package/src/writers/alias.ts +0 -19
  731. package/src/writers/async.ts +0 -44
  732. package/src/writers/boxed-constructor.ts +0 -105
  733. package/src/writers/boxed-field-accessor.ts +0 -306
  734. package/src/writers/boxed-layout.ts +0 -166
  735. package/src/writers/boxed.ts +0 -77
  736. package/src/writers/callables.ts +0 -339
  737. package/src/writers/callback.ts +0 -40
  738. package/src/writers/class-struct-record.ts +0 -75
  739. package/src/writers/class-struct.ts +0 -96
  740. package/src/writers/class.ts +0 -384
  741. package/src/writers/constant.ts +0 -29
  742. package/src/writers/constructor-props.ts +0 -130
  743. package/src/writers/enum.ts +0 -53
  744. package/src/writers/function.ts +0 -136
  745. package/src/writers/gtype-binding.ts +0 -48
  746. package/src/writers/inheritance.ts +0 -104
  747. package/src/writers/interface.ts +0 -168
  748. package/src/writers/method.ts +0 -678
  749. package/src/writers/param-classify.ts +0 -178
  750. package/src/writers/property-accessor.ts +0 -139
  751. package/src/writers/registration.ts +0 -42
  752. package/src/writers/return-wrap.ts +0 -180
  753. package/src/writers/runtime-override.ts +0 -59
  754. package/src/writers/signal.ts +0 -318
  755. package/src/writers/ts-type.ts +0 -115
  756. package/src/writers/value.ts +0 -485
@@ -1,140 +0,0 @@
1
- import { ModuleBuilder } from "./module.js";
2
- /**
3
- * Shared context handed to every writer for a single generated FFI module.
4
- *
5
- * Bundles the namespace the writer is emitting for, the broader repository
6
- * (for cross-namespace lookups), and the in-progress {@link ModuleBuilder}.
7
- * Writers also call back into this context to register cross-namespace
8
- * runtime imports so individual writers do not need to know the relative
9
- * path layout of the generated output.
10
- *
11
- * Generated bindings live in the `@gtkx/gi` package at `<ns>/<ns>.{js,d.ts}`,
12
- * with a per-namespace barrel at `<ns>/index.js` and the augment overlay at
13
- * `<ns>/augment/*.js`. The hand-written runtime is reached through the single
14
- * `@gtkx/ffi` barrel; sibling generated namespaces are reached relative to the
15
- * gi package root.
16
- */
17
- export class ModuleContext {
18
- namespace;
19
- repository;
20
- module = new ModuleBuilder();
21
- /**
22
- * @param namespace - The namespace this module corresponds to
23
- * @param repository - The repository containing every loaded namespace
24
- */
25
- constructor(namespace, repository) {
26
- this.namespace = namespace;
27
- this.repository = repository;
28
- }
29
- /**
30
- * Adds a named import from the `@gtkx/ffi` runtime barrel.
31
- */
32
- addRuntimeImport(name) {
33
- this.module.imports.addNamed("@gtkx/ffi", name);
34
- }
35
- /**
36
- * Adds a type-only named import from the `@gtkx/ffi` runtime barrel
37
- * (`import { type Name }`), erased from the emitted `.js`.
38
- */
39
- addRuntimeTypeImport(name) {
40
- this.module.imports.addNamed("@gtkx/ffi", name, true);
41
- }
42
- /**
43
- * Adds a named import from the low-level `@gtkx/native` runtime.
44
- *
45
- * The transport primitives (`alloc`, `call`, `read`, `write`) live in
46
- * `@gtkx/native`; generated bindings reach them directly so `@gtkx/ffi`
47
- * stays the home of higher-level runtime helpers only.
48
- */
49
- addNativeImport(name) {
50
- this.module.imports.addNamed("@gtkx/native", name);
51
- }
52
- /**
53
- * Adds a type-only named import from `@gtkx/native`
54
- * (`import { type Name }`), erased from the emitted `.js`.
55
- */
56
- addNativeTypeImport(name) {
57
- this.module.imports.addNamed("@gtkx/native", name, true);
58
- }
59
- /** Adds the canonical `constructGObjectInstance` import from `@gtkx/ffi`. */
60
- addConstructGObjectInstanceImport() {
61
- this.module.imports.addNamed("@gtkx/ffi", "constructGObjectInstance");
62
- }
63
- /** Adds the `valueFromFfi` import from `@gtkx/ffi`. */
64
- addValueFromFfiImport() {
65
- this.module.imports.addNamed("@gtkx/ffi", "valueFromFfi");
66
- }
67
- /** Adds the `valueFromFfiOptional` import from `@gtkx/ffi`. */
68
- addValueFromFfiOptionalImport() {
69
- this.module.imports.addNamed("@gtkx/ffi", "valueFromFfiOptional");
70
- }
71
- /**
72
- * Adds the canonical side-effect imports for `gobject/object.js` and
73
- * `gobject/value.js`.
74
- *
75
- * Skipped for the `GObject` namespace itself (those modules import its
76
- * generated classes) and for `GLib`, which lives below GObject in the
77
- * import graph. Letting GLib bootstrap creates a runtime cycle:
78
- * `gobject.js` imports `glib.js` for `GLib.Variant` return-wrapping,
79
- * `glib.js`'s bootstrap re-enters `gobject/value.js`, and `value.ts`
80
- * touches `Value.prototype` before `gobject.js` has finished defining
81
- * `Value`. Other namespaces install the override on first import.
82
- */
83
- addGObjectBootstrapImports() {
84
- if (this.namespace.name === "GObject")
85
- return;
86
- if (this.namespace.name === "GLib")
87
- return;
88
- this.module.imports.addSideEffect("../gobject/augment/object.js");
89
- this.module.imports.addSideEffect("../gobject/augment/value.js");
90
- }
91
- /**
92
- * Adds a wildcard import for another namespace and returns the local
93
- * alias used.
94
- *
95
- * Most namespaces are routed through their hand-written `index.js` so any
96
- * prototype augmentations (Cairo `Context` methods, Gdk `RGBA`, Graphene
97
- * structs, …) load whenever a generated module references the namespace.
98
- * The foundational `gobject` and `glib` namespaces are routed straight to
99
- * their generated module instead, because their indexes pull in modules
100
- * that depend on values still mid-initialization, which would deadlock the
101
- * import graph.
102
- *
103
- * For non-foundational namespaces a side-effect import is recorded
104
- * alongside the wildcard so the foreign module loads even when its alias
105
- * appears only in type positions. The wildcard alias is type-stripped out
106
- * of the emitted `.js` whenever it is never read as a value, which would
107
- * otherwise drop the foreign module from the runtime graph and skip its
108
- * eager `*_get_type` registrations. The side-effect import survives type
109
- * stripping and pins the module in place. The foundational `gobject` and
110
- * `glib` wildcards are always read as values (enums, base classes) and so
111
- * are never stripped, needing no side-effect pin.
112
- *
113
- * @param namespaceName - The other namespace (e.g. `"GLib"`)
114
- */
115
- addCrossNamespaceImport(namespaceName) {
116
- if (namespaceName === this.namespace.name)
117
- return namespaceName;
118
- const directory = namespaceName.toLowerCase();
119
- const isFoundational = directory === "gobject" || directory === "glib";
120
- const path = isFoundational ? `../${directory}/${directory}.js` : `../${directory}/index.js`;
121
- if (!isFoundational)
122
- this.module.imports.addSideEffect(`../${directory}/${directory}.js`);
123
- this.module.imports.addNamespace(path, namespaceName);
124
- return namespaceName;
125
- }
126
- /**
127
- * Renders a namespace-qualified reference to `typeName`: the bare name when
128
- * it lives in this module's own namespace, otherwise `Alias.Name` with the
129
- * foreign namespace imported on demand via {@link addCrossNamespaceImport}.
130
- *
131
- * @param namespaceName - The namespace the referenced type lives in
132
- * @param typeName - The local type or export name within that namespace
133
- */
134
- qualify(namespaceName, typeName) {
135
- if (namespaceName === this.namespace.name)
136
- return typeName;
137
- return `${this.addCrossNamespaceImport(namespaceName)}.${typeName}`;
138
- }
139
- }
140
- //# sourceMappingURL=context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/dsl/context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM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Script
3
- * source. The DSL deliberately stops short of modelling expressions or
4
- * statements — writers compose strings directly using these primitives.
5
- */
6
- /**
7
- * Indents each line of `block` by `level` four-space units.
8
- *
9
- * Lines that are empty stay empty (no trailing whitespace).
10
- *
11
- * @param block - The multi-line source fragment
12
- * @param level - Number of indentation steps to apply
13
- */
14
- export declare const indent: (block: string, level: number) => string;
15
- /**
16
- * Joins `parts` with commas, dropping `undefined` entries.
17
- */
18
- export declare const joinArgs: (parts: ReadonlyArray<string | undefined>) => string;
19
- /**
20
- * Renders an array literal multi-line, indenting each element four spaces
21
- * and adding a trailing comma.
22
- *
23
- * Empty input renders as `[]`.
24
- *
25
- * @param elements - Already-rendered element expressions
26
- */
27
- export declare const arrayLiteral: (elements: readonly string[]) => string;
28
- //# sourceMappingURL=emit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/dsl/emit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,KAAG,MAOrD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,KAAG,MACK,CAAC;AAE1E;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,MAAM,EAAE,KAAG,MAI1D,CAAC"}
package/dist/dsl/emit.js DELETED
@@ -1,41 +0,0 @@
1
- /**
2
- * Tiny string-builder helpers used by the writers to assemble TypeScript
3
- * source. The DSL deliberately stops short of modelling expressions or
4
- * statements — writers compose strings directly using these primitives.
5
- */
6
- /**
7
- * Indents each line of `block` by `level` four-space units.
8
- *
9
- * Lines that are empty stay empty (no trailing whitespace).
10
- *
11
- * @param block - The multi-line source fragment
12
- * @param level - Number of indentation steps to apply
13
- */
14
- export const indent = (block, level) => {
15
- if (level <= 0)
16
- return block;
17
- const prefix = " ".repeat(level);
18
- return block
19
- .split("\n")
20
- .map((line) => (line.length === 0 ? line : `${prefix}${line}`))
21
- .join("\n");
22
- };
23
- /**
24
- * Joins `parts` with commas, dropping `undefined` entries.
25
- */
26
- export const joinArgs = (parts) => parts.filter((part) => part !== undefined).join(", ");
27
- /**
28
- * Renders an array literal multi-line, indenting each element four spaces
29
- * and adding a trailing comma.
30
- *
31
- * Empty input renders as `[]`.
32
- *
33
- * @param elements - Already-rendered element expressions
34
- */
35
- export const arrayLiteral = (elements) => {
36
- if (elements.length === 0)
37
- return "[]";
38
- const lines = elements.map((element) => ` ${element},`);
39
- return `[\n${lines.join("\n")}\n]`;
40
- };
41
- //# sourceMappingURL=emit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emit.js","sourceRoot":"","sources":["../../src/dsl/emit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,KAAa,EAAU,EAAE;IAC3D,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,KAAK;SACP,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC;SAC9D,IAAI,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAwC,EAAU,EAAE,CACzE,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAA2B,EAAU,EAAE;IAChE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,OAAO,GAAG,CAAC,CAAC;IAC3D,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;AACvC,CAAC,CAAC"}
@@ -1,28 +0,0 @@
1
- /**
2
- * Derives the public camelCase export name for a namespace-level callable.
3
- *
4
- * The GIR `name` attribute is camelCased (`quark_from_string` →
5
- * `quarkFromString`); for a shadowing function it is the shadowed short name,
6
- * so `g_idle_add_full` (which shadows `idle_add`) exports as `idleAdd`. When the
7
- * `name` is empty the C identifier is used instead, with the namespace's
8
- * `c:symbol-prefixes` value stripped (e.g. `g_` from `g_quark_from_string`).
9
- * The result is escaped so it never collides with a reserved word.
10
- *
11
- * @param cIdentifier - The C symbol identifier from GIR
12
- * @param girName - The GIR `name` attribute (shadow-resolved)
13
- * @param symbolPrefixes - The namespace's `c:symbol-prefixes` values
14
- */
15
- export declare const namespaceFunctionExportName: (cIdentifier: string, girName: string, symbolPrefixes: readonly string[]) => string;
16
- /**
17
- * Derives the exported identifier for a GIR `<alias>`.
18
- *
19
- * Aliases are surfaced under their GIR `name` (e.g. `Quark`, `Pid`,
20
- * `Allocation`), matching the `@girs` convention. GObject's `Type` alias is the
21
- * one exception: it is published as `GType` so it lines up with the GObject
22
- * runtime's `GType` type and the references that resolve through it.
23
- *
24
- * @param namespaceName - The namespace the alias is declared in
25
- * @param aliasName - The alias's GIR `name`
26
- */
27
- export declare const aliasExportName: (namespaceName: string, aliasName: string) => string;
28
- //# sourceMappingURL=identifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../src/dsl/identifier.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,2BAA2B,GACpC,aAAa,MAAM,EACnB,SAAS,MAAM,EACf,gBAAgB,SAAS,MAAM,EAAE,KAClC,MAMF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAAI,eAAe,MAAM,EAAE,WAAW,MAAM,KAAG,MACE,CAAC"}
@@ -1,45 +0,0 @@
1
- import { toCamelCase, toIdentifier } from "@gtkx/utils";
2
- /**
3
- * Derives the public camelCase export name for a namespace-level callable.
4
- *
5
- * The GIR `name` attribute is camelCased (`quark_from_string` →
6
- * `quarkFromString`); for a shadowing function it is the shadowed short name,
7
- * so `g_idle_add_full` (which shadows `idle_add`) exports as `idleAdd`. When the
8
- * `name` is empty the C identifier is used instead, with the namespace's
9
- * `c:symbol-prefixes` value stripped (e.g. `g_` from `g_quark_from_string`).
10
- * The result is escaped so it never collides with a reserved word.
11
- *
12
- * @param cIdentifier - The C symbol identifier from GIR
13
- * @param girName - The GIR `name` attribute (shadow-resolved)
14
- * @param symbolPrefixes - The namespace's `c:symbol-prefixes` values
15
- */
16
- export const namespaceFunctionExportName = (cIdentifier, girName, symbolPrefixes) => {
17
- if (girName.length > 0) {
18
- return toIdentifier(toCamelCase(girName));
19
- }
20
- const stripped = stripLongestPrefix(cIdentifier, symbolPrefixes);
21
- return toIdentifier(toCamelCase(stripped));
22
- };
23
- /**
24
- * Derives the exported identifier for a GIR `<alias>`.
25
- *
26
- * Aliases are surfaced under their GIR `name` (e.g. `Quark`, `Pid`,
27
- * `Allocation`), matching the `@girs` convention. GObject's `Type` alias is the
28
- * one exception: it is published as `GType` so it lines up with the GObject
29
- * runtime's `GType` type and the references that resolve through it.
30
- *
31
- * @param namespaceName - The namespace the alias is declared in
32
- * @param aliasName - The alias's GIR `name`
33
- */
34
- export const aliasExportName = (namespaceName, aliasName) => namespaceName === "GObject" && aliasName === "Type" ? "GType" : aliasName;
35
- const stripLongestPrefix = (input, prefixes) => {
36
- let best = "";
37
- for (const prefix of prefixes) {
38
- const candidate = `${prefix}_`;
39
- if (input.startsWith(candidate) && candidate.length > best.length) {
40
- best = candidate;
41
- }
42
- }
43
- return best.length === 0 ? input : input.slice(best.length);
44
- };
45
- //# sourceMappingURL=identifier.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../src/dsl/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACvC,WAAmB,EACnB,OAAe,EACf,cAAiC,EAC3B,EAAE;IACR,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACjE,OAAO,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,aAAqB,EAAE,SAAiB,EAAU,EAAE,CAChF,aAAa,KAAK,SAAS,IAAI,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAE9E,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAE,QAA2B,EAAU,EAAE;IAC9E,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC5B,MAAM,SAAS,GAAG,GAAG,MAAM,GAAG,CAAC;QAC/B,IAAI,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAChE,IAAI,GAAG,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAChE,CAAC,CAAC"}
@@ -1,58 +0,0 @@
1
- /**
2
- * Tracks imports for a single generated module.
3
- *
4
- * The DSL is intentionally tiny: it covers what is awkward to do with
5
- * string concatenation (deduplicating named imports, sorting them, mixing
6
- * side-effect and named imports from the same specifier) and leaves
7
- * everything else to raw TS strings the writers compose themselves.
8
- */
9
- export declare class ImportsBuilder {
10
- private readonly named;
11
- private readonly defaultNames;
12
- private readonly namespaces;
13
- private readonly sideEffects;
14
- /**
15
- * Records a named import: `import { foo, bar } from "lib"`.
16
- *
17
- * Repeated calls deduplicate; the final emit alphabetises within the
18
- * braces. A name is emitted with the inline `type` modifier only when
19
- * every recording of it is type-only — a single value import of the same
20
- * name keeps it a value import.
21
- *
22
- * @param specifier - The module specifier (e.g. `"@gtkx/ffi"`)
23
- * @param name - The identifier to import
24
- * @param isType - Whether this recording is type-only (`import { type X }`)
25
- */
26
- addNamed(specifier: string, name: string, isType?: boolean): void;
27
- /**
28
- * Records a namespace import: `import * as Alias from "lib"`.
29
- *
30
- * The first call wins if a different alias is reused for the same
31
- * specifier.
32
- *
33
- * @param specifier - The module specifier
34
- * @param alias - The local alias bound by the import
35
- */
36
- addNamespace(specifier: string, alias: string): void;
37
- /**
38
- * Records a default import: `import Alias from "lib"`. Subsequent calls
39
- * with a different alias are ignored.
40
- *
41
- * @param specifier - The module specifier
42
- * @param alias - The local name bound to the default export
43
- */
44
- addDefault(specifier: string, alias: string): void;
45
- /**
46
- * Records a side-effect-only import: `import "lib"`.
47
- *
48
- * @param specifier - The module specifier
49
- */
50
- addSideEffect(specifier: string): void;
51
- /**
52
- * Renders all imports as a single string ending with a trailing
53
- * newline. Side-effect imports come first (in insertion order),
54
- * followed by named/namespace/default imports sorted by specifier.
55
- */
56
- toSource(): string;
57
- }
58
- //# sourceMappingURL=imports.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../src/dsl/imports.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,qBAAa,cAAc;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA2C;IACjE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAC1D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IACxD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IAEjD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG,IAAI;IAS/D;;;;;;;;OAQG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAMpD;;;;;;OAMG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAMlD;;;;OAIG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAItC;;;;OAIG;IACH,QAAQ,IAAI,MAAM;CA6BrB"}
@@ -1,107 +0,0 @@
1
- import { quote } from "@gtkx/utils";
2
- /**
3
- * Tracks imports for a single generated module.
4
- *
5
- * The DSL is intentionally tiny: it covers what is awkward to do with
6
- * string concatenation (deduplicating named imports, sorting them, mixing
7
- * side-effect and named imports from the same specifier) and leaves
8
- * everything else to raw TS strings the writers compose themselves.
9
- */
10
- export class ImportsBuilder {
11
- named = new Map();
12
- defaultNames = new Map();
13
- namespaces = new Map();
14
- sideEffects = new Set();
15
- /**
16
- * Records a named import: `import { foo, bar } from "lib"`.
17
- *
18
- * Repeated calls deduplicate; the final emit alphabetises within the
19
- * braces. A name is emitted with the inline `type` modifier only when
20
- * every recording of it is type-only — a single value import of the same
21
- * name keeps it a value import.
22
- *
23
- * @param specifier - The module specifier (e.g. `"@gtkx/ffi"`)
24
- * @param name - The identifier to import
25
- * @param isType - Whether this recording is type-only (`import { type X }`)
26
- */
27
- addNamed(specifier, name, isType = false) {
28
- let bucket = this.named.get(specifier);
29
- if (bucket === undefined) {
30
- bucket = new Map();
31
- this.named.set(specifier, bucket);
32
- }
33
- bucket.set(name, (bucket.get(name) ?? true) && isType);
34
- }
35
- /**
36
- * Records a namespace import: `import * as Alias from "lib"`.
37
- *
38
- * The first call wins if a different alias is reused for the same
39
- * specifier.
40
- *
41
- * @param specifier - The module specifier
42
- * @param alias - The local alias bound by the import
43
- */
44
- addNamespace(specifier, alias) {
45
- if (!this.namespaces.has(specifier)) {
46
- this.namespaces.set(specifier, alias);
47
- }
48
- }
49
- /**
50
- * Records a default import: `import Alias from "lib"`. Subsequent calls
51
- * with a different alias are ignored.
52
- *
53
- * @param specifier - The module specifier
54
- * @param alias - The local name bound to the default export
55
- */
56
- addDefault(specifier, alias) {
57
- if (!this.defaultNames.has(specifier)) {
58
- this.defaultNames.set(specifier, alias);
59
- }
60
- }
61
- /**
62
- * Records a side-effect-only import: `import "lib"`.
63
- *
64
- * @param specifier - The module specifier
65
- */
66
- addSideEffect(specifier) {
67
- this.sideEffects.add(specifier);
68
- }
69
- /**
70
- * Renders all imports as a single string ending with a trailing
71
- * newline. Side-effect imports come first (in insertion order),
72
- * followed by named/namespace/default imports sorted by specifier.
73
- */
74
- toSource() {
75
- const lines = [];
76
- for (const specifier of this.sideEffects) {
77
- lines.push(`import ${quote(specifier)};`);
78
- }
79
- const specifiers = new Set([
80
- ...this.named.keys(),
81
- ...this.namespaces.keys(),
82
- ...this.defaultNames.keys(),
83
- ]);
84
- const sortedSpecifiers = [...specifiers].sort((a, b) => a.localeCompare(b));
85
- for (const specifier of sortedSpecifiers) {
86
- const defaultAlias = this.defaultNames.get(specifier);
87
- const namespaceAlias = this.namespaces.get(specifier);
88
- const namedNames = this.named.get(specifier);
89
- const parts = [];
90
- if (defaultAlias !== undefined)
91
- parts.push(defaultAlias);
92
- if (namespaceAlias !== undefined)
93
- parts.push(`* as ${namespaceAlias}`);
94
- if (namedNames !== undefined && namedNames.size > 0) {
95
- const sortedNames = [...namedNames.entries()]
96
- .sort(([a], [b]) => a.localeCompare(b))
97
- .map(([name, isType]) => (isType ? `type ${name}` : name));
98
- parts.push(`{ ${sortedNames.join(", ")} }`);
99
- }
100
- if (parts.length === 0)
101
- continue;
102
- lines.push(`import ${parts.join(", ")} from ${quote(specifier)};`);
103
- }
104
- return lines.length === 0 ? "" : `${lines.join("\n")}\n`;
105
- }
106
- }
107
- //# sourceMappingURL=imports.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"imports.js","sourceRoot":"","sources":["../../src/dsl/imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,OAAO,cAAc;IACN,KAAK,GAAG,IAAI,GAAG,EAAgC,CAAC;IAChD,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IAEjD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,SAAiB,EAAE,IAAY,EAAE,MAAM,GAAG,KAAK;QACpD,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACvC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;YACnB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,MAAM,CAAC,CAAC;IAC3D,CAAC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KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAC7D,CAAC;CACJ"}
@@ -1,53 +0,0 @@
1
- import { ImportsBuilder } from "./imports.js";
2
- /**
3
- * Accumulator for one generated TypeScript module's source.
4
- *
5
- * Writers append code in three logical phases:
6
- *
7
- * 1. *Bindings* — the `const fn_name = t.fn(...)` block at the top.
8
- * 2. *Declarations* — the class bodies, free function exports, enums,
9
- * constants.
10
- * 3. *Registrations* — the trailing `registerNativeClass(...)` block.
11
- *
12
- * Keeping the three buckets independent removes ordering constraints
13
- * between writers and lets {@link emit} stitch a final source string with
14
- * the same shape every generated file uses today.
15
- */
16
- export declare class ModuleBuilder {
17
- /** Imports manifest the writers feed into. */
18
- readonly imports: ImportsBuilder;
19
- private readonly bindings;
20
- private readonly bindingNames;
21
- private readonly declarations;
22
- private readonly registrations;
23
- /**
24
- * Appends a top-level FFI binding (`const foo = t.fn(...)`).
25
- *
26
- * Duplicates are dropped when a `name` is supplied that matches a
27
- * previously appended binding; this is the common case for GIR
28
- * callables that appear both as a namespace function and as a
29
- * constructor or static on a class.
30
- *
31
- * @param code - The source fragment, without a trailing newline
32
- * @param name - Optional binding identifier used for deduplication
33
- */
34
- appendBinding(code: string, name?: string): void;
35
- /**
36
- * Appends a declaration (class, function, enum, constant).
37
- *
38
- * @param code - The source fragment, without a trailing newline
39
- */
40
- appendDeclaration(code: string): void;
41
- /**
42
- * Appends a trailing registration statement (`registerNativeClass(…)`).
43
- *
44
- * @param code - The source fragment, without a trailing newline
45
- */
46
- appendRegistration(code: string): void;
47
- /**
48
- * Renders the full TypeScript source: imports, bindings, declarations,
49
- * registrations — separated by a single blank line.
50
- */
51
- toSource(): string;
52
- }
53
- //# sourceMappingURL=module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/dsl/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AACH,qBAAa,aAAa;IACtB,8CAA8C;IAC9C,SAAgB,OAAO,iBAAwB;IAC/C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;IAClD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgB;IAC7C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAE9C;;;;;;;;;;OAUG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAQhD;;;;OAIG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIrC;;;;OAIG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAItC;;;OAGG;IACH,QAAQ,IAAI,MAAM;CASrB"}
@@ -1,76 +0,0 @@
1
- import { ImportsBuilder } from "./imports.js";
2
- /**
3
- * Accumulator for one generated TypeScript module's source.
4
- *
5
- * Writers append code in three logical phases:
6
- *
7
- * 1. *Bindings* — the `const fn_name = t.fn(...)` block at the top.
8
- * 2. *Declarations* — the class bodies, free function exports, enums,
9
- * constants.
10
- * 3. *Registrations* — the trailing `registerNativeClass(...)` block.
11
- *
12
- * Keeping the three buckets independent removes ordering constraints
13
- * between writers and lets {@link emit} stitch a final source string with
14
- * the same shape every generated file uses today.
15
- */
16
- export class ModuleBuilder {
17
- /** Imports manifest the writers feed into. */
18
- imports = new ImportsBuilder();
19
- bindings = [];
20
- bindingNames = new Set();
21
- declarations = [];
22
- registrations = [];
23
- /**
24
- * Appends a top-level FFI binding (`const foo = t.fn(...)`).
25
- *
26
- * Duplicates are dropped when a `name` is supplied that matches a
27
- * previously appended binding; this is the common case for GIR
28
- * callables that appear both as a namespace function and as a
29
- * constructor or static on a class.
30
- *
31
- * @param code - The source fragment, without a trailing newline
32
- * @param name - Optional binding identifier used for deduplication
33
- */
34
- appendBinding(code, name) {
35
- if (name !== undefined) {
36
- if (this.bindingNames.has(name))
37
- return;
38
- this.bindingNames.add(name);
39
- }
40
- this.bindings.push(code);
41
- }
42
- /**
43
- * Appends a declaration (class, function, enum, constant).
44
- *
45
- * @param code - The source fragment, without a trailing newline
46
- */
47
- appendDeclaration(code) {
48
- this.declarations.push(code);
49
- }
50
- /**
51
- * Appends a trailing registration statement (`registerNativeClass(…)`).
52
- *
53
- * @param code - The source fragment, without a trailing newline
54
- */
55
- appendRegistration(code) {
56
- this.registrations.push(code);
57
- }
58
- /**
59
- * Renders the full TypeScript source: imports, bindings, declarations,
60
- * registrations — separated by a single blank line.
61
- */
62
- toSource() {
63
- const sections = [];
64
- const importsBlock = this.imports.toSource();
65
- if (importsBlock.length > 0)
66
- sections.push(importsBlock.trimEnd());
67
- if (this.bindings.length > 0)
68
- sections.push(this.bindings.join("\n\n"));
69
- if (this.declarations.length > 0)
70
- sections.push(this.declarations.join("\n\n"));
71
- if (this.registrations.length > 0)
72
- sections.push(this.registrations.join("\n\n"));
73
- return `${sections.join("\n\n")}\n`;
74
- }
75
- }
76
- //# sourceMappingURL=module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/dsl/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,aAAa;IACtB,8CAA8C;IAC9B,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;IAC9B,QAAQ,GAAa,EAAE,CAAC;IACxB,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,YAAY,GAAa,EAAE,CAAC;IAC5B,aAAa,GAAa,EAAE,CAAC;IAE9C;;;;;;;;;;OAUG;IACH,aAAa,CAAC,IAAY,EAAE,IAAa;QACrC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,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
4
- * Generates the TypeScript source for one FFI namespace module.
5
- *
6
- * Walks the namespace's declared enums, boxeds, classes, interfaces,
7
- * callbacks, functions, constants, and aliases, dispatching to the
8
- * per-construct writers in `writers/`: bindings first, declarations second,
9
- * registrations trailing.
10
- *
11
- * @param namespace - The namespace to emit
12
- * @param repository - The full repository (for cross-namespace lookups)
13
- * @returns The relative output path and the TypeScript source string
14
- */
15
- export declare const generateNamespaceModule: (namespace: GirNamespace, repository: GirRepository) => {
16
- readonly path: string;
17
- readonly source: string;
18
- };
19
- //# sourceMappingURL=pipeline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/ffi/pipeline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAU1D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,GAChC,WAAW,YAAY,EACvB,YAAY,aAAa,KAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAmClD,CAAC"}