@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
@@ -0,0 +1,61 @@
1
+ import { readdirSync } from "node:fs";
2
+ const CONFIG_ENTRYPOINT = "config";
3
+ const CONFIG_SUFFIX = `/${CONFIG_ENTRYPOINT}`;
4
+ const presentNamespaceDirs = (giStoreDir) => {
5
+ const dirs = new Set();
6
+ const entries = readdirSync(giStoreDir, { withFileTypes: true });
7
+ for (const entry of entries) {
8
+ if (entry.isDirectory()) {
9
+ dirs.add(entry.name);
10
+ }
11
+ }
12
+ return dirs;
13
+ };
14
+ /**
15
+ * The clean, reconciler-free `@gtkx/react` config entrypoints to import: the base `config` entry plus
16
+ * each namespace's `<ns>/config` entry whose GIR namespace is present in the gi store.
17
+ */
18
+ const configEntrypoints = (reactSubexports, present) => reactSubexports.filter((sub) => {
19
+ if (sub === CONFIG_ENTRYPOINT) {
20
+ return true;
21
+ }
22
+ return sub.endsWith(CONFIG_SUFFIX) && present.has(sub.slice(0, sub.length - CONFIG_SUFFIX.length));
23
+ });
24
+ const importBuiltinElements = async (entrypoint) => {
25
+ const specifier = `@gtkx/react/${entrypoint}`;
26
+ const imported = (await import(/* @vite-ignore */ specifier));
27
+ return imported.BUILTIN_ELEMENTS ?? {};
28
+ };
29
+ const applyBuiltinElement = (target, type, config) => {
30
+ if (config.component !== undefined) {
31
+ target.components[type] = config.component;
32
+ }
33
+ if (config.props !== undefined) {
34
+ target.props[type] = config.props;
35
+ }
36
+ if (config.lazy === true) {
37
+ target.lazyElements.push(type);
38
+ }
39
+ };
40
+ /**
41
+ * Reads the framework's built-in element config by importing the freshly linked `@gtkx/react` config
42
+ * entrypoints. These are reconciler-free, so importing them resolves `@gtkx/gi` but never `virtual:gtkx-config`;
43
+ * it must run only after the gi store has been linked.
44
+ */
45
+ const collectBuiltinElements = (target, elements) => {
46
+ for (const [type, config] of Object.entries(elements)) {
47
+ applyBuiltinElement(target, type, config);
48
+ }
49
+ };
50
+ const readBuiltinElements = async (reactSubexports, giStoreDir) => {
51
+ const present = presentNamespaceDirs(giStoreDir);
52
+ const entrypoints = configEntrypoints(reactSubexports, present);
53
+ const result = { components: {}, lazyElements: [], props: {} };
54
+ for (const entrypoint of entrypoints) {
55
+ collectBuiltinElements(result, await importBuiltinElements(entrypoint));
56
+ }
57
+ return result;
58
+ };
59
+ export {} from "@gtkx/react/config";
60
+ export { readBuiltinElements };
61
+ //# sourceMappingURL=element-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-config.js","sourceRoot":"","sources":["../../src/react/element-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAYtC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AACnC,MAAM,aAAa,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAE9C,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAe,EAAE;IAC7D,MAAM,IAAI,GAAgB,IAAI,GAAG,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAEjE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACtB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CAAC,eAAyB,EAAE,O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AAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,mBAAmB,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,KAAK,EAAE,eAAyB,EAAE,UAAkB,EAA4B,EAAE;IAC1G,MAAM,OAAO,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACjD,MAAM,WAAW,GAAG,iBAAiB,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAChE,MAAM,MAAM,GAAoB,EAAE,UAAU,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAEhF,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACnC,sBAAsB,CAAC,MAAM,EAAE,MAAM,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAA6C,CAAC","sourcesContent":["import type { ModuleExport } from \"@gtkx/react/config\";\nimport { readdirSync } from \"node:fs\";\n\n/** The codegen-relevant subset of a React element config; behaviors are ignored at codegen time. */\ntype BuiltinElement = { component?: ModuleExport; lazy?: boolean; props?: ModuleExport };\n\n/** The framework's built-in element config, split into the maps codegen consumes. */\ntype BuiltinElements = {\n components: Record<string, ModuleExport>;\n lazyElements: string[];\n props: Record<string, ModuleExport>;\n};\n\nconst CONFIG_ENTRYPOINT = \"config\";\nconst CONFIG_SUFFIX = `/${CONFIG_ENTRYPOINT}`;\n\nconst presentNamespaceDirs = (giStoreDir: string): Set<string> => {\n const dirs: Set<string> = new Set();\n const entries = readdirSync(giStoreDir, { withFileTypes: true });\n\n for (const entry of entries) {\n if (entry.isDirectory()) {\n dirs.add(entry.name);\n }\n }\n\n return dirs;\n};\n\n/**\n * The clean, reconciler-free `@gtkx/react` config entrypoints to import: the base `config` entry plus\n * each namespace's `<ns>/config` entry whose GIR namespace is present in the gi store.\n */\nconst configEntrypoints = (reactSubexports: string[], present: Set<string>): string[] =>\n reactSubexports.filter((sub) => {\n if (sub === CONFIG_ENTRYPOINT) {\n return true;\n }\n\n return sub.endsWith(CONFIG_SUFFIX) && present.has(sub.slice(0, sub.length - CONFIG_SUFFIX.length));\n });\n\nconst importBuiltinElements = async (entrypoint: string): Promise<Record<string, BuiltinElement>> => {\n const specifier = `@gtkx/react/${entrypoint}`;\n\n const imported = (await import(/* @vite-ignore */ specifier)) as {\n BUILTIN_ELEMENTS?: Record<string, BuiltinElement>;\n };\n\n return imported.BUILTIN_ELEMENTS ?? {};\n};\n\nconst applyBuiltinElement = (target: BuiltinElements, type: string, config: BuiltinElement): void => {\n if (config.component !== undefined) {\n target.components[type] = config.component;\n }\n\n if (config.props !== undefined) {\n target.props[type] = config.props;\n }\n\n if (config.lazy === true) {\n target.lazyElements.push(type);\n }\n};\n\n/**\n * Reads the framework's built-in element config by importing the freshly linked `@gtkx/react` config\n * entrypoints. These are reconciler-free, so importing them resolves `@gtkx/gi` but never `virtual:gtkx-config`;\n * it must run only after the gi store has been linked.\n */\nconst collectBuiltinElements = (target: BuiltinElements, elements: Record<string, BuiltinElement>): void => {\n for (const [type, config] of Object.entries(elements)) {\n applyBuiltinElement(target, type, config);\n }\n};\n\nconst readBuiltinElements = async (reactSubexports: string[], giStoreDir: string): Promise<BuiltinElements> => {\n const present = presentNamespaceDirs(giStoreDir);\n const entrypoints = configEntrypoints(reactSubexports, present);\n const result: BuiltinElements = { components: {}, lazyElements: [], props: {} };\n\n for (const entrypoint of entrypoints) {\n collectBuiltinElements(result, await importBuiltinElements(entrypoint));\n }\n\n return result;\n};\n\nexport { type ModuleExport } from \"@gtkx/react/config\";\nexport { readBuiltinElements, type BuiltinElement, type BuiltinElements };\n"]}
package/dist/runner.d.ts CHANGED
@@ -1,55 +1,44 @@
1
- import { type GiStoreOptions } from "./gi-store.js";
2
- import { type JsxStoreOptions } from "./jsx-store.js";
3
- /**
4
- * Options for {@link CodegenRunner}.
5
- */
6
- export type CodegenRunnerOptions = {
7
- /** Resolved `Name-Version` namespace identifiers to generate. */
8
- readonly libraries: readonly string[];
9
- /** Directories searched for `.gir` files. */
10
- readonly girPath: readonly string[];
11
- /** Optional user slot-prop overrides keyed by JSX element name. */
12
- readonly slotProps?: Readonly<Record<string, readonly string[]>>;
13
- /** Target for the injected `@gtkx/gi` bindings package. */
14
- readonly gi: GiStoreOptions;
15
- /** Target for the injected `@gtkx/react-jsx` unit; React is skipped when omitted. */
16
- readonly jsx?: JsxStoreOptions;
1
+ import type { GiStoreOptions } from "./store/gi-store.js";
2
+ import type { JsxStoreOptions } from "./store/jsx-store.js";
3
+ import { type GlGenerationReport } from "./khronos/pipeline.js";
4
+ type ModuleExport = {
5
+ module: string;
6
+ export: string;
17
7
  };
18
- /**
19
- * Result returned from {@link CodegenRunner.run}.
20
- */
21
- export type CodegenRunnerResult = {
22
- /** Number of FFI namespaces produced. */
23
- readonly namespaces: number;
24
- /** Number of widget intrinsics emitted into `jsx.ts`. */
25
- readonly widgets: number;
26
- /** Wall-clock duration in milliseconds. */
27
- readonly duration: number;
8
+ type GlCodegenOptions = {
9
+ registryPath: string;
10
+ overrideExports: Set<string>;
11
+ outputDir: string;
12
+ resolveFrom: string;
13
+ };
14
+ type CodegenRunnerOptions = {
15
+ libraries?: string[];
16
+ girPath?: string[];
17
+ gi?: GiStoreOptions;
18
+ jsx?: JsxStoreOptions | undefined;
19
+ reactSubexports?: string[];
20
+ userComponents?: Record<string, ModuleExport>;
21
+ userLazyElements?: string[];
22
+ userProps?: Record<string, ModuleExport>;
23
+ gl?: GlCodegenOptions;
24
+ force?: boolean;
25
+ };
26
+ type CodegenRunnerResult = {
27
+ regenerated: boolean;
28
+ namespaces: number;
29
+ intrinsicElements: number;
30
+ duration: number;
31
+ gl?: GlGenerationReport | undefined;
28
32
  };
29
33
  /**
30
- * Single-entry orchestrator for the GTKX codegen.
31
- *
32
- * Loads the GIR repository, runs the FFI pipeline per namespace, runs the
33
- * React pipeline once, and materializes the self-contained `@gtkx/gi` (and
34
- * optional `@gtkx/react-jsx`) packages into the project's `node_modules`.
35
- *
36
- * @example
37
- * ```ts
38
- * import { CodegenRunner } from "@gtkx/codegen";
34
+ * Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the
35
+ * configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its
36
+ * fingerprint is stale unless `options.force` is set, then the jsx store is regenerated when the gi store or
37
+ * the React element config changed; the OpenGL modules are regenerated whenever `options.gl` is provided.
39
38
  *
40
- * await new CodegenRunner({
41
- * libraries: ["Gtk-4.0", "Adw-1"],
42
- * girPath: ["/usr/share/gir-1.0"],
43
- * gi: { storeDir, linkDir, realFfiDir, realNativeDir, version },
44
- * }).run();
45
- * ```
39
+ * @param options - What to generate and where to write it.
40
+ * @returns A summary of what was regenerated and how long the run took.
46
41
  */
47
- export declare class CodegenRunner {
48
- private readonly options;
49
- constructor(options: CodegenRunnerOptions);
50
- /**
51
- * Executes the full codegen pipeline and materializes the output packages.
52
- */
53
- run(): Promise<CodegenRunnerResult>;
54
- }
42
+ declare const runCodegen: (options: CodegenRunnerOptions) => Promise<CodegenRunnerResult>;
43
+ export { runCodegen, type GlCodegenOptions, type CodegenRunnerOptions, type CodegenRunnerResult };
55
44
  //# sourceMappingURL=runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,cAAc,EAAgB,MAAM,eAAe,CAAC;AAEzF,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,gBAAgB,CAAC;AAGrE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B,iEAAiE;IACjE,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M,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IACxB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,EAAE,CAAC,EAAE,cAAc,CAAC;IACpB,GAAG,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IAClC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC9C,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACzC,EAAE,CAAC,EAAE,gBAAgB,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;CACvC,CAAC;AAQF;;;;;;;;GAQG;AACH,QAAA,MAAM,UAAU,GAAU,SAAS,oBAAoB,KAAG,OAAO,CAAC,mBAAmB,CAYpF,CAAC;AA8FF,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,CAAC"}
package/dist/runner.js CHANGED
@@ -1,60 +1,87 @@
1
- import { generateNamespaceModule } from "./ffi/pipeline.js";
2
- import { computeFingerprint } from "./fingerprint.js";
3
- import { writeGiStore } from "./gi-store.js";
4
- import { loadGirRepository } from "./gir/repository.js";
5
- import { writeJsxStore } from "./jsx-store.js";
6
- import { generateReactFiles } from "./react/pipeline.js";
1
+ import { mkdirSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { checkModules } from "./compile.js";
4
+ import { isGiStoreFresh } from "./fingerprint.js";
5
+ import { runGiCodegen } from "./gi.js";
6
+ import { Library } from "./gir/library.js";
7
+ import { generateGlModules } from "./khronos/pipeline.js";
7
8
  /**
8
- * Single-entry orchestrator for the GTKX codegen.
9
+ * Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the
10
+ * configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its
11
+ * fingerprint is stale unless `options.force` is set, then the jsx store is regenerated when the gi store or
12
+ * the React element config changed; the OpenGL modules are regenerated whenever `options.gl` is provided.
9
13
  *
10
- * Loads the GIR repository, runs the FFI pipeline per namespace, runs the
11
- * React pipeline once, and materializes the self-contained `@gtkx/gi` (and
12
- * optional `@gtkx/react-jsx`) packages into the project's `node_modules`.
13
- *
14
- * @example
15
- * ```ts
16
- * import { CodegenRunner } from "@gtkx/codegen";
17
- *
18
- * await new CodegenRunner({
19
- * libraries: ["Gtk-4.0", "Adw-1"],
20
- * girPath: ["/usr/share/gir-1.0"],
21
- * gi: { storeDir, linkDir, realFfiDir, realNativeDir, version },
22
- * }).run();
23
- * ```
14
+ * @param options - What to generate and where to write it.
15
+ * @returns A summary of what was regenerated and how long the run took.
24
16
  */
25
- export class CodegenRunner {
26
- options;
27
- constructor(options) {
28
- this.options = options;
17
+ const runCodegen = async (options) => {
18
+ const start = Date.now();
19
+ const gl = options.gl === undefined ? undefined : emitGlModules(options.gl);
20
+ const store = await emitStores(options);
21
+ return {
22
+ regenerated: store.regenerated,
23
+ namespaces: store.namespaces,
24
+ intrinsicElements: store.intrinsicElements,
25
+ duration: Date.now() - start,
26
+ gl,
27
+ };
28
+ };
29
+ const emitGlModules = (options) => {
30
+ const { files, report } = generateGlModules({
31
+ registryPath: options.registryPath,
32
+ overrideExports: options.overrideExports,
33
+ });
34
+ checkModules({
35
+ modules: [...files].map(([fileName, source]) => ({ fileName, source })),
36
+ resolveFrom: options.resolveFrom,
37
+ label: "the generated gl modules",
38
+ });
39
+ mkdirSync(options.outputDir, { recursive: true });
40
+ for (const [fileName, source] of files) {
41
+ writeFileSync(join(options.outputDir, fileName), source);
42
+ }
43
+ return report;
44
+ };
45
+ const jsxUserOptions = (options) => ({
46
+ reactSubexports: options.reactSubexports ?? [],
47
+ userComponents: options.userComponents ?? {},
48
+ userLazyElements: options.userLazyElements ?? [],
49
+ userProps: options.userProps ?? {},
50
+ });
51
+ const emitJsxStore = async (input) => {
52
+ const { options, jsx, gi, loadLibrary, giRegenerated, namespaces } = input;
53
+ const { runJsxCodegen } = await import("./jsx.js");
54
+ const jsxResult = await runJsxCodegen({
55
+ getLibrary: loadLibrary,
56
+ jsx,
57
+ giStoreDir: gi.storeDir,
58
+ ...jsxUserOptions(options),
59
+ giRegenerated,
60
+ force: options.force === true,
61
+ });
62
+ return {
63
+ regenerated: giRegenerated || jsxResult.regenerated,
64
+ namespaces,
65
+ intrinsicElements: jsxResult.intrinsicElementCount,
66
+ };
67
+ };
68
+ const emitStoresWithConfig = async (config) => {
69
+ const { options, gi, jsx, libraries, girPath } = config;
70
+ let library;
71
+ const loadLibrary = () => (library ??= Library.load(libraries, girPath));
72
+ const isGiRegenerated = options.force === true || !isGiStoreFresh(gi.storeDir, libraries, girPath);
73
+ const namespaces = isGiRegenerated ? runGiCodegen(loadLibrary(), gi, libraries, girPath) : 0;
74
+ if (jsx === undefined) {
75
+ return { regenerated: isGiRegenerated, namespaces, intrinsicElements: 0 };
29
76
  }
30
- /**
31
- * Executes the full codegen pipeline and materializes the output packages.
32
- */
33
- async run() {
34
- const start = Date.now();
35
- const repository = loadGirRepository(this.options.libraries, this.options.girPath);
36
- const namespaces = [];
37
- for (const namespace of repository.namespaces.values()) {
38
- const { source } = generateNamespaceModule(namespace, repository);
39
- namespaces.push({ directory: namespace.name.toLowerCase(), rawSource: source });
40
- }
41
- const libraries = [...this.options.libraries];
42
- writeGiStore(this.options.gi, namespaces, {
43
- value: computeFingerprint(repository.girFiles, libraries),
44
- girFiles: repository.girFiles,
45
- libraries,
46
- });
47
- let widgetCount = 0;
48
- if (this.options.jsx !== undefined) {
49
- const reactPipeline = generateReactFiles(repository, this.options.slotProps);
50
- writeJsxStore(this.options.jsx, reactPipeline.files);
51
- widgetCount = reactPipeline.widgetCount;
52
- }
53
- return {
54
- namespaces: repository.namespaces.size,
55
- widgets: widgetCount,
56
- duration: Date.now() - start,
57
- };
77
+ return emitJsxStore({ options, jsx, gi, loadLibrary, giRegenerated: isGiRegenerated, namespaces });
78
+ };
79
+ const emitStores = async (options) => {
80
+ const { gi, jsx, libraries, girPath } = options;
81
+ if (gi === undefined || libraries === undefined || girPath === undefined) {
82
+ return { regenerated: false, namespaces: 0, intrinsicElements: 0 };
58
83
  }
59
- }
84
+ return emitStoresWithConfig({ options, gi, jsx, libraries, girPath });
85
+ };
86
+ export { runCodegen };
60
87
  //# sourceMappingURL=runner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAA8C,YAAY,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAwB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AA8BzD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,aAAa;IACO;IAA7B,YAA6B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;IAE9D;;OAEG;IACH,KAAK,CAAC,GAAG;QACL,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,E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AS,IAAI,SAAS,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACvE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvE,CAAC;IAED,OAAO,oBAAoB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAA8E,CAAC","sourcesContent":["import { mkdirSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GiStoreOptions } from \"./store/gi-store.js\";\nimport type { JsxStoreOptions } from \"./store/jsx-store.js\";\nimport { checkModules } from \"./compile.js\";\nimport { isGiStoreFresh } from \"./fingerprint.js\";\nimport { runGiCodegen } from \"./gi.js\";\nimport { Library } from \"./gir/library.js\";\nimport { generateGlModules, type GlGenerationReport } from \"./khronos/pipeline.js\";\n\ntype ModuleExport = { module: string; export: string };\n\ntype GlCodegenOptions = {\n registryPath: string;\n overrideExports: Set<string>;\n outputDir: string;\n resolveFrom: string;\n};\n\ntype CodegenRunnerOptions = {\n libraries?: string[];\n girPath?: string[];\n gi?: GiStoreOptions;\n jsx?: JsxStoreOptions | undefined;\n reactSubexports?: string[];\n userComponents?: Record<string, ModuleExport>;\n userLazyElements?: string[];\n userProps?: Record<string, ModuleExport>;\n gl?: GlCodegenOptions;\n force?: boolean;\n};\n\ntype CodegenRunnerResult = {\n regenerated: boolean;\n namespaces: number;\n intrinsicElements: number;\n duration: number;\n gl?: GlGenerationReport | undefined;\n};\n\ntype StoreResult = {\n regenerated: boolean;\n namespaces: number;\n intrinsicElements: number;\n};\n\n/**\n * Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the\n * configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its\n * fingerprint is stale unless `options.force` is set, then the jsx store is regenerated when the gi store or\n * the React element config changed; the OpenGL modules are regenerated whenever `options.gl` is provided.\n *\n * @param options - What to generate and where to write it.\n * @returns A summary of what was regenerated and how long the run took.\n */\nconst runCodegen = async (options: CodegenRunnerOptions): Promise<CodegenRunnerResult> => {\n const start = Date.now();\n const gl = options.gl === undefined ? undefined : emitGlModules(options.gl);\n const store = await emitStores(options);\n\n return {\n regenerated: store.regenerated,\n namespaces: store.namespaces,\n intrinsicElements: store.intrinsicElements,\n duration: Date.now() - start,\n gl,\n };\n};\n\nconst emitGlModules = (options: GlCodegenOptions): GlGenerationReport => {\n const { files, report } = generateGlModules({\n registryPath: options.registryPath,\n overrideExports: options.overrideExports,\n });\n\n checkModules({\n modules: [...files].map(([fileName, source]) => ({ fileName, source })),\n resolveFrom: options.resolveFrom,\n label: \"the generated gl modules\",\n });\n\n mkdirSync(options.outputDir, { recursive: true });\n\n for (const [fileName, source] of files) {\n writeFileSync(join(options.outputDir, fileName), source);\n }\n\n return report;\n};\n\nconst jsxUserOptions = (\n options: CodegenRunnerOptions,\n): {\n reactSubexports: string[];\n userComponents: Record<string, ModuleExport>;\n userLazyElements: string[];\n userProps: Record<string, ModuleExport>;\n} => ({\n reactSubexports: options.reactSubexports ?? [],\n userComponents: options.userComponents ?? {},\n userLazyElements: options.userLazyElements ?? [],\n userProps: options.userProps ?? {},\n});\n\nconst emitJsxStore = async (input: {\n options: CodegenRunnerOptions;\n jsx: JsxStoreOptions;\n gi: GiStoreOptions;\n loadLibrary: () => Library;\n giRegenerated: boolean;\n namespaces: number;\n}): Promise<StoreResult> => {\n const { options, jsx, gi, loadLibrary, giRegenerated, namespaces } = input;\n const { runJsxCodegen } = await import(\"./jsx.js\");\n\n const jsxResult = await runJsxCodegen({\n getLibrary: loadLibrary,\n jsx,\n giStoreDir: gi.storeDir,\n ...jsxUserOptions(options),\n giRegenerated,\n force: options.force === true,\n });\n\n return {\n regenerated: giRegenerated || jsxResult.regenerated,\n namespaces,\n intrinsicElements: jsxResult.intrinsicElementCount,\n };\n};\n\nconst emitStoresWithConfig = async (config: {\n options: CodegenRunnerOptions;\n gi: GiStoreOptions;\n jsx: JsxStoreOptions | undefined;\n libraries: string[];\n girPath: string[];\n}): Promise<StoreResult> => {\n const { options, gi, jsx, libraries, girPath } = config;\n let library: Library | undefined;\n const loadLibrary = (): Library => (library ??= Library.load(libraries, girPath));\n const isGiRegenerated = options.force === true || !isGiStoreFresh(gi.storeDir, libraries, girPath);\n const namespaces = isGiRegenerated ? runGiCodegen(loadLibrary(), gi, libraries, girPath) : 0;\n\n if (jsx === undefined) {\n return { regenerated: isGiRegenerated, namespaces, intrinsicElements: 0 };\n }\n\n return emitJsxStore({ options, jsx, gi, loadLibrary, giRegenerated: isGiRegenerated, namespaces });\n};\n\nconst emitStores = async (options: CodegenRunnerOptions): Promise<StoreResult> => {\n const { gi, jsx, libraries, girPath } = options;\n\n if (gi === undefined || libraries === undefined || girPath === undefined) {\n return { regenerated: false, namespaces: 0, intrinsicElements: 0 };\n }\n\n return emitStoresWithConfig({ options, gi, jsx, libraries, girPath });\n};\n\nexport { runCodegen, type GlCodegenOptions, type CodegenRunnerOptions, type CodegenRunnerResult };\n"]}
@@ -0,0 +1,11 @@
1
+ import { type SourceModule } from "../compile.js";
2
+ type CompileStoreParams = {
3
+ storeDir: string;
4
+ files: SourceModule[];
5
+ packageName: string;
6
+ /** Declare `virtual:gtkx-config` for the typecheck, needed when it follows imports into `@gtkx/react` source. */
7
+ configEnv?: boolean;
8
+ };
9
+ declare const compileStore: (params: CompileStoreParams) => void;
10
+ export { compileStore, type CompileStoreParams };
11
+ //# sourceMappingURL=compile-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-store.d.ts","sourceRoot":"","sources":["../../src/store/compile-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAElE,KAAK,kBAAkB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,iHAAiH;IACjH,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAqBF,QAAA,MAAM,YAAY,GAAI,QAAQ,kBAAkB,KAAG,IAqBlD,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { rmSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { compileProject } from "../compile.js";
4
+ const EMIT_OPTIONS = {
5
+ declaration: true,
6
+ removeComments: false,
7
+ sourceMap: false,
8
+ declarationMap: false,
9
+ rootDir: ".",
10
+ outDir: ".",
11
+ };
12
+ const ENV_REFERENCE_FILE = "__gtkx-env__.d.ts";
13
+ const writeEnvReference = (storeDir) => {
14
+ writeFileSync(join(storeDir, ENV_REFERENCE_FILE), "/// <reference types=\"@gtkx/react/env\" />\n");
15
+ return () => {
16
+ rmSync(join(storeDir, ENV_REFERENCE_FILE), { force: true });
17
+ };
18
+ };
19
+ const compileStore = (params) => {
20
+ const fileNames = params.files.map((file) => file.fileName);
21
+ const removeEnvReference = params.configEnv === true
22
+ ? writeEnvReference(params.storeDir)
23
+ : () => undefined;
24
+ try {
25
+ compileProject({
26
+ projectDir: params.storeDir,
27
+ fileNames: params.configEnv === true ? [ENV_REFERENCE_FILE, ...fileNames] : fileNames,
28
+ compilerOptions: EMIT_OPTIONS,
29
+ label: `the generated ${params.packageName} store`,
30
+ });
31
+ }
32
+ finally {
33
+ removeEnvReference();
34
+ }
35
+ for (const file of params.files) {
36
+ rmSync(join(params.storeDir, file.fileName), { force: true });
37
+ }
38
+ };
39
+ export { compileStore };
40
+ //# sourceMappingURL=compile-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-store.js","sourceRoot":"","sources":["../../src/store/compile-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,E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B,MAAM,CAAC,WAAW,QAAQ;SACrD,CAAC,CAAC;IACP,CAAC;YAAS,CAAC;QACP,kBAAkB,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAA2B,CAAC","sourcesContent":["import { rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { compileProject, type SourceModule } from \"../compile.js\";\n\ntype CompileStoreParams = {\n storeDir: string;\n files: SourceModule[];\n packageName: string;\n /** Declare `virtual:gtkx-config` for the typecheck, needed when it follows imports into `@gtkx/react` source. */\n configEnv?: boolean;\n};\n\nconst EMIT_OPTIONS = {\n declaration: true,\n removeComments: false,\n sourceMap: false,\n declarationMap: false,\n rootDir: \".\",\n outDir: \".\",\n};\n\nconst ENV_REFERENCE_FILE = \"__gtkx-env__.d.ts\";\n\nconst writeEnvReference = (storeDir: string): (() => void) => {\n writeFileSync(join(storeDir, ENV_REFERENCE_FILE), \"/// <reference types=\\\"@gtkx/react/env\\\" />\\n\");\n\n return () => {\n rmSync(join(storeDir, ENV_REFERENCE_FILE), { force: true });\n };\n};\n\nconst compileStore = (params: CompileStoreParams): void => {\n const fileNames = params.files.map((file) => file.fileName);\n\n const removeEnvReference = params.configEnv === true\n ? writeEnvReference(params.storeDir)\n : (): void => undefined;\n\n try {\n compileProject({\n projectDir: params.storeDir,\n fileNames: params.configEnv === true ? [ENV_REFERENCE_FILE, ...fileNames] : fileNames,\n compilerOptions: EMIT_OPTIONS,\n label: `the generated ${params.packageName} store`,\n });\n } finally {\n removeEnvReference();\n }\n\n for (const file of params.files) {\n rmSync(join(params.storeDir, file.fileName), { force: true });\n }\n};\n\nexport { compileStore, type CompileStoreParams };\n"]}
@@ -0,0 +1,5 @@
1
+ import type { GirFunction } from "../../gir/function.js";
2
+ import type { Library } from "../../gir/library.js";
3
+ declare const matchAsyncFinish: (library: Library, fn: GirFunction, siblings: GirFunction[]) => GirFunction | undefined;
4
+ export { matchAsyncFinish };
5
+ //# sourceMappingURL=async.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../../src/store/gi/async.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAIpD,QAAA,MAAM,gBAAgB,GAClB,SAAS,OAAO,EAChB,IAAI,WAAW,EACf,UAAU,WAAW,EAAE,KACxB,WAAW,GAAG,SAYhB,CAAC;AA+CF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { inputParameters } from "../../analysis/param-structure.js";
2
+ const matchAsyncFinish = (library, fn, siblings) => {
3
+ if (!hasCanonicalAsyncCallback(library, fn)) {
4
+ return undefined;
5
+ }
6
+ const finishFn = findFinishSibling(fn, siblings);
7
+ if (finishFn === undefined || !isPromisifiableFinish(library, finishFn)) {
8
+ return undefined;
9
+ }
10
+ return finishFn;
11
+ };
12
+ const findFinishSibling = (fn, siblings) => {
13
+ const annotated = fn.finishFunc;
14
+ if (annotated !== undefined) {
15
+ return siblings.find((sibling) => sibling.name === annotated || sibling.cIdentifier === annotated);
16
+ }
17
+ if (fn.name.endsWith("_finish")) {
18
+ return undefined;
19
+ }
20
+ const root = fn.name.endsWith("_async") ? fn.name.slice(0, -"_async".length) : fn.name;
21
+ const finishName = `${root}_finish`;
22
+ return siblings.find((sibling) => sibling.name === finishName);
23
+ };
24
+ const callbackParameterName = (library, ref) => {
25
+ if (ref === undefined || library.typeFor(ref)?.kind !== "callback") {
26
+ return undefined;
27
+ }
28
+ return library.nameFor(ref)?.typeName;
29
+ };
30
+ const hasCanonicalAsyncCallback = (library, fn) => {
31
+ const callbackNames = fn.parameters
32
+ .map((parameter) => callbackParameterName(library, parameter.type))
33
+ .filter((name) => name !== undefined);
34
+ return callbackNames.length === 1 && callbackNames[0] === "AsyncReadyCallback";
35
+ };
36
+ const isPromisifiableFinish = (library, finishFn) => {
37
+ const inputs = inputParameters(library, finishFn);
38
+ if (inputs.length !== 1) {
39
+ return false;
40
+ }
41
+ const only = inputs[0];
42
+ return only?.parameter.type !== undefined && library.nameFor(only.parameter.type)?.typeName === "AsyncResult";
43
+ };
44
+ export { matchAsyncFinish };
45
+ //# sourceMappingURL=async.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async.js","sourceRoot":"","sources":["../../../src/store/gi/async.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,MAAM,gBAAgB,GAAG,CACrB,OAAgB,EAChB,EAAe,EACf,QAAuB,EACA,EAAE;IACzB,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,QAAQ,GAAG,iBAAiB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAEjD,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;QACtE,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,EAAe,EAAE,QAAuB,EAA2B,EAAE;IAC5F,MAAM,SAAS,GAAG,EAAE,CAAC,UAAU,CAAC;IAEhC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAA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AAK,oBAAoB,CAAC;AACnF,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,OAAgB,EAAE,QAAqB,EAAW,EAAE;IAC/E,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAElD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAEvB,OAAO,IAAI,EAAE,SAAS,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,KAAK,aAAa,CAAC;AAClH,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import type { GirFunction } from \"../../gir/function.js\";\nimport type { Library } from \"../../gir/library.js\";\nimport type { TypeId } from \"../../gir/type-id.js\";\nimport { inputParameters } from \"../../analysis/param-structure.js\";\n\nconst matchAsyncFinish = (\n library: Library,\n fn: GirFunction,\n siblings: GirFunction[],\n): GirFunction | undefined => {\n if (!hasCanonicalAsyncCallback(library, fn)) {\n return undefined;\n }\n\n const finishFn = findFinishSibling(fn, siblings);\n\n if (finishFn === undefined || !isPromisifiableFinish(library, finishFn)) {\n return undefined;\n }\n\n return finishFn;\n};\n\nconst findFinishSibling = (fn: GirFunction, siblings: GirFunction[]): GirFunction | undefined => {\n const annotated = fn.finishFunc;\n\n if (annotated !== undefined) {\n return siblings.find((sibling) => sibling.name === annotated || sibling.cIdentifier === annotated);\n }\n\n if (fn.name.endsWith(\"_finish\")) {\n return undefined;\n }\n\n const root = fn.name.endsWith(\"_async\") ? fn.name.slice(0, -\"_async\".length) : fn.name;\n const finishName = `${root}_finish`;\n\n return siblings.find((sibling) => sibling.name === finishName);\n};\n\nconst callbackParameterName = (library: Library, ref: TypeId | undefined): string | undefined => {\n if (ref === undefined || library.typeFor(ref)?.kind !== \"callback\") {\n return undefined;\n }\n\n return library.nameFor(ref)?.typeName;\n};\n\nconst hasCanonicalAsyncCallback = (library: Library, fn: GirFunction): boolean => {\n const callbackNames = fn.parameters\n .map((parameter) => callbackParameterName(library, parameter.type))\n .filter((name): name is string => name !== undefined);\n\n return callbackNames.length === 1 && callbackNames[0] === \"AsyncReadyCallback\";\n};\n\nconst isPromisifiableFinish = (library: Library, finishFn: GirFunction): boolean => {\n const inputs = inputParameters(library, finishFn);\n\n if (inputs.length !== 1) {\n return false;\n }\n\n const only = inputs[0];\n\n return only?.parameter.type !== undefined && library.nameFor(only.parameter.type)?.typeName === \"AsyncResult\";\n};\n\nexport { matchAsyncFinish };\n"]}
@@ -0,0 +1,42 @@
1
+ import type { GirFunction } from "../../gir/function.js";
2
+ import type { ModuleContext } from "../../writer/context.js";
3
+ type Callables = {
4
+ constructors: GirFunction[];
5
+ functions: GirFunction[];
6
+ methods: GirFunction[];
7
+ };
8
+ type InstanceScope = {
9
+ ownerName: string;
10
+ methodByName: Map<string, GirFunction>;
11
+ statics: GirFunction[];
12
+ };
13
+ type InstanceMemberRenderer = (context: ModuleContext, callable: GirFunction, scope: InstanceScope, nameOverride?: string) => string | undefined;
14
+ type PlainTypeMembersOptions = {
15
+ context: ModuleContext;
16
+ className: string;
17
+ callables: Callables;
18
+ hasGtype: boolean;
19
+ };
20
+ declare const renderInstanceMethodSignature: InstanceMemberRenderer;
21
+ declare const renderClassInstanceMember: InstanceMemberRenderer;
22
+ declare const instanceScope: (ownerName: string, callables: Callables) => InstanceScope;
23
+ declare const dedupeCallables: (callables: GirFunction[]) => GirFunction[];
24
+ declare const generateBindings: (context: ModuleContext, callables: Callables) => void;
25
+ declare const matchStaticFinishFunction: (context: ModuleContext, callable: GirFunction, siblings: GirFunction[]) => GirFunction | undefined;
26
+ declare const indexMethodsByName: (methods: GirFunction[]) => Map<string, GirFunction>;
27
+ declare const isEmittableCallable: (context: ModuleContext, callable: GirFunction) => boolean;
28
+ declare const renderStaticSignature: (context: ModuleContext, callable: GirFunction, options?: {
29
+ returnTypeOverride?: string | undefined;
30
+ siblings?: GirFunction[] | undefined;
31
+ }) => {
32
+ name: string;
33
+ signature: string;
34
+ } | undefined;
35
+ declare const classConstructorMemberNames: (context: ModuleContext, callables: Callables) => string[];
36
+ declare const renderStaticHead: (context: ModuleContext, callables: Callables, ownerClassName: string) => string[];
37
+ declare const renderPlainTypeMembers: (options: PlainTypeMembersOptions) => {
38
+ members: string[];
39
+ claimedNames: Set<string>;
40
+ };
41
+ export { renderInstanceMethodSignature, renderClassInstanceMember, instanceScope, dedupeCallables, generateBindings, matchStaticFinishFunction, indexMethodsByName, isEmittableCallable, renderStaticSignature, classConstructorMemberNames, renderStaticHead, renderPlainTypeMembers, type Callables, type InstanceScope, };
42
+ //# sourceMappingURL=callables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callables.d.ts","sourceRoot":"","sources":["../../../src/store/gi/callables.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAmB7D,KAAK,SAAS,GAAG;IACb,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,OAAO,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AAEF,KAAK,aAAa,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACvC,OAAO,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AAoBF,KAAK,sBAAsB,GAAG,CAC1B,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,WAAW,EACrB,KAAK,EAAE,aAAa,EACpB,YAAY,CAAC,EAAE,MAAM,KACpB,MAAM,GAAG,SAAS,CAAC;AAExB,KAAK,uBAAuB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