@ts-for-gir/cli 3.0.0-beta.10

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 (773) hide show
  1. package/README.md +420 -0
  2. package/lib/commands/doc.d.ts +27 -0
  3. package/lib/commands/doc.js +48 -0
  4. package/lib/commands/doc.js.map +1 -0
  5. package/lib/commands/generate.d.ts +49 -0
  6. package/lib/commands/generate.js +73 -0
  7. package/lib/commands/generate.js.map +1 -0
  8. package/lib/commands/index.d.ts +3 -0
  9. package/lib/commands/index.js +4 -0
  10. package/lib/commands/index.js.map +1 -0
  11. package/lib/commands/list.d.ts +21 -0
  12. package/lib/commands/list.js +77 -0
  13. package/lib/commands/list.js.map +1 -0
  14. package/lib/config.d.ts +88 -0
  15. package/lib/config.js +471 -0
  16. package/lib/config.js.map +1 -0
  17. package/lib/conflict-resolver.d.ts +155 -0
  18. package/lib/conflict-resolver.js +1103 -0
  19. package/lib/conflict-resolver.js.map +1 -0
  20. package/lib/constants.d.ts +18 -0
  21. package/lib/constants.js +23 -0
  22. package/lib/constants.js.map +1 -0
  23. package/lib/dependency-manager.d.ts +34 -0
  24. package/lib/dependency-manager.js +78 -0
  25. package/lib/dependency-manager.js.map +1 -0
  26. package/lib/generation-handler.d.ts +12 -0
  27. package/lib/generation-handler.js +63 -0
  28. package/lib/generation-handler.js.map +1 -0
  29. package/lib/generator.d.ts +5 -0
  30. package/lib/generator.js +2 -0
  31. package/lib/generator.js.map +1 -0
  32. package/lib/gir-factory.d.ts +52 -0
  33. package/lib/gir-factory.js +376 -0
  34. package/lib/gir-factory.js.map +1 -0
  35. package/lib/gir-module.d.ts +259 -0
  36. package/lib/gir-module.js +2181 -0
  37. package/lib/gir-module.js.map +1 -0
  38. package/lib/html-doc-generator.d.ts +13 -0
  39. package/lib/html-doc-generator.js +18 -0
  40. package/lib/html-doc-generator.js.map +1 -0
  41. package/lib/index.d.ts +17 -0
  42. package/lib/index.js +18 -0
  43. package/lib/index.js.map +1 -0
  44. package/lib/injection/callbacks/gjs/Gio-2.0.d.ts +2 -0
  45. package/lib/injection/callbacks/gjs/Gio-2.0.js +36 -0
  46. package/lib/injection/callbacks/gjs/Gio-2.0.js.map +1 -0
  47. package/lib/injection/callbacks/gjs/index.d.ts +2 -0
  48. package/lib/injection/callbacks/gjs/index.js +3 -0
  49. package/lib/injection/callbacks/gjs/index.js.map +1 -0
  50. package/lib/injection/callbacks/index.d.ts +4 -0
  51. package/lib/injection/callbacks/index.js +4 -0
  52. package/lib/injection/callbacks/index.js.map +1 -0
  53. package/lib/injection/callbacks/node-gtk/index.d.ts +2 -0
  54. package/lib/injection/callbacks/node-gtk/index.js +2 -0
  55. package/lib/injection/callbacks/node-gtk/index.js.map +1 -0
  56. package/lib/injection/classes/GLib-2-0.d.ts +2 -0
  57. package/lib/injection/classes/GLib-2-0.js +35 -0
  58. package/lib/injection/classes/GLib-2-0.js.map +1 -0
  59. package/lib/injection/classes/gjs/GLib-2.0.d.ts +2 -0
  60. package/lib/injection/classes/gjs/GLib-2.0.js +205 -0
  61. package/lib/injection/classes/gjs/GLib-2.0.js.map +1 -0
  62. package/lib/injection/classes/gjs/GObject-2.0.d.ts +2 -0
  63. package/lib/injection/classes/gjs/GObject-2.0.js +634 -0
  64. package/lib/injection/classes/gjs/GObject-2.0.js.map +1 -0
  65. package/lib/injection/classes/gjs/Gio-2.0.d.ts +5 -0
  66. package/lib/injection/classes/gjs/Gio-2.0.js +218 -0
  67. package/lib/injection/classes/gjs/Gio-2.0.js.map +1 -0
  68. package/lib/injection/classes/gjs/index.d.ts +2 -0
  69. package/lib/injection/classes/gjs/index.js +5 -0
  70. package/lib/injection/classes/gjs/index.js.map +1 -0
  71. package/lib/injection/classes/index.d.ts +4 -0
  72. package/lib/injection/classes/index.js +5 -0
  73. package/lib/injection/classes/index.js.map +1 -0
  74. package/lib/injection/classes/node-gtk/GLib-2.0.d.ts +2 -0
  75. package/lib/injection/classes/node-gtk/GLib-2.0.js +19 -0
  76. package/lib/injection/classes/node-gtk/GLib-2.0.js.map +1 -0
  77. package/lib/injection/classes/node-gtk/GObject-2.0.d.ts +2 -0
  78. package/lib/injection/classes/node-gtk/GObject-2.0.js +66 -0
  79. package/lib/injection/classes/node-gtk/GObject-2.0.js.map +1 -0
  80. package/lib/injection/classes/node-gtk/Gdk-4.0.d.ts +2 -0
  81. package/lib/injection/classes/node-gtk/Gdk-4.0.js +32 -0
  82. package/lib/injection/classes/node-gtk/Gdk-4.0.js.map +1 -0
  83. package/lib/injection/classes/node-gtk/Gio-2.0.d.ts +2 -0
  84. package/lib/injection/classes/node-gtk/Gio-2.0.js +14 -0
  85. package/lib/injection/classes/node-gtk/Gio-2.0.js.map +1 -0
  86. package/lib/injection/classes/node-gtk/Graphene-1.0.d.ts +2 -0
  87. package/lib/injection/classes/node-gtk/Graphene-1.0.js +133 -0
  88. package/lib/injection/classes/node-gtk/Graphene-1.0.js.map +1 -0
  89. package/lib/injection/classes/node-gtk/Gtk-3.0.d.ts +2 -0
  90. package/lib/injection/classes/node-gtk/Gtk-3.0.js +31 -0
  91. package/lib/injection/classes/node-gtk/Gtk-3.0.js.map +1 -0
  92. package/lib/injection/classes/node-gtk/Gtk-4.0.d.ts +2 -0
  93. package/lib/injection/classes/node-gtk/Gtk-4.0.js +52 -0
  94. package/lib/injection/classes/node-gtk/Gtk-4.0.js.map +1 -0
  95. package/lib/injection/classes/node-gtk/Pango-1.0.d.ts +2 -0
  96. package/lib/injection/classes/node-gtk/Pango-1.0.js +31 -0
  97. package/lib/injection/classes/node-gtk/Pango-1.0.js.map +1 -0
  98. package/lib/injection/classes/node-gtk/index.d.ts +2 -0
  99. package/lib/injection/classes/node-gtk/index.js +19 -0
  100. package/lib/injection/classes/node-gtk/index.js.map +1 -0
  101. package/lib/injection/index.d.ts +3 -0
  102. package/lib/injection/index.js +4 -0
  103. package/lib/injection/index.js.map +1 -0
  104. package/lib/injection/injector.d.ts +17 -0
  105. package/lib/injection/injector.js +139 -0
  106. package/lib/injection/injector.js.map +1 -0
  107. package/lib/logger.d.ts +36 -0
  108. package/lib/logger.js +137 -0
  109. package/lib/logger.js.map +1 -0
  110. package/lib/messages.d.ts +31 -0
  111. package/lib/messages.js +46 -0
  112. package/lib/messages.js.map +1 -0
  113. package/lib/module-loader.d.ts +134 -0
  114. package/lib/module-loader.js +475 -0
  115. package/lib/module-loader.js.map +1 -0
  116. package/lib/start.d.ts +2 -0
  117. package/lib/start.js +15 -0
  118. package/lib/start.js.map +1 -0
  119. package/lib/symtable.d.ts +24 -0
  120. package/lib/symtable.js +63 -0
  121. package/lib/symtable.js.map +1 -0
  122. package/lib/template-processor.d.ts +74 -0
  123. package/lib/template-processor.js +165 -0
  124. package/lib/template-processor.js.map +1 -0
  125. package/lib/transformation.d.ts +156 -0
  126. package/lib/transformation.js +524 -0
  127. package/lib/transformation.js.map +1 -0
  128. package/lib/type-definition-generator.d.ts +116 -0
  129. package/lib/type-definition-generator.js +996 -0
  130. package/lib/type-definition-generator.js.map +1 -0
  131. package/lib/types/answer-version.d.ts +4 -0
  132. package/lib/types/answer-version.js +2 -0
  133. package/lib/types/answer-version.js.map +1 -0
  134. package/lib/types/build-type.d.ts +1 -0
  135. package/lib/types/build-type.js +2 -0
  136. package/lib/types/build-type.js.map +1 -0
  137. package/lib/types/class-parent.d.ts +13 -0
  138. package/lib/types/class-parent.js +2 -0
  139. package/lib/types/class-parent.js.map +1 -0
  140. package/lib/types/config-flags.d.ts +4 -0
  141. package/lib/types/config-flags.js +2 -0
  142. package/lib/types/config-flags.js.map +1 -0
  143. package/lib/types/conflict-child-element.d.ts +10 -0
  144. package/lib/types/conflict-child-element.js +2 -0
  145. package/lib/types/conflict-child-element.js.map +1 -0
  146. package/lib/types/conflict-grouped-element.d.ts +6 -0
  147. package/lib/types/conflict-grouped-element.js +2 -0
  148. package/lib/types/conflict-grouped-element.js.map +1 -0
  149. package/lib/types/conflict-grouped-elements.d.ts +4 -0
  150. package/lib/types/conflict-grouped-elements.js +2 -0
  151. package/lib/types/conflict-grouped-elements.js.map +1 -0
  152. package/lib/types/construct-name.d.ts +1 -0
  153. package/lib/types/construct-name.js +2 -0
  154. package/lib/types/construct-name.js.map +1 -0
  155. package/lib/types/dependency-map.d.ts +4 -0
  156. package/lib/types/dependency-map.js +2 -0
  157. package/lib/types/dependency-map.js.map +1 -0
  158. package/lib/types/dependency.d.ts +15 -0
  159. package/lib/types/dependency.js +2 -0
  160. package/lib/types/dependency.js.map +1 -0
  161. package/lib/types/environment.d.ts +1 -0
  162. package/lib/types/environment.js +2 -0
  163. package/lib/types/environment.js.map +1 -0
  164. package/lib/types/file-info.d.ts +14 -0
  165. package/lib/types/file-info.js +2 -0
  166. package/lib/types/file-info.js.map +1 -0
  167. package/lib/types/generate-config.d.ts +34 -0
  168. package/lib/types/generate-config.js +2 -0
  169. package/lib/types/generate-config.js.map +1 -0
  170. package/lib/types/generator-type.d.ts +4 -0
  171. package/lib/types/generator-type.js +6 -0
  172. package/lib/types/generator-type.js.map +1 -0
  173. package/lib/types/gir-alias-element.d.ts +13 -0
  174. package/lib/types/gir-alias-element.js +2 -0
  175. package/lib/types/gir-alias-element.js.map +1 -0
  176. package/lib/types/gir-annotation.d.ts +9 -0
  177. package/lib/types/gir-annotation.js +2 -0
  178. package/lib/types/gir-annotation.js.map +1 -0
  179. package/lib/types/gir-any-element.d.ts +2 -0
  180. package/lib/types/gir-any-element.js +2 -0
  181. package/lib/types/gir-any-element.js.map +1 -0
  182. package/lib/types/gir-any-type.d.ts +5 -0
  183. package/lib/types/gir-any-type.js +2 -0
  184. package/lib/types/gir-any-type.js.map +1 -0
  185. package/lib/types/gir-array-type.d.ts +20 -0
  186. package/lib/types/gir-array-type.js +3 -0
  187. package/lib/types/gir-array-type.js.map +1 -0
  188. package/lib/types/gir-bitfield-element.d.ts +17 -0
  189. package/lib/types/gir-bitfield-element.js +2 -0
  190. package/lib/types/gir-bitfield-element.js.map +1 -0
  191. package/lib/types/gir-boolean.d.ts +1 -0
  192. package/lib/types/gir-boolean.js +2 -0
  193. package/lib/types/gir-boolean.js.map +1 -0
  194. package/lib/types/gir-boxed-element.d.ts +15 -0
  195. package/lib/types/gir-boxed-element.js +2 -0
  196. package/lib/types/gir-boxed-element.js.map +1 -0
  197. package/lib/types/gir-c-include.d.ts +7 -0
  198. package/lib/types/gir-c-include.js +2 -0
  199. package/lib/types/gir-c-include.js.map +1 -0
  200. package/lib/types/gir-callable-attrs.d.ts +15 -0
  201. package/lib/types/gir-callable-attrs.js +3 -0
  202. package/lib/types/gir-callable-attrs.js.map +1 -0
  203. package/lib/types/gir-callable-param-element.d.ts +30 -0
  204. package/lib/types/gir-callable-param-element.js +2 -0
  205. package/lib/types/gir-callable-param-element.js.map +1 -0
  206. package/lib/types/gir-callable-param.d.ts +7 -0
  207. package/lib/types/gir-callable-param.js +2 -0
  208. package/lib/types/gir-callable-param.js.map +1 -0
  209. package/lib/types/gir-callable-return.d.ts +22 -0
  210. package/lib/types/gir-callable-return.js +2 -0
  211. package/lib/types/gir-callable-return.js.map +1 -0
  212. package/lib/types/gir-callback-element.d.ts +15 -0
  213. package/lib/types/gir-callback-element.js +2 -0
  214. package/lib/types/gir-callback-element.js.map +1 -0
  215. package/lib/types/gir-class-element.d.ts +48 -0
  216. package/lib/types/gir-class-element.js +2 -0
  217. package/lib/types/gir-class-element.js.map +1 -0
  218. package/lib/types/gir-constant-element.d.ts +15 -0
  219. package/lib/types/gir-constant-element.js +2 -0
  220. package/lib/types/gir-constant-element.js.map +1 -0
  221. package/lib/types/gir-constructor-element.d.ts +8 -0
  222. package/lib/types/gir-constructor-element.js +2 -0
  223. package/lib/types/gir-constructor-element.js.map +1 -0
  224. package/lib/types/gir-direction.d.ts +5 -0
  225. package/lib/types/gir-direction.js +7 -0
  226. package/lib/types/gir-direction.js.map +1 -0
  227. package/lib/types/gir-doc-element.d.ts +68 -0
  228. package/lib/types/gir-doc-element.js +2 -0
  229. package/lib/types/gir-doc-element.js.map +1 -0
  230. package/lib/types/gir-enum-element.d.ts +19 -0
  231. package/lib/types/gir-enum-element.js +2 -0
  232. package/lib/types/gir-enum-element.js.map +1 -0
  233. package/lib/types/gir-field-element.d.ts +18 -0
  234. package/lib/types/gir-field-element.js +2 -0
  235. package/lib/types/gir-field-element.js.map +1 -0
  236. package/lib/types/gir-function-element.d.ts +8 -0
  237. package/lib/types/gir-function-element.js +2 -0
  238. package/lib/types/gir-function-element.js.map +1 -0
  239. package/lib/types/gir-implements.d.ts +8 -0
  240. package/lib/types/gir-implements.js +2 -0
  241. package/lib/types/gir-implements.js.map +1 -0
  242. package/lib/types/gir-include.d.ts +9 -0
  243. package/lib/types/gir-include.js +2 -0
  244. package/lib/types/gir-include.js.map +1 -0
  245. package/lib/types/gir-info-attrs.d.ts +13 -0
  246. package/lib/types/gir-info-attrs.js +2 -0
  247. package/lib/types/gir-info-attrs.js.map +1 -0
  248. package/lib/types/gir-info-elements.d.ts +5 -0
  249. package/lib/types/gir-info-elements.js +2 -0
  250. package/lib/types/gir-info-elements.js.map +1 -0
  251. package/lib/types/gir-instance-parameter.d.ts +21 -0
  252. package/lib/types/gir-instance-parameter.js +2 -0
  253. package/lib/types/gir-instance-parameter.js.map +1 -0
  254. package/lib/types/gir-interface-element.d.ts +31 -0
  255. package/lib/types/gir-interface-element.js +2 -0
  256. package/lib/types/gir-interface-element.js.map +1 -0
  257. package/lib/types/gir-member-element.d.ts +17 -0
  258. package/lib/types/gir-member-element.js +2 -0
  259. package/lib/types/gir-member-element.js.map +1 -0
  260. package/lib/types/gir-method-element.d.ts +13 -0
  261. package/lib/types/gir-method-element.js +2 -0
  262. package/lib/types/gir-method-element.js.map +1 -0
  263. package/lib/types/gir-module-resolved-by.d.ts +10 -0
  264. package/lib/types/gir-module-resolved-by.js +2 -0
  265. package/lib/types/gir-module-resolved-by.js.map +1 -0
  266. package/lib/types/gir-modules-grouped-map.d.ts +4 -0
  267. package/lib/types/gir-modules-grouped-map.js +2 -0
  268. package/lib/types/gir-modules-grouped-map.js.map +1 -0
  269. package/lib/types/gir-modules-grouped.d.ts +12 -0
  270. package/lib/types/gir-modules-grouped.js +2 -0
  271. package/lib/types/gir-modules-grouped.js.map +1 -0
  272. package/lib/types/gir-namespace.d.ts +30 -0
  273. package/lib/types/gir-namespace.js +2 -0
  274. package/lib/types/gir-namespace.js.map +1 -0
  275. package/lib/types/gir-package.d.ts +7 -0
  276. package/lib/types/gir-package.js +2 -0
  277. package/lib/types/gir-package.js.map +1 -0
  278. package/lib/types/gir-prerequisite.d.ts +5 -0
  279. package/lib/types/gir-prerequisite.js +2 -0
  280. package/lib/types/gir-prerequisite.js.map +1 -0
  281. package/lib/types/gir-property-element.d.ts +21 -0
  282. package/lib/types/gir-property-element.js +2 -0
  283. package/lib/types/gir-property-element.js.map +1 -0
  284. package/lib/types/gir-record-element.d.ts +30 -0
  285. package/lib/types/gir-record-element.js +2 -0
  286. package/lib/types/gir-record-element.js.map +1 -0
  287. package/lib/types/gir-repository.d.ts +16 -0
  288. package/lib/types/gir-repository.js +2 -0
  289. package/lib/types/gir-repository.js.map +1 -0
  290. package/lib/types/gir-signal.d.ts +25 -0
  291. package/lib/types/gir-signal.js +2 -0
  292. package/lib/types/gir-signal.js.map +1 -0
  293. package/lib/types/gir-transfer-ownership-type.d.ts +5 -0
  294. package/lib/types/gir-transfer-ownership-type.js +7 -0
  295. package/lib/types/gir-transfer-ownership-type.js.map +1 -0
  296. package/lib/types/gir-transfer-ownership.d.ts +5 -0
  297. package/lib/types/gir-transfer-ownership.js +2 -0
  298. package/lib/types/gir-transfer-ownership.js.map +1 -0
  299. package/lib/types/gir-type.d.ts +14 -0
  300. package/lib/types/gir-type.js +2 -0
  301. package/lib/types/gir-type.js.map +1 -0
  302. package/lib/types/gir-union-element.d.ts +22 -0
  303. package/lib/types/gir-union-element.js +2 -0
  304. package/lib/types/gir-union-element.js.map +1 -0
  305. package/lib/types/gir-unparsed-number.d.ts +2 -0
  306. package/lib/types/gir-unparsed-number.js +2 -0
  307. package/lib/types/gir-unparsed-number.js.map +1 -0
  308. package/lib/types/gir-var-args.d.ts +5 -0
  309. package/lib/types/gir-var-args.js +2 -0
  310. package/lib/types/gir-var-args.js.map +1 -0
  311. package/lib/types/gir-virtual-method.d.ts +10 -0
  312. package/lib/types/gir-virtual-method.js +2 -0
  313. package/lib/types/gir-virtual-method.js.map +1 -0
  314. package/lib/types/index.d.ts +120 -0
  315. package/lib/types/index.js +121 -0
  316. package/lib/types/index.js.map +1 -0
  317. package/lib/types/inheritance-table.d.ts +3 -0
  318. package/lib/types/inheritance-table.js +2 -0
  319. package/lib/types/inheritance-table.js.map +1 -0
  320. package/lib/types/injection-callback.d.ts +16 -0
  321. package/lib/types/injection-callback.js +2 -0
  322. package/lib/types/injection-callback.js.map +1 -0
  323. package/lib/types/injection-class.d.ts +25 -0
  324. package/lib/types/injection-class.js +2 -0
  325. package/lib/types/injection-class.js.map +1 -0
  326. package/lib/types/injection-function.d.ts +7 -0
  327. package/lib/types/injection-function.js +2 -0
  328. package/lib/types/injection-function.js.map +1 -0
  329. package/lib/types/injection-generic-parameter.d.ts +2 -0
  330. package/lib/types/injection-generic-parameter.js +2 -0
  331. package/lib/types/injection-generic-parameter.js.map +1 -0
  332. package/lib/types/injection-instance-parameter.d.ts +2 -0
  333. package/lib/types/injection-instance-parameter.js +2 -0
  334. package/lib/types/injection-instance-parameter.js.map +1 -0
  335. package/lib/types/injection-parameter.d.ts +8 -0
  336. package/lib/types/injection-parameter.js +2 -0
  337. package/lib/types/injection-parameter.js.map +1 -0
  338. package/lib/types/injection-property.d.ts +4 -0
  339. package/lib/types/injection-property.js +2 -0
  340. package/lib/types/injection-property.js.map +1 -0
  341. package/lib/types/injection-type.d.ts +2 -0
  342. package/lib/types/injection-type.js +2 -0
  343. package/lib/types/injection-type.js.map +1 -0
  344. package/lib/types/injection.d.ts +5 -0
  345. package/lib/types/injection.js +2 -0
  346. package/lib/types/injection.js.map +1 -0
  347. package/lib/types/local-name-check.d.ts +4 -0
  348. package/lib/types/local-name-check.js +2 -0
  349. package/lib/types/local-name-check.js.map +1 -0
  350. package/lib/types/local-name-type.d.ts +1 -0
  351. package/lib/types/local-name-type.js +2 -0
  352. package/lib/types/local-name-type.js.map +1 -0
  353. package/lib/types/local-name.d.ts +7 -0
  354. package/lib/types/local-name.js +2 -0
  355. package/lib/types/local-name.js.map +1 -0
  356. package/lib/types/local-names.d.ts +4 -0
  357. package/lib/types/local-names.js +2 -0
  358. package/lib/types/local-names.js.map +1 -0
  359. package/lib/types/module-type.d.ts +1 -0
  360. package/lib/types/module-type.js +2 -0
  361. package/lib/types/module-type.js.map +1 -0
  362. package/lib/types/parsed-gir.d.ts +4 -0
  363. package/lib/types/parsed-gir.js +2 -0
  364. package/lib/types/parsed-gir.js.map +1 -0
  365. package/lib/types/part-of-class.d.ts +7 -0
  366. package/lib/types/part-of-class.js +2 -0
  367. package/lib/types/part-of-class.js.map +1 -0
  368. package/lib/types/part-of-module.d.ts +6 -0
  369. package/lib/types/part-of-module.js +2 -0
  370. package/lib/types/part-of-module.js.map +1 -0
  371. package/lib/types/promisify-func.d.ts +7 -0
  372. package/lib/types/promisify-func.js +2 -0
  373. package/lib/types/promisify-func.js.map +1 -0
  374. package/lib/types/resolve-type.d.ts +4 -0
  375. package/lib/types/resolve-type.js +6 -0
  376. package/lib/types/resolve-type.js.map +1 -0
  377. package/lib/types/sym-table-items.d.ts +4 -0
  378. package/lib/types/sym-table-items.js +2 -0
  379. package/lib/types/sym-table-items.js.map +1 -0
  380. package/lib/types/transformation-case.d.ts +1 -0
  381. package/lib/types/transformation-case.js +2 -0
  382. package/lib/types/transformation-case.js.map +1 -0
  383. package/lib/types/transformations.d.ts +11 -0
  384. package/lib/types/transformations.js +2 -0
  385. package/lib/types/transformations.js.map +1 -0
  386. package/lib/types/ts-alias.d.ts +10 -0
  387. package/lib/types/ts-alias.js +2 -0
  388. package/lib/types/ts-alias.js.map +1 -0
  389. package/lib/types/ts-callback-interface.d.ts +10 -0
  390. package/lib/types/ts-callback-interface.js +2 -0
  391. package/lib/types/ts-callback-interface.js.map +1 -0
  392. package/lib/types/ts-callback.d.ts +17 -0
  393. package/lib/types/ts-callback.js +2 -0
  394. package/lib/types/ts-callback.js.map +1 -0
  395. package/lib/types/ts-class.d.ts +85 -0
  396. package/lib/types/ts-class.js +2 -0
  397. package/lib/types/ts-class.js.map +1 -0
  398. package/lib/types/ts-doc-tag.d.ts +21 -0
  399. package/lib/types/ts-doc-tag.js +2 -0
  400. package/lib/types/ts-doc-tag.js.map +1 -0
  401. package/lib/types/ts-doc.d.ts +16 -0
  402. package/lib/types/ts-doc.js +2 -0
  403. package/lib/types/ts-doc.js.map +1 -0
  404. package/lib/types/ts-enum.d.ts +12 -0
  405. package/lib/types/ts-enum.js +2 -0
  406. package/lib/types/ts-enum.js.map +1 -0
  407. package/lib/types/ts-function.d.ts +55 -0
  408. package/lib/types/ts-function.js +2 -0
  409. package/lib/types/ts-function.js.map +1 -0
  410. package/lib/types/ts-generic-parameter.d.ts +8 -0
  411. package/lib/types/ts-generic-parameter.js +2 -0
  412. package/lib/types/ts-generic-parameter.js.map +1 -0
  413. package/lib/types/ts-instance-parameter.d.ts +4 -0
  414. package/lib/types/ts-instance-parameter.js +2 -0
  415. package/lib/types/ts-instance-parameter.js.map +1 -0
  416. package/lib/types/ts-member.d.ts +10 -0
  417. package/lib/types/ts-member.js +2 -0
  418. package/lib/types/ts-member.js.map +1 -0
  419. package/lib/types/ts-method.d.ts +5 -0
  420. package/lib/types/ts-method.js +2 -0
  421. package/lib/types/ts-method.js.map +1 -0
  422. package/lib/types/ts-parameter.d.ts +15 -0
  423. package/lib/types/ts-parameter.js +2 -0
  424. package/lib/types/ts-parameter.js.map +1 -0
  425. package/lib/types/ts-property.d.ts +17 -0
  426. package/lib/types/ts-property.js +2 -0
  427. package/lib/types/ts-property.js.map +1 -0
  428. package/lib/types/ts-signal.d.ts +17 -0
  429. package/lib/types/ts-signal.js +2 -0
  430. package/lib/types/ts-signal.js.map +1 -0
  431. package/lib/types/ts-type-name.d.ts +1 -0
  432. package/lib/types/ts-type-name.js +2 -0
  433. package/lib/types/ts-type-name.js.map +1 -0
  434. package/lib/types/ts-type-separator.d.ts +1 -0
  435. package/lib/types/ts-type-separator.js +2 -0
  436. package/lib/types/ts-type-separator.js.map +1 -0
  437. package/lib/types/ts-type.d.ts +26 -0
  438. package/lib/types/ts-type.js +2 -0
  439. package/lib/types/ts-type.js.map +1 -0
  440. package/lib/types/ts-var.d.ts +17 -0
  441. package/lib/types/ts-var.js +2 -0
  442. package/lib/types/ts-var.js.map +1 -0
  443. package/lib/types/type-gir-alias.d.ts +2 -0
  444. package/lib/types/type-gir-alias.js +2 -0
  445. package/lib/types/type-gir-alias.js.map +1 -0
  446. package/lib/types/type-gir-class.d.ts +2 -0
  447. package/lib/types/type-gir-class.js +2 -0
  448. package/lib/types/type-gir-class.js.map +1 -0
  449. package/lib/types/type-gir-element.d.ts +3 -0
  450. package/lib/types/type-gir-element.js +2 -0
  451. package/lib/types/type-gir-element.js.map +1 -0
  452. package/lib/types/type-gir-enumeration-member.d.ts +2 -0
  453. package/lib/types/type-gir-enumeration-member.js +2 -0
  454. package/lib/types/type-gir-enumeration-member.js.map +1 -0
  455. package/lib/types/type-gir-enumeration.d.ts +2 -0
  456. package/lib/types/type-gir-enumeration.js +2 -0
  457. package/lib/types/type-gir-enumeration.js.map +1 -0
  458. package/lib/types/type-gir-function.d.ts +1 -0
  459. package/lib/types/type-gir-function.js +2 -0
  460. package/lib/types/type-gir-function.js.map +1 -0
  461. package/lib/types/type-gir-interface.d.ts +2 -0
  462. package/lib/types/type-gir-interface.js +2 -0
  463. package/lib/types/type-gir-interface.js.map +1 -0
  464. package/lib/types/type-gir-method.d.ts +2 -0
  465. package/lib/types/type-gir-method.js +2 -0
  466. package/lib/types/type-gir-method.js.map +1 -0
  467. package/lib/types/type-gir-parameter.d.ts +1 -0
  468. package/lib/types/type-gir-parameter.js +2 -0
  469. package/lib/types/type-gir-parameter.js.map +1 -0
  470. package/lib/types/type-gir-property.d.ts +2 -0
  471. package/lib/types/type-gir-property.js +2 -0
  472. package/lib/types/type-gir-property.js.map +1 -0
  473. package/lib/types/type-gir-variable.d.ts +1 -0
  474. package/lib/types/type-gir-variable.js +2 -0
  475. package/lib/types/type-gir-variable.js.map +1 -0
  476. package/lib/types/type-ts-element.d.ts +3 -0
  477. package/lib/types/type-ts-element.js +2 -0
  478. package/lib/types/type-ts-element.js.map +1 -0
  479. package/lib/types/type-ts-enumeration-member.d.ts +2 -0
  480. package/lib/types/type-ts-enumeration-member.js +2 -0
  481. package/lib/types/type-ts-enumeration-member.js.map +1 -0
  482. package/lib/types/type-ts-function.d.ts +1 -0
  483. package/lib/types/type-ts-function.js +2 -0
  484. package/lib/types/type-ts-function.js.map +1 -0
  485. package/lib/types/type-ts-property.d.ts +1 -0
  486. package/lib/types/type-ts-property.js +2 -0
  487. package/lib/types/type-ts-property.js.map +1 -0
  488. package/lib/types/user-config-load-result.d.ts +6 -0
  489. package/lib/types/user-config-load-result.js +2 -0
  490. package/lib/types/user-config-load-result.js.map +1 -0
  491. package/lib/types/user-config.d.ts +42 -0
  492. package/lib/types/user-config.js +2 -0
  493. package/lib/types/user-config.js.map +1 -0
  494. package/lib/utils.d.ts +292 -0
  495. package/lib/utils.js +403 -0
  496. package/lib/utils.js.map +1 -0
  497. package/package.json +89 -0
  498. package/src/commands/doc.ts +65 -0
  499. package/src/commands/generate.ts +88 -0
  500. package/src/commands/index.ts +3 -0
  501. package/src/commands/list.ts +96 -0
  502. package/src/config.ts +528 -0
  503. package/src/conflict-resolver.ts +1358 -0
  504. package/src/constants.ts +29 -0
  505. package/src/dependency-manager.ts +91 -0
  506. package/src/generation-handler.ts +79 -0
  507. package/src/generator.ts +10 -0
  508. package/src/gir-factory.ts +526 -0
  509. package/src/gir-module.ts +2953 -0
  510. package/src/html-doc-generator.ts +23 -0
  511. package/src/index.ts +17 -0
  512. package/src/injection/callbacks/gjs/Gio-2.0.ts +37 -0
  513. package/src/injection/callbacks/gjs/index.ts +5 -0
  514. package/src/injection/callbacks/index.ts +6 -0
  515. package/src/injection/callbacks/node-gtk/index.ts +3 -0
  516. package/src/injection/classes/GLib-2-0.ts +36 -0
  517. package/src/injection/classes/gjs/GLib-2.0.ts +206 -0
  518. package/src/injection/classes/gjs/GObject-2.0.ts +635 -0
  519. package/src/injection/classes/gjs/Gio-2.0.ts +219 -0
  520. package/src/injection/classes/gjs/index.ts +7 -0
  521. package/src/injection/classes/index.ts +7 -0
  522. package/src/injection/classes/node-gtk/GLib-2.0.ts +20 -0
  523. package/src/injection/classes/node-gtk/GObject-2.0.ts +67 -0
  524. package/src/injection/classes/node-gtk/Gdk-4.0.ts +33 -0
  525. package/src/injection/classes/node-gtk/Gio-2.0.ts +15 -0
  526. package/src/injection/classes/node-gtk/Graphene-1.0.ts +134 -0
  527. package/src/injection/classes/node-gtk/Gtk-3.0.ts +32 -0
  528. package/src/injection/classes/node-gtk/Gtk-4.0.ts +53 -0
  529. package/src/injection/classes/node-gtk/Pango-1.0.ts +32 -0
  530. package/src/injection/classes/node-gtk/index.ts +21 -0
  531. package/src/injection/index.ts +3 -0
  532. package/src/injection/injector.ts +184 -0
  533. package/src/logger.ts +134 -0
  534. package/src/messages.ts +69 -0
  535. package/src/module-loader.ts +576 -0
  536. package/src/start.ts +16 -0
  537. package/src/symtable.ts +72 -0
  538. package/src/template-processor.ts +199 -0
  539. package/src/transformation.ts +584 -0
  540. package/src/type-definition-generator.ts +1467 -0
  541. package/src/types/answer-version.ts +4 -0
  542. package/src/types/build-type.ts +1 -0
  543. package/src/types/class-parent.ts +14 -0
  544. package/src/types/config-flags.ts +5 -0
  545. package/src/types/conflict-child-element.ts +11 -0
  546. package/src/types/conflict-grouped-element.ts +7 -0
  547. package/src/types/conflict-grouped-elements.ts +5 -0
  548. package/src/types/construct-name.ts +11 -0
  549. package/src/types/dependency-map.ts +4 -0
  550. package/src/types/dependency.ts +16 -0
  551. package/src/types/environment.ts +1 -0
  552. package/src/types/file-info.ts +14 -0
  553. package/src/types/generate-config.ts +35 -0
  554. package/src/types/generator-type.ts +4 -0
  555. package/src/types/gir-alias-element.ts +15 -0
  556. package/src/types/gir-annotation.ts +10 -0
  557. package/src/types/gir-any-element.ts +35 -0
  558. package/src/types/gir-any-type.ts +7 -0
  559. package/src/types/gir-array-type.ts +23 -0
  560. package/src/types/gir-bitfield-element.ts +20 -0
  561. package/src/types/gir-boolean.ts +1 -0
  562. package/src/types/gir-boxed-element.ts +19 -0
  563. package/src/types/gir-c-include.ts +7 -0
  564. package/src/types/gir-callable-attrs.ts +19 -0
  565. package/src/types/gir-callable-param-element.ts +45 -0
  566. package/src/types/gir-callable-param.ts +9 -0
  567. package/src/types/gir-callable-return.ts +25 -0
  568. package/src/types/gir-callback-element.ts +28 -0
  569. package/src/types/gir-class-element.ts +71 -0
  570. package/src/types/gir-constant-element.ts +17 -0
  571. package/src/types/gir-constructor-element.ts +18 -0
  572. package/src/types/gir-direction.ts +5 -0
  573. package/src/types/gir-doc-element.ts +73 -0
  574. package/src/types/gir-enum-element.ts +28 -0
  575. package/src/types/gir-field-element.ts +31 -0
  576. package/src/types/gir-function-element.ts +19 -0
  577. package/src/types/gir-implements.ts +9 -0
  578. package/src/types/gir-include.ts +9 -0
  579. package/src/types/gir-info-attrs.ts +16 -0
  580. package/src/types/gir-info-elements.ts +8 -0
  581. package/src/types/gir-instance-parameter.ts +25 -0
  582. package/src/types/gir-interface-element.ts +53 -0
  583. package/src/types/gir-member-element.ts +19 -0
  584. package/src/types/gir-method-element.ts +25 -0
  585. package/src/types/gir-module-resolved-by.ts +11 -0
  586. package/src/types/gir-modules-grouped-map.ts +5 -0
  587. package/src/types/gir-modules-grouped.ts +13 -0
  588. package/src/types/gir-namespace.ts +47 -0
  589. package/src/types/gir-package.ts +7 -0
  590. package/src/types/gir-prerequisite.ts +5 -0
  591. package/src/types/gir-property-element.ts +31 -0
  592. package/src/types/gir-record-element.ts +47 -0
  593. package/src/types/gir-repository.ts +20 -0
  594. package/src/types/gir-signal.ts +43 -0
  595. package/src/types/gir-transfer-ownership-type.ts +5 -0
  596. package/src/types/gir-transfer-ownership.ts +6 -0
  597. package/src/types/gir-type.ts +16 -0
  598. package/src/types/gir-union-element.ts +35 -0
  599. package/src/types/gir-unparsed-number.ts +2 -0
  600. package/src/types/gir-var-args.ts +6 -0
  601. package/src/types/gir-virtual-method.ts +22 -0
  602. package/src/types/index.ts +120 -0
  603. package/src/types/inheritance-table.ts +3 -0
  604. package/src/types/injection-callback.ts +20 -0
  605. package/src/types/injection-class.ts +30 -0
  606. package/src/types/injection-function.ts +31 -0
  607. package/src/types/injection-generic-parameter.ts +3 -0
  608. package/src/types/injection-instance-parameter.ts +3 -0
  609. package/src/types/injection-parameter.ts +9 -0
  610. package/src/types/injection-property.ts +7 -0
  611. package/src/types/injection-type.ts +3 -0
  612. package/src/types/injection.ts +6 -0
  613. package/src/types/local-name-check.ts +5 -0
  614. package/src/types/local-name-type.ts +1 -0
  615. package/src/types/local-name.ts +8 -0
  616. package/src/types/local-names.ts +5 -0
  617. package/src/types/module-type.ts +1 -0
  618. package/src/types/parsed-gir.ts +5 -0
  619. package/src/types/part-of-class.ts +9 -0
  620. package/src/types/part-of-module.ts +8 -0
  621. package/src/types/promisify-func.ts +9 -0
  622. package/src/types/resolve-type.ts +4 -0
  623. package/src/types/sym-table-items.ts +5 -0
  624. package/src/types/transformation-case.ts +7 -0
  625. package/src/types/transformations.ts +12 -0
  626. package/src/types/ts-alias.ts +11 -0
  627. package/src/types/ts-callback-interface.ts +11 -0
  628. package/src/types/ts-callback.ts +21 -0
  629. package/src/types/ts-class.ts +109 -0
  630. package/src/types/ts-doc-tag.ts +23 -0
  631. package/src/types/ts-doc.ts +18 -0
  632. package/src/types/ts-enum.ts +15 -0
  633. package/src/types/ts-function.ts +70 -0
  634. package/src/types/ts-generic-parameter.ts +8 -0
  635. package/src/types/ts-instance-parameter.ts +4 -0
  636. package/src/types/ts-member.ts +11 -0
  637. package/src/types/ts-method.ts +6 -0
  638. package/src/types/ts-parameter.ts +20 -0
  639. package/src/types/ts-property.ts +22 -0
  640. package/src/types/ts-signal.ts +21 -0
  641. package/src/types/ts-type-name.ts +1 -0
  642. package/src/types/ts-type-separator.ts +1 -0
  643. package/src/types/ts-type.ts +28 -0
  644. package/src/types/ts-var.ts +21 -0
  645. package/src/types/type-gir-alias.ts +2 -0
  646. package/src/types/type-gir-class.ts +2 -0
  647. package/src/types/type-gir-element.ts +25 -0
  648. package/src/types/type-gir-enumeration-member.ts +2 -0
  649. package/src/types/type-gir-enumeration.ts +2 -0
  650. package/src/types/type-gir-function.ts +8 -0
  651. package/src/types/type-gir-interface.ts +2 -0
  652. package/src/types/type-gir-method.ts +2 -0
  653. package/src/types/type-gir-parameter.ts +1 -0
  654. package/src/types/type-gir-property.ts +2 -0
  655. package/src/types/type-gir-variable.ts +1 -0
  656. package/src/types/type-ts-element.ts +13 -0
  657. package/src/types/type-ts-enumeration-member.ts +2 -0
  658. package/src/types/type-ts-function.ts +1 -0
  659. package/src/types/type-ts-property.ts +1 -0
  660. package/src/types/user-config-load-result.ts +6 -0
  661. package/src/types/user-config.ts +43 -0
  662. package/src/utils.ts +433 -0
  663. package/templates/Cogl-2.0.d.ts +0 -0
  664. package/templates/Gjs/GObject-2.0.d.ts +238 -0
  665. package/templates/Gjs/Gio-2.0.d.ts +101 -0
  666. package/templates/Gjs/Gjs.d.ts +204 -0
  667. package/templates/Gjs/Gjs.js +21 -0
  668. package/templates/Gjs/GnomeShell.d.ts +154 -0
  669. package/templates/Gjs/GnomeShell.js +10 -0
  670. package/templates/Gjs/index.d.ts +594 -0
  671. package/templates/Gjs/index.js +4 -0
  672. package/templates/Gjs/misc/dbusUtils.d.ts +15 -0
  673. package/templates/Gjs/misc/dbusUtils.js +6 -0
  674. package/templates/Gjs/misc/extensionUtils.d.ts +99 -0
  675. package/templates/Gjs/misc/extensionUtils.js +6 -0
  676. package/templates/Gjs/misc/fileUtils.d.ts +51 -0
  677. package/templates/Gjs/misc/fileUtils.js +6 -0
  678. package/templates/Gjs/misc/gnomeSession.d.ts +74 -0
  679. package/templates/Gjs/misc/gnomeSession.js +6 -0
  680. package/templates/Gjs/misc/parentalControlsManager.d.ts +42 -0
  681. package/templates/Gjs/misc/parentalControlsManager.js +6 -0
  682. package/templates/Gjs/misc/signals.d.ts +15 -0
  683. package/templates/Gjs/misc/signals.js +6 -0
  684. package/templates/Gjs/module.d.ts +6 -0
  685. package/templates/Gjs/module.js +16 -0
  686. package/templates/Gjs/tsconfig.alias.json +10 -0
  687. package/templates/Gjs/ui/accessDialog.d.ts +19 -0
  688. package/templates/Gjs/ui/accessDialog.js +6 -0
  689. package/templates/Gjs/ui/altTab.d.ts +124 -0
  690. package/templates/Gjs/ui/altTab.js +6 -0
  691. package/templates/Gjs/ui/animation.d.ts +58 -0
  692. package/templates/Gjs/ui/animation.js +6 -0
  693. package/templates/Gjs/ui/appDisplay.d.ts +204 -0
  694. package/templates/Gjs/ui/appDisplay.js +6 -0
  695. package/templates/Gjs/ui/appFavorites.d.ts +34 -0
  696. package/templates/Gjs/ui/appFavorites.js +6 -0
  697. package/templates/Gjs/ui/appMenu.d.ts +74 -0
  698. package/templates/Gjs/ui/appMenu.js +6 -0
  699. package/templates/Gjs/ui/audioDeviceSelection.d.ts +51 -0
  700. package/templates/Gjs/ui/audioDeviceSelection.js +6 -0
  701. package/templates/Gjs/ui/background.d.ts +255 -0
  702. package/templates/Gjs/ui/background.js +5 -0
  703. package/templates/Gjs/ui/backgroundMenu.d.ts +19 -0
  704. package/templates/Gjs/ui/backgroundMenu.js +5 -0
  705. package/templates/Gjs/ui/barLevel.d.ts +42 -0
  706. package/templates/Gjs/ui/barLevel.js +5 -0
  707. package/templates/Gjs/ui/boxpointer.d.ts +103 -0
  708. package/templates/Gjs/ui/boxpointer.js +5 -0
  709. package/templates/Gjs/ui/calendar.d.ts +261 -0
  710. package/templates/Gjs/ui/calendar.js +5 -0
  711. package/templates/Gjs/ui/checkBox.d.ts +22 -0
  712. package/templates/Gjs/ui/checkBox.js +5 -0
  713. package/templates/Gjs/ui/closeDialog.d.ts +40 -0
  714. package/templates/Gjs/ui/closeDialog.js +5 -0
  715. package/templates/Gjs/ui/components/__init__.d.ts +9 -0
  716. package/templates/Gjs/ui/components/__init__.js +6 -0
  717. package/templates/Gjs/ui/components/automountManager.d.ts +8 -0
  718. package/templates/Gjs/ui/components/automountManager.js +6 -0
  719. package/templates/Gjs/ui/components/autorunManager.d.ts +8 -0
  720. package/templates/Gjs/ui/components/autorunManager.js +6 -0
  721. package/templates/Gjs/ui/components/index.d.ts +6 -0
  722. package/templates/Gjs/ui/components/index.js +6 -0
  723. package/templates/Gjs/ui/components/keyring.d.ts +19 -0
  724. package/templates/Gjs/ui/components/keyring.js +6 -0
  725. package/templates/Gjs/ui/components/networkAgent.d.ts +10 -0
  726. package/templates/Gjs/ui/components/networkAgent.js +6 -0
  727. package/templates/Gjs/ui/components/polkitAgent.d.ts +19 -0
  728. package/templates/Gjs/ui/components/polkitAgent.js +6 -0
  729. package/templates/Gjs/ui/components/telepathyClient.d.ts +10 -0
  730. package/templates/Gjs/ui/components/telepathyClient.js +6 -0
  731. package/templates/Gjs/ui/dialog.d.ts +78 -0
  732. package/templates/Gjs/ui/dialog.js +6 -0
  733. package/templates/Gjs/ui/dnd.d.ts +127 -0
  734. package/templates/Gjs/ui/dnd.js +6 -0
  735. package/templates/Gjs/ui/iconGrid.d.ts +172 -0
  736. package/templates/Gjs/ui/iconGrid.js +6 -0
  737. package/templates/Gjs/ui/layout.d.ts +311 -0
  738. package/templates/Gjs/ui/layout.js +6 -0
  739. package/templates/Gjs/ui/main.d.ts +215 -0
  740. package/templates/Gjs/ui/main.js +6 -0
  741. package/templates/Gjs/ui/messageList.d.ts +113 -0
  742. package/templates/Gjs/ui/messageList.js +6 -0
  743. package/templates/Gjs/ui/messageTray.d.ts +423 -0
  744. package/templates/Gjs/ui/messageTray.js +6 -0
  745. package/templates/Gjs/ui/modalDialog.d.ts +96 -0
  746. package/templates/Gjs/ui/modalDialog.js +6 -0
  747. package/templates/Gjs/ui/mpris.d.ts +78 -0
  748. package/templates/Gjs/ui/mpris.js +6 -0
  749. package/templates/Gjs/ui/notificationDaemon.d.ts +5 -0
  750. package/templates/Gjs/ui/notificationDaemon.js +6 -0
  751. package/templates/Gjs/ui/panel.d.ts +65 -0
  752. package/templates/Gjs/ui/panel.js +6 -0
  753. package/templates/Gjs/ui/panelMenu.d.ts +51 -0
  754. package/templates/Gjs/ui/panelMenu.js +6 -0
  755. package/templates/Gjs/ui/popupMenu.d.ts +228 -0
  756. package/templates/Gjs/ui/popupMenu.js +6 -0
  757. package/templates/Gjs/ui/ripples.d.ts +44 -0
  758. package/templates/Gjs/ui/ripples.js +6 -0
  759. package/templates/Gjs/ui/search.d.ts +158 -0
  760. package/templates/Gjs/ui/search.js +6 -0
  761. package/templates/Gjs/ui/switcherPopup.d.ts +107 -0
  762. package/templates/Gjs/ui/switcherPopup.js +6 -0
  763. package/templates/Gjs/ui/userWidget.d.ts +13 -0
  764. package/templates/Gjs/ui/userWidget.js +6 -0
  765. package/templates/Granite-1.0.d.ts +7 -0
  766. package/templates/Granite-7.0.d.ts +7 -0
  767. package/templates/GstBase-0.10.d.ts +5 -0
  768. package/templates/RygelServer-2.6.d.ts +3 -0
  769. package/templates/node-gtk/GObject-2.0.d.ts +57 -0
  770. package/templates/node-gtk/index.d.ts +40 -0
  771. package/templates/node-gtk/index.js +9 -0
  772. package/templates/node-gtk/module.d.ts +6 -0
  773. package/templates/node-gtk/module.js +17 -0
@@ -0,0 +1,584 @@
1
+ /**
2
+ * This is where transformations take place for gjs and node-gtk.
3
+ * For example a function names should be transformed to lowerCamelCase for node-gtk but should keep their original name for gjs
4
+ */
5
+
6
+ import {
7
+ Transformations,
8
+ Environment,
9
+ ConstructName,
10
+ GenerateConfig,
11
+ GirCallableParamElement,
12
+ GirEnumElement,
13
+ GirBitfieldElement,
14
+ } from './types/index.js'
15
+ import { lowerCamelCase, upperCamelCase, isFirstCharNumeric } from './utils.js'
16
+ import { Logger } from './logger.js'
17
+ import { NEW_LINE_REG_EXP } from './constants.js'
18
+ import {
19
+ WARN_RENAMED_PROPERTY,
20
+ WARN_RENAMED_CLASS,
21
+ WARN_RENAMED_CONSTANT,
22
+ WARN_RENAMED_FIELD,
23
+ WARN_RENAMED_FUNCTION,
24
+ WARN_RENAMED_ENUM,
25
+ WARN_RENAMED_PARAMETER,
26
+ } from './messages.js'
27
+
28
+ export const POD_TYPE_MAP_ARRAY = {
29
+ guint8: 'Uint8Array',
30
+ // Int8Array would probably be more appropriate for gint8, but Uint8Array is better supported
31
+ gint8: 'Uint8Array',
32
+ gunichar: 'string',
33
+ }
34
+
35
+ /**
36
+ * @see https://developer.gnome.org/glib/stable/glib-Basic-Types.html
37
+ */
38
+ export const POD_TYPE_MAP = {
39
+ utf8: 'string',
40
+ none: 'void',
41
+ double: 'number',
42
+ 'double*': 'number',
43
+ guint: 'number',
44
+ 'guint*': 'number',
45
+ guint8: 'number',
46
+ 'guint8*': 'number',
47
+ 'guint8**': 'number',
48
+ guint16: 'number',
49
+ 'guint16*': 'number',
50
+ gint16: 'number',
51
+ 'gint16*': 'number',
52
+ guint32: 'number',
53
+ 'guint32*': 'number',
54
+ guint64: 'number',
55
+ 'guint64*': 'number',
56
+ gunichar: 'string',
57
+ 'gunichar*': 'string',
58
+ gint: 'number',
59
+ 'gint*': 'number',
60
+ gint8: 'number',
61
+ 'gint8*': 'number',
62
+ gint32: 'number',
63
+ 'gint32*': 'number',
64
+ gint64: 'number',
65
+ 'gint64*': 'number',
66
+ gushort: 'number',
67
+ 'gushort*': 'number',
68
+ gfloat: 'number',
69
+ 'gfloat*': 'number',
70
+ gboolean: 'boolean',
71
+ 'gboolean*': 'boolean',
72
+ gpointer: 'object',
73
+ 'gpointer*': 'object',
74
+ gconstpointer: 'object',
75
+ gchar: 'number',
76
+ guchar: 'number',
77
+ glong: 'number',
78
+ gulong: 'number',
79
+ gdouble: 'number',
80
+ gssize: 'number',
81
+ gsize: 'number',
82
+ long: 'number',
83
+ object: 'any',
84
+ gshort: 'number',
85
+ filename: 'string',
86
+ va_list: 'any',
87
+ guintptr: 'number',
88
+ }
89
+
90
+ export const C_TYPE_MAP = (value: string): string | undefined => {
91
+ const cTypeMap = {
92
+ 'char*': 'string',
93
+ 'gchar*': 'string',
94
+ 'gchar**': 'string', // TODO CHECKME
95
+ 'gchar***': 'string', // TODO CHECKME
96
+ 'const gchar*': 'string', // TODO CHECKME
97
+ 'const char*': 'string', // TODO CHECKME
98
+ uint8: 'number',
99
+ int8: 'number',
100
+ int32: 'number',
101
+ uint16: 'number',
102
+ 'int*': 'number',
103
+ int: 'number',
104
+ boolean: 'boolean',
105
+ }
106
+ const result = cTypeMap[value as keyof typeof cTypeMap]
107
+ return result
108
+ }
109
+
110
+ // Gjs is permissive for byte-array in parameters but strict for out/return
111
+ // See <https://discourse.gnome.org/t/gjs-bytearray-vs-glib-bytes/4900>
112
+ export const FULL_TYPE_MAP = (environment: Environment, value: string, out = true): string | undefined => {
113
+ let ba: string
114
+ let gb: string | undefined
115
+ if (environment === 'gjs') {
116
+ ba = 'Uint8Array'
117
+ if (out === false) {
118
+ ba += ' | Gjs.byteArray.ByteArray'
119
+ gb = 'GLib.Bytes | Uint8Array | Gjs.byteArray.ByteArray'
120
+ } else {
121
+ gb = undefined // No transformation
122
+ }
123
+ } else {
124
+ // TODO
125
+ ba = 'any'
126
+ gb = 'any'
127
+ }
128
+
129
+ const fullTypeMap = {
130
+ 'GObject.Value': 'any',
131
+ 'GObject.Closure': 'GObject.TClosure',
132
+ 'GLib.ByteArray': ba,
133
+ 'GLib.Bytes': gb,
134
+ GType: 'GObject.GType',
135
+ 'GObject.Type': 'GObject.GType',
136
+ Type: 'GObject.GType',
137
+ 'GObject.GType': 'GObject.GType',
138
+ }
139
+
140
+ const result = fullTypeMap[value as keyof typeof fullTypeMap]
141
+ return result
142
+ }
143
+
144
+ /** The reserved variable names listed here cannot be resolved simply by quotation marks */
145
+ export const RESERVED_QUOTE_VARIABLE_NAMES = ['constructor']
146
+
147
+ export const RESERVED_VARIABLE_NAMES = [
148
+ 'in',
149
+ 'function',
150
+ 'true',
151
+ 'false',
152
+ 'break',
153
+ 'arguments',
154
+ 'eval',
155
+ 'default',
156
+ 'new',
157
+ 'extends',
158
+ 'with',
159
+ 'var',
160
+ 'class',
161
+ 'delete',
162
+ 'return',
163
+ 'constructor',
164
+ 'this', // TODO check if this is used as we would use this in javascript, if so, this is only allowed as the first parameter
165
+ ]
166
+
167
+ export const RESERVED_CLASS_NAMES = [
168
+ 'break',
169
+ 'boolean',
170
+ 'case',
171
+ 'catch',
172
+ 'class',
173
+ 'const',
174
+ 'continue',
175
+ 'debugger',
176
+ 'default',
177
+ 'delete',
178
+ 'do',
179
+ 'else',
180
+ 'enum',
181
+ 'export',
182
+ 'extends',
183
+ 'false',
184
+ 'finally',
185
+ 'for',
186
+ 'function',
187
+ 'if',
188
+ 'implements',
189
+ 'import',
190
+ 'in',
191
+ 'instanceof',
192
+ 'interface',
193
+ 'let',
194
+ 'new',
195
+ 'number',
196
+ 'package',
197
+ 'private',
198
+ 'protected',
199
+ 'public',
200
+ 'return',
201
+ 'static',
202
+ 'super',
203
+ 'switch',
204
+ 'string',
205
+ 'this',
206
+ 'throw',
207
+ 'true',
208
+ 'try',
209
+ 'typeof',
210
+ 'var',
211
+ 'void',
212
+ 'while',
213
+ 'with',
214
+ 'yield',
215
+ ]
216
+
217
+ export const RESERVED_FUNCTION_NAMES = ['false', 'true', 'break']
218
+
219
+ /**
220
+ * Some classes already have their own `.connect`, `.disconnect` or `.emit` methods,
221
+ * so these cannot be overwritten with the Gjs signal methods which have the same name.
222
+ */
223
+ export const GOBJECT_SIGNAL_METHOD_NAMES = ['connect', 'connect_after', 'emit', 'disconnect']
224
+
225
+ export const IGNORE_GIR_TYPE_TS_DOC_TYPES = [
226
+ 'method',
227
+ 'enum',
228
+ 'enum-member',
229
+ 'bitfield-member',
230
+ 'property',
231
+ 'function',
232
+ 'static-function',
233
+ 'constant',
234
+ ]
235
+
236
+ export const RESERVED_NAMESPACE_NAMES = {}
237
+
238
+ export class Transformation {
239
+ /**
240
+ * Rules for the name conventions
241
+ * For node-gtk naming conventions see https://github.com/romgrk/node-gtk#naming-conventions
242
+ * For gjs see https://gjs-docs.gnome.org/ and https://wiki.gnome.org/Attic/Gjs
243
+ */
244
+ private transformations: Transformations = {
245
+ functionName: {
246
+ node: {
247
+ transformation: 'lowerCamelCase',
248
+ },
249
+ gjs: {
250
+ transformation: 'original',
251
+ },
252
+ },
253
+ enumName: {
254
+ node: {
255
+ transformation: 'original',
256
+ },
257
+ gjs: {
258
+ transformation: 'original',
259
+ },
260
+ },
261
+ enumMember: {
262
+ node: {
263
+ transformation: 'upperCase',
264
+ },
265
+ gjs: {
266
+ transformation: 'upperCase',
267
+ },
268
+ },
269
+ signalName: {
270
+ node: {
271
+ transformation: 'original',
272
+ },
273
+ gjs: {
274
+ transformation: 'original',
275
+ },
276
+ },
277
+ // GJS always re-writes - to _ (I think?)
278
+ propertyName: {
279
+ node: {
280
+ transformation: 'lowerCamelCase',
281
+ },
282
+ gjs: {
283
+ transformation: 'underscores',
284
+ },
285
+ },
286
+ parameterName: {
287
+ node: {
288
+ transformation: 'lowerCamelCase',
289
+ },
290
+ gjs: {
291
+ transformation: 'underscores',
292
+ },
293
+ },
294
+ fieldName: {
295
+ node: {
296
+ transformation: 'lowerCamelCase',
297
+ },
298
+ gjs: {
299
+ transformation: 'underscores',
300
+ },
301
+ },
302
+ constantName: {
303
+ node: {
304
+ transformation: 'original',
305
+ },
306
+ gjs: {
307
+ transformation: 'original',
308
+ },
309
+ },
310
+ importName: {
311
+ node: {
312
+ transformation: 'upperCamelCase',
313
+ },
314
+ gjs: {
315
+ transformation: 'upperCamelCase',
316
+ },
317
+ },
318
+ signalInterfaceName: {
319
+ node: {
320
+ transformation: 'upperCamelCase',
321
+ },
322
+ gjs: {
323
+ transformation: 'upperCamelCase',
324
+ },
325
+ },
326
+ }
327
+
328
+ private log: Logger
329
+
330
+ constructor(moduleName = 'Transformation', private readonly config: GenerateConfig) {
331
+ this.log = new Logger(config.environment, config.verbose, moduleName)
332
+ }
333
+
334
+ public transformSignalInterfaceName(name: string): string {
335
+ name = this.transform('signalInterfaceName', name)
336
+ return name
337
+ }
338
+
339
+ public transformModuleNamespaceName(name: string): string {
340
+ name = this.transformNumericName(name)
341
+ name = this.transform('importName', name)
342
+
343
+ if (RESERVED_NAMESPACE_NAMES[name]) {
344
+ name = `${name}_`
345
+ }
346
+ return name
347
+ }
348
+
349
+ public transformClassName(name: string): string {
350
+ const originalName = `${name}`
351
+ name = this.transformNumericName(name)
352
+
353
+ if (RESERVED_CLASS_NAMES.includes(name)) {
354
+ name = `${name}_`
355
+ }
356
+ if (originalName !== name) {
357
+ this.log.warn(WARN_RENAMED_CLASS(originalName, name))
358
+ }
359
+ return name
360
+ }
361
+
362
+ /**
363
+ * // E.g. the NetworkManager-1.0 has enum names starting with 80211
364
+ * @param girEnum The enum
365
+ * @returns The transformed name
366
+ */
367
+ public transformEnumName(girEnum: GirEnumElement | GirBitfieldElement): string {
368
+ let name = girEnum.$.name
369
+ name = this.transform('enumName', name)
370
+ const originalName = `${name}`
371
+
372
+ // For an example enum starting with a number see https://gjs-docs.gnome.org/nm10~1.20.8/nm.80211mode
373
+ name = this.transformNumericName(name)
374
+
375
+ if (RESERVED_CLASS_NAMES.includes(name)) {
376
+ name = `${name}_`
377
+ }
378
+ if (originalName !== name) {
379
+ this.log.warn(WARN_RENAMED_ENUM(originalName, name))
380
+ }
381
+ return name
382
+ }
383
+
384
+ public transformEnumMember(memberName: string): string {
385
+ memberName = this.transform('enumMember', memberName)
386
+ memberName = this.transformNumericName(memberName)
387
+
388
+ return memberName
389
+ }
390
+
391
+ public transformFunctionName(name: string, isVirtual: boolean): string {
392
+ name = this.transform('functionName', name)
393
+
394
+ // node-gtk has no `vfunc_` prefix for virtual methods
395
+ if (isVirtual && this.config.environment === 'gjs') {
396
+ name = 'vfunc_' + name
397
+ }
398
+
399
+ const originalName = `${name}`
400
+
401
+ name = this.transformNumericName(name)
402
+
403
+ if (RESERVED_FUNCTION_NAMES.includes(name)) {
404
+ name = `${name}_TODO`
405
+ }
406
+
407
+ if (originalName !== name) {
408
+ this.log.warn(WARN_RENAMED_FUNCTION(originalName, name))
409
+ }
410
+ return name
411
+ }
412
+
413
+ public transformReservedVariableNames(name: string, allowQuotes: boolean) {
414
+ if (RESERVED_VARIABLE_NAMES.includes(name)) {
415
+ if (allowQuotes && !RESERVED_QUOTE_VARIABLE_NAMES.includes(name)) {
416
+ name = `"${name}"`
417
+ } else {
418
+ name = `${name}_`
419
+ }
420
+ }
421
+ return name
422
+ }
423
+
424
+ /**
425
+ * E.g. GstVideo-1.0 has a class `VideoScaler` with a method called `2d`
426
+ * or NetworkManager-1.0 has methods starting with `80211`
427
+ */
428
+ public transformPropertyName(name: string, allowQuotes: boolean): string {
429
+ name = this.transform('propertyName', name)
430
+ const originalName = `${name}`
431
+
432
+ name = this.transformReservedVariableNames(name, allowQuotes)
433
+ name = this.transformNumericName(name, allowQuotes)
434
+
435
+ if (originalName !== name) {
436
+ this.log.warn(WARN_RENAMED_PROPERTY(originalName, name))
437
+ }
438
+ return name
439
+ }
440
+
441
+ public transformConstantName(name: string, allowQuotes: boolean): string {
442
+ name = this.transform('constantName', name)
443
+ const originalName = `${name}`
444
+
445
+ name = this.transformReservedVariableNames(name, allowQuotes)
446
+ name = this.transformNumericName(name, allowQuotes)
447
+
448
+ if (originalName !== name) {
449
+ this.log.warn(WARN_RENAMED_CONSTANT(originalName, name))
450
+ }
451
+ return name
452
+ }
453
+
454
+ public transformFieldName(name: string, allowQuotes: boolean): string {
455
+ name = this.transform('fieldName', name)
456
+ const originalName = `${name}`
457
+
458
+ name = this.transformReservedVariableNames(name, allowQuotes)
459
+ name = this.transformNumericName(name, allowQuotes)
460
+ if (originalName !== name) {
461
+ this.log.warn(WARN_RENAMED_FIELD(originalName, name))
462
+ }
463
+ return name
464
+ }
465
+
466
+ public transformParameterName(param: GirCallableParamElement, allowQuotes: boolean): string {
467
+ let name = param.$.name || '-'
468
+ // Such a variable name exists in `GConf-2.0.d.ts` class `Engine` method `change_set_from_current`
469
+ if (name === '...') {
470
+ return '...args'
471
+ }
472
+ name = this.transform('parameterName', name)
473
+ const originalName = `${name}`
474
+
475
+ name = this.transformReservedVariableNames(name, allowQuotes)
476
+ name = this.transformNumericName(name, allowQuotes)
477
+ if (originalName !== name) {
478
+ this.log.warn(WARN_RENAMED_PARAMETER(originalName, name))
479
+ }
480
+ return name
481
+ }
482
+
483
+ /**
484
+ * Fixes type names, e.g. Return types or enum definitions can not start with numbers
485
+ * @param typeName
486
+ */
487
+ public transformTypeName(name: string): string {
488
+ name = this.transformNumericName(name)
489
+ return name
490
+ }
491
+
492
+ public transform(construct: ConstructName, transformMe: string): string {
493
+ const transformations = this.transformations[construct][this.config.environment].transformation
494
+ if (transformations === 'original') {
495
+ return transformMe
496
+ }
497
+ if (transformations === 'lowerCamelCase') {
498
+ return lowerCamelCase(transformMe)
499
+ }
500
+ if (transformations === 'upperCamelCase') {
501
+ return upperCamelCase(transformMe)
502
+ }
503
+ if (transformations === 'upperCase') {
504
+ return transformMe.toUpperCase()
505
+ }
506
+ if (transformations === 'lowerCase') {
507
+ return transformMe.toLowerCase()
508
+ }
509
+ if (transformations === 'underscores') {
510
+ return transformMe.replace(/-|_/g, '_')
511
+ }
512
+ return transformMe
513
+ }
514
+
515
+ /**
516
+ * In JavaScript there can be no variables, methods, class names or enum names that start with a number.
517
+ * This method converts such names.
518
+ * TODO: Prepends an `@` to numeric starting names, how does gjs and node-gtk do that?
519
+ * @param name
520
+ * @param allowQuotes
521
+ */
522
+ private transformNumericName(name: string, allowQuotes = false): string {
523
+ if (isFirstCharNumeric(name)) {
524
+ if (allowQuotes) name = `"${name}"`
525
+ else name = `TODO_${name}`
526
+ }
527
+ return name
528
+ }
529
+
530
+ /**
531
+ * Replaces "@any_property" with "`any_property`"
532
+ * @param description E.g. "Creates a binding between @source_property on @source and @target_property on @target."
533
+ * @returns E.g. "Creates a binding between `source_property` on `source` and `target_property` on `target`."
534
+ */
535
+ private transformGirDocHighlights(description: string) {
536
+ const highlights = description.match(/@[A-Za-z_-]*[^\s.]/gm)
537
+ if (highlights) {
538
+ for (const highlight of highlights) {
539
+ description = description.replace(highlight, `\`${highlight.slice(1)}\``)
540
+ }
541
+ }
542
+ return description
543
+ }
544
+
545
+ /**
546
+ * Replaces:
547
+ * |[<!-- language="C" -->
548
+ * g_object_notify_by_pspec (self, properties[PROP_FOO]);
549
+ * ]|
550
+ *
551
+ * with
552
+ * ```c
553
+ * g_object_notify_by_pspec (self, properties[PROP_FOO]);
554
+ * ```
555
+ *
556
+ * @param description
557
+ */
558
+ private transformGirDocCodeBlocks(description: string) {
559
+ description = description.replaceAll(/\|\[<!-- language="C" -->/gm, '\n```c').replaceAll(/\]\|/gm, '```\n')
560
+ return description
561
+ }
562
+
563
+ /**
564
+ * Transforms the documentation text to markdown
565
+ * TODO: Transform references to link tags: https://tsdoc.org/pages/tags/link/
566
+ * @param text
567
+ * @returns
568
+ */
569
+ public transformGirDocText(text: string) {
570
+ text = this.transformGirDocHighlights(text)
571
+ text = this.transformGirDocCodeBlocks(text)
572
+ return text
573
+ }
574
+
575
+ /**
576
+ * Transforms the tsDoc tag <text> like `@param name <text>`
577
+ * @param text
578
+ * @returns
579
+ */
580
+ public transformGirDocTagText(text: string) {
581
+ // return this.transformGirDocHighlights(text.replace(NEW_LINE_REG_EXP, ' '))
582
+ return text.replace(NEW_LINE_REG_EXP, ' ')
583
+ }
584
+ }