@gtkx/codegen 1.0.0-rc.1 → 1.0.0-rc.3

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 (531) hide show
  1. package/dist/analysis/descriptor-render.d.ts +20 -11
  2. package/dist/analysis/descriptor-render.d.ts.map +1 -1
  3. package/dist/analysis/descriptor-render.js +296 -152
  4. package/dist/analysis/descriptor-render.js.map +1 -1
  5. package/dist/analysis/descriptor.d.ts +37 -34
  6. package/dist/analysis/descriptor.d.ts.map +1 -1
  7. package/dist/analysis/descriptor.js +34 -30
  8. package/dist/analysis/descriptor.js.map +1 -1
  9. package/dist/analysis/inheritance.d.ts +16 -16
  10. package/dist/analysis/inheritance.d.ts.map +1 -1
  11. package/dist/analysis/inheritance.js +139 -84
  12. package/dist/analysis/inheritance.js.map +1 -1
  13. package/dist/analysis/param-structure.d.ts +14 -13
  14. package/dist/analysis/param-structure.d.ts.map +1 -1
  15. package/dist/analysis/param-structure.js +104 -53
  16. package/dist/analysis/param-structure.js.map +1 -1
  17. package/dist/analysis/ts-type.d.ts +6 -5
  18. package/dist/analysis/ts-type.d.ts.map +1 -1
  19. package/dist/analysis/ts-type.js +71 -29
  20. package/dist/analysis/ts-type.js.map +1 -1
  21. package/dist/compile.d.ts +5 -5
  22. package/dist/compile.d.ts.map +1 -1
  23. package/dist/compile.js +70 -63
  24. package/dist/compile.js.map +1 -1
  25. package/dist/docs/api-reference.d.ts +12 -11
  26. package/dist/docs/api-reference.d.ts.map +1 -1
  27. package/dist/docs/api-reference.js +192 -123
  28. package/dist/docs/api-reference.js.map +1 -1
  29. package/dist/docs/element-page.d.ts +6 -9
  30. package/dist/docs/element-page.d.ts.map +1 -1
  31. package/dist/docs/element-page.js +69 -133
  32. package/dist/docs/element-page.js.map +1 -1
  33. package/dist/docs/pipeline.d.ts +10 -7
  34. package/dist/docs/pipeline.d.ts.map +1 -1
  35. package/dist/docs/pipeline.js +81 -53
  36. package/dist/docs/pipeline.js.map +1 -1
  37. package/dist/docs/render.d.ts +21 -19
  38. package/dist/docs/render.d.ts.map +1 -1
  39. package/dist/docs/render.js +80 -71
  40. package/dist/docs/render.js.map +1 -1
  41. package/dist/docs/symbol-page.d.ts +6 -6
  42. package/dist/docs/symbol-page.d.ts.map +1 -1
  43. package/dist/docs/symbol-page.js +126 -84
  44. package/dist/docs/symbol-page.js.map +1 -1
  45. package/dist/fingerprint.d.ts +29 -5
  46. package/dist/fingerprint.d.ts.map +1 -1
  47. package/dist/fingerprint.js +69 -13
  48. package/dist/fingerprint.js.map +1 -1
  49. package/dist/gi.d.ts +18 -0
  50. package/dist/gi.d.ts.map +1 -0
  51. package/dist/gi.js +23 -0
  52. package/dist/gi.js.map +1 -0
  53. package/dist/gir/ancestry.d.ts +4 -3
  54. package/dist/gir/ancestry.d.ts.map +1 -1
  55. package/dist/gir/ancestry.js +12 -15
  56. package/dist/gir/ancestry.js.map +1 -1
  57. package/dist/gir/callback.d.ts +6 -11
  58. package/dist/gir/callback.d.ts.map +1 -1
  59. package/dist/gir/callback.js +6 -7
  60. package/dist/gir/callback.js.map +1 -1
  61. package/dist/gir/class.d.ts +7 -5
  62. package/dist/gir/class.d.ts.map +1 -1
  63. package/dist/gir/class.js +14 -12
  64. package/dist/gir/class.js.map +1 -1
  65. package/dist/gir/enum.d.ts +3 -3
  66. package/dist/gir/enum.d.ts.map +1 -1
  67. package/dist/gir/enum.js +7 -6
  68. package/dist/gir/enum.js.map +1 -1
  69. package/dist/gir/field.d.ts +8 -3
  70. package/dist/gir/field.d.ts.map +1 -1
  71. package/dist/gir/field.js +30 -7
  72. package/dist/gir/field.js.map +1 -1
  73. package/dist/gir/function.d.ts +6 -3
  74. package/dist/gir/function.d.ts.map +1 -1
  75. package/dist/gir/function.js +23 -7
  76. package/dist/gir/function.js.map +1 -1
  77. package/dist/gir/gir-path.d.ts +2 -1
  78. package/dist/gir/gir-path.d.ts.map +1 -1
  79. package/dist/gir/gir-path.js +26 -10
  80. package/dist/gir/gir-path.js.map +1 -1
  81. package/dist/gir/libraries.d.ts +5 -3
  82. package/dist/gir/libraries.d.ts.map +1 -1
  83. package/dist/gir/libraries.js +41 -28
  84. package/dist/gir/libraries.js.map +1 -1
  85. package/dist/gir/library.d.ts +17 -11
  86. package/dist/gir/library.d.ts.map +1 -1
  87. package/dist/gir/library.js +116 -92
  88. package/dist/gir/library.js.map +1 -1
  89. package/dist/gir/namespace.d.ts +10 -10
  90. package/dist/gir/namespace.d.ts.map +1 -1
  91. package/dist/gir/namespace.js +21 -20
  92. package/dist/gir/namespace.js.map +1 -1
  93. package/dist/gir/nullable-overrides.d.ts +3 -0
  94. package/dist/gir/nullable-overrides.d.ts.map +1 -0
  95. package/dist/gir/nullable-overrides.js +5 -0
  96. package/dist/gir/nullable-overrides.js.map +1 -0
  97. package/dist/gir/parameter.d.ts +14 -12
  98. package/dist/gir/parameter.d.ts.map +1 -1
  99. package/dist/gir/parameter.js +27 -18
  100. package/dist/gir/parameter.js.map +1 -1
  101. package/dist/gir/parse.d.ts +12 -13
  102. package/dist/gir/parse.d.ts.map +1 -1
  103. package/dist/gir/parse.js +50 -40
  104. package/dist/gir/parse.js.map +1 -1
  105. package/dist/gir/primitives.d.ts +5 -4
  106. package/dist/gir/primitives.d.ts.map +1 -1
  107. package/dist/gir/primitives.js +4 -3
  108. package/dist/gir/primitives.js.map +1 -1
  109. package/dist/gir/property.d.ts +5 -4
  110. package/dist/gir/property.d.ts.map +1 -1
  111. package/dist/gir/property.js +10 -9
  112. package/dist/gir/property.js.map +1 -1
  113. package/dist/gir/record.d.ts +5 -4
  114. package/dist/gir/record.d.ts.map +1 -1
  115. package/dist/gir/record.js +13 -12
  116. package/dist/gir/record.js.map +1 -1
  117. package/dist/gir/size.d.ts +6 -5
  118. package/dist/gir/size.d.ts.map +1 -1
  119. package/dist/gir/size.js +49 -47
  120. package/dist/gir/size.js.map +1 -1
  121. package/dist/gir/type-id.d.ts +17 -15
  122. package/dist/gir/type-id.d.ts.map +1 -1
  123. package/dist/gir/type-id.js +5 -1
  124. package/dist/gir/type-id.js.map +1 -1
  125. package/dist/gir/type-ref.d.ts +3 -2
  126. package/dist/gir/type-ref.d.ts.map +1 -1
  127. package/dist/gir/type-ref.js +36 -25
  128. package/dist/gir/type-ref.js.map +1 -1
  129. package/dist/gir/type.d.ts +3 -2
  130. package/dist/gir/type.d.ts.map +1 -1
  131. package/dist/gir/type.js.map +1 -1
  132. package/dist/index.d.ts +3 -0
  133. package/dist/index.d.ts.map +1 -1
  134. package/dist/index.js +2 -0
  135. package/dist/index.js.map +1 -1
  136. package/dist/jsx.d.ts +28 -0
  137. package/dist/jsx.d.ts.map +1 -0
  138. package/dist/jsx.js +44 -0
  139. package/dist/jsx.js.map +1 -0
  140. package/dist/khronos/args.d.ts +7 -7
  141. package/dist/khronos/args.d.ts.map +1 -1
  142. package/dist/khronos/args.js +88 -67
  143. package/dist/khronos/args.js.map +1 -1
  144. package/dist/khronos/jsdoc.d.ts +4 -4
  145. package/dist/khronos/jsdoc.d.ts.map +1 -1
  146. package/dist/khronos/jsdoc.js +29 -16
  147. package/dist/khronos/jsdoc.js.map +1 -1
  148. package/dist/khronos/model.d.ts +8 -7
  149. package/dist/khronos/model.d.ts.map +1 -1
  150. package/dist/khronos/model.js +94 -59
  151. package/dist/khronos/model.js.map +1 -1
  152. package/dist/khronos/modules.d.ts +4 -3
  153. package/dist/khronos/modules.d.ts.map +1 -1
  154. package/dist/khronos/modules.js +40 -25
  155. package/dist/khronos/modules.js.map +1 -1
  156. package/dist/khronos/param-pair.d.ts +11 -0
  157. package/dist/khronos/param-pair.d.ts.map +1 -0
  158. package/dist/khronos/param-pair.js +6 -0
  159. package/dist/khronos/param-pair.js.map +1 -0
  160. package/dist/khronos/parse.d.ts +7 -8
  161. package/dist/khronos/parse.d.ts.map +1 -1
  162. package/dist/khronos/parse.js +17 -16
  163. package/dist/khronos/parse.js.map +1 -1
  164. package/dist/khronos/pipeline.d.ts +4 -4
  165. package/dist/khronos/pipeline.d.ts.map +1 -1
  166. package/dist/khronos/pipeline.js +97 -56
  167. package/dist/khronos/pipeline.js.map +1 -1
  168. package/dist/khronos/plan.d.ts +11 -10
  169. package/dist/khronos/plan.d.ts.map +1 -1
  170. package/dist/khronos/plan.js +109 -45
  171. package/dist/khronos/plan.js.map +1 -1
  172. package/dist/khronos/render.d.ts +5 -4
  173. package/dist/khronos/render.d.ts.map +1 -1
  174. package/dist/khronos/render.js +106 -59
  175. package/dist/khronos/render.js.map +1 -1
  176. package/dist/khronos/select.d.ts +4 -4
  177. package/dist/khronos/select.d.ts.map +1 -1
  178. package/dist/khronos/select.js +30 -19
  179. package/dist/khronos/select.js.map +1 -1
  180. package/dist/react/element-config.d.ts +20 -0
  181. package/dist/react/element-config.d.ts.map +1 -0
  182. package/dist/react/element-config.js +64 -0
  183. package/dist/react/element-config.js.map +1 -0
  184. package/dist/runner.d.ts +19 -10
  185. package/dist/runner.d.ts.map +1 -1
  186. package/dist/runner.js +48 -43
  187. package/dist/runner.js.map +1 -1
  188. package/dist/store/compile-store.d.ts +5 -3
  189. package/dist/store/compile-store.d.ts.map +1 -1
  190. package/dist/store/compile-store.js +24 -22
  191. package/dist/store/compile-store.js.map +1 -1
  192. package/dist/store/gi/async.d.ts +2 -1
  193. package/dist/store/gi/async.d.ts.map +1 -1
  194. package/dist/store/gi/async.js +28 -24
  195. package/dist/store/gi/async.js.map +1 -1
  196. package/dist/store/gi/callables.d.ts +26 -20
  197. package/dist/store/gi/callables.d.ts.map +1 -1
  198. package/dist/store/gi/callables.js +157 -100
  199. package/dist/store/gi/callables.js.map +1 -1
  200. package/dist/store/gi/callback.d.ts +3 -2
  201. package/dist/store/gi/callback.d.ts.map +1 -1
  202. package/dist/store/gi/callback.js +6 -3
  203. package/dist/store/gi/callback.js.map +1 -1
  204. package/dist/store/gi/class.d.ts +2 -1
  205. package/dist/store/gi/class.d.ts.map +1 -1
  206. package/dist/store/gi/class.js +86 -47
  207. package/dist/store/gi/class.js.map +1 -1
  208. package/dist/store/gi/companion.d.ts +2 -1
  209. package/dist/store/gi/companion.d.ts.map +1 -1
  210. package/dist/store/gi/companion.js +8 -5
  211. package/dist/store/gi/companion.js.map +1 -1
  212. package/dist/store/gi/constant.d.ts +3 -2
  213. package/dist/store/gi/constant.d.ts.map +1 -1
  214. package/dist/store/gi/constant.js +25 -8
  215. package/dist/store/gi/constant.js.map +1 -1
  216. package/dist/store/gi/constructor-props.d.ts +3 -2
  217. package/dist/store/gi/constructor-props.d.ts.map +1 -1
  218. package/dist/store/gi/constructor-props.js +17 -10
  219. package/dist/store/gi/constructor-props.js.map +1 -1
  220. package/dist/store/gi/enum.d.ts +3 -2
  221. package/dist/store/gi/enum.d.ts.map +1 -1
  222. package/dist/store/gi/enum.js +14 -11
  223. package/dist/store/gi/enum.js.map +1 -1
  224. package/dist/store/gi/function.d.ts +5 -4
  225. package/dist/store/gi/function.d.ts.map +1 -1
  226. package/dist/store/gi/function.js +48 -23
  227. package/dist/store/gi/function.js.map +1 -1
  228. package/dist/store/gi/gtype-binding.d.ts +4 -4
  229. package/dist/store/gi/gtype-binding.d.ts.map +1 -1
  230. package/dist/store/gi/gtype-binding.js +15 -11
  231. package/dist/store/gi/gtype-binding.js.map +1 -1
  232. package/dist/store/gi/interface.d.ts +2 -1
  233. package/dist/store/gi/interface.d.ts.map +1 -1
  234. package/dist/store/gi/interface.js +36 -18
  235. package/dist/store/gi/interface.js.map +1 -1
  236. package/dist/store/gi/item-comparators.d.ts +3 -2
  237. package/dist/store/gi/item-comparators.d.ts.map +1 -1
  238. package/dist/store/gi/item-comparators.js +33 -21
  239. package/dist/store/gi/item-comparators.js.map +1 -1
  240. package/dist/store/gi/method.d.ts +13 -13
  241. package/dist/store/gi/method.d.ts.map +1 -1
  242. package/dist/store/gi/method.js +188 -130
  243. package/dist/store/gi/method.js.map +1 -1
  244. package/dist/store/gi/param-marshal.d.ts +7 -6
  245. package/dist/store/gi/param-marshal.d.ts.map +1 -1
  246. package/dist/store/gi/param-marshal.js +26 -13
  247. package/dist/store/gi/param-marshal.js.map +1 -1
  248. package/dist/store/gi/pipeline.d.ts +2 -1
  249. package/dist/store/gi/pipeline.d.ts.map +1 -1
  250. package/dist/store/gi/pipeline.js +38 -23
  251. package/dist/store/gi/pipeline.js.map +1 -1
  252. package/dist/store/gi/properties.d.ts +2 -1
  253. package/dist/store/gi/properties.d.ts.map +1 -1
  254. package/dist/store/gi/properties.js +6 -4
  255. package/dist/store/gi/properties.js.map +1 -1
  256. package/dist/store/gi/property-accessor.d.ts +11 -10
  257. package/dist/store/gi/property-accessor.d.ts.map +1 -1
  258. package/dist/store/gi/property-accessor.js +86 -60
  259. package/dist/store/gi/property-accessor.js.map +1 -1
  260. package/dist/store/gi/record-constructor.d.ts +3 -2
  261. package/dist/store/gi/record-constructor.d.ts.map +1 -1
  262. package/dist/store/gi/record-constructor.js +40 -28
  263. package/dist/store/gi/record-constructor.js.map +1 -1
  264. package/dist/store/gi/record-field-accessor.d.ts +9 -8
  265. package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
  266. package/dist/store/gi/record-field-accessor.js +187 -99
  267. package/dist/store/gi/record-field-accessor.js.map +1 -1
  268. package/dist/store/gi/record-layout.d.ts +6 -5
  269. package/dist/store/gi/record-layout.d.ts.map +1 -1
  270. package/dist/store/gi/record-layout.js +75 -39
  271. package/dist/store/gi/record-layout.js.map +1 -1
  272. package/dist/store/gi/record.d.ts +2 -1
  273. package/dist/store/gi/record.d.ts.map +1 -1
  274. package/dist/store/gi/record.js +15 -16
  275. package/dist/store/gi/record.js.map +1 -1
  276. package/dist/store/gi/registration.d.ts +3 -3
  277. package/dist/store/gi/registration.d.ts.map +1 -1
  278. package/dist/store/gi/registration.js +3 -2
  279. package/dist/store/gi/registration.js.map +1 -1
  280. package/dist/store/gi/return-wrap.d.ts +2 -2
  281. package/dist/store/gi/return-wrap.d.ts.map +1 -1
  282. package/dist/store/gi/return-wrap.js +43 -22
  283. package/dist/store/gi/return-wrap.js.map +1 -1
  284. package/dist/store/gi/runtime-override.d.ts +2 -1
  285. package/dist/store/gi/runtime-override.d.ts.map +1 -1
  286. package/dist/store/gi/runtime-override.js +6 -3
  287. package/dist/store/gi/runtime-override.js.map +1 -1
  288. package/dist/store/gi/signal.d.ts +3 -2
  289. package/dist/store/gi/signal.d.ts.map +1 -1
  290. package/dist/store/gi/signal.js +113 -66
  291. package/dist/store/gi/signal.js.map +1 -1
  292. package/dist/store/gi/value-marshalable.d.ts +15 -0
  293. package/dist/store/gi/value-marshalable.d.ts.map +1 -0
  294. package/dist/store/gi/value-marshalable.js +66 -0
  295. package/dist/store/gi/value-marshalable.js.map +1 -0
  296. package/dist/store/gi/vtable.d.ts +2 -1
  297. package/dist/store/gi/vtable.d.ts.map +1 -1
  298. package/dist/store/gi/vtable.js +60 -30
  299. package/dist/store/gi/vtable.js.map +1 -1
  300. package/dist/store/gi-store.d.ts +5 -4
  301. package/dist/store/gi-store.d.ts.map +1 -1
  302. package/dist/store/gi-store.js +4 -2
  303. package/dist/store/gi-store.js.map +1 -1
  304. package/dist/store/jsx/element-components.d.ts +23 -0
  305. package/dist/store/jsx/element-components.d.ts.map +1 -0
  306. package/dist/store/jsx/element-components.js +86 -0
  307. package/dist/store/jsx/element-components.js.map +1 -0
  308. package/dist/store/jsx/element-prop-imports.d.ts +17 -0
  309. package/dist/store/jsx/element-prop-imports.d.ts.map +1 -0
  310. package/dist/store/jsx/element-prop-imports.js +15 -0
  311. package/dist/store/jsx/element-prop-imports.js.map +1 -0
  312. package/dist/store/jsx/element-prop-types.d.ts +10 -0
  313. package/dist/store/jsx/element-prop-types.d.ts.map +1 -0
  314. package/dist/store/jsx/element-prop-types.js +41 -0
  315. package/dist/store/jsx/element-prop-types.js.map +1 -0
  316. package/dist/store/jsx/gir-index.d.ts +16 -0
  317. package/dist/store/jsx/gir-index.d.ts.map +1 -0
  318. package/dist/store/jsx/gir-index.js +33 -0
  319. package/dist/store/jsx/gir-index.js.map +1 -0
  320. package/dist/store/jsx/intrinsic-elements.d.ts +26 -0
  321. package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -0
  322. package/dist/store/jsx/intrinsic-elements.js +127 -0
  323. package/dist/store/jsx/intrinsic-elements.js.map +1 -0
  324. package/dist/store/{react → jsx}/jsx.d.ts +2 -4
  325. package/dist/store/jsx/jsx.d.ts.map +1 -0
  326. package/dist/store/{react → jsx}/jsx.js +110 -71
  327. package/dist/store/jsx/jsx.js.map +1 -0
  328. package/dist/store/jsx/metadata.d.ts +4 -0
  329. package/dist/store/jsx/metadata.d.ts.map +1 -0
  330. package/dist/store/{react → jsx}/metadata.js +148 -69
  331. package/dist/store/jsx/metadata.js.map +1 -0
  332. package/dist/store/jsx/omitted-props.d.ts +10 -0
  333. package/dist/store/jsx/omitted-props.d.ts.map +1 -0
  334. package/dist/store/jsx/omitted-props.js +22 -0
  335. package/dist/store/jsx/omitted-props.js.map +1 -0
  336. package/dist/store/jsx/pipeline.d.ts +23 -0
  337. package/dist/store/jsx/pipeline.d.ts.map +1 -0
  338. package/dist/store/{react → jsx}/pipeline.js +38 -15
  339. package/dist/store/jsx/pipeline.js.map +1 -0
  340. package/dist/store/{react → jsx}/props.d.ts +9 -12
  341. package/dist/store/jsx/props.d.ts.map +1 -0
  342. package/dist/store/jsx/props.js +153 -0
  343. package/dist/store/jsx/props.js.map +1 -0
  344. package/dist/store/jsx-store.d.ts +5 -3
  345. package/dist/store/jsx-store.d.ts.map +1 -1
  346. package/dist/store/jsx-store.js +4 -1
  347. package/dist/store/jsx-store.js.map +1 -1
  348. package/dist/store/store-fs.d.ts +14 -12
  349. package/dist/store/store-fs.d.ts.map +1 -1
  350. package/dist/store/store-fs.js +9 -7
  351. package/dist/store/store-fs.js.map +1 -1
  352. package/dist/writer/context.d.ts +2 -1
  353. package/dist/writer/context.d.ts.map +1 -1
  354. package/dist/writer/context.js +12 -6
  355. package/dist/writer/context.js.map +1 -1
  356. package/dist/writer/doc.d.ts +2 -1
  357. package/dist/writer/doc.d.ts.map +1 -1
  358. package/dist/writer/doc.js +13 -7
  359. package/dist/writer/doc.js.map +1 -1
  360. package/dist/writer/emit.d.ts +8 -7
  361. package/dist/writer/emit.d.ts.map +1 -1
  362. package/dist/writer/emit.js +13 -10
  363. package/dist/writer/emit.js.map +1 -1
  364. package/dist/writer/gtk-doc.d.ts +2 -1
  365. package/dist/writer/gtk-doc.d.ts.map +1 -1
  366. package/dist/writer/gtk-doc.js +29 -18
  367. package/dist/writer/gtk-doc.js.map +1 -1
  368. package/dist/writer/imports.d.ts +4 -2
  369. package/dist/writer/imports.d.ts.map +1 -1
  370. package/dist/writer/imports.js +35 -24
  371. package/dist/writer/imports.js.map +1 -1
  372. package/dist/writer/module.d.ts +3 -2
  373. package/dist/writer/module.d.ts.map +1 -1
  374. package/dist/writer/module.js +16 -9
  375. package/dist/writer/module.js.map +1 -1
  376. package/dist/xml.d.ts +4 -0
  377. package/dist/xml.d.ts.map +1 -0
  378. package/dist/xml.js +10 -0
  379. package/dist/xml.js.map +1 -0
  380. package/overrides/cairo/context.ts.ejs +7 -7
  381. package/overrides/cairo/matrix.ts.ejs +2 -2
  382. package/overrides/cairo/recording-surface.ts.ejs +2 -2
  383. package/overrides/cairo/region.ts.ejs +1 -1
  384. package/overrides/cairo/scaled-font.ts.ejs +3 -3
  385. package/package.json +14 -9
  386. package/src/analysis/descriptor-render.ts +516 -168
  387. package/src/analysis/descriptor.ts +162 -125
  388. package/src/analysis/inheritance.ts +286 -98
  389. package/src/analysis/param-structure.ts +188 -57
  390. package/src/analysis/ts-type.ts +113 -34
  391. package/src/compile.ts +103 -76
  392. package/src/docs/api-reference.ts +337 -146
  393. package/src/docs/element-page.ts +137 -150
  394. package/src/docs/pipeline.ts +135 -73
  395. package/src/docs/render.ts +151 -87
  396. package/src/docs/symbol-page.ts +268 -123
  397. package/src/fingerprint.ts +138 -26
  398. package/src/gi.ts +35 -0
  399. package/src/gir/ancestry.ts +26 -14
  400. package/src/gir/callback.ts +10 -15
  401. package/src/gir/class.ts +20 -16
  402. package/src/gir/enum.ts +9 -7
  403. package/src/gir/field.ts +37 -8
  404. package/src/gir/function.ts +33 -9
  405. package/src/gir/gir-path.ts +36 -12
  406. package/src/gir/libraries.ts +59 -33
  407. package/src/gir/library.ts +200 -97
  408. package/src/gir/namespace.ts +42 -26
  409. package/src/gir/nullable-overrides.ts +5 -0
  410. package/src/gir/parameter.ts +80 -42
  411. package/src/gir/parse.ts +102 -47
  412. package/src/gir/primitives.ts +25 -23
  413. package/src/gir/property.ts +13 -11
  414. package/src/gir/record.ts +16 -14
  415. package/src/gir/size.ts +91 -58
  416. package/src/gir/type-id.ts +33 -18
  417. package/src/gir/type-ref.ts +62 -26
  418. package/src/gir/type.ts +10 -8
  419. package/src/index.ts +8 -0
  420. package/src/jsx.ts +75 -0
  421. package/src/khronos/args.ts +158 -89
  422. package/src/khronos/jsdoc.ts +67 -29
  423. package/src/khronos/model.ts +154 -53
  424. package/src/khronos/modules.ts +67 -27
  425. package/src/khronos/param-pair.ts +14 -0
  426. package/src/khronos/parse.ts +37 -17
  427. package/src/khronos/pipeline.ts +193 -90
  428. package/src/khronos/plan.ts +235 -86
  429. package/src/khronos/render.ts +208 -71
  430. package/src/khronos/select.ts +48 -18
  431. package/src/react/element-config.ts +97 -0
  432. package/src/runner.ts +100 -57
  433. package/src/store/compile-store.ts +32 -26
  434. package/src/store/gi/async.ts +48 -21
  435. package/src/store/gi/callables.ts +339 -136
  436. package/src/store/gi/callback.ts +13 -4
  437. package/src/store/gi/class.ts +186 -64
  438. package/src/store/gi/companion.ts +15 -6
  439. package/src/store/gi/constant.ts +42 -8
  440. package/src/store/gi/constructor-props.ts +42 -16
  441. package/src/store/gi/enum.ts +28 -13
  442. package/src/store/gi/function.ts +88 -24
  443. package/src/store/gi/gtype-binding.ts +31 -18
  444. package/src/store/gi/interface.ts +101 -36
  445. package/src/store/gi/item-comparators.ts +74 -26
  446. package/src/store/gi/method.ts +377 -159
  447. package/src/store/gi/param-marshal.ts +38 -15
  448. package/src/store/gi/pipeline.ts +72 -22
  449. package/src/store/gi/properties.ts +16 -5
  450. package/src/store/gi/property-accessor.ts +192 -84
  451. package/src/store/gi/record-constructor.ts +70 -33
  452. package/src/store/gi/record-field-accessor.ts +415 -167
  453. package/src/store/gi/record-layout.ts +130 -43
  454. package/src/store/gi/record.ts +29 -15
  455. package/src/store/gi/registration.ts +15 -9
  456. package/src/store/gi/return-wrap.ts +71 -23
  457. package/src/store/gi/runtime-override.ts +13 -3
  458. package/src/store/gi/signal.ts +244 -104
  459. package/src/store/gi/value-marshalable.ts +96 -0
  460. package/src/store/gi/vtable.ts +117 -41
  461. package/src/store/gi-store.ts +26 -13
  462. package/src/store/jsx/element-components.ts +152 -0
  463. package/src/store/jsx/element-prop-imports.ts +24 -0
  464. package/src/store/jsx/element-prop-types.ts +59 -0
  465. package/src/store/jsx/gir-index.ts +62 -0
  466. package/src/store/jsx/intrinsic-elements.ts +253 -0
  467. package/src/store/{react → jsx}/jsx.ts +213 -99
  468. package/src/store/jsx/metadata.ts +385 -0
  469. package/src/store/jsx/omitted-props.ts +32 -0
  470. package/src/store/jsx/pipeline.ts +148 -0
  471. package/src/store/jsx/props.ts +262 -0
  472. package/src/store/jsx-store.ts +15 -3
  473. package/src/store/store-fs.ts +36 -20
  474. package/src/writer/context.ts +25 -6
  475. package/src/writer/doc.ts +19 -5
  476. package/src/writer/emit.ts +20 -11
  477. package/src/writer/gtk-doc.ts +48 -21
  478. package/src/writer/imports.ts +63 -28
  479. package/src/writer/module.ts +35 -11
  480. package/src/xml.ts +12 -0
  481. package/dist/store/gi/class-struct-record.d.ts +0 -9
  482. package/dist/store/gi/class-struct-record.d.ts.map +0 -1
  483. package/dist/store/gi/class-struct-record.js +0 -34
  484. package/dist/store/gi/class-struct-record.js.map +0 -1
  485. package/dist/store/react/built-ins.d.ts +0 -9
  486. package/dist/store/react/built-ins.d.ts.map +0 -1
  487. package/dist/store/react/built-ins.js +0 -226
  488. package/dist/store/react/built-ins.js.map +0 -1
  489. package/dist/store/react/element-components.d.ts +0 -15
  490. package/dist/store/react/element-components.d.ts.map +0 -1
  491. package/dist/store/react/element-components.js +0 -92
  492. package/dist/store/react/element-components.js.map +0 -1
  493. package/dist/store/react/element-prop-types.d.ts +0 -19
  494. package/dist/store/react/element-prop-types.d.ts.map +0 -1
  495. package/dist/store/react/element-prop-types.js +0 -244
  496. package/dist/store/react/element-prop-types.js.map +0 -1
  497. package/dist/store/react/element-props.d.ts +0 -4
  498. package/dist/store/react/element-props.d.ts.map +0 -1
  499. package/dist/store/react/element-props.js +0 -178
  500. package/dist/store/react/element-props.js.map +0 -1
  501. package/dist/store/react/gir-index.d.ts +0 -25
  502. package/dist/store/react/gir-index.d.ts.map +0 -1
  503. package/dist/store/react/gir-index.js +0 -55
  504. package/dist/store/react/gir-index.js.map +0 -1
  505. package/dist/store/react/intrinsic-elements.d.ts +0 -26
  506. package/dist/store/react/intrinsic-elements.d.ts.map +0 -1
  507. package/dist/store/react/intrinsic-elements.js +0 -107
  508. package/dist/store/react/intrinsic-elements.js.map +0 -1
  509. package/dist/store/react/jsx.d.ts.map +0 -1
  510. package/dist/store/react/jsx.js.map +0 -1
  511. package/dist/store/react/metadata.d.ts +0 -4
  512. package/dist/store/react/metadata.d.ts.map +0 -1
  513. package/dist/store/react/metadata.js.map +0 -1
  514. package/dist/store/react/pipeline.d.ts +0 -14
  515. package/dist/store/react/pipeline.d.ts.map +0 -1
  516. package/dist/store/react/pipeline.js.map +0 -1
  517. package/dist/store/react/props.d.ts.map +0 -1
  518. package/dist/store/react/props.js +0 -133
  519. package/dist/store/react/props.js.map +0 -1
  520. package/overrides/gtk/constants.ts.ejs +0 -3
  521. package/overrides/gtk/index.ts.ejs +0 -2
  522. package/src/store/gi/class-struct-record.ts +0 -40
  523. package/src/store/react/built-ins.ts +0 -260
  524. package/src/store/react/element-components.ts +0 -138
  525. package/src/store/react/element-prop-types.ts +0 -280
  526. package/src/store/react/element-props.ts +0 -204
  527. package/src/store/react/gir-index.ts +0 -85
  528. package/src/store/react/intrinsic-elements.ts +0 -161
  529. package/src/store/react/metadata.ts +0 -197
  530. package/src/store/react/pipeline.ts +0 -90
  531. package/src/store/react/props.ts +0 -197
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-config.d.ts","sourceRoot":"","sources":["../../src/react/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,oGAAoG;AACpG,KAAK,cAAc,GAAG;IAAE,SAAS,CAAC,EAAE,YAAY,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE/G,qFAAqF;AACrF,KAAK,eAAe,GAAG;IACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACzC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACpC,SAAS,EAAE,YAAY,CAAC;CAC3B,CAAC;AAsEF,QAAA,MAAM,mBAAmB,GAAU,iBAAiB,MAAM,EAAE,EAAE,YAAY,MAAM,KAAG,OAAO,CAAC,eAAe,CAUzG,CAAC;AAEF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,CAAC"}
@@ -0,0 +1,64 @@
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.omitProps !== undefined) {
37
+ target.omitProps[type] = [...(target.omitProps[type] ?? []), ...config.omitProps];
38
+ }
39
+ if (config.lazy === true) {
40
+ target.lazyElements.push(type);
41
+ }
42
+ };
43
+ /**
44
+ * Reads the framework's built-in element config by importing the freshly linked `@gtkx/react` config
45
+ * entrypoints. These are reconciler-free, so importing them resolves `@gtkx/gi` but never `virtual:gtkx-config`;
46
+ * it must run only after the gi store has been linked.
47
+ */
48
+ const collectBuiltinElements = (target, elements) => {
49
+ for (const [type, config] of Object.entries(elements)) {
50
+ applyBuiltinElement(target, type, config);
51
+ }
52
+ };
53
+ const readBuiltinElements = async (reactSubexports, giStoreDir) => {
54
+ const present = presentNamespaceDirs(giStoreDir);
55
+ const entrypoints = configEntrypoints(reactSubexports, present);
56
+ const result = { components: {}, lazyElements: [], props: {}, omitProps: {} };
57
+ for (const entrypoint of entrypoints) {
58
+ collectBuiltinElements(result, await importBuiltinElements(entrypoint));
59
+ }
60
+ return result;
61
+ };
62
+ export {} from "@gtkx/react/config";
63
+ export { readBuiltinElements };
64
+ //# 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;AActC,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,OAAoB,EAAY,EAAE,CACpF,eAAe,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;IAC3B,IAAI,GAAG,KAAK,iBAAiB,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AACvG,CAAC,CAAC,CAAC;AAEP,MAAM,qBAAqB,GAAG,KAAK,EAAE,UAAkB,EAA2C,EAAE;IAChG,M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AAK,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,SAAS,EAAE,EAAE,EAAE,CAAC;IAE/F,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\";\nimport type { OmittedProps } from \"../store/jsx/omitted-props.js\";\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; omitProps?: string[] };\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 omitProps: OmittedProps;\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.omitProps !== undefined) {\n target.omitProps[type] = [...(target.omitProps[type] ?? []), ...config.omitProps];\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: {}, omitProps: {} };\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,23 +1,31 @@
1
- import type { ElementProp } from "@gtkx/config";
1
+ import type { GiStoreOptions } from "./store/gi-store.js";
2
+ import type { JsxStoreOptions } from "./store/jsx-store.js";
3
+ import type { OmittedProps } from "./store/jsx/omitted-props.js";
2
4
  import { type GlGenerationReport } from "./khronos/pipeline.js";
3
- import { type GiStoreOptions } from "./store/gi-store.js";
4
- import { type JsxStoreOptions } from "./store/jsx-store.js";
5
- export type GlCodegenOptions = {
5
+ type ModuleExport = {
6
+ module: string;
7
+ export: string;
8
+ };
9
+ type GlCodegenOptions = {
6
10
  registryPath: string;
7
11
  overrideExports: Set<string>;
8
12
  outputDir: string;
9
13
  resolveFrom: string;
10
14
  };
11
- export type CodegenRunnerOptions = {
15
+ type CodegenRunnerOptions = {
12
16
  libraries?: string[];
13
17
  girPath?: string[];
14
- elementProps?: Record<string, ElementProp[]> | undefined;
15
18
  gi?: GiStoreOptions;
16
19
  jsx?: JsxStoreOptions | undefined;
20
+ reactSubexports?: string[];
21
+ userComponents?: Record<string, ModuleExport>;
22
+ userLazyElements?: string[];
23
+ userProps?: Record<string, ModuleExport>;
24
+ userOmitProps?: OmittedProps;
17
25
  gl?: GlCodegenOptions;
18
26
  force?: boolean;
19
27
  };
20
- export type CodegenRunnerResult = {
28
+ type CodegenRunnerResult = {
21
29
  regenerated: boolean;
22
30
  namespaces: number;
23
31
  intrinsicElements: number;
@@ -27,11 +35,12 @@ export type CodegenRunnerResult = {
27
35
  /**
28
36
  * Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the
29
37
  * configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its
30
- * fingerprint is stale unless `options.force` is set, while the OpenGL modules are regenerated whenever
31
- * `options.gl` is provided.
38
+ * fingerprint is stale unless `options.force` is set, then the jsx store is regenerated when the gi store or
39
+ * the React element config changed; the OpenGL modules are regenerated whenever `options.gl` is provided.
32
40
  *
33
41
  * @param options - What to generate and where to write it.
34
42
  * @returns A summary of what was regenerated and how long the run took.
35
43
  */
36
- export declare const runCodegen: (options: CodegenRunnerOptions) => Promise<CodegenRunnerResult>;
44
+ declare const runCodegen: (options: CodegenRunnerOptions) => Promise<CodegenRunnerResult>;
45
+ export { runCodegen, type GlCodegenOptions, type CodegenRunnerOptions, type CodegenRunnerResult };
37
46
  //# sourceMappingURL=runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhD,OAAO,EAAE,KAAK,kBAAkB,EAAqB,MAAM,uBAAuB,CAAC;AAEnF,OAAO,EAAyB,KAAK,cAAc,EAAgB,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,sBAAsB,CAAC;AAG3E,MAAM,MAAM,gBAAgB,GAAG;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,GAAG,SAAS,CAAC;IACzD,EAAE,CAAC,EAAE,cAAc,CAAC;IACpB,GAAG,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IAClC,EAAE,CAAC,EAAE,gBAAgB,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,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,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;AAmGF,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,CAAC"}
package/dist/runner.js CHANGED
@@ -1,31 +1,27 @@
1
1
  import { mkdirSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { checkModules } from "./compile.js";
4
- import { computeFingerprint, isStoreFresh } from "./fingerprint.js";
4
+ import { isGiStoreFresh } from "./fingerprint.js";
5
+ import { runGiCodegen } from "./gi.js";
5
6
  import { Library } from "./gir/library.js";
6
- import { namespaceDirectory } from "./gir/namespace.js";
7
7
  import { generateGlModules } from "./khronos/pipeline.js";
8
- import { generateNamespaceModule } from "./store/gi/pipeline.js";
9
- import { writeGiStore } from "./store/gi-store.js";
10
- import { writeJsxStore } from "./store/jsx-store.js";
11
- import { generateJsxFiles } from "./store/react/pipeline.js";
12
8
  /**
13
9
  * Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the
14
10
  * configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its
15
- * fingerprint is stale unless `options.force` is set, while the OpenGL modules are regenerated whenever
16
- * `options.gl` is provided.
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.
17
13
  *
18
14
  * @param options - What to generate and where to write it.
19
15
  * @returns A summary of what was regenerated and how long the run took.
20
16
  */
21
- export const runCodegen = async (options) => {
17
+ const runCodegen = async (options) => {
22
18
  const start = Date.now();
23
19
  const gl = options.gl === undefined ? undefined : emitGlModules(options.gl);
24
- const gi = emitGiStoreIfStale(options);
20
+ const store = await emitStores(options);
25
21
  return {
26
- regenerated: gi !== undefined,
27
- namespaces: gi?.namespaces ?? 0,
28
- intrinsicElements: gi?.intrinsicElements ?? 0,
22
+ regenerated: store.regenerated,
23
+ namespaces: store.namespaces,
24
+ intrinsicElements: store.intrinsicElements,
29
25
  duration: Date.now() - start,
30
26
  gl,
31
27
  };
@@ -46,40 +42,49 @@ const emitGlModules = (options) => {
46
42
  }
47
43
  return report;
48
44
  };
49
- const emitGiStoreIfStale = (options) => {
50
- const { gi, libraries, girPath } = options;
51
- if (gi === undefined || libraries === undefined || girPath === undefined)
52
- return undefined;
53
- const elementProps = options.elementProps ?? {};
54
- if (options.force !== true && isStoreFresh(gi.storeDir, libraries, elementProps))
55
- return undefined;
56
- const library = Library.load(libraries, girPath);
57
- emitGiStore(gi, libraries, elementProps, library);
45
+ const jsxUserOptions = (options) => ({
46
+ reactSubexports: options.reactSubexports ?? [],
47
+ userComponents: options.userComponents ?? {},
48
+ userLazyElements: options.userLazyElements ?? [],
49
+ userProps: options.userProps ?? {},
50
+ userOmitProps: options.userOmitProps ?? {},
51
+ });
52
+ const emitJsxStore = async (input) => {
53
+ const { options, jsx, gi, loadLibrary, giRegenerated, namespaces } = input;
54
+ const { runJsxCodegen } = await import("./jsx.js");
55
+ const jsxResult = await runJsxCodegen({
56
+ getLibrary: loadLibrary,
57
+ jsx,
58
+ giStoreDir: gi.storeDir,
59
+ ...jsxUserOptions(options),
60
+ giRegenerated,
61
+ force: options.force === true,
62
+ });
58
63
  return {
59
- namespaces: library.namespaces.size,
60
- intrinsicElements: emitJsxStore(options.jsx, elementProps, library),
64
+ regenerated: giRegenerated || jsxResult.regenerated,
65
+ namespaces,
66
+ intrinsicElements: jsxResult.intrinsicElementCount,
61
67
  };
62
68
  };
63
- const emitGiStore = (gi, libraries, elementProps, library) => {
64
- const namespaces = [];
65
- for (const namespace of library.namespaces.values()) {
66
- namespaces.push({
67
- directory: namespaceDirectory(namespace),
68
- rawSource: generateNamespaceModule(namespace, library),
69
- });
69
+ const emitStoresWithConfig = async (config) => {
70
+ const { options, gi, jsx, libraries, girPath } = config;
71
+ let library;
72
+ const loadLibrary = () => (library ??= Library.load(libraries, girPath));
73
+ const isGiRegenerated = options.force === true || !isGiStoreFresh(gi.storeDir, libraries, girPath);
74
+ const namespaces = isGiRegenerated
75
+ ? runGiCodegen(loadLibrary(), { gi, libraries, girPath })
76
+ : 0;
77
+ if (jsx === undefined) {
78
+ return { regenerated: isGiRegenerated, namespaces, intrinsicElements: 0 };
70
79
  }
71
- const libs = [...libraries];
72
- writeGiStore(gi, namespaces, {
73
- value: computeFingerprint(library.girFiles, libs, elementProps),
74
- girFiles: library.girFiles,
75
- libraries: libs,
76
- });
80
+ return emitJsxStore({ options, jsx, gi, loadLibrary, giRegenerated: isGiRegenerated, namespaces });
77
81
  };
78
- const emitJsxStore = (jsx, elementProps, library) => {
79
- if (jsx === undefined)
80
- return 0;
81
- const reactPipeline = generateJsxFiles(library, elementProps);
82
- writeJsxStore(jsx, reactPipeline.namespaces, reactPipeline.metadata);
83
- return reactPipeline.intrinsicElementCount;
82
+ const emitStores = async (options) => {
83
+ const { gi, jsx, libraries, girPath } = options;
84
+ if (gi === undefined || libraries === undefined || girPath === undefined) {
85
+ return { regenerated: false, namespaces: 0, intrinsicElements: 0 };
86
+ }
87
+ return emitStoresWithConfig({ options, gi, jsx, libraries, girPath });
84
88
  };
89
+ export { runCodegen };
85
90
  //# sourceMappingURL=runner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,a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from \"node:path\";\nimport type { ElementProp } from \"@gtkx/config\";\nimport { checkModules } from \"./compile.js\";\nimport { computeFingerprint, isStoreFresh } from \"./fingerprint.js\";\nimport { Library } from \"./gir/library.js\";\nimport { namespaceDirectory } from \"./gir/namespace.js\";\nimport { type GlGenerationReport, generateGlModules } from \"./khronos/pipeline.js\";\nimport { generateNamespaceModule } from \"./store/gi/pipeline.js\";\nimport { type GiNamespaceInput, type GiStoreOptions, writeGiStore } from \"./store/gi-store.js\";\nimport { type JsxStoreOptions, writeJsxStore } from \"./store/jsx-store.js\";\nimport { generateJsxFiles } from \"./store/react/pipeline.js\";\n\nexport type GlCodegenOptions = {\n registryPath: string;\n overrideExports: Set<string>;\n outputDir: string;\n resolveFrom: string;\n};\n\nexport type CodegenRunnerOptions = {\n libraries?: string[];\n girPath?: string[];\n elementProps?: Record<string, ElementProp[]> | undefined;\n gi?: GiStoreOptions;\n jsx?: JsxStoreOptions | undefined;\n gl?: GlCodegenOptions;\n force?: boolean;\n};\n\nexport type CodegenRunnerResult = {\n regenerated: boolean;\n namespaces: number;\n intrinsicElements: number;\n duration: number;\n gl?: GlGenerationReport | undefined;\n};\n\ntype GiEmitResult = {\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, while the OpenGL modules are regenerated whenever\n * `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 */\nexport const runCodegen = async (options: CodegenRunnerOptions): Promise<CodegenRunnerResult> => {\n const start = Date.now();\n const gl = options.gl === undefined ? undefined : emitGlModules(options.gl);\n const gi = emitGiStoreIfStale(options);\n return {\n regenerated: gi !== undefined,\n namespaces: gi?.namespaces ?? 0,\n intrinsicElements: gi?.intrinsicElements ?? 0,\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 checkModules({\n modules: [...files].map(([fileName, source]) => ({ fileName, source })),\n resolveFrom: options.resolveFrom,\n label: \"the generated gl modules\",\n });\n mkdirSync(options.outputDir, { recursive: true });\n for (const [fileName, source] of files) {\n writeFileSync(join(options.outputDir, fileName), source);\n }\n return report;\n};\n\nconst emitGiStoreIfStale = (options: CodegenRunnerOptions): GiEmitResult | undefined => {\n const { gi, libraries, girPath } = options;\n if (gi === undefined || libraries === undefined || girPath === undefined) return undefined;\n const elementProps = options.elementProps ?? {};\n if (options.force !== true && isStoreFresh(gi.storeDir, libraries, elementProps)) return undefined;\n const library = Library.load(libraries, girPath);\n emitGiStore(gi, libraries, elementProps, library);\n return {\n namespaces: library.namespaces.size,\n intrinsicElements: emitJsxStore(options.jsx, elementProps, library),\n };\n};\n\nconst emitGiStore = (\n gi: GiStoreOptions,\n libraries: string[],\n elementProps: Record<string, ElementProp[]>,\n library: Library,\n): void => {\n const namespaces: GiNamespaceInput[] = [];\n for (const namespace of library.namespaces.values()) {\n namespaces.push({\n directory: namespaceDirectory(namespace),\n rawSource: generateNamespaceModule(namespace, library),\n });\n }\n const libs = [...libraries];\n writeGiStore(gi, namespaces, {\n value: computeFingerprint(library.girFiles, libs, elementProps),\n girFiles: library.girFiles,\n libraries: libs,\n });\n};\n\nconst emitJsxStore = (\n jsx: JsxStoreOptions | undefined,\n elementProps: Record<string, ElementProp[]>,\n library: Library,\n): number => {\n if (jsx === undefined) return 0;\n const reactPipeline = generateJsxFiles(library, elementProps);\n writeJsxStore(jsx, reactPipeline.namespaces, reactPipeline.metadata);\n return reactPipeline.intrinsicElementCount;\n};\n"]}
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CA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,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 type { OmittedProps } from \"./store/jsx/omitted-props.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 userOmitProps?: OmittedProps;\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 userOmitProps: OmittedProps;\n} => ({\n reactSubexports: options.reactSubexports ?? [],\n userComponents: options.userComponents ?? {},\n userLazyElements: options.userLazyElements ?? [],\n userProps: options.userProps ?? {},\n userOmitProps: options.userOmitProps ?? {},\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\n const namespaces = isGiRegenerated\n ? runGiCodegen(loadLibrary(), { gi, libraries, girPath })\n : 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"]}
@@ -1,9 +1,11 @@
1
1
  import { type SourceModule } from "../compile.js";
2
- export type CompileStoreParams = {
2
+ type CompileStoreParams = {
3
3
  storeDir: string;
4
4
  files: SourceModule[];
5
5
  packageName: string;
6
- exports: Record<string, unknown>;
6
+ /** Declare `virtual:gtkx-config` for the typecheck, needed when it follows imports into `@gtkx/react` source. */
7
+ configEnv?: boolean;
7
8
  };
8
- export declare const compileStore: (params: CompileStoreParams) => void;
9
+ declare const compileStore: (params: CompileStoreParams) => void;
10
+ export { compileStore, type CompileStoreParams };
9
11
  //# sourceMappingURL=compile-store.d.ts.map
@@ -1 +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,MAAM,MAAM,kBAAkB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AA4BF,eAAO,MAAM,YAAY,WAAY,kBAAkB,KAAG,IAWzD,CAAC"}
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"}
@@ -1,4 +1,4 @@
1
- import { rmSync } from "node:fs";
1
+ import { rmSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { compileProject } from "../compile.js";
4
4
  const EMIT_OPTIONS = {
@@ -6,33 +6,35 @@ const EMIT_OPTIONS = {
6
6
  removeComments: false,
7
7
  sourceMap: false,
8
8
  declarationMap: false,
9
- noEmitOnError: true,
10
9
  rootDir: ".",
11
10
  outDir: ".",
12
11
  };
13
- const selfPaths = (packageName, exportsMap, storeDir) => {
14
- const paths = {};
15
- for (const [key, value] of Object.entries(exportsMap)) {
16
- if (key === "./package.json" || typeof value !== "object" || value === null)
17
- continue;
18
- const target = value.default;
19
- if (typeof target !== "string")
20
- continue;
21
- const stem = target.replace(/^\.\//, "").replace(/\.js$/, "");
22
- paths[`${packageName}${key.slice(1)}`] = [join(storeDir, stem)];
23
- }
24
- return paths;
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
+ };
25
18
  };
26
- export const compileStore = (params) => {
27
- compileProject({
28
- projectDir: params.storeDir,
29
- fileNames: params.files.map((file) => file.fileName),
30
- compilerOptions: EMIT_OPTIONS,
31
- paths: selfPaths(params.packageName, params.exports, params.storeDir),
32
- label: `the generated ${params.packageName} store`,
33
- });
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
+ }
34
35
  for (const file of params.files) {
35
36
  rmSync(join(params.storeDir, file.fileName), { force: true });
36
37
  }
37
38
  };
39
+ export { compileStore };
38
40
  //# sourceMappingURL=compile-store.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile-store.js","sourceRoot":"","sources":["../../src/store/compile-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAC;AASlE,MAAM,YAAY,GAAG;IACjB,WAAW,EAAE,IAAI;IACjB,cAAc,EAAE,KAAK;IACrB,SAAS,EAAE,KAAK;IAChB,c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AAW,QAAQ;KACrD,CAAC,CAAC;IACH,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","sourcesContent":["import { rmSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { compileProject, type SourceModule } from \"../compile.js\";\n\nexport type CompileStoreParams = {\n storeDir: string;\n files: SourceModule[];\n packageName: string;\n exports: Record<string, unknown>;\n};\n\nconst EMIT_OPTIONS = {\n declaration: true,\n removeComments: false,\n sourceMap: false,\n declarationMap: false,\n noEmitOnError: true,\n rootDir: \".\",\n outDir: \".\",\n};\n\nconst selfPaths = (\n packageName: string,\n exportsMap: Record<string, unknown>,\n storeDir: string,\n): Record<string, string[]> => {\n const paths: Record<string, string[]> = {};\n for (const [key, value] of Object.entries(exportsMap)) {\n if (key === \"./package.json\" || typeof value !== \"object\" || value === null) continue;\n const target = (value as { default?: unknown }).default;\n if (typeof target !== \"string\") continue;\n const stem = target.replace(/^\\.\\//, \"\").replace(/\\.js$/, \"\");\n paths[`${packageName}${key.slice(1)}`] = [join(storeDir, stem)];\n }\n return paths;\n};\n\nexport const compileStore = (params: CompileStoreParams): void => {\n compileProject({\n projectDir: params.storeDir,\n fileNames: params.files.map((file) => file.fileName),\n compilerOptions: EMIT_OPTIONS,\n paths: selfPaths(params.packageName, params.exports, params.storeDir),\n label: `the generated ${params.packageName} store`,\n });\n for (const file of params.files) {\n rmSync(join(params.storeDir, file.fileName), { force: true });\n }\n};\n"]}
1
+ {"version":3,"file":"compile-store.js","sourceRoot":"","sources":["../../src/store/compile-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WA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,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"]}
@@ -1,4 +1,5 @@
1
1
  import type { GirFunction } from "../../gir/function.js";
2
2
  import type { Library } from "../../gir/library.js";
3
- export declare const matchAsyncFinish: (library: Library, fn: GirFunction, siblings: GirFunction[]) => GirFunction | undefined;
3
+ declare const matchAsyncFinish: (library: Library, fn: GirFunction, siblings: GirFunction[]) => GirFunction | undefined;
4
+ export { matchAsyncFinish };
4
5
  //# sourceMappingURL=async.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../../src/store/gi/async.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,gBAAgB,YAChB,OAAO,MACZ,WAAW,YACL,WAAW,EAAE,KACxB,WAAW,GAAG,SAOhB,CAAC"}
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"}
@@ -1,41 +1,45 @@
1
1
  import { inputParameters } from "../../analysis/param-structure.js";
2
- export const matchAsyncFinish = (library, fn, siblings) => {
3
- if (!hasCanonicalAsyncCallback(library, fn))
2
+ const matchAsyncFinish = (library, fn, siblings) => {
3
+ if (!hasCanonicalAsyncCallback(library, fn)) {
4
4
  return undefined;
5
- const finishName = matchAsyncFinishName(fn, siblings);
6
- if (finishName === undefined)
7
- return undefined;
8
- const finishFn = siblings.find((sibling) => sibling.name === finishName);
9
- if (finishFn === undefined || !isPromisifiableFinish(library, finishFn))
5
+ }
6
+ const finishFn = findFinishSibling(fn, siblings);
7
+ if (finishFn === undefined || !isPromisifiableFinish(library, finishFn)) {
10
8
  return undefined;
9
+ }
11
10
  return finishFn;
12
11
  };
13
- const matchAsyncFinishName = (fn, siblings) => {
14
- if (fn.name.endsWith("_finish"))
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")) {
15
18
  return undefined;
19
+ }
16
20
  const root = fn.name.endsWith("_async") ? fn.name.slice(0, -"_async".length) : fn.name;
17
21
  const finishName = `${root}_finish`;
18
- return siblings.some((sibling) => sibling.name === finishName) ? finishName : undefined;
22
+ return siblings.find((sibling) => sibling.name === finishName);
19
23
  };
20
- const hasCanonicalAsyncCallback = (library, fn) => {
21
- let asyncReadyCallbacks = 0;
22
- let otherCallbacks = 0;
23
- for (const parameter of fn.parameters) {
24
- const ref = parameter.type;
25
- if (ref === undefined || library.typeOf(ref)?.kind !== "callback")
26
- continue;
27
- if (library.nameOf(ref)?.typeName === "AsyncReadyCallback")
28
- asyncReadyCallbacks += 1;
29
- else
30
- otherCallbacks += 1;
24
+ const callbackParameterName = (library, ref) => {
25
+ if (ref === undefined || library.typeFor(ref)?.kind !== "callback") {
26
+ return undefined;
31
27
  }
32
- return asyncReadyCallbacks === 1 && otherCallbacks === 0;
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";
33
35
  };
34
36
  const isPromisifiableFinish = (library, finishFn) => {
35
37
  const inputs = inputParameters(library, finishFn);
36
- if (inputs.length !== 1)
38
+ if (inputs.length !== 1) {
37
39
  return false;
40
+ }
38
41
  const only = inputs[0];
39
- return only?.parameter.type !== undefined && library.nameOf(only.parameter.type)?.typeName === "AsyncResult";
42
+ return only?.parameter.type !== undefined && library.nameFor(only.parameter.type)?.typeName === "AsyncResult";
40
43
  };
44
+ export { matchAsyncFinish };
41
45
  //# sourceMappingURL=async.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"async.js","sourceRoot":"","sources":["../../../src/store/gi/async.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAIpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC5B,OAAgB,EAChB,EAAe,EACf,QAAuB,EACA,EAAE;IACzB,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,EAAE,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9D,MAAM,UAAU,GAAG,oBAAoB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IACtD,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC/C,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IACzE,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,QAAQ,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1F,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,EAAe,EAAE,QAAuB,EAAsB,EAAE;IAC1F,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IAClD,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC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AAC;AACjH,CAAC,CAAC","sourcesContent":["import { inputParameters } from \"../../analysis/param-structure.js\";\nimport type { GirFunction } from \"../../gir/function.js\";\nimport type { Library } from \"../../gir/library.js\";\n\nexport const matchAsyncFinish = (\n library: Library,\n fn: GirFunction,\n siblings: GirFunction[],\n): GirFunction | undefined => {\n if (!hasCanonicalAsyncCallback(library, fn)) return undefined;\n const finishName = matchAsyncFinishName(fn, siblings);\n if (finishName === undefined) return undefined;\n const finishFn = siblings.find((sibling) => sibling.name === finishName);\n if (finishFn === undefined || !isPromisifiableFinish(library, finishFn)) return undefined;\n return finishFn;\n};\n\nconst matchAsyncFinishName = (fn: GirFunction, siblings: GirFunction[]): string | undefined => {\n if (fn.name.endsWith(\"_finish\")) return undefined;\n const root = fn.name.endsWith(\"_async\") ? fn.name.slice(0, -\"_async\".length) : fn.name;\n const finishName = `${root}_finish`;\n return siblings.some((sibling) => sibling.name === finishName) ? finishName : undefined;\n};\n\nconst hasCanonicalAsyncCallback = (library: Library, fn: GirFunction): boolean => {\n let asyncReadyCallbacks = 0;\n let otherCallbacks = 0;\n for (const parameter of fn.parameters) {\n const ref = parameter.type;\n if (ref === undefined || library.typeOf(ref)?.kind !== \"callback\") continue;\n if (library.nameOf(ref)?.typeName === \"AsyncReadyCallback\") asyncReadyCallbacks += 1;\n else otherCallbacks += 1;\n }\n return asyncReadyCallbacks === 1 && otherCallbacks === 0;\n};\n\nconst isPromisifiableFinish = (library: Library, finishFn: GirFunction): boolean => {\n const inputs = inputParameters(library, finishFn);\n if (inputs.length !== 1) return false;\n const only = inputs[0];\n return only?.parameter.type !== undefined && library.nameOf(only.parameter.type)?.typeName === \"AsyncResult\";\n};\n"]}
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,EAC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B,EAAE;IAC5F,IAAI,GAAG,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,KAAK,UAAU,EAAE,CAAC;QACjE,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAAC,OAAgB,EAAE,EAAe,EAAW,EAAE;IAC7E,MAAM,aAAa,GAAG,EAAE,CAAC,UAAU;SAC9B,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,qBAAqB,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;SAClE,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IAE1D,OAAO,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,KAAK,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"]}