@gtkx/cli 1.0.0 → 1.1.0

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 (449) hide show
  1. package/README.md +1 -1
  2. package/dist/builder.d.ts +1 -1
  3. package/dist/builder.d.ts.map +1 -1
  4. package/dist/builder.js +20 -3
  5. package/dist/builder.js.map +1 -1
  6. package/dist/cli.js +6 -2
  7. package/dist/cli.js.map +1 -1
  8. package/dist/codegen/freshness.js +2 -2
  9. package/dist/codegen/freshness.js.map +1 -1
  10. package/dist/codegen/run-codegen.d.ts +8 -5
  11. package/dist/codegen/run-codegen.d.ts.map +1 -1
  12. package/dist/codegen/run-codegen.js +24 -19
  13. package/dist/codegen/run-codegen.js.map +1 -1
  14. package/dist/codegen/store-resolver.d.ts +1 -1
  15. package/dist/codegen/store-resolver.d.ts.map +1 -1
  16. package/dist/codegen/store-resolver.js.map +1 -1
  17. package/dist/commands/build.d.ts.map +1 -1
  18. package/dist/commands/build.js +5 -6
  19. package/dist/commands/build.js.map +1 -1
  20. package/dist/commands/codegen.d.ts.map +1 -1
  21. package/dist/commands/codegen.js +11 -1
  22. package/dist/commands/codegen.js.map +1 -1
  23. package/dist/commands/deploy.d.ts +22 -0
  24. package/dist/commands/deploy.d.ts.map +1 -0
  25. package/dist/commands/deploy.js +44 -0
  26. package/dist/commands/deploy.js.map +1 -0
  27. package/dist/commands/dev.d.ts.map +1 -1
  28. package/dist/commands/dev.js +4 -4
  29. package/dist/commands/dev.js.map +1 -1
  30. package/dist/commands/docs.d.ts +2 -2
  31. package/dist/commands/docs.d.ts.map +1 -1
  32. package/dist/commands/docs.js +27 -4
  33. package/dist/commands/docs.js.map +1 -1
  34. package/dist/deploy/depends.d.ts +8 -0
  35. package/dist/deploy/depends.d.ts.map +1 -0
  36. package/dist/deploy/depends.js +27 -0
  37. package/dist/deploy/depends.js.map +1 -0
  38. package/dist/deploy/download.d.ts +20 -0
  39. package/dist/deploy/download.d.ts.map +1 -0
  40. package/dist/deploy/download.js +98 -0
  41. package/dist/deploy/download.js.map +1 -0
  42. package/dist/deploy/freedesktop/copyright.d.ts +4 -0
  43. package/dist/deploy/freedesktop/copyright.d.ts.map +1 -0
  44. package/dist/deploy/freedesktop/copyright.js +33 -0
  45. package/dist/deploy/freedesktop/copyright.js.map +1 -0
  46. package/dist/deploy/freedesktop/dbus-service.d.ts +4 -0
  47. package/dist/deploy/freedesktop/dbus-service.d.ts.map +1 -0
  48. package/dist/deploy/freedesktop/dbus-service.js +15 -0
  49. package/dist/deploy/freedesktop/dbus-service.js.map +1 -0
  50. package/dist/deploy/freedesktop/desktop-entry.d.ts +4 -0
  51. package/dist/deploy/freedesktop/desktop-entry.d.ts.map +1 -0
  52. package/dist/deploy/freedesktop/desktop-entry.js +73 -0
  53. package/dist/deploy/freedesktop/desktop-entry.js.map +1 -0
  54. package/dist/deploy/freedesktop/ini.d.ts +7 -0
  55. package/dist/deploy/freedesktop/ini.d.ts.map +1 -0
  56. package/dist/deploy/freedesktop/ini.js +22 -0
  57. package/dist/deploy/freedesktop/ini.js.map +1 -0
  58. package/dist/deploy/freedesktop/metainfo-sections.d.ts +13 -0
  59. package/dist/deploy/freedesktop/metainfo-sections.d.ts.map +1 -0
  60. package/dist/deploy/freedesktop/metainfo-sections.js +73 -0
  61. package/dist/deploy/freedesktop/metainfo-sections.js.map +1 -0
  62. package/dist/deploy/freedesktop/metainfo.d.ts +4 -0
  63. package/dist/deploy/freedesktop/metainfo.d.ts.map +1 -0
  64. package/dist/deploy/freedesktop/metainfo.js +29 -0
  65. package/dist/deploy/freedesktop/metainfo.js.map +1 -0
  66. package/dist/deploy/freedesktop/mime-package.d.ts +4 -0
  67. package/dist/deploy/freedesktop/mime-package.d.ts.map +1 -0
  68. package/dist/deploy/freedesktop/mime-package.js +16 -0
  69. package/dist/deploy/freedesktop/mime-package.js.map +1 -0
  70. package/dist/deploy/freedesktop/validate.d.ts +4 -0
  71. package/dist/deploy/freedesktop/validate.d.ts.map +1 -0
  72. package/dist/deploy/freedesktop/validate.js +81 -0
  73. package/dist/deploy/freedesktop/validate.js.map +1 -0
  74. package/dist/deploy/freedesktop/xml.d.ts +11 -0
  75. package/dist/deploy/freedesktop/xml.d.ts.map +1 -0
  76. package/dist/deploy/freedesktop/xml.js +33 -0
  77. package/dist/deploy/freedesktop/xml.js.map +1 -0
  78. package/dist/deploy/git.d.ts +4 -0
  79. package/dist/deploy/git.d.ts.map +1 -0
  80. package/dist/deploy/git.js +17 -0
  81. package/dist/deploy/git.js.map +1 -0
  82. package/dist/deploy/install-hints.d.ts +5 -0
  83. package/dist/deploy/install-hints.d.ts.map +1 -0
  84. package/dist/deploy/install-hints.js +85 -0
  85. package/dist/deploy/install-hints.js.map +1 -0
  86. package/dist/deploy/nfpm/config.d.ts +8 -0
  87. package/dist/deploy/nfpm/config.d.ts.map +1 -0
  88. package/dist/deploy/nfpm/config.js +119 -0
  89. package/dist/deploy/nfpm/config.js.map +1 -0
  90. package/dist/deploy/nfpm/contents.d.ts +12 -0
  91. package/dist/deploy/nfpm/contents.d.ts.map +1 -0
  92. package/dist/deploy/nfpm/contents.js +48 -0
  93. package/dist/deploy/nfpm/contents.js.map +1 -0
  94. package/dist/deploy/nfpm/description.d.ts +5 -0
  95. package/dist/deploy/nfpm/description.d.ts.map +1 -0
  96. package/dist/deploy/nfpm/description.js +5 -0
  97. package/dist/deploy/nfpm/description.js.map +1 -0
  98. package/dist/deploy/nfpm/optional.d.ts +5 -0
  99. package/dist/deploy/nfpm/optional.d.ts.map +1 -0
  100. package/dist/deploy/nfpm/optional.js +4 -0
  101. package/dist/deploy/nfpm/optional.js.map +1 -0
  102. package/dist/deploy/nfpm/pack.d.ts +5 -0
  103. package/dist/deploy/nfpm/pack.d.ts.map +1 -0
  104. package/dist/deploy/nfpm/pack.js +32 -0
  105. package/dist/deploy/nfpm/pack.js.map +1 -0
  106. package/dist/deploy/node-runtime/download.d.ts +3 -0
  107. package/dist/deploy/node-runtime/download.d.ts.map +1 -0
  108. package/dist/deploy/node-runtime/download.js +39 -0
  109. package/dist/deploy/node-runtime/download.js.map +1 -0
  110. package/dist/deploy/node-runtime/elf.d.ts +7 -0
  111. package/dist/deploy/node-runtime/elf.d.ts.map +1 -0
  112. package/dist/deploy/node-runtime/elf.js +100 -0
  113. package/dist/deploy/node-runtime/elf.js.map +1 -0
  114. package/dist/deploy/node-runtime/guard.d.ts +4 -0
  115. package/dist/deploy/node-runtime/guard.d.ts.map +1 -0
  116. package/dist/deploy/node-runtime/guard.js +22 -0
  117. package/dist/deploy/node-runtime/guard.js.map +1 -0
  118. package/dist/deploy/node-runtime/index.d.ts +4 -0
  119. package/dist/deploy/node-runtime/index.d.ts.map +1 -0
  120. package/dist/deploy/node-runtime/index.js +61 -0
  121. package/dist/deploy/node-runtime/index.js.map +1 -0
  122. package/dist/deploy/payload/copy-tree.d.ts +7 -0
  123. package/dist/deploy/payload/copy-tree.d.ts.map +1 -0
  124. package/dist/deploy/payload/copy-tree.js +36 -0
  125. package/dist/deploy/payload/copy-tree.js.map +1 -0
  126. package/dist/deploy/payload/icons.d.ts +6 -0
  127. package/dist/deploy/payload/icons.d.ts.map +1 -0
  128. package/dist/deploy/payload/icons.js +53 -0
  129. package/dist/deploy/payload/icons.js.map +1 -0
  130. package/dist/deploy/payload/launcher.d.ts +5 -0
  131. package/dist/deploy/payload/launcher.d.ts.map +1 -0
  132. package/dist/deploy/payload/launcher.js +22 -0
  133. package/dist/deploy/payload/launcher.js.map +1 -0
  134. package/dist/deploy/payload/schemas.d.ts +4 -0
  135. package/dist/deploy/payload/schemas.d.ts.map +1 -0
  136. package/dist/deploy/payload/schemas.js +17 -0
  137. package/dist/deploy/payload/schemas.js.map +1 -0
  138. package/dist/deploy/payload/stage.d.ts +15 -0
  139. package/dist/deploy/payload/stage.d.ts.map +1 -0
  140. package/dist/deploy/payload/stage.js +100 -0
  141. package/dist/deploy/payload/stage.js.map +1 -0
  142. package/dist/deploy/registry.d.ts +7 -0
  143. package/dist/deploy/registry.d.ts.map +1 -0
  144. package/dist/deploy/registry.js +30 -0
  145. package/dist/deploy/registry.js.map +1 -0
  146. package/dist/deploy/run-deploy.d.ts +11 -0
  147. package/dist/deploy/run-deploy.d.ts.map +1 -0
  148. package/dist/deploy/run-deploy.js +153 -0
  149. package/dist/deploy/run-deploy.js.map +1 -0
  150. package/dist/deploy/settings/arch.d.ts +4 -0
  151. package/dist/deploy/settings/arch.d.ts.map +1 -0
  152. package/dist/deploy/settings/arch.js +13 -0
  153. package/dist/deploy/settings/arch.js.map +1 -0
  154. package/dist/deploy/settings/categories.d.ts +4 -0
  155. package/dist/deploy/settings/categories.d.ts.map +1 -0
  156. package/dist/deploy/settings/categories.js +29 -0
  157. package/dist/deploy/settings/categories.js.map +1 -0
  158. package/dist/deploy/settings/exec.d.ts +6 -0
  159. package/dist/deploy/settings/exec.d.ts.map +1 -0
  160. package/dist/deploy/settings/exec.js +20 -0
  161. package/dist/deploy/settings/exec.js.map +1 -0
  162. package/dist/deploy/settings/identity.d.ts +18 -0
  163. package/dist/deploy/settings/identity.d.ts.map +1 -0
  164. package/dist/deploy/settings/identity.js +73 -0
  165. package/dist/deploy/settings/identity.js.map +1 -0
  166. package/dist/deploy/settings/index.d.ts +11 -0
  167. package/dist/deploy/settings/index.d.ts.map +1 -0
  168. package/dist/deploy/settings/index.js +103 -0
  169. package/dist/deploy/settings/index.js.map +1 -0
  170. package/dist/deploy/settings/package-manifest.d.ts +15 -0
  171. package/dist/deploy/settings/package-manifest.d.ts.map +1 -0
  172. package/dist/deploy/settings/package-manifest.js +41 -0
  173. package/dist/deploy/settings/package-manifest.js.map +1 -0
  174. package/dist/deploy/settings/paths.d.ts +9 -0
  175. package/dist/deploy/settings/paths.d.ts.map +1 -0
  176. package/dist/deploy/settings/paths.js +82 -0
  177. package/dist/deploy/settings/paths.js.map +1 -0
  178. package/dist/deploy/settings/screenshots.d.ts +8 -0
  179. package/dist/deploy/settings/screenshots.d.ts.map +1 -0
  180. package/dist/deploy/settings/screenshots.js +79 -0
  181. package/dist/deploy/settings/screenshots.js.map +1 -0
  182. package/dist/deploy/settings/starter.d.ts +4 -0
  183. package/dist/deploy/settings/starter.d.ts.map +1 -0
  184. package/dist/deploy/settings/starter.js +28 -0
  185. package/dist/deploy/settings/starter.js.map +1 -0
  186. package/dist/deploy/settings/version.d.ts +9 -0
  187. package/dist/deploy/settings/version.d.ts.map +1 -0
  188. package/dist/deploy/settings/version.js +37 -0
  189. package/dist/deploy/settings/version.js.map +1 -0
  190. package/dist/deploy/targets/appimage.d.ts +4 -0
  191. package/dist/deploy/targets/appimage.d.ts.map +1 -0
  192. package/dist/deploy/targets/appimage.js +105 -0
  193. package/dist/deploy/targets/appimage.js.map +1 -0
  194. package/dist/deploy/targets/deb.d.ts +4 -0
  195. package/dist/deploy/targets/deb.d.ts.map +1 -0
  196. package/dist/deploy/targets/deb.js +4 -0
  197. package/dist/deploy/targets/deb.js.map +1 -0
  198. package/dist/deploy/targets/flatpak-manifest.d.ts +6 -0
  199. package/dist/deploy/targets/flatpak-manifest.d.ts.map +1 -0
  200. package/dist/deploy/targets/flatpak-manifest.js +48 -0
  201. package/dist/deploy/targets/flatpak-manifest.js.map +1 -0
  202. package/dist/deploy/targets/flatpak-prebuilt.d.ts +8 -0
  203. package/dist/deploy/targets/flatpak-prebuilt.d.ts.map +1 -0
  204. package/dist/deploy/targets/flatpak-prebuilt.js +43 -0
  205. package/dist/deploy/targets/flatpak-prebuilt.js.map +1 -0
  206. package/dist/deploy/targets/flatpak-source.d.ts +5 -0
  207. package/dist/deploy/targets/flatpak-source.d.ts.map +1 -0
  208. package/dist/deploy/targets/flatpak-source.js +110 -0
  209. package/dist/deploy/targets/flatpak-source.js.map +1 -0
  210. package/dist/deploy/targets/flatpak-sources.d.ts +17 -0
  211. package/dist/deploy/targets/flatpak-sources.d.ts.map +1 -0
  212. package/dist/deploy/targets/flatpak-sources.js +108 -0
  213. package/dist/deploy/targets/flatpak-sources.js.map +1 -0
  214. package/dist/deploy/targets/flatpak.d.ts +4 -0
  215. package/dist/deploy/targets/flatpak.d.ts.map +1 -0
  216. package/dist/deploy/targets/flatpak.js +112 -0
  217. package/dist/deploy/targets/flatpak.js.map +1 -0
  218. package/dist/deploy/targets/nfpm-target.d.ts +5 -0
  219. package/dist/deploy/targets/nfpm-target.d.ts.map +1 -0
  220. package/dist/deploy/targets/nfpm-target.js +26 -0
  221. package/dist/deploy/targets/nfpm-target.js.map +1 -0
  222. package/dist/deploy/targets/rpm.d.ts +4 -0
  223. package/dist/deploy/targets/rpm.d.ts.map +1 -0
  224. package/dist/deploy/targets/rpm.js +4 -0
  225. package/dist/deploy/targets/rpm.js.map +1 -0
  226. package/dist/deploy/tools.d.ts +18 -0
  227. package/dist/deploy/tools.d.ts.map +1 -0
  228. package/dist/deploy/tools.js +92 -0
  229. package/dist/deploy/tools.js.map +1 -0
  230. package/dist/deploy/types.d.ts +140 -0
  231. package/dist/deploy/types.d.ts.map +1 -0
  232. package/dist/deploy/types.js +2 -0
  233. package/dist/deploy/types.js.map +1 -0
  234. package/dist/deploy/vendored/appimagetool.d.ts +7 -0
  235. package/dist/deploy/vendored/appimagetool.d.ts.map +1 -0
  236. package/dist/deploy/vendored/appimagetool.js +42 -0
  237. package/dist/deploy/vendored/appimagetool.js.map +1 -0
  238. package/dist/deploy/vendored/nfpm.d.ts +3 -0
  239. package/dist/deploy/vendored/nfpm.d.ts.map +1 -0
  240. package/dist/deploy/vendored/nfpm.js +60 -0
  241. package/dist/deploy/vendored/nfpm.js.map +1 -0
  242. package/dist/dev/change-queue.d.ts +11 -0
  243. package/dist/dev/change-queue.d.ts.map +1 -0
  244. package/dist/dev/change-queue.js +34 -0
  245. package/dist/dev/change-queue.js.map +1 -0
  246. package/dist/dev/failure-tracker.d.ts +10 -0
  247. package/dist/dev/failure-tracker.d.ts.map +1 -0
  248. package/dist/dev/failure-tracker.js +61 -0
  249. package/dist/dev/failure-tracker.js.map +1 -0
  250. package/dist/dev/missing-import.d.ts +4 -0
  251. package/dist/dev/missing-import.d.ts.map +1 -0
  252. package/dist/dev/missing-import.js +23 -0
  253. package/dist/dev/missing-import.js.map +1 -0
  254. package/dist/dev/runner-deps.d.ts.map +1 -1
  255. package/dist/dev/runner-deps.js +25 -6
  256. package/dist/dev/runner-deps.js.map +1 -1
  257. package/dist/dev/runner.d.ts +8 -4
  258. package/dist/dev/runner.d.ts.map +1 -1
  259. package/dist/dev/runner.js +334 -66
  260. package/dist/dev/runner.js.map +1 -1
  261. package/dist/dev/supervisor.d.ts +1 -2
  262. package/dist/dev/supervisor.d.ts.map +1 -1
  263. package/dist/dev/supervisor.js +1 -1
  264. package/dist/dev/supervisor.js.map +1 -1
  265. package/dist/dev/vite-dev-server.d.ts +13 -2
  266. package/dist/dev/vite-dev-server.d.ts.map +1 -1
  267. package/dist/dev/vite-dev-server.js +30 -2
  268. package/dist/dev/vite-dev-server.js.map +1 -1
  269. package/dist/internal/entry-arg.d.ts +1 -7
  270. package/dist/internal/entry-arg.d.ts.map +1 -1
  271. package/dist/internal/entry-arg.js +18 -11
  272. package/dist/internal/entry-arg.js.map +1 -1
  273. package/dist/internal/module-loads.d.ts +7 -0
  274. package/dist/internal/module-loads.d.ts.map +1 -0
  275. package/dist/internal/module-loads.js +21 -0
  276. package/dist/internal/module-loads.js.map +1 -0
  277. package/dist/internal/prepare-project.d.ts +16 -0
  278. package/dist/internal/prepare-project.d.ts.map +1 -0
  279. package/dist/internal/prepare-project.js +15 -0
  280. package/dist/internal/prepare-project.js.map +1 -0
  281. package/dist/internal/run-cli-tool.d.ts +2 -1
  282. package/dist/internal/run-cli-tool.d.ts.map +1 -1
  283. package/dist/internal/run-cli-tool.js +15 -6
  284. package/dist/internal/run-cli-tool.js.map +1 -1
  285. package/dist/internal/staging-dir.d.ts +8 -1
  286. package/dist/internal/staging-dir.d.ts.map +1 -1
  287. package/dist/internal/staging-dir.js +38 -2
  288. package/dist/internal/staging-dir.js.map +1 -1
  289. package/dist/mcp/serialize-widget.d.ts +2 -1
  290. package/dist/mcp/serialize-widget.d.ts.map +1 -1
  291. package/dist/mcp/serialize-widget.js +1 -1
  292. package/dist/mcp/serialize-widget.js.map +1 -1
  293. package/dist/mcp/testing-loader.d.ts +5 -2
  294. package/dist/mcp/testing-loader.d.ts.map +1 -1
  295. package/dist/mcp/testing-loader.js +7 -3
  296. package/dist/mcp/testing-loader.js.map +1 -1
  297. package/dist/refresh-runtime.d.ts +2 -1
  298. package/dist/refresh-runtime.d.ts.map +1 -1
  299. package/dist/refresh-runtime.js +32 -2
  300. package/dist/refresh-runtime.js.map +1 -1
  301. package/dist/settings/schema.d.ts +1 -2
  302. package/dist/settings/schema.d.ts.map +1 -1
  303. package/dist/settings/schema.js +1 -1
  304. package/dist/settings/schema.js.map +1 -1
  305. package/dist/vite-plugins/asset-extensions.d.ts +2 -1
  306. package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
  307. package/dist/vite-plugins/asset-extensions.js +2 -1
  308. package/dist/vite-plugins/asset-extensions.js.map +1 -1
  309. package/dist/vite-plugins/asset-imports.d.ts +4 -0
  310. package/dist/vite-plugins/asset-imports.d.ts.map +1 -0
  311. package/dist/vite-plugins/asset-imports.js +88 -0
  312. package/dist/vite-plugins/asset-imports.js.map +1 -0
  313. package/dist/vite-plugins/asset-specifier.d.ts +5 -0
  314. package/dist/vite-plugins/asset-specifier.d.ts.map +1 -0
  315. package/dist/vite-plugins/asset-specifier.js +7 -0
  316. package/dist/vite-plugins/asset-specifier.js.map +1 -0
  317. package/dist/vite-plugins/esm-extension.d.ts +4 -0
  318. package/dist/vite-plugins/esm-extension.d.ts.map +1 -0
  319. package/dist/vite-plugins/esm-extension.js +4 -0
  320. package/dist/vite-plugins/esm-extension.js.map +1 -0
  321. package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts +1 -3
  322. package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts.map +1 -1
  323. package/dist/vite-plugins/fast-refresh/swc-refresh.js +1 -1
  324. package/dist/vite-plugins/fast-refresh/swc-refresh.js.map +1 -1
  325. package/dist/vite-plugins/index.d.ts.map +1 -1
  326. package/dist/vite-plugins/index.js +4 -0
  327. package/dist/vite-plugins/index.js.map +1 -1
  328. package/dist/vite-plugins/resource-shared.d.ts +2 -1
  329. package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
  330. package/dist/vite-plugins/resource-shared.js +2 -1
  331. package/dist/vite-plugins/resource-shared.js.map +1 -1
  332. package/dist/vite-plugins/resources.d.ts.map +1 -1
  333. package/dist/vite-plugins/resources.js +30 -29
  334. package/dist/vite-plugins/resources.js.map +1 -1
  335. package/dist/vite-plugins/self-contained.d.ts +4 -0
  336. package/dist/vite-plugins/self-contained.d.ts.map +1 -0
  337. package/dist/vite-plugins/self-contained.js +244 -0
  338. package/dist/vite-plugins/self-contained.js.map +1 -0
  339. package/dist/vite-plugins/settings.d.ts.map +1 -1
  340. package/dist/vite-plugins/settings.js +19 -40
  341. package/dist/vite-plugins/settings.js.map +1 -1
  342. package/dist/vite-plugins/store-links.d.ts +4 -0
  343. package/dist/vite-plugins/store-links.d.ts.map +1 -0
  344. package/dist/vite-plugins/store-links.js +19 -0
  345. package/dist/vite-plugins/store-links.js.map +1 -0
  346. package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
  347. package/dist/vite-plugins/undeclared-library.js +51 -12
  348. package/dist/vite-plugins/undeclared-library.js.map +1 -1
  349. package/dist/vite-plugins/worker.d.ts.map +1 -1
  350. package/dist/vite-plugins/worker.js +3 -1
  351. package/dist/vite-plugins/worker.js.map +1 -1
  352. package/env.d.ts +106 -25
  353. package/package.json +20 -13
  354. package/src/builder.ts +22 -4
  355. package/src/cli.ts +7 -2
  356. package/src/codegen/freshness.ts +2 -2
  357. package/src/codegen/run-codegen.ts +37 -23
  358. package/src/codegen/store-resolver.ts +1 -1
  359. package/src/commands/build.ts +5 -6
  360. package/src/commands/codegen.ts +14 -1
  361. package/src/commands/deploy.ts +47 -0
  362. package/src/commands/dev.ts +4 -4
  363. package/src/commands/docs.ts +39 -4
  364. package/src/deploy/depends.ts +42 -0
  365. package/src/deploy/download.ts +148 -0
  366. package/src/deploy/freedesktop/copyright.ts +41 -0
  367. package/src/deploy/freedesktop/dbus-service.ts +19 -0
  368. package/src/deploy/freedesktop/desktop-entry.ts +102 -0
  369. package/src/deploy/freedesktop/ini.ts +39 -0
  370. package/src/deploy/freedesktop/metainfo-sections.ts +116 -0
  371. package/src/deploy/freedesktop/metainfo.ts +46 -0
  372. package/src/deploy/freedesktop/mime-package.ts +28 -0
  373. package/src/deploy/freedesktop/validate.ts +124 -0
  374. package/src/deploy/freedesktop/xml.ts +53 -0
  375. package/src/deploy/git.ts +20 -0
  376. package/src/deploy/install-hints.ts +108 -0
  377. package/src/deploy/nfpm/config.ts +153 -0
  378. package/src/deploy/nfpm/contents.ts +69 -0
  379. package/src/deploy/nfpm/description.ts +11 -0
  380. package/src/deploy/nfpm/optional.ts +8 -0
  381. package/src/deploy/nfpm/pack.ts +44 -0
  382. package/src/deploy/node-runtime/download.ts +48 -0
  383. package/src/deploy/node-runtime/elf.ts +145 -0
  384. package/src/deploy/node-runtime/guard.ts +29 -0
  385. package/src/deploy/node-runtime/index.ts +80 -0
  386. package/src/deploy/payload/copy-tree.ts +51 -0
  387. package/src/deploy/payload/icons.ts +80 -0
  388. package/src/deploy/payload/launcher.ts +27 -0
  389. package/src/deploy/payload/schemas.ts +27 -0
  390. package/src/deploy/payload/stage.ts +145 -0
  391. package/src/deploy/registry.ts +40 -0
  392. package/src/deploy/run-deploy.ts +235 -0
  393. package/src/deploy/settings/arch.ts +18 -0
  394. package/src/deploy/settings/categories.ts +39 -0
  395. package/src/deploy/settings/exec.ts +29 -0
  396. package/src/deploy/settings/identity.ts +133 -0
  397. package/src/deploy/settings/index.ts +189 -0
  398. package/src/deploy/settings/package-manifest.ts +66 -0
  399. package/src/deploy/settings/paths.ts +115 -0
  400. package/src/deploy/settings/screenshots.ts +125 -0
  401. package/src/deploy/settings/starter.ts +41 -0
  402. package/src/deploy/settings/version.ts +59 -0
  403. package/src/deploy/targets/appimage.ts +140 -0
  404. package/src/deploy/targets/deb.ts +6 -0
  405. package/src/deploy/targets/flatpak-manifest.ts +61 -0
  406. package/src/deploy/targets/flatpak-prebuilt.ts +59 -0
  407. package/src/deploy/targets/flatpak-source.ts +168 -0
  408. package/src/deploy/targets/flatpak-sources.ts +171 -0
  409. package/src/deploy/targets/flatpak.ts +143 -0
  410. package/src/deploy/targets/nfpm-target.ts +33 -0
  411. package/src/deploy/targets/rpm.ts +6 -0
  412. package/src/deploy/tools.ts +135 -0
  413. package/src/deploy/types.ts +174 -0
  414. package/src/deploy/vendored/appimagetool.ts +57 -0
  415. package/src/deploy/vendored/nfpm.ts +79 -0
  416. package/src/dev/change-queue.ts +59 -0
  417. package/src/dev/failure-tracker.ts +92 -0
  418. package/src/dev/missing-import.ts +32 -0
  419. package/src/dev/runner-deps.ts +34 -6
  420. package/src/dev/runner.ts +506 -102
  421. package/src/dev/supervisor.ts +0 -3
  422. package/src/dev/vite-dev-server.ts +54 -3
  423. package/src/internal/entry-arg.ts +25 -11
  424. package/src/internal/module-loads.ts +32 -0
  425. package/src/internal/prepare-project.ts +23 -0
  426. package/src/internal/run-cli-tool.ts +22 -6
  427. package/src/internal/staging-dir.ts +57 -2
  428. package/src/mcp/serialize-widget.ts +3 -2
  429. package/src/mcp/testing-loader.ts +19 -4
  430. package/src/refresh-runtime.ts +48 -2
  431. package/src/settings/schema.ts +0 -1
  432. package/src/vite-plugins/asset-extensions.ts +2 -1
  433. package/src/vite-plugins/asset-imports.ts +134 -0
  434. package/src/vite-plugins/asset-specifier.ts +9 -0
  435. package/src/vite-plugins/esm-extension.ts +4 -0
  436. package/src/vite-plugins/fast-refresh/swc-refresh.ts +1 -1
  437. package/src/vite-plugins/index.ts +4 -0
  438. package/src/vite-plugins/resource-shared.ts +2 -0
  439. package/src/vite-plugins/resources.ts +33 -33
  440. package/src/vite-plugins/self-contained.ts +352 -0
  441. package/src/vite-plugins/settings.ts +21 -48
  442. package/src/vite-plugins/store-links.ts +25 -0
  443. package/src/vite-plugins/undeclared-library.ts +74 -12
  444. package/src/vite-plugins/worker.ts +4 -1
  445. package/dist/internal.d.ts +0 -3
  446. package/dist/internal.d.ts.map +0 -1
  447. package/dist/internal.js +0 -3
  448. package/dist/internal.js.map +0 -1
  449. package/src/internal.ts +0 -2
@@ -0,0 +1,22 @@
1
+ const FORBIDDEN_VALUE_CHARACTERS = /[\n\r]/;
2
+ const assertValue = (key, value) => {
3
+ if (FORBIDDEN_VALUE_CHARACTERS.test(value)) {
4
+ throw new Error(`Cannot write "${key}" into a desktop entry: its value contains a line break`);
5
+ }
6
+ };
7
+ const escapeValue = (key, value) => {
8
+ assertValue(key, value);
9
+ return value.replaceAll("\\", "\\\\");
10
+ };
11
+ const escapeListItem = (key, value) => escapeValue(key, value).replaceAll(";", String.raw `\;`);
12
+ const renderList = (key, values) => values.length === 0 ? "" : `${values.map((item) => escapeListItem(key, item)).join(";")};`;
13
+ const renderValue = (key, value) => Array.isArray(value) ? renderList(key, value) : escapeValue(key, value);
14
+ const renderEntry = ([key, value]) => `${key}=${renderValue(key, value)}`;
15
+ const renderGroup = (group) => [
16
+ `[${group.name}]`,
17
+ ...group.entries.map((entry) => renderEntry(entry)),
18
+ ];
19
+ const renderIni = (groups) => [...groups.flatMap((group, index) => (index === 0 ? renderGroup(group) : ["", ...renderGroup(group)])), ""]
20
+ .join("\n");
21
+ export { renderIni };
22
+ //# sourceMappingURL=ini.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ini.js","sourceRoot":"","sources":["../../../src/deploy/freedesktop/ini.ts"],"names":[],"mappings":"AAKA,MAAM,0BAA0B,GAAG,QAAQ,CAAC;AAE5C,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,KAAa,EAAQ,EAAE;IACrD,IAAI,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI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AAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;CACtD,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,MAAkB,EAAU,EAAE,CAC7C,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;KACtG,IAAI,CAAC,IAAI,CAAC,CAAC;AAEpB,OAAO,EAAiB,SAAS,EAAE,CAAC","sourcesContent":["type IniGroup = {\n name: string;\n entries: [string, string | string[]][];\n};\n\nconst FORBIDDEN_VALUE_CHARACTERS = /[\\n\\r]/;\n\nconst assertValue = (key: string, value: string): void => {\n if (FORBIDDEN_VALUE_CHARACTERS.test(value)) {\n throw new Error(`Cannot write \"${key}\" into a desktop entry: its value contains a line break`);\n }\n};\n\nconst escapeValue = (key: string, value: string): string => {\n assertValue(key, value);\n\n return value.replaceAll(\"\\\\\", \"\\\\\\\\\");\n};\n\nconst escapeListItem = (key: string, value: string): string => escapeValue(key, value).replaceAll(\";\", String.raw`\\;`);\n\nconst renderList = (key: string, values: string[]): string =>\n values.length === 0 ? \"\" : `${values.map((item) => escapeListItem(key, item)).join(\";\")};`;\n\nconst renderValue = (key: string, value: string | string[]): string =>\n Array.isArray(value) ? renderList(key, value) : escapeValue(key, value);\n\nconst renderEntry = ([key, value]: [string, string | string[]]): string => `${key}=${renderValue(key, value)}`;\n\nconst renderGroup = (group: IniGroup): string[] => [\n `[${group.name}]`,\n ...group.entries.map((entry) => renderEntry(entry)),\n];\n\nconst renderIni = (groups: IniGroup[]): string =>\n [...groups.flatMap((group, index) => (index === 0 ? renderGroup(group) : [\"\", ...renderGroup(group)])), \"\"]\n .join(\"\\n\");\n\nexport { type IniGroup, renderIni };\n"]}
@@ -0,0 +1,13 @@
1
+ import type { DeploySettings } from "../types.js";
2
+ import { type XmlNode } from "./xml.js";
3
+ declare const developerSection: (settings: DeploySettings) => XmlNode[];
4
+ declare const descriptionSection: (settings: DeploySettings) => XmlNode[];
5
+ declare const providesSection: (settings: DeploySettings) => XmlNode[];
6
+ declare const listSection: (tag: string, itemTag: string, values: string[]) => XmlNode[];
7
+ declare const urlsSection: (settings: DeploySettings) => XmlNode[];
8
+ declare const screenshotsSection: (settings: DeploySettings) => XmlNode[];
9
+ declare const releasesSection: (settings: DeploySettings) => XmlNode[];
10
+ declare const contentRatingSection: (settings: DeploySettings) => XmlNode[];
11
+ declare const brandingSection: (settings: DeploySettings) => XmlNode[];
12
+ export { brandingSection, contentRatingSection, descriptionSection, developerSection, listSection, providesSection, releasesSection, screenshotsSection, urlsSection, };
13
+ //# sourceMappingURL=metainfo-sections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metainfo-sections.d.ts","sourceRoot":"","sources":["../../../src/deploy/freedesktop/metainfo-sections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,UAAU,CAAC;AAMvD,QAAA,MAAM,gBAAgB,GAAI,UAAU,cAAc,KAAG,OAAO,EAI3D,CAAC;AAEF,QAAA,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,OAAO,EAE7D,CAAC;AAEF,QAAA,MAAM,eAAe,GAAI,UAAU,cAAc,KAAG,OAAO,EAK1D,CAAC;AAEF,QAAA,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,EAAE,QAAQ,MAAM,EAAE,KAAG,OAAO,EACiB,CAAC;AAE/F,QAAA,MAAM,WAAW,GAAI,UAAU,cAAc,KAAG,OAAO,EAKtD,CAAC;AAEF,QAAA,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,OAAO,EAgB7D,CAAC;AAgBF,QAAA,MAAM,eAAe,GAAI,UAAU,cAAc,KAAG,OAAO,EAS1D,CAAC;AAEF,QAAA,MAAM,oBAAoB,GAAI,UAAU,cAAc,KAAG,OAAO,EAU/D,CAAC;AAEF,QAAA,MAAM,eAAe,GAAI,UAAU,cAAc,KAAG,OAAO,EAc1D,CAAC;AAEF,OAAO,EACH,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,WAAW,GACd,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { element, text } from "./xml.js";
2
+ const CONTENT_RATING_TYPE = "oars-1.1";
3
+ const DEFAULT_SCREENSHOT_TYPE = "default";
4
+ const PRIMARY_COLOR = "primary";
5
+ const developerSection = (settings) => {
6
+ const attributes = settings.developer.id === null ? {} : { id: settings.developer.id };
7
+ return [element("developer", attributes, [text("name", settings.developer.name)])];
8
+ };
9
+ const descriptionSection = (settings) => [
10
+ element("description", {}, settings.description.map((paragraph) => text("p", paragraph))),
11
+ ];
12
+ const providesSection = (settings) => [
13
+ element("provides", {}, [
14
+ text("binary", settings.binaryName),
15
+ ...settings.mimeTypes.map((mimeType) => text("mediatype", mimeType)),
16
+ ]),
17
+ ];
18
+ const listSection = (tag, itemTag, values) => values.length === 0 ? [] : [element(tag, {}, values.map((value) => text(itemTag, value)))];
19
+ const urlsSection = (settings) => {
20
+ const homepage = settings.homepage === null ? [] : [{ tag: "homepage", url: settings.homepage }];
21
+ const rest = Object.entries(settings.urls).map(([tag, url]) => ({ tag, url }));
22
+ return [...homepage, ...rest].map((entry) => ({ tag: "url", attributes: { type: entry.tag }, text: entry.url }));
23
+ };
24
+ const screenshotsSection = (settings) => {
25
+ if (settings.screenshots.length === 0) {
26
+ return [];
27
+ }
28
+ const entries = settings.screenshots.map((screenshot) => element("screenshot", screenshot.isDefault ? { type: DEFAULT_SCREENSHOT_TYPE } : {}, [
29
+ text("image", screenshot.url),
30
+ ...(screenshot.caption === null ? [] : [text("caption", screenshot.caption)]),
31
+ ]));
32
+ return [element("screenshots", {}, entries)];
33
+ };
34
+ const releaseAttributes = (release) => ({
35
+ version: release.version,
36
+ date: release.date,
37
+ ...(release.type !== null && { type: release.type }),
38
+ ...(release.urgency !== null && { urgency: release.urgency }),
39
+ });
40
+ const releaseChildren = (release) => [
41
+ ...(release.url === null ? [] : [{ tag: "url", attributes: { type: "details" }, text: release.url }]),
42
+ ...(release.notes.length === 0
43
+ ? []
44
+ : [element("description", {}, release.notes.map((note) => text("p", note)))]),
45
+ ];
46
+ const releasesSection = (settings) => {
47
+ if (settings.releases.length === 0) {
48
+ return [];
49
+ }
50
+ const entries = settings.releases.map((release) => element("release", releaseAttributes(release), releaseChildren(release)));
51
+ return [element("releases", {}, entries)];
52
+ };
53
+ const contentRatingSection = (settings) => [
54
+ element("content_rating", { type: CONTENT_RATING_TYPE }, Object.entries(settings.contentRating).map(([id, intensity]) => ({
55
+ tag: "content_attribute",
56
+ attributes: { id },
57
+ text: intensity,
58
+ }))),
59
+ ];
60
+ const brandingSection = (settings) => {
61
+ const branding = settings.branding;
62
+ if (branding === null) {
63
+ return [];
64
+ }
65
+ const color = (scheme, value) => ({
66
+ tag: "color",
67
+ attributes: { type: PRIMARY_COLOR, scheme_preference: scheme },
68
+ text: value,
69
+ });
70
+ return [element("branding", {}, [color("light", branding.light), color("dark", branding.dark)])];
71
+ };
72
+ export { brandingSection, contentRatingSection, descriptionSection, developerSection, listSection, providesSection, releasesSection, screenshotsSection, urlsSection, };
73
+ //# sourceMappingURL=metainfo-sections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metainfo-sections.js","sourceRoot":"","sources":["../../../src/deploy/freedesktop/metainfo-sections.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAgB,MAAM,UAAU,CAAC;AAEvD,MAAM,mBAAmB,GAAG,UAAU,CAAC;AACvC,MAAM,u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AQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACrG,CAAC,CAAC;AAEF,OAAO,EACH,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,WAAW,GACd,CAAC","sourcesContent":["import type { DeployRelease, DeploySettings } from \"../types.js\";\nimport { element, text, type XmlNode } from \"./xml.js\";\n\nconst CONTENT_RATING_TYPE = \"oars-1.1\";\nconst DEFAULT_SCREENSHOT_TYPE = \"default\";\nconst PRIMARY_COLOR = \"primary\";\n\nconst developerSection = (settings: DeploySettings): XmlNode[] => {\n const attributes = settings.developer.id === null ? {} : { id: settings.developer.id };\n\n return [element(\"developer\", attributes, [text(\"name\", settings.developer.name)])];\n};\n\nconst descriptionSection = (settings: DeploySettings): XmlNode[] => [\n element(\"description\", {}, settings.description.map((paragraph) => text(\"p\", paragraph))),\n];\n\nconst providesSection = (settings: DeploySettings): XmlNode[] => [\n element(\"provides\", {}, [\n text(\"binary\", settings.binaryName),\n ...settings.mimeTypes.map((mimeType) => text(\"mediatype\", mimeType)),\n ]),\n];\n\nconst listSection = (tag: string, itemTag: string, values: string[]): XmlNode[] =>\n values.length === 0 ? [] : [element(tag, {}, values.map((value) => text(itemTag, value)))];\n\nconst urlsSection = (settings: DeploySettings): XmlNode[] => {\n const homepage = settings.homepage === null ? [] : [{ tag: \"homepage\", url: settings.homepage }];\n const rest = Object.entries(settings.urls).map(([tag, url]) => ({ tag, url }));\n\n return [...homepage, ...rest].map((entry) => ({ tag: \"url\", attributes: { type: entry.tag }, text: entry.url }));\n};\n\nconst screenshotsSection = (settings: DeploySettings): XmlNode[] => {\n if (settings.screenshots.length === 0) {\n return [];\n }\n\n const entries = settings.screenshots.map((screenshot) =>\n element(\n \"screenshot\",\n screenshot.isDefault ? { type: DEFAULT_SCREENSHOT_TYPE } : {},\n [\n text(\"image\", screenshot.url),\n ...(screenshot.caption === null ? [] : [text(\"caption\", screenshot.caption)]),\n ],\n ));\n\n return [element(\"screenshots\", {}, entries)];\n};\n\nconst releaseAttributes = (release: DeployRelease): Record<string, string> => ({\n version: release.version,\n date: release.date,\n ...(release.type !== null && { type: release.type }),\n ...(release.urgency !== null && { urgency: release.urgency }),\n});\n\nconst releaseChildren = (release: DeployRelease): XmlNode[] => [\n ...(release.url === null ? [] : [{ tag: \"url\", attributes: { type: \"details\" }, text: release.url }]),\n ...(release.notes.length === 0\n ? []\n : [element(\"description\", {}, release.notes.map((note) => text(\"p\", note)))]),\n];\n\nconst releasesSection = (settings: DeploySettings): XmlNode[] => {\n if (settings.releases.length === 0) {\n return [];\n }\n\n const entries = settings.releases.map((release) =>\n element(\"release\", releaseAttributes(release), releaseChildren(release)));\n\n return [element(\"releases\", {}, entries)];\n};\n\nconst contentRatingSection = (settings: DeploySettings): XmlNode[] => [\n element(\n \"content_rating\",\n { type: CONTENT_RATING_TYPE },\n Object.entries(settings.contentRating).map(([id, intensity]) => ({\n tag: \"content_attribute\",\n attributes: { id },\n text: intensity,\n })),\n ),\n];\n\nconst brandingSection = (settings: DeploySettings): XmlNode[] => {\n const branding = settings.branding;\n\n if (branding === null) {\n return [];\n }\n\n const color = (scheme: string, value: string): XmlNode => ({\n tag: \"color\",\n attributes: { type: PRIMARY_COLOR, scheme_preference: scheme },\n text: value,\n });\n\n return [element(\"branding\", {}, [color(\"light\", branding.light), color(\"dark\", branding.dark)])];\n};\n\nexport {\n brandingSection,\n contentRatingSection,\n descriptionSection,\n developerSection,\n listSection,\n providesSection,\n releasesSection,\n screenshotsSection,\n urlsSection,\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import type { DeploySettings } from "../types.js";
2
+ declare const renderMetainfo: (settings: DeploySettings) => string;
3
+ export { renderMetainfo };
4
+ //# sourceMappingURL=metainfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metainfo.d.ts","sourceRoot":"","sources":["../../../src/deploy/freedesktop/metainfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAuBlD,QAAA,MAAM,cAAc,GAAI,UAAU,cAAc,KAAG,MAoB9C,CAAC;AAEN,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { brandingSection, contentRatingSection, descriptionSection, developerSection, listSection, providesSection, releasesSection, screenshotsSection, urlsSection, } from "./metainfo-sections.js";
2
+ import { element, renderDocument, text } from "./xml.js";
3
+ const COMPONENT_TYPE = "desktop-application";
4
+ const DESKTOP_SUFFIX = ".desktop";
5
+ const launchable = (applicationId) => ({
6
+ tag: "launchable",
7
+ attributes: { type: "desktop-id" },
8
+ text: `${applicationId}${DESKTOP_SUFFIX}`,
9
+ });
10
+ const renderMetainfo = (settings) => renderDocument(element("component", { type: COMPONENT_TYPE }, [
11
+ text("id", settings.applicationId),
12
+ text("name", settings.name),
13
+ text("summary", settings.summary),
14
+ text("metadata_license", settings.metadataLicense),
15
+ text("project_license", settings.license),
16
+ ...developerSection(settings),
17
+ ...descriptionSection(settings),
18
+ launchable(settings.applicationId),
19
+ ...providesSection(settings),
20
+ ...listSection("categories", "category", settings.categories),
21
+ ...listSection("keywords", "keyword", settings.keywords),
22
+ ...urlsSection(settings),
23
+ ...screenshotsSection(settings),
24
+ ...releasesSection(settings),
25
+ ...contentRatingSection(settings),
26
+ ...brandingSection(settings),
27
+ ]));
28
+ export { renderMetainfo };
29
+ //# sourceMappingURL=metainfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metainfo.js","sourceRoot":"","sources":["../../../src/deploy/freedesktop/metainfo.ts"],"names":[],"mappings":"AACA,OAAO,EACH,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,WAAW,GACd,MAAM,wBAAwB,CAAC;AA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C,GAAG,eAAe,CAAC,QAAQ,CAAC;CAC/B,CAAC,CACL,CAAC;AAEN,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type { DeploySettings } from \"../types.js\";\nimport {\n brandingSection,\n contentRatingSection,\n descriptionSection,\n developerSection,\n listSection,\n providesSection,\n releasesSection,\n screenshotsSection,\n urlsSection,\n} from \"./metainfo-sections.js\";\nimport { element, renderDocument, text, type XmlNode } from \"./xml.js\";\n\nconst COMPONENT_TYPE = \"desktop-application\";\nconst DESKTOP_SUFFIX = \".desktop\";\n\nconst launchable = (applicationId: string): XmlNode => ({\n tag: \"launchable\",\n attributes: { type: \"desktop-id\" },\n text: `${applicationId}${DESKTOP_SUFFIX}`,\n});\n\nconst renderMetainfo = (settings: DeploySettings): string =>\n renderDocument(\n element(\"component\", { type: COMPONENT_TYPE }, [\n text(\"id\", settings.applicationId),\n text(\"name\", settings.name),\n text(\"summary\", settings.summary),\n text(\"metadata_license\", settings.metadataLicense),\n text(\"project_license\", settings.license),\n ...developerSection(settings),\n ...descriptionSection(settings),\n launchable(settings.applicationId),\n ...providesSection(settings),\n ...listSection(\"categories\", \"category\", settings.categories),\n ...listSection(\"keywords\", \"keyword\", settings.keywords),\n ...urlsSection(settings),\n ...screenshotsSection(settings),\n ...releasesSection(settings),\n ...contentRatingSection(settings),\n ...brandingSection(settings),\n ]),\n );\n\nexport { renderMetainfo };\n"]}
@@ -0,0 +1,4 @@
1
+ import type { DeploySettings } from "../types.js";
2
+ declare const renderMimePackage: (settings: DeploySettings) => string | null;
3
+ export { renderMimePackage };
4
+ //# sourceMappingURL=mime-package.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mime-package.d.ts","sourceRoot":"","sources":["../../../src/deploy/freedesktop/mime-package.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,cAAc,EAAE,MAAM,aAAa,CAAC;AAazE,QAAA,MAAM,iBAAiB,GAAI,UAAU,cAAc,KAAG,MAAM,GAAG,IAY9D,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { element, renderDocument, text } from "./xml.js";
2
+ /* eslint-disable-next-line sonarjs/no-clear-text-protocols, unicorn/prefer-https --
3
+ An XML namespace is a fixed identifier, not a URL to fetch: shared-mime-info only recognizes this exact string. */
4
+ const MIME_INFO_NAMESPACE = "http://www.freedesktop.org/standards/shared-mime-info";
5
+ const mimeTypeNode = (association) => element("mime-type", { type: association.mimeType }, [
6
+ ...(association.description === null ? [] : [text("comment", association.description)]),
7
+ { tag: "glob", attributes: { pattern: `*.${association.extension}` } },
8
+ ]);
9
+ const renderMimePackage = (settings) => {
10
+ if (settings.fileAssociations.length === 0) {
11
+ return null;
12
+ }
13
+ return renderDocument(element("mime-info", { xmlns: MIME_INFO_NAMESPACE }, settings.fileAssociations.map((entry) => mimeTypeNode(entry))));
14
+ };
15
+ export { renderMimePackage };
16
+ //# sourceMappingURL=mime-package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mime-package.js","sourceRoot":"","sources":["../../../src/deploy/freedesktop/mime-package.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAgB,MAAM,UAAU,CAAC;AAEvE;qHACqH;AACrH,MAAM,mBAAmB,GAAG,uDAAuD,CAAC;AAEpF,MAAM,YAAY,GAAG,CAAC,WAAkC,EAAW,EAAE,CACjE,OAAO,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,EAAE;IACjD,GAAG,CAAC,WAAW,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;IACvF,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,KAAK,WAAW,CAAC,SAAS,EAAE,EAAE,EAAE;CACzE,CAAC,CAAC;AAEP,MAAM,iBAAiB,GAAG,CAAC,QAAwB,EAAiB,EAAE;IAClE,IAAI,QAAQ,CAAC,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,cAAc,CACjB,OAAO,CACH,WAAW,EACX,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAC9B,QAAQ,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAChE,CACJ,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import type { DeployFileAssociation, DeploySettings } from \"../types.js\";\nimport { element, renderDocument, text, type XmlNode } from \"./xml.js\";\n\n/* eslint-disable-next-line sonarjs/no-clear-text-protocols, unicorn/prefer-https --\n An XML namespace is a fixed identifier, not a URL to fetch: shared-mime-info only recognizes this exact string. */\nconst MIME_INFO_NAMESPACE = \"http://www.freedesktop.org/standards/shared-mime-info\";\n\nconst mimeTypeNode = (association: DeployFileAssociation): XmlNode =>\n element(\"mime-type\", { type: association.mimeType }, [\n ...(association.description === null ? [] : [text(\"comment\", association.description)]),\n { tag: \"glob\", attributes: { pattern: `*.${association.extension}` } },\n ]);\n\nconst renderMimePackage = (settings: DeploySettings): string | null => {\n if (settings.fileAssociations.length === 0) {\n return null;\n }\n\n return renderDocument(\n element(\n \"mime-info\",\n { xmlns: MIME_INFO_NAMESPACE },\n settings.fileAssociations.map((entry) => mimeTypeNode(entry)),\n ),\n );\n};\n\nexport { renderMimePackage };\n"]}
@@ -0,0 +1,4 @@
1
+ declare const validateDesktopEntry: (path: string) => void;
2
+ declare const validateMetainfo: (path: string, areWarningsFatal: boolean) => void;
3
+ export { validateDesktopEntry, validateMetainfo };
4
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/deploy/freedesktop/validate.ts"],"names":[],"mappings":"AAgGA,QAAA,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,IAU5C,CAAC;AAEF,QAAA,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,kBAAkB,OAAO,KAAG,IAanE,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { resolveExecutable, sortStrings, warn } from "@gtkx/utils";
2
+ import { spawnSync } from "node:child_process";
3
+ const DIAGNOSTIC = /^(?<severity>[EIPW]): \S+ (?<rule>[\w-]+)/;
4
+ const ERROR_SEVERITY = "E";
5
+ const WARNING_SEVERITY = "W";
6
+ const INFO_SEVERITY = "I";
7
+ const REMEDY_FOR_RULE = {
8
+ "component-summary-missing": "set `deploy.summary`",
9
+ "description-first-para-too-short": "open `deploy.description` with a paragraph longer than 80 characters",
10
+ "developer-info-missing": "set `deploy.developer.name`",
11
+ "metainfo-legacy-path": "this file is generated; report it as a gtkx bug",
12
+ "summary-has-dot-suffix": "drop the trailing period from `deploy.summary`",
13
+ "summary-too-long": "shorten `deploy.summary`",
14
+ "url-homepage-missing": "set `deploy.homepage`, or `homepage` in package.json",
15
+ };
16
+ const runTool = ({ tool, args, subject }) => {
17
+ const result = spawnSync(resolveExecutable(tool), args, { encoding: "utf8" });
18
+ if (result.error !== undefined) {
19
+ throw new Error(`${subject} could not be validated: ${result.error.message}`, { cause: result.error });
20
+ }
21
+ return { output: [result.stdout, result.stderr].join("\n").trim(), status: result.status ?? 0 };
22
+ };
23
+ const rulesIn = (output, severities) => output
24
+ .split("\n")
25
+ .map((line) => DIAGNOSTIC.exec(line)?.groups)
26
+ .filter((groups) => groups !== undefined && severities.includes(groups.severity ?? ""))
27
+ .map((groups) => groups?.rule ?? "");
28
+ const remedyLines = (rules) => {
29
+ const remedies = sortStrings([...new Set(rules)])
30
+ .filter((rule) => REMEDY_FOR_RULE[rule] !== undefined)
31
+ .map((rule) => ` ${rule}: ${REMEDY_FOR_RULE[rule] ?? ""}`);
32
+ return remedies.length === 0 ? [] : ["", "Fix it in gtkx.config.ts:", ...remedies];
33
+ };
34
+ const invalid = (subject, output, rules) => new Error([`${subject} is not valid:`, output.length > 0 ? output : "no output", ...remedyLines(rules)].join("\n"));
35
+ const isFatalResult = ({ status, errors, warnings, areWarningsFatal }) => {
36
+ if (errors.length > 0) {
37
+ return true;
38
+ }
39
+ if (areWarningsFatal && warnings.length > 0) {
40
+ return true;
41
+ }
42
+ return status !== 0 && warnings.length === 0;
43
+ };
44
+ const assertNotFatal = (result) => {
45
+ if (isFatalResult(result)) {
46
+ throw invalid(result.subject, result.output, [...result.errors, ...result.warnings]);
47
+ }
48
+ };
49
+ const describeRule = (rule) => {
50
+ const remedy = REMEDY_FOR_RULE[rule];
51
+ return remedy === undefined ? rule : `${rule} — ${remedy}`;
52
+ };
53
+ const reportDiagnostics = (subject, rules) => {
54
+ for (const rule of rules) {
55
+ warn(`${subject}: ${describeRule(rule)}`);
56
+ }
57
+ };
58
+ const validateDesktopEntry = (path) => {
59
+ const { output, status } = runTool({
60
+ tool: "desktop-file-validate",
61
+ args: [path],
62
+ subject: "The desktop entry",
63
+ });
64
+ if (status !== 0 || output.length > 0) {
65
+ throw invalid("The desktop entry", output, []);
66
+ }
67
+ };
68
+ const validateMetainfo = (path, areWarningsFatal) => {
69
+ const subject = "The AppStream metainfo";
70
+ const { output, status } = runTool({
71
+ tool: "appstreamcli",
72
+ args: ["validate", "--no-net", "--explain", path],
73
+ subject,
74
+ });
75
+ const errors = rulesIn(output, [ERROR_SEVERITY]);
76
+ const warnings = rulesIn(output, [WARNING_SEVERITY]);
77
+ assertNotFatal({ subject, output, status, errors, warnings, areWarningsFatal });
78
+ reportDiagnostics(subject, [...warnings, ...rulesIn(output, [INFO_SEVERITY])]);
79
+ };
80
+ export { validateDesktopEntry, validateMetainfo };
81
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +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AAE,GAAG,OAAO,CAAC;QAC/B,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,CAAC,IAAI,CAAC;QACZ,OAAO,EAAE,mBAAmB;KAC/B,CAAC,CAAC;IAEH,IAAI,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,MAAM,OAAO,CAAC,mBAAmB,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACnD,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,gBAAyB,EAAQ,EAAE;IACvE,MAAM,OAAO,GAAG,wBAAwB,CAAC;IAEzC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC/B,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,CAAC;QACjD,OAAO;KACV,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IACjD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACrD,cAAc,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAChF,iBAAiB,CAAC,OAAO,EAAE,CAAC,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { resolveExecutable, sortStrings, warn } from \"@gtkx/utils\";\nimport { spawnSync } from \"node:child_process\";\n\ntype ToolResult = {\n output: string;\n status: number;\n};\n\ntype MetainfoResult = {\n subject: string;\n output: string;\n status: number;\n errors: string[];\n warnings: string[];\n areWarningsFatal: boolean;\n};\n\ntype ToolRequest = {\n tool: string;\n args: string[];\n subject: string;\n};\n\nconst DIAGNOSTIC = /^(?<severity>[EIPW]): \\S+ (?<rule>[\\w-]+)/;\nconst ERROR_SEVERITY = \"E\";\nconst WARNING_SEVERITY = \"W\";\nconst INFO_SEVERITY = \"I\";\n\nconst REMEDY_FOR_RULE: Record<string, string> = {\n \"component-summary-missing\": \"set `deploy.summary`\",\n \"description-first-para-too-short\": \"open `deploy.description` with a paragraph longer than 80 characters\",\n \"developer-info-missing\": \"set `deploy.developer.name`\",\n \"metainfo-legacy-path\": \"this file is generated; report it as a gtkx bug\",\n \"summary-has-dot-suffix\": \"drop the trailing period from `deploy.summary`\",\n \"summary-too-long\": \"shorten `deploy.summary`\",\n \"url-homepage-missing\": \"set `deploy.homepage`, or `homepage` in package.json\",\n};\n\nconst runTool = ({ tool, args, subject }: ToolRequest): ToolResult => {\n const result = spawnSync(resolveExecutable(tool), args, { encoding: \"utf8\" });\n\n if (result.error !== undefined) {\n throw new Error(`${subject} could not be validated: ${result.error.message}`, { cause: result.error });\n }\n\n return { output: [result.stdout, result.stderr].join(\"\\n\").trim(), status: result.status ?? 0 };\n};\n\nconst rulesIn = (output: string, severities: string[]): string[] =>\n output\n .split(\"\\n\")\n .map((line) => DIAGNOSTIC.exec(line)?.groups)\n .filter((groups) => groups !== undefined && severities.includes(groups.severity ?? \"\"))\n .map((groups) => groups?.rule ?? \"\");\n\nconst remedyLines = (rules: string[]): string[] => {\n const remedies = sortStrings([...new Set(rules)])\n .filter((rule) => REMEDY_FOR_RULE[rule] !== undefined)\n .map((rule) => ` ${rule}: ${REMEDY_FOR_RULE[rule] ?? \"\"}`);\n\n return remedies.length === 0 ? [] : [\"\", \"Fix it in gtkx.config.ts:\", ...remedies];\n};\n\nconst invalid = (subject: string, output: string, rules: string[]): Error =>\n new Error([`${subject} is not valid:`, output.length > 0 ? output : \"no output\", ...remedyLines(rules)].join(\"\\n\"));\n\nconst isFatalResult = ({ status, errors, warnings, areWarningsFatal }: MetainfoResult): boolean => {\n if (errors.length > 0) {\n return true;\n }\n\n if (areWarningsFatal && warnings.length > 0) {\n return true;\n }\n\n return status !== 0 && warnings.length === 0;\n};\n\nconst assertNotFatal = (result: MetainfoResult): void => {\n if (isFatalResult(result)) {\n throw invalid(result.subject, result.output, [...result.errors, ...result.warnings]);\n }\n};\n\nconst describeRule = (rule: string): string => {\n const remedy = REMEDY_FOR_RULE[rule];\n\n return remedy === undefined ? rule : `${rule} — ${remedy}`;\n};\n\nconst reportDiagnostics = (subject: string, rules: string[]): void => {\n for (const rule of rules) {\n warn(`${subject}: ${describeRule(rule)}`);\n }\n};\n\nconst validateDesktopEntry = (path: string): void => {\n const { output, status } = runTool({\n tool: \"desktop-file-validate\",\n args: [path],\n subject: \"The desktop entry\",\n });\n\n if (status !== 0 || output.length > 0) {\n throw invalid(\"The desktop entry\", output, []);\n }\n};\n\nconst validateMetainfo = (path: string, areWarningsFatal: boolean): void => {\n const subject = \"The AppStream metainfo\";\n\n const { output, status } = runTool({\n tool: \"appstreamcli\",\n args: [\"validate\", \"--no-net\", \"--explain\", path],\n subject,\n });\n\n const errors = rulesIn(output, [ERROR_SEVERITY]);\n const warnings = rulesIn(output, [WARNING_SEVERITY]);\n assertNotFatal({ subject, output, status, errors, warnings, areWarningsFatal });\n reportDiagnostics(subject, [...warnings, ...rulesIn(output, [INFO_SEVERITY])]);\n};\n\nexport { validateDesktopEntry, validateMetainfo };\n"]}
@@ -0,0 +1,11 @@
1
+ type XmlNode = {
2
+ tag: string;
3
+ attributes?: Record<string, string>;
4
+ children?: XmlNode[];
5
+ text?: string;
6
+ };
7
+ declare const element: (tag: string, attributes: Record<string, string>, children: XmlNode[]) => XmlNode;
8
+ declare const text: (tag: string, value: string) => XmlNode;
9
+ declare const renderDocument: (root: XmlNode) => string;
10
+ export { element, renderDocument, text, type XmlNode };
11
+ //# sourceMappingURL=xml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../../src/deploy/freedesktop/xml.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAoBF,QAAA,MAAM,OAAO,GAAI,KAAK,MAAM,EAAE,YAAY,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,OAAO,EAAE,KAAG,OAItF,CAAC;AAEH,QAAA,MAAM,IAAI,GAAI,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,OAAiC,CAAC;AAmB7E,QAAA,MAAM,cAAc,GAAI,MAAM,OAAO,KAAG,MAAkE,CAAC;AAE3G,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,CAAC"}
@@ -0,0 +1,33 @@
1
+ const XML_DECLARATION = '<?xml version="1.0" encoding="UTF-8"?>';
2
+ const INDENT = " ".repeat(4);
3
+ const ESCAPES = {
4
+ '"': "&quot;",
5
+ "&": "&amp;",
6
+ "<": "&lt;",
7
+ ">": "&gt;",
8
+ };
9
+ const escapeXml = (value) => value.replaceAll(/["&<>]/g, (character) => ESCAPES[character] ?? character);
10
+ const renderAttributes = (attributes) => Object.entries(attributes ?? {})
11
+ .map(([key, value]) => ` ${key}="${escapeXml(value)}"`)
12
+ .join("");
13
+ const element = (tag, attributes, children) => ({
14
+ tag,
15
+ attributes,
16
+ children,
17
+ });
18
+ const text = (tag, value) => ({ tag, text: value });
19
+ const renderNode = (node, depth) => {
20
+ const padding = INDENT.repeat(depth);
21
+ const open = `${padding}<${node.tag}${renderAttributes(node.attributes)}`;
22
+ if (node.text !== undefined) {
23
+ return [`${open}>${escapeXml(node.text)}</${node.tag}>`];
24
+ }
25
+ const children = node.children ?? [];
26
+ if (children.length === 0) {
27
+ return [`${open}/>`];
28
+ }
29
+ return [`${open}>`, ...children.flatMap((child) => renderNode(child, depth + 1)), `${padding}</${node.tag}>`];
30
+ };
31
+ const renderDocument = (root) => [XML_DECLARATION, ...renderNode(root, 0), ""].join("\n");
32
+ export { element, renderDocument, text };
33
+ //# sourceMappingURL=xml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml.js","sourceRoot":"","sources":["../../../src/deploy/freedesktop/xml.ts"],"names":[],"mappings":"AAOA,MAAM,eAAe,GAAG,wCAAwC,CAAC;AACjE,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAE7B,MAAM,OAAO,GAA2B;IACpC,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;CACd,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAa,EAAU,EAAE,CACxC,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,CAAC;AAEhF,MAAM,gBAAgB,GAAG,CAAC,UAA8C,EAAU,EAAE,CAChF,MAAM,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;KAC3B,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,KAAK,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC;KACtD,IAAI,CAAC,EAAE,CAAC,CAAC;AAElB,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,UAAkC,EAAE,QAAmB,EAAW,EAAE,CAAC,CAAC;IAChG,GAAG;IACH,UAAU;IACV,QAAQ;CACX,CAAC,CAAC;AAEH,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,KAAa,EAAW,EAAE,CAAC,CAAC,E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" encoding=\"UTF-8\"?>';\nconst INDENT = \" \".repeat(4);\n\nconst ESCAPES: Record<string, string> = {\n '\"': \"&quot;\",\n \"&\": \"&amp;\",\n \"<\": \"&lt;\",\n \">\": \"&gt;\",\n};\n\nconst escapeXml = (value: string): string =>\n value.replaceAll(/[\"&<>]/g, (character) => ESCAPES[character] ?? character);\n\nconst renderAttributes = (attributes: Record<string, string> | undefined): string =>\n Object.entries(attributes ?? {})\n .map(([key, value]) => ` ${key}=\"${escapeXml(value)}\"`)\n .join(\"\");\n\nconst element = (tag: string, attributes: Record<string, string>, children: XmlNode[]): XmlNode => ({\n tag,\n attributes,\n children,\n});\n\nconst text = (tag: string, value: string): XmlNode => ({ tag, text: value });\n\nconst renderNode = (node: XmlNode, depth: number): string[] => {\n const padding = INDENT.repeat(depth);\n const open = `${padding}<${node.tag}${renderAttributes(node.attributes)}`;\n\n if (node.text !== undefined) {\n return [`${open}>${escapeXml(node.text)}</${node.tag}>`];\n }\n\n const children = node.children ?? [];\n\n if (children.length === 0) {\n return [`${open}/>`];\n }\n\n return [`${open}>`, ...children.flatMap((child) => renderNode(child, depth + 1)), `${padding}</${node.tag}>`];\n};\n\nconst renderDocument = (root: XmlNode): string => [XML_DECLARATION, ...renderNode(root, 0), \"\"].join(\"\\n\");\n\nexport { element, renderDocument, text, type XmlNode };\n"]}
@@ -0,0 +1,4 @@
1
+ declare const runGit: (root: string, args: string[]) => string | null;
2
+ declare const gitRemoteUrl: (root: string) => string | null;
3
+ export { gitRemoteUrl, runGit };
4
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/deploy/git.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,MAAM,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,EAAE,KAAG,MAAM,GAAG,IAYvD,CAAC;AAEF,QAAA,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IAAqD,CAAC;AAEpG,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { tryResolveExecutable } from "@gtkx/utils";
2
+ import { execFileSync } from "node:child_process";
3
+ const runGit = (root, args) => {
4
+ const git = tryResolveExecutable("git");
5
+ if (git === undefined) {
6
+ return null;
7
+ }
8
+ try {
9
+ return execFileSync(git, args, { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
10
+ }
11
+ catch {
12
+ return null;
13
+ }
14
+ };
15
+ const gitRemoteUrl = (root) => runGit(root, ["remote", "get-url", "origin"]);
16
+ export { gitRemoteUrl, runGit };
17
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/deploy/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,IAAc,EAAiB,EAAE;IAC3D,MAAM,GAAG,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAExC,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,CAAC;QACD,OAAO,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAChH,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,IAAY,EAAiB,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEpG,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import { tryResolveExecutable } from \"@gtkx/utils\";\nimport { execFileSync } from \"node:child_process\";\n\nconst runGit = (root: string, args: string[]): string | null => {\n const git = tryResolveExecutable(\"git\");\n\n if (git === undefined) {\n return null;\n }\n\n try {\n return execFileSync(git, args, { cwd: root, encoding: \"utf8\", stdio: [\"ignore\", \"pipe\", \"ignore\"] }).trim();\n } catch {\n return null;\n }\n};\n\nconst gitRemoteUrl = (root: string): string | null => runGit(root, [\"remote\", \"get-url\", \"origin\"]);\n\nexport { gitRemoteUrl, runGit };\n"]}
@@ -0,0 +1,5 @@
1
+ import type { PackageFamily } from "./types.js";
2
+ declare const detectPackageFamily: () => PackageFamily;
3
+ declare const installHints: (tool: string, family: PackageFamily) => string[];
4
+ export { detectPackageFamily, installHints };
5
+ //# sourceMappingURL=install-hints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-hints.d.ts","sourceRoot":"","sources":["../../src/deploy/install-hints.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA0FhD,QAAA,MAAM,mBAAmB,QAAO,aAK/B,CAAC;AAEF,QAAA,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,QAAQ,aAAa,KAAG,MAAM,EAOjE,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { readFileSync } from "node:fs";
2
+ const OS_RELEASE_PATH = "/etc/os-release";
3
+ const OS_RELEASE_LINE = /^(?<key>[A-Z_]+)=(?<value>.*)$/;
4
+ const QUOTED = /^"(.*)"$/;
5
+ const FAMILY_BY_ID = {
6
+ arch: "arch",
7
+ debian: "debian",
8
+ fedora: "fedora",
9
+ manjaro: "arch",
10
+ opensuse: "suse",
11
+ "opensuse-leap": "suse",
12
+ "opensuse-tumbleweed": "suse",
13
+ rhel: "fedora",
14
+ sles: "suse",
15
+ suse: "suse",
16
+ ubuntu: "debian",
17
+ };
18
+ const INSTALL_COMMAND = {
19
+ arch: "sudo pacman -S",
20
+ debian: "sudo apt install",
21
+ fedora: "sudo dnf install",
22
+ suse: "sudo zypper install",
23
+ };
24
+ const PACKAGE_FOR_TOOL = {
25
+ appstreamcli: { arch: "appstream", debian: "appstream", fedora: "appstream", suse: "AppStream" },
26
+ "desktop-file-validate": {
27
+ arch: "desktop-file-utils",
28
+ debian: "desktop-file-utils",
29
+ fedora: "desktop-file-utils",
30
+ suse: "desktop-file-utils",
31
+ },
32
+ file: { arch: "file", debian: "file", fedora: "file", suse: "file" },
33
+ "flatpak-builder": {
34
+ arch: "flatpak-builder",
35
+ debian: "flatpak-builder",
36
+ fedora: "flatpak-builder",
37
+ suse: "flatpak-builder",
38
+ },
39
+ strip: { arch: "binutils", debian: "binutils", fedora: "binutils", suse: "binutils" },
40
+ tar: { arch: "tar", debian: "tar", fedora: "tar", suse: "tar" },
41
+ };
42
+ const EXTRA_HINTS = {
43
+ "flatpak-builder": "or: flatpak install --user -y flathub org.flatpak.Builder",
44
+ "flatpak-node-generator": "pipx install git+https://github.com/flatpak/flatpak-builder-tools.git#subdirectory=node",
45
+ };
46
+ const unquote = (value) => QUOTED.exec(value)?.[1] ?? value;
47
+ const readOsReleaseText = () => {
48
+ try {
49
+ return readFileSync(OS_RELEASE_PATH, "utf8");
50
+ }
51
+ catch {
52
+ return "";
53
+ }
54
+ };
55
+ const osReleaseEntry = (line) => {
56
+ const match = OS_RELEASE_LINE.exec(line.trim());
57
+ return match?.groups ? [match.groups.key ?? "", unquote(match.groups.value ?? "")] : null;
58
+ };
59
+ const readOsRelease = () => Object.fromEntries(readOsReleaseText()
60
+ .split("\n")
61
+ .map((line) => osReleaseEntry(line))
62
+ .filter((entry) => entry !== null));
63
+ const familyForIds = (ids) => {
64
+ for (const id of ids) {
65
+ const family = FAMILY_BY_ID[id];
66
+ if (family !== undefined) {
67
+ return family;
68
+ }
69
+ }
70
+ return "unknown";
71
+ };
72
+ const detectPackageFamily = () => {
73
+ const release = readOsRelease();
74
+ const like = (release.ID_LIKE ?? "").split(" ").filter((entry) => entry.length > 0);
75
+ return familyForIds([release.ID ?? "", ...like]);
76
+ };
77
+ const installHints = (tool, family) => {
78
+ const packageName = PACKAGE_FOR_TOOL[tool]?.[family];
79
+ const command = INSTALL_COMMAND[family];
80
+ const extra = EXTRA_HINTS[tool];
81
+ const install = packageName !== undefined && command !== undefined ? [`${command} ${packageName}`] : [];
82
+ return extra === undefined ? install : [...install, extra];
83
+ };
84
+ export { detectPackageFamily, installHints };
85
+ //# sourceMappingURL=install-hints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-hints.js","sourceRoot":"","sources":["../../src/deploy/install-hints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvC,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC1C,MAAM,eAAe,GAAG,gCAAgC,CAAC;AACzD,MAAM,MAAM,GAAG,UAAU,CAAC;AAE1B,MAAM,YAAY,GAAkC;IAChD,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,MAAM;IAChB,eAAe,EAAE,MAAM;IACvB,qBAAqB,EAAE,MAAM;IAC7B,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;CACnB,CAAC;AAEF,MAAM,eAAe,GAA2C;IAC5D,IAAI,EAAE,gBAAgB;IACtB,MAAM,EAAE,kBAAkB;IAC1B,MAAM,EAAE,kBAAkB;IAC1B,IAAI,EAAE,qBAAqB;CAC9B,CAAC;AAEF,MAAM,gBAAgB,GAAmC;IACrD,YAAY,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,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ACnE,MAAM,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACrD,MAAM,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,WAAW,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAExG,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { readFileSync } from \"node:fs\";\nimport type { PackageFamily } from \"./types.js\";\n\ntype FamilyPackages = Partial<Record<PackageFamily, string>>;\n\nconst OS_RELEASE_PATH = \"/etc/os-release\";\nconst OS_RELEASE_LINE = /^(?<key>[A-Z_]+)=(?<value>.*)$/;\nconst QUOTED = /^\"(.*)\"$/;\n\nconst FAMILY_BY_ID: Record<string, PackageFamily> = {\n arch: \"arch\",\n debian: \"debian\",\n fedora: \"fedora\",\n manjaro: \"arch\",\n opensuse: \"suse\",\n \"opensuse-leap\": \"suse\",\n \"opensuse-tumbleweed\": \"suse\",\n rhel: \"fedora\",\n sles: \"suse\",\n suse: \"suse\",\n ubuntu: \"debian\",\n};\n\nconst INSTALL_COMMAND: Partial<Record<PackageFamily, string>> = {\n arch: \"sudo pacman -S\",\n debian: \"sudo apt install\",\n fedora: \"sudo dnf install\",\n suse: \"sudo zypper install\",\n};\n\nconst PACKAGE_FOR_TOOL: Record<string, FamilyPackages> = {\n appstreamcli: { arch: \"appstream\", debian: \"appstream\", fedora: \"appstream\", suse: \"AppStream\" },\n \"desktop-file-validate\": {\n arch: \"desktop-file-utils\",\n debian: \"desktop-file-utils\",\n fedora: \"desktop-file-utils\",\n suse: \"desktop-file-utils\",\n },\n file: { arch: \"file\", debian: \"file\", fedora: \"file\", suse: \"file\" },\n \"flatpak-builder\": {\n arch: \"flatpak-builder\",\n debian: \"flatpak-builder\",\n fedora: \"flatpak-builder\",\n suse: \"flatpak-builder\",\n },\n strip: { arch: \"binutils\", debian: \"binutils\", fedora: \"binutils\", suse: \"binutils\" },\n tar: { arch: \"tar\", debian: \"tar\", fedora: \"tar\", suse: \"tar\" },\n};\n\nconst EXTRA_HINTS: Record<string, string> = {\n \"flatpak-builder\": \"or: flatpak install --user -y flathub org.flatpak.Builder\",\n \"flatpak-node-generator\":\n \"pipx install git+https://github.com/flatpak/flatpak-builder-tools.git#subdirectory=node\",\n};\n\nconst unquote = (value: string): string => QUOTED.exec(value)?.[1] ?? value;\n\nconst readOsReleaseText = (): string => {\n try {\n return readFileSync(OS_RELEASE_PATH, \"utf8\");\n } catch {\n return \"\";\n }\n};\n\nconst osReleaseEntry = (line: string): [string, string] | null => {\n const match = OS_RELEASE_LINE.exec(line.trim());\n\n return match?.groups ? [match.groups.key ?? \"\", unquote(match.groups.value ?? \"\")] : null;\n};\n\nconst readOsRelease = (): Record<string, string> =>\n Object.fromEntries(\n readOsReleaseText()\n .split(\"\\n\")\n .map((line) => osReleaseEntry(line))\n .filter((entry) => entry !== null),\n );\n\nconst familyForIds = (ids: string[]): PackageFamily => {\n for (const id of ids) {\n const family = FAMILY_BY_ID[id];\n\n if (family !== undefined) {\n return family;\n }\n }\n\n return \"unknown\";\n};\n\nconst detectPackageFamily = (): PackageFamily => {\n const release = readOsRelease();\n const like = (release.ID_LIKE ?? \"\").split(\" \").filter((entry) => entry.length > 0);\n\n return familyForIds([release.ID ?? \"\", ...like]);\n};\n\nconst installHints = (tool: string, family: PackageFamily): string[] => {\n const packageName = PACKAGE_FOR_TOOL[tool]?.[family];\n const command = INSTALL_COMMAND[family];\n const extra = EXTRA_HINTS[tool];\n const install = packageName !== undefined && command !== undefined ? [`${command} ${packageName}`] : [];\n\n return extra === undefined ? install : [...install, extra];\n};\n\nexport { detectPackageFamily, installHints };\n"]}
@@ -0,0 +1,8 @@
1
+ import type { DeployPayload, DeploySettings } from "../types.js";
2
+ import { type Entries } from "./optional.js";
3
+ type NfpmPackager = "deb" | "rpm";
4
+ type NfpmConfig = Entries;
5
+ declare const packageNameFor: (settings: DeploySettings, packager: NfpmPackager) => string;
6
+ declare const renderNfpmConfig: (payload: DeployPayload, packager: NfpmPackager) => NfpmConfig;
7
+ export { type NfpmPackager, packageNameFor, renderNfpmConfig };
8
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/deploy/nfpm/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAc,MAAM,aAAa,CAAC;AAK7E,OAAO,EAAE,KAAK,OAAO,EAAkB,MAAM,eAAe,CAAC;AAE7D,KAAK,YAAY,GAAG,KAAK,GAAG,KAAK,CAAC;AAClC,KAAK,UAAU,GAAG,OAAO,CAAC;AAmG1B,QAAA,MAAM,cAAc,GAAI,UAAU,cAAc,EAAE,UAAU,YAAY,KAAG,MACV,CAAC;AAgBlE,QAAA,MAAM,gBAAgB,GAAI,SAAS,aAAa,EAAE,UAAU,YAAY,KAAG,UA0B1E,CAAC;AAEF,OAAO,EAAE,KAAK,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC"}