@gtkx/cli 1.0.0-rc.4 → 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 (520) hide show
  1. package/README.md +5 -5
  2. package/dist/builder.d.ts +2 -2
  3. package/dist/builder.d.ts.map +1 -1
  4. package/dist/builder.js +21 -3
  5. package/dist/builder.js.map +1 -1
  6. package/dist/cli.js +9 -3
  7. package/dist/cli.js.map +1 -1
  8. package/dist/codegen/freshness.d.ts.map +1 -1
  9. package/dist/codegen/freshness.js +2 -4
  10. package/dist/codegen/freshness.js.map +1 -1
  11. package/dist/codegen/run-codegen.d.ts +8 -5
  12. package/dist/codegen/run-codegen.d.ts.map +1 -1
  13. package/dist/codegen/run-codegen.js +25 -19
  14. package/dist/codegen/run-codegen.js.map +1 -1
  15. package/dist/codegen/store-resolver.d.ts +1 -1
  16. package/dist/codegen/store-resolver.d.ts.map +1 -1
  17. package/dist/codegen/store-resolver.js.map +1 -1
  18. package/dist/commands/build.d.ts.map +1 -1
  19. package/dist/commands/build.js +5 -6
  20. package/dist/commands/build.js.map +1 -1
  21. package/dist/commands/codegen.d.ts.map +1 -1
  22. package/dist/commands/codegen.js +11 -1
  23. package/dist/commands/codegen.js.map +1 -1
  24. package/dist/commands/deploy.d.ts +22 -0
  25. package/dist/commands/deploy.d.ts.map +1 -0
  26. package/dist/commands/deploy.js +44 -0
  27. package/dist/commands/deploy.js.map +1 -0
  28. package/dist/commands/dev.d.ts.map +1 -1
  29. package/dist/commands/dev.js +7 -5
  30. package/dist/commands/dev.js.map +1 -1
  31. package/dist/commands/docs.d.ts +2 -2
  32. package/dist/commands/docs.d.ts.map +1 -1
  33. package/dist/commands/docs.js +27 -4
  34. package/dist/commands/docs.js.map +1 -1
  35. package/dist/deploy/depends.d.ts +8 -0
  36. package/dist/deploy/depends.d.ts.map +1 -0
  37. package/dist/deploy/depends.js +27 -0
  38. package/dist/deploy/depends.js.map +1 -0
  39. package/dist/deploy/download.d.ts +20 -0
  40. package/dist/deploy/download.d.ts.map +1 -0
  41. package/dist/deploy/download.js +98 -0
  42. package/dist/deploy/download.js.map +1 -0
  43. package/dist/deploy/freedesktop/copyright.d.ts +4 -0
  44. package/dist/deploy/freedesktop/copyright.d.ts.map +1 -0
  45. package/dist/deploy/freedesktop/copyright.js +33 -0
  46. package/dist/deploy/freedesktop/copyright.js.map +1 -0
  47. package/dist/deploy/freedesktop/dbus-service.d.ts +4 -0
  48. package/dist/deploy/freedesktop/dbus-service.d.ts.map +1 -0
  49. package/dist/deploy/freedesktop/dbus-service.js +15 -0
  50. package/dist/deploy/freedesktop/dbus-service.js.map +1 -0
  51. package/dist/deploy/freedesktop/desktop-entry.d.ts +4 -0
  52. package/dist/deploy/freedesktop/desktop-entry.d.ts.map +1 -0
  53. package/dist/deploy/freedesktop/desktop-entry.js +73 -0
  54. package/dist/deploy/freedesktop/desktop-entry.js.map +1 -0
  55. package/dist/deploy/freedesktop/ini.d.ts +7 -0
  56. package/dist/deploy/freedesktop/ini.d.ts.map +1 -0
  57. package/dist/deploy/freedesktop/ini.js +22 -0
  58. package/dist/deploy/freedesktop/ini.js.map +1 -0
  59. package/dist/deploy/freedesktop/metainfo-sections.d.ts +13 -0
  60. package/dist/deploy/freedesktop/metainfo-sections.d.ts.map +1 -0
  61. package/dist/deploy/freedesktop/metainfo-sections.js +73 -0
  62. package/dist/deploy/freedesktop/metainfo-sections.js.map +1 -0
  63. package/dist/deploy/freedesktop/metainfo.d.ts +4 -0
  64. package/dist/deploy/freedesktop/metainfo.d.ts.map +1 -0
  65. package/dist/deploy/freedesktop/metainfo.js +29 -0
  66. package/dist/deploy/freedesktop/metainfo.js.map +1 -0
  67. package/dist/deploy/freedesktop/mime-package.d.ts +4 -0
  68. package/dist/deploy/freedesktop/mime-package.d.ts.map +1 -0
  69. package/dist/deploy/freedesktop/mime-package.js +16 -0
  70. package/dist/deploy/freedesktop/mime-package.js.map +1 -0
  71. package/dist/deploy/freedesktop/validate.d.ts +4 -0
  72. package/dist/deploy/freedesktop/validate.d.ts.map +1 -0
  73. package/dist/deploy/freedesktop/validate.js +81 -0
  74. package/dist/deploy/freedesktop/validate.js.map +1 -0
  75. package/dist/deploy/freedesktop/xml.d.ts +11 -0
  76. package/dist/deploy/freedesktop/xml.d.ts.map +1 -0
  77. package/dist/deploy/freedesktop/xml.js +33 -0
  78. package/dist/deploy/freedesktop/xml.js.map +1 -0
  79. package/dist/deploy/git.d.ts +4 -0
  80. package/dist/deploy/git.d.ts.map +1 -0
  81. package/dist/deploy/git.js +17 -0
  82. package/dist/deploy/git.js.map +1 -0
  83. package/dist/deploy/install-hints.d.ts +5 -0
  84. package/dist/deploy/install-hints.d.ts.map +1 -0
  85. package/dist/deploy/install-hints.js +85 -0
  86. package/dist/deploy/install-hints.js.map +1 -0
  87. package/dist/deploy/nfpm/config.d.ts +8 -0
  88. package/dist/deploy/nfpm/config.d.ts.map +1 -0
  89. package/dist/deploy/nfpm/config.js +119 -0
  90. package/dist/deploy/nfpm/config.js.map +1 -0
  91. package/dist/deploy/nfpm/contents.d.ts +12 -0
  92. package/dist/deploy/nfpm/contents.d.ts.map +1 -0
  93. package/dist/deploy/nfpm/contents.js +48 -0
  94. package/dist/deploy/nfpm/contents.js.map +1 -0
  95. package/dist/deploy/nfpm/description.d.ts +5 -0
  96. package/dist/deploy/nfpm/description.d.ts.map +1 -0
  97. package/dist/deploy/nfpm/description.js +5 -0
  98. package/dist/deploy/nfpm/description.js.map +1 -0
  99. package/dist/deploy/nfpm/optional.d.ts +5 -0
  100. package/dist/deploy/nfpm/optional.d.ts.map +1 -0
  101. package/dist/deploy/nfpm/optional.js +4 -0
  102. package/dist/deploy/nfpm/optional.js.map +1 -0
  103. package/dist/deploy/nfpm/pack.d.ts +5 -0
  104. package/dist/deploy/nfpm/pack.d.ts.map +1 -0
  105. package/dist/deploy/nfpm/pack.js +32 -0
  106. package/dist/deploy/nfpm/pack.js.map +1 -0
  107. package/dist/deploy/node-runtime/download.d.ts +3 -0
  108. package/dist/deploy/node-runtime/download.d.ts.map +1 -0
  109. package/dist/deploy/node-runtime/download.js +39 -0
  110. package/dist/deploy/node-runtime/download.js.map +1 -0
  111. package/dist/deploy/node-runtime/elf.d.ts +7 -0
  112. package/dist/deploy/node-runtime/elf.d.ts.map +1 -0
  113. package/dist/deploy/node-runtime/elf.js +100 -0
  114. package/dist/deploy/node-runtime/elf.js.map +1 -0
  115. package/dist/deploy/node-runtime/guard.d.ts +4 -0
  116. package/dist/deploy/node-runtime/guard.d.ts.map +1 -0
  117. package/dist/deploy/node-runtime/guard.js +22 -0
  118. package/dist/deploy/node-runtime/guard.js.map +1 -0
  119. package/dist/deploy/node-runtime/index.d.ts +4 -0
  120. package/dist/deploy/node-runtime/index.d.ts.map +1 -0
  121. package/dist/deploy/node-runtime/index.js +61 -0
  122. package/dist/deploy/node-runtime/index.js.map +1 -0
  123. package/dist/deploy/payload/copy-tree.d.ts +7 -0
  124. package/dist/deploy/payload/copy-tree.d.ts.map +1 -0
  125. package/dist/deploy/payload/copy-tree.js +36 -0
  126. package/dist/deploy/payload/copy-tree.js.map +1 -0
  127. package/dist/deploy/payload/icons.d.ts +6 -0
  128. package/dist/deploy/payload/icons.d.ts.map +1 -0
  129. package/dist/deploy/payload/icons.js +53 -0
  130. package/dist/deploy/payload/icons.js.map +1 -0
  131. package/dist/deploy/payload/launcher.d.ts +5 -0
  132. package/dist/deploy/payload/launcher.d.ts.map +1 -0
  133. package/dist/deploy/payload/launcher.js +22 -0
  134. package/dist/deploy/payload/launcher.js.map +1 -0
  135. package/dist/deploy/payload/schemas.d.ts +4 -0
  136. package/dist/deploy/payload/schemas.d.ts.map +1 -0
  137. package/dist/deploy/payload/schemas.js +17 -0
  138. package/dist/deploy/payload/schemas.js.map +1 -0
  139. package/dist/deploy/payload/stage.d.ts +15 -0
  140. package/dist/deploy/payload/stage.d.ts.map +1 -0
  141. package/dist/deploy/payload/stage.js +100 -0
  142. package/dist/deploy/payload/stage.js.map +1 -0
  143. package/dist/deploy/registry.d.ts +7 -0
  144. package/dist/deploy/registry.d.ts.map +1 -0
  145. package/dist/deploy/registry.js +30 -0
  146. package/dist/deploy/registry.js.map +1 -0
  147. package/dist/deploy/run-deploy.d.ts +11 -0
  148. package/dist/deploy/run-deploy.d.ts.map +1 -0
  149. package/dist/deploy/run-deploy.js +153 -0
  150. package/dist/deploy/run-deploy.js.map +1 -0
  151. package/dist/deploy/settings/arch.d.ts +4 -0
  152. package/dist/deploy/settings/arch.d.ts.map +1 -0
  153. package/dist/deploy/settings/arch.js +13 -0
  154. package/dist/deploy/settings/arch.js.map +1 -0
  155. package/dist/deploy/settings/categories.d.ts +4 -0
  156. package/dist/deploy/settings/categories.d.ts.map +1 -0
  157. package/dist/deploy/settings/categories.js +29 -0
  158. package/dist/deploy/settings/categories.js.map +1 -0
  159. package/dist/deploy/settings/exec.d.ts +6 -0
  160. package/dist/deploy/settings/exec.d.ts.map +1 -0
  161. package/dist/deploy/settings/exec.js +20 -0
  162. package/dist/deploy/settings/exec.js.map +1 -0
  163. package/dist/deploy/settings/identity.d.ts +18 -0
  164. package/dist/deploy/settings/identity.d.ts.map +1 -0
  165. package/dist/deploy/settings/identity.js +73 -0
  166. package/dist/deploy/settings/identity.js.map +1 -0
  167. package/dist/deploy/settings/index.d.ts +11 -0
  168. package/dist/deploy/settings/index.d.ts.map +1 -0
  169. package/dist/deploy/settings/index.js +103 -0
  170. package/dist/deploy/settings/index.js.map +1 -0
  171. package/dist/deploy/settings/package-manifest.d.ts +15 -0
  172. package/dist/deploy/settings/package-manifest.d.ts.map +1 -0
  173. package/dist/deploy/settings/package-manifest.js +41 -0
  174. package/dist/deploy/settings/package-manifest.js.map +1 -0
  175. package/dist/deploy/settings/paths.d.ts +9 -0
  176. package/dist/deploy/settings/paths.d.ts.map +1 -0
  177. package/dist/deploy/settings/paths.js +82 -0
  178. package/dist/deploy/settings/paths.js.map +1 -0
  179. package/dist/deploy/settings/screenshots.d.ts +8 -0
  180. package/dist/deploy/settings/screenshots.d.ts.map +1 -0
  181. package/dist/deploy/settings/screenshots.js +79 -0
  182. package/dist/deploy/settings/screenshots.js.map +1 -0
  183. package/dist/deploy/settings/starter.d.ts +4 -0
  184. package/dist/deploy/settings/starter.d.ts.map +1 -0
  185. package/dist/deploy/settings/starter.js +28 -0
  186. package/dist/deploy/settings/starter.js.map +1 -0
  187. package/dist/deploy/settings/version.d.ts +9 -0
  188. package/dist/deploy/settings/version.d.ts.map +1 -0
  189. package/dist/deploy/settings/version.js +37 -0
  190. package/dist/deploy/settings/version.js.map +1 -0
  191. package/dist/deploy/targets/appimage.d.ts +4 -0
  192. package/dist/deploy/targets/appimage.d.ts.map +1 -0
  193. package/dist/deploy/targets/appimage.js +105 -0
  194. package/dist/deploy/targets/appimage.js.map +1 -0
  195. package/dist/deploy/targets/deb.d.ts +4 -0
  196. package/dist/deploy/targets/deb.d.ts.map +1 -0
  197. package/dist/deploy/targets/deb.js +4 -0
  198. package/dist/deploy/targets/deb.js.map +1 -0
  199. package/dist/deploy/targets/flatpak-manifest.d.ts +6 -0
  200. package/dist/deploy/targets/flatpak-manifest.d.ts.map +1 -0
  201. package/dist/deploy/targets/flatpak-manifest.js +48 -0
  202. package/dist/deploy/targets/flatpak-manifest.js.map +1 -0
  203. package/dist/deploy/targets/flatpak-prebuilt.d.ts +8 -0
  204. package/dist/deploy/targets/flatpak-prebuilt.d.ts.map +1 -0
  205. package/dist/deploy/targets/flatpak-prebuilt.js +43 -0
  206. package/dist/deploy/targets/flatpak-prebuilt.js.map +1 -0
  207. package/dist/deploy/targets/flatpak-source.d.ts +5 -0
  208. package/dist/deploy/targets/flatpak-source.d.ts.map +1 -0
  209. package/dist/deploy/targets/flatpak-source.js +110 -0
  210. package/dist/deploy/targets/flatpak-source.js.map +1 -0
  211. package/dist/deploy/targets/flatpak-sources.d.ts +17 -0
  212. package/dist/deploy/targets/flatpak-sources.d.ts.map +1 -0
  213. package/dist/deploy/targets/flatpak-sources.js +108 -0
  214. package/dist/deploy/targets/flatpak-sources.js.map +1 -0
  215. package/dist/deploy/targets/flatpak.d.ts +4 -0
  216. package/dist/deploy/targets/flatpak.d.ts.map +1 -0
  217. package/dist/deploy/targets/flatpak.js +112 -0
  218. package/dist/deploy/targets/flatpak.js.map +1 -0
  219. package/dist/deploy/targets/nfpm-target.d.ts +5 -0
  220. package/dist/deploy/targets/nfpm-target.d.ts.map +1 -0
  221. package/dist/deploy/targets/nfpm-target.js +26 -0
  222. package/dist/deploy/targets/nfpm-target.js.map +1 -0
  223. package/dist/deploy/targets/rpm.d.ts +4 -0
  224. package/dist/deploy/targets/rpm.d.ts.map +1 -0
  225. package/dist/deploy/targets/rpm.js +4 -0
  226. package/dist/deploy/targets/rpm.js.map +1 -0
  227. package/dist/deploy/tools.d.ts +18 -0
  228. package/dist/deploy/tools.d.ts.map +1 -0
  229. package/dist/deploy/tools.js +92 -0
  230. package/dist/deploy/tools.js.map +1 -0
  231. package/dist/deploy/types.d.ts +140 -0
  232. package/dist/deploy/types.d.ts.map +1 -0
  233. package/dist/deploy/types.js +2 -0
  234. package/dist/deploy/types.js.map +1 -0
  235. package/dist/deploy/vendored/appimagetool.d.ts +7 -0
  236. package/dist/deploy/vendored/appimagetool.d.ts.map +1 -0
  237. package/dist/deploy/vendored/appimagetool.js +42 -0
  238. package/dist/deploy/vendored/appimagetool.js.map +1 -0
  239. package/dist/deploy/vendored/nfpm.d.ts +3 -0
  240. package/dist/deploy/vendored/nfpm.d.ts.map +1 -0
  241. package/dist/deploy/vendored/nfpm.js +60 -0
  242. package/dist/deploy/vendored/nfpm.js.map +1 -0
  243. package/dist/dev/change-queue.d.ts +11 -0
  244. package/dist/dev/change-queue.d.ts.map +1 -0
  245. package/dist/dev/change-queue.js +34 -0
  246. package/dist/dev/change-queue.js.map +1 -0
  247. package/dist/dev/entry-env.d.ts +3 -0
  248. package/dist/dev/entry-env.d.ts.map +1 -0
  249. package/dist/dev/entry-env.js +3 -0
  250. package/dist/dev/entry-env.js.map +1 -0
  251. package/dist/dev/failure-tracker.d.ts +10 -0
  252. package/dist/dev/failure-tracker.d.ts.map +1 -0
  253. package/dist/dev/failure-tracker.js +61 -0
  254. package/dist/dev/failure-tracker.js.map +1 -0
  255. package/dist/dev/missing-import.d.ts +4 -0
  256. package/dist/dev/missing-import.d.ts.map +1 -0
  257. package/dist/dev/missing-import.js +23 -0
  258. package/dist/dev/missing-import.js.map +1 -0
  259. package/dist/dev/runner-deps.d.ts.map +1 -1
  260. package/dist/dev/runner-deps.js +25 -5
  261. package/dist/dev/runner-deps.js.map +1 -1
  262. package/dist/dev/runner-main.d.ts.map +1 -1
  263. package/dist/dev/runner-main.js +3 -3
  264. package/dist/dev/runner-main.js.map +1 -1
  265. package/dist/dev/runner.d.ts +8 -3
  266. package/dist/dev/runner.d.ts.map +1 -1
  267. package/dist/dev/runner.js +343 -65
  268. package/dist/dev/runner.js.map +1 -1
  269. package/dist/dev/supervisor.d.ts +10 -4
  270. package/dist/dev/supervisor.d.ts.map +1 -1
  271. package/dist/dev/supervisor.js +23 -4
  272. package/dist/dev/supervisor.js.map +1 -1
  273. package/dist/dev/vite-dev-server.d.ts +13 -2
  274. package/dist/dev/vite-dev-server.d.ts.map +1 -1
  275. package/dist/dev/vite-dev-server.js +30 -2
  276. package/dist/dev/vite-dev-server.js.map +1 -1
  277. package/dist/internal/application-args.d.ts +6 -0
  278. package/dist/internal/application-args.d.ts.map +1 -0
  279. package/dist/internal/application-args.js +10 -0
  280. package/dist/internal/application-args.js.map +1 -0
  281. package/dist/internal/entry-arg.d.ts +1 -7
  282. package/dist/internal/entry-arg.d.ts.map +1 -1
  283. package/dist/internal/entry-arg.js +18 -11
  284. package/dist/internal/entry-arg.js.map +1 -1
  285. package/dist/internal/errors.d.ts +1 -2
  286. package/dist/internal/errors.d.ts.map +1 -1
  287. package/dist/internal/errors.js +1 -1
  288. package/dist/internal/errors.js.map +1 -1
  289. package/dist/internal/module-loads.d.ts +7 -0
  290. package/dist/internal/module-loads.d.ts.map +1 -0
  291. package/dist/internal/module-loads.js +21 -0
  292. package/dist/internal/module-loads.js.map +1 -0
  293. package/dist/internal/prepare-project.d.ts +16 -0
  294. package/dist/internal/prepare-project.d.ts.map +1 -0
  295. package/dist/internal/prepare-project.js +15 -0
  296. package/dist/internal/prepare-project.js.map +1 -0
  297. package/dist/internal/run-cli-tool.d.ts +11 -0
  298. package/dist/internal/run-cli-tool.d.ts.map +1 -0
  299. package/dist/internal/run-cli-tool.js +24 -0
  300. package/dist/internal/run-cli-tool.js.map +1 -0
  301. package/dist/internal/staging-dir.d.ts +8 -1
  302. package/dist/internal/staging-dir.d.ts.map +1 -1
  303. package/dist/internal/staging-dir.js +38 -2
  304. package/dist/internal/staging-dir.js.map +1 -1
  305. package/dist/mcp/client.d.ts +1 -1
  306. package/dist/mcp/client.d.ts.map +1 -1
  307. package/dist/mcp/client.js.map +1 -1
  308. package/dist/mcp/handlers.d.ts +1 -1
  309. package/dist/mcp/handlers.d.ts.map +1 -1
  310. package/dist/mcp/handlers.js +78 -41
  311. package/dist/mcp/handlers.js.map +1 -1
  312. package/dist/mcp/index.d.ts.map +1 -1
  313. package/dist/mcp/index.js +1 -0
  314. package/dist/mcp/index.js.map +1 -1
  315. package/dist/mcp/serialize-widget.d.ts +4 -3
  316. package/dist/mcp/serialize-widget.d.ts.map +1 -1
  317. package/dist/mcp/serialize-widget.js +47 -17
  318. package/dist/mcp/serialize-widget.js.map +1 -1
  319. package/dist/mcp/testing-loader.d.ts +5 -2
  320. package/dist/mcp/testing-loader.d.ts.map +1 -1
  321. package/dist/mcp/testing-loader.js +7 -3
  322. package/dist/mcp/testing-loader.js.map +1 -1
  323. package/dist/mcp/widget-properties.d.ts +6 -0
  324. package/dist/mcp/widget-properties.d.ts.map +1 -0
  325. package/dist/mcp/widget-properties.js +102 -0
  326. package/dist/mcp/widget-properties.js.map +1 -0
  327. package/dist/refresh-runtime.d.ts +2 -1
  328. package/dist/refresh-runtime.d.ts.map +1 -1
  329. package/dist/refresh-runtime.js +32 -2
  330. package/dist/refresh-runtime.js.map +1 -1
  331. package/dist/settings/compile.d.ts.map +1 -1
  332. package/dist/settings/compile.js +8 -12
  333. package/dist/settings/compile.js.map +1 -1
  334. package/dist/settings/schema.d.ts +1 -2
  335. package/dist/settings/schema.d.ts.map +1 -1
  336. package/dist/settings/schema.js +1 -1
  337. package/dist/settings/schema.js.map +1 -1
  338. package/dist/vite-plugins/asset-emitter.d.ts +9 -0
  339. package/dist/vite-plugins/asset-emitter.d.ts.map +1 -0
  340. package/dist/vite-plugins/asset-emitter.js +2 -0
  341. package/dist/vite-plugins/asset-emitter.js.map +1 -0
  342. package/dist/vite-plugins/asset-extensions.d.ts +2 -2
  343. package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
  344. package/dist/vite-plugins/asset-extensions.js +2 -1
  345. package/dist/vite-plugins/asset-extensions.js.map +1 -1
  346. package/dist/vite-plugins/asset-imports.d.ts +4 -0
  347. package/dist/vite-plugins/asset-imports.d.ts.map +1 -0
  348. package/dist/vite-plugins/asset-imports.js +88 -0
  349. package/dist/vite-plugins/asset-imports.js.map +1 -0
  350. package/dist/vite-plugins/asset-specifier.d.ts +5 -0
  351. package/dist/vite-plugins/asset-specifier.d.ts.map +1 -0
  352. package/dist/vite-plugins/asset-specifier.js +7 -0
  353. package/dist/vite-plugins/asset-specifier.js.map +1 -0
  354. package/dist/vite-plugins/built-url.d.ts.map +1 -1
  355. package/dist/vite-plugins/built-url.js +14 -10
  356. package/dist/vite-plugins/built-url.js.map +1 -1
  357. package/dist/vite-plugins/ensure-store.d.ts +4 -0
  358. package/dist/vite-plugins/ensure-store.d.ts.map +1 -0
  359. package/dist/vite-plugins/ensure-store.js +10 -0
  360. package/dist/vite-plugins/ensure-store.js.map +1 -0
  361. package/dist/vite-plugins/esm-extension.d.ts +4 -0
  362. package/dist/vite-plugins/esm-extension.d.ts.map +1 -0
  363. package/dist/vite-plugins/esm-extension.js +4 -0
  364. package/dist/vite-plugins/esm-extension.js.map +1 -0
  365. package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts +1 -3
  366. package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts.map +1 -1
  367. package/dist/vite-plugins/fast-refresh/swc-refresh.js +1 -1
  368. package/dist/vite-plugins/fast-refresh/swc-refresh.js.map +1 -1
  369. package/dist/vite-plugins/icons.d.ts.map +1 -1
  370. package/dist/vite-plugins/icons.js.map +1 -1
  371. package/dist/vite-plugins/index.d.ts.map +1 -1
  372. package/dist/vite-plugins/index.js +4 -0
  373. package/dist/vite-plugins/index.js.map +1 -1
  374. package/dist/vite-plugins/react-compiler.d.ts +1 -1
  375. package/dist/vite-plugins/react-compiler.d.ts.map +1 -1
  376. package/dist/vite-plugins/react-compiler.js.map +1 -1
  377. package/dist/vite-plugins/resource-shared.d.ts +2 -1
  378. package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
  379. package/dist/vite-plugins/resource-shared.js +2 -1
  380. package/dist/vite-plugins/resource-shared.js.map +1 -1
  381. package/dist/vite-plugins/resources.d.ts +1 -1
  382. package/dist/vite-plugins/resources.d.ts.map +1 -1
  383. package/dist/vite-plugins/resources.js +36 -44
  384. package/dist/vite-plugins/resources.js.map +1 -1
  385. package/dist/vite-plugins/self-contained.d.ts +4 -0
  386. package/dist/vite-plugins/self-contained.d.ts.map +1 -0
  387. package/dist/vite-plugins/self-contained.js +244 -0
  388. package/dist/vite-plugins/self-contained.js.map +1 -0
  389. package/dist/vite-plugins/settings.d.ts.map +1 -1
  390. package/dist/vite-plugins/settings.js +19 -40
  391. package/dist/vite-plugins/settings.js.map +1 -1
  392. package/dist/vite-plugins/store-links.d.ts +4 -0
  393. package/dist/vite-plugins/store-links.d.ts.map +1 -0
  394. package/dist/vite-plugins/store-links.js +19 -0
  395. package/dist/vite-plugins/store-links.js.map +1 -0
  396. package/dist/vite-plugins/undeclared-library.d.ts +1 -1
  397. package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
  398. package/dist/vite-plugins/undeclared-library.js +51 -12
  399. package/dist/vite-plugins/undeclared-library.js.map +1 -1
  400. package/dist/vite-plugins/worker.d.ts +4 -0
  401. package/dist/vite-plugins/worker.d.ts.map +1 -0
  402. package/dist/vite-plugins/worker.js +138 -0
  403. package/dist/vite-plugins/worker.js.map +1 -0
  404. package/dist/vitest-plugin.d.ts +7 -0
  405. package/dist/vitest-plugin.d.ts.map +1 -1
  406. package/dist/vitest-plugin.js +14 -1
  407. package/dist/vitest-plugin.js.map +1 -1
  408. package/env.d.ts +106 -25
  409. package/package.json +23 -12
  410. package/src/builder.ts +24 -5
  411. package/src/cli.ts +10 -3
  412. package/src/codegen/freshness.ts +2 -4
  413. package/src/codegen/run-codegen.ts +37 -23
  414. package/src/codegen/store-resolver.ts +1 -1
  415. package/src/commands/build.ts +5 -6
  416. package/src/commands/codegen.ts +14 -1
  417. package/src/commands/deploy.ts +47 -0
  418. package/src/commands/dev.ts +7 -5
  419. package/src/commands/docs.ts +39 -4
  420. package/src/deploy/depends.ts +42 -0
  421. package/src/deploy/download.ts +148 -0
  422. package/src/deploy/freedesktop/copyright.ts +41 -0
  423. package/src/deploy/freedesktop/dbus-service.ts +19 -0
  424. package/src/deploy/freedesktop/desktop-entry.ts +102 -0
  425. package/src/deploy/freedesktop/ini.ts +39 -0
  426. package/src/deploy/freedesktop/metainfo-sections.ts +116 -0
  427. package/src/deploy/freedesktop/metainfo.ts +46 -0
  428. package/src/deploy/freedesktop/mime-package.ts +28 -0
  429. package/src/deploy/freedesktop/validate.ts +124 -0
  430. package/src/deploy/freedesktop/xml.ts +53 -0
  431. package/src/deploy/git.ts +20 -0
  432. package/src/deploy/install-hints.ts +108 -0
  433. package/src/deploy/nfpm/config.ts +153 -0
  434. package/src/deploy/nfpm/contents.ts +69 -0
  435. package/src/deploy/nfpm/description.ts +11 -0
  436. package/src/deploy/nfpm/optional.ts +8 -0
  437. package/src/deploy/nfpm/pack.ts +44 -0
  438. package/src/deploy/node-runtime/download.ts +48 -0
  439. package/src/deploy/node-runtime/elf.ts +145 -0
  440. package/src/deploy/node-runtime/guard.ts +29 -0
  441. package/src/deploy/node-runtime/index.ts +80 -0
  442. package/src/deploy/payload/copy-tree.ts +51 -0
  443. package/src/deploy/payload/icons.ts +80 -0
  444. package/src/deploy/payload/launcher.ts +27 -0
  445. package/src/deploy/payload/schemas.ts +27 -0
  446. package/src/deploy/payload/stage.ts +145 -0
  447. package/src/deploy/registry.ts +40 -0
  448. package/src/deploy/run-deploy.ts +235 -0
  449. package/src/deploy/settings/arch.ts +18 -0
  450. package/src/deploy/settings/categories.ts +39 -0
  451. package/src/deploy/settings/exec.ts +29 -0
  452. package/src/deploy/settings/identity.ts +133 -0
  453. package/src/deploy/settings/index.ts +189 -0
  454. package/src/deploy/settings/package-manifest.ts +66 -0
  455. package/src/deploy/settings/paths.ts +115 -0
  456. package/src/deploy/settings/screenshots.ts +125 -0
  457. package/src/deploy/settings/starter.ts +41 -0
  458. package/src/deploy/settings/version.ts +59 -0
  459. package/src/deploy/targets/appimage.ts +140 -0
  460. package/src/deploy/targets/deb.ts +6 -0
  461. package/src/deploy/targets/flatpak-manifest.ts +61 -0
  462. package/src/deploy/targets/flatpak-prebuilt.ts +59 -0
  463. package/src/deploy/targets/flatpak-source.ts +168 -0
  464. package/src/deploy/targets/flatpak-sources.ts +171 -0
  465. package/src/deploy/targets/flatpak.ts +143 -0
  466. package/src/deploy/targets/nfpm-target.ts +33 -0
  467. package/src/deploy/targets/rpm.ts +6 -0
  468. package/src/deploy/tools.ts +135 -0
  469. package/src/deploy/types.ts +174 -0
  470. package/src/deploy/vendored/appimagetool.ts +57 -0
  471. package/src/deploy/vendored/nfpm.ts +79 -0
  472. package/src/dev/change-queue.ts +59 -0
  473. package/src/dev/entry-env.ts +3 -0
  474. package/src/dev/failure-tracker.ts +92 -0
  475. package/src/dev/missing-import.ts +32 -0
  476. package/src/dev/runner-deps.ts +34 -5
  477. package/src/dev/runner-main.ts +3 -4
  478. package/src/dev/runner.ts +524 -89
  479. package/src/dev/supervisor.ts +51 -11
  480. package/src/dev/vite-dev-server.ts +54 -3
  481. package/src/internal/application-args.ts +13 -0
  482. package/src/internal/entry-arg.ts +25 -11
  483. package/src/internal/errors.ts +1 -1
  484. package/src/internal/module-loads.ts +32 -0
  485. package/src/internal/prepare-project.ts +23 -0
  486. package/src/internal/run-cli-tool.ts +38 -0
  487. package/src/internal/staging-dir.ts +57 -2
  488. package/src/mcp/client.ts +1 -1
  489. package/src/mcp/handlers.ts +123 -56
  490. package/src/mcp/index.ts +1 -0
  491. package/src/mcp/serialize-widget.ts +73 -22
  492. package/src/mcp/testing-loader.ts +19 -4
  493. package/src/mcp/widget-properties.ts +153 -0
  494. package/src/refresh-runtime.ts +48 -2
  495. package/src/settings/compile.ts +8 -11
  496. package/src/settings/schema.ts +0 -1
  497. package/src/vite-plugins/asset-emitter.ts +5 -0
  498. package/src/vite-plugins/asset-extensions.ts +2 -1
  499. package/src/vite-plugins/asset-imports.ts +134 -0
  500. package/src/vite-plugins/asset-specifier.ts +9 -0
  501. package/src/vite-plugins/built-url.ts +19 -13
  502. package/src/vite-plugins/ensure-store.ts +14 -0
  503. package/src/vite-plugins/esm-extension.ts +4 -0
  504. package/src/vite-plugins/fast-refresh/swc-refresh.ts +1 -1
  505. package/src/vite-plugins/icons.ts +2 -5
  506. package/src/vite-plugins/index.ts +4 -0
  507. package/src/vite-plugins/react-compiler.ts +2 -1
  508. package/src/vite-plugins/resource-shared.ts +2 -0
  509. package/src/vite-plugins/resources.ts +43 -52
  510. package/src/vite-plugins/self-contained.ts +352 -0
  511. package/src/vite-plugins/settings.ts +23 -50
  512. package/src/vite-plugins/store-links.ts +25 -0
  513. package/src/vite-plugins/undeclared-library.ts +75 -13
  514. package/src/vite-plugins/worker.ts +238 -0
  515. package/src/vitest-plugin.ts +15 -1
  516. package/dist/internal/resolve-cli-tool.d.ts +0 -3
  517. package/dist/internal/resolve-cli-tool.d.ts.map +0 -1
  518. package/dist/internal/resolve-cli-tool.js +0 -27
  519. package/dist/internal/resolve-cli-tool.js.map +0 -1
  520. package/src/internal/resolve-cli-tool.ts +0 -37
@@ -1 +1 @@
1
- {"version":3,"file":"undeclared-library.js","sourceRoot":"","sources":["../../src/vite-plugins/undeclared-library.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAQ3D,MAAM,wBAAwB,GAAG,kCAAkC,CAAC;AAEpE,MAAM,cAAc,GAAG,KAAK,EAAE,KAAkB,EAAqB,EAAE;IACnE,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3D,KAAK,CAAC,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,KAAK,CAAC,OAAO,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAU,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAEhH,MAAM,iBAAiB,GAAG,CAAC,OAAiB,EAAE,SAAiB,EAAsB,EAAE,CACnF,qBAAqB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,SAAS,CAAC,CAAC;AAEhG,MAAM,sBAAsB,GAAG,CAAC,MAAc,EAAE,SAAiB,EAAE,OAAiB,EAAS,EAAE;IAC3F,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAEzD,IAAI,UAAU,KAAK,SAA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AAqB,EAAE,CAAC","sourcesContent":["import type { ConfigLoader } from \"@gtkx/config/internal\";\nimport type { Plugin, UserConfig } from \"vite\";\nimport { discoverGirNamespaces, resolveGirPath } from \"@gtkx/codegen\";\nimport { createConfigLoader } from \"@gtkx/config/internal\";\n\ntype PluginState = {\n root: string;\n loadConfig: ConfigLoader;\n girPath: string[] | null;\n};\n\nconst GENERATED_MODULE_PATTERN = /^@gtkx\\/(?:gi|jsx)\\/([a-z0-9]+)$/;\n\nconst girSearchPaths = async (state: PluginState): Promise<string[]> => {\n if (state.girPath === null) {\n const { config } = await state.loadConfig.load(state.root);\n state.girPath = resolveGirPath(config.girPath);\n }\n\n return state.girPath;\n};\n\nconst getNamespace = (identifier: string): string => identifier.slice(0, identifier.indexOf(\"-\")).toLowerCase();\n\nconst findGirIdentifier = (girPath: string[], namespace: string): string | undefined =>\n discoverGirNamespaces(girPath).find((identifier) => getNamespace(identifier) === namespace);\n\nconst undeclaredLibraryError = (source: string, namespace: string, girPath: string[]): Error => {\n const identifier = findGirIdentifier(girPath, namespace);\n\n if (identifier === undefined) {\n return new Error(\n `Cannot resolve \"${source}\": the binding store has no \"${namespace}\" module, and no GIR data for it ` +\n `was found in [${girPath.join(\", \")}]. If \"${namespace}\" is a library, install its ` +\n \"gobject-introspection data package and add its GIR identifier to `libraries` in gtkx.config.ts. \" +\n \"Otherwise run gtkx codegen to regenerate the store.\",\n );\n }\n\n return new Error(\n `Cannot resolve \"${source}\": the \"${identifier}\" bindings have not been generated. ` +\n `Add \"${identifier}\" to \\`libraries\\` in gtkx.config.ts, then run gtkx dev or gtkx build again.`,\n );\n};\n\nfunction gtkxUndeclaredLibrary(loadConfig: ConfigLoader = createConfigLoader()): Plugin {\n const state: PluginState = {\n root: \"\",\n loadConfig,\n girPath: null,\n };\n\n return {\n name: \"gtkx:undeclared-library\",\n enforce: \"pre\",\n\n config(config: UserConfig) {\n state.root = config.root ?? process.cwd();\n },\n\n async resolveId(source, importer, options) {\n const namespace = GENERATED_MODULE_PATTERN.exec(source)?.[1];\n\n if (namespace === undefined) {\n return;\n }\n\n const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });\n\n if (resolved !== null) {\n return;\n }\n\n throw undeclaredLibraryError(source, namespace, await girSearchPaths(state));\n },\n };\n}\n\nexport { gtkxUndeclaredLibrary };\n"]}
1
+ {"version":3,"file":"undeclared-library.js","sourceRoot":"","sources":["../../src/vite-plugins/undeclared-library.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAejC,MAAM,wBAAwB,GAAG,gCAAgC,CAAC;AAElE,MAAM,cAAc,GAAG,KAAK,EAAE,KAAkB,EAAqB,EAAE;IACnE,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3D,KAAK,CAAC,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,KAAK,CAAC,OAAO,CAAC;AACzB,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAU,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAEhH,MAAM,iBAAiB,GAAG,CAAC,OAAiB,EAAE,SAAiB,EAAsB,EAAE,CACnF,qBAAqB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,YA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AsB,CAAC,SAAS,EAAE,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,SAAS,qBAAqB,CAAC,aAA2B,kBAAkB,EAAE;IAC1E,MAAM,KAAK,GAAgB;QACvB,IAAI,EAAE,EAAE;QACR,UAAU;QACV,OAAO,EAAE,IAAI;KAChB,CAAC;IAEF,OAAO;QACH,IAAI,EAAE,yBAAyB;QAC/B,OAAO,EAAE,KAAK;QAEd,MAAM,CAAC,MAAkB;YACrB,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAC9C,CAAC;QAED,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO;YACrC,MAAM,SAAS,GAAG,oBAAoB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAEzD,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;gBACrB,OAAO;YACX,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAEtF,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;gBACpB,OAAO;YACX,CAAC;YAED,MAAM,MAAM,qBAAqB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QACxD,CAAC;KACJ,CAAC;AACN,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type { StoreOptions } from \"@gtkx/codegen\";\nimport type { ConfigLoader } from \"@gtkx/config\";\nimport type { Plugin, UserConfig } from \"vite\";\nimport { discoverGirNamespaces, resolveGirPath, resolveStore } from \"@gtkx/codegen\";\nimport { createConfigLoader } from \"@gtkx/config/internal\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\ntype PluginState = {\n root: string;\n loadConfig: ConfigLoader;\n girPath: string[] | null;\n};\n\ntype GeneratedModule = {\n source: string;\n kind: string;\n namespace: string;\n importer: string;\n};\n\nconst GENERATED_MODULE_PATTERN = /^@gtkx\\/(gi|jsx)\\/([a-z0-9]+)$/;\n\nconst girSearchPaths = async (state: PluginState): Promise<string[]> => {\n if (state.girPath === null) {\n const { config } = await state.loadConfig.load(state.root);\n state.girPath = resolveGirPath(config.girPath);\n }\n\n return state.girPath;\n};\n\nconst getNamespace = (identifier: string): string => identifier.slice(0, identifier.indexOf(\"-\")).toLowerCase();\n\nconst findGirIdentifier = (girPath: string[], namespace: string): string | undefined =>\n discoverGirNamespaces(girPath).find((identifier) => getNamespace(identifier) === namespace);\n\nconst parseGeneratedModule = (source: string, importer: string | undefined): GeneratedModule | null => {\n const matched = GENERATED_MODULE_PATTERN.exec(source);\n const kind = matched?.[1];\n const namespace = matched?.[2];\n\n if (kind === undefined || namespace === undefined) {\n return null;\n }\n\n return { source, kind, namespace, importer: importer ?? \"the project's sources\" };\n};\n\nconst getStoreOptions = (root: string, kind: string): StoreOptions | null => {\n try {\n const store = resolveStore(root);\n\n return kind === \"gi\" ? store.gi : store.jsx;\n } catch {\n return null;\n }\n};\n\nconst hasNamespaceModule = (storeDir: string, namespace: string): boolean => {\n const manifest = join(storeDir, \"package.json\");\n\n if (!existsSync(manifest)) {\n return false;\n }\n\n const { exports } = JSON.parse(readFileSync(manifest, \"utf8\")) as { exports?: Record<string, unknown> };\n\n return exports?.[`./${namespace}`] !== undefined;\n};\n\nconst unreachableStoreError = (generated: GeneratedModule, options: StoreOptions): Error =>\n new Error(\n `Cannot resolve \"${generated.source}\": the generated store in ${options.storeDir} does provide ` +\n `\"${generated.namespace}\", but its link at ${options.linkDir} is not on the module resolution path of ` +\n `${generated.importer}. Codegen writes the store into the node_modules the installed @gtkx packages ` +\n \"resolve from; install them where the importing file reaches them, then run gtkx codegen again.\",\n );\n\nconst undeclaredLibraryError = (generated: GeneratedModule, girPath: string[]): Error => {\n const identifier = findGirIdentifier(girPath, generated.namespace);\n\n if (identifier === undefined) {\n return new Error(\n `Cannot resolve \"${generated.source}\": the binding store has no \"${generated.namespace}\" module, and no ` +\n `GIR data for it was found in [${girPath.join(\", \")}]. If \"${generated.namespace}\" is a library, ` +\n \"install its gobject-introspection data package and add its GIR identifier to `libraries` in \" +\n \"gtkx.config.ts. Otherwise run gtkx codegen to regenerate the store.\",\n );\n }\n\n return new Error(\n `Cannot resolve \"${generated.source}\": the \"${identifier}\" bindings have not been generated. ` +\n `Add \"${identifier}\" to \\`libraries\\` in gtkx.config.ts, then run gtkx dev or gtkx build again.`,\n );\n};\n\nconst unresolvedModuleError = async (state: PluginState, generated: GeneratedModule): Promise<Error> => {\n const options = getStoreOptions(state.root, generated.kind);\n\n if (options !== null && hasNamespaceModule(options.storeDir, generated.namespace)) {\n return unreachableStoreError(generated, options);\n }\n\n return undeclaredLibraryError(generated, await girSearchPaths(state));\n};\n\nfunction gtkxUndeclaredLibrary(loadConfig: ConfigLoader = createConfigLoader()): Plugin {\n const state: PluginState = {\n root: \"\",\n loadConfig,\n girPath: null,\n };\n\n return {\n name: \"gtkx:undeclared-library\",\n enforce: \"pre\",\n\n config(config: UserConfig) {\n state.root = config.root ?? process.cwd();\n },\n\n async resolveId(source, importer, options) {\n const generated = parseGeneratedModule(source, importer);\n\n if (generated === null) {\n return;\n }\n\n const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });\n\n if (resolved !== null) {\n return;\n }\n\n throw await unresolvedModuleError(state, generated);\n },\n };\n}\n\nexport { gtkxUndeclaredLibrary };\n"]}
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from "vite";
2
+ declare function gtkxWorker(): Plugin;
3
+ export { gtkxWorker };
4
+ //# sourceMappingURL=worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/vite-plugins/worker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAU,MAAM,MAAM,CAAC;AAgO3C,iBAAS,UAAU,IAAI,MAAM,CAW5B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,138 @@
1
+ import { createHash } from "node:crypto";
2
+ import { basename, extname } from "node:path";
3
+ import { ESM_EXTENSION } from "./esm-extension.js";
4
+ import { stripQuery } from "./strip-query.js";
5
+ const RELATIVE_SPECIFIER = String.raw `(?<quote>["'])(?<specifier>\.{1,2}\/[^"']+)\k<quote>`;
6
+ const URL_CALL = String.raw `new\s+URL\s*\(\s*${RELATIVE_SPECIFIER}\s*,\s*import\.meta\.url\s*\)`;
7
+ const URL_DECLARATION = String.raw `(?:const|let|var)\s+(?<name>[A-Za-z_$][\w$]*)\s*(?::[^=;\n]+)?=\s*`;
8
+ const BLOCK_COMMENT = String.raw `\/\*[\s\S]*?\*\/`;
9
+ const LINE_COMMENT = String.raw `\/\/[^\n]*`;
10
+ const DOUBLE_QUOTED = String.raw `"(?:[^"\\\n]|\\[\s\S])*"`;
11
+ const SINGLE_QUOTED = String.raw `'(?:[^'\\\n]|\\[\s\S])*'`;
12
+ const TEMPLATE_LITERAL = String.raw `\`(?:[^\`\\]|\\[\s\S])*\``;
13
+ const WORKER_URL = new RegExp(URL_CALL, "g");
14
+ const HOISTED_WORKER_URL = new RegExp(URL_DECLARATION + URL_CALL, "g");
15
+ const WORKER_CONSTRUCTION = /new\s+(?:\w+\.)?Worker\s*\(\s*$/;
16
+ const NON_CODE = new RegExp([BLOCK_COMMENT, LINE_COMMENT, DOUBLE_QUOTED, SINGLE_QUOTED, TEMPLATE_LITERAL].join("|"), "g");
17
+ const WORKER_DIR = "workers";
18
+ const SUGGESTED_EXTENSIONS = {
19
+ ".cjs": [".cts"],
20
+ ".js": [".ts", ".tsx"],
21
+ ".jsx": [".tsx"],
22
+ ".mjs": [".mts"],
23
+ };
24
+ const workerFileName = (id) => {
25
+ const path = stripQuery(id);
26
+ const stem = basename(path, extname(path));
27
+ const digest = createHash("sha256").update(id).digest("hex").slice(0, 8);
28
+ return `${WORKER_DIR}/${stem}-${digest}${ESM_EXTENSION}`;
29
+ };
30
+ const nonCodeRanges = (code) => code
31
+ .matchAll(NON_CODE)
32
+ .map((match) => ({ start: match.index, end: match.index + match[0].length }))
33
+ .toArray();
34
+ const isCodePosition = (scan, index) => scan.nonCode.every((range) => index < range.start || index >= range.end);
35
+ const isWorkerConstruction = (code, matchIndex) => WORKER_CONSTRUCTION.test(code.slice(0, matchIndex));
36
+ const hasWorkerCandidate = (code) => code.includes("import.meta.url") && code.includes("Worker");
37
+ const workerUrlExpression = (fileName) => {
38
+ const specifier = JSON.stringify(`./${fileName}`);
39
+ return `new URL(${specifier}, import.meta.url)`;
40
+ };
41
+ const inlineWorkerExample = (specifier) => `new Worker(new URL(${JSON.stringify(specifier)}, import.meta.url))`;
42
+ const hoistedWorkerError = (scan, hoisted) => new Error(`${stripQuery(scan.id)}: the worker URL for ${JSON.stringify(hoisted.specifier)} is bound to ` +
43
+ `"${hoisted.name}" before it reaches "new Worker". gtkx build emits a worker chunk only for a URL ` +
44
+ `written inside the construction. Write ${inlineWorkerExample(hoisted.specifier)} instead.`);
45
+ const unresolvedWorkerError = (scan, specifier, suggestion) => new Error(`${stripQuery(scan.id)}: the worker specifier ${JSON.stringify(specifier)} does not resolve to a module, ` +
46
+ "so no worker chunk can be emitted. " +
47
+ (suggestion === null
48
+ ? "Correct the path so it names the worker source file as it exists on disk."
49
+ : `Write ${inlineWorkerExample(suggestion)} instead.`));
50
+ const suggestionFor = async (emit, scan, specifier) => {
51
+ const extension = extname(specifier);
52
+ const stem = specifier.slice(0, specifier.length - extension.length);
53
+ const candidates = SUGGESTED_EXTENSIONS[extension] ?? [];
54
+ for (const candidate of candidates) {
55
+ const resolved = await emit.context.resolve(stem + candidate, scan.id);
56
+ if (resolved !== null) {
57
+ return stem + candidate;
58
+ }
59
+ }
60
+ return null;
61
+ };
62
+ const claimWorker = (emit, resolvedId) => {
63
+ const existing = emit.emitted.get(resolvedId);
64
+ if (existing !== undefined) {
65
+ return existing;
66
+ }
67
+ const fileName = workerFileName(resolvedId);
68
+ emit.emitted.set(resolvedId, fileName);
69
+ emit.context.emitFile({ type: "chunk", id: resolvedId, fileName });
70
+ return fileName;
71
+ };
72
+ const isRewritableUrl = (scan, match) => isCodePosition(scan, match.index) && isWorkerConstruction(scan.code, match.index);
73
+ const replacementFor = async (emit, scan, match) => {
74
+ const specifier = match.groups?.specifier;
75
+ if (specifier === undefined || !isRewritableUrl(scan, match)) {
76
+ return null;
77
+ }
78
+ const resolved = await emit.context.resolve(specifier, scan.id);
79
+ if (resolved === null) {
80
+ throw unresolvedWorkerError(scan, specifier, await suggestionFor(emit, scan, specifier));
81
+ }
82
+ return { start: match.index, end: match.index + match[0].length, fileName: claimWorker(emit, resolved.id) };
83
+ };
84
+ const collectReplacements = async (emit, scan) => {
85
+ const pending = scan.code.matchAll(WORKER_URL).map((match) => replacementFor(emit, scan, match)).toArray();
86
+ const found = await Promise.all(pending);
87
+ return found.filter((entry) => entry !== null);
88
+ };
89
+ const hasWorkerArgument = (scan, name) => {
90
+ const escaped = name.replaceAll("$", String.raw `\$`);
91
+ const pattern = new RegExp(String.raw `new\s+(?:\w+\.)?Worker\s*\(\s*${escaped}\s*[,)]`, "g");
92
+ return scan.code.matchAll(pattern).some((match) => isCodePosition(scan, match.index));
93
+ };
94
+ const hoistedUrlFor = (scan, match) => {
95
+ const name = match.groups?.name;
96
+ const specifier = match.groups?.specifier;
97
+ if (name === undefined || specifier === undefined || !isCodePosition(scan, match.index)) {
98
+ return null;
99
+ }
100
+ return { name, specifier };
101
+ };
102
+ const findHoistedWorkerUrl = (scan) => scan.code
103
+ .matchAll(HOISTED_WORKER_URL)
104
+ .map((match) => hoistedUrlFor(scan, match))
105
+ .find((entry) => entry !== null && hasWorkerArgument(scan, entry.name)) ?? null;
106
+ const applyReplacements = (code, replacements) => {
107
+ let output = "";
108
+ let cursor = 0;
109
+ for (const { start, end, fileName } of replacements) {
110
+ output += code.slice(cursor, start) + workerUrlExpression(fileName);
111
+ cursor = end;
112
+ }
113
+ return output + code.slice(cursor);
114
+ };
115
+ const transformWorkerUrls = async (emit, code, id) => {
116
+ if (!hasWorkerCandidate(code)) {
117
+ return null;
118
+ }
119
+ const scan = { code, id, nonCode: nonCodeRanges(code) };
120
+ const hoisted = findHoistedWorkerUrl(scan);
121
+ if (hoisted !== null) {
122
+ throw hoistedWorkerError(scan, hoisted);
123
+ }
124
+ const replacements = await collectReplacements(emit, scan);
125
+ return replacements.length === 0 ? null : { code: applyReplacements(code, replacements), map: null };
126
+ };
127
+ function gtkxWorker() {
128
+ const emitted = new Map();
129
+ return {
130
+ name: "gtkx:worker",
131
+ apply: "build",
132
+ transform(code, id) {
133
+ return transformWorkerUrls({ context: this, emitted }, code, id);
134
+ },
135
+ };
136
+ }
137
+ export { gtkxWorker };
138
+ //# sourceMappingURL=worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/vite-plugins/worker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAkC9C,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA,sDAAsD,CAAC;AAC5F,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAA,oBAAoB,kBAAkB,+BAA+B,CAAC;AACjG,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA,oEAAoE,CAAC;AACvG,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA,kBAAkB,CAAC;AACnD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA,YAAY,CAAC;AAC5C,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA,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IAAI,CAAC;IAChB,CAAC;IAED,MAAM,IAAI,GAAgB,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;IACrE,MAAM,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAE3C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE3D,OAAO,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACzG,CAAC,CAAC;AAEF,SAAS,UAAU;IACf,MAAM,OAAO,GAAwB,IAAI,GAAG,EAAE,CAAC;IAE/C,OAAO;QACH,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,OAAO;QAEd,SAAS,CAAC,IAAI,EAAE,EAAE;YACd,OAAO,mBAAmB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACrE,CAAC;KACJ,CAAC;AACN,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type { Plugin, Rollup } from \"vite\";\nimport { createHash } from \"node:crypto\";\nimport { basename, extname } from \"node:path\";\nimport { ESM_EXTENSION } from \"./esm-extension.js\";\nimport { stripQuery } from \"./strip-query.js\";\n\ntype WorkerReplacement = {\n start: number;\n end: number;\n fileName: string;\n};\n\ntype EmitContext = {\n context: Rollup.PluginContext;\n emitted: Map<string, string>;\n};\n\ntype SourceRange = {\n start: number;\n end: number;\n};\n\ntype ScanContext = {\n code: string;\n id: string;\n nonCode: SourceRange[];\n};\n\ntype HoistedWorkerUrl = {\n name: string;\n specifier: string;\n};\n\ntype TransformResult = {\n code: string;\n map: null;\n} | null;\n\nconst RELATIVE_SPECIFIER = String.raw`(?<quote>[\"'])(?<specifier>\\.{1,2}\\/[^\"']+)\\k<quote>`;\nconst URL_CALL = String.raw`new\\s+URL\\s*\\(\\s*${RELATIVE_SPECIFIER}\\s*,\\s*import\\.meta\\.url\\s*\\)`;\nconst URL_DECLARATION = String.raw`(?:const|let|var)\\s+(?<name>[A-Za-z_$][\\w$]*)\\s*(?::[^=;\\n]+)?=\\s*`;\nconst BLOCK_COMMENT = String.raw`\\/\\*[\\s\\S]*?\\*\\/`;\nconst LINE_COMMENT = String.raw`\\/\\/[^\\n]*`;\nconst DOUBLE_QUOTED = String.raw`\"(?:[^\"\\\\\\n]|\\\\[\\s\\S])*\"`;\nconst SINGLE_QUOTED = String.raw`'(?:[^'\\\\\\n]|\\\\[\\s\\S])*'`;\nconst TEMPLATE_LITERAL = String.raw`\\`(?:[^\\`\\\\]|\\\\[\\s\\S])*\\``;\nconst WORKER_URL = new RegExp(URL_CALL, \"g\");\nconst HOISTED_WORKER_URL = new RegExp(URL_DECLARATION + URL_CALL, \"g\");\nconst WORKER_CONSTRUCTION = /new\\s+(?:\\w+\\.)?Worker\\s*\\(\\s*$/;\n\nconst NON_CODE = new RegExp(\n [BLOCK_COMMENT, LINE_COMMENT, DOUBLE_QUOTED, SINGLE_QUOTED, TEMPLATE_LITERAL].join(\"|\"),\n \"g\",\n);\n\nconst WORKER_DIR = \"workers\";\n\nconst SUGGESTED_EXTENSIONS: Record<string, string[]> = {\n \".cjs\": [\".cts\"],\n \".js\": [\".ts\", \".tsx\"],\n \".jsx\": [\".tsx\"],\n \".mjs\": [\".mts\"],\n};\n\nconst workerFileName = (id: string): string => {\n const path = stripQuery(id);\n const stem = basename(path, extname(path));\n const digest = createHash(\"sha256\").update(id).digest(\"hex\").slice(0, 8);\n\n return `${WORKER_DIR}/${stem}-${digest}${ESM_EXTENSION}`;\n};\n\nconst nonCodeRanges = (code: string): SourceRange[] =>\n code\n .matchAll(NON_CODE)\n .map((match) => ({ start: match.index, end: match.index + match[0].length }))\n .toArray();\n\nconst isCodePosition = (scan: ScanContext, index: number): boolean =>\n scan.nonCode.every((range) => index < range.start || index >= range.end);\n\nconst isWorkerConstruction = (code: string, matchIndex: number): boolean =>\n WORKER_CONSTRUCTION.test(code.slice(0, matchIndex));\n\nconst hasWorkerCandidate = (code: string): boolean => code.includes(\"import.meta.url\") && code.includes(\"Worker\");\n\nconst workerUrlExpression = (fileName: string): string => {\n const specifier = JSON.stringify(`./${fileName}`);\n\n return `new URL(${specifier}, import.meta.url)`;\n};\n\nconst inlineWorkerExample = (specifier: string): string =>\n `new Worker(new URL(${JSON.stringify(specifier)}, import.meta.url))`;\n\nconst hoistedWorkerError = (scan: ScanContext, hoisted: HoistedWorkerUrl): Error =>\n new Error(\n `${stripQuery(scan.id)}: the worker URL for ${JSON.stringify(hoisted.specifier)} is bound to ` +\n `\"${hoisted.name}\" before it reaches \"new Worker\". gtkx build emits a worker chunk only for a URL ` +\n `written inside the construction. Write ${inlineWorkerExample(hoisted.specifier)} instead.`,\n );\n\nconst unresolvedWorkerError = (scan: ScanContext, specifier: string, suggestion: string | null): Error =>\n new Error(\n `${stripQuery(scan.id)}: the worker specifier ${JSON.stringify(specifier)} does not resolve to a module, ` +\n \"so no worker chunk can be emitted. \" +\n (suggestion === null\n ? \"Correct the path so it names the worker source file as it exists on disk.\"\n : `Write ${inlineWorkerExample(suggestion)} instead.`),\n );\n\nconst suggestionFor = async (emit: EmitContext, scan: ScanContext, specifier: string): Promise<string | null> => {\n const extension = extname(specifier);\n const stem = specifier.slice(0, specifier.length - extension.length);\n const candidates = SUGGESTED_EXTENSIONS[extension] ?? [];\n\n for (const candidate of candidates) {\n const resolved = await emit.context.resolve(stem + candidate, scan.id);\n\n if (resolved !== null) {\n return stem + candidate;\n }\n }\n\n return null;\n};\n\nconst claimWorker = (emit: EmitContext, resolvedId: string): string => {\n const existing = emit.emitted.get(resolvedId);\n\n if (existing !== undefined) {\n return existing;\n }\n\n const fileName = workerFileName(resolvedId);\n emit.emitted.set(resolvedId, fileName);\n emit.context.emitFile({ type: \"chunk\", id: resolvedId, fileName });\n\n return fileName;\n};\n\nconst isRewritableUrl = (scan: ScanContext, match: RegExpExecArray): boolean =>\n isCodePosition(scan, match.index) && isWorkerConstruction(scan.code, match.index);\n\nconst replacementFor = async (\n emit: EmitContext,\n scan: ScanContext,\n match: RegExpExecArray,\n): Promise<WorkerReplacement | null> => {\n const specifier = match.groups?.specifier;\n\n if (specifier === undefined || !isRewritableUrl(scan, match)) {\n return null;\n }\n\n const resolved = await emit.context.resolve(specifier, scan.id);\n\n if (resolved === null) {\n throw unresolvedWorkerError(scan, specifier, await suggestionFor(emit, scan, specifier));\n }\n\n return { start: match.index, end: match.index + match[0].length, fileName: claimWorker(emit, resolved.id) };\n};\n\nconst collectReplacements = async (emit: EmitContext, scan: ScanContext): Promise<WorkerReplacement[]> => {\n const pending = scan.code.matchAll(WORKER_URL).map((match) => replacementFor(emit, scan, match)).toArray();\n const found = await Promise.all(pending);\n\n return found.filter((entry) => entry !== null);\n};\n\nconst hasWorkerArgument = (scan: ScanContext, name: string): boolean => {\n const escaped = name.replaceAll(\"$\", String.raw`\\$`);\n const pattern = new RegExp(String.raw`new\\s+(?:\\w+\\.)?Worker\\s*\\(\\s*${escaped}\\s*[,)]`, \"g\");\n\n return scan.code.matchAll(pattern).some((match) => isCodePosition(scan, match.index));\n};\n\nconst hoistedUrlFor = (scan: ScanContext, match: RegExpExecArray): HoistedWorkerUrl | null => {\n const name = match.groups?.name;\n const specifier = match.groups?.specifier;\n\n if (name === undefined || specifier === undefined || !isCodePosition(scan, match.index)) {\n return null;\n }\n\n return { name, specifier };\n};\n\nconst findHoistedWorkerUrl = (scan: ScanContext): HoistedWorkerUrl | null =>\n scan.code\n .matchAll(HOISTED_WORKER_URL)\n .map((match) => hoistedUrlFor(scan, match))\n .find((entry) => entry !== null && hasWorkerArgument(scan, entry.name)) ?? null;\n\nconst applyReplacements = (code: string, replacements: WorkerReplacement[]): string => {\n let output = \"\";\n let cursor = 0;\n\n for (const { start, end, fileName } of replacements) {\n output += code.slice(cursor, start) + workerUrlExpression(fileName);\n cursor = end;\n }\n\n return output + code.slice(cursor);\n};\n\nconst transformWorkerUrls = async (emit: EmitContext, code: string, id: string): Promise<TransformResult> => {\n if (!hasWorkerCandidate(code)) {\n return null;\n }\n\n const scan: ScanContext = { code, id, nonCode: nonCodeRanges(code) };\n const hoisted = findHoistedWorkerUrl(scan);\n\n if (hoisted !== null) {\n throw hoistedWorkerError(scan, hoisted);\n }\n\n const replacements = await collectReplacements(emit, scan);\n\n return replacements.length === 0 ? null : { code: applyReplacements(code, replacements), map: null };\n};\n\nfunction gtkxWorker(): Plugin {\n const emitted: Map<string, string> = new Map();\n\n return {\n name: \"gtkx:worker\",\n apply: \"build\",\n\n transform(code, id) {\n return transformWorkerUrls({ context: this, emitted }, code, id);\n },\n };\n}\n\nexport { gtkxWorker };\n"]}
@@ -1,4 +1,11 @@
1
1
  import type { Plugin } from "vite";
2
+ /**
3
+ * Vite plugin stack for testing a GTKX application: the generated bindings the tests import,
4
+ * the plugins the app is built with, the project's compiled GSettings schemas exposed to every
5
+ * test worker, and a headless display per worker.
6
+ *
7
+ * @returns The plugins to spread into a Vitest config.
8
+ */
2
9
  declare const gtkx: () => Plugin[];
3
10
  export default gtkx;
4
11
  //# sourceMappingURL=vitest-plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vitest-plugin.d.ts","sourceRoot":"","sources":["../src/vitest-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAKnC,QAAA,MAAM,IAAI,QAAO,MAAM,EAAmE,CAAC;AAC3F,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"vitest-plugin.d.ts","sourceRoot":"","sources":["../src/vitest-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAMnC;;;;;;GAMG;AACH,QAAA,MAAM,IAAI,QAAO,MAAM,EAKtB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,6 +1,19 @@
1
1
  import gtkxVitest from "@gtkx/vitest";
2
+ import { gtkxEnsureStore } from "./vite-plugins/ensure-store.js";
2
3
  import { gtkxVitePlugins } from "./vite-plugins/index.js";
3
4
  import { gtkxSettingsWorkerEnv } from "./vite-plugins/settings-worker-env.js";
4
- const gtkx = () => [...gtkxVitePlugins(), gtkxSettingsWorkerEnv(), gtkxVitest()];
5
+ /**
6
+ * Vite plugin stack for testing a GTKX application: the generated bindings the tests import,
7
+ * the plugins the app is built with, the project's compiled GSettings schemas exposed to every
8
+ * test worker, and a headless display per worker.
9
+ *
10
+ * @returns The plugins to spread into a Vitest config.
11
+ */
12
+ const gtkx = () => [
13
+ gtkxEnsureStore(),
14
+ ...gtkxVitePlugins(),
15
+ gtkxSettingsWorkerEnv(),
16
+ gtkxVitest(),
17
+ ];
5
18
  export default gtkx;
6
19
  //# sourceMappingURL=vitest-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vitest-plugin.js","sourceRoot":"","sources":["../src/vitest-plugin.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,MAAM,IAAI,GAAG,GAAa,EAAE,CAAC,CAAC,GAAG,eAAe,EAAE,EAAE,qBAAqB,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;AAC3F,eAAe,IAAI,CAAC","sourcesContent":["import type { Plugin } from \"vite\";\nimport gtkxVitest from \"@gtkx/vitest\";\nimport { gtkxVitePlugins } from \"./vite-plugins/index.js\";\nimport { gtkxSettingsWorkerEnv } from \"./vite-plugins/settings-worker-env.js\";\n\nconst gtkx = (): Plugin[] => [...gtkxVitePlugins(), gtkxSettingsWorkerEnv(), gtkxVitest()];\nexport default gtkx;\n"]}
1
+ {"version":3,"file":"vitest-plugin.js","sourceRoot":"","sources":["../src/vitest-plugin.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E;;;;;;GAMG;AACH,MAAM,IAAI,GAAG,GAAa,EAAE,CAAC;IACzB,eAAe,EAAE;IACjB,GAAG,eAAe,EAAE;IACpB,qBAAqB,EAAE;IACvB,UAAU,EAAE;CACf,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import type { Plugin } from \"vite\";\nimport gtkxVitest from \"@gtkx/vitest\";\nimport { gtkxEnsureStore } from \"./vite-plugins/ensure-store.js\";\nimport { gtkxVitePlugins } from \"./vite-plugins/index.js\";\nimport { gtkxSettingsWorkerEnv } from \"./vite-plugins/settings-worker-env.js\";\n\n/**\n * Vite plugin stack for testing a GTKX application: the generated bindings the tests import,\n * the plugins the app is built with, the project's compiled GSettings schemas exposed to every\n * test worker, and a headless display per worker.\n *\n * @returns The plugins to spread into a Vitest config.\n */\nconst gtkx = (): Plugin[] => [\n gtkxEnsureStore(),\n ...gtkxVitePlugins(),\n gtkxSettingsWorkerEnv(),\n gtkxVitest(),\n];\n\nexport default gtkx;\n"]}
package/env.d.ts CHANGED
@@ -1,107 +1,167 @@
1
1
  /// <reference types="vite/client" />
2
2
  /// <reference types="@gtkx/react/env" />
3
3
 
4
- declare module "*.aac" {
4
+ declare module "#data/*.aac" {
5
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
6
+ const resourceUri: string;
5
7
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
6
8
  export const path: string;
9
+ export default resourceUri;
7
10
  }
8
11
 
9
- declare module "*.avif" {
12
+ declare module "#data/*.avif" {
13
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
14
+ const resourceUri: string;
10
15
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
11
16
  export const path: string;
17
+ export default resourceUri;
12
18
  }
13
19
 
14
- declare module "*.eot" {
20
+ declare module "#data/*.data" {
21
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
22
+ const resourceUri: string;
15
23
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
16
24
  export const path: string;
25
+ export default resourceUri;
17
26
  }
18
27
 
19
- declare module "*.flac" {
28
+ declare module "#data/*.eot" {
29
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
30
+ const resourceUri: string;
20
31
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
21
32
  export const path: string;
33
+ export default resourceUri;
22
34
  }
23
35
 
24
- declare module "*.gif" {
36
+ declare module "#data/*.flac" {
37
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
38
+ const resourceUri: string;
25
39
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
26
40
  export const path: string;
41
+ export default resourceUri;
27
42
  }
28
43
 
29
- declare module "*.ico" {
44
+ declare module "#data/*.gif" {
45
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
46
+ const resourceUri: string;
30
47
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
31
48
  export const path: string;
49
+ export default resourceUri;
32
50
  }
33
51
 
34
- declare module "*.jpeg" {
52
+ declare module "#data/*.gpa" {
53
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
54
+ const resourceUri: string;
35
55
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
36
56
  export const path: string;
57
+ export default resourceUri;
37
58
  }
38
59
 
39
- declare module "*.jpg" {
60
+ declare module "#data/*.ico" {
61
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
62
+ const resourceUri: string;
40
63
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
41
64
  export const path: string;
65
+ export default resourceUri;
42
66
  }
43
67
 
44
- declare module "*.mp3" {
68
+ declare module "#data/*.jpeg" {
69
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
70
+ const resourceUri: string;
45
71
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
46
72
  export const path: string;
73
+ export default resourceUri;
47
74
  }
48
75
 
49
- declare module "*.mp4" {
76
+ declare module "#data/*.jpg" {
77
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
78
+ const resourceUri: string;
50
79
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
51
80
  export const path: string;
81
+ export default resourceUri;
52
82
  }
53
83
 
54
- declare module "*.ogg" {
84
+ declare module "#data/*.mp3" {
85
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
86
+ const resourceUri: string;
55
87
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
56
88
  export const path: string;
89
+ export default resourceUri;
57
90
  }
58
91
 
59
- declare module "*.otf" {
92
+ declare module "#data/*.mp4" {
93
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
94
+ const resourceUri: string;
60
95
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
61
96
  export const path: string;
97
+ export default resourceUri;
62
98
  }
63
99
 
64
- declare module "*.png" {
100
+ declare module "#data/*.ogg" {
101
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
102
+ const resourceUri: string;
65
103
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
66
104
  export const path: string;
105
+ export default resourceUri;
67
106
  }
68
107
 
69
- declare module "*.svg" {
108
+ declare module "#data/*.otf" {
109
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
110
+ const resourceUri: string;
70
111
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
71
112
  export const path: string;
113
+ export default resourceUri;
72
114
  }
73
115
 
74
- declare module "*.ttf" {
116
+ declare module "#data/*.png" {
117
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
118
+ const resourceUri: string;
75
119
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
76
120
  export const path: string;
121
+ export default resourceUri;
77
122
  }
78
123
 
79
- declare module "*.wav" {
124
+ declare module "#data/*.svg" {
125
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
126
+ const resourceUri: string;
80
127
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
81
128
  export const path: string;
129
+ export default resourceUri;
82
130
  }
83
131
 
84
- declare module "*.webm" {
132
+ declare module "#data/*.ttf" {
133
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
134
+ const resourceUri: string;
85
135
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
86
136
  export const path: string;
137
+ export default resourceUri;
87
138
  }
88
139
 
89
- declare module "*.webp" {
140
+ declare module "#data/*.wav" {
141
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
142
+ const resourceUri: string;
90
143
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
91
144
  export const path: string;
145
+ export default resourceUri;
92
146
  }
93
147
 
94
- declare module "*.woff" {
148
+ declare module "#data/*.webm" {
149
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
150
+ const resourceUri: string;
95
151
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
96
152
  export const path: string;
153
+ export default resourceUri;
97
154
  }
98
155
 
99
- declare module "*.woff2" {
156
+ declare module "#data/*.webp" {
157
+ /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
158
+ const resourceUri: string;
100
159
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
101
160
  export const path: string;
161
+ export default resourceUri;
102
162
  }
103
163
 
104
- declare module "*.data" {
164
+ declare module "#data/*.woff" {
105
165
  /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
106
166
  const resourceUri: string;
107
167
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
@@ -109,7 +169,7 @@ declare module "*.data" {
109
169
  export default resourceUri;
110
170
  }
111
171
 
112
- declare module "*.gpa" {
172
+ declare module "#data/*.woff2" {
113
173
  /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
114
174
  const resourceUri: string;
115
175
  /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
@@ -117,8 +177,29 @@ declare module "*.gpa" {
117
177
  export default resourceUri;
118
178
  }
119
179
 
180
+ declare module "*.data" {
181
+ /**
182
+ * URL of the emitted asset: a dev server URL under `gtkx dev`, an absolute filesystem path once built.
183
+ * Import it under `#data/` instead for a GResource path and a `resource://` URI.
184
+ */
185
+ const assetUrl: string;
186
+ export default assetUrl;
187
+ }
188
+
189
+ declare module "*.gpa" {
190
+ /**
191
+ * URL of the emitted asset: a dev server URL under `gtkx dev`, an absolute filesystem path once built.
192
+ * Import it under `#data/` instead for a GResource path and a `resource://` URI.
193
+ */
194
+ const assetUrl: string;
195
+ export default assetUrl;
196
+ }
197
+
120
198
  declare module "*.css?url" {
121
- /** Filesystem path of the emitted stylesheet, imported without installing it on the default display. */
122
- const path: string;
123
- export default path;
199
+ /**
200
+ * URL of the emitted stylesheet, imported without installing it on the default display: a dev server URL
201
+ * under `gtkx dev`, an absolute filesystem path once built.
202
+ */
203
+ const styleSheetUrl: string;
204
+ export default styleSheetUrl;
124
205
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtkx/cli",
3
- "version": "1.0.0-rc.4",
3
+ "version": "1.1.0",
4
4
  "description": "Command-line tool and Vite plugin stack that scaffolds, develops, builds, and documents GTKX applications",
5
5
  "keywords": [
6
6
  "gtkx",
@@ -29,6 +29,7 @@
29
29
  "author": "Eugenio Depalo <eugeniodepalo@gmail.com>",
30
30
  "type": "module",
31
31
  "exports": {
32
+ "./env": "./env.d.ts",
32
33
  "./package.json": "./package.json",
33
34
  "./refresh-runtime": {
34
35
  "types": "./dist/refresh-runtime.d.ts",
@@ -37,8 +38,7 @@
37
38
  "./vitest-plugin": {
38
39
  "types": "./dist/vitest-plugin.d.ts",
39
40
  "default": "./dist/vitest-plugin.js"
40
- },
41
- "./env": "./env.d.ts"
41
+ }
42
42
  },
43
43
  "bin": {
44
44
  "gtkx": "bin/gtkx.js"
@@ -50,6 +50,16 @@
50
50
  "env.d.ts",
51
51
  "src"
52
52
  ],
53
+ "nx": {
54
+ "targets": {
55
+ "lint": {
56
+ "options": {
57
+ "cwd": ".",
58
+ "command": "eslint {projectRoot}"
59
+ }
60
+ }
61
+ }
62
+ },
53
63
  "engines": {
54
64
  "node": ">=24"
55
65
  },
@@ -61,20 +71,21 @@
61
71
  "citty": "^0.2.2",
62
72
  "fast-xml-parser": "^5.10.1",
63
73
  "react-refresh": "^0.18.0",
64
- "vite": "^8.2.0",
65
- "@gtkx/codegen": "1.0.0-rc.4",
66
- "@gtkx/config": "1.0.0-rc.4",
67
- "@gtkx/runtime": "1.0.0-rc.4",
68
- "@gtkx/utils": "1.0.0-rc.4",
69
- "@gtkx/mcp": "1.0.0-rc.4",
70
- "@gtkx/vitest": "1.0.0-rc.4",
71
- "create-gtkx": "1.0.0-rc.4"
74
+ "vite": "^8.2.1",
75
+ "yaml": "^2.9.0",
76
+ "@gtkx/codegen": "1.1.0",
77
+ "@gtkx/runtime": "1.1.0",
78
+ "@gtkx/mcp": "1.1.0",
79
+ "@gtkx/config": "1.1.0",
80
+ "@gtkx/utils": "1.1.0",
81
+ "create-gtkx": "1.1.0",
82
+ "@gtkx/vitest": "1.1.0"
72
83
  },
73
84
  "devDependencies": {
74
85
  "@types/babel__core": "^7.20.5",
75
86
  "@types/react-refresh": "^0.14.7",
76
87
  "vitest": "^4.1.10",
77
- "@gtkx/testing": "1.0.0-rc.4"
88
+ "@gtkx/testing": "1.1.0"
78
89
  },
79
90
  "peerDependencies": {
80
91
  "react": "^19"
package/src/builder.ts CHANGED
@@ -1,7 +1,11 @@
1
+ import { join, posix } from "node:path";
1
2
  import { type InlineConfig, mergeConfig, build as viteBuild } from "vite";
2
3
  import { gtkxBuiltUrl } from "./vite-plugins/built-url.js";
4
+ import { BUNDLE_FILENAME, ESM_EXTENSION } from "./vite-plugins/esm-extension.js";
3
5
  import { gtkxVitePlugins } from "./vite-plugins/index.js";
4
6
  import { gtkxNative } from "./vite-plugins/native.js";
7
+ import { gtkxSelfContained } from "./vite-plugins/self-contained.js";
8
+ import { gtkxWorker } from "./vite-plugins/worker.js";
5
9
 
6
10
  type BuildOptions = {
7
11
  entry: string;
@@ -10,11 +14,15 @@ type BuildOptions = {
10
14
  };
11
15
 
12
16
  const BUILD_MODE = "production";
17
+ const CHUNK_STEM = "[name]-[hash]";
18
+ const DEFAULT_OUT_DIR = "dist";
19
+ const DEFAULT_ASSETS_DIR = "assets";
20
+ const ENTRY_FILE_NAMES = BUNDLE_FILENAME;
13
21
 
14
22
  const buildDefaults: InlineConfig = {
15
23
  build: {
16
24
  ssrEmitAssets: true,
17
- outDir: "dist",
25
+ outDir: DEFAULT_OUT_DIR,
18
26
  minify: true,
19
27
  cssMinify: false,
20
28
  },
@@ -23,18 +31,27 @@ const buildDefaults: InlineConfig = {
23
31
  },
24
32
  };
25
33
 
26
- const build = async (options: BuildOptions): Promise<void> => {
34
+ const build = async (options: BuildOptions): Promise<string> => {
27
35
  const { entry, assetBase, vite: viteConfig } = options;
28
36
  const root = viteConfig?.root ?? process.cwd();
37
+ const assetsDir = viteConfig?.build?.assetsDir ?? DEFAULT_ASSETS_DIR;
29
38
 
30
39
  const forced: InlineConfig = {
31
- plugins: [...gtkxVitePlugins(BUILD_MODE), gtkxBuiltUrl(assetBase), gtkxNative(root)],
40
+ plugins: [
41
+ ...gtkxVitePlugins(BUILD_MODE),
42
+ gtkxWorker(),
43
+ gtkxBuiltUrl(assetBase),
44
+ gtkxNative(root),
45
+ gtkxSelfContained(),
46
+ ],
32
47
  build: {
33
48
  ssr: entry,
34
49
  assetsInlineLimit: 0,
35
50
  rolldownOptions: {
36
51
  output: {
37
- entryFileNames: "bundle.js",
52
+ entryFileNames: ENTRY_FILE_NAMES,
53
+ chunkFileNames: posix.join(assetsDir, CHUNK_STEM + ESM_EXTENSION),
54
+ keepNames: true,
38
55
  },
39
56
  },
40
57
  },
@@ -42,6 +59,8 @@ const build = async (options: BuildOptions): Promise<void> => {
42
59
 
43
60
  const merged: InlineConfig = mergeConfig(mergeConfig(buildDefaults, viteConfig ?? {}), forced);
44
61
  await viteBuild({ ...merged, ssr: { ...merged.ssr, noExternal: true } });
62
+
63
+ return join(merged.build?.outDir ?? DEFAULT_OUT_DIR, ENTRY_FILE_NAMES);
45
64
  };
46
65
 
47
- export { build, type BuildOptions };
66
+ export { build };