@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
@@ -1,4 +1,4 @@
1
- import { sortStringsBy } from "@gtkx/utils";
1
+ import { sortStringsBy, warn } from "@gtkx/utils";
2
2
  import { existsSync, rmSync } from "node:fs";
3
3
  import { join, resolve } from "node:path";
4
4
  import { LOCALE_DIRNAME } from "../../i18n/catalogs.js";
@@ -7,7 +7,10 @@ import { listFilesRecursive } from "../../internal/list-files.js";
7
7
  import { BUNDLE_FILENAME } from "../../vite-plugins/esm-extension.js";
8
8
  import { renderCopyright } from "../freedesktop/copyright.js";
9
9
  import { renderDbusService } from "../freedesktop/dbus-service.js";
10
+ import { BINDING_FILENAME } from "../native-addon.js";
11
+ import { readOptionalElfInfo } from "../node-runtime/elf.js";
10
12
  import { renderNotices } from "../notices/render.js";
13
+ import { elfMachineFor } from "../settings/arch.js";
11
14
  import { copyInto, EXECUTABLE_MODE, executableModeFor, writeInto } from "./copy-tree.js";
12
15
  import { stageIcons } from "./icons.js";
13
16
  import { NODE_FILENAME, renderLauncher } from "./launcher.js";
@@ -44,6 +47,20 @@ const stageRuntimeFiles = (settings, root) => {
44
47
  .filter((file) => !isIconAsset(file.rel) && file.rel !== BUILD_MANIFEST_FILENAME && !isLocaleAsset(file.rel))
45
48
  .map((file) => copyInto(root, join(libDirFor(settings), file.rel), file.absPath));
46
49
  };
50
+ const stageAddon = (settings, root, addon) => addon === null ? [] : [copyInto(root, join(libDirFor(settings), BINDING_FILENAME), addon)];
51
+ const architectureMismatch = (settings, file) => new Error(`Cannot deploy ${file.rel} for ${settings.arch.node}: it was built for another architecture. ` +
52
+ "Run `gtkx build` again, or drop --skip-build.");
53
+ const assertStagedArchitecture = (settings, staged) => {
54
+ const expected = elfMachineFor(settings.arch.node);
55
+ const lib = libDirFor(settings);
56
+ const checked = new Set([join(lib, BINDING_FILENAME), join(lib, NODE_FILENAME)]);
57
+ const binaries = staged.filter((entry) => checked.has(entry.rel));
58
+ for (const file of binaries) {
59
+ if (readOptionalElfInfo(file.abs)?.machine !== expected) {
60
+ throw architectureMismatch(settings, file);
61
+ }
62
+ }
63
+ };
47
64
  const stageCatalogs = (settings, root) => listFilesRecursive(join(settings.paths.dist, LOCALE_DIRNAME))
48
65
  .map((file) => copyInto(root, join(SHARE_LOCALE, file.rel), file.absPath));
49
66
  const stageNodeBinary = (settings, root, node) => node === null ? [] : [copyInto(root, join(libDirFor(settings), NODE_FILENAME), node.path, EXECUTABLE_MODE)];
@@ -54,8 +71,29 @@ const stageMetadata = (settings, root, metadata) => [
54
71
  ? []
55
72
  : [writeInto(root, join(SHARE_MIME_PACKAGES, `${settings.applicationId}.xml`), metadata.mimePackage)]),
56
73
  ];
57
- const stageExtraFiles = (settings, root) => settings.extraFiles.map((file) => {
74
+ const generatedMetadataKind = (settings, metadata, destination) => {
75
+ if (destination === join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`)) {
76
+ return "desktop entry";
77
+ }
78
+ if (destination === join(SHARE_METAINFO, `${settings.applicationId}.metainfo.xml`)) {
79
+ return "metainfo";
80
+ }
81
+ if (metadata.mimePackage !== null &&
82
+ destination === join(SHARE_MIME_PACKAGES, `${settings.applicationId}.xml`)) {
83
+ return "MIME package";
84
+ }
85
+ return null;
86
+ };
87
+ const warnMetadataCollision = (settings, metadata, file) => {
88
+ const kind = generatedMetadataKind(settings, metadata, file.destination);
89
+ if (kind !== null) {
90
+ warn(`extraFiles source "${file.source}" targeting "${file.destination}" is overridden by the ` +
91
+ `GTKX-generated ${kind}`);
92
+ }
93
+ };
94
+ const stageExtraFiles = (settings, root, metadata) => settings.extraFiles.map((file) => {
58
95
  const source = resolve(settings.paths.root, file.source);
96
+ warnMetadataCollision(settings, metadata, file);
59
97
  return copyInto(root, file.destination, source, file.mode ?? executableModeFor(source));
60
98
  });
61
99
  const byRelativePath = (files) => {
@@ -65,19 +103,22 @@ const byRelativePath = (files) => {
65
103
  }
66
104
  return sortStringsBy(latest.values(), (file) => file.rel);
67
105
  };
68
- const stagePayload = ({ settings, node, metadata }) => {
106
+ const stagePayload = ({ settings, node, addon, metadata }) => {
69
107
  const root = settings.paths.stage;
70
108
  rmSync(root, { recursive: true, force: true, maxRetries: 5 });
71
- return byRelativePath([
109
+ const staged = byRelativePath([
72
110
  writeInto(root, join("bin", settings.binaryName), renderLauncher(settings), EXECUTABLE_MODE),
73
111
  ...stageNodeBinary(settings, root, node),
74
112
  ...stageRuntimeFiles(settings, root),
113
+ ...stageAddon(settings, root, addon),
75
114
  ...stageCatalogs(settings, root),
115
+ ...stageExtraFiles(settings, root, metadata),
76
116
  ...stageMetadata(settings, root, metadata),
77
117
  ...stageIcons(settings, root),
78
118
  ...stageSchemas(settings, root),
79
- ...stageExtraFiles(settings, root),
80
119
  ]);
120
+ assertStagedArchitecture(settings, staged);
121
+ return staged;
81
122
  };
82
123
  const withoutDbusActivation = (desktopEntry) => desktopEntry
83
124
  .split("\n")
@@ -1 +1 @@
1
- {"version":3,"file":"stage.js","sourceRoot":"","sources":["../../../src/deploy/payload/stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAA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Q,CAAC;IACrD,OAAO,EAAE,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC;IAC7D,GAAG,EAAE,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;CACxD,CAAC,CAAC;AAEH,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAElB,aAAa,EACb,YAAY,GACf,CAAC","sourcesContent":["import { sortStringsBy } from \"@gtkx/utils\";\nimport { existsSync, rmSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { DeploySettings, DeployTargetName, NodeRuntime, NoticeSection, StagedFile } from \"../types.js\";\nimport { LOCALE_DIRNAME } from \"../../i18n/catalogs.js\";\nimport { BUILD_MANIFEST_FILENAME } from \"../../internal/build-manifest.js\";\nimport { listFilesRecursive } from \"../../internal/list-files.js\";\nimport { BUNDLE_FILENAME } from \"../../vite-plugins/esm-extension.js\";\nimport { renderCopyright } from \"../freedesktop/copyright.js\";\nimport { renderDbusService } from \"../freedesktop/dbus-service.js\";\nimport { renderNotices } from \"../notices/render.js\";\nimport { copyInto, EXECUTABLE_MODE, executableModeFor, writeInto } from \"./copy-tree.js\";\nimport { stageIcons } from \"./icons.js\";\nimport { NODE_FILENAME, renderLauncher } from \"./launcher.js\";\nimport { stageSchemas } from \"./schemas.js\";\n\ntype StageRequest = {\n settings: DeploySettings;\n node: NodeRuntime | null;\n metadata: StagedMetadata;\n};\n\ntype StagedMetadata = {\n desktopEntry: string;\n metainfo: string;\n mimePackage: string | null;\n};\n\nconst DIST_ICONS_DIR = \"icons\";\nconst NOTICES_FILENAME = \"THIRD-PARTY-NOTICES\";\nconst NODE_LICENSE_FILENAME = \"LICENSE\";\nconst SHARE_APPLICATIONS = \"share/applications\";\nconst SHARE_METAINFO = \"share/metainfo\";\nconst SHARE_MIME_PACKAGES = \"share/mime/packages\";\nconst SHARE_DOC = \"share/doc\";\nconst SHARE_LICENSES = \"share/licenses\";\nconst SHARE_DBUS_SERVICES = \"share/dbus-1/services\";\nconst SHARE_LOCALE = `share/${LOCALE_DIRNAME}`;\n\nconst PREFIX_FOR: Record<DeployTargetName, string> = {\n appimage: \"/usr\",\n deb: \"/usr\",\n flatpak: \"/app\",\n rpm: \"/usr\",\n};\n\nconst libDirFor = (settings: DeploySettings): string => `lib/${settings.binaryName}`;\nconst licenseDirFor = (settings: DeploySettings): string => `${SHARE_LICENSES}/${settings.binaryName}`;\nconst licenseDestination = (settings: DeploySettings): string => `${licenseDirFor(settings)}/LICENSE`;\nconst noticesDestination = (settings: DeploySettings): string => `${licenseDirFor(settings)}/${NOTICES_FILENAME}`;\nconst isIconAsset = (rel: string): boolean => rel === DIST_ICONS_DIR || rel.startsWith(`${DIST_ICONS_DIR}/`);\nconst isLocaleAsset = (rel: string): boolean => rel === LOCALE_DIRNAME || rel.startsWith(`${LOCALE_DIRNAME}/`);\n\nconst nodeLicenseDestination = (settings: DeploySettings): string =>\n `${licenseDirFor(settings)}/${NODE_FILENAME}/${NODE_LICENSE_FILENAME}`;\n\nconst stageRuntimeFiles = (settings: DeploySettings, root: string): StagedFile[] => {\n const dist = settings.paths.dist;\n\n if (!existsSync(join(dist, BUNDLE_FILENAME))) {\n throw new Error(`Cannot deploy: ${join(dist, BUNDLE_FILENAME)} is missing. Run \\`gtkx build\\` first.`);\n }\n\n return listFilesRecursive(dist)\n .filter((file) =>\n !isIconAsset(file.rel) && file.rel !== BUILD_MANIFEST_FILENAME && !isLocaleAsset(file.rel))\n .map((file) => copyInto(root, join(libDirFor(settings), file.rel), file.absPath));\n};\n\nconst stageCatalogs = (settings: DeploySettings, root: string): StagedFile[] =>\n listFilesRecursive(join(settings.paths.dist, LOCALE_DIRNAME))\n .map((file) => copyInto(root, join(SHARE_LOCALE, file.rel), file.absPath));\n\nconst stageNodeBinary = (settings: DeploySettings, root: string, node: NodeRuntime | null): StagedFile[] =>\n node === null ? [] : [copyInto(root, join(libDirFor(settings), NODE_FILENAME), node.path, EXECUTABLE_MODE)];\n\nconst stageMetadata = (settings: DeploySettings, root: string, metadata: StagedMetadata): StagedFile[] => [\n writeInto(root, join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`), metadata.desktopEntry),\n writeInto(root, join(SHARE_METAINFO, `${settings.applicationId}.metainfo.xml`), metadata.metainfo),\n ...(metadata.mimePackage === null\n ? []\n : [writeInto(root, join(SHARE_MIME_PACKAGES, `${settings.applicationId}.xml`), metadata.mimePackage)]),\n];\n\nconst stageExtraFiles = (settings: DeploySettings, root: string): StagedFile[] =>\n settings.extraFiles.map((file) => {\n const source = resolve(settings.paths.root, file.source);\n\n return copyInto(root, file.destination, source, file.mode ?? executableModeFor(source));\n });\n\nconst byRelativePath = (files: StagedFile[]): StagedFile[] => {\n const latest: Map<string, StagedFile> = new Map();\n\n for (const file of files) {\n latest.set(file.rel, file);\n }\n\n return sortStringsBy(latest.values(), (file) => file.rel);\n};\n\nconst stagePayload = ({ settings, node, metadata }: StageRequest): StagedFile[] => {\n const root = settings.paths.stage;\n rmSync(root, { recursive: true, force: true, maxRetries: 5 });\n\n return byRelativePath([\n writeInto(root, join(\"bin\", settings.binaryName), renderLauncher(settings), EXECUTABLE_MODE),\n ...stageNodeBinary(settings, root, node),\n ...stageRuntimeFiles(settings, root),\n ...stageCatalogs(settings, root),\n ...stageMetadata(settings, root, metadata),\n ...stageIcons(settings, root),\n ...stageSchemas(settings, root),\n ...stageExtraFiles(settings, root),\n ]);\n};\n\nconst withoutDbusActivation = (desktopEntry: string): string =>\n desktopEntry\n .split(\"\\n\")\n .filter((line) => line !== \"DBusActivatable=true\")\n .join(\"\\n\");\n\nconst stageActivation = (\n settings: DeploySettings,\n root: string,\n target: DeployTargetName,\n metadata: StagedMetadata,\n): StagedFile[] => {\n if (!settings.isDbusActivatable) {\n return [];\n }\n\n if (target === \"appimage\") {\n return [writeInto(\n root,\n join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`),\n withoutDbusActivation(metadata.desktopEntry),\n )];\n }\n\n return [writeInto(\n root,\n join(SHARE_DBUS_SERVICES, `${settings.applicationId}.service`),\n renderDbusService(settings, PREFIX_FOR[target]),\n )];\n};\n\nconst stageOverlay = (\n settings: DeploySettings,\n target: DeployTargetName,\n notices: NoticeSection[],\n metadata: StagedMetadata,\n): StagedFile[] => {\n const root = join(settings.paths.overlay, target);\n rmSync(root, { recursive: true, force: true, maxRetries: 5 });\n const licenseFile = settings.paths.licenseFile;\n const activation = stageActivation(settings, root, target, metadata);\n\n if (target === \"deb\") {\n return [\n ...activation,\n writeInto(root, join(SHARE_DOC, settings.binaryName, \"copyright\"), renderCopyright(settings, notices)),\n ];\n }\n\n return [\n ...activation,\n ...(licenseFile === null ? [] : [copyInto(root, licenseDestination(settings), licenseFile)]),\n writeInto(root, noticesDestination(settings), renderNotices(settings, notices)),\n ];\n};\n\nconst stageOverlays = (\n settings: DeploySettings,\n notices: NoticeSection[],\n metadata: StagedMetadata,\n): Record<DeployTargetName, StagedFile[]> => ({\n appimage: stageOverlay(settings, \"appimage\", notices, metadata),\n deb: stageOverlay(settings, \"deb\", notices, metadata),\n flatpak: stageOverlay(settings, \"flatpak\", notices, metadata),\n rpm: stageOverlay(settings, \"rpm\", notices, metadata),\n});\n\nexport {\n licenseDestination,\n nodeLicenseDestination,\n NOTICES_FILENAME,\n noticesDestination,\n type StagedMetadata,\n stageOverlays,\n stagePayload,\n};\n"]}
1
+ {"version":3,"file":"stage.js","sourceRoot":"","sources":["../../../src/deploy/payload/stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAA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AC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC;IAC/D,GAAG,EAAE,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;IACrD,OAAO,EAAE,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC;IAC7D,GAAG,EAAE,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;CACxD,CAAC,CAAC;AAEH,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAElB,aAAa,EACb,YAAY,GACf,CAAC","sourcesContent":["import { sortStringsBy, warn } from \"@gtkx/utils\";\nimport { existsSync, rmSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { DeploySettings, DeployTargetName, NodeRuntime, NoticeSection, StagedFile } from \"../types.js\";\nimport { LOCALE_DIRNAME } from \"../../i18n/catalogs.js\";\nimport { BUILD_MANIFEST_FILENAME } from \"../../internal/build-manifest.js\";\nimport { listFilesRecursive } from \"../../internal/list-files.js\";\nimport { BUNDLE_FILENAME } from \"../../vite-plugins/esm-extension.js\";\nimport { renderCopyright } from \"../freedesktop/copyright.js\";\nimport { renderDbusService } from \"../freedesktop/dbus-service.js\";\nimport { BINDING_FILENAME } from \"../native-addon.js\";\nimport { readOptionalElfInfo } from \"../node-runtime/elf.js\";\nimport { renderNotices } from \"../notices/render.js\";\nimport { elfMachineFor } from \"../settings/arch.js\";\nimport { copyInto, EXECUTABLE_MODE, executableModeFor, writeInto } from \"./copy-tree.js\";\nimport { stageIcons } from \"./icons.js\";\nimport { NODE_FILENAME, renderLauncher } from \"./launcher.js\";\nimport { stageSchemas } from \"./schemas.js\";\n\ntype StageRequest = {\n settings: DeploySettings;\n node: NodeRuntime | null;\n addon: string | null;\n metadata: StagedMetadata;\n};\n\ntype StagedMetadata = {\n desktopEntry: string;\n metainfo: string;\n mimePackage: string | null;\n};\n\nconst DIST_ICONS_DIR = \"icons\";\nconst NOTICES_FILENAME = \"THIRD-PARTY-NOTICES\";\nconst NODE_LICENSE_FILENAME = \"LICENSE\";\nconst SHARE_APPLICATIONS = \"share/applications\";\nconst SHARE_METAINFO = \"share/metainfo\";\nconst SHARE_MIME_PACKAGES = \"share/mime/packages\";\nconst SHARE_DOC = \"share/doc\";\nconst SHARE_LICENSES = \"share/licenses\";\nconst SHARE_DBUS_SERVICES = \"share/dbus-1/services\";\nconst SHARE_LOCALE = `share/${LOCALE_DIRNAME}`;\n\nconst PREFIX_FOR: Record<DeployTargetName, string> = {\n appimage: \"/usr\",\n deb: \"/usr\",\n flatpak: \"/app\",\n rpm: \"/usr\",\n};\n\nconst libDirFor = (settings: DeploySettings): string => `lib/${settings.binaryName}`;\nconst licenseDirFor = (settings: DeploySettings): string => `${SHARE_LICENSES}/${settings.binaryName}`;\nconst licenseDestination = (settings: DeploySettings): string => `${licenseDirFor(settings)}/LICENSE`;\nconst noticesDestination = (settings: DeploySettings): string => `${licenseDirFor(settings)}/${NOTICES_FILENAME}`;\nconst isIconAsset = (rel: string): boolean => rel === DIST_ICONS_DIR || rel.startsWith(`${DIST_ICONS_DIR}/`);\nconst isLocaleAsset = (rel: string): boolean => rel === LOCALE_DIRNAME || rel.startsWith(`${LOCALE_DIRNAME}/`);\n\nconst nodeLicenseDestination = (settings: DeploySettings): string =>\n `${licenseDirFor(settings)}/${NODE_FILENAME}/${NODE_LICENSE_FILENAME}`;\n\nconst stageRuntimeFiles = (settings: DeploySettings, root: string): StagedFile[] => {\n const dist = settings.paths.dist;\n\n if (!existsSync(join(dist, BUNDLE_FILENAME))) {\n throw new Error(`Cannot deploy: ${join(dist, BUNDLE_FILENAME)} is missing. Run \\`gtkx build\\` first.`);\n }\n\n return listFilesRecursive(dist)\n .filter((file) =>\n !isIconAsset(file.rel) && file.rel !== BUILD_MANIFEST_FILENAME && !isLocaleAsset(file.rel))\n .map((file) => copyInto(root, join(libDirFor(settings), file.rel), file.absPath));\n};\n\nconst stageAddon = (settings: DeploySettings, root: string, addon: string | null): StagedFile[] =>\n addon === null ? [] : [copyInto(root, join(libDirFor(settings), BINDING_FILENAME), addon)];\n\nconst architectureMismatch = (settings: DeploySettings, file: StagedFile): Error =>\n new Error(\n `Cannot deploy ${file.rel} for ${settings.arch.node}: it was built for another architecture. ` +\n \"Run `gtkx build` again, or drop --skip-build.\",\n );\n\nconst assertStagedArchitecture = (settings: DeploySettings, staged: StagedFile[]): void => {\n const expected = elfMachineFor(settings.arch.node);\n const lib = libDirFor(settings);\n const checked = new Set([join(lib, BINDING_FILENAME), join(lib, NODE_FILENAME)]);\n\n const binaries = staged.filter((entry) => checked.has(entry.rel));\n\n for (const file of binaries) {\n if (readOptionalElfInfo(file.abs)?.machine !== expected) {\n throw architectureMismatch(settings, file);\n }\n }\n};\n\nconst stageCatalogs = (settings: DeploySettings, root: string): StagedFile[] =>\n listFilesRecursive(join(settings.paths.dist, LOCALE_DIRNAME))\n .map((file) => copyInto(root, join(SHARE_LOCALE, file.rel), file.absPath));\n\nconst stageNodeBinary = (settings: DeploySettings, root: string, node: NodeRuntime | null): StagedFile[] =>\n node === null ? [] : [copyInto(root, join(libDirFor(settings), NODE_FILENAME), node.path, EXECUTABLE_MODE)];\n\nconst stageMetadata = (settings: DeploySettings, root: string, metadata: StagedMetadata): StagedFile[] => [\n writeInto(root, join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`), metadata.desktopEntry),\n writeInto(root, join(SHARE_METAINFO, `${settings.applicationId}.metainfo.xml`), metadata.metainfo),\n ...(metadata.mimePackage === null\n ? []\n : [writeInto(root, join(SHARE_MIME_PACKAGES, `${settings.applicationId}.xml`), metadata.mimePackage)]),\n];\n\nconst generatedMetadataKind = (\n settings: DeploySettings,\n metadata: StagedMetadata,\n destination: string,\n): string | null => {\n if (destination === join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`)) {\n return \"desktop entry\";\n }\n\n if (destination === join(SHARE_METAINFO, `${settings.applicationId}.metainfo.xml`)) {\n return \"metainfo\";\n }\n\n if (\n metadata.mimePackage !== null &&\n destination === join(SHARE_MIME_PACKAGES, `${settings.applicationId}.xml`)\n ) {\n return \"MIME package\";\n }\n\n return null;\n};\n\nconst warnMetadataCollision = (\n settings: DeploySettings,\n metadata: StagedMetadata,\n file: DeploySettings[\"extraFiles\"][number],\n): void => {\n const kind = generatedMetadataKind(settings, metadata, file.destination);\n\n if (kind !== null) {\n warn(\n `extraFiles source \"${file.source}\" targeting \"${file.destination}\" is overridden by the ` +\n `GTKX-generated ${kind}`,\n );\n }\n};\n\nconst stageExtraFiles = (settings: DeploySettings, root: string, metadata: StagedMetadata): StagedFile[] =>\n settings.extraFiles.map((file) => {\n const source = resolve(settings.paths.root, file.source);\n warnMetadataCollision(settings, metadata, file);\n\n return copyInto(root, file.destination, source, file.mode ?? executableModeFor(source));\n });\n\nconst byRelativePath = (files: StagedFile[]): StagedFile[] => {\n const latest: Map<string, StagedFile> = new Map();\n\n for (const file of files) {\n latest.set(file.rel, file);\n }\n\n return sortStringsBy(latest.values(), (file) => file.rel);\n};\n\nconst stagePayload = ({ settings, node, addon, metadata }: StageRequest): StagedFile[] => {\n const root = settings.paths.stage;\n rmSync(root, { recursive: true, force: true, maxRetries: 5 });\n\n const staged = byRelativePath([\n writeInto(root, join(\"bin\", settings.binaryName), renderLauncher(settings), EXECUTABLE_MODE),\n ...stageNodeBinary(settings, root, node),\n ...stageRuntimeFiles(settings, root),\n ...stageAddon(settings, root, addon),\n ...stageCatalogs(settings, root),\n ...stageExtraFiles(settings, root, metadata),\n ...stageMetadata(settings, root, metadata),\n ...stageIcons(settings, root),\n ...stageSchemas(settings, root),\n ]);\n\n assertStagedArchitecture(settings, staged);\n\n return staged;\n};\n\nconst withoutDbusActivation = (desktopEntry: string): string =>\n desktopEntry\n .split(\"\\n\")\n .filter((line) => line !== \"DBusActivatable=true\")\n .join(\"\\n\");\n\nconst stageActivation = (\n settings: DeploySettings,\n root: string,\n target: DeployTargetName,\n metadata: StagedMetadata,\n): StagedFile[] => {\n if (!settings.isDbusActivatable) {\n return [];\n }\n\n if (target === \"appimage\") {\n return [writeInto(\n root,\n join(SHARE_APPLICATIONS, `${settings.applicationId}.desktop`),\n withoutDbusActivation(metadata.desktopEntry),\n )];\n }\n\n return [writeInto(\n root,\n join(SHARE_DBUS_SERVICES, `${settings.applicationId}.service`),\n renderDbusService(settings, PREFIX_FOR[target]),\n )];\n};\n\nconst stageOverlay = (\n settings: DeploySettings,\n target: DeployTargetName,\n notices: NoticeSection[],\n metadata: StagedMetadata,\n): StagedFile[] => {\n const root = join(settings.paths.overlay, target);\n rmSync(root, { recursive: true, force: true, maxRetries: 5 });\n const licenseFile = settings.paths.licenseFile;\n const activation = stageActivation(settings, root, target, metadata);\n\n if (target === \"deb\") {\n return [\n ...activation,\n writeInto(root, join(SHARE_DOC, settings.binaryName, \"copyright\"), renderCopyright(settings, notices)),\n ];\n }\n\n return [\n ...activation,\n ...(licenseFile === null ? [] : [copyInto(root, licenseDestination(settings), licenseFile)]),\n writeInto(root, noticesDestination(settings), renderNotices(settings, notices)),\n ];\n};\n\nconst stageOverlays = (\n settings: DeploySettings,\n notices: NoticeSection[],\n metadata: StagedMetadata,\n): Record<DeployTargetName, StagedFile[]> => ({\n appimage: stageOverlay(settings, \"appimage\", notices, metadata),\n deb: stageOverlay(settings, \"deb\", notices, metadata),\n flatpak: stageOverlay(settings, \"flatpak\", notices, metadata),\n rpm: stageOverlay(settings, \"rpm\", notices, metadata),\n});\n\nexport {\n licenseDestination,\n nodeLicenseDestination,\n NOTICES_FILENAME,\n noticesDestination,\n type StagedMetadata,\n stageOverlays,\n stagePayload,\n};\n"]}
@@ -1,7 +1,9 @@
1
1
  type DeployOptions = {
2
2
  entry: string;
3
3
  cwd: string;
4
+ configFile?: string | undefined;
4
5
  targets?: string | undefined;
6
+ arches?: string | undefined;
5
7
  outDir?: string | undefined;
6
8
  shouldPrintManifests: boolean;
7
9
  shouldSkipBuild: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"run-deploy.d.ts","sourceRoot":"","sources":["../../src/deploy/run-deploy.ts"],"names":[],"mappings":"AAyDA,KAAK,aAAa,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;CAC5B,CAAC;AA4VF,QAAA,MAAM,SAAS,GAAU,SAAS,aAAa,KAAG,OAAO,CAAC,IAAI,CAsC7D,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"run-deploy.d.ts","sourceRoot":"","sources":["../../src/deploy/run-deploy.ts"],"names":[],"mappings":"AA+DA,KAAK,aAAa,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;CAC5B,CAAC;AA6fF,QAAA,MAAM,SAAS,GAAU,SAAS,aAAa,KAAG,OAAO,CAAC,IAAI,CAwB7D,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,3 +1,55 @@
1
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
2
+ if (value !== null && value !== void 0) {
3
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
+ var dispose, inner;
5
+ if (async) {
6
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
+ dispose = value[Symbol.asyncDispose];
8
+ }
9
+ if (dispose === void 0) {
10
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
+ dispose = value[Symbol.dispose];
12
+ if (async) inner = dispose;
13
+ }
14
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
16
+ env.stack.push({ value: value, dispose: dispose, async: async });
17
+ }
18
+ else if (async) {
19
+ env.stack.push({ async: true });
20
+ }
21
+ return value;
22
+ };
23
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
24
+ return function (env) {
25
+ function fail(e) {
26
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
27
+ env.hasError = true;
28
+ }
29
+ var r, s = 0;
30
+ function next() {
31
+ while (r = env.stack.pop()) {
32
+ try {
33
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
34
+ if (r.dispose) {
35
+ var result = r.dispose.call(r.value);
36
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
37
+ }
38
+ else s |= 1;
39
+ }
40
+ catch (e) {
41
+ fail(e);
42
+ }
43
+ }
44
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
45
+ if (env.hasError) throw env.error;
46
+ }
47
+ return next();
48
+ };
49
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
50
+ var e = new Error(message);
51
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
+ });
1
53
  import { loadConfig } from "@gtkx/config";
2
54
  import { info, warn } from "@gtkx/utils";
3
55
  import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
@@ -7,19 +59,23 @@ import { ensureGenerated } from "../codegen/run-codegen.js";
7
59
  import { replaceCatalogTemplate } from "../i18n/catalog-template.js";
8
60
  import { compileCatalogs, LOCALE_DIRNAME, requiresCatalogInitialization, resolveCatalogProject, synchronizeCatalogs, } from "../i18n/catalogs.js";
9
61
  import { extractSourceCatalogTo } from "../i18n/source-messages.js";
62
+ import { prepareBuildOutDir, resolveBuildOutDir } from "../internal/build-output.js";
10
63
  import { discoverSourceFiles } from "../internal/source-imports.js";
11
64
  import { renderDesktopEntry } from "./freedesktop/desktop-entry.js";
12
65
  import { extractMetadataMessages, localizeMetadata } from "./freedesktop/localize.js";
13
66
  import { renderMetainfo } from "./freedesktop/metainfo.js";
14
67
  import { renderMimePackage } from "./freedesktop/mime-package.js";
15
68
  import { validateDesktopEntry, validateMetainfo } from "./freedesktop/validate.js";
16
- import { resolveNodeRuntime } from "./node-runtime/index.js";
69
+ import { resolveStagedAddon } from "./native-addon.js";
70
+ import { assertPortableRuntimeSource, resolveNodeRuntime } from "./node-runtime/index.js";
17
71
  import { collectNotices } from "./notices/collect.js";
18
72
  import { stageOverlays, stagePayload } from "./payload/stage.js";
19
73
  import { DEFAULT_TARGETS, parseTargetList, targetsFor } from "./registry.js";
74
+ import { archesFor, hostArchName, isHostArch, parseArchList } from "./settings/arch.js";
20
75
  import { readBuildManifest } from "./settings/build-manifest.js";
21
76
  import { resolveDeploySettings } from "./settings/index.js";
22
77
  import { readPackageManifest } from "./settings/package-manifest.js";
78
+ import { prepareDeployOutDir } from "./settings/paths.js";
23
79
  import { missingDeployError } from "./settings/starter.js";
24
80
  import { finishArgsFor, hasDisplaySocket, runtimeLabelFor } from "./targets/flatpak-manifest.js";
25
81
  import { detectPackageManager } from "./targets/flatpak-sources.js";
@@ -122,14 +178,20 @@ const sourceModeTools = (targets, settings) => {
122
178
  return detectPackageManager(settings) === "pnpm" ? [FLATPAK_NODE_GENERATOR_PNPM] : [FLATPAK_NODE_GENERATOR];
123
179
  };
124
180
  const isNodeRequired = (targets, settings) => !(settings.deploy.flatpak?.mode === "source" && targets.every((target) => target.name === FLATPAK_TARGET));
125
- const runtimeToolsFor = (targets, settings) => {
181
+ const archiveToolsFor = (settings) => (settings.deploy.node?.source ?? "download") === "download" ? [TAR] : [];
182
+ const stripToolsFor = (settings, arches) => {
183
+ if (settings.deploy.node?.shouldStrip === false) {
184
+ return [];
185
+ }
186
+ return arches.some((arch) => isHostArch(arch)) ? [STRIP] : [];
187
+ };
188
+ const runtimeToolsFor = (targets, settings, arches) => {
126
189
  if (!isNodeRequired(targets, settings)) {
127
190
  return [];
128
191
  }
129
- const node = settings.deploy.node ?? {};
130
- const archiveTools = (node.source ?? "download") === "download" ? [TAR] : [];
131
- return node.shouldStrip === false ? archiveTools : [...archiveTools, STRIP];
192
+ return [...archiveToolsFor(settings), ...stripToolsFor(settings, arches)];
132
193
  };
194
+ const crossBuildToolsFor = (arches) => arches.every((arch) => isHostArch(arch)) ? [] : [TAR];
133
195
  const mutableCatalogTools = (project) => {
134
196
  if (project.catalogs.length === 0) {
135
197
  return [MSGGREP, XGETTEXT];
@@ -151,34 +213,80 @@ const catalogTools = (project, shouldSkipBuild) => {
151
213
  }
152
214
  return project.catalogs.length === 0 ? [] : [MSGFMT];
153
215
  };
154
- const preflight = ({ targets, settings, project, shouldPrintManifests, shouldSkipBuild, }) => {
216
+ const preflight = ({ plan, settings, shouldPrintManifests, shouldSkipBuild }) => {
217
+ const { targets, arches, project } = plan;
155
218
  const packagerTools = shouldPrintManifests
156
219
  ? []
157
- : [...runtimeToolsFor(targets, settings), ...targets.flatMap((target) => target.tools)];
220
+ : [...runtimeToolsFor(targets, settings, arches), ...targets.flatMap((target) => target.tools)];
158
221
  const required = [
159
222
  DESKTOP_FILE_VALIDATE,
160
223
  APPSTREAMCLI,
224
+ ...crossBuildToolsFor(arches),
161
225
  ...catalogTools(project, shouldSkipBuild),
162
226
  ...sourceModeTools(targets, settings),
163
227
  ];
164
228
  const report = probeTools([...required, ...packagerTools]);
165
229
  assertTools(report);
230
+ if (isNodeRequired(targets, settings)) {
231
+ assertPortableRuntimeSource(settings);
232
+ }
166
233
  warnMissingOptional(report);
167
234
  warnFlatpakPermissions(targets, settings);
168
235
  warnLibraryMinimums(targets, settings);
169
236
  };
170
- const resolveTargetNames = (options, settings) => {
237
+ const hostOnlyNames = (targets) => targets.filter((target) => target.isHostOnly).map((target) => target.name);
238
+ const assertCrossBuild = (plan) => {
239
+ const foreign = plan.arches.filter((arch) => !isHostArch(arch));
240
+ if (foreign.length === 0) {
241
+ return;
242
+ }
243
+ const hostOnly = hostOnlyNames(plan.targets);
244
+ if (hostOnly.length > 0) {
245
+ throw new Error(`Cannot build ${hostOnly.join(" and ")} for ${foreign.join(" and ")}: those targets package with ` +
246
+ `tooling that only runs on ${hostArchName()}. Deploy them in a separate run without --arch.`);
247
+ }
248
+ if ((plan.loaded.deploy.node?.source ?? "download") !== "download") {
249
+ throw new Error('Cannot deploy for another architecture with a `deploy.node.source` other than "download": ' +
250
+ `a host or path runtime is always ${hostArchName()}.`);
251
+ }
252
+ };
253
+ const resolveTargetNames = (options, deploy) => {
171
254
  if (options.targets !== undefined) {
172
255
  return parseTargetList(options.targets);
173
256
  }
174
- return settings.deploy.targets ?? DEFAULT_TARGETS;
257
+ return deploy.targets ?? DEFAULT_TARGETS;
175
258
  };
176
- const loadSettings = async (options) => {
177
- const { config, root } = await loadConfig(options.cwd, { mode: BUILD_MODE });
259
+ const resolveArchNames = (options, deploy) => {
260
+ if (options.arches !== undefined) {
261
+ return parseArchList(options.arches);
262
+ }
263
+ return deploy.architectures ?? [hostArchName()];
264
+ };
265
+ const loadDeployConfig = async (options) => {
266
+ const { config, configFile, root } = await loadConfig(options.cwd, {
267
+ mode: BUILD_MODE,
268
+ configFile: options.configFile,
269
+ });
178
270
  if (config.deploy === undefined) {
179
271
  throw missingDeployError(config.applicationId, readPackageManifest(root));
180
272
  }
181
- return resolveDeploySettings({ root, config, outDirOverride: options.outDir });
273
+ return { config, configFile, root, deploy: config.deploy };
274
+ };
275
+ const settingsFor = (plan, options, arch) => resolveDeploySettings({
276
+ root: plan.loaded.root,
277
+ config: plan.loaded.config,
278
+ configFile: plan.loaded.configFile,
279
+ outDirOverride: options.outDir,
280
+ arch,
281
+ });
282
+ const planDeploy = async (options) => {
283
+ const loaded = await loadDeployConfig(options);
284
+ return {
285
+ loaded,
286
+ targets: targetsFor(resolveTargetNames(options, loaded.deploy)),
287
+ arches: archesFor(resolveArchNames(options, loaded.deploy)),
288
+ project: resolveCatalogProject(loaded.root, loaded.config.applicationId),
289
+ };
182
290
  };
183
291
  const synchronizeMetadataCatalogs = async (settings, templates, project) => {
184
292
  if (project === null) {
@@ -200,30 +308,47 @@ const synchronizeMetadataCatalogs = async (settings, templates, project) => {
200
308
  rmSync(stagingDir, { recursive: true, force: true });
201
309
  }
202
310
  };
203
- const buildPayload = async (options, settings, targets, project) => {
204
- const templates = renderMetadata(settings);
205
- if (!options.shouldSkipBuild) {
311
+ const buildApplication = async ({ options, plan, settings, buildOutDir, }) => {
312
+ const env_1 = { stack: [], error: void 0, hasError: false };
313
+ try {
314
+ const templates = renderMetadata(settings);
315
+ if (buildOutDir === null) {
316
+ if (plan.project !== null) {
317
+ compileCatalogs(plan.project, join(settings.paths.dist, LOCALE_DIRNAME));
318
+ }
319
+ return localizeMetadata(templates, plan.project);
320
+ }
206
321
  info(`Building ${options.entry}`);
322
+ const preparedOutput = __addDisposableResource(env_1, prepareBuildOutDir(settings.paths.root, buildOutDir), false);
207
323
  await buildApp({
208
324
  entry: options.entry,
209
- vite: { root: options.cwd },
325
+ configFile: options.configFile,
326
+ vite: { root: options.cwd, build: { outDir: preparedOutput.path, emptyOutDir: false } },
210
327
  });
211
- await synchronizeMetadataCatalogs(settings, templates, project);
328
+ preparedOutput.commit();
329
+ await synchronizeMetadataCatalogs(settings, templates, plan.project);
330
+ return localizeMetadata(templates, plan.project);
212
331
  }
213
- else if (project !== null) {
214
- compileCatalogs(project, join(settings.paths.dist, LOCALE_DIRNAME));
332
+ catch (e_1) {
333
+ env_1.error = e_1;
334
+ env_1.hasError = true;
335
+ }
336
+ finally {
337
+ __disposeResources(env_1);
215
338
  }
216
- const metadata = localizeMetadata(templates, project);
217
- validateMetadata(settings, metadata, isFlathubSubmission(settings, targets));
218
- const buildManifest = readBuildManifest(settings);
339
+ };
340
+ const buildArchPayload = async ({ options, plan, settings, metadata, }) => {
341
+ validateMetadata(settings, metadata, isFlathubSubmission(settings, plan.targets));
342
+ const buildManifest = readBuildManifest(settings, plan.loaded);
219
343
  const builtSettings = {
220
344
  ...settings,
221
345
  paths: { ...settings.paths, schemaFiles: buildManifest.schemaFiles },
222
346
  };
223
- const node = options.shouldPrintManifests || !isNodeRequired(targets, builtSettings)
347
+ const node = options.shouldPrintManifests || !isNodeRequired(plan.targets, builtSettings)
224
348
  ? null
225
349
  : await resolveNodeRuntime(builtSettings);
226
- const stage = stagePayload({ settings: builtSettings, node, metadata });
350
+ const addon = await resolveStagedAddon(builtSettings);
351
+ const stage = stagePayload({ settings: builtSettings, node, addon, metadata });
227
352
  info(`Staged ${String(stage.length)} files into ${displayPath(builtSettings, builtSettings.paths.stage)}`);
228
353
  const notices = collectNotices({ settings: builtSettings, node, packages: buildManifest.packages });
229
354
  return {
@@ -257,42 +382,62 @@ const packTargets = async (rendered, payload) => {
257
382
  }
258
383
  return artifacts;
259
384
  };
260
- const announce = (settings, targets) => {
261
- const names = targets.map((target) => target.name).join(", ");
385
+ const announce = (settings, plan) => {
386
+ const names = plan.targets.map((target) => target.name).join(", ");
262
387
  const version = `${settings.versions.packageVersion}-${settings.versions.debRevision}`;
263
- info(`Deploying ${settings.name} ${version} as ${settings.binaryName} (${settings.arch.rpm}) to ${names}`);
388
+ const arches = plan.arches.join(", ");
389
+ info(`Deploying ${settings.name} ${version} as ${settings.binaryName} (${arches}) to ${names}`);
264
390
  };
265
- const runDeploy = async (options) => {
266
- let settings = await loadSettings(options);
267
- let project = resolveCatalogProject(settings.paths.root, settings.applicationId);
268
- let targets = targetsFor(resolveTargetNames(options, settings));
269
- announce(settings, targets);
270
- preflight({
271
- targets,
272
- settings,
273
- project,
274
- shouldPrintManifests: options.shouldPrintManifests,
275
- shouldSkipBuild: options.shouldSkipBuild,
276
- });
277
- if (!options.shouldSkipBuild) {
278
- await ensureGenerated(options.cwd, {
279
- shouldAnnounce: true,
280
- mode: BUILD_MODE,
281
- });
282
- settings = await loadSettings(options);
283
- project = resolveCatalogProject(settings.paths.root, settings.applicationId);
284
- targets = targetsFor(resolveTargetNames(options, settings));
285
- }
286
- const payload = await buildPayload(options, settings, targets, project);
287
- const rendered = renderTargetManifests(targets, payload);
391
+ const deployArch = async (request) => {
392
+ const { options, plan, arch, metadata } = request;
393
+ const settings = settingsFor(plan, options, arch);
394
+ const payload = await buildArchPayload({ options, plan, settings, metadata });
395
+ const rendered = renderTargetManifests(plan.targets, payload);
288
396
  if (options.shouldPrintManifests) {
289
397
  const count = rendered.values().toArray().flat().length;
290
- info(`Wrote ${String(count)} manifests, 0 packages built`);
398
+ info(`Wrote ${String(count)} manifests for ${arch}, 0 packages built`);
399
+ return [];
400
+ }
401
+ return await packTargets(rendered, payload);
402
+ };
403
+ const regenerate = async (options, plan) => {
404
+ if (options.shouldSkipBuild) {
405
+ return plan;
406
+ }
407
+ await ensureGenerated(options.cwd, {
408
+ shouldAnnounce: true,
409
+ mode: BUILD_MODE,
410
+ configFile: options.configFile,
411
+ });
412
+ return await planDeploy(options);
413
+ };
414
+ const finish = (options, settings, artifacts) => {
415
+ if (options.shouldPrintManifests) {
291
416
  return;
292
417
  }
293
- const artifacts = await packTargets(rendered, payload);
294
418
  const output = displayPath(settings, settings.paths.output);
295
419
  info(`Deploy complete: ${String(artifacts.length)} artifacts in ${output}`);
296
420
  };
421
+ const runDeploy = async (options) => {
422
+ const planned = await planDeploy(options);
423
+ assertCrossBuild(planned);
424
+ announce(settingsFor(planned, options, planned.arches[0]), planned);
425
+ preflight({
426
+ plan: planned,
427
+ settings: settingsFor(planned, options, planned.arches[0]),
428
+ shouldPrintManifests: options.shouldPrintManifests,
429
+ shouldSkipBuild: options.shouldSkipBuild,
430
+ });
431
+ const plan = await regenerate(options, planned);
432
+ const settings = settingsFor(plan, options, plan.arches[0]);
433
+ const buildOutDir = options.shouldSkipBuild ? null : resolveBuildOutDir(settings.paths.root, settings.paths.dist);
434
+ prepareDeployOutDir(settings.paths.root, settings.paths.outDir);
435
+ const metadata = await buildApplication({ options, plan, settings, buildOutDir });
436
+ const artifacts = [];
437
+ for (const arch of plan.arches) {
438
+ artifacts.push(...await deployArch({ options, plan, arch, metadata }));
439
+ }
440
+ finish(options, settings, artifacts);
441
+ };
297
442
  export { runDeploy };
298
443
  //# sourceMappingURL=run-deploy.js.map