@gtkx/codegen 1.0.0-rc.1 → 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 (521) hide show
  1. package/dist/analysis/descriptor-render.d.ts +18 -11
  2. package/dist/analysis/descriptor-render.d.ts.map +1 -1
  3. package/dist/analysis/descriptor-render.js +275 -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 +69 -23
  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 +194 -121
  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 +68 -133
  32. package/dist/docs/element-page.js.map +1 -1
  33. package/dist/docs/pipeline.d.ts +8 -7
  34. package/dist/docs/pipeline.d.ts.map +1 -1
  35. package/dist/docs/pipeline.js +79 -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 +28 -5
  46. package/dist/fingerprint.d.ts.map +1 -1
  47. package/dist/fingerprint.js +66 -13
  48. package/dist/fingerprint.js.map +1 -1
  49. package/dist/gi.d.ts +13 -0
  50. package/dist/gi.d.ts.map +1 -0
  51. package/dist/gi.js +21 -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 +3 -2
  82. package/dist/gir/libraries.d.ts.map +1 -1
  83. package/dist/gir/libraries.js +39 -27
  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 +2 -0
  133. package/dist/index.d.ts.map +1 -1
  134. package/dist/index.js +1 -0
  135. package/dist/index.js.map +1 -1
  136. package/dist/jsx.d.ts +26 -0
  137. package/dist/jsx.d.ts.map +1 -0
  138. package/dist/jsx.js +40 -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 +17 -0
  181. package/dist/react/element-config.d.ts.map +1 -0
  182. package/dist/react/element-config.js +61 -0
  183. package/dist/react/element-config.js.map +1 -0
  184. package/dist/runner.d.ts +17 -10
  185. package/dist/runner.d.ts.map +1 -1
  186. package/dist/runner.js +45 -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 +162 -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-struct-record.d.ts +4 -3
  205. package/dist/store/gi/class-struct-record.d.ts.map +1 -1
  206. package/dist/store/gi/class-struct-record.js +33 -15
  207. package/dist/store/gi/class-struct-record.js.map +1 -1
  208. package/dist/store/gi/class.d.ts +2 -1
  209. package/dist/store/gi/class.d.ts.map +1 -1
  210. package/dist/store/gi/class.js +86 -47
  211. package/dist/store/gi/class.js.map +1 -1
  212. package/dist/store/gi/companion.d.ts +2 -1
  213. package/dist/store/gi/companion.d.ts.map +1 -1
  214. package/dist/store/gi/companion.js +8 -5
  215. package/dist/store/gi/companion.js.map +1 -1
  216. package/dist/store/gi/constant.d.ts +3 -2
  217. package/dist/store/gi/constant.d.ts.map +1 -1
  218. package/dist/store/gi/constant.js +25 -8
  219. package/dist/store/gi/constant.js.map +1 -1
  220. package/dist/store/gi/constructor-props.d.ts +3 -2
  221. package/dist/store/gi/constructor-props.d.ts.map +1 -1
  222. package/dist/store/gi/constructor-props.js +17 -10
  223. package/dist/store/gi/constructor-props.js.map +1 -1
  224. package/dist/store/gi/enum.d.ts +3 -2
  225. package/dist/store/gi/enum.d.ts.map +1 -1
  226. package/dist/store/gi/enum.js +14 -11
  227. package/dist/store/gi/enum.js.map +1 -1
  228. package/dist/store/gi/function.d.ts +5 -4
  229. package/dist/store/gi/function.d.ts.map +1 -1
  230. package/dist/store/gi/function.js +50 -23
  231. package/dist/store/gi/function.js.map +1 -1
  232. package/dist/store/gi/gtype-binding.d.ts +4 -4
  233. package/dist/store/gi/gtype-binding.d.ts.map +1 -1
  234. package/dist/store/gi/gtype-binding.js +15 -11
  235. package/dist/store/gi/gtype-binding.js.map +1 -1
  236. package/dist/store/gi/interface.d.ts +2 -1
  237. package/dist/store/gi/interface.d.ts.map +1 -1
  238. package/dist/store/gi/interface.js +36 -18
  239. package/dist/store/gi/interface.js.map +1 -1
  240. package/dist/store/gi/item-comparators.d.ts +3 -2
  241. package/dist/store/gi/item-comparators.d.ts.map +1 -1
  242. package/dist/store/gi/item-comparators.js +33 -21
  243. package/dist/store/gi/item-comparators.js.map +1 -1
  244. package/dist/store/gi/method.d.ts +13 -13
  245. package/dist/store/gi/method.d.ts.map +1 -1
  246. package/dist/store/gi/method.js +187 -130
  247. package/dist/store/gi/method.js.map +1 -1
  248. package/dist/store/gi/param-marshal.d.ts +7 -6
  249. package/dist/store/gi/param-marshal.d.ts.map +1 -1
  250. package/dist/store/gi/param-marshal.js +26 -13
  251. package/dist/store/gi/param-marshal.js.map +1 -1
  252. package/dist/store/gi/pipeline.d.ts +2 -1
  253. package/dist/store/gi/pipeline.d.ts.map +1 -1
  254. package/dist/store/gi/pipeline.js +38 -23
  255. package/dist/store/gi/pipeline.js.map +1 -1
  256. package/dist/store/gi/properties.d.ts +2 -1
  257. package/dist/store/gi/properties.d.ts.map +1 -1
  258. package/dist/store/gi/properties.js +6 -4
  259. package/dist/store/gi/properties.js.map +1 -1
  260. package/dist/store/gi/property-accessor.d.ts +11 -10
  261. package/dist/store/gi/property-accessor.d.ts.map +1 -1
  262. package/dist/store/gi/property-accessor.js +86 -60
  263. package/dist/store/gi/property-accessor.js.map +1 -1
  264. package/dist/store/gi/record-constructor.d.ts +3 -2
  265. package/dist/store/gi/record-constructor.d.ts.map +1 -1
  266. package/dist/store/gi/record-constructor.js +36 -25
  267. package/dist/store/gi/record-constructor.js.map +1 -1
  268. package/dist/store/gi/record-field-accessor.d.ts +8 -8
  269. package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
  270. package/dist/store/gi/record-field-accessor.js +171 -99
  271. package/dist/store/gi/record-field-accessor.js.map +1 -1
  272. package/dist/store/gi/record-layout.d.ts +6 -5
  273. package/dist/store/gi/record-layout.d.ts.map +1 -1
  274. package/dist/store/gi/record-layout.js +75 -39
  275. package/dist/store/gi/record-layout.js.map +1 -1
  276. package/dist/store/gi/record.d.ts +2 -1
  277. package/dist/store/gi/record.d.ts.map +1 -1
  278. package/dist/store/gi/record.js +19 -13
  279. package/dist/store/gi/record.js.map +1 -1
  280. package/dist/store/gi/registration.d.ts +3 -3
  281. package/dist/store/gi/registration.d.ts.map +1 -1
  282. package/dist/store/gi/registration.js +3 -2
  283. package/dist/store/gi/registration.js.map +1 -1
  284. package/dist/store/gi/return-wrap.d.ts +2 -2
  285. package/dist/store/gi/return-wrap.d.ts.map +1 -1
  286. package/dist/store/gi/return-wrap.js +43 -22
  287. package/dist/store/gi/return-wrap.js.map +1 -1
  288. package/dist/store/gi/runtime-override.d.ts +2 -1
  289. package/dist/store/gi/runtime-override.d.ts.map +1 -1
  290. package/dist/store/gi/runtime-override.js +6 -3
  291. package/dist/store/gi/runtime-override.js.map +1 -1
  292. package/dist/store/gi/signal.d.ts +3 -2
  293. package/dist/store/gi/signal.d.ts.map +1 -1
  294. package/dist/store/gi/signal.js +113 -66
  295. package/dist/store/gi/signal.js.map +1 -1
  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 +27 -0
  321. package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -0
  322. package/dist/store/jsx/intrinsic-elements.js +128 -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/pipeline.d.ts +21 -0
  333. package/dist/store/jsx/pipeline.d.ts.map +1 -0
  334. package/dist/store/{react → jsx}/pipeline.js +36 -15
  335. package/dist/store/jsx/pipeline.js.map +1 -0
  336. package/dist/store/{react → jsx}/props.d.ts +9 -12
  337. package/dist/store/jsx/props.d.ts.map +1 -0
  338. package/dist/store/jsx/props.js +158 -0
  339. package/dist/store/jsx/props.js.map +1 -0
  340. package/dist/store/jsx-store.d.ts +5 -3
  341. package/dist/store/jsx-store.d.ts.map +1 -1
  342. package/dist/store/jsx-store.js +4 -1
  343. package/dist/store/jsx-store.js.map +1 -1
  344. package/dist/store/store-fs.d.ts +14 -12
  345. package/dist/store/store-fs.d.ts.map +1 -1
  346. package/dist/store/store-fs.js +9 -7
  347. package/dist/store/store-fs.js.map +1 -1
  348. package/dist/writer/context.d.ts +2 -1
  349. package/dist/writer/context.d.ts.map +1 -1
  350. package/dist/writer/context.js +12 -6
  351. package/dist/writer/context.js.map +1 -1
  352. package/dist/writer/doc.d.ts +2 -1
  353. package/dist/writer/doc.d.ts.map +1 -1
  354. package/dist/writer/doc.js +13 -7
  355. package/dist/writer/doc.js.map +1 -1
  356. package/dist/writer/emit.d.ts +8 -7
  357. package/dist/writer/emit.d.ts.map +1 -1
  358. package/dist/writer/emit.js +13 -10
  359. package/dist/writer/emit.js.map +1 -1
  360. package/dist/writer/gtk-doc.d.ts +2 -1
  361. package/dist/writer/gtk-doc.d.ts.map +1 -1
  362. package/dist/writer/gtk-doc.js +29 -18
  363. package/dist/writer/gtk-doc.js.map +1 -1
  364. package/dist/writer/imports.d.ts +4 -2
  365. package/dist/writer/imports.d.ts.map +1 -1
  366. package/dist/writer/imports.js +35 -24
  367. package/dist/writer/imports.js.map +1 -1
  368. package/dist/writer/module.d.ts +3 -2
  369. package/dist/writer/module.d.ts.map +1 -1
  370. package/dist/writer/module.js +16 -9
  371. package/dist/writer/module.js.map +1 -1
  372. package/dist/xml.d.ts +4 -0
  373. package/dist/xml.d.ts.map +1 -0
  374. package/dist/xml.js +10 -0
  375. package/dist/xml.js.map +1 -0
  376. package/overrides/cairo/context.ts.ejs +7 -7
  377. package/overrides/cairo/matrix.ts.ejs +2 -2
  378. package/overrides/cairo/recording-surface.ts.ejs +2 -2
  379. package/overrides/cairo/region.ts.ejs +1 -1
  380. package/overrides/cairo/scaled-font.ts.ejs +3 -3
  381. package/package.json +15 -9
  382. package/src/analysis/descriptor-render.ts +484 -168
  383. package/src/analysis/descriptor.ts +162 -125
  384. package/src/analysis/inheritance.ts +286 -98
  385. package/src/analysis/param-structure.ts +188 -57
  386. package/src/analysis/ts-type.ts +112 -26
  387. package/src/compile.ts +103 -76
  388. package/src/docs/api-reference.ts +340 -144
  389. package/src/docs/element-page.ts +137 -146
  390. package/src/docs/pipeline.ts +132 -73
  391. package/src/docs/render.ts +151 -87
  392. package/src/docs/symbol-page.ts +268 -123
  393. package/src/fingerprint.ts +127 -29
  394. package/src/gi.ts +26 -0
  395. package/src/gir/ancestry.ts +26 -14
  396. package/src/gir/callback.ts +10 -15
  397. package/src/gir/class.ts +20 -16
  398. package/src/gir/enum.ts +9 -7
  399. package/src/gir/field.ts +37 -8
  400. package/src/gir/function.ts +33 -9
  401. package/src/gir/gir-path.ts +36 -12
  402. package/src/gir/libraries.ts +56 -31
  403. package/src/gir/library.ts +200 -97
  404. package/src/gir/namespace.ts +42 -26
  405. package/src/gir/nullable-overrides.ts +5 -0
  406. package/src/gir/parameter.ts +80 -42
  407. package/src/gir/parse.ts +102 -47
  408. package/src/gir/primitives.ts +25 -23
  409. package/src/gir/property.ts +13 -11
  410. package/src/gir/record.ts +16 -14
  411. package/src/gir/size.ts +91 -58
  412. package/src/gir/type-id.ts +33 -18
  413. package/src/gir/type-ref.ts +62 -26
  414. package/src/gir/type.ts +10 -8
  415. package/src/index.ts +7 -0
  416. package/src/jsx.ts +70 -0
  417. package/src/khronos/args.ts +158 -89
  418. package/src/khronos/jsdoc.ts +67 -29
  419. package/src/khronos/model.ts +154 -53
  420. package/src/khronos/modules.ts +67 -27
  421. package/src/khronos/param-pair.ts +14 -0
  422. package/src/khronos/parse.ts +37 -17
  423. package/src/khronos/pipeline.ts +193 -90
  424. package/src/khronos/plan.ts +235 -86
  425. package/src/khronos/render.ts +208 -71
  426. package/src/khronos/select.ts +48 -18
  427. package/src/react/element-config.ts +91 -0
  428. package/src/runner.ts +93 -57
  429. package/src/store/compile-store.ts +32 -26
  430. package/src/store/gi/async.ts +48 -21
  431. package/src/store/gi/callables.ts +345 -136
  432. package/src/store/gi/callback.ts +13 -4
  433. package/src/store/gi/class-struct-record.ts +49 -17
  434. package/src/store/gi/class.ts +186 -64
  435. package/src/store/gi/companion.ts +15 -6
  436. package/src/store/gi/constant.ts +42 -8
  437. package/src/store/gi/constructor-props.ts +42 -16
  438. package/src/store/gi/enum.ts +28 -13
  439. package/src/store/gi/function.ts +90 -24
  440. package/src/store/gi/gtype-binding.ts +31 -18
  441. package/src/store/gi/interface.ts +101 -36
  442. package/src/store/gi/item-comparators.ts +74 -26
  443. package/src/store/gi/method.ts +376 -159
  444. package/src/store/gi/param-marshal.ts +38 -15
  445. package/src/store/gi/pipeline.ts +72 -22
  446. package/src/store/gi/properties.ts +16 -5
  447. package/src/store/gi/property-accessor.ts +192 -84
  448. package/src/store/gi/record-constructor.ts +62 -30
  449. package/src/store/gi/record-field-accessor.ts +380 -167
  450. package/src/store/gi/record-layout.ts +130 -43
  451. package/src/store/gi/record.ts +37 -14
  452. package/src/store/gi/registration.ts +15 -9
  453. package/src/store/gi/return-wrap.ts +71 -23
  454. package/src/store/gi/runtime-override.ts +13 -3
  455. package/src/store/gi/signal.ts +244 -104
  456. package/src/store/gi/vtable.ts +117 -41
  457. package/src/store/gi-store.ts +26 -13
  458. package/src/store/jsx/element-components.ts +152 -0
  459. package/src/store/jsx/element-prop-imports.ts +24 -0
  460. package/src/store/jsx/element-prop-types.ts +59 -0
  461. package/src/store/jsx/gir-index.ts +62 -0
  462. package/src/store/jsx/intrinsic-elements.ts +262 -0
  463. package/src/store/{react → jsx}/jsx.ts +213 -99
  464. package/src/store/jsx/metadata.ts +385 -0
  465. package/src/store/jsx/pipeline.ts +145 -0
  466. package/src/store/jsx/props.ts +274 -0
  467. package/src/store/jsx-store.ts +15 -3
  468. package/src/store/store-fs.ts +36 -20
  469. package/src/writer/context.ts +25 -6
  470. package/src/writer/doc.ts +19 -5
  471. package/src/writer/emit.ts +20 -11
  472. package/src/writer/gtk-doc.ts +48 -21
  473. package/src/writer/imports.ts +63 -28
  474. package/src/writer/module.ts +35 -11
  475. package/src/xml.ts +12 -0
  476. package/dist/store/react/built-ins.d.ts +0 -9
  477. package/dist/store/react/built-ins.d.ts.map +0 -1
  478. package/dist/store/react/built-ins.js +0 -226
  479. package/dist/store/react/built-ins.js.map +0 -1
  480. package/dist/store/react/element-components.d.ts +0 -15
  481. package/dist/store/react/element-components.d.ts.map +0 -1
  482. package/dist/store/react/element-components.js +0 -92
  483. package/dist/store/react/element-components.js.map +0 -1
  484. package/dist/store/react/element-prop-types.d.ts +0 -19
  485. package/dist/store/react/element-prop-types.d.ts.map +0 -1
  486. package/dist/store/react/element-prop-types.js +0 -244
  487. package/dist/store/react/element-prop-types.js.map +0 -1
  488. package/dist/store/react/element-props.d.ts +0 -4
  489. package/dist/store/react/element-props.d.ts.map +0 -1
  490. package/dist/store/react/element-props.js +0 -178
  491. package/dist/store/react/element-props.js.map +0 -1
  492. package/dist/store/react/gir-index.d.ts +0 -25
  493. package/dist/store/react/gir-index.d.ts.map +0 -1
  494. package/dist/store/react/gir-index.js +0 -55
  495. package/dist/store/react/gir-index.js.map +0 -1
  496. package/dist/store/react/intrinsic-elements.d.ts +0 -26
  497. package/dist/store/react/intrinsic-elements.d.ts.map +0 -1
  498. package/dist/store/react/intrinsic-elements.js +0 -107
  499. package/dist/store/react/intrinsic-elements.js.map +0 -1
  500. package/dist/store/react/jsx.d.ts.map +0 -1
  501. package/dist/store/react/jsx.js.map +0 -1
  502. package/dist/store/react/metadata.d.ts +0 -4
  503. package/dist/store/react/metadata.d.ts.map +0 -1
  504. package/dist/store/react/metadata.js.map +0 -1
  505. package/dist/store/react/pipeline.d.ts +0 -14
  506. package/dist/store/react/pipeline.d.ts.map +0 -1
  507. package/dist/store/react/pipeline.js.map +0 -1
  508. package/dist/store/react/props.d.ts.map +0 -1
  509. package/dist/store/react/props.js +0 -133
  510. package/dist/store/react/props.js.map +0 -1
  511. package/overrides/gtk/constants.ts.ejs +0 -3
  512. package/overrides/gtk/index.ts.ejs +0 -2
  513. package/src/store/react/built-ins.ts +0 -260
  514. package/src/store/react/element-components.ts +0 -138
  515. package/src/store/react/element-prop-types.ts +0 -280
  516. package/src/store/react/element-props.ts +0 -204
  517. package/src/store/react/gir-index.ts +0 -85
  518. package/src/store/react/intrinsic-elements.ts +0 -161
  519. package/src/store/react/metadata.ts +0 -197
  520. package/src/store/react/pipeline.ts +0 -90
  521. package/src/store/react/props.ts +0 -197
package/dist/compile.js CHANGED
@@ -1,8 +1,7 @@
1
- import { execFileSync } from "node:child_process";
2
1
  import { existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
3
- import { createRequire } from "node:module";
4
- import { dirname, isAbsolute, join, relative, resolve } from "node:path";
5
- const require = createRequire(import.meta.url);
2
+ import { dirname, isAbsolute, join, relative } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import ts from "typescript";
6
5
  const BASE_COMPILER_OPTIONS = {
7
6
  module: "esnext",
8
7
  moduleResolution: "bundler",
@@ -22,84 +21,91 @@ const BASE_COMPILER_OPTIONS = {
22
21
  skipLibCheck: true,
23
22
  types: ["node"],
24
23
  };
25
- const codegenModules = () => dirname(dirname(dirname(require.resolve("@types/node/package.json"))));
24
+ const CHECK_OPTIONS = {
25
+ declaration: true,
26
+ isolatedDeclarations: true,
27
+ noEmit: true,
28
+ };
29
+ const FORMAT_HOST = {
30
+ getCanonicalFileName: (fileName) => fileName,
31
+ getCurrentDirectory: () => ts.sys.getCurrentDirectory(),
32
+ getNewLine: () => "\n",
33
+ };
34
+ /** `@gtkx/codegen`'s own `node_modules`, which has `@types/node` plus the `@gtkx/*` deps the store typecheck needs. */
35
+ const codegenModules = () => {
36
+ const sourceDir = dirname(fileURLToPath(import.meta.url));
37
+ return join(dirname(sourceDir), "node_modules");
38
+ };
26
39
  const linkToolingModules = (projectDir) => {
27
40
  const link = join(projectDir, "node_modules");
28
- if (existsSync(link))
29
- return () => { };
41
+ if (existsSync(link)) {
42
+ return () => undefined;
43
+ }
30
44
  symlinkSync(codegenModules(), link, "junction");
31
- return () => rmSync(link, { force: true });
45
+ return () => {
46
+ rmSync(link, { force: true });
47
+ };
32
48
  };
33
- const tscBin = () => join(dirname(require.resolve("typescript/package.json")), "bin", "tsc");
34
- const runTsc = (tsconfigPath, cwd) => {
35
- try {
36
- execFileSync(process.execPath, [tscBin(), "--pretty", "false", "-p", tsconfigPath], {
37
- cwd,
38
- encoding: "utf8",
39
- stdio: ["ignore", "pipe", "pipe"],
40
- maxBuffer: 64 * 1024 * 1024,
41
- });
42
- return { code: 0, output: "" };
49
+ const isProjectFile = (rel) => !rel.startsWith("..") && !isAbsolute(rel) && !rel.split(/[/\\]/).includes("node_modules");
50
+ const projectDiagnosticLine = (diagnostic, projectDir) => {
51
+ const { file, start } = diagnostic;
52
+ if (file === undefined || start === undefined) {
53
+ return undefined;
43
54
  }
44
- catch (error) {
45
- const { status, stdout = "", stderr = "", } = error;
46
- return { code: typeof status === "number" ? status : 1, output: `${stdout}\n${stderr}` };
55
+ const filePath = relative(projectDir, file.fileName);
56
+ if (!isProjectFile(filePath)) {
57
+ return undefined;
47
58
  }
59
+ const { line, character } = file.getLineAndCharacterOfPosition(start);
60
+ const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
61
+ return `${filePath}:${String(line + 1)}:${String(character + 1)} - ${message} (TS${String(diagnostic.code)})`;
48
62
  };
49
- const DIAGNOSTIC_LINE = /^(.+?)\((\d+),(\d+)\): error TS(\d+): (.*)$/;
50
- const parseDiagnostics = (output, projectDir) => {
51
- const diagnostics = [];
52
- for (const raw of output.split(/\r?\n/)) {
53
- const match = DIAGNOSTIC_LINE.exec(raw);
54
- if (match === null)
55
- continue;
56
- const [, filePart, line, column, code, message] = match;
57
- if (filePart === undefined || line === undefined || column === undefined || code === undefined)
58
- continue;
59
- const file = resolve(projectDir, filePart);
60
- const rel = relative(projectDir, file);
61
- if (rel.startsWith("..") || isAbsolute(rel) || rel.split(/[/\\]/).includes("node_modules"))
62
- continue;
63
- diagnostics.push({ file, line, column, code, message: (message ?? "").trim() });
63
+ const projectDiagnosticLines = (diagnostics, projectDir) => {
64
+ const lines = [];
65
+ for (const diagnostic of diagnostics) {
66
+ const line = projectDiagnosticLine(diagnostic, projectDir);
67
+ if (line !== undefined) {
68
+ lines.push(line);
69
+ }
64
70
  }
65
- return diagnostics;
71
+ return lines;
66
72
  };
67
- const formatDiagnostics = (label, projectDir, diagnostics) => {
68
- const messages = diagnostics.map((diagnostic) => `${relative(projectDir, diagnostic.file)}:${diagnostic.line}:${diagnostic.column} - ${diagnostic.message} (TS${diagnostic.code})`);
69
- return `Type checking ${label} found ${diagnostics.length} error(s):\n${messages.join("\n")}`;
73
+ const diagnosticError = (label, projectDir, diagnostics) => {
74
+ const lines = projectDiagnosticLines(diagnostics, projectDir);
75
+ if (lines.length > 0) {
76
+ return new Error(`Type checking ${label} found ${String(lines.length)} error(s):\n${lines.join("\n")}`);
77
+ }
78
+ return new Error(`Type checking ${label} failed:\n${ts.formatDiagnostics(diagnostics, FORMAT_HOST).trim()}`);
70
79
  };
71
- export const compileProject = (params) => {
72
- const tsconfigPath = join(params.projectDir, "tsconfig.json");
80
+ const runProgram = (params) => {
81
+ const parsed = ts.parseJsonConfigFileContent({
82
+ compilerOptions: { ...BASE_COMPILER_OPTIONS, ...params.compilerOptions },
83
+ files: params.fileNames.map((name) => `./${name}`),
84
+ }, ts.sys, params.projectDir);
85
+ const program = ts.createProgram({
86
+ rootNames: parsed.fileNames,
87
+ options: parsed.options,
88
+ configFileParsingDiagnostics: parsed.errors,
89
+ });
90
+ const diagnostics = ts.getPreEmitDiagnostics(program);
91
+ if (diagnostics.length > 0) {
92
+ return [...diagnostics];
93
+ }
94
+ return [...program.emit().diagnostics];
95
+ };
96
+ const compileProject = (params) => {
73
97
  const unlinkToolingModules = linkToolingModules(params.projectDir);
74
98
  try {
75
- writeFileSync(tsconfigPath, JSON.stringify({
76
- compilerOptions: {
77
- ...BASE_COMPILER_OPTIONS,
78
- ...params.compilerOptions,
79
- ...(params.paths === undefined ? {} : { paths: params.paths }),
80
- },
81
- files: params.fileNames.map((name) => `./${name}`),
82
- }));
83
- const { code, output } = runTsc(tsconfigPath, params.projectDir);
84
- const diagnostics = parseDiagnostics(output, params.projectDir);
99
+ const diagnostics = runProgram(params);
85
100
  if (diagnostics.length > 0) {
86
- throw new Error(formatDiagnostics(params.label, params.projectDir, diagnostics));
87
- }
88
- if (code !== 0) {
89
- throw new Error(`Type checking ${params.label} failed:\n${output.trim()}`);
101
+ throw diagnosticError(params.label, params.projectDir, diagnostics);
90
102
  }
91
103
  }
92
104
  finally {
93
105
  unlinkToolingModules();
94
- rmSync(tsconfigPath, { force: true });
95
106
  }
96
107
  };
97
- const CHECK_OPTIONS = {
98
- declaration: true,
99
- isolatedDeclarations: true,
100
- noEmit: true,
101
- };
102
- export const checkModules = (params) => {
108
+ const checkModules = (params) => {
103
109
  const checkRoot = join(params.resolveFrom, "node_modules");
104
110
  mkdirSync(checkRoot, { recursive: true });
105
111
  const projectDir = mkdtempSync(join(checkRoot, ".gtkx-check-"));
@@ -120,4 +126,5 @@ export const checkModules = (params) => {
120
126
  rmSync(projectDir, { recursive: true, force: true });
121
127
  }
122
128
  };
129
+ export { compileProject, checkModules };
123
130
  //# sourceMappingURL=compile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile.js","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzE,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAe/C,MAAM,qBAAqB,GAAG;IAC1B,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,SAAS;IAC3B,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,CAAC,QAAQ,CAAC;IACf,GAAG,EAAE,WAAW;IAChB,eAAe,EAAE,OAAO;IACxB,gBAAgB,EAAE,CAAC,QAAQ,CAAC;IAC5B,MAAM,EAAE,IAAI;IACZ,0BAA0B,EAAE,IAAI;IAChC,wBAAwB,EAAE,IAAI;IAC9B,iBAAiB,EAAE,IAAI;IACvB,0BAA0B,EAAE,IAAI;IAChC,oBAAoB,EAAE,KAAK;IAC3B,gCAAgC,EAAE,IAAI;IACtC,iBAAiB,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C,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAClD,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC;QACD,cAAc,CAAC;YACX,UAAU;YACV,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;YAC1D,eAAe,EAAE,aAAa;YAC9B,KAAK,EAAE,MAAM,CAAC,KAAK;SACtB,CAAC,CAAC;IACP,CAAC;YAAS,CAAC;QACP,MAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, isAbsolute, join, relative, resolve } from \"node:path\";\n\nconst require = createRequire(import.meta.url);\n\nexport type SourceModule = {\n fileName: string;\n source: string;\n};\n\nexport type CompileProjectParams = {\n projectDir: string;\n fileNames: string[];\n compilerOptions: Record<string, unknown>;\n label: string;\n paths?: Record<string, string[]>;\n};\n\nconst BASE_COMPILER_OPTIONS = {\n module: \"esnext\",\n moduleResolution: \"bundler\",\n target: \"esnext\",\n lib: [\"esnext\"],\n jsx: \"react-jsx\",\n jsxImportSource: \"react\",\n customConditions: [\"source\"],\n strict: true,\n exactOptionalPropertyTypes: true,\n noUncheckedIndexedAccess: true,\n noImplicitReturns: true,\n noFallthroughCasesInSwitch: true,\n allowUnreachableCode: false,\n forceConsistentCasingInFileNames: true,\n resolveJsonModule: true,\n skipLibCheck: true,\n types: [\"node\"],\n};\n\nconst codegenModules = (): string => dirname(dirname(dirname(require.resolve(\"@types/node/package.json\"))));\n\nconst linkToolingModules = (projectDir: string): (() => void) => {\n const link = join(projectDir, \"node_modules\");\n if (existsSync(link)) return () => {};\n symlinkSync(codegenModules(), link, \"junction\");\n return () => rmSync(link, { force: true });\n};\n\nconst tscBin = (): string => join(dirname(require.resolve(\"typescript/package.json\")), \"bin\", \"tsc\");\n\nconst runTsc = (tsconfigPath: string, cwd: string): { code: number; output: string } => {\n try {\n execFileSync(process.execPath, [tscBin(), \"--pretty\", \"false\", \"-p\", tsconfigPath], {\n cwd,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n maxBuffer: 64 * 1024 * 1024,\n });\n return { code: 0, output: \"\" };\n } catch (error) {\n const {\n status,\n stdout = \"\",\n stderr = \"\",\n } = error as { status?: number | null; stdout?: string; stderr?: string };\n return { code: typeof status === \"number\" ? status : 1, output: `${stdout}\\n${stderr}` };\n }\n};\n\nconst DIAGNOSTIC_LINE = /^(.+?)\\((\\d+),(\\d+)\\): error TS(\\d+): (.*)$/;\n\ntype ProjectDiagnostic = { file: string; line: string; column: string; code: string; message: string };\n\nconst parseDiagnostics = (output: string, projectDir: string): ProjectDiagnostic[] => {\n const diagnostics: ProjectDiagnostic[] = [];\n for (const raw of output.split(/\\r?\\n/)) {\n const match = DIAGNOSTIC_LINE.exec(raw);\n if (match === null) continue;\n const [, filePart, line, column, code, message] = match;\n if (filePart === undefined || line === undefined || column === undefined || code === undefined) continue;\n const file = resolve(projectDir, filePart);\n const rel = relative(projectDir, file);\n if (rel.startsWith(\"..\") || isAbsolute(rel) || rel.split(/[/\\\\]/).includes(\"node_modules\")) continue;\n diagnostics.push({ file, line, column, code, message: (message ?? \"\").trim() });\n }\n return diagnostics;\n};\n\nconst formatDiagnostics = (label: string, projectDir: string, diagnostics: ProjectDiagnostic[]): string => {\n const messages = diagnostics.map(\n (diagnostic) =>\n `${relative(projectDir, diagnostic.file)}:${diagnostic.line}:${diagnostic.column} - ${diagnostic.message} (TS${diagnostic.code})`,\n );\n return `Type checking ${label} found ${diagnostics.length} error(s):\\n${messages.join(\"\\n\")}`;\n};\n\nexport const compileProject = (params: CompileProjectParams): void => {\n const tsconfigPath = join(params.projectDir, \"tsconfig.json\");\n const unlinkToolingModules = linkToolingModules(params.projectDir);\n try {\n writeFileSync(\n tsconfigPath,\n JSON.stringify({\n compilerOptions: {\n ...BASE_COMPILER_OPTIONS,\n ...params.compilerOptions,\n ...(params.paths === undefined ? {} : { paths: params.paths }),\n },\n files: params.fileNames.map((name) => `./${name}`),\n }),\n );\n const { code, output } = runTsc(tsconfigPath, params.projectDir);\n const diagnostics = parseDiagnostics(output, params.projectDir);\n if (diagnostics.length > 0) {\n throw new Error(formatDiagnostics(params.label, params.projectDir, diagnostics));\n }\n if (code !== 0) {\n throw new Error(`Type checking ${params.label} failed:\\n${output.trim()}`);\n }\n } finally {\n unlinkToolingModules();\n rmSync(tsconfigPath, { force: true });\n }\n};\n\nconst CHECK_OPTIONS = {\n declaration: true,\n isolatedDeclarations: true,\n noEmit: true,\n};\n\nexport const checkModules = (params: { modules: SourceModule[]; resolveFrom: string; label: string }): void => {\n const checkRoot = join(params.resolveFrom, \"node_modules\");\n mkdirSync(checkRoot, { recursive: true });\n const projectDir = mkdtempSync(join(checkRoot, \".gtkx-check-\"));\n try {\n for (const module of params.modules) {\n const filePath = join(projectDir, module.fileName);\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, module.source);\n }\n compileProject({\n projectDir,\n fileNames: params.modules.map((module) => module.fileName),\n compilerOptions: CHECK_OPTIONS,\n label: params.label,\n });\n } finally {\n rmSync(projectDir, { recursive: true, force: true });\n }\n};\n"]}
1
+ {"version":3,"file":"compile.js","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC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,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IAEhE,IAAI,CAAC;QACD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YACnD,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAClD,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC3C,CAAC;QAED,cAAc,CAAC;YACX,UAAU;YACV,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;YAC1D,eAAe,EAAE,aAAa;YAC9B,KAAK,EAAE,MAAM,CAAC,KAAK;SACtB,CAAC,CAAC;IACP,CAAC;YAAS,CAAC;QACP,MAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAgD,CAAC","sourcesContent":["import { existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, relative } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport ts from \"typescript\";\n\ntype SourceModule = {\n fileName: string;\n source: string;\n};\n\ntype CompileProjectParams = {\n projectDir: string;\n fileNames: string[];\n compilerOptions: Record<string, unknown>;\n label: string;\n};\n\nconst BASE_COMPILER_OPTIONS = {\n module: \"esnext\",\n moduleResolution: \"bundler\",\n target: \"esnext\",\n lib: [\"esnext\"],\n jsx: \"react-jsx\",\n jsxImportSource: \"react\",\n customConditions: [\"source\"],\n strict: true,\n exactOptionalPropertyTypes: true,\n noUncheckedIndexedAccess: true,\n noImplicitReturns: true,\n noFallthroughCasesInSwitch: true,\n allowUnreachableCode: false,\n forceConsistentCasingInFileNames: true,\n resolveJsonModule: true,\n skipLibCheck: true,\n types: [\"node\"],\n};\n\nconst CHECK_OPTIONS = {\n declaration: true,\n isolatedDeclarations: true,\n noEmit: true,\n};\n\nconst FORMAT_HOST: ts.FormatDiagnosticsHost = {\n getCanonicalFileName: (fileName) => fileName,\n getCurrentDirectory: () => ts.sys.getCurrentDirectory(),\n getNewLine: () => \"\\n\",\n};\n\n/** `@gtkx/codegen`'s own `node_modules`, which has `@types/node` plus the `@gtkx/*` deps the store typecheck needs. */\nconst codegenModules = (): string => {\n const sourceDir = dirname(fileURLToPath(import.meta.url));\n\n return join(dirname(sourceDir), \"node_modules\");\n};\n\nconst linkToolingModules = (projectDir: string): (() => void) => {\n const link = join(projectDir, \"node_modules\");\n\n if (existsSync(link)) {\n return (): void => undefined;\n }\n\n symlinkSync(codegenModules(), link, \"junction\");\n\n return () => {\n rmSync(link, { force: true });\n };\n};\n\nconst isProjectFile = (rel: string): boolean =>\n !rel.startsWith(\"..\") && !isAbsolute(rel) && !rel.split(/[/\\\\]/).includes(\"node_modules\");\n\nconst projectDiagnosticLine = (diagnostic: ts.Diagnostic, projectDir: string): string | undefined => {\n const { file, start } = diagnostic;\n\n if (file === undefined || start === undefined) {\n return undefined;\n }\n\n const filePath = relative(projectDir, file.fileName);\n\n if (!isProjectFile(filePath)) {\n return undefined;\n }\n\n const { line, character } = file.getLineAndCharacterOfPosition(start);\n const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, \"\\n\");\n\n return `${filePath}:${String(line + 1)}:${String(character + 1)} - ${message} (TS${String(diagnostic.code)})`;\n};\n\nconst projectDiagnosticLines = (diagnostics: ts.Diagnostic[], projectDir: string): string[] => {\n const lines: string[] = [];\n\n for (const diagnostic of diagnostics) {\n const line = projectDiagnosticLine(diagnostic, projectDir);\n\n if (line !== undefined) {\n lines.push(line);\n }\n }\n\n return lines;\n};\n\nconst diagnosticError = (label: string, projectDir: string, diagnostics: ts.Diagnostic[]): Error => {\n const lines = projectDiagnosticLines(diagnostics, projectDir);\n\n if (lines.length > 0) {\n return new Error(`Type checking ${label} found ${String(lines.length)} error(s):\\n${lines.join(\"\\n\")}`);\n }\n\n return new Error(`Type checking ${label} failed:\\n${ts.formatDiagnostics(diagnostics, FORMAT_HOST).trim()}`);\n};\n\nconst runProgram = (params: CompileProjectParams): ts.Diagnostic[] => {\n const parsed = ts.parseJsonConfigFileContent(\n {\n compilerOptions: { ...BASE_COMPILER_OPTIONS, ...params.compilerOptions },\n files: params.fileNames.map((name) => `./${name}`),\n },\n ts.sys,\n params.projectDir,\n );\n\n const program = ts.createProgram({\n rootNames: parsed.fileNames,\n options: parsed.options,\n configFileParsingDiagnostics: parsed.errors,\n });\n\n const diagnostics = ts.getPreEmitDiagnostics(program);\n\n if (diagnostics.length > 0) {\n return [...diagnostics];\n }\n\n return [...program.emit().diagnostics];\n};\n\nconst compileProject = (params: CompileProjectParams): void => {\n const unlinkToolingModules = linkToolingModules(params.projectDir);\n\n try {\n const diagnostics = runProgram(params);\n\n if (diagnostics.length > 0) {\n throw diagnosticError(params.label, params.projectDir, diagnostics);\n }\n } finally {\n unlinkToolingModules();\n }\n};\n\nconst checkModules = (params: { modules: SourceModule[]; resolveFrom: string; label: string }): void => {\n const checkRoot = join(params.resolveFrom, \"node_modules\");\n mkdirSync(checkRoot, { recursive: true });\n const projectDir = mkdtempSync(join(checkRoot, \".gtkx-check-\"));\n\n try {\n for (const module of params.modules) {\n const filePath = join(projectDir, module.fileName);\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, module.source);\n }\n\n compileProject({\n projectDir,\n fileNames: params.modules.map((module) => module.fileName),\n compilerOptions: CHECK_OPTIONS,\n label: params.label,\n });\n } finally {\n rmSync(projectDir, { recursive: true, force: true });\n }\n};\n\nexport { compileProject, checkModules, type SourceModule, type CompileProjectParams };\n"]}
@@ -1,25 +1,22 @@
1
- import type { ElementProp } from "@gtkx/config";
2
1
  import { type GiSymbolEntry } from "./symbol-page.js";
3
- export type ApiReferenceOptions = {
2
+ type ApiReferenceOptions = {
4
3
  libraries: string[];
5
4
  girPath: string[];
6
- elementProps?: Record<string, ElementProp[]>;
7
5
  };
8
- export type ApiSymbolKind = GiSymbolEntry["kind"] | "element";
9
- export declare const API_SYMBOL_KINDS: ApiSymbolKind[];
10
- export type ApiSymbol = {
6
+ type ApiSymbolKind = GiSymbolEntry["kind"] | "element";
7
+ type ApiSymbol = {
11
8
  namespace: string;
12
9
  name: string;
13
10
  kind: ApiSymbolKind;
14
11
  summary: string;
15
12
  };
16
- export type ApiNamespaceSummary = {
13
+ type ApiNamespaceSummary = {
17
14
  name: string;
18
15
  importPath: string;
19
16
  symbols: number;
20
17
  elements: number;
21
18
  };
22
- export type ApiLookupResult = {
19
+ type ApiLookupResult = {
23
20
  outcome: "page";
24
21
  symbol: ApiSymbol;
25
22
  markdown: string;
@@ -29,12 +26,14 @@ export type ApiLookupResult = {
29
26
  } | {
30
27
  outcome: "notFound";
31
28
  };
32
- export type ApiSearchOptions = {
29
+ type ApiSearchOptions = {
33
30
  query: string;
34
31
  namespace?: string;
35
32
  kinds?: ApiSymbolKind[];
36
33
  limit?: number;
37
34
  };
35
+ declare const API_SYMBOL_KINDS: ApiSymbolKind[];
36
+ declare const loadApiReference: (options: ApiReferenceOptions) => ApiReference;
38
37
  declare class ApiReference {
39
38
  private library;
40
39
  private libraries;
@@ -45,7 +44,6 @@ declare class ApiReference {
45
44
  private byNamespace;
46
45
  private elementsByClass;
47
46
  constructor(options: ApiReferenceOptions);
48
- get girFiles(): string[];
49
47
  private add;
50
48
  private buildIndex;
51
49
  private indexNamespace;
@@ -54,6 +52,9 @@ declare class ApiReference {
54
52
  private symbolPageOptions;
55
53
  private renderPage;
56
54
  private findNamespace;
55
+ private lookupCandidates;
56
+ private scoreEntries;
57
+ get girFiles(): string[];
57
58
  lookup(query: string, kind?: ApiSymbolKind): ApiLookupResult;
58
59
  search(options: ApiSearchOptions): ApiSymbol[];
59
60
  namespaces(): ApiNamespaceSummary[];
@@ -62,5 +63,5 @@ declare class ApiReference {
62
63
  namespaceOverview(name: string): string | undefined;
63
64
  }
64
65
  export type { ApiReference };
65
- export declare const loadApiReference: (options: ApiReferenceOptions) => ApiReference;
66
+ export { API_SYMBOL_KINDS, loadApiReference, type ApiReferenceOptions, type ApiSymbolKind, type ApiSymbol, type ApiNamespaceSummary, type ApiLookupResult, type ApiSearchOptions, };
66
67
  //# sourceMappingURL=api-reference.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-reference.d.ts","sourceRoot":"","sources":["../../src/docs/api-reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAUhD,OAAO,EAAE,KAAK,aAAa,EAA4C,MAAM,kBAAkB,CAAC;AAEhG,MAAM,MAAM,mBAAmB,GAAG;IAC9B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;AAE9D,eAAO,MAAM,gBAAgB,EAAE,aAAa,EAU3C,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF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