@gtkx/cli 2.0.0-beta.1 → 2.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (501) hide show
  1. package/README.md +43 -40
  2. package/bin/gtkx-dev-runner.js +5 -1
  3. package/bin/gtkx.js +5 -1
  4. package/dist/builder.d.ts +1 -0
  5. package/dist/builder.d.ts.map +1 -1
  6. package/dist/builder.js +44 -12
  7. package/dist/builder.js.map +1 -1
  8. package/dist/cli.d.ts +1 -1
  9. package/dist/cli.d.ts.map +1 -1
  10. package/dist/cli.js +14 -2
  11. package/dist/cli.js.map +1 -1
  12. package/dist/codegen/config-dependencies.d.ts +3 -0
  13. package/dist/codegen/config-dependencies.d.ts.map +1 -0
  14. package/dist/codegen/config-dependencies.js +355 -0
  15. package/dist/codegen/config-dependencies.js.map +1 -0
  16. package/dist/codegen/freshness.d.ts.map +1 -1
  17. package/dist/codegen/freshness.js +5 -1
  18. package/dist/codegen/freshness.js.map +1 -1
  19. package/dist/codegen/reference.d.ts.map +1 -1
  20. package/dist/codegen/reference.js +1 -0
  21. package/dist/codegen/reference.js.map +1 -1
  22. package/dist/codegen/run-codegen.d.ts +6 -3
  23. package/dist/codegen/run-codegen.d.ts.map +1 -1
  24. package/dist/codegen/run-codegen.js +42 -18
  25. package/dist/codegen/run-codegen.js.map +1 -1
  26. package/dist/codegen/store-resolver.d.ts +3 -1
  27. package/dist/codegen/store-resolver.d.ts.map +1 -1
  28. package/dist/codegen/store-resolver.js +7 -4
  29. package/dist/codegen/store-resolver.js.map +1 -1
  30. package/dist/commands/build.d.ts +5 -0
  31. package/dist/commands/build.d.ts.map +1 -1
  32. package/dist/commands/build.js +83 -10
  33. package/dist/commands/build.js.map +1 -1
  34. package/dist/commands/cleanup.d.ts +9 -0
  35. package/dist/commands/cleanup.d.ts.map +1 -0
  36. package/dist/commands/cleanup.js +42 -0
  37. package/dist/commands/cleanup.js.map +1 -0
  38. package/dist/commands/codegen.d.ts +1 -0
  39. package/dist/commands/codegen.d.ts.map +1 -1
  40. package/dist/commands/codegen.js +6 -5
  41. package/dist/commands/codegen.js.map +1 -1
  42. package/dist/commands/deploy.d.ts +5 -0
  43. package/dist/commands/deploy.d.ts.map +1 -1
  44. package/dist/commands/deploy.js +10 -2
  45. package/dist/commands/deploy.js.map +1 -1
  46. package/dist/commands/dev.d.ts +9 -0
  47. package/dist/commands/dev.d.ts.map +1 -1
  48. package/dist/commands/dev.js +31 -4
  49. package/dist/commands/dev.js.map +1 -1
  50. package/dist/commands/docs.d.ts.map +1 -1
  51. package/dist/commands/docs.js +1 -0
  52. package/dist/commands/docs.js.map +1 -1
  53. package/dist/deploy/depends.d.ts.map +1 -1
  54. package/dist/deploy/depends.js +24 -2
  55. package/dist/deploy/depends.js.map +1 -1
  56. package/dist/deploy/download.d.ts +7 -3
  57. package/dist/deploy/download.d.ts.map +1 -1
  58. package/dist/deploy/download.js +19 -20
  59. package/dist/deploy/download.js.map +1 -1
  60. package/dist/deploy/freedesktop/metainfo.d.ts.map +1 -1
  61. package/dist/deploy/freedesktop/metainfo.js +41 -2
  62. package/dist/deploy/freedesktop/metainfo.js.map +1 -1
  63. package/dist/deploy/freedesktop/validate.d.ts.map +1 -1
  64. package/dist/deploy/freedesktop/validate.js +58 -14
  65. package/dist/deploy/freedesktop/validate.js.map +1 -1
  66. package/dist/deploy/native-addon.d.ts +5 -0
  67. package/dist/deploy/native-addon.d.ts.map +1 -0
  68. package/dist/deploy/native-addon.js +134 -0
  69. package/dist/deploy/native-addon.js.map +1 -0
  70. package/dist/deploy/nfpm/config.d.ts +3 -2
  71. package/dist/deploy/nfpm/config.d.ts.map +1 -1
  72. package/dist/deploy/nfpm/config.js +7 -4
  73. package/dist/deploy/nfpm/config.js.map +1 -1
  74. package/dist/deploy/nfpm/contents.d.ts.map +1 -1
  75. package/dist/deploy/nfpm/contents.js +8 -0
  76. package/dist/deploy/nfpm/contents.js.map +1 -1
  77. package/dist/deploy/node-runtime/download.js +2 -2
  78. package/dist/deploy/node-runtime/download.js.map +1 -1
  79. package/dist/deploy/node-runtime/elf.d.ts +4 -1
  80. package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
  81. package/dist/deploy/node-runtime/elf.js +34 -5
  82. package/dist/deploy/node-runtime/elf.js.map +1 -1
  83. package/dist/deploy/node-runtime/guard.d.ts.map +1 -1
  84. package/dist/deploy/node-runtime/guard.js +7 -14
  85. package/dist/deploy/node-runtime/guard.js.map +1 -1
  86. package/dist/deploy/node-runtime/index.d.ts +3 -1
  87. package/dist/deploy/node-runtime/index.d.ts.map +1 -1
  88. package/dist/deploy/node-runtime/index.js +103 -10
  89. package/dist/deploy/node-runtime/index.js.map +1 -1
  90. package/dist/deploy/node-runtime/sonames.d.ts +5 -0
  91. package/dist/deploy/node-runtime/sonames.d.ts.map +1 -0
  92. package/dist/deploy/node-runtime/sonames.js +13 -0
  93. package/dist/deploy/node-runtime/sonames.js.map +1 -0
  94. package/dist/deploy/notices/node-runtime.js +2 -2
  95. package/dist/deploy/notices/node-runtime.js.map +1 -1
  96. package/dist/deploy/payload/launcher.d.ts.map +1 -1
  97. package/dist/deploy/payload/launcher.js +14 -1
  98. package/dist/deploy/payload/launcher.js.map +1 -1
  99. package/dist/deploy/payload/stage.d.ts +2 -1
  100. package/dist/deploy/payload/stage.d.ts.map +1 -1
  101. package/dist/deploy/payload/stage.js +46 -5
  102. package/dist/deploy/payload/stage.js.map +1 -1
  103. package/dist/deploy/run-deploy.d.ts +2 -0
  104. package/dist/deploy/run-deploy.d.ts.map +1 -1
  105. package/dist/deploy/run-deploy.js +197 -52
  106. package/dist/deploy/run-deploy.js.map +1 -1
  107. package/dist/deploy/settings/arch.d.ts +9 -3
  108. package/dist/deploy/settings/arch.d.ts.map +1 -1
  109. package/dist/deploy/settings/arch.js +27 -6
  110. package/dist/deploy/settings/arch.js.map +1 -1
  111. package/dist/deploy/settings/build-manifest.d.ts +6 -1
  112. package/dist/deploy/settings/build-manifest.d.ts.map +1 -1
  113. package/dist/deploy/settings/build-manifest.js +15 -4
  114. package/dist/deploy/settings/build-manifest.js.map +1 -1
  115. package/dist/deploy/settings/extra-files.d.ts +1 -1
  116. package/dist/deploy/settings/extra-files.d.ts.map +1 -1
  117. package/dist/deploy/settings/extra-files.js +25 -3
  118. package/dist/deploy/settings/extra-files.js.map +1 -1
  119. package/dist/deploy/settings/index.d.ts +3 -1
  120. package/dist/deploy/settings/index.d.ts.map +1 -1
  121. package/dist/deploy/settings/index.js +4 -2
  122. package/dist/deploy/settings/index.js.map +1 -1
  123. package/dist/deploy/settings/libraries.d.ts.map +1 -1
  124. package/dist/deploy/settings/libraries.js +2 -1
  125. package/dist/deploy/settings/libraries.js.map +1 -1
  126. package/dist/deploy/settings/paths.d.ts +4 -2
  127. package/dist/deploy/settings/paths.d.ts.map +1 -1
  128. package/dist/deploy/settings/paths.js +121 -12
  129. package/dist/deploy/settings/paths.js.map +1 -1
  130. package/dist/deploy/targets/appimage.d.ts.map +1 -1
  131. package/dist/deploy/targets/appimage.js +1 -0
  132. package/dist/deploy/targets/appimage.js.map +1 -1
  133. package/dist/deploy/targets/flatpak-pnpm.js +4 -4
  134. package/dist/deploy/targets/flatpak-pnpm.js.map +1 -1
  135. package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
  136. package/dist/deploy/targets/flatpak-source.js +13 -2
  137. package/dist/deploy/targets/flatpak-source.js.map +1 -1
  138. package/dist/deploy/targets/flatpak.d.ts.map +1 -1
  139. package/dist/deploy/targets/flatpak.js +1 -0
  140. package/dist/deploy/targets/flatpak.js.map +1 -1
  141. package/dist/deploy/targets/nfpm-target.d.ts.map +1 -1
  142. package/dist/deploy/targets/nfpm-target.js +13 -7
  143. package/dist/deploy/targets/nfpm-target.js.map +1 -1
  144. package/dist/deploy/types.d.ts +5 -2
  145. package/dist/deploy/types.d.ts.map +1 -1
  146. package/dist/deploy/types.js.map +1 -1
  147. package/dist/deploy/vendored/appimagetool.js +2 -2
  148. package/dist/deploy/vendored/appimagetool.js.map +1 -1
  149. package/dist/deploy/vendored/nfpm.js +1 -1
  150. package/dist/deploy/vendored/nfpm.js.map +1 -1
  151. package/dist/dev/catalog-writes.d.ts +8 -0
  152. package/dist/dev/catalog-writes.d.ts.map +1 -0
  153. package/dist/dev/catalog-writes.js +26 -0
  154. package/dist/dev/catalog-writes.js.map +1 -0
  155. package/dist/dev/entry-env.d.ts +2 -1
  156. package/dist/dev/entry-env.d.ts.map +1 -1
  157. package/dist/dev/entry-env.js +2 -1
  158. package/dist/dev/entry-env.js.map +1 -1
  159. package/dist/dev/font-dir.d.ts +3 -0
  160. package/dist/dev/font-dir.d.ts.map +1 -0
  161. package/dist/dev/font-dir.js +9 -0
  162. package/dist/dev/font-dir.js.map +1 -0
  163. package/dist/dev/headless.d.ts +3 -0
  164. package/dist/dev/headless.d.ts.map +1 -0
  165. package/dist/dev/headless.js +35 -0
  166. package/dist/dev/headless.js.map +1 -0
  167. package/dist/dev/runner-deps.d.ts +1 -1
  168. package/dist/dev/runner-deps.d.ts.map +1 -1
  169. package/dist/dev/runner-deps.js +12 -7
  170. package/dist/dev/runner-deps.js.map +1 -1
  171. package/dist/dev/runner-main.d.ts.map +1 -1
  172. package/dist/dev/runner-main.js +10 -3
  173. package/dist/dev/runner-main.js.map +1 -1
  174. package/dist/dev/runner.d.ts +2 -0
  175. package/dist/dev/runner.d.ts.map +1 -1
  176. package/dist/dev/runner.js +26 -7
  177. package/dist/dev/runner.js.map +1 -1
  178. package/dist/dev/supervisor.d.ts +3 -1
  179. package/dist/dev/supervisor.d.ts.map +1 -1
  180. package/dist/dev/supervisor.js +132 -29
  181. package/dist/dev/supervisor.js.map +1 -1
  182. package/dist/dev/vite-dev-server.d.ts +1 -1
  183. package/dist/dev/vite-dev-server.d.ts.map +1 -1
  184. package/dist/dev/vite-dev-server.js +14 -2
  185. package/dist/dev/vite-dev-server.js.map +1 -1
  186. package/dist/dev/watch-ignore.d.ts +3 -0
  187. package/dist/dev/watch-ignore.d.ts.map +1 -0
  188. package/dist/dev/watch-ignore.js +11 -0
  189. package/dist/dev/watch-ignore.js.map +1 -0
  190. package/dist/i18n/catalogs.d.ts +6 -2
  191. package/dist/i18n/catalogs.d.ts.map +1 -1
  192. package/dist/i18n/catalogs.js +10 -7
  193. package/dist/i18n/catalogs.js.map +1 -1
  194. package/dist/i18n/source-messages.d.ts +3 -1
  195. package/dist/i18n/source-messages.d.ts.map +1 -1
  196. package/dist/i18n/source-messages.js +973 -9
  197. package/dist/i18n/source-messages.js.map +1 -1
  198. package/dist/internal/agent-rules.d.ts.map +1 -1
  199. package/dist/internal/agent-rules.js +7 -2
  200. package/dist/internal/agent-rules.js.map +1 -1
  201. package/dist/internal/banner.d.ts +4 -2
  202. package/dist/internal/banner.d.ts.map +1 -1
  203. package/dist/internal/banner.js +19 -5
  204. package/dist/internal/banner.js.map +1 -1
  205. package/dist/internal/build-manifest.d.ts +5 -2
  206. package/dist/internal/build-manifest.d.ts.map +1 -1
  207. package/dist/internal/build-manifest.js +15 -2
  208. package/dist/internal/build-manifest.js.map +1 -1
  209. package/dist/internal/build-output.d.ts +8 -0
  210. package/dist/internal/build-output.d.ts.map +1 -0
  211. package/dist/internal/build-output.js +116 -0
  212. package/dist/internal/build-output.js.map +1 -0
  213. package/dist/internal/cache-root.d.ts +3 -0
  214. package/dist/internal/cache-root.d.ts.map +1 -0
  215. package/dist/internal/cache-root.js +9 -0
  216. package/dist/internal/cache-root.js.map +1 -0
  217. package/dist/internal/compile-cache-store.d.ts +4 -0
  218. package/dist/internal/compile-cache-store.d.ts.map +1 -0
  219. package/dist/internal/compile-cache-store.js +41 -0
  220. package/dist/internal/compile-cache-store.js.map +1 -0
  221. package/dist/internal/compile-cache.d.ts +4 -0
  222. package/dist/internal/compile-cache.d.ts.map +1 -0
  223. package/dist/internal/compile-cache.js +16 -0
  224. package/dist/internal/compile-cache.js.map +1 -0
  225. package/dist/internal/deploy-out-dir.d.ts +4 -0
  226. package/dist/internal/deploy-out-dir.d.ts.map +1 -0
  227. package/dist/internal/deploy-out-dir.js +5 -0
  228. package/dist/internal/deploy-out-dir.js.map +1 -0
  229. package/dist/internal/docs-elements.d.ts +1 -0
  230. package/dist/internal/docs-elements.d.ts.map +1 -1
  231. package/dist/internal/docs-elements.js +5 -4
  232. package/dist/internal/docs-elements.js.map +1 -1
  233. package/dist/internal/entry-arg.d.ts +4 -1
  234. package/dist/internal/entry-arg.d.ts.map +1 -1
  235. package/dist/internal/entry-arg.js +7 -1
  236. package/dist/internal/entry-arg.js.map +1 -1
  237. package/dist/internal/errors.d.ts +2 -1
  238. package/dist/internal/errors.d.ts.map +1 -1
  239. package/dist/internal/errors.js +1 -1
  240. package/dist/internal/errors.js.map +1 -1
  241. package/dist/internal/font-path.d.ts +4 -0
  242. package/dist/internal/font-path.d.ts.map +1 -0
  243. package/dist/internal/font-path.js +12 -0
  244. package/dist/internal/font-path.js.map +1 -0
  245. package/dist/internal/font-staging.d.ts +6 -0
  246. package/dist/internal/font-staging.d.ts.map +1 -0
  247. package/dist/internal/font-staging.js +94 -0
  248. package/dist/internal/font-staging.js.map +1 -0
  249. package/dist/internal/icon-staging.d.ts +3 -0
  250. package/dist/internal/icon-staging.d.ts.map +1 -0
  251. package/dist/internal/icon-staging.js +40 -0
  252. package/dist/internal/icon-staging.js.map +1 -0
  253. package/dist/internal/import-scan.d.ts +4 -0
  254. package/dist/internal/import-scan.d.ts.map +1 -0
  255. package/dist/internal/import-scan.js +138 -0
  256. package/dist/internal/import-scan.js.map +1 -0
  257. package/dist/internal/module-hash.d.ts +3 -0
  258. package/dist/internal/module-hash.d.ts.map +1 -0
  259. package/dist/internal/module-hash.js +19 -0
  260. package/dist/internal/module-hash.js.map +1 -0
  261. package/dist/internal/output-directory.d.ts +15 -0
  262. package/dist/internal/output-directory.d.ts.map +1 -0
  263. package/dist/internal/output-directory.js +490 -0
  264. package/dist/internal/output-directory.js.map +1 -0
  265. package/dist/internal/parent-process.d.ts +12 -0
  266. package/dist/internal/parent-process.d.ts.map +1 -0
  267. package/dist/internal/parent-process.js +74 -0
  268. package/dist/internal/parent-process.js.map +1 -0
  269. package/dist/internal/prepare-project.d.ts +3 -0
  270. package/dist/internal/prepare-project.d.ts.map +1 -1
  271. package/dist/internal/prepare-project.js +9 -3
  272. package/dist/internal/prepare-project.js.map +1 -1
  273. package/dist/internal/react-compiler-cache.d.ts +13 -0
  274. package/dist/internal/react-compiler-cache.d.ts.map +1 -0
  275. package/dist/internal/react-compiler-cache.js +182 -0
  276. package/dist/internal/react-compiler-cache.js.map +1 -0
  277. package/dist/internal/source-imports.d.ts +7 -2
  278. package/dist/internal/source-imports.d.ts.map +1 -1
  279. package/dist/internal/source-imports.js +31 -11
  280. package/dist/internal/source-imports.js.map +1 -1
  281. package/dist/internal/staging-file.d.ts +5 -0
  282. package/dist/internal/staging-file.d.ts.map +1 -0
  283. package/dist/internal/staging-file.js +35 -0
  284. package/dist/internal/staging-file.js.map +1 -0
  285. package/dist/internal/xdg-banner.d.ts +4 -0
  286. package/dist/internal/xdg-banner.d.ts.map +1 -0
  287. package/dist/internal/xdg-banner.js +11 -0
  288. package/dist/internal/xdg-banner.js.map +1 -0
  289. package/dist/internal/xdg-data-dirs.d.ts +2 -1
  290. package/dist/internal/xdg-data-dirs.d.ts.map +1 -1
  291. package/dist/internal/xdg-data-dirs.js +1 -1
  292. package/dist/internal/xdg-data-dirs.js.map +1 -1
  293. package/dist/mcp/client.js +2 -2
  294. package/dist/mcp/client.js.map +1 -1
  295. package/dist/settings/schema.d.ts.map +1 -1
  296. package/dist/settings/schema.js +3 -8
  297. package/dist/settings/schema.js.map +1 -1
  298. package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
  299. package/dist/vite-plugins/asset-extensions.js +2 -0
  300. package/dist/vite-plugins/asset-extensions.js.map +1 -1
  301. package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
  302. package/dist/vite-plugins/asset-imports.js +20 -6
  303. package/dist/vite-plugins/asset-imports.js.map +1 -1
  304. package/dist/vite-plugins/asset-specifier.d.ts +5 -1
  305. package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
  306. package/dist/vite-plugins/asset-specifier.js +10 -1
  307. package/dist/vite-plugins/asset-specifier.js.map +1 -1
  308. package/dist/vite-plugins/build-manifest.d.ts +5 -1
  309. package/dist/vite-plugins/build-manifest.d.ts.map +1 -1
  310. package/dist/vite-plugins/build-manifest.js +2 -1
  311. package/dist/vite-plugins/build-manifest.js.map +1 -1
  312. package/dist/vite-plugins/built-url.d.ts.map +1 -1
  313. package/dist/vite-plugins/built-url.js +5 -2
  314. package/dist/vite-plugins/built-url.js.map +1 -1
  315. package/dist/vite-plugins/css.d.ts.map +1 -1
  316. package/dist/vite-plugins/css.js +13 -5
  317. package/dist/vite-plugins/css.js.map +1 -1
  318. package/dist/vite-plugins/ensure-store.d.ts +1 -1
  319. package/dist/vite-plugins/ensure-store.d.ts.map +1 -1
  320. package/dist/vite-plugins/ensure-store.js +2 -2
  321. package/dist/vite-plugins/ensure-store.js.map +1 -1
  322. package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts +6 -1
  323. package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts.map +1 -1
  324. package/dist/vite-plugins/fast-refresh/refresh-filter.js +3 -1
  325. package/dist/vite-plugins/fast-refresh/refresh-filter.js.map +1 -1
  326. package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts.map +1 -1
  327. package/dist/vite-plugins/fast-refresh/swc-refresh.js +23 -14
  328. package/dist/vite-plugins/fast-refresh/swc-refresh.js.map +1 -1
  329. package/dist/vite-plugins/font-name.d.ts +3 -0
  330. package/dist/vite-plugins/font-name.d.ts.map +1 -0
  331. package/dist/vite-plugins/font-name.js +406 -0
  332. package/dist/vite-plugins/font-name.js.map +1 -0
  333. package/dist/vite-plugins/font-worker-env.d.ts +4 -0
  334. package/dist/vite-plugins/font-worker-env.d.ts.map +1 -0
  335. package/dist/vite-plugins/font-worker-env.js +19 -0
  336. package/dist/vite-plugins/font-worker-env.js.map +1 -0
  337. package/dist/vite-plugins/font.d.ts +4 -0
  338. package/dist/vite-plugins/font.d.ts.map +1 -0
  339. package/dist/vite-plugins/font.js +111 -0
  340. package/dist/vite-plugins/font.js.map +1 -0
  341. package/dist/vite-plugins/i18n.d.ts +11 -2
  342. package/dist/vite-plugins/i18n.d.ts.map +1 -1
  343. package/dist/vite-plugins/i18n.js +74 -8
  344. package/dist/vite-plugins/i18n.js.map +1 -1
  345. package/dist/vite-plugins/icon-worker-env.d.ts +4 -0
  346. package/dist/vite-plugins/icon-worker-env.d.ts.map +1 -0
  347. package/dist/vite-plugins/icon-worker-env.js +23 -0
  348. package/dist/vite-plugins/icon-worker-env.js.map +1 -0
  349. package/dist/vite-plugins/icons.d.ts.map +1 -1
  350. package/dist/vite-plugins/icons.js +4 -9
  351. package/dist/vite-plugins/icons.js.map +1 -1
  352. package/dist/vite-plugins/index.d.ts +10 -1
  353. package/dist/vite-plugins/index.d.ts.map +1 -1
  354. package/dist/vite-plugins/index.js +17 -3
  355. package/dist/vite-plugins/index.js.map +1 -1
  356. package/dist/vite-plugins/native.d.ts.map +1 -1
  357. package/dist/vite-plugins/native.js +0 -4
  358. package/dist/vite-plugins/native.js.map +1 -1
  359. package/dist/vite-plugins/react-compiler.d.ts.map +1 -1
  360. package/dist/vite-plugins/react-compiler.js +57 -18
  361. package/dist/vite-plugins/react-compiler.js.map +1 -1
  362. package/dist/vite-plugins/resource-shared.d.ts +3 -1
  363. package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
  364. package/dist/vite-plugins/resource-shared.js +3 -1
  365. package/dist/vite-plugins/resource-shared.js.map +1 -1
  366. package/dist/vite-plugins/resources.d.ts.map +1 -1
  367. package/dist/vite-plugins/resources.js +9 -6
  368. package/dist/vite-plugins/resources.js.map +1 -1
  369. package/dist/vite-plugins/self-contained.d.ts.map +1 -1
  370. package/dist/vite-plugins/self-contained.js +159 -158
  371. package/dist/vite-plugins/self-contained.js.map +1 -1
  372. package/dist/vite-plugins/settings-worker-env.d.ts +1 -1
  373. package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
  374. package/dist/vite-plugins/settings-worker-env.js +4 -4
  375. package/dist/vite-plugins/settings-worker-env.js.map +1 -1
  376. package/dist/vite-plugins/settings.d.ts.map +1 -1
  377. package/dist/vite-plugins/settings.js +25 -14
  378. package/dist/vite-plugins/settings.js.map +1 -1
  379. package/dist/vite-plugins/store-links.d.ts.map +1 -1
  380. package/dist/vite-plugins/store-links.js +9 -5
  381. package/dist/vite-plugins/store-links.js.map +1 -1
  382. package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
  383. package/dist/vite-plugins/undeclared-library.js +18 -15
  384. package/dist/vite-plugins/undeclared-library.js.map +1 -1
  385. package/dist/vite-plugins/worker.d.ts.map +1 -1
  386. package/dist/vite-plugins/worker.js +21 -13
  387. package/dist/vite-plugins/worker.js.map +1 -1
  388. package/dist/vitest-plugin.d.ts +4 -3
  389. package/dist/vitest-plugin.d.ts.map +1 -1
  390. package/dist/vitest-plugin.js +12 -8
  391. package/dist/vitest-plugin.js.map +1 -1
  392. package/env.d.ts +9 -0
  393. package/package.json +18 -13
  394. package/src/builder.ts +45 -12
  395. package/src/cli.ts +15 -2
  396. package/src/codegen/config-dependencies.ts +470 -0
  397. package/src/codegen/freshness.ts +5 -1
  398. package/src/codegen/reference.ts +1 -0
  399. package/src/codegen/run-codegen.ts +51 -21
  400. package/src/codegen/store-resolver.ts +9 -4
  401. package/src/commands/build.ts +13 -2
  402. package/src/commands/cleanup.ts +48 -0
  403. package/src/commands/codegen.ts +6 -5
  404. package/src/commands/deploy.ts +10 -2
  405. package/src/commands/dev.ts +45 -4
  406. package/src/commands/docs.ts +1 -0
  407. package/src/deploy/depends.ts +30 -3
  408. package/src/deploy/download.ts +33 -24
  409. package/src/deploy/freedesktop/metainfo.ts +73 -21
  410. package/src/deploy/freedesktop/validate.ts +80 -15
  411. package/src/deploy/native-addon.ts +183 -0
  412. package/src/deploy/nfpm/config.ts +13 -4
  413. package/src/deploy/nfpm/contents.ts +8 -0
  414. package/src/deploy/node-runtime/download.ts +2 -2
  415. package/src/deploy/node-runtime/elf.ts +46 -5
  416. package/src/deploy/node-runtime/guard.ts +10 -14
  417. package/src/deploy/node-runtime/index.ts +148 -12
  418. package/src/deploy/node-runtime/sonames.ts +17 -0
  419. package/src/deploy/notices/node-runtime.ts +2 -2
  420. package/src/deploy/payload/launcher.ts +20 -1
  421. package/src/deploy/payload/stage.ts +76 -5
  422. package/src/deploy/run-deploy.ts +227 -72
  423. package/src/deploy/settings/arch.ts +40 -8
  424. package/src/deploy/settings/build-manifest.ts +28 -3
  425. package/src/deploy/settings/extra-files.ts +30 -4
  426. package/src/deploy/settings/index.ts +7 -2
  427. package/src/deploy/settings/libraries.ts +2 -1
  428. package/src/deploy/settings/paths.ts +80 -13
  429. package/src/deploy/targets/appimage.ts +1 -0
  430. package/src/deploy/targets/flatpak-pnpm.ts +4 -4
  431. package/src/deploy/targets/flatpak-source.ts +15 -2
  432. package/src/deploy/targets/flatpak.ts +1 -0
  433. package/src/deploy/targets/nfpm-target.ts +14 -6
  434. package/src/deploy/types.ts +5 -1
  435. package/src/deploy/vendored/appimagetool.ts +2 -2
  436. package/src/deploy/vendored/nfpm.ts +1 -1
  437. package/src/dev/catalog-writes.ts +35 -0
  438. package/src/dev/entry-env.ts +2 -1
  439. package/src/dev/font-dir.ts +11 -0
  440. package/src/dev/headless.ts +40 -0
  441. package/src/dev/runner-deps.ts +20 -7
  442. package/src/dev/runner-main.ts +12 -3
  443. package/src/dev/runner.ts +37 -7
  444. package/src/dev/supervisor.ts +183 -32
  445. package/src/dev/vite-dev-server.ts +20 -2
  446. package/src/dev/watch-ignore.ts +16 -0
  447. package/src/i18n/catalogs.ts +21 -8
  448. package/src/i18n/source-messages.ts +1446 -29
  449. package/src/internal/agent-rules.ts +7 -2
  450. package/src/internal/banner.ts +27 -6
  451. package/src/internal/build-manifest.ts +25 -1
  452. package/src/internal/build-output.ts +171 -0
  453. package/src/internal/cache-root.ts +12 -0
  454. package/src/internal/compile-cache-store.ts +50 -0
  455. package/src/internal/compile-cache.ts +20 -0
  456. package/src/internal/deploy-out-dir.ts +8 -0
  457. package/src/internal/docs-elements.ts +10 -4
  458. package/src/internal/entry-arg.ts +8 -1
  459. package/src/internal/errors.ts +1 -1
  460. package/src/internal/font-path.ts +15 -0
  461. package/src/internal/font-staging.ts +131 -0
  462. package/src/internal/icon-staging.ts +58 -0
  463. package/src/internal/import-scan.ts +206 -0
  464. package/src/internal/module-hash.ts +22 -0
  465. package/src/internal/output-directory.ts +699 -0
  466. package/src/internal/parent-process.ts +110 -0
  467. package/src/internal/prepare-project.ts +11 -5
  468. package/src/internal/react-compiler-cache.ts +246 -0
  469. package/src/internal/source-imports.ts +57 -12
  470. package/src/internal/staging-file.ts +42 -0
  471. package/src/internal/xdg-banner.ts +13 -0
  472. package/src/internal/xdg-data-dirs.ts +1 -1
  473. package/src/mcp/client.ts +2 -2
  474. package/src/settings/schema.ts +4 -10
  475. package/src/vite-plugins/asset-extensions.ts +2 -0
  476. package/src/vite-plugins/asset-imports.ts +23 -5
  477. package/src/vite-plugins/asset-specifier.ts +17 -0
  478. package/src/vite-plugins/build-manifest.ts +7 -1
  479. package/src/vite-plugins/built-url.ts +6 -2
  480. package/src/vite-plugins/css.ts +16 -5
  481. package/src/vite-plugins/ensure-store.ts +2 -2
  482. package/src/vite-plugins/fast-refresh/refresh-filter.ts +10 -1
  483. package/src/vite-plugins/fast-refresh/swc-refresh.ts +33 -14
  484. package/src/vite-plugins/font-name.ts +582 -0
  485. package/src/vite-plugins/font-worker-env.ts +25 -0
  486. package/src/vite-plugins/font.ts +180 -0
  487. package/src/vite-plugins/i18n.ts +122 -11
  488. package/src/vite-plugins/icon-worker-env.ts +36 -0
  489. package/src/vite-plugins/icons.ts +4 -10
  490. package/src/vite-plugins/index.ts +34 -9
  491. package/src/vite-plugins/native.ts +0 -5
  492. package/src/vite-plugins/react-compiler.ts +83 -19
  493. package/src/vite-plugins/resource-shared.ts +4 -0
  494. package/src/vite-plugins/resources.ts +11 -5
  495. package/src/vite-plugins/self-contained.ts +184 -185
  496. package/src/vite-plugins/settings-worker-env.ts +4 -4
  497. package/src/vite-plugins/settings.ts +36 -16
  498. package/src/vite-plugins/store-links.ts +10 -5
  499. package/src/vite-plugins/undeclared-library.ts +19 -15
  500. package/src/vite-plugins/worker.ts +31 -15
  501. package/src/vitest-plugin.ts +12 -8
package/src/builder.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { join, posix } from "node:path";
1
+ import { loadConfig } from "@gtkx/config";
2
+ import { join, posix, relative, resolve } from "node:path";
2
3
  import { type InlineConfig, mergeConfig, build as viteBuild } from "vite";
3
- import { createBuildManifestCollector } from "./internal/build-manifest.js";
4
+ import { configDigest, createBuildManifestCollector } from "./internal/build-manifest.js";
4
5
  import { gtkxBuildManifest } from "./vite-plugins/build-manifest.js";
5
6
  import { BUNDLE_FILENAME, ESM_EXTENSION } from "./vite-plugins/esm-extension.js";
6
7
  import { gtkxVitePlugins } from "./vite-plugins/index.js";
@@ -10,6 +11,7 @@ import { gtkxWorker } from "./vite-plugins/worker.js";
10
11
 
11
12
  type BuildOptions = {
12
13
  entry: string;
14
+ configFile?: string | undefined;
13
15
  shouldPreserveI18nMetadata?: boolean | undefined;
14
16
  vite?: InlineConfig | undefined;
15
17
  };
@@ -27,23 +29,33 @@ const buildDefaults: InlineConfig = {
27
29
  minify: true,
28
30
  cssMinify: false,
29
31
  },
30
- define: {
31
- "process.env.NODE_ENV": JSON.stringify(BUILD_MODE),
32
- },
33
32
  };
34
33
 
35
- const build = async (options: BuildOptions): Promise<string> => {
36
- const { entry, shouldPreserveI18nMetadata = true, vite: viteConfig } = options;
37
- const root = viteConfig?.root ?? process.cwd();
38
- const assetsDir = viteConfig?.build?.assetsDir ?? DEFAULT_ASSETS_DIR;
34
+ const forcedConfig = async (options: BuildOptions, root: string, assetsDir: string): Promise<InlineConfig> => {
35
+ const { entry, shouldPreserveI18nMetadata = true } = options;
39
36
  const buildManifest = createBuildManifestCollector();
37
+ const loadedConfig = await loadConfig(root, { mode: BUILD_MODE, configFile: options.configFile });
38
+ const buildConfigIdentity = {
39
+ configFile: posix.normalize(relative(root, loadedConfig.configFile).replaceAll("\\", "/")),
40
+ configDigest: configDigest(loadedConfig.config),
41
+ };
40
42
 
41
- const forced: InlineConfig = {
43
+ return {
44
+ mode: BUILD_MODE,
45
+ define: {
46
+ "process.env.NODE_ENV": JSON.stringify(BUILD_MODE),
47
+ },
42
48
  plugins: [
43
- ...gtkxVitePlugins(BUILD_MODE, entry, buildManifest, shouldPreserveI18nMetadata),
49
+ ...gtkxVitePlugins({
50
+ mode: BUILD_MODE,
51
+ entryPath: entry,
52
+ buildManifest,
53
+ shouldPreserveI18nMetadata,
54
+ configFile: options.configFile,
55
+ }),
44
56
  gtkxWorker(),
45
57
  gtkxNative(root),
46
- gtkxBuildManifest(root, buildManifest),
58
+ gtkxBuildManifest(root, buildManifest, buildConfigIdentity),
47
59
  gtkxSelfContained(),
48
60
  ],
49
61
  build: {
@@ -58,11 +70,32 @@ const build = async (options: BuildOptions): Promise<string> => {
58
70
  },
59
71
  },
60
72
  };
73
+ };
61
74
 
75
+ const buildProduction = async (options: BuildOptions): Promise<string> => {
76
+ const viteConfig = options.vite;
77
+ const root = resolve(viteConfig?.root ?? process.cwd());
78
+ const assetsDir = viteConfig?.build?.assetsDir ?? DEFAULT_ASSETS_DIR;
79
+ const forced = await forcedConfig(options, root, assetsDir);
62
80
  const merged: InlineConfig = mergeConfig(mergeConfig(buildDefaults, viteConfig ?? {}), forced);
63
81
  await viteBuild({ ...merged, ssr: { ...merged.ssr, noExternal: true } });
64
82
 
65
83
  return join(merged.build?.outDir ?? DEFAULT_OUT_DIR, ENTRY_FILE_NAMES);
66
84
  };
67
85
 
86
+ const build = async (options: BuildOptions): Promise<string> => {
87
+ const callerNodeEnv = process.env.NODE_ENV;
88
+ process.env.NODE_ENV = BUILD_MODE;
89
+
90
+ try {
91
+ return await buildProduction(options);
92
+ } finally {
93
+ if (callerNodeEnv === undefined) {
94
+ delete process.env.NODE_ENV;
95
+ } else {
96
+ process.env.NODE_ENV = callerNodeEnv;
97
+ }
98
+ }
99
+ };
100
+
68
101
  export { build };
package/src/cli.ts CHANGED
@@ -1,7 +1,15 @@
1
+ import { assertSupportedNodeVersion } from "@gtkx/config/internal";
1
2
  import { defineCommand, runMain } from "citty";
2
3
  import packageManifest from "../package.json" with { type: "json" };
3
4
  import { splitApplicationArgs } from "./internal/application-args.js";
4
- import { withErrorBoundary } from "./internal/errors.js";
5
+ import { printError, withErrorBoundary } from "./internal/errors.js";
6
+ import "./internal/parent-process.js";
7
+
8
+ try {
9
+ assertSupportedNodeVersion();
10
+ } catch (error) {
11
+ printError(error);
12
+ }
5
13
 
6
14
  const version = packageManifest.version;
7
15
  const { cliArgs } = splitApplicationArgs(process.argv.slice(2));
@@ -10,7 +18,7 @@ const main = defineCommand({
10
18
  meta: {
11
19
  name: "gtkx",
12
20
  version,
13
- description: "CLI for GTKX: create and develop GTK4 React applications",
21
+ description: "CLI for GTKX: create and develop Adwaita-first GNOME applications",
14
22
  },
15
23
  subCommands: {
16
24
  dev: async () => {
@@ -48,6 +56,11 @@ const main = defineCommand({
48
56
 
49
57
  return withErrorBoundary(scaffoldCommand);
50
58
  },
59
+ cleanup: async () => {
60
+ const { cleanup } = await import("./commands/cleanup.js");
61
+
62
+ return withErrorBoundary(cleanup);
63
+ },
51
64
  },
52
65
  });
53
66
 
@@ -0,0 +1,470 @@
1
+ import { parseSync, traverse, types } from "@babel/core";
2
+ import { parseJSON, parseJSON5, parseJSONC, parseTOML, parseYAML } from "confbox";
3
+ import { createJiti, type Jiti } from "jiti";
4
+ import { existsSync, readFileSync } from "node:fs";
5
+ import { basename, dirname, extname, isAbsolute, join, resolve, sep } from "node:path";
6
+ import { fileURLToPath, pathToFileURL } from "node:url";
7
+
8
+ const MODULE_EXTENSIONS: ReadonlySet<string> = new Set([
9
+ ".cjs",
10
+ ".cts",
11
+ ".js",
12
+ ".mjs",
13
+ ".mts",
14
+ ".ts",
15
+ ]);
16
+ const RESOLVABLE_EXTENSIONS = [
17
+ ".js",
18
+ ".ts",
19
+ ".mjs",
20
+ ".cjs",
21
+ ".mts",
22
+ ".cts",
23
+ ".json",
24
+ ".jsonc",
25
+ ".json5",
26
+ ".yaml",
27
+ ".yml",
28
+ ".toml",
29
+ ];
30
+ const JAVASCRIPT_FALLBACKS: Readonly<Record<string, string[]>> = {
31
+ ".cjs": [".cts"],
32
+ ".js": [".ts"],
33
+ ".jsx": [".tsx"],
34
+ ".mjs": [".mts"],
35
+ };
36
+ const DATA_PARSERS: Readonly<Record<string, (source: string) => unknown>> = {
37
+ ".json": parseJSON,
38
+ ".json5": parseJSON5,
39
+ ".jsonc": parseJSONC,
40
+ ".toml": parseTOML,
41
+ ".yaml": parseYAML,
42
+ ".yml": parseYAML,
43
+ };
44
+
45
+ type PackageImports = { file: string; imports: Record<string, unknown>; root: string };
46
+ type ModuleSources = { all: string[]; extended: string[] };
47
+
48
+ const isRecord = (value: unknown): value is Record<string, unknown> =>
49
+ typeof value === "object" && value !== null && !Array.isArray(value);
50
+
51
+ const parserPlugins = (path: string): ("decorators" | "jsx" | "typescript")[] => {
52
+ const extension = extname(path).toLowerCase();
53
+
54
+ return [
55
+ "decorators",
56
+ ...([".cts", ".mts", ".ts"].includes(extension) ? ["typescript" as const] : []),
57
+ ];
58
+ };
59
+
60
+ function expressionSources(value: types.Expression): string[] {
61
+ if (types.isStringLiteral(value)) {
62
+ return [value.value];
63
+ }
64
+
65
+ if (types.isArrayExpression(value)) {
66
+ return value.elements.flatMap((element) =>
67
+ types.isExpression(element) ? expressionSources(element) : []);
68
+ }
69
+
70
+ return types.isObjectExpression(value)
71
+ ? value.properties.flatMap((property) => sourcePropertySources(property))
72
+ : [];
73
+ }
74
+
75
+ const isNamedProperty = (property: types.ObjectProperty, name: string): boolean =>
76
+ (types.isIdentifier(property.key) && property.key.name === name) ||
77
+ (types.isStringLiteral(property.key) && property.key.value === name);
78
+
79
+ function sourcePropertySources(
80
+ property: types.ObjectMethod | types.ObjectProperty | types.SpreadElement,
81
+ ): string[] {
82
+ return types.isObjectProperty(property) &&
83
+ isNamedProperty(property, "source") &&
84
+ types.isExpression(property.value)
85
+ ? expressionSources(property.value)
86
+ : [];
87
+ }
88
+
89
+ const extendsSources = (value: types.Expression): string[] => expressionSources(value);
90
+
91
+ const isExtendsProperty = (property: types.ObjectProperty): boolean =>
92
+ isNamedProperty(property, "extends");
93
+
94
+ type ParsedModule = NonNullable<ReturnType<typeof parseSync>>;
95
+
96
+ const parseModule = (path: string): ParsedModule | undefined => {
97
+ try {
98
+ return parseSync(readFileSync(path, "utf8"), {
99
+ ast: true,
100
+ babelrc: false,
101
+ configFile: false,
102
+ filename: path,
103
+ parserOpts: { allowReturnOutsideFunction: true, plugins: parserPlugins(path) },
104
+ sourceType: "unambiguous",
105
+ }) ?? undefined;
106
+ } catch {
107
+ return undefined;
108
+ }
109
+ };
110
+
111
+ const addSource = (sources: Set<string>, source: types.StringLiteral | null | undefined): void => {
112
+ if (source !== null && source !== undefined) {
113
+ sources.add(source.value);
114
+ }
115
+ };
116
+
117
+ const requireSource = (call: types.CallExpression): types.StringLiteral | undefined =>
118
+ types.isIdentifier(call.callee, { name: "require" }) && types.isStringLiteral(call.arguments[0])
119
+ ? call.arguments[0]
120
+ : undefined;
121
+
122
+ const importEqualsSource = (declaration: types.TSImportEqualsDeclaration): types.StringLiteral | undefined => {
123
+ const { moduleReference } = declaration;
124
+
125
+ return types.isTSExternalModuleReference(moduleReference) ? moduleReference.expression : undefined;
126
+ };
127
+
128
+ const propertySources = (property: types.ObjectProperty): string[] =>
129
+ isExtendsProperty(property) && types.isExpression(property.value)
130
+ ? extendsSources(property.value)
131
+ : [];
132
+
133
+ const collectModuleSources = (ast: ParsedModule): ModuleSources => {
134
+ const sources: Set<string> = new Set();
135
+ const extended: Set<string> = new Set();
136
+
137
+ traverse(ast, {
138
+ CallExpression: (nodePath) => {
139
+ addSource(sources, requireSource(nodePath.node));
140
+ },
141
+ ExportAllDeclaration: (nodePath) => {
142
+ addSource(sources, nodePath.node.source);
143
+ },
144
+ ExportNamedDeclaration: (nodePath) => {
145
+ addSource(sources, nodePath.node.source);
146
+ },
147
+ ImportDeclaration: (nodePath) => {
148
+ addSource(sources, nodePath.node.source);
149
+ },
150
+ ImportExpression: (nodePath) => {
151
+ const { source } = nodePath.node;
152
+ addSource(sources, types.isStringLiteral(source) ? source : undefined);
153
+ },
154
+ ObjectProperty: (nodePath) => {
155
+ for (const source of propertySources(nodePath.node)) {
156
+ sources.add(source);
157
+ extended.add(source);
158
+ }
159
+ },
160
+ TSImportEqualsDeclaration: (nodePath) => {
161
+ addSource(sources, importEqualsSource(nodePath.node));
162
+ },
163
+ });
164
+
165
+ return { all: [...sources], extended: [...extended] };
166
+ };
167
+
168
+ const moduleSources = (path: string): ModuleSources => {
169
+ const ast = parseModule(path);
170
+
171
+ return ast === undefined ? { all: [], extended: [] } : collectModuleSources(ast);
172
+ };
173
+
174
+ function parsedExtendsSources(value: unknown): string[] {
175
+ if (typeof value === "string") {
176
+ return [value];
177
+ }
178
+
179
+ if (Array.isArray(value)) {
180
+ return value.flatMap((item) => parsedExtendsSources(item));
181
+ }
182
+
183
+ return objectExtendsSources(value);
184
+ }
185
+
186
+ const objectExtendsSources = (value: unknown): string[] => {
187
+ if (typeof value !== "object" || value === null) {
188
+ return [];
189
+ }
190
+
191
+ return "source" in value ? parsedExtendsSources(value.source) : [];
192
+ };
193
+
194
+ const configExtendsSources = (value: unknown): string[] => {
195
+ if (typeof value !== "object" || value === null) {
196
+ return [];
197
+ }
198
+
199
+ return "extends" in value ? parsedExtendsSources(value.extends) : [];
200
+ };
201
+
202
+ const dataSources = (path: string): string[] => {
203
+ const parser = DATA_PARSERS[extname(path).toLowerCase()];
204
+
205
+ if (parser === undefined) {
206
+ return [];
207
+ }
208
+
209
+ try {
210
+ return configExtendsSources(parser(readFileSync(path, "utf8")));
211
+ } catch {
212
+ return [];
213
+ }
214
+ };
215
+
216
+ const extensionCandidates = (path: string): string[] => {
217
+ const extension = extname(path).toLowerCase();
218
+
219
+ if (extension.length === 0) {
220
+ return RESOLVABLE_EXTENSIONS.map((candidate) => `${path}${candidate}`);
221
+ }
222
+
223
+ const stem = path.slice(0, -extension.length);
224
+
225
+ return (JAVASCRIPT_FALLBACKS[extension] ?? []).map((candidate) => `${stem}${candidate}`);
226
+ };
227
+
228
+ const targetCandidates = (target: string, configName: string): string[] => {
229
+ const extension = extname(target);
230
+
231
+ if (extension.length > 0) {
232
+ return [target, ...extensionCandidates(target)];
233
+ }
234
+
235
+ return [
236
+ target,
237
+ ...extensionCandidates(target),
238
+ join(target, configName),
239
+ ...RESOLVABLE_EXTENSIONS.map((candidate) => join(target, `index${candidate}`)),
240
+ ];
241
+ };
242
+
243
+ const localSourceTarget = (source: string, importer: string): string | undefined => {
244
+ const clean = source.split(/[?#]/u, 1)[0] ?? "";
245
+
246
+ if (clean.startsWith("file:")) {
247
+ return fileURLToPath(clean);
248
+ }
249
+
250
+ if (!isAbsolute(clean) && !clean.startsWith(".")) {
251
+ return undefined;
252
+ }
253
+
254
+ return resolve(dirname(importer), clean);
255
+ };
256
+
257
+ const unresolvedCandidates = (source: string, importer: string, configName: string): string[] => {
258
+ const target = localSourceTarget(source, importer);
259
+
260
+ if (target === undefined) {
261
+ return [];
262
+ }
263
+
264
+ return targetCandidates(target, configName);
265
+ };
266
+
267
+ const nearestPackageFile = (importer: string): string | undefined => {
268
+ let directory = dirname(importer);
269
+ let previous = "";
270
+
271
+ while (directory !== previous) {
272
+ const candidate = join(directory, "package.json");
273
+
274
+ if (existsSync(candidate)) {
275
+ return candidate;
276
+ }
277
+
278
+ previous = directory;
279
+ directory = dirname(directory);
280
+ }
281
+
282
+ return undefined;
283
+ };
284
+
285
+ const readPackageImports = (importer: string): PackageImports | undefined => {
286
+ const file = nearestPackageFile(importer);
287
+
288
+ if (file === undefined) {
289
+ return undefined;
290
+ }
291
+
292
+ try {
293
+ const manifest = parseJSON(readFileSync(file, "utf8"));
294
+
295
+ return isRecord(manifest) && isRecord(manifest.imports)
296
+ ? { file, imports: manifest.imports, root: dirname(file) }
297
+ : undefined;
298
+ } catch {
299
+ return undefined;
300
+ }
301
+ };
302
+
303
+ function stringTargets(value: unknown): string[] {
304
+ if (typeof value === "string") {
305
+ return [value];
306
+ }
307
+
308
+ if (Array.isArray(value)) {
309
+ return value.flatMap((item) => stringTargets(item));
310
+ }
311
+
312
+ return isRecord(value)
313
+ ? Object.values(value).flatMap((item) => stringTargets(item))
314
+ : [];
315
+ }
316
+
317
+ const importPatternMatch = (pattern: string, source: string): string | undefined => {
318
+ if (pattern === source) {
319
+ return "";
320
+ }
321
+
322
+ const wildcard = pattern.indexOf("*");
323
+
324
+ if (wildcard === -1) {
325
+ return undefined;
326
+ }
327
+
328
+ const prefix = pattern.slice(0, wildcard);
329
+ const suffix = pattern.slice(wildcard + 1);
330
+
331
+ return source.startsWith(prefix) && source.endsWith(suffix)
332
+ ? source.slice(prefix.length, source.length - suffix.length)
333
+ : undefined;
334
+ };
335
+
336
+ const packageImportTargets = (source: string, imports: Record<string, unknown>): string[] =>
337
+ Object.entries(imports).flatMap(([pattern, value]) => {
338
+ const match = importPatternMatch(pattern, source);
339
+
340
+ return match === undefined
341
+ ? []
342
+ : stringTargets(value).map((target) => target.split("*").join(match));
343
+ });
344
+
345
+ const packageImportDependencies = (source: string, importer: string, configName: string): string[] => {
346
+ if (!source.startsWith("#")) {
347
+ return [];
348
+ }
349
+
350
+ const packageImports = readPackageImports(importer);
351
+
352
+ if (packageImports === undefined) {
353
+ return [];
354
+ }
355
+
356
+ const targets = packageImportTargets(source, packageImports.imports)
357
+ .filter((target) => target.startsWith("."))
358
+ .flatMap((target) => targetCandidates(resolve(packageImports.root, target), configName));
359
+
360
+ return [packageImports.file, ...targets];
361
+ };
362
+
363
+ const normalizedResolvedPath = (path: string): string =>
364
+ path.startsWith("file:") ? fileURLToPath(path) : path;
365
+
366
+ const resolvedSourcePath = (source: string, importer: string, jiti: Jiti): string | undefined => {
367
+ try {
368
+ const path = jiti.esmResolve(source, {
369
+ parentURL: pathToFileURL(importer).href,
370
+ try: true,
371
+ });
372
+
373
+ return path === undefined ? undefined : normalizedResolvedPath(path);
374
+ } catch {
375
+ return undefined;
376
+ }
377
+ };
378
+
379
+ const sourceDependencies = (
380
+ source: string,
381
+ importer: string,
382
+ configName: string,
383
+ jiti: Jiti,
384
+ ): string[] => {
385
+ const dependency = resolvedSourcePath(source, importer, jiti);
386
+ const packageDependencies = packageImportDependencies(source, importer, configName);
387
+
388
+ return dependency === undefined
389
+ ? [...unresolvedCandidates(source, importer, configName), ...packageDependencies]
390
+ : [dependency, ...packageDependencies];
391
+ };
392
+
393
+ const configLayerDirectory = (path: string, configName: string, configRoot: string): string => {
394
+ const segments = configName.split(/[\\/]/u).filter((segment) => segment.length > 0);
395
+ let directory = resolve(path);
396
+ let remaining = segments.length;
397
+
398
+ while (remaining > 0) {
399
+ directory = dirname(directory);
400
+ remaining -= 1;
401
+ }
402
+
403
+ return resolve(directory, ...segments) === resolve(path) ? directory : resolve(configRoot);
404
+ };
405
+
406
+ const c12SourceDependencies = (
407
+ source: string,
408
+ importer: string,
409
+ configName: string,
410
+ configRoot: string,
411
+ ): string[] => {
412
+ const clean = source.split(/[?#]/u, 1)[0] ?? "";
413
+
414
+ if (clean === "." || (!isAbsolute(clean) && !clean.startsWith("."))) {
415
+ return [];
416
+ }
417
+
418
+ const cwd = configLayerDirectory(importer, configName, configRoot);
419
+ const extension = extname(clean);
420
+ const target = (extension.length === 0 || extension === basename(clean))
421
+ ? resolve(cwd, clean, configName)
422
+ : resolve(cwd, clean);
423
+
424
+ return targetCandidates(target, configName);
425
+ };
426
+
427
+ const directDependencies = (path: string, configName: string, configRoot: string): string[] => {
428
+ const module = MODULE_EXTENSIONS.has(extname(path).toLowerCase()) ? moduleSources(path) : undefined;
429
+ const sources = module?.all ?? dataSources(path);
430
+ const extended = module?.extended ?? sources;
431
+ const jiti = createJiti(path, {
432
+ extensions: RESOLVABLE_EXTENSIONS,
433
+ fsCache: false,
434
+ moduleCache: false,
435
+ });
436
+
437
+ return [
438
+ ...sources.flatMap((source) => sourceDependencies(source, path, configName, jiti)),
439
+ ...extended.flatMap((source) => c12SourceDependencies(source, path, configName, configRoot)),
440
+ ]
441
+ .filter((dependency) => !dependency.includes(`${sep}node_modules${sep}`));
442
+ };
443
+
444
+ const resolveConfigDependencies = (
445
+ configFile: string,
446
+ configName = basename(configFile),
447
+ configRoot = dirname(configFile),
448
+ ): string[] => {
449
+ const dependencies: Set<string> = new Set();
450
+ const pending = [resolve(configFile)];
451
+
452
+ while (pending.length > 0) {
453
+ const path = pending.pop();
454
+
455
+ if (path === undefined) {
456
+ break;
457
+ }
458
+
459
+ if (dependencies.has(path)) {
460
+ continue;
461
+ }
462
+
463
+ dependencies.add(path);
464
+ pending.push(...directDependencies(path, configName, configRoot));
465
+ }
466
+
467
+ return [...dependencies];
468
+ };
469
+
470
+ export { resolveConfigDependencies };
@@ -1,5 +1,6 @@
1
1
  import type { Config } from "@gtkx/config";
2
2
  import { resolveGirPath, resolveLibraries } from "@gtkx/codegen";
3
+ import { resolveBoundLibraries } from "@gtkx/codegen/internal";
3
4
  import { existsSync, readFileSync } from "node:fs";
4
5
  import { basename, dirname, join } from "node:path";
5
6
  import { type CodegenStore, resolveCodegenStore } from "./store-resolver.js";
@@ -86,7 +87,10 @@ const hasStoreExports = (storeDir: string, required: string[], forbidden: string
86
87
  };
87
88
 
88
89
  const isGiStoreStale = (store: CodegenStore, libraries: string[]): boolean => {
89
- const required = [PACKAGE_EXPORT, ...libraries.map((library) => namespaceExport(library))];
90
+ const required = [
91
+ PACKAGE_EXPORT,
92
+ ...resolveBoundLibraries(libraries).map((library) => namespaceExport(library)),
93
+ ];
90
94
 
91
95
  return !hasStoreExports(store.giStoreDir, required);
92
96
  };
@@ -38,6 +38,7 @@ const writeReference = async (options: WriteReferenceOptions): Promise<Reference
38
38
  basePath: REFERENCE_PATH,
39
39
  linkStyle: "file",
40
40
  props: builtin.props,
41
+ acceptedChildTypes: builtin.acceptedChildTypes,
41
42
  omittedProps: mergeOmittedProps(builtin.omittedProps, resolveOmittedProps(config.elements)),
42
43
  isForced: options.isForced === true,
43
44
  });