@gtkx/cli 2.0.0-beta.1 → 2.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 (501) hide show
  1. package/README.md +43 -40
  2. package/bin/gtkx-dev-runner.js +5 -1
  3. package/bin/gtkx.js +5 -1
  4. package/dist/builder.d.ts +1 -0
  5. package/dist/builder.d.ts.map +1 -1
  6. package/dist/builder.js +44 -12
  7. package/dist/builder.js.map +1 -1
  8. package/dist/cli.d.ts +1 -1
  9. package/dist/cli.d.ts.map +1 -1
  10. package/dist/cli.js +14 -2
  11. package/dist/cli.js.map +1 -1
  12. package/dist/codegen/config-dependencies.d.ts +3 -0
  13. package/dist/codegen/config-dependencies.d.ts.map +1 -0
  14. package/dist/codegen/config-dependencies.js +355 -0
  15. package/dist/codegen/config-dependencies.js.map +1 -0
  16. package/dist/codegen/freshness.d.ts.map +1 -1
  17. package/dist/codegen/freshness.js +5 -1
  18. package/dist/codegen/freshness.js.map +1 -1
  19. package/dist/codegen/reference.d.ts.map +1 -1
  20. package/dist/codegen/reference.js +1 -0
  21. package/dist/codegen/reference.js.map +1 -1
  22. package/dist/codegen/run-codegen.d.ts +6 -3
  23. package/dist/codegen/run-codegen.d.ts.map +1 -1
  24. package/dist/codegen/run-codegen.js +42 -18
  25. package/dist/codegen/run-codegen.js.map +1 -1
  26. package/dist/codegen/store-resolver.d.ts +3 -1
  27. package/dist/codegen/store-resolver.d.ts.map +1 -1
  28. package/dist/codegen/store-resolver.js +7 -4
  29. package/dist/codegen/store-resolver.js.map +1 -1
  30. package/dist/commands/build.d.ts +5 -0
  31. package/dist/commands/build.d.ts.map +1 -1
  32. package/dist/commands/build.js +83 -10
  33. package/dist/commands/build.js.map +1 -1
  34. package/dist/commands/cleanup.d.ts +9 -0
  35. package/dist/commands/cleanup.d.ts.map +1 -0
  36. package/dist/commands/cleanup.js +42 -0
  37. package/dist/commands/cleanup.js.map +1 -0
  38. package/dist/commands/codegen.d.ts +1 -0
  39. package/dist/commands/codegen.d.ts.map +1 -1
  40. package/dist/commands/codegen.js +6 -5
  41. package/dist/commands/codegen.js.map +1 -1
  42. package/dist/commands/deploy.d.ts +5 -0
  43. package/dist/commands/deploy.d.ts.map +1 -1
  44. package/dist/commands/deploy.js +10 -2
  45. package/dist/commands/deploy.js.map +1 -1
  46. package/dist/commands/dev.d.ts +9 -0
  47. package/dist/commands/dev.d.ts.map +1 -1
  48. package/dist/commands/dev.js +31 -4
  49. package/dist/commands/dev.js.map +1 -1
  50. package/dist/commands/docs.d.ts.map +1 -1
  51. package/dist/commands/docs.js +1 -0
  52. package/dist/commands/docs.js.map +1 -1
  53. package/dist/deploy/depends.d.ts.map +1 -1
  54. package/dist/deploy/depends.js +24 -2
  55. package/dist/deploy/depends.js.map +1 -1
  56. package/dist/deploy/download.d.ts +7 -3
  57. package/dist/deploy/download.d.ts.map +1 -1
  58. package/dist/deploy/download.js +19 -20
  59. package/dist/deploy/download.js.map +1 -1
  60. package/dist/deploy/freedesktop/metainfo.d.ts.map +1 -1
  61. package/dist/deploy/freedesktop/metainfo.js +41 -2
  62. package/dist/deploy/freedesktop/metainfo.js.map +1 -1
  63. package/dist/deploy/freedesktop/validate.d.ts.map +1 -1
  64. package/dist/deploy/freedesktop/validate.js +58 -14
  65. package/dist/deploy/freedesktop/validate.js.map +1 -1
  66. package/dist/deploy/native-addon.d.ts +5 -0
  67. package/dist/deploy/native-addon.d.ts.map +1 -0
  68. package/dist/deploy/native-addon.js +134 -0
  69. package/dist/deploy/native-addon.js.map +1 -0
  70. package/dist/deploy/nfpm/config.d.ts +3 -2
  71. package/dist/deploy/nfpm/config.d.ts.map +1 -1
  72. package/dist/deploy/nfpm/config.js +7 -4
  73. package/dist/deploy/nfpm/config.js.map +1 -1
  74. package/dist/deploy/nfpm/contents.d.ts.map +1 -1
  75. package/dist/deploy/nfpm/contents.js +8 -0
  76. package/dist/deploy/nfpm/contents.js.map +1 -1
  77. package/dist/deploy/node-runtime/download.js +2 -2
  78. package/dist/deploy/node-runtime/download.js.map +1 -1
  79. package/dist/deploy/node-runtime/elf.d.ts +4 -1
  80. package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
  81. package/dist/deploy/node-runtime/elf.js +34 -5
  82. package/dist/deploy/node-runtime/elf.js.map +1 -1
  83. package/dist/deploy/node-runtime/guard.d.ts.map +1 -1
  84. package/dist/deploy/node-runtime/guard.js +7 -14
  85. package/dist/deploy/node-runtime/guard.js.map +1 -1
  86. package/dist/deploy/node-runtime/index.d.ts +3 -1
  87. package/dist/deploy/node-runtime/index.d.ts.map +1 -1
  88. package/dist/deploy/node-runtime/index.js +103 -10
  89. package/dist/deploy/node-runtime/index.js.map +1 -1
  90. package/dist/deploy/node-runtime/sonames.d.ts +5 -0
  91. package/dist/deploy/node-runtime/sonames.d.ts.map +1 -0
  92. package/dist/deploy/node-runtime/sonames.js +13 -0
  93. package/dist/deploy/node-runtime/sonames.js.map +1 -0
  94. package/dist/deploy/notices/node-runtime.js +2 -2
  95. package/dist/deploy/notices/node-runtime.js.map +1 -1
  96. package/dist/deploy/payload/launcher.d.ts.map +1 -1
  97. package/dist/deploy/payload/launcher.js +14 -1
  98. package/dist/deploy/payload/launcher.js.map +1 -1
  99. package/dist/deploy/payload/stage.d.ts +2 -1
  100. package/dist/deploy/payload/stage.d.ts.map +1 -1
  101. package/dist/deploy/payload/stage.js +46 -5
  102. package/dist/deploy/payload/stage.js.map +1 -1
  103. package/dist/deploy/run-deploy.d.ts +2 -0
  104. package/dist/deploy/run-deploy.d.ts.map +1 -1
  105. package/dist/deploy/run-deploy.js +197 -52
  106. package/dist/deploy/run-deploy.js.map +1 -1
  107. package/dist/deploy/settings/arch.d.ts +9 -3
  108. package/dist/deploy/settings/arch.d.ts.map +1 -1
  109. package/dist/deploy/settings/arch.js +27 -6
  110. package/dist/deploy/settings/arch.js.map +1 -1
  111. package/dist/deploy/settings/build-manifest.d.ts +6 -1
  112. package/dist/deploy/settings/build-manifest.d.ts.map +1 -1
  113. package/dist/deploy/settings/build-manifest.js +15 -4
  114. package/dist/deploy/settings/build-manifest.js.map +1 -1
  115. package/dist/deploy/settings/extra-files.d.ts +1 -1
  116. package/dist/deploy/settings/extra-files.d.ts.map +1 -1
  117. package/dist/deploy/settings/extra-files.js +25 -3
  118. package/dist/deploy/settings/extra-files.js.map +1 -1
  119. package/dist/deploy/settings/index.d.ts +3 -1
  120. package/dist/deploy/settings/index.d.ts.map +1 -1
  121. package/dist/deploy/settings/index.js +4 -2
  122. package/dist/deploy/settings/index.js.map +1 -1
  123. package/dist/deploy/settings/libraries.d.ts.map +1 -1
  124. package/dist/deploy/settings/libraries.js +2 -1
  125. package/dist/deploy/settings/libraries.js.map +1 -1
  126. package/dist/deploy/settings/paths.d.ts +4 -2
  127. package/dist/deploy/settings/paths.d.ts.map +1 -1
  128. package/dist/deploy/settings/paths.js +121 -12
  129. package/dist/deploy/settings/paths.js.map +1 -1
  130. package/dist/deploy/targets/appimage.d.ts.map +1 -1
  131. package/dist/deploy/targets/appimage.js +1 -0
  132. package/dist/deploy/targets/appimage.js.map +1 -1
  133. package/dist/deploy/targets/flatpak-pnpm.js +4 -4
  134. package/dist/deploy/targets/flatpak-pnpm.js.map +1 -1
  135. package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
  136. package/dist/deploy/targets/flatpak-source.js +13 -2
  137. package/dist/deploy/targets/flatpak-source.js.map +1 -1
  138. package/dist/deploy/targets/flatpak.d.ts.map +1 -1
  139. package/dist/deploy/targets/flatpak.js +1 -0
  140. package/dist/deploy/targets/flatpak.js.map +1 -1
  141. package/dist/deploy/targets/nfpm-target.d.ts.map +1 -1
  142. package/dist/deploy/targets/nfpm-target.js +13 -7
  143. package/dist/deploy/targets/nfpm-target.js.map +1 -1
  144. package/dist/deploy/types.d.ts +5 -2
  145. package/dist/deploy/types.d.ts.map +1 -1
  146. package/dist/deploy/types.js.map +1 -1
  147. package/dist/deploy/vendored/appimagetool.js +2 -2
  148. package/dist/deploy/vendored/appimagetool.js.map +1 -1
  149. package/dist/deploy/vendored/nfpm.js +1 -1
  150. package/dist/deploy/vendored/nfpm.js.map +1 -1
  151. package/dist/dev/catalog-writes.d.ts +8 -0
  152. package/dist/dev/catalog-writes.d.ts.map +1 -0
  153. package/dist/dev/catalog-writes.js +26 -0
  154. package/dist/dev/catalog-writes.js.map +1 -0
  155. package/dist/dev/entry-env.d.ts +2 -1
  156. package/dist/dev/entry-env.d.ts.map +1 -1
  157. package/dist/dev/entry-env.js +2 -1
  158. package/dist/dev/entry-env.js.map +1 -1
  159. package/dist/dev/font-dir.d.ts +3 -0
  160. package/dist/dev/font-dir.d.ts.map +1 -0
  161. package/dist/dev/font-dir.js +9 -0
  162. package/dist/dev/font-dir.js.map +1 -0
  163. package/dist/dev/headless.d.ts +3 -0
  164. package/dist/dev/headless.d.ts.map +1 -0
  165. package/dist/dev/headless.js +35 -0
  166. package/dist/dev/headless.js.map +1 -0
  167. package/dist/dev/runner-deps.d.ts +1 -1
  168. package/dist/dev/runner-deps.d.ts.map +1 -1
  169. package/dist/dev/runner-deps.js +12 -7
  170. package/dist/dev/runner-deps.js.map +1 -1
  171. package/dist/dev/runner-main.d.ts.map +1 -1
  172. package/dist/dev/runner-main.js +10 -3
  173. package/dist/dev/runner-main.js.map +1 -1
  174. package/dist/dev/runner.d.ts +2 -0
  175. package/dist/dev/runner.d.ts.map +1 -1
  176. package/dist/dev/runner.js +26 -7
  177. package/dist/dev/runner.js.map +1 -1
  178. package/dist/dev/supervisor.d.ts +3 -1
  179. package/dist/dev/supervisor.d.ts.map +1 -1
  180. package/dist/dev/supervisor.js +132 -29
  181. package/dist/dev/supervisor.js.map +1 -1
  182. package/dist/dev/vite-dev-server.d.ts +1 -1
  183. package/dist/dev/vite-dev-server.d.ts.map +1 -1
  184. package/dist/dev/vite-dev-server.js +14 -2
  185. package/dist/dev/vite-dev-server.js.map +1 -1
  186. package/dist/dev/watch-ignore.d.ts +3 -0
  187. package/dist/dev/watch-ignore.d.ts.map +1 -0
  188. package/dist/dev/watch-ignore.js +11 -0
  189. package/dist/dev/watch-ignore.js.map +1 -0
  190. package/dist/i18n/catalogs.d.ts +6 -2
  191. package/dist/i18n/catalogs.d.ts.map +1 -1
  192. package/dist/i18n/catalogs.js +10 -7
  193. package/dist/i18n/catalogs.js.map +1 -1
  194. package/dist/i18n/source-messages.d.ts +3 -1
  195. package/dist/i18n/source-messages.d.ts.map +1 -1
  196. package/dist/i18n/source-messages.js +973 -9
  197. package/dist/i18n/source-messages.js.map +1 -1
  198. package/dist/internal/agent-rules.d.ts.map +1 -1
  199. package/dist/internal/agent-rules.js +7 -2
  200. package/dist/internal/agent-rules.js.map +1 -1
  201. package/dist/internal/banner.d.ts +4 -2
  202. package/dist/internal/banner.d.ts.map +1 -1
  203. package/dist/internal/banner.js +19 -5
  204. package/dist/internal/banner.js.map +1 -1
  205. package/dist/internal/build-manifest.d.ts +5 -2
  206. package/dist/internal/build-manifest.d.ts.map +1 -1
  207. package/dist/internal/build-manifest.js +15 -2
  208. package/dist/internal/build-manifest.js.map +1 -1
  209. package/dist/internal/build-output.d.ts +8 -0
  210. package/dist/internal/build-output.d.ts.map +1 -0
  211. package/dist/internal/build-output.js +116 -0
  212. package/dist/internal/build-output.js.map +1 -0
  213. package/dist/internal/cache-root.d.ts +3 -0
  214. package/dist/internal/cache-root.d.ts.map +1 -0
  215. package/dist/internal/cache-root.js +9 -0
  216. package/dist/internal/cache-root.js.map +1 -0
  217. package/dist/internal/compile-cache-store.d.ts +4 -0
  218. package/dist/internal/compile-cache-store.d.ts.map +1 -0
  219. package/dist/internal/compile-cache-store.js +41 -0
  220. package/dist/internal/compile-cache-store.js.map +1 -0
  221. package/dist/internal/compile-cache.d.ts +4 -0
  222. package/dist/internal/compile-cache.d.ts.map +1 -0
  223. package/dist/internal/compile-cache.js +16 -0
  224. package/dist/internal/compile-cache.js.map +1 -0
  225. package/dist/internal/deploy-out-dir.d.ts +4 -0
  226. package/dist/internal/deploy-out-dir.d.ts.map +1 -0
  227. package/dist/internal/deploy-out-dir.js +5 -0
  228. package/dist/internal/deploy-out-dir.js.map +1 -0
  229. package/dist/internal/docs-elements.d.ts +1 -0
  230. package/dist/internal/docs-elements.d.ts.map +1 -1
  231. package/dist/internal/docs-elements.js +5 -4
  232. package/dist/internal/docs-elements.js.map +1 -1
  233. package/dist/internal/entry-arg.d.ts +4 -1
  234. package/dist/internal/entry-arg.d.ts.map +1 -1
  235. package/dist/internal/entry-arg.js +7 -1
  236. package/dist/internal/entry-arg.js.map +1 -1
  237. package/dist/internal/errors.d.ts +2 -1
  238. package/dist/internal/errors.d.ts.map +1 -1
  239. package/dist/internal/errors.js +1 -1
  240. package/dist/internal/errors.js.map +1 -1
  241. package/dist/internal/font-path.d.ts +4 -0
  242. package/dist/internal/font-path.d.ts.map +1 -0
  243. package/dist/internal/font-path.js +12 -0
  244. package/dist/internal/font-path.js.map +1 -0
  245. package/dist/internal/font-staging.d.ts +6 -0
  246. package/dist/internal/font-staging.d.ts.map +1 -0
  247. package/dist/internal/font-staging.js +94 -0
  248. package/dist/internal/font-staging.js.map +1 -0
  249. package/dist/internal/icon-staging.d.ts +3 -0
  250. package/dist/internal/icon-staging.d.ts.map +1 -0
  251. package/dist/internal/icon-staging.js +40 -0
  252. package/dist/internal/icon-staging.js.map +1 -0
  253. package/dist/internal/import-scan.d.ts +4 -0
  254. package/dist/internal/import-scan.d.ts.map +1 -0
  255. package/dist/internal/import-scan.js +138 -0
  256. package/dist/internal/import-scan.js.map +1 -0
  257. package/dist/internal/module-hash.d.ts +3 -0
  258. package/dist/internal/module-hash.d.ts.map +1 -0
  259. package/dist/internal/module-hash.js +19 -0
  260. package/dist/internal/module-hash.js.map +1 -0
  261. package/dist/internal/output-directory.d.ts +15 -0
  262. package/dist/internal/output-directory.d.ts.map +1 -0
  263. package/dist/internal/output-directory.js +490 -0
  264. package/dist/internal/output-directory.js.map +1 -0
  265. package/dist/internal/parent-process.d.ts +12 -0
  266. package/dist/internal/parent-process.d.ts.map +1 -0
  267. package/dist/internal/parent-process.js +74 -0
  268. package/dist/internal/parent-process.js.map +1 -0
  269. package/dist/internal/prepare-project.d.ts +3 -0
  270. package/dist/internal/prepare-project.d.ts.map +1 -1
  271. package/dist/internal/prepare-project.js +9 -3
  272. package/dist/internal/prepare-project.js.map +1 -1
  273. package/dist/internal/react-compiler-cache.d.ts +13 -0
  274. package/dist/internal/react-compiler-cache.d.ts.map +1 -0
  275. package/dist/internal/react-compiler-cache.js +182 -0
  276. package/dist/internal/react-compiler-cache.js.map +1 -0
  277. package/dist/internal/source-imports.d.ts +7 -2
  278. package/dist/internal/source-imports.d.ts.map +1 -1
  279. package/dist/internal/source-imports.js +31 -11
  280. package/dist/internal/source-imports.js.map +1 -1
  281. package/dist/internal/staging-file.d.ts +5 -0
  282. package/dist/internal/staging-file.d.ts.map +1 -0
  283. package/dist/internal/staging-file.js +35 -0
  284. package/dist/internal/staging-file.js.map +1 -0
  285. package/dist/internal/xdg-banner.d.ts +4 -0
  286. package/dist/internal/xdg-banner.d.ts.map +1 -0
  287. package/dist/internal/xdg-banner.js +11 -0
  288. package/dist/internal/xdg-banner.js.map +1 -0
  289. package/dist/internal/xdg-data-dirs.d.ts +2 -1
  290. package/dist/internal/xdg-data-dirs.d.ts.map +1 -1
  291. package/dist/internal/xdg-data-dirs.js +1 -1
  292. package/dist/internal/xdg-data-dirs.js.map +1 -1
  293. package/dist/mcp/client.js +2 -2
  294. package/dist/mcp/client.js.map +1 -1
  295. package/dist/settings/schema.d.ts.map +1 -1
  296. package/dist/settings/schema.js +3 -8
  297. package/dist/settings/schema.js.map +1 -1
  298. package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
  299. package/dist/vite-plugins/asset-extensions.js +2 -0
  300. package/dist/vite-plugins/asset-extensions.js.map +1 -1
  301. package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
  302. package/dist/vite-plugins/asset-imports.js +20 -6
  303. package/dist/vite-plugins/asset-imports.js.map +1 -1
  304. package/dist/vite-plugins/asset-specifier.d.ts +5 -1
  305. package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
  306. package/dist/vite-plugins/asset-specifier.js +10 -1
  307. package/dist/vite-plugins/asset-specifier.js.map +1 -1
  308. package/dist/vite-plugins/build-manifest.d.ts +5 -1
  309. package/dist/vite-plugins/build-manifest.d.ts.map +1 -1
  310. package/dist/vite-plugins/build-manifest.js +2 -1
  311. package/dist/vite-plugins/build-manifest.js.map +1 -1
  312. package/dist/vite-plugins/built-url.d.ts.map +1 -1
  313. package/dist/vite-plugins/built-url.js +5 -2
  314. package/dist/vite-plugins/built-url.js.map +1 -1
  315. package/dist/vite-plugins/css.d.ts.map +1 -1
  316. package/dist/vite-plugins/css.js +13 -5
  317. package/dist/vite-plugins/css.js.map +1 -1
  318. package/dist/vite-plugins/ensure-store.d.ts +1 -1
  319. package/dist/vite-plugins/ensure-store.d.ts.map +1 -1
  320. package/dist/vite-plugins/ensure-store.js +2 -2
  321. package/dist/vite-plugins/ensure-store.js.map +1 -1
  322. package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts +6 -1
  323. package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts.map +1 -1
  324. package/dist/vite-plugins/fast-refresh/refresh-filter.js +3 -1
  325. package/dist/vite-plugins/fast-refresh/refresh-filter.js.map +1 -1
  326. package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts.map +1 -1
  327. package/dist/vite-plugins/fast-refresh/swc-refresh.js +23 -14
  328. package/dist/vite-plugins/fast-refresh/swc-refresh.js.map +1 -1
  329. package/dist/vite-plugins/font-name.d.ts +3 -0
  330. package/dist/vite-plugins/font-name.d.ts.map +1 -0
  331. package/dist/vite-plugins/font-name.js +406 -0
  332. package/dist/vite-plugins/font-name.js.map +1 -0
  333. package/dist/vite-plugins/font-worker-env.d.ts +4 -0
  334. package/dist/vite-plugins/font-worker-env.d.ts.map +1 -0
  335. package/dist/vite-plugins/font-worker-env.js +19 -0
  336. package/dist/vite-plugins/font-worker-env.js.map +1 -0
  337. package/dist/vite-plugins/font.d.ts +4 -0
  338. package/dist/vite-plugins/font.d.ts.map +1 -0
  339. package/dist/vite-plugins/font.js +111 -0
  340. package/dist/vite-plugins/font.js.map +1 -0
  341. package/dist/vite-plugins/i18n.d.ts +11 -2
  342. package/dist/vite-plugins/i18n.d.ts.map +1 -1
  343. package/dist/vite-plugins/i18n.js +74 -8
  344. package/dist/vite-plugins/i18n.js.map +1 -1
  345. package/dist/vite-plugins/icon-worker-env.d.ts +4 -0
  346. package/dist/vite-plugins/icon-worker-env.d.ts.map +1 -0
  347. package/dist/vite-plugins/icon-worker-env.js +23 -0
  348. package/dist/vite-plugins/icon-worker-env.js.map +1 -0
  349. package/dist/vite-plugins/icons.d.ts.map +1 -1
  350. package/dist/vite-plugins/icons.js +4 -9
  351. package/dist/vite-plugins/icons.js.map +1 -1
  352. package/dist/vite-plugins/index.d.ts +10 -1
  353. package/dist/vite-plugins/index.d.ts.map +1 -1
  354. package/dist/vite-plugins/index.js +17 -3
  355. package/dist/vite-plugins/index.js.map +1 -1
  356. package/dist/vite-plugins/native.d.ts.map +1 -1
  357. package/dist/vite-plugins/native.js +0 -4
  358. package/dist/vite-plugins/native.js.map +1 -1
  359. package/dist/vite-plugins/react-compiler.d.ts.map +1 -1
  360. package/dist/vite-plugins/react-compiler.js +57 -18
  361. package/dist/vite-plugins/react-compiler.js.map +1 -1
  362. package/dist/vite-plugins/resource-shared.d.ts +3 -1
  363. package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
  364. package/dist/vite-plugins/resource-shared.js +3 -1
  365. package/dist/vite-plugins/resource-shared.js.map +1 -1
  366. package/dist/vite-plugins/resources.d.ts.map +1 -1
  367. package/dist/vite-plugins/resources.js +9 -6
  368. package/dist/vite-plugins/resources.js.map +1 -1
  369. package/dist/vite-plugins/self-contained.d.ts.map +1 -1
  370. package/dist/vite-plugins/self-contained.js +159 -158
  371. package/dist/vite-plugins/self-contained.js.map +1 -1
  372. package/dist/vite-plugins/settings-worker-env.d.ts +1 -1
  373. package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
  374. package/dist/vite-plugins/settings-worker-env.js +4 -4
  375. package/dist/vite-plugins/settings-worker-env.js.map +1 -1
  376. package/dist/vite-plugins/settings.d.ts.map +1 -1
  377. package/dist/vite-plugins/settings.js +25 -14
  378. package/dist/vite-plugins/settings.js.map +1 -1
  379. package/dist/vite-plugins/store-links.d.ts.map +1 -1
  380. package/dist/vite-plugins/store-links.js +9 -5
  381. package/dist/vite-plugins/store-links.js.map +1 -1
  382. package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
  383. package/dist/vite-plugins/undeclared-library.js +18 -15
  384. package/dist/vite-plugins/undeclared-library.js.map +1 -1
  385. package/dist/vite-plugins/worker.d.ts.map +1 -1
  386. package/dist/vite-plugins/worker.js +21 -13
  387. package/dist/vite-plugins/worker.js.map +1 -1
  388. package/dist/vitest-plugin.d.ts +4 -3
  389. package/dist/vitest-plugin.d.ts.map +1 -1
  390. package/dist/vitest-plugin.js +12 -8
  391. package/dist/vitest-plugin.js.map +1 -1
  392. package/env.d.ts +9 -0
  393. package/package.json +18 -13
  394. package/src/builder.ts +45 -12
  395. package/src/cli.ts +15 -2
  396. package/src/codegen/config-dependencies.ts +470 -0
  397. package/src/codegen/freshness.ts +5 -1
  398. package/src/codegen/reference.ts +1 -0
  399. package/src/codegen/run-codegen.ts +51 -21
  400. package/src/codegen/store-resolver.ts +9 -4
  401. package/src/commands/build.ts +13 -2
  402. package/src/commands/cleanup.ts +48 -0
  403. package/src/commands/codegen.ts +6 -5
  404. package/src/commands/deploy.ts +10 -2
  405. package/src/commands/dev.ts +45 -4
  406. package/src/commands/docs.ts +1 -0
  407. package/src/deploy/depends.ts +30 -3
  408. package/src/deploy/download.ts +33 -24
  409. package/src/deploy/freedesktop/metainfo.ts +73 -21
  410. package/src/deploy/freedesktop/validate.ts +80 -15
  411. package/src/deploy/native-addon.ts +183 -0
  412. package/src/deploy/nfpm/config.ts +13 -4
  413. package/src/deploy/nfpm/contents.ts +8 -0
  414. package/src/deploy/node-runtime/download.ts +2 -2
  415. package/src/deploy/node-runtime/elf.ts +46 -5
  416. package/src/deploy/node-runtime/guard.ts +10 -14
  417. package/src/deploy/node-runtime/index.ts +148 -12
  418. package/src/deploy/node-runtime/sonames.ts +17 -0
  419. package/src/deploy/notices/node-runtime.ts +2 -2
  420. package/src/deploy/payload/launcher.ts +20 -1
  421. package/src/deploy/payload/stage.ts +76 -5
  422. package/src/deploy/run-deploy.ts +227 -72
  423. package/src/deploy/settings/arch.ts +40 -8
  424. package/src/deploy/settings/build-manifest.ts +28 -3
  425. package/src/deploy/settings/extra-files.ts +30 -4
  426. package/src/deploy/settings/index.ts +7 -2
  427. package/src/deploy/settings/libraries.ts +2 -1
  428. package/src/deploy/settings/paths.ts +80 -13
  429. package/src/deploy/targets/appimage.ts +1 -0
  430. package/src/deploy/targets/flatpak-pnpm.ts +4 -4
  431. package/src/deploy/targets/flatpak-source.ts +15 -2
  432. package/src/deploy/targets/flatpak.ts +1 -0
  433. package/src/deploy/targets/nfpm-target.ts +14 -6
  434. package/src/deploy/types.ts +5 -1
  435. package/src/deploy/vendored/appimagetool.ts +2 -2
  436. package/src/deploy/vendored/nfpm.ts +1 -1
  437. package/src/dev/catalog-writes.ts +35 -0
  438. package/src/dev/entry-env.ts +2 -1
  439. package/src/dev/font-dir.ts +11 -0
  440. package/src/dev/headless.ts +40 -0
  441. package/src/dev/runner-deps.ts +20 -7
  442. package/src/dev/runner-main.ts +12 -3
  443. package/src/dev/runner.ts +37 -7
  444. package/src/dev/supervisor.ts +183 -32
  445. package/src/dev/vite-dev-server.ts +20 -2
  446. package/src/dev/watch-ignore.ts +16 -0
  447. package/src/i18n/catalogs.ts +21 -8
  448. package/src/i18n/source-messages.ts +1446 -29
  449. package/src/internal/agent-rules.ts +7 -2
  450. package/src/internal/banner.ts +27 -6
  451. package/src/internal/build-manifest.ts +25 -1
  452. package/src/internal/build-output.ts +171 -0
  453. package/src/internal/cache-root.ts +12 -0
  454. package/src/internal/compile-cache-store.ts +50 -0
  455. package/src/internal/compile-cache.ts +20 -0
  456. package/src/internal/deploy-out-dir.ts +8 -0
  457. package/src/internal/docs-elements.ts +10 -4
  458. package/src/internal/entry-arg.ts +8 -1
  459. package/src/internal/errors.ts +1 -1
  460. package/src/internal/font-path.ts +15 -0
  461. package/src/internal/font-staging.ts +131 -0
  462. package/src/internal/icon-staging.ts +58 -0
  463. package/src/internal/import-scan.ts +206 -0
  464. package/src/internal/module-hash.ts +22 -0
  465. package/src/internal/output-directory.ts +699 -0
  466. package/src/internal/parent-process.ts +110 -0
  467. package/src/internal/prepare-project.ts +11 -5
  468. package/src/internal/react-compiler-cache.ts +246 -0
  469. package/src/internal/source-imports.ts +57 -12
  470. package/src/internal/staging-file.ts +42 -0
  471. package/src/internal/xdg-banner.ts +13 -0
  472. package/src/internal/xdg-data-dirs.ts +1 -1
  473. package/src/mcp/client.ts +2 -2
  474. package/src/settings/schema.ts +4 -10
  475. package/src/vite-plugins/asset-extensions.ts +2 -0
  476. package/src/vite-plugins/asset-imports.ts +23 -5
  477. package/src/vite-plugins/asset-specifier.ts +17 -0
  478. package/src/vite-plugins/build-manifest.ts +7 -1
  479. package/src/vite-plugins/built-url.ts +6 -2
  480. package/src/vite-plugins/css.ts +16 -5
  481. package/src/vite-plugins/ensure-store.ts +2 -2
  482. package/src/vite-plugins/fast-refresh/refresh-filter.ts +10 -1
  483. package/src/vite-plugins/fast-refresh/swc-refresh.ts +33 -14
  484. package/src/vite-plugins/font-name.ts +582 -0
  485. package/src/vite-plugins/font-worker-env.ts +25 -0
  486. package/src/vite-plugins/font.ts +180 -0
  487. package/src/vite-plugins/i18n.ts +122 -11
  488. package/src/vite-plugins/icon-worker-env.ts +36 -0
  489. package/src/vite-plugins/icons.ts +4 -10
  490. package/src/vite-plugins/index.ts +34 -9
  491. package/src/vite-plugins/native.ts +0 -5
  492. package/src/vite-plugins/react-compiler.ts +83 -19
  493. package/src/vite-plugins/resource-shared.ts +4 -0
  494. package/src/vite-plugins/resources.ts +11 -5
  495. package/src/vite-plugins/self-contained.ts +184 -185
  496. package/src/vite-plugins/settings-worker-env.ts +4 -4
  497. package/src/vite-plugins/settings.ts +36 -16
  498. package/src/vite-plugins/store-links.ts +10 -5
  499. package/src/vite-plugins/undeclared-library.ts +19 -15
  500. package/src/vite-plugins/worker.ts +31 -15
  501. package/src/vitest-plugin.ts +12 -8
@@ -2,6 +2,7 @@ import { runCodegen as runCodegenCore } from "@gtkx/codegen";
2
2
  import { getShadowingStorePaths, sweepProjectStaging } from "@gtkx/codegen/internal";
3
3
  import { type Config, loadConfig } from "@gtkx/config";
4
4
  import {
5
+ configDependenciesFor,
5
6
  isAgentRulesEnabled,
6
7
  resolveElementComponents,
7
8
  resolveElementProps,
@@ -10,13 +11,14 @@ import {
10
11
  } from "@gtkx/config/internal";
11
12
  import { info } from "@gtkx/utils";
12
13
  import { existsSync, rmSync } from "node:fs";
13
- import { join, resolve } from "node:path";
14
+ import { join, relative, resolve } from "node:path";
14
15
  import { resolveCatalogProject, synchronizeCatalogs } from "../i18n/catalogs.js";
15
16
  import { extractSourceCatalog } from "../i18n/source-messages.js";
16
17
  import { clearI18nTypes, emitI18nTypes } from "../i18n/types.js";
17
18
  import { upsertAgentRules } from "../internal/agent-rules.js";
18
19
  import { discoverSourceFiles } from "../internal/source-imports.js";
19
20
  import { emitSchemaEnv } from "../settings/schema.js";
21
+ import { resolveConfigDependencies } from "./config-dependencies.js";
20
22
  import { type CodegenInputs, isCodegenStale, resolveCodegenInputs } from "./freshness.js";
21
23
  import { type ReferenceResult, writeReference } from "./reference.js";
22
24
  import { type CodegenContext, type CodegenStore, resolveCodegenContext } from "./store-resolver.js";
@@ -24,6 +26,7 @@ import { type CodegenContext, type CodegenStore, resolveCodegenContext } from ".
24
26
  type RunCodegenOptions = {
25
27
  cwd?: string;
26
28
  mode?: string | undefined;
29
+ configFile?: string | undefined;
27
30
  isForced?: boolean;
28
31
  inputs?: CodegenInputs;
29
32
  resolved?: LoadedConfig;
@@ -58,6 +61,7 @@ type PreparedCodegen = CodegenInputs & { isForced: boolean };
58
61
  type EnsureGeneratedOptions = {
59
62
  shouldAnnounce?: boolean;
60
63
  mode?: string;
64
+ configFile?: string | undefined;
61
65
  shouldPreserveI18nMetadata?: boolean | undefined;
62
66
  };
63
67
 
@@ -84,6 +88,7 @@ const codegenOptions = ({ store, libraries, girPath, elements }: CodegenOptionsI
84
88
  storeDir: store.giStoreDir,
85
89
  linkDir: store.giLinkDir,
86
90
  version: store.runtimeVersion,
91
+ owner: store.owner,
87
92
  },
88
93
  jsx:
89
94
  store.react === null
@@ -92,6 +97,7 @@ const codegenOptions = ({ store, libraries, girPath, elements }: CodegenOptionsI
92
97
  storeDir: store.jsxStoreDir,
93
98
  linkDir: store.jsxLinkDir,
94
99
  version: store.react.version,
100
+ owner: store.owner,
95
101
  },
96
102
  userComponents: resolveElementComponents(elements),
97
103
  userProps: resolveElementProps(elements),
@@ -109,14 +115,6 @@ const disabledCodegenResult = (configFile: string): RunCodegenResult => ({
109
115
  libraries: [],
110
116
  });
111
117
 
112
- const clearGeneratedStores = (store: CodegenStore): void => {
113
- removeStores(
114
- store.react === null
115
- ? [store.giStoreDir, store.giLinkDir]
116
- : [store.giStoreDir, store.giLinkDir, store.jsxStoreDir, store.jsxLinkDir],
117
- );
118
- };
119
-
120
118
  const prepareCodegen = (options: RunCodegenOptions, cwd: string, config: Config): PreparedCodegen => {
121
119
  const { girPath, libraries, store } = options.inputs ?? resolveCodegenInputs(cwd, config);
122
120
 
@@ -131,7 +129,10 @@ const prepareCodegen = (options: RunCodegenOptions, cwd: string, config: Config)
131
129
 
132
130
  const runCodegen = async (options: RunCodegenOptions = {}): Promise<RunCodegenResult> => {
133
131
  const cwd = options.cwd ?? process.cwd();
134
- const { config, configFile } = options.resolved ?? (await loadConfig(cwd, { mode: options.mode }));
132
+ const { config, configFile } = options.resolved ?? (await loadConfig(cwd, {
133
+ mode: options.mode,
134
+ configFile: options.configFile,
135
+ }));
135
136
  await syncI18n(cwd, config.applicationId, options.shouldPreserveI18nMetadata);
136
137
  emitSchemaEnv(cwd);
137
138
 
@@ -143,10 +144,6 @@ const runCodegen = async (options: RunCodegenOptions = {}): Promise<RunCodegenRe
143
144
 
144
145
  const { girPath, libraries, store, isForced } = prepareCodegen(options, cwd, config);
145
146
 
146
- if (options.isForced) {
147
- clearGeneratedStores(store);
148
- }
149
-
150
147
  const result = await runCodegenCore({
151
148
  ...codegenOptions({ store, libraries, girPath, elements: config.elements }),
152
149
  isForced,
@@ -190,9 +187,9 @@ const syncI18n = async (
190
187
  await emitI18nTypes(root);
191
188
  };
192
189
 
193
- const isCodegenDisabled = async (cwd: string, mode?: string): Promise<boolean> => {
190
+ const isCodegenDisabled = async (cwd: string, mode?: string, configFile?: string): Promise<boolean> => {
194
191
  try {
195
- const { config } = await loadConfig(cwd, { mode });
192
+ const { config } = await loadConfig(cwd, { mode, configFile });
196
193
 
197
194
  return config.codegen === false;
198
195
  } catch {
@@ -257,18 +254,51 @@ const ensureGeneratedIn = async (
257
254
 
258
255
  /* eslint-disable-next-line unicorn/consistent-boolean-name -- the boolean reports whether codegen ran */
259
256
  const ensureGenerated = async (cwd: string, options: EnsureGeneratedOptions = {}): Promise<boolean> =>
260
- isPreflightSkipped(options) ? false : generate(await resolveCodegenContext(cwd, options.mode), options);
257
+ isPreflightSkipped(options)
258
+ ? false
259
+ : generate(await resolveCodegenContext(cwd, options.mode, options.configFile), options);
261
260
 
262
261
  const resolveConfigWatch = async (
263
262
  cwd: string,
264
263
  mode?: string,
265
- ): Promise<{ paths: string[]; regenerate: () => Promise<void> }> => {
266
- const { configFile, root } = await loadConfig(cwd, { mode });
264
+ configFile?: string,
265
+ initialDependencies: string[] = [],
266
+ ): Promise<{ paths: string[]; resolvePaths: () => string[]; regenerate: () => Promise<string[]> }> => {
267
+ let selectedConfigFile: string;
268
+
269
+ if (configFile === undefined) {
270
+ const loaded = await loadConfig(cwd, { mode });
271
+ selectedConfigFile = loaded.configFile;
272
+ } else {
273
+ selectedConfigFile = resolve(cwd, configFile);
274
+ }
275
+
276
+ let knownDependencies = initialDependencies;
277
+ const selectedConfigName = relative(cwd, selectedConfigFile);
278
+ const resolvePaths = (): string[] => [
279
+ ...new Set(
280
+ [selectedConfigFile, ...knownDependencies]
281
+ .flatMap((path) => resolveConfigDependencies(path, selectedConfigName, cwd)),
282
+ ),
283
+ ];
267
284
 
268
285
  return {
269
- paths: [resolve(root, configFile)],
286
+ paths: resolvePaths(),
287
+ resolvePaths,
270
288
  regenerate: async () => {
271
- await runCodegen({ cwd: root, mode });
289
+ let loaded: Awaited<ReturnType<typeof loadConfig>>;
290
+
291
+ try {
292
+ loaded = await loadConfig(cwd, { mode, configFile: selectedConfigFile });
293
+ } catch (error) {
294
+ knownDependencies = [...new Set([...knownDependencies, ...configDependenciesFor(error)])];
295
+ throw error;
296
+ }
297
+
298
+ knownDependencies = configDependenciesFor(loaded);
299
+ await runCodegen({ cwd, mode, resolved: loaded });
300
+
301
+ return resolvePaths();
272
302
  },
273
303
  };
274
304
  };
@@ -1,6 +1,7 @@
1
1
  import { resolveStore } from "@gtkx/codegen";
2
2
  import { type Config, loadConfig } from "@gtkx/config";
3
- import { existsSync } from "node:fs";
3
+ import { configDependenciesFor } from "@gtkx/config/internal";
4
+ import { existsSync, realpathSync } from "node:fs";
4
5
  import { createRequire } from "node:module";
5
6
  import { dirname, join } from "node:path";
6
7
  import { pathToFileURL } from "node:url";
@@ -11,6 +12,7 @@ type CodegenStore = {
11
12
  jsxStoreDir: string;
12
13
  jsxLinkDir: string;
13
14
  runtimeVersion: string;
15
+ owner: string;
14
16
  react: CodegenReactPackage | null;
15
17
  };
16
18
 
@@ -22,6 +24,7 @@ type CodegenContext = {
22
24
  root: string;
23
25
  config: Config;
24
26
  configFile: string;
27
+ configDependencies: string[];
25
28
  };
26
29
 
27
30
  const hasPackage = (require: NodeJS.Require, dir: string, packageName: string): boolean => {
@@ -54,6 +57,7 @@ const resolveCodegenStore = (dir: string): CodegenStore => {
54
57
  jsxStoreDir: store.jsx?.storeDir ?? siblingStore(store.gi.storeDir),
55
58
  jsxLinkDir: store.jsx?.linkDir ?? siblingStore(store.gi.linkDir),
56
59
  runtimeVersion: store.gi.version,
60
+ owner: store.gi.owner ?? realpathSync(dir),
57
61
  react:
58
62
  hasReactRuntime && store.jsx !== null
59
63
  ? { version: store.jsx.version }
@@ -61,10 +65,11 @@ const resolveCodegenStore = (dir: string): CodegenStore => {
61
65
  };
62
66
  };
63
67
 
64
- const resolveCodegenContext = async (cwd: string, mode?: string): Promise<CodegenContext> => {
65
- const { config, configFile } = await loadConfig(cwd, { mode });
68
+ const resolveCodegenContext = async (cwd: string, mode?: string, selectedConfig?: string): Promise<CodegenContext> => {
69
+ const loaded = await loadConfig(cwd, { mode, configFile: selectedConfig });
70
+ const { config, configFile } = loaded;
66
71
 
67
- return { root: cwd, config, configFile };
72
+ return { root: cwd, config, configFile, configDependencies: configDependenciesFor(loaded) };
68
73
  };
69
74
 
70
75
  export { resolveCodegenStore, resolveCodegenContext, type CodegenContext, type CodegenStore };
@@ -1,7 +1,8 @@
1
1
  import { info } from "@gtkx/utils";
2
2
  import { defineCommand } from "citty";
3
3
  import { build as buildApp } from "../builder.js";
4
- import { entryArg } from "../internal/entry-arg.js";
4
+ import { prepareBuildOutDir, resolveBuildOutDir } from "../internal/build-output.js";
5
+ import { configArg, entryArg } from "../internal/entry-arg.js";
5
6
  import { prepareProject } from "../internal/prepare-project.js";
6
7
 
7
8
  const BUILD_MODE = "production";
@@ -13,18 +14,28 @@ const build = defineCommand({
13
14
  },
14
15
  args: {
15
16
  ...entryArg,
17
+ ...configArg,
18
+ out: {
19
+ type: "string",
20
+ description: "Output directory below the project root (default: dist)",
21
+ },
16
22
  },
17
23
  async run({ args }) {
18
- const { cwd, entry } = await prepareProject(args, BUILD_MODE);
24
+ const { cwd, entry, configFile } = await prepareProject(args, BUILD_MODE);
25
+ const outDir = resolveBuildOutDir(cwd, args.out);
26
+ using preparedOutput = prepareBuildOutDir(cwd, outDir);
19
27
  info(`Building ${entry}`);
20
28
 
21
29
  const bundlePath = await buildApp({
22
30
  entry,
31
+ configFile,
23
32
  vite: {
24
33
  root: cwd,
34
+ build: { outDir: preparedOutput.path, emptyOutDir: false },
25
35
  },
26
36
  });
27
37
 
38
+ preparedOutput.commit();
28
39
  info(`Build complete: ${bundlePath}`);
29
40
  },
30
41
  });
@@ -0,0 +1,48 @@
1
+ import { info } from "@gtkx/utils";
2
+ import { findStaleHeadlessDisplays, reapStaleHeadlessDisplays } from "@gtkx/vitest/headless";
3
+ import { defineCommand } from "citty";
4
+ import { findStaleCompileCaches, reapStaleCompileCaches } from "../internal/compile-cache-store.js";
5
+ import { cwdArg } from "../internal/entry-arg.js";
6
+
7
+ const DISPLAY_LABEL = "stale headless runtime directories";
8
+ const COMPILE_CACHE_LABEL = "stale compile cache directories";
9
+
10
+ const report = (paths: string[]): void => {
11
+ for (const path of paths) {
12
+ info(`cleanup: ${path}`);
13
+ }
14
+ };
15
+
16
+ const cleanup = defineCommand({
17
+ meta: {
18
+ name: "cleanup",
19
+ description: "Remove stale GTKX headless runtime and compile cache directories",
20
+ },
21
+ args: {
22
+ "dry-run": {
23
+ type: "boolean",
24
+ description: "List stale directories without removing them",
25
+ },
26
+ ...cwdArg,
27
+ },
28
+ run({ args }) {
29
+ const displays = findStaleHeadlessDisplays();
30
+ const compileCaches = findStaleCompileCaches();
31
+ report(displays.map((candidate) => candidate.runtimeDir));
32
+ report(compileCaches);
33
+
34
+ if (args["dry-run"] === true) {
35
+ info(`cleanup: found ${String(displays.length)} ${DISPLAY_LABEL}`);
36
+ info(`cleanup: found ${String(compileCaches.length)} ${COMPILE_CACHE_LABEL}`);
37
+
38
+ return;
39
+ }
40
+
41
+ const removedDisplays = reapStaleHeadlessDisplays(displays);
42
+ const removedCaches = reapStaleCompileCaches(compileCaches);
43
+ info(`cleanup: removed ${String(removedDisplays.length)} ${DISPLAY_LABEL}`);
44
+ info(`cleanup: removed ${String(removedCaches.length)} ${COMPILE_CACHE_LABEL}`);
45
+ },
46
+ });
47
+
48
+ export { cleanup };
@@ -2,7 +2,7 @@ import { info } from "@gtkx/utils";
2
2
  import { defineCommand } from "citty";
3
3
  import { formatCodegenResult } from "../codegen/report.js";
4
4
  import { ensureGenerated, isCodegenDisabled, runCodegen } from "../codegen/run-codegen.js";
5
- import { cwdArg, resolveCwd } from "../internal/entry-arg.js";
5
+ import { configArg, cwdArg, resolveCwd } from "../internal/entry-arg.js";
6
6
 
7
7
  const FORCED_WHILE_DISABLED_MESSAGE =
8
8
  "codegen is disabled for this project, so --force has no store to regenerate here. " +
@@ -20,29 +20,30 @@ const codegen = defineCommand({
20
20
  description: "Wipe the generated store and regenerate unconditionally (recover a corrupted store)",
21
21
  default: false,
22
22
  },
23
+ ...configArg,
23
24
  ...cwdArg,
24
25
  },
25
26
  async run({ args }) {
26
27
  const cwd = resolveCwd(args);
27
- const isDisabled = await isCodegenDisabled(cwd);
28
+ const isDisabled = await isCodegenDisabled(cwd, undefined, args.config);
28
29
  checkForce(isDisabled, args.force);
29
30
 
30
31
  if (isDisabled) {
31
- await runCodegen({ cwd });
32
+ await runCodegen({ cwd, configFile: args.config });
32
33
  info("codegen: disabled for this project; reusing an installed binding store");
33
34
 
34
35
  return;
35
36
  }
36
37
 
37
38
  if (!args.force) {
38
- const isRan = await ensureGenerated(cwd);
39
+ const isRan = await ensureGenerated(cwd, { configFile: args.config });
39
40
  info(isRan ? "codegen: regenerated stale bindings" : "codegen: bindings up to date");
40
41
 
41
42
  return;
42
43
  }
43
44
 
44
45
  const startedAt = Date.now();
45
- const result = await runCodegen({ cwd, isForced: true });
46
+ const result = await runCodegen({ cwd, configFile: args.config, isForced: true });
46
47
  const lines = formatCodegenResult(result, Date.now() - startedAt);
47
48
 
48
49
  for (const line of lines) {
@@ -1,7 +1,8 @@
1
1
  import { defineCommand } from "citty";
2
2
  import { KNOWN_NAMES } from "../deploy/registry.js";
3
3
  import { runDeploy } from "../deploy/run-deploy.js";
4
- import { entryArg } from "../internal/entry-arg.js";
4
+ import { KNOWN_ARCH_NAMES } from "../deploy/settings/arch.js";
5
+ import { configArg, entryArg } from "../internal/entry-arg.js";
5
6
  import { resolveProject } from "../internal/prepare-project.js";
6
7
 
7
8
  const DEPLOY_MODE = "production";
@@ -13,10 +14,15 @@ const deploy = defineCommand({
13
14
  },
14
15
  args: {
15
16
  ...entryArg,
17
+ ...configArg,
16
18
  target: {
17
19
  type: "string",
18
20
  description: `Comma-separated package formats to build (${KNOWN_NAMES})`,
19
21
  },
22
+ arch: {
23
+ type: "string",
24
+ description: `Comma-separated architectures to build (${KNOWN_ARCH_NAMES}; default: the host)`,
25
+ },
20
26
  out: {
21
27
  type: "string",
22
28
  description: "Output directory relative to the project root (default: build)",
@@ -31,12 +37,14 @@ const deploy = defineCommand({
31
37
  },
32
38
  },
33
39
  async run({ args }) {
34
- const { cwd, entry } = await resolveProject(args, DEPLOY_MODE);
40
+ const { cwd, entry, configFile } = await resolveProject(args, DEPLOY_MODE);
35
41
 
36
42
  await runDeploy({
37
43
  entry,
38
44
  cwd,
45
+ configFile,
39
46
  targets: args.target,
47
+ arches: args.arch,
40
48
  outDir: args.out,
41
49
  shouldPrintManifests: args["print-manifests"] === true,
42
50
  shouldSkipBuild: args["skip-build"] === true,
@@ -1,8 +1,12 @@
1
+ import { armParentDeath } from "@gtkx/native/internal";
2
+ import { reapStaleHeadlessDisplaysAtStartup } from "@gtkx/vitest/headless";
1
3
  import { defineCommand } from "citty";
2
4
  import { resolveConfigWatch } from "../codegen/run-codegen.js";
5
+ import { startHeadlessDevDisplay } from "../dev/headless.js";
3
6
  import { type DevWatch, runDevSupervisor } from "../dev/supervisor.js";
4
7
  import { splitApplicationArgs } from "../internal/application-args.js";
5
- import { entryArg } from "../internal/entry-arg.js";
8
+ import { configArg, entryArg } from "../internal/entry-arg.js";
9
+ import { getInitialProcessGroupOwner, initialParentId } from "../internal/parent-process.js";
6
10
  import { prepareProject } from "../internal/prepare-project.js";
7
11
 
8
12
  const DEV_MODE = "development";
@@ -14,12 +18,49 @@ const dev = defineCommand({
14
18
  },
15
19
  args: {
16
20
  ...entryArg,
21
+ ...configArg,
22
+ headless: {
23
+ type: "boolean",
24
+ description: "Run on an isolated headless Wayland display",
25
+ },
26
+ size: {
27
+ type: "string",
28
+ description: "Headless display size as WIDTHxHEIGHT",
29
+ },
17
30
  },
18
31
  async run({ args }) {
19
- const { cwd, entry: entryPath } = await prepareProject(args, DEV_MODE);
20
- const watch: DevWatch | undefined = await resolveConfigWatch(cwd, DEV_MODE);
32
+ reapStaleHeadlessDisplaysAtStartup();
33
+ const initialProcessGroupOwner = getInitialProcessGroupOwner();
34
+
35
+ if (
36
+ !armParentDeath(
37
+ initialParentId,
38
+ initialProcessGroupOwner?.pid,
39
+ initialProcessGroupOwner?.startTime,
40
+ )
41
+ ) {
42
+ throw new Error("The process that launched gtkx dev exited during startup");
43
+ }
44
+
45
+ if (args.size !== undefined && !args.headless) {
46
+ throw new Error("--size requires --headless");
47
+ }
48
+
49
+ const { cwd, entry: entryPath, configFile, configDependencies } = await prepareProject(args, DEV_MODE);
50
+ const watch: DevWatch | undefined = await resolveConfigWatch(
51
+ cwd,
52
+ DEV_MODE,
53
+ configFile,
54
+ configDependencies,
55
+ );
21
56
  const { applicationArgs } = splitApplicationArgs(process.argv.slice(2));
22
- await runDevSupervisor({ entryPath, cwd, args: applicationArgs, watch });
57
+ const stopHeadless = args.headless ? await startHeadlessDevDisplay(args.size) : undefined;
58
+
59
+ try {
60
+ await runDevSupervisor({ entryPath, cwd, configFile, args: applicationArgs, watch });
61
+ } finally {
62
+ stopHeadless?.();
63
+ }
23
64
  },
24
65
  });
25
66
 
@@ -68,6 +68,7 @@ const docs = defineCommand({
68
68
  outDir,
69
69
  basePath: args["base-path"],
70
70
  props: builtin.props,
71
+ acceptedChildTypes: builtin.acceptedChildTypes,
71
72
  omittedProps: mergeOmittedProps(builtin.omittedProps, resolveOmittedProps(config.elements)),
72
73
  isForced: args.force,
73
74
  });
@@ -1,13 +1,17 @@
1
1
  import type { DeploySettings } from "./types.js";
2
+ import { PACKAGED_SONAMES, type PackagedSoname } from "./node-runtime/sonames.js";
2
3
 
3
4
  type Relations = {
4
5
  deb: string[];
5
6
  rpm: string[];
6
7
  };
7
8
 
8
- type LibraryPackages = {
9
+ type PackageNames = {
9
10
  deb: string;
10
11
  rpm: string;
12
+ };
13
+
14
+ type LibraryPackages = PackageNames & {
11
15
  extra: Relations;
12
16
  };
13
17
 
@@ -25,6 +29,17 @@ const DEPENDS_BY_LIBRARY: Record<string, LibraryPackages> = {
25
29
  "Gtk-4.0": { deb: "libgtk-4-1", rpm: "gtk4", extra: { deb: [], rpm: [GLES_SONAME] } },
26
30
  };
27
31
 
32
+ const RUNTIME_PACKAGES: Record<PackagedSoname, PackageNames> = {
33
+ "libatomic.so.1": { deb: "libatomic1", rpm: `libatomic.so.1${SONAME_SUFFIX}` },
34
+ "libgcc_s.so.1": { deb: "libgcc-s1", rpm: `libgcc_s.so.1${SONAME_SUFFIX}` },
35
+ "libstdc++.so.6": { deb: "libstdc++6", rpm: `libstdc++.so.6${SONAME_SUFFIX}` },
36
+ };
37
+
38
+ const RUNTIME_DEPENDS: Relations = {
39
+ deb: PACKAGED_SONAMES.map((soname) => RUNTIME_PACKAGES[soname].deb),
40
+ rpm: PACKAGED_SONAMES.map((soname) => RUNTIME_PACKAGES[soname].rpm),
41
+ };
42
+
28
43
  const debRelation = (name: string, minimum: string | undefined): string =>
29
44
  minimum === undefined ? name : `${name} (>= ${minimum})`;
30
45
 
@@ -63,8 +78,20 @@ const resolveDepends = (settings: DeploySettings, glibcMinimum: string | null):
63
78
  const extra = settings.deploy.depends ?? {};
64
79
 
65
80
  return {
66
- deb: dedupe([...fromLibraries.deb, ...BASE_DEPENDS.deb, ...fromGlibc.deb, ...(extra.deb ?? [])]),
67
- rpm: dedupe([...fromLibraries.rpm, ...BASE_DEPENDS.rpm, ...fromGlibc.rpm, ...(extra.rpm ?? [])]),
81
+ deb: dedupe([
82
+ ...fromLibraries.deb,
83
+ ...BASE_DEPENDS.deb,
84
+ ...fromGlibc.deb,
85
+ ...RUNTIME_DEPENDS.deb,
86
+ ...(extra.deb ?? []),
87
+ ]),
88
+ rpm: dedupe([
89
+ ...fromLibraries.rpm,
90
+ ...BASE_DEPENDS.rpm,
91
+ ...fromGlibc.rpm,
92
+ ...RUNTIME_DEPENDS.rpm,
93
+ ...(extra.rpm ?? []),
94
+ ]),
68
95
  };
69
96
  };
70
97
 
@@ -1,8 +1,8 @@
1
1
  import { info, warn } from "@gtkx/utils";
2
2
  import { createHash } from "node:crypto";
3
3
  import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
4
- import { homedir } from "node:os";
5
4
  import { join } from "node:path";
5
+ import { cacheRoot } from "../internal/cache-root.js";
6
6
 
7
7
  type DigestRequest = {
8
8
  url: string;
@@ -11,22 +11,21 @@ type DigestRequest = {
11
11
  subject: string;
12
12
  };
13
13
 
14
+ type DigestAlgorithm = "sha256" | "sha512";
15
+
14
16
  type DownloadRequest = {
15
17
  url: string;
16
18
  dest: string;
17
19
  label: string;
18
- sha256: string;
19
- freshSha256?: (() => Promise<string>) | undefined;
20
+ digest: string;
21
+ algorithm?: DigestAlgorithm | undefined;
22
+ freshDigest?: (() => Promise<string>) | undefined;
20
23
  mode?: number | undefined;
21
24
  };
22
25
 
23
- const CACHE_NAMESPACE = "gtkx";
24
- const DIGEST_PATTERN = /^[\da-f]{64}$/;
25
-
26
- const cacheRoot = (): string => {
27
- const base = process.env.XDG_CACHE_HOME;
28
-
29
- return join(base !== undefined && base.length > 0 ? base : join(homedir(), ".cache"), CACHE_NAMESPACE);
26
+ const DIGEST_PATTERN: Record<DigestAlgorithm, RegExp> = {
27
+ sha256: /^[\da-f]{64}$/,
28
+ sha512: /^[\da-f]{128}$/,
30
29
  };
31
30
 
32
31
  const cacheDir = (segments: string[]): string => {
@@ -36,10 +35,11 @@ const cacheDir = (segments: string[]): string => {
36
35
  return dir;
37
36
  };
38
37
 
39
- const getDigest = (contents: Buffer): string => createHash("sha256").update(contents).digest("hex");
38
+ const getDigest = (contents: Buffer, algorithm: DigestAlgorithm): string =>
39
+ createHash(algorithm).update(contents).digest("hex");
40
40
 
41
- const assertDigest = (url: string, contents: Buffer, expected: string): void => {
42
- const actual = getDigest(contents);
41
+ const assertDigest = (url: string, contents: Buffer, expected: string, algorithm: DigestAlgorithm): void => {
42
+ const actual = getDigest(contents, algorithm);
43
43
 
44
44
  if (actual !== expected) {
45
45
  throw new Error(`Checksum mismatch for ${url}\n expected ${expected}\n received ${actual}`);
@@ -62,11 +62,11 @@ const fetchText = async (url: string): Promise<string> => {
62
62
  return bytes.toString("utf8");
63
63
  };
64
64
 
65
- const readCachedDigest = (dest: string): string | undefined => {
65
+ const readCachedDigest = (dest: string, algorithm: DigestAlgorithm): string | undefined => {
66
66
  try {
67
67
  const cached = readFileSync(dest, "utf8").trim();
68
68
 
69
- return DIGEST_PATTERN.test(cached) ? cached : undefined;
69
+ return DIGEST_PATTERN[algorithm].test(cached) ? cached : undefined;
70
70
  } catch {
71
71
  return undefined;
72
72
  }
@@ -82,7 +82,7 @@ const publishedDigest = async (request: DigestRequest): Promise<string> => {
82
82
  const checksums = await fetchText(request.url);
83
83
  const digest = digestFromChecksums(checksums, request.assetName, request.subject);
84
84
 
85
- if (!DIGEST_PATTERN.test(digest)) {
85
+ if (!DIGEST_PATTERN.sha256.test(digest)) {
86
86
  throw new Error(`${request.subject} published a malformed checksum for ${request.assetName}: "${digest}"`);
87
87
  }
88
88
 
@@ -92,17 +92,17 @@ const publishedDigest = async (request: DigestRequest): Promise<string> => {
92
92
  };
93
93
 
94
94
  const cachedDigest = async (request: DigestRequest): Promise<string> => {
95
- const cached = readCachedDigest(request.dest);
95
+ const cached = readCachedDigest(request.dest, "sha256");
96
96
 
97
97
  return cached ?? publishedDigest(request);
98
98
  };
99
99
 
100
- const isCacheUsable = (dest: string, sha256: string): boolean => {
100
+ const isCacheUsable = (dest: string, digest: string, algorithm: DigestAlgorithm): boolean => {
101
101
  if (!existsSync(dest)) {
102
102
  return false;
103
103
  }
104
104
 
105
- if (getDigest(readFileSync(dest)) === sha256) {
105
+ if (getDigest(readFileSync(dest), algorithm) === digest) {
106
106
  return true;
107
107
  }
108
108
 
@@ -112,16 +112,17 @@ const isCacheUsable = (dest: string, sha256: string): boolean => {
112
112
  };
113
113
 
114
114
  const downloadFile = async (request: DownloadRequest): Promise<string> => {
115
- const { url, dest, label, sha256, mode } = request;
115
+ const { url, dest, label, digest, mode } = request;
116
+ const algorithm = request.algorithm ?? "sha256";
116
117
 
117
- if (isCacheUsable(dest, sha256)) {
118
+ if (isCacheUsable(dest, digest, algorithm)) {
118
119
  return dest;
119
120
  }
120
121
 
121
122
  info(`Downloading ${label}`);
122
- const expected = request.freshSha256 === undefined ? sha256 : await request.freshSha256();
123
+ const expected = request.freshDigest === undefined ? digest : await request.freshDigest();
123
124
  const contents = await fetchBytes(url);
124
- assertDigest(url, contents, expected);
125
+ assertDigest(url, contents, expected, algorithm);
125
126
  const staging = `${dest}.partial`;
126
127
  writeFileSync(staging, contents);
127
128
 
@@ -145,4 +146,12 @@ const digestFromChecksums = (checksums: string, assetName: string, subject: stri
145
146
  return digest;
146
147
  };
147
148
 
148
- export { cacheDir, cachedDigest, type DigestRequest, downloadFile, publishedDigest };
149
+ export {
150
+ cacheDir,
151
+ cachedDigest,
152
+ type DigestRequest,
153
+ downloadFile,
154
+ publishedDigest,
155
+ readCachedDigest,
156
+ writeAtomically,
157
+ };