@gtkx/cli 0.21.0 → 1.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (358) hide show
  1. package/README.md +173 -0
  2. package/bin/gtkx-dev-runner.js +9 -0
  3. package/dist/builder.d.ts +5 -52
  4. package/dist/builder.d.ts.map +1 -1
  5. package/dist/builder.js +24 -57
  6. package/dist/builder.js.map +1 -1
  7. package/dist/cli.d.ts +1 -2
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +24 -122
  10. package/dist/cli.js.map +1 -1
  11. package/dist/codegen/freshness.d.ts +11 -0
  12. package/dist/codegen/freshness.d.ts.map +1 -0
  13. package/dist/codegen/freshness.js +45 -0
  14. package/dist/codegen/freshness.js.map +1 -0
  15. package/dist/codegen/report.d.ts +4 -0
  16. package/dist/codegen/report.d.ts.map +1 -0
  17. package/dist/codegen/report.js +18 -0
  18. package/dist/codegen/report.js.map +1 -0
  19. package/dist/codegen/run-codegen.d.ts +35 -0
  20. package/dist/codegen/run-codegen.d.ts.map +1 -0
  21. package/dist/codegen/run-codegen.js +162 -0
  22. package/dist/codegen/run-codegen.js.map +1 -0
  23. package/dist/codegen/store-resolver.d.ts +24 -0
  24. package/dist/codegen/store-resolver.d.ts.map +1 -0
  25. package/dist/codegen/store-resolver.js +72 -0
  26. package/dist/codegen/store-resolver.js.map +1 -0
  27. package/dist/commands/build.d.ts +10 -0
  28. package/dist/commands/build.d.ts.map +1 -0
  29. package/dist/commands/build.js +34 -0
  30. package/dist/commands/build.js.map +1 -0
  31. package/dist/commands/codegen.d.ts +10 -0
  32. package/dist/commands/codegen.d.ts.map +1 -0
  33. package/dist/commands/codegen.js +42 -0
  34. package/dist/commands/codegen.js.map +1 -0
  35. package/dist/commands/dev.d.ts +6 -0
  36. package/dist/commands/dev.d.ts.map +1 -0
  37. package/dist/commands/dev.js +22 -0
  38. package/dist/commands/dev.js.map +1 -0
  39. package/dist/commands/docs.d.ts +20 -0
  40. package/dist/commands/docs.d.ts.map +1 -0
  41. package/dist/commands/docs.js +74 -0
  42. package/dist/commands/docs.js.map +1 -0
  43. package/dist/dev/icon-dir.d.ts +3 -0
  44. package/dist/dev/icon-dir.d.ts.map +1 -0
  45. package/dist/dev/icon-dir.js +16 -0
  46. package/dist/dev/icon-dir.js.map +1 -0
  47. package/dist/dev/refresh-tracker.d.ts +7 -0
  48. package/dist/dev/refresh-tracker.d.ts.map +1 -0
  49. package/dist/dev/refresh-tracker.js +19 -0
  50. package/dist/dev/refresh-tracker.js.map +1 -0
  51. package/dist/dev/runner-deps.d.ts +4 -0
  52. package/dist/dev/runner-deps.d.ts.map +1 -0
  53. package/dist/dev/runner-deps.js +55 -0
  54. package/dist/dev/runner-deps.js.map +1 -0
  55. package/dist/dev/runner-main.d.ts +3 -0
  56. package/dist/dev/runner-main.d.ts.map +1 -0
  57. package/dist/dev/runner-main.js +29 -0
  58. package/dist/dev/runner-main.js.map +1 -0
  59. package/dist/dev/runner.d.ts +24 -0
  60. package/dist/dev/runner.d.ts.map +1 -0
  61. package/dist/dev/runner.js +119 -0
  62. package/dist/dev/runner.js.map +1 -0
  63. package/dist/dev/schema-dir.d.ts +3 -0
  64. package/dist/dev/schema-dir.d.ts.map +1 -0
  65. package/dist/dev/schema-dir.js +12 -0
  66. package/dist/dev/schema-dir.js.map +1 -0
  67. package/dist/dev/supervisor.d.ts +18 -0
  68. package/dist/dev/supervisor.d.ts.map +1 -0
  69. package/dist/dev/supervisor.js +182 -0
  70. package/dist/dev/supervisor.js.map +1 -0
  71. package/dist/dev/vite-dev-server.d.ts +21 -0
  72. package/dist/dev/vite-dev-server.d.ts.map +1 -0
  73. package/dist/dev/vite-dev-server.js +13 -0
  74. package/dist/dev/vite-dev-server.js.map +1 -0
  75. package/dist/internal/banner.d.ts +4 -0
  76. package/dist/internal/banner.d.ts.map +1 -0
  77. package/dist/internal/banner.js +9 -0
  78. package/dist/internal/banner.js.map +1 -0
  79. package/dist/internal/data-dir.d.ts +4 -0
  80. package/dist/internal/data-dir.d.ts.map +1 -0
  81. package/dist/internal/data-dir.js +52 -0
  82. package/dist/internal/data-dir.js.map +1 -0
  83. package/dist/internal/entry-arg.d.ts +20 -0
  84. package/dist/internal/entry-arg.d.ts.map +1 -0
  85. package/dist/internal/entry-arg.js +36 -0
  86. package/dist/internal/entry-arg.js.map +1 -0
  87. package/dist/internal/errors.d.ts +5 -0
  88. package/dist/internal/errors.d.ts.map +1 -0
  89. package/dist/internal/errors.js +29 -0
  90. package/dist/internal/errors.js.map +1 -0
  91. package/dist/internal/list-files.d.ts +7 -0
  92. package/dist/internal/list-files.d.ts.map +1 -0
  93. package/dist/internal/list-files.js +15 -0
  94. package/dist/internal/list-files.js.map +1 -0
  95. package/dist/internal/resolve-cli-tool.d.ts +3 -0
  96. package/dist/internal/resolve-cli-tool.d.ts.map +1 -0
  97. package/dist/internal/resolve-cli-tool.js +27 -0
  98. package/dist/internal/resolve-cli-tool.js.map +1 -0
  99. package/dist/internal/staging-dir.d.ts +4 -0
  100. package/dist/internal/staging-dir.d.ts.map +1 -0
  101. package/dist/internal/staging-dir.js +17 -0
  102. package/dist/internal/staging-dir.js.map +1 -0
  103. package/dist/internal/xdg-data-dirs.d.ts +3 -0
  104. package/dist/internal/xdg-data-dirs.d.ts.map +1 -0
  105. package/dist/internal/xdg-data-dirs.js +10 -0
  106. package/dist/internal/xdg-data-dirs.js.map +1 -0
  107. package/dist/mcp/client.d.ts +28 -0
  108. package/dist/mcp/client.d.ts.map +1 -0
  109. package/dist/mcp/client.js +182 -0
  110. package/dist/mcp/client.js.map +1 -0
  111. package/dist/mcp/handlers.d.ts +9 -0
  112. package/dist/mcp/handlers.d.ts.map +1 -0
  113. package/dist/mcp/handlers.js +147 -0
  114. package/dist/mcp/handlers.js.map +1 -0
  115. package/dist/mcp/index.d.ts +4 -0
  116. package/dist/mcp/index.d.ts.map +1 -0
  117. package/dist/mcp/index.js +34 -0
  118. package/dist/mcp/index.js.map +1 -0
  119. package/dist/mcp/serialize-widget.d.ts +10 -0
  120. package/dist/mcp/serialize-widget.d.ts.map +1 -0
  121. package/dist/mcp/serialize-widget.js +23 -0
  122. package/dist/mcp/serialize-widget.js.map +1 -0
  123. package/dist/mcp/testing-loader.d.ts +5 -0
  124. package/dist/mcp/testing-loader.d.ts.map +1 -0
  125. package/dist/mcp/testing-loader.js +47 -0
  126. package/dist/mcp/testing-loader.js.map +1 -0
  127. package/dist/mcp/widget-registry.d.ts +14 -0
  128. package/dist/mcp/widget-registry.d.ts.map +1 -0
  129. package/dist/mcp/widget-registry.js +39 -0
  130. package/dist/mcp/widget-registry.js.map +1 -0
  131. package/dist/refresh-globals.d.ts +2 -0
  132. package/dist/refresh-globals.d.ts.map +1 -0
  133. package/dist/refresh-globals.js +8 -0
  134. package/dist/refresh-globals.js.map +1 -0
  135. package/dist/refresh-runtime.d.ts +10 -26
  136. package/dist/refresh-runtime.d.ts.map +1 -1
  137. package/dist/refresh-runtime.js +26 -48
  138. package/dist/refresh-runtime.js.map +1 -1
  139. package/dist/settings/compile.d.ts +3 -0
  140. package/dist/settings/compile.d.ts.map +1 -0
  141. package/dist/settings/compile.js +21 -0
  142. package/dist/settings/compile.js.map +1 -0
  143. package/dist/settings/parser.d.ts +24 -0
  144. package/dist/settings/parser.d.ts.map +1 -0
  145. package/dist/settings/parser.js +121 -0
  146. package/dist/settings/parser.js.map +1 -0
  147. package/dist/settings/render.d.ts +5 -0
  148. package/dist/settings/render.d.ts.map +1 -0
  149. package/dist/settings/render.js +122 -0
  150. package/dist/settings/render.js.map +1 -0
  151. package/dist/settings/schema.d.ts +13 -0
  152. package/dist/settings/schema.d.ts.map +1 -0
  153. package/dist/settings/schema.js +121 -0
  154. package/dist/settings/schema.js.map +1 -0
  155. package/dist/vite-plugins/asset-extensions.d.ts +5 -0
  156. package/dist/vite-plugins/asset-extensions.d.ts.map +1 -0
  157. package/dist/vite-plugins/asset-extensions.js +28 -0
  158. package/dist/vite-plugins/asset-extensions.js.map +1 -0
  159. package/dist/vite-plugins/built-url.d.ts +4 -0
  160. package/dist/vite-plugins/built-url.d.ts.map +1 -0
  161. package/dist/vite-plugins/built-url.js +36 -0
  162. package/dist/vite-plugins/built-url.js.map +1 -0
  163. package/dist/vite-plugins/css.d.ts +4 -0
  164. package/dist/vite-plugins/css.d.ts.map +1 -0
  165. package/dist/vite-plugins/css.js +38 -0
  166. package/dist/vite-plugins/css.js.map +1 -0
  167. package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts +8 -0
  168. package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts.map +1 -0
  169. package/dist/vite-plugins/fast-refresh/refresh-filter.js +19 -0
  170. package/dist/vite-plugins/fast-refresh/refresh-filter.js.map +1 -0
  171. package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts +6 -0
  172. package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts.map +1 -0
  173. package/dist/vite-plugins/fast-refresh/swc-refresh.js +70 -0
  174. package/dist/vite-plugins/fast-refresh/swc-refresh.js.map +1 -0
  175. package/dist/vite-plugins/icons.d.ts +4 -0
  176. package/dist/vite-plugins/icons.d.ts.map +1 -0
  177. package/dist/vite-plugins/icons.js +51 -0
  178. package/dist/vite-plugins/icons.js.map +1 -0
  179. package/dist/vite-plugins/index.d.ts +4 -0
  180. package/dist/vite-plugins/index.d.ts.map +1 -0
  181. package/dist/vite-plugins/index.js +22 -0
  182. package/dist/vite-plugins/index.js.map +1 -0
  183. package/dist/vite-plugins/native.d.ts +4 -0
  184. package/dist/vite-plugins/native.d.ts.map +1 -0
  185. package/dist/vite-plugins/native.js +62 -0
  186. package/dist/vite-plugins/native.js.map +1 -0
  187. package/dist/vite-plugins/react-compiler.d.ts +5 -0
  188. package/dist/vite-plugins/react-compiler.d.ts.map +1 -0
  189. package/dist/vite-plugins/react-compiler.js +62 -0
  190. package/dist/vite-plugins/react-compiler.js.map +1 -0
  191. package/dist/vite-plugins/react-dom-prebundle.d.ts +4 -0
  192. package/dist/vite-plugins/react-dom-prebundle.d.ts.map +1 -0
  193. package/dist/vite-plugins/react-dom-prebundle.js +12 -0
  194. package/dist/vite-plugins/react-dom-prebundle.js.map +1 -0
  195. package/dist/vite-plugins/resource-init-module.d.ts +6 -0
  196. package/dist/vite-plugins/resource-init-module.d.ts.map +1 -0
  197. package/dist/vite-plugins/resource-init-module.js +51 -0
  198. package/dist/vite-plugins/resource-init-module.js.map +1 -0
  199. package/dist/vite-plugins/resource-shared.d.ts +8 -0
  200. package/dist/vite-plugins/resource-shared.d.ts.map +1 -0
  201. package/dist/vite-plugins/resource-shared.js +28 -0
  202. package/dist/vite-plugins/resource-shared.js.map +1 -0
  203. package/dist/vite-plugins/resources.d.ts +5 -0
  204. package/dist/vite-plugins/resources.d.ts.map +1 -0
  205. package/dist/vite-plugins/resources.js +260 -0
  206. package/dist/vite-plugins/resources.js.map +1 -0
  207. package/dist/vite-plugins/settings-worker-env.d.ts +4 -0
  208. package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -0
  209. package/dist/vite-plugins/settings-worker-env.js +23 -0
  210. package/dist/vite-plugins/settings-worker-env.js.map +1 -0
  211. package/dist/vite-plugins/settings.d.ts +4 -0
  212. package/dist/vite-plugins/settings.d.ts.map +1 -0
  213. package/dist/vite-plugins/settings.js +214 -0
  214. package/dist/vite-plugins/settings.js.map +1 -0
  215. package/dist/vite-plugins/strip-query.d.ts +3 -0
  216. package/dist/vite-plugins/strip-query.d.ts.map +1 -0
  217. package/dist/vite-plugins/strip-query.js +6 -0
  218. package/dist/vite-plugins/strip-query.js.map +1 -0
  219. package/dist/vite-plugins/undeclared-library.d.ts +4 -0
  220. package/dist/vite-plugins/undeclared-library.d.ts.map +1 -0
  221. package/dist/vite-plugins/undeclared-library.js +50 -0
  222. package/dist/vite-plugins/undeclared-library.js.map +1 -0
  223. package/dist/vite-plugins/virtual-module.d.ts +22 -0
  224. package/dist/vite-plugins/virtual-module.d.ts.map +1 -0
  225. package/dist/vite-plugins/virtual-module.js +20 -0
  226. package/dist/vite-plugins/virtual-module.js.map +1 -0
  227. package/dist/vitest-plugin.d.ts +10 -0
  228. package/dist/vitest-plugin.d.ts.map +1 -0
  229. package/dist/vitest-plugin.js +12 -0
  230. package/dist/vitest-plugin.js.map +1 -0
  231. package/env.d.ts +91 -8
  232. package/package.json +30 -38
  233. package/src/babel-modules.d.ts +11 -0
  234. package/src/builder.ts +31 -86
  235. package/src/cli.ts +42 -0
  236. package/src/codegen/freshness.ts +65 -0
  237. package/src/codegen/report.ts +28 -0
  238. package/src/codegen/run-codegen.ts +260 -0
  239. package/src/codegen/store-resolver.ts +116 -0
  240. package/src/commands/build.ts +38 -0
  241. package/src/commands/codegen.ts +49 -0
  242. package/src/commands/dev.ts +24 -0
  243. package/src/commands/docs.ts +95 -0
  244. package/src/dev/icon-dir.ts +21 -0
  245. package/src/dev/refresh-tracker.ts +25 -0
  246. package/src/dev/runner-deps.ts +65 -0
  247. package/src/dev/runner-main.ts +34 -0
  248. package/src/dev/runner.ts +185 -0
  249. package/src/dev/schema-dir.ts +16 -0
  250. package/src/dev/supervisor.ts +276 -0
  251. package/src/dev/vite-dev-server.ts +36 -0
  252. package/src/internal/banner.ts +13 -0
  253. package/src/internal/data-dir.ts +70 -0
  254. package/src/internal/entry-arg.ts +46 -0
  255. package/src/internal/errors.ts +36 -0
  256. package/src/internal/list-files.ts +23 -0
  257. package/src/internal/resolve-cli-tool.ts +37 -0
  258. package/src/internal/staging-dir.ts +19 -0
  259. package/src/internal/xdg-data-dirs.ts +13 -0
  260. package/src/mcp/client.ts +235 -0
  261. package/src/mcp/handlers.ts +213 -0
  262. package/src/mcp/index.ts +46 -0
  263. package/src/mcp/serialize-widget.ts +41 -0
  264. package/src/mcp/testing-loader.ts +73 -0
  265. package/src/mcp/widget-registry.ts +49 -0
  266. package/src/refresh-globals.ts +10 -0
  267. package/src/refresh-runtime.ts +30 -55
  268. package/src/settings/compile.ts +22 -0
  269. package/src/settings/parser.ts +193 -0
  270. package/src/settings/render.ts +167 -0
  271. package/src/settings/schema.ts +169 -0
  272. package/src/vite-plugins/asset-extensions.ts +29 -0
  273. package/src/vite-plugins/built-url.ts +50 -0
  274. package/src/vite-plugins/css.ts +53 -0
  275. package/src/vite-plugins/fast-refresh/refresh-filter.ts +26 -0
  276. package/src/vite-plugins/fast-refresh/swc-refresh.ts +92 -0
  277. package/src/vite-plugins/icons.ts +74 -0
  278. package/src/vite-plugins/index.ts +25 -0
  279. package/src/vite-plugins/native.ts +83 -0
  280. package/src/vite-plugins/react-compiler.ts +84 -0
  281. package/src/vite-plugins/react-dom-prebundle.ts +17 -0
  282. package/src/vite-plugins/resource-init-module.ts +57 -0
  283. package/src/vite-plugins/resource-shared.ts +40 -0
  284. package/src/vite-plugins/resources.ts +366 -0
  285. package/src/vite-plugins/settings-worker-env.ts +30 -0
  286. package/src/vite-plugins/settings.ts +286 -0
  287. package/src/vite-plugins/strip-query.ts +7 -0
  288. package/src/vite-plugins/undeclared-library.ts +78 -0
  289. package/src/vite-plugins/virtual-module.ts +44 -0
  290. package/src/vitest-plugin.ts +13 -0
  291. package/dist/create.d.ts +0 -55
  292. package/dist/create.d.ts.map +0 -1
  293. package/dist/create.js +0 -236
  294. package/dist/create.js.map +0 -1
  295. package/dist/dev-server.d.ts +0 -37
  296. package/dist/dev-server.d.ts.map +0 -1
  297. package/dist/dev-server.js +0 -130
  298. package/dist/dev-server.js.map +0 -1
  299. package/dist/index.d.ts +0 -4
  300. package/dist/index.d.ts.map +0 -1
  301. package/dist/index.js +0 -4
  302. package/dist/index.js.map +0 -1
  303. package/dist/mcp-client.d.ts +0 -31
  304. package/dist/mcp-client.d.ts.map +0 -1
  305. package/dist/mcp-client.js +0 -430
  306. package/dist/mcp-client.js.map +0 -1
  307. package/dist/templates.d.ts +0 -9
  308. package/dist/templates.d.ts.map +0 -1
  309. package/dist/templates.js +0 -16
  310. package/dist/templates.js.map +0 -1
  311. package/dist/vite-plugin-gtkx-assets.d.ts +0 -20
  312. package/dist/vite-plugin-gtkx-assets.d.ts.map +0 -1
  313. package/dist/vite-plugin-gtkx-assets.js +0 -57
  314. package/dist/vite-plugin-gtkx-assets.js.map +0 -1
  315. package/dist/vite-plugin-gtkx-built-url.d.ts +0 -18
  316. package/dist/vite-plugin-gtkx-built-url.d.ts.map +0 -1
  317. package/dist/vite-plugin-gtkx-built-url.js +0 -43
  318. package/dist/vite-plugin-gtkx-built-url.js.map +0 -1
  319. package/dist/vite-plugin-gtkx-gsettings.d.ts +0 -28
  320. package/dist/vite-plugin-gtkx-gsettings.d.ts.map +0 -1
  321. package/dist/vite-plugin-gtkx-gsettings.js +0 -147
  322. package/dist/vite-plugin-gtkx-gsettings.js.map +0 -1
  323. package/dist/vite-plugin-gtkx-native.d.ts +0 -14
  324. package/dist/vite-plugin-gtkx-native.d.ts.map +0 -1
  325. package/dist/vite-plugin-gtkx-native.js +0 -53
  326. package/dist/vite-plugin-gtkx-native.js.map +0 -1
  327. package/dist/vite-plugin-gtkx-refresh.d.ts +0 -8
  328. package/dist/vite-plugin-gtkx-refresh.d.ts.map +0 -1
  329. package/dist/vite-plugin-gtkx-refresh.js +0 -37
  330. package/dist/vite-plugin-gtkx-refresh.js.map +0 -1
  331. package/dist/vite-plugin-swc-ssr-refresh.d.ts +0 -8
  332. package/dist/vite-plugin-swc-ssr-refresh.d.ts.map +0 -1
  333. package/dist/vite-plugin-swc-ssr-refresh.js +0 -46
  334. package/dist/vite-plugin-swc-ssr-refresh.js.map +0 -1
  335. package/src/cli.tsx +0 -154
  336. package/src/create.ts +0 -326
  337. package/src/dev-server.tsx +0 -162
  338. package/src/index.ts +0 -3
  339. package/src/mcp-client.ts +0 -518
  340. package/src/templates.ts +0 -26
  341. package/src/vite-plugin-gtkx-assets.ts +0 -69
  342. package/src/vite-plugin-gtkx-built-url.ts +0 -48
  343. package/src/vite-plugin-gtkx-gsettings.ts +0 -168
  344. package/src/vite-plugin-gtkx-native.ts +0 -64
  345. package/src/vite-plugin-gtkx-refresh.ts +0 -54
  346. package/src/vite-plugin-swc-ssr-refresh.ts +0 -61
  347. package/templates/claude/EXAMPLES.md.ejs +0 -744
  348. package/templates/claude/SKILL.md.ejs +0 -93
  349. package/templates/claude/WIDGETS.md.ejs +0 -820
  350. package/templates/config/vitest.config.ts.ejs +0 -11
  351. package/templates/gitignore.ejs +0 -4
  352. package/templates/package.json.ejs +0 -16
  353. package/templates/src/app.tsx.ejs +0 -32
  354. package/templates/src/dev.tsx.ejs +0 -5
  355. package/templates/src/gtkx-env.d.ts.ejs +0 -1
  356. package/templates/src/index.tsx.ejs +0 -5
  357. package/templates/tests/app.test.tsx.ejs +0 -16
  358. package/templates/tsconfig.json.ejs +0 -14
package/README.md ADDED
@@ -0,0 +1,173 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/gtkx-org/gtkx/main/logo.svg" alt="GTKX" width="100" />
3
+ </p>
4
+
5
+ <h1 align="center">GTKX</h1>
6
+
7
+ <p align="center">
8
+ The React framework for Linux.<br />
9
+ Build GTK4 and Adwaita apps in TypeScript, with React components and hooks driving GNOME's own widgets. What you ship is a GNOME app.
10
+ </p>
11
+
12
+ <p align="center">
13
+ <a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/v/create-gtkx?color=cb3837&logo=npm&label=create-gtkx" alt="npm version" /></a>
14
+ <a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/dm/create-gtkx?color=cb3837&logo=npm&label=downloads" alt="npm downloads" /></a>
15
+ <img src="https://img.shields.io/badge/node-%E2%89%A524-339933?logo=node.js&logoColor=white" alt="Node >= 24" />
16
+ <a href="https://github.com/gtkx-org/gtkx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MPL--2.0-blue.svg" alt="License: MPL-2.0" /></a>
17
+ <a href="https://github.com/gtkx-org/gtkx/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/gtkx-org/gtkx/ci.yml?branch=main&logo=github&label=CI" alt="CI status" /></a>
18
+ <img src="https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white" alt="TypeScript" />
19
+ </p>
20
+
21
+ <p align="center">
22
+ <a href="https://gtkx.dev">Homepage</a> &middot;
23
+ <a href="https://gtkx.dev/guide/why-gtkx">Documentation</a> &middot;
24
+ <a href="https://github.com/gtkx-org/gtkx/tree/main/examples">Examples</a> &middot;
25
+ <a href="https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md">Contributing</a>
26
+ </p>
27
+
28
+ ---
29
+
30
+ GTKX generates fully typed bindings for the entire GTK4 and Adwaita surface directly from GObject-Introspection. On top of those bindings you get the React programming model: components and hooks driving GObject instances, with Fast Refresh while you develop.
31
+
32
+ <p align="center">
33
+ <img src="https://raw.githubusercontent.com/gtkx-org/gtkx/main/examples/tutorial/assets/screenshot.png" alt="The Tasks app: an Adwaita window with a sidebar of smart views and colored lists on the left, and a boxed task list on the right." />
34
+ </p>
35
+
36
+ <p align="center">
37
+ <em>The Tasks app you build in the <a href="https://gtkx.dev/tutorial/">tutorial</a>.</em>
38
+ </p>
39
+
40
+ ## Demo
41
+
42
+ The intrinsic elements in this snippet render GTK4 widgets, and ordinary React hooks and events drive them:
43
+
44
+ ```tsx
45
+ import * as Gtk from "@gtkx/gi/gtk";
46
+ import { GtkApplication, GtkApplicationWindow, GtkBox, GtkButton, GtkLabel } from "@gtkx/jsx/gtk";
47
+ import { createRoot, quit } from "@gtkx/react";
48
+ import { useState } from "react";
49
+
50
+ const Counter = () => {
51
+ const [count, setCount] = useState(0);
52
+
53
+ return (
54
+ <GtkApplicationWindow
55
+ title="Hello GTKX"
56
+ defaultWidth={400}
57
+ defaultHeight={300}
58
+ onCloseRequest={quit}
59
+ >
60
+ <GtkBox
61
+ orientation={Gtk.Orientation.VERTICAL}
62
+ spacing={20}
63
+ marginTop={40}
64
+ marginBottom={40}
65
+ marginStart={40}
66
+ marginEnd={40}
67
+ valign={Gtk.Align.CENTER}
68
+ halign={Gtk.Align.CENTER}
69
+ >
70
+ <GtkLabel cssClasses={["title-1"]}>Welcome to GTKX!</GtkLabel>
71
+ <GtkLabel cssClasses={["title-2"]}>{`Count: ${count}`}</GtkLabel>
72
+ <GtkButton
73
+ label="Increment"
74
+ onClicked={() => setCount((c) => c + 1)}
75
+ cssClasses={["suggested-action", "pill"]}
76
+ />
77
+ </GtkBox>
78
+ </GtkApplicationWindow>
79
+ );
80
+ };
81
+
82
+ const App = () => (
83
+ <GtkApplication>
84
+ <Counter />
85
+ </GtkApplication>
86
+ );
87
+
88
+ createRoot().render(<App />);
89
+ ```
90
+
91
+ This is the [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world) example, with `app.tsx` and `index.tsx` combined into a single snippet. `@gtkx/gi` and `@gtkx/jsx` are per-project bindings generated by the CLI, not packages you install from npm.
92
+
93
+ ## Why GTKX
94
+
95
+ ### A declarative layer for the GNOME stack
96
+
97
+ GTK4 is mature, and GtkBuilder XML can lay out a static interface, but nothing re-renders that interface when your application state changes, and nothing hot-reloads it as you work. GTKX adds that missing layer, and the tooling around it, on top of the stack you already know:
98
+
99
+ - a React reconciler that exposes every GObject as a JSX element,
100
+ - a CLI for scaffolding, development, and production builds,
101
+ - a dev server with Fast Refresh that patches your running UI in place,
102
+ - CSS-in-JS styling and high-level list, grid, and dialog components,
103
+ - a Testing Library-style API for querying and driving your widgets in tests,
104
+ - and a Model Context Protocol (MCP) server that exposes your live app to AI agents.
105
+
106
+ ### The full GNOME API surface
107
+
108
+ React Native and similar frameworks hide the native toolkit so one API can run everywhere. GTKX exposes it: GTK4, Adwaita, and any other GObject-Introspection library on your system. Linux-only by design.
109
+
110
+ ### Why Node.js, and why generated bindings
111
+
112
+ GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [why-gtkx guide](https://gtkx.dev/guide/why-gtkx) covers the comparison in full.
113
+
114
+ GTKX generates the TypeScript types and the native FFI calls from the same GObject-Introspection data, so the types cannot drift from the calls they back. Codegen covers the whole GTK4 and Adwaita surface.
115
+
116
+ At runtime, the native Rust core calls straight into the system GTK4, Adwaita, and GLib libraries through libffi, without loading libgirepository at all.
117
+
118
+ ## Quick start
119
+
120
+ GTKX is Linux-only and needs Node.js 24 or later. See [Requirements](#requirements).
121
+
122
+ Scaffold a new app with the `create-gtkx` initializer:
123
+
124
+ ```sh
125
+ npm create gtkx@rc
126
+ ```
127
+
128
+ The same command works with other package managers: `pnpm create gtkx@rc` or `yarn create gtkx@rc`.
129
+
130
+ Then run your new app:
131
+
132
+ ```sh
133
+ cd my-app
134
+ npm run dev
135
+ ```
136
+
137
+ To go further, follow the [tutorial](https://gtkx.dev/tutorial/).
138
+
139
+ ## Documentation
140
+
141
+ The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tutorial that builds a complete GNOME app, from scaffolding to packaging and shipping, plus guides and a full API reference.
142
+
143
+ **[Read the docs &rarr;](https://gtkx.dev/guide/why-gtkx)**
144
+
145
+ ## Requirements
146
+
147
+ GTKX is Linux-only. You need:
148
+
149
+ - Linux with the GTK4 (4.20 or later), Adwaita (1.8 or later), and GLib development libraries
150
+ - Node.js 24 or later
151
+
152
+ The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
153
+
154
+ ## Examples
155
+
156
+ Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
157
+
158
+ - [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world): the counter above.
159
+ - [`gtk-demo`](https://github.com/gtkx-org/gtkx/tree/main/examples/gtk-demo): a React port of the official GTK4 widget showcase, covering lists, dialogs, gestures, CSS, and OpenGL.
160
+ - [`browser`](https://github.com/gtkx-org/gtkx/tree/main/examples/browser): a WebKitWebView-based web browser.
161
+ - [`tutorial`](https://github.com/gtkx-org/gtkx/tree/main/examples/tutorial): the Tasks app the documentation builds.
162
+
163
+ ## Status
164
+
165
+ GTKX 1.0 is at the release candidate stage.
166
+
167
+ ## Contributing
168
+
169
+ Contributions are welcome. See [CONTRIBUTING.md](https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md), the [Code of Conduct](https://github.com/gtkx-org/gtkx/blob/main/CODE_OF_CONDUCT.md), and the [security policy](https://github.com/gtkx-org/gtkx/blob/main/SECURITY.md). Building the repo needs Node.js 24 or later, pnpm, and a Rust toolchain.
170
+
171
+ ## License
172
+
173
+ GTKX is licensed under [MPL-2.0](https://github.com/gtkx-org/gtkx/blob/main/LICENSE).
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import { main } from "../dist/dev/runner-main.js";
3
+
4
+ try {
5
+ await main();
6
+ } catch (error) {
7
+ console.error("[gtkx] Fatal:", error);
8
+ process.exit(1);
9
+ }
package/dist/builder.d.ts CHANGED
@@ -1,56 +1,9 @@
1
1
  import { type InlineConfig } from "vite";
2
- /**
3
- * Options for building a GTKX application for production.
4
- */
5
- export type BuildOptions = {
6
- /** Path to the entry file (e.g., "src/index.tsx") */
2
+ type BuildOptions = {
7
3
  entry: string;
8
- /**
9
- * Base path for resolving asset imports at runtime, relative to the
10
- * executable directory.
11
- *
12
- * When set, asset imports resolve to
13
- * `path.join(path.dirname(process.execPath), assetBase, filename)`.
14
- * This is useful for FHS-compliant packaging where assets live under
15
- * a `share/` directory rather than next to the binary.
16
- *
17
- * When omitted, assets resolve relative to the bundle via
18
- * `import.meta.url`, which works when assets are co-located with
19
- * the executable (e.g., in `bin/assets/`).
20
- *
21
- * @example
22
- * ```ts
23
- * await build({
24
- * entry: "./src/index.tsx",
25
- * assetBase: "../share/my-app",
26
- * });
27
- * ```
28
- */
29
- assetBase?: string;
30
- /** Additional Vite configuration */
31
- vite?: InlineConfig;
4
+ assetBase?: string | undefined;
5
+ vite?: InlineConfig | undefined;
32
6
  };
33
- /**
34
- * Builds a GTKX application for production using Vite's SSR build mode.
35
- *
36
- * Produces a single minified ESM bundle at `dist/bundle.js` with all
37
- * dependencies inlined. The native `.node` binary is copied into the
38
- * output directory as `gtkx.node`, making the bundle fully self-contained
39
- * with no `node_modules` dependency at runtime.
40
- *
41
- * @param options - Build configuration including entry point and Vite options
42
- *
43
- * @example
44
- * ```ts
45
- * import { build } from "@gtkx/cli";
46
- *
47
- * await build({
48
- * entry: "./src/index.tsx",
49
- * vite: { root: process.cwd() },
50
- * });
51
- * ```
52
- *
53
- * @see {@link BuildOptions} for configuration options
54
- */
55
- export declare const build: (options: BuildOptions) => Promise<void>;
7
+ declare const build: (options: BuildOptions) => Promise<void>;
8
+ export { build, type BuildOptions };
56
9
  //# sourceMappingURL=builder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,MAAM,CAAC;AAM7D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACvB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,IAAI,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,KAAK,GAAU,SAAS,YAAY,KAAG,OAAO,CAAC,IAAI,CAyC/D,CAAC"}
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAmC,MAAM,MAAM,CAAC;AAK1E,KAAK,YAAY,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,IAAI,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CACnC,CAAC;AAgBF,QAAA,MAAM,KAAK,GAAU,SAAS,YAAY,KAAG,OAAO,CAAC,IAAI,CAmBxD,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,CAAC"}
package/dist/builder.js CHANGED
@@ -1,69 +1,36 @@
1
- import { build as viteBuild } from "vite";
2
- import { gtkxAssets } from "./vite-plugin-gtkx-assets.js";
3
- import { gtkxBuiltUrl } from "./vite-plugin-gtkx-built-url.js";
4
- import { gtkxGSettings } from "./vite-plugin-gtkx-gsettings.js";
5
- import { gtkxNative } from "./vite-plugin-gtkx-native.js";
6
- /**
7
- * Builds a GTKX application for production using Vite's SSR build mode.
8
- *
9
- * Produces a single minified ESM bundle at `dist/bundle.js` with all
10
- * dependencies inlined. The native `.node` binary is copied into the
11
- * output directory as `gtkx.node`, making the bundle fully self-contained
12
- * with no `node_modules` dependency at runtime.
13
- *
14
- * @param options - Build configuration including entry point and Vite options
15
- *
16
- * @example
17
- * ```ts
18
- * import { build } from "@gtkx/cli";
19
- *
20
- * await build({
21
- * entry: "./src/index.tsx",
22
- * vite: { root: process.cwd() },
23
- * });
24
- * ```
25
- *
26
- * @see {@link BuildOptions} for configuration options
27
- */
28
- export const build = async (options) => {
1
+ import { mergeConfig, build as viteBuild } from "vite";
2
+ import { gtkxBuiltUrl } from "./vite-plugins/built-url.js";
3
+ import { gtkxVitePlugins } from "./vite-plugins/index.js";
4
+ import { gtkxNative } from "./vite-plugins/native.js";
5
+ const BUILD_MODE = "production";
6
+ const buildDefaults = {
7
+ build: {
8
+ ssrEmitAssets: true,
9
+ outDir: "dist",
10
+ minify: true,
11
+ cssMinify: false,
12
+ },
13
+ define: {
14
+ "process.env.NODE_ENV": JSON.stringify(BUILD_MODE),
15
+ },
16
+ };
17
+ const build = async (options) => {
29
18
  const { entry, assetBase, vite: viteConfig } = options;
30
19
  const root = viteConfig?.root ?? process.cwd();
31
- await viteBuild({
32
- ...viteConfig,
33
- plugins: [
34
- ...(viteConfig?.plugins ?? []),
35
- gtkxGSettings(),
36
- gtkxAssets(),
37
- gtkxBuiltUrl(assetBase),
38
- gtkxNative(root),
39
- ],
20
+ const forced = {
21
+ plugins: [...gtkxVitePlugins(BUILD_MODE), gtkxBuiltUrl(assetBase), gtkxNative(root)],
40
22
  build: {
41
- ...viteConfig?.build,
42
23
  ssr: entry,
43
- ssrEmitAssets: true,
44
24
  assetsInlineLimit: 0,
45
- outDir: viteConfig?.build?.outDir ?? "dist",
46
- minify: true,
47
- cssMinify: false,
48
- rollupOptions: {
49
- ...viteConfig?.build?.rollupOptions,
25
+ rolldownOptions: {
50
26
  output: {
51
- ...(viteConfig?.build?.rollupOptions?.output ?? {}),
52
27
  entryFileNames: "bundle.js",
53
28
  },
54
29
  },
55
30
  },
56
- define: {
57
- ...viteConfig?.define,
58
- "process.env.NODE_ENV": JSON.stringify("production"),
59
- },
60
- ssr: {
61
- ...viteConfig?.ssr,
62
- noExternal: true,
63
- },
64
- experimental: {
65
- ...viteConfig?.experimental,
66
- },
67
- });
31
+ };
32
+ const merged = mergeConfig(mergeConfig(buildDefaults, viteConfig ?? {}), forced);
33
+ await viteBuild({ ...merged, ssr: { ...merged.ssr, noExternal: true } });
68
34
  };
35
+ export { build };
69
36
  //# sourceMappingURL=builder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"builder.js","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAkC1D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EAAE,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AC;AAEF,OAAO,EAAE,KAAK,EAAqB,CAAC","sourcesContent":["import { type InlineConfig, mergeConfig, build as viteBuild } from \"vite\";\nimport { gtkxBuiltUrl } from \"./vite-plugins/built-url.js\";\nimport { gtkxVitePlugins } from \"./vite-plugins/index.js\";\nimport { gtkxNative } from \"./vite-plugins/native.js\";\n\ntype BuildOptions = {\n entry: string;\n assetBase?: string | undefined;\n vite?: InlineConfig | undefined;\n};\n\nconst BUILD_MODE = \"production\";\n\nconst buildDefaults: InlineConfig = {\n build: {\n ssrEmitAssets: true,\n outDir: \"dist\",\n minify: true,\n cssMinify: false,\n },\n define: {\n \"process.env.NODE_ENV\": JSON.stringify(BUILD_MODE),\n },\n};\n\nconst build = async (options: BuildOptions): Promise<void> => {\n const { entry, assetBase, vite: viteConfig } = options;\n const root = viteConfig?.root ?? process.cwd();\n\n const forced: InlineConfig = {\n plugins: [...gtkxVitePlugins(BUILD_MODE), gtkxBuiltUrl(assetBase), gtkxNative(root)],\n build: {\n ssr: entry,\n assetsInlineLimit: 0,\n rolldownOptions: {\n output: {\n entryFileNames: \"bundle.js\",\n },\n },\n },\n };\n\n const merged: InlineConfig = mergeConfig(mergeConfig(buildDefaults, viteConfig ?? {}), forced);\n await viteBuild({ ...merged, ssr: { ...merged.ssr, noExternal: true } });\n};\n\nexport { build, type BuildOptions };\n"]}
package/dist/cli.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- #!/usr/bin/env node
2
- import "./refresh-runtime.js";
1
+ export {};
3
2
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";AAEA,OAAO,sBAAsB,CAAC"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js CHANGED
@@ -1,133 +1,35 @@
1
- #!/usr/bin/env node
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import "./refresh-runtime.js";
4
- import { createRequire } from "node:module";
5
- import { resolve } from "node:path";
6
- import { events } from "@gtkx/ffi";
7
- import { render } from "@gtkx/react";
1
+ import { packageVersion } from "@gtkx/utils";
8
2
  import { defineCommand, runMain } from "citty";
9
- import { build } from "./builder.js";
10
- import { createApp } from "./create.js";
11
- import { createDevServer } from "./dev-server.js";
12
- import { startMcpClient, stopMcpClient } from "./mcp-client.js";
13
- const require = createRequire(import.meta.url);
14
- const { version } = require("../package.json");
15
- const dev = defineCommand({
16
- meta: {
17
- name: "dev",
18
- description: "Start development server with HMR",
19
- },
20
- args: {
21
- entry: {
22
- type: "positional",
23
- description: "Entry file (e.g., src/app.tsx)",
24
- required: true,
25
- },
26
- },
27
- async run({ args }) {
28
- const entryPath = resolve(process.cwd(), args.entry);
29
- console.log(`[gtkx] Starting dev server for ${entryPath}`);
30
- const server = await createDevServer({
31
- entry: entryPath,
32
- vite: {
33
- root: process.cwd(),
34
- },
35
- });
36
- const mod = (await server.ssrLoadModule(entryPath));
37
- const App = mod.default;
38
- const appId = mod.appId ?? "org.gtkx.dev";
39
- const appFlags = mod.appFlags;
40
- if (typeof App !== "function") {
41
- console.error("[gtkx] Entry file must export a default function component");
42
- process.exit(1);
43
- }
44
- console.log(`[gtkx] Rendering app with ID: ${appId}`);
45
- render(_jsx(App, {}), appId, appFlags);
46
- await startMcpClient(appId);
47
- events.on("stop", () => {
48
- stopMcpClient();
49
- });
50
- console.log("[gtkx] HMR enabled - watching for changes...");
51
- },
52
- });
53
- const buildCmd = defineCommand({
54
- meta: {
55
- name: "build",
56
- description: "Build application for production",
57
- },
58
- args: {
59
- entry: {
60
- type: "positional",
61
- description: "Entry file (default: src/index.tsx)",
62
- required: false,
63
- },
64
- "asset-base": {
65
- type: "string",
66
- description: "Asset base path relative to executable directory (e.g., ../share/my-app)",
67
- },
68
- },
69
- async run({ args }) {
70
- const entry = resolve(process.cwd(), args.entry ?? "src/index.tsx");
71
- console.log(`[gtkx] Building ${entry}`);
72
- await build({
73
- entry,
74
- assetBase: args["asset-base"],
75
- vite: {
76
- root: process.cwd(),
77
- },
78
- });
79
- console.log("[gtkx] Build complete: dist/bundle.js");
80
- },
81
- });
82
- const create = defineCommand({
3
+ import { withErrorBoundary } from "./internal/errors.js";
4
+ const version = packageVersion(import.meta.url);
5
+ const main = defineCommand({
83
6
  meta: {
84
- name: "create",
85
- description: "Create a new GTKX application",
7
+ name: "gtkx",
8
+ version,
9
+ description: "CLI for GTKX: create and develop GTK4 React applications",
86
10
  },
87
- args: {
88
- name: {
89
- type: "positional",
90
- description: "Project name",
91
- required: false,
11
+ subCommands: {
12
+ dev: async () => {
13
+ const { dev } = await import("./commands/dev.js");
14
+ return withErrorBoundary(dev);
92
15
  },
93
- "app-id": {
94
- type: "string",
95
- description: "App ID (e.g., com.example.myapp)",
16
+ build: async () => {
17
+ const { build } = await import("./commands/build.js");
18
+ return withErrorBoundary(build);
96
19
  },
97
- pm: {
98
- type: "string",
99
- description: "Package manager (pnpm, npm, yarn)",
20
+ codegen: async () => {
21
+ const { codegen } = await import("./commands/codegen.js");
22
+ return withErrorBoundary(codegen);
100
23
  },
101
- testing: {
102
- type: "string",
103
- description: "Testing setup (vitest, none)",
24
+ docs: async () => {
25
+ const { docs } = await import("./commands/docs.js");
26
+ return withErrorBoundary(docs);
104
27
  },
105
- "claude-skills": {
106
- type: "boolean",
107
- description: "Include Claude Code skills for AI assistance",
28
+ create: async () => {
29
+ const { scaffoldCommand } = await import("create-gtkx");
30
+ return withErrorBoundary(scaffoldCommand);
108
31
  },
109
32
  },
110
- async run({ args }) {
111
- await createApp({
112
- name: args.name,
113
- appId: args["app-id"],
114
- packageManager: args.pm,
115
- testing: args.testing,
116
- claudeSkills: args["claude-skills"],
117
- });
118
- },
119
- });
120
- const main = defineCommand({
121
- meta: {
122
- name: "gtkx",
123
- version,
124
- description: "CLI for GTKX - create and develop GTK4 React applications",
125
- },
126
- subCommands: {
127
- dev,
128
- build: buildCmd,
129
- create,
130
- },
131
33
  });
132
- runMain(main);
34
+ await runMain(main);
133
35
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";;AAEA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAQtE,MAAM,GAAG,GAAG,aAAa,CAAC;IACtB,IAAI,EAAE;QACF,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,mCAAmC;KACnD;IACD,IAAI,EAAE;QACF,KAAK,EAAE;YACH,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,gCAAgC;YAC7C,QAAQ,EAAE,IAAI;SACjB;KACJ;IACD,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE;QACd,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,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iBAAiB,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QACD,IAAI,EAAE,KAAK,IAAI,EAAE;YACb,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;YAEpD,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;QACD,MAAM,EAAE,KAAK,IAAI,EAAE;YACf,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;YAExD,OAAO,iBAAiB,CAAC,eAAe,CAAC,CAAC;QAC9C,CAAC;KACJ;CACJ,CAAC,CAAC;AAEH,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { packageVersion } from \"@gtkx/utils\";\nimport { defineCommand, runMain } from \"citty\";\nimport { withErrorBoundary } from \"./internal/errors.js\";\n\nconst version = packageVersion(import.meta.url);\n\nconst main = defineCommand({\n meta: {\n name: \"gtkx\",\n version,\n description: \"CLI for GTKX: create and develop GTK4 React applications\",\n },\n subCommands: {\n dev: async () => {\n const { dev } = await import(\"./commands/dev.js\");\n\n return withErrorBoundary(dev);\n },\n build: async () => {\n const { build } = await import(\"./commands/build.js\");\n\n return withErrorBoundary(build);\n },\n codegen: async () => {\n const { codegen } = await import(\"./commands/codegen.js\");\n\n return withErrorBoundary(codegen);\n },\n docs: async () => {\n const { docs } = await import(\"./commands/docs.js\");\n\n return withErrorBoundary(docs);\n },\n create: async () => {\n const { scaffoldCommand } = await import(\"create-gtkx\");\n\n return withErrorBoundary(scaffoldCommand);\n },\n },\n});\n\nawait runMain(main);\n"]}
@@ -0,0 +1,11 @@
1
+ import type { Config } from "@gtkx/config";
2
+ import { type CodegenStore } from "./store-resolver.js";
3
+ type CodegenInputs = {
4
+ girPath: string[];
5
+ libraries: string[];
6
+ store: CodegenStore;
7
+ };
8
+ declare const resolveCodegenInputs: (cwd: string, config: Config) => CodegenInputs;
9
+ declare const isCodegenStale: (inputs: CodegenInputs) => boolean;
10
+ export { resolveCodegenInputs, isCodegenStale, type CodegenInputs };
11
+ //# sourceMappingURL=freshness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"freshness.d.ts","sourceRoot":"","sources":["../../src/codegen/freshness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,qBAAqB,CAAC;AAE7E,KAAK,aAAa,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,YAAY,CAAC;CACvB,CAAC;AAIF,QAAA,MAAM,oBAAoB,GAAI,KAAK,MAAM,EAAE,QAAQ,MAAM,KAAG,aAM3D,CAAC;AAoCF,QAAA,MAAM,cAAc,GAAI,QAAQ,aAAa,KAAG,OAM/C,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { resolveGirPath, resolveLibraries } from "@gtkx/codegen";
2
+ import { existsSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { resolveCodegenStore } from "./store-resolver.js";
5
+ const REACT_GENERATED_MODULES = ["metadata.js", join("gtk", "gtk.js")];
6
+ const resolveCodegenInputs = (cwd, config) => {
7
+ const girPath = resolveGirPath(config.girPath);
8
+ const libraries = resolveLibraries(config.libraries, girPath);
9
+ const store = resolveCodegenStore(cwd);
10
+ return { girPath, libraries, store };
11
+ };
12
+ const namespaceBarrelPath = (giStoreDir, library) => {
13
+ const separator = library.indexOf("-");
14
+ const namespace = (separator === -1 ? library : library.slice(0, separator)).toLowerCase();
15
+ return join(giStoreDir, namespace, "index.js");
16
+ };
17
+ const canResolveGiStoreLinks = (giStoreDir) => existsSync(join(giStoreDir, "node_modules", "@gtkx", "gi", "package.json"));
18
+ const isGiStoreStale = (store, libraries) => {
19
+ if (!existsSync(store.giLinkDir) || !existsSync(store.giStoreDir)) {
20
+ return true;
21
+ }
22
+ if (!canResolveGiStoreLinks(store.giStoreDir)) {
23
+ return true;
24
+ }
25
+ return libraries.some((library) => !existsSync(namespaceBarrelPath(store.giStoreDir, library)));
26
+ };
27
+ const isReactStoreStale = (store) => {
28
+ if (store.react === null) {
29
+ return false;
30
+ }
31
+ if (!existsSync(store.jsxLinkDir)) {
32
+ return true;
33
+ }
34
+ return REACT_GENERATED_MODULES.some((module) => !existsSync(join(store.jsxStoreDir, module)));
35
+ };
36
+ const isCodegenStale = (inputs) => {
37
+ try {
38
+ return isGiStoreStale(inputs.store, inputs.libraries) || isReactStoreStale(inputs.store);
39
+ }
40
+ catch {
41
+ return true;
42
+ }
43
+ };
44
+ export { resolveCodegenInputs, isCodegenStale };
45
+ //# sourceMappingURL=freshness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"freshness.js","sourceRoot":"","sources":["../../src/codegen/freshness.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAqB,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAQ7E,MAAM,uBAAuB,GAAa,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEjF,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAE,MAAc,EAAiB,EAAE;IACxE,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAEvC,OAAO,EAAE,OAAO,EAAE,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I,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,uBAAuB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAClG,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,MAAqB,EAAW,EAAE;IACtD,IAAI,CAAC;QACD,OAAO,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7F,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAsB,CAAC","sourcesContent":["import type { Config } from \"@gtkx/config\";\nimport { resolveGirPath, resolveLibraries } from \"@gtkx/codegen\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { type CodegenStore, resolveCodegenStore } from \"./store-resolver.js\";\n\ntype CodegenInputs = {\n girPath: string[];\n libraries: string[];\n store: CodegenStore;\n};\n\nconst REACT_GENERATED_MODULES: string[] = [\"metadata.js\", join(\"gtk\", \"gtk.js\")];\n\nconst resolveCodegenInputs = (cwd: string, config: Config): CodegenInputs => {\n const girPath = resolveGirPath(config.girPath);\n const libraries = resolveLibraries(config.libraries, girPath);\n const store = resolveCodegenStore(cwd);\n\n return { girPath, libraries, store };\n};\n\nconst namespaceBarrelPath = (giStoreDir: string, library: string): string => {\n const separator = library.indexOf(\"-\");\n const namespace = (separator === -1 ? library : library.slice(0, separator)).toLowerCase();\n\n return join(giStoreDir, namespace, \"index.js\");\n};\n\nconst canResolveGiStoreLinks = (giStoreDir: string): boolean =>\n existsSync(join(giStoreDir, \"node_modules\", \"@gtkx\", \"gi\", \"package.json\"));\n\nconst isGiStoreStale = (store: CodegenStore, libraries: string[]): boolean => {\n if (!existsSync(store.giLinkDir) || !existsSync(store.giStoreDir)) {\n return true;\n }\n\n if (!canResolveGiStoreLinks(store.giStoreDir)) {\n return true;\n }\n\n return libraries.some((library) => !existsSync(namespaceBarrelPath(store.giStoreDir, library)));\n};\n\nconst isReactStoreStale = (store: CodegenStore): boolean => {\n if (store.react === null) {\n return false;\n }\n\n if (!existsSync(store.jsxLinkDir)) {\n return true;\n }\n\n return REACT_GENERATED_MODULES.some((module) => !existsSync(join(store.jsxStoreDir, module)));\n};\n\nconst isCodegenStale = (inputs: CodegenInputs): boolean => {\n try {\n return isGiStoreStale(inputs.store, inputs.libraries) || isReactStoreStale(inputs.store);\n } catch {\n return true;\n }\n};\n\nexport { resolveCodegenInputs, isCodegenStale, type CodegenInputs };\n"]}
@@ -0,0 +1,4 @@
1
+ import type { RunCodegenResult } from "./run-codegen.js";
2
+ declare const formatCodegenResult: (result: RunCodegenResult, totalMs: number) => string[];
3
+ export { formatCodegenResult };
4
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/codegen/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,QAAA,MAAM,mBAAmB,GAAI,QAAQ,gBAAgB,EAAE,SAAS,MAAM,KAAG,MAAM,EAqB9E,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}