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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (501) hide show
  1. package/README.md +43 -40
  2. package/bin/gtkx-dev-runner.js +5 -1
  3. package/bin/gtkx.js +5 -1
  4. package/dist/builder.d.ts +1 -0
  5. package/dist/builder.d.ts.map +1 -1
  6. package/dist/builder.js +44 -12
  7. package/dist/builder.js.map +1 -1
  8. package/dist/cli.d.ts +1 -1
  9. package/dist/cli.d.ts.map +1 -1
  10. package/dist/cli.js +14 -2
  11. package/dist/cli.js.map +1 -1
  12. package/dist/codegen/config-dependencies.d.ts +3 -0
  13. package/dist/codegen/config-dependencies.d.ts.map +1 -0
  14. package/dist/codegen/config-dependencies.js +355 -0
  15. package/dist/codegen/config-dependencies.js.map +1 -0
  16. package/dist/codegen/freshness.d.ts.map +1 -1
  17. package/dist/codegen/freshness.js +5 -1
  18. package/dist/codegen/freshness.js.map +1 -1
  19. package/dist/codegen/reference.d.ts.map +1 -1
  20. package/dist/codegen/reference.js +1 -0
  21. package/dist/codegen/reference.js.map +1 -1
  22. package/dist/codegen/run-codegen.d.ts +6 -3
  23. package/dist/codegen/run-codegen.d.ts.map +1 -1
  24. package/dist/codegen/run-codegen.js +42 -18
  25. package/dist/codegen/run-codegen.js.map +1 -1
  26. package/dist/codegen/store-resolver.d.ts +3 -1
  27. package/dist/codegen/store-resolver.d.ts.map +1 -1
  28. package/dist/codegen/store-resolver.js +7 -4
  29. package/dist/codegen/store-resolver.js.map +1 -1
  30. package/dist/commands/build.d.ts +5 -0
  31. package/dist/commands/build.d.ts.map +1 -1
  32. package/dist/commands/build.js +83 -10
  33. package/dist/commands/build.js.map +1 -1
  34. package/dist/commands/cleanup.d.ts +9 -0
  35. package/dist/commands/cleanup.d.ts.map +1 -0
  36. package/dist/commands/cleanup.js +42 -0
  37. package/dist/commands/cleanup.js.map +1 -0
  38. package/dist/commands/codegen.d.ts +1 -0
  39. package/dist/commands/codegen.d.ts.map +1 -1
  40. package/dist/commands/codegen.js +6 -5
  41. package/dist/commands/codegen.js.map +1 -1
  42. package/dist/commands/deploy.d.ts +5 -0
  43. package/dist/commands/deploy.d.ts.map +1 -1
  44. package/dist/commands/deploy.js +10 -2
  45. package/dist/commands/deploy.js.map +1 -1
  46. package/dist/commands/dev.d.ts +9 -0
  47. package/dist/commands/dev.d.ts.map +1 -1
  48. package/dist/commands/dev.js +31 -4
  49. package/dist/commands/dev.js.map +1 -1
  50. package/dist/commands/docs.d.ts.map +1 -1
  51. package/dist/commands/docs.js +1 -0
  52. package/dist/commands/docs.js.map +1 -1
  53. package/dist/deploy/depends.d.ts.map +1 -1
  54. package/dist/deploy/depends.js +24 -2
  55. package/dist/deploy/depends.js.map +1 -1
  56. package/dist/deploy/download.d.ts +7 -3
  57. package/dist/deploy/download.d.ts.map +1 -1
  58. package/dist/deploy/download.js +19 -20
  59. package/dist/deploy/download.js.map +1 -1
  60. package/dist/deploy/freedesktop/metainfo.d.ts.map +1 -1
  61. package/dist/deploy/freedesktop/metainfo.js +41 -2
  62. package/dist/deploy/freedesktop/metainfo.js.map +1 -1
  63. package/dist/deploy/freedesktop/validate.d.ts.map +1 -1
  64. package/dist/deploy/freedesktop/validate.js +58 -14
  65. package/dist/deploy/freedesktop/validate.js.map +1 -1
  66. package/dist/deploy/native-addon.d.ts +5 -0
  67. package/dist/deploy/native-addon.d.ts.map +1 -0
  68. package/dist/deploy/native-addon.js +134 -0
  69. package/dist/deploy/native-addon.js.map +1 -0
  70. package/dist/deploy/nfpm/config.d.ts +3 -2
  71. package/dist/deploy/nfpm/config.d.ts.map +1 -1
  72. package/dist/deploy/nfpm/config.js +7 -4
  73. package/dist/deploy/nfpm/config.js.map +1 -1
  74. package/dist/deploy/nfpm/contents.d.ts.map +1 -1
  75. package/dist/deploy/nfpm/contents.js +8 -0
  76. package/dist/deploy/nfpm/contents.js.map +1 -1
  77. package/dist/deploy/node-runtime/download.js +2 -2
  78. package/dist/deploy/node-runtime/download.js.map +1 -1
  79. package/dist/deploy/node-runtime/elf.d.ts +4 -1
  80. package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
  81. package/dist/deploy/node-runtime/elf.js +34 -5
  82. package/dist/deploy/node-runtime/elf.js.map +1 -1
  83. package/dist/deploy/node-runtime/guard.d.ts.map +1 -1
  84. package/dist/deploy/node-runtime/guard.js +7 -14
  85. package/dist/deploy/node-runtime/guard.js.map +1 -1
  86. package/dist/deploy/node-runtime/index.d.ts +3 -1
  87. package/dist/deploy/node-runtime/index.d.ts.map +1 -1
  88. package/dist/deploy/node-runtime/index.js +103 -10
  89. package/dist/deploy/node-runtime/index.js.map +1 -1
  90. package/dist/deploy/node-runtime/sonames.d.ts +5 -0
  91. package/dist/deploy/node-runtime/sonames.d.ts.map +1 -0
  92. package/dist/deploy/node-runtime/sonames.js +13 -0
  93. package/dist/deploy/node-runtime/sonames.js.map +1 -0
  94. package/dist/deploy/notices/node-runtime.js +2 -2
  95. package/dist/deploy/notices/node-runtime.js.map +1 -1
  96. package/dist/deploy/payload/launcher.d.ts.map +1 -1
  97. package/dist/deploy/payload/launcher.js +14 -1
  98. package/dist/deploy/payload/launcher.js.map +1 -1
  99. package/dist/deploy/payload/stage.d.ts +2 -1
  100. package/dist/deploy/payload/stage.d.ts.map +1 -1
  101. package/dist/deploy/payload/stage.js +46 -5
  102. package/dist/deploy/payload/stage.js.map +1 -1
  103. package/dist/deploy/run-deploy.d.ts +2 -0
  104. package/dist/deploy/run-deploy.d.ts.map +1 -1
  105. package/dist/deploy/run-deploy.js +197 -52
  106. package/dist/deploy/run-deploy.js.map +1 -1
  107. package/dist/deploy/settings/arch.d.ts +9 -3
  108. package/dist/deploy/settings/arch.d.ts.map +1 -1
  109. package/dist/deploy/settings/arch.js +27 -6
  110. package/dist/deploy/settings/arch.js.map +1 -1
  111. package/dist/deploy/settings/build-manifest.d.ts +6 -1
  112. package/dist/deploy/settings/build-manifest.d.ts.map +1 -1
  113. package/dist/deploy/settings/build-manifest.js +15 -4
  114. package/dist/deploy/settings/build-manifest.js.map +1 -1
  115. package/dist/deploy/settings/extra-files.d.ts +1 -1
  116. package/dist/deploy/settings/extra-files.d.ts.map +1 -1
  117. package/dist/deploy/settings/extra-files.js +25 -3
  118. package/dist/deploy/settings/extra-files.js.map +1 -1
  119. package/dist/deploy/settings/index.d.ts +3 -1
  120. package/dist/deploy/settings/index.d.ts.map +1 -1
  121. package/dist/deploy/settings/index.js +4 -2
  122. package/dist/deploy/settings/index.js.map +1 -1
  123. package/dist/deploy/settings/libraries.d.ts.map +1 -1
  124. package/dist/deploy/settings/libraries.js +2 -1
  125. package/dist/deploy/settings/libraries.js.map +1 -1
  126. package/dist/deploy/settings/paths.d.ts +4 -2
  127. package/dist/deploy/settings/paths.d.ts.map +1 -1
  128. package/dist/deploy/settings/paths.js +121 -12
  129. package/dist/deploy/settings/paths.js.map +1 -1
  130. package/dist/deploy/targets/appimage.d.ts.map +1 -1
  131. package/dist/deploy/targets/appimage.js +1 -0
  132. package/dist/deploy/targets/appimage.js.map +1 -1
  133. package/dist/deploy/targets/flatpak-pnpm.js +4 -4
  134. package/dist/deploy/targets/flatpak-pnpm.js.map +1 -1
  135. package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
  136. package/dist/deploy/targets/flatpak-source.js +13 -2
  137. package/dist/deploy/targets/flatpak-source.js.map +1 -1
  138. package/dist/deploy/targets/flatpak.d.ts.map +1 -1
  139. package/dist/deploy/targets/flatpak.js +1 -0
  140. package/dist/deploy/targets/flatpak.js.map +1 -1
  141. package/dist/deploy/targets/nfpm-target.d.ts.map +1 -1
  142. package/dist/deploy/targets/nfpm-target.js +13 -7
  143. package/dist/deploy/targets/nfpm-target.js.map +1 -1
  144. package/dist/deploy/types.d.ts +5 -2
  145. package/dist/deploy/types.d.ts.map +1 -1
  146. package/dist/deploy/types.js.map +1 -1
  147. package/dist/deploy/vendored/appimagetool.js +2 -2
  148. package/dist/deploy/vendored/appimagetool.js.map +1 -1
  149. package/dist/deploy/vendored/nfpm.js +1 -1
  150. package/dist/deploy/vendored/nfpm.js.map +1 -1
  151. package/dist/dev/catalog-writes.d.ts +8 -0
  152. package/dist/dev/catalog-writes.d.ts.map +1 -0
  153. package/dist/dev/catalog-writes.js +26 -0
  154. package/dist/dev/catalog-writes.js.map +1 -0
  155. package/dist/dev/entry-env.d.ts +2 -1
  156. package/dist/dev/entry-env.d.ts.map +1 -1
  157. package/dist/dev/entry-env.js +2 -1
  158. package/dist/dev/entry-env.js.map +1 -1
  159. package/dist/dev/font-dir.d.ts +3 -0
  160. package/dist/dev/font-dir.d.ts.map +1 -0
  161. package/dist/dev/font-dir.js +9 -0
  162. package/dist/dev/font-dir.js.map +1 -0
  163. package/dist/dev/headless.d.ts +3 -0
  164. package/dist/dev/headless.d.ts.map +1 -0
  165. package/dist/dev/headless.js +35 -0
  166. package/dist/dev/headless.js.map +1 -0
  167. package/dist/dev/runner-deps.d.ts +1 -1
  168. package/dist/dev/runner-deps.d.ts.map +1 -1
  169. package/dist/dev/runner-deps.js +12 -7
  170. package/dist/dev/runner-deps.js.map +1 -1
  171. package/dist/dev/runner-main.d.ts.map +1 -1
  172. package/dist/dev/runner-main.js +10 -3
  173. package/dist/dev/runner-main.js.map +1 -1
  174. package/dist/dev/runner.d.ts +2 -0
  175. package/dist/dev/runner.d.ts.map +1 -1
  176. package/dist/dev/runner.js +26 -7
  177. package/dist/dev/runner.js.map +1 -1
  178. package/dist/dev/supervisor.d.ts +3 -1
  179. package/dist/dev/supervisor.d.ts.map +1 -1
  180. package/dist/dev/supervisor.js +132 -29
  181. package/dist/dev/supervisor.js.map +1 -1
  182. package/dist/dev/vite-dev-server.d.ts +1 -1
  183. package/dist/dev/vite-dev-server.d.ts.map +1 -1
  184. package/dist/dev/vite-dev-server.js +14 -2
  185. package/dist/dev/vite-dev-server.js.map +1 -1
  186. package/dist/dev/watch-ignore.d.ts +3 -0
  187. package/dist/dev/watch-ignore.d.ts.map +1 -0
  188. package/dist/dev/watch-ignore.js +11 -0
  189. package/dist/dev/watch-ignore.js.map +1 -0
  190. package/dist/i18n/catalogs.d.ts +6 -2
  191. package/dist/i18n/catalogs.d.ts.map +1 -1
  192. package/dist/i18n/catalogs.js +10 -7
  193. package/dist/i18n/catalogs.js.map +1 -1
  194. package/dist/i18n/source-messages.d.ts +3 -1
  195. package/dist/i18n/source-messages.d.ts.map +1 -1
  196. package/dist/i18n/source-messages.js +973 -9
  197. package/dist/i18n/source-messages.js.map +1 -1
  198. package/dist/internal/agent-rules.d.ts.map +1 -1
  199. package/dist/internal/agent-rules.js +7 -2
  200. package/dist/internal/agent-rules.js.map +1 -1
  201. package/dist/internal/banner.d.ts +4 -2
  202. package/dist/internal/banner.d.ts.map +1 -1
  203. package/dist/internal/banner.js +19 -5
  204. package/dist/internal/banner.js.map +1 -1
  205. package/dist/internal/build-manifest.d.ts +5 -2
  206. package/dist/internal/build-manifest.d.ts.map +1 -1
  207. package/dist/internal/build-manifest.js +15 -2
  208. package/dist/internal/build-manifest.js.map +1 -1
  209. package/dist/internal/build-output.d.ts +8 -0
  210. package/dist/internal/build-output.d.ts.map +1 -0
  211. package/dist/internal/build-output.js +116 -0
  212. package/dist/internal/build-output.js.map +1 -0
  213. package/dist/internal/cache-root.d.ts +3 -0
  214. package/dist/internal/cache-root.d.ts.map +1 -0
  215. package/dist/internal/cache-root.js +9 -0
  216. package/dist/internal/cache-root.js.map +1 -0
  217. package/dist/internal/compile-cache-store.d.ts +4 -0
  218. package/dist/internal/compile-cache-store.d.ts.map +1 -0
  219. package/dist/internal/compile-cache-store.js +41 -0
  220. package/dist/internal/compile-cache-store.js.map +1 -0
  221. package/dist/internal/compile-cache.d.ts +4 -0
  222. package/dist/internal/compile-cache.d.ts.map +1 -0
  223. package/dist/internal/compile-cache.js +16 -0
  224. package/dist/internal/compile-cache.js.map +1 -0
  225. package/dist/internal/deploy-out-dir.d.ts +4 -0
  226. package/dist/internal/deploy-out-dir.d.ts.map +1 -0
  227. package/dist/internal/deploy-out-dir.js +5 -0
  228. package/dist/internal/deploy-out-dir.js.map +1 -0
  229. package/dist/internal/docs-elements.d.ts +1 -0
  230. package/dist/internal/docs-elements.d.ts.map +1 -1
  231. package/dist/internal/docs-elements.js +5 -4
  232. package/dist/internal/docs-elements.js.map +1 -1
  233. package/dist/internal/entry-arg.d.ts +4 -1
  234. package/dist/internal/entry-arg.d.ts.map +1 -1
  235. package/dist/internal/entry-arg.js +7 -1
  236. package/dist/internal/entry-arg.js.map +1 -1
  237. package/dist/internal/errors.d.ts +2 -1
  238. package/dist/internal/errors.d.ts.map +1 -1
  239. package/dist/internal/errors.js +1 -1
  240. package/dist/internal/errors.js.map +1 -1
  241. package/dist/internal/font-path.d.ts +4 -0
  242. package/dist/internal/font-path.d.ts.map +1 -0
  243. package/dist/internal/font-path.js +12 -0
  244. package/dist/internal/font-path.js.map +1 -0
  245. package/dist/internal/font-staging.d.ts +6 -0
  246. package/dist/internal/font-staging.d.ts.map +1 -0
  247. package/dist/internal/font-staging.js +94 -0
  248. package/dist/internal/font-staging.js.map +1 -0
  249. package/dist/internal/icon-staging.d.ts +3 -0
  250. package/dist/internal/icon-staging.d.ts.map +1 -0
  251. package/dist/internal/icon-staging.js +40 -0
  252. package/dist/internal/icon-staging.js.map +1 -0
  253. package/dist/internal/import-scan.d.ts +4 -0
  254. package/dist/internal/import-scan.d.ts.map +1 -0
  255. package/dist/internal/import-scan.js +138 -0
  256. package/dist/internal/import-scan.js.map +1 -0
  257. package/dist/internal/module-hash.d.ts +3 -0
  258. package/dist/internal/module-hash.d.ts.map +1 -0
  259. package/dist/internal/module-hash.js +19 -0
  260. package/dist/internal/module-hash.js.map +1 -0
  261. package/dist/internal/output-directory.d.ts +15 -0
  262. package/dist/internal/output-directory.d.ts.map +1 -0
  263. package/dist/internal/output-directory.js +490 -0
  264. package/dist/internal/output-directory.js.map +1 -0
  265. package/dist/internal/parent-process.d.ts +12 -0
  266. package/dist/internal/parent-process.d.ts.map +1 -0
  267. package/dist/internal/parent-process.js +74 -0
  268. package/dist/internal/parent-process.js.map +1 -0
  269. package/dist/internal/prepare-project.d.ts +3 -0
  270. package/dist/internal/prepare-project.d.ts.map +1 -1
  271. package/dist/internal/prepare-project.js +9 -3
  272. package/dist/internal/prepare-project.js.map +1 -1
  273. package/dist/internal/react-compiler-cache.d.ts +13 -0
  274. package/dist/internal/react-compiler-cache.d.ts.map +1 -0
  275. package/dist/internal/react-compiler-cache.js +182 -0
  276. package/dist/internal/react-compiler-cache.js.map +1 -0
  277. package/dist/internal/source-imports.d.ts +7 -2
  278. package/dist/internal/source-imports.d.ts.map +1 -1
  279. package/dist/internal/source-imports.js +31 -11
  280. package/dist/internal/source-imports.js.map +1 -1
  281. package/dist/internal/staging-file.d.ts +5 -0
  282. package/dist/internal/staging-file.d.ts.map +1 -0
  283. package/dist/internal/staging-file.js +35 -0
  284. package/dist/internal/staging-file.js.map +1 -0
  285. package/dist/internal/xdg-banner.d.ts +4 -0
  286. package/dist/internal/xdg-banner.d.ts.map +1 -0
  287. package/dist/internal/xdg-banner.js +11 -0
  288. package/dist/internal/xdg-banner.js.map +1 -0
  289. package/dist/internal/xdg-data-dirs.d.ts +2 -1
  290. package/dist/internal/xdg-data-dirs.d.ts.map +1 -1
  291. package/dist/internal/xdg-data-dirs.js +1 -1
  292. package/dist/internal/xdg-data-dirs.js.map +1 -1
  293. package/dist/mcp/client.js +2 -2
  294. package/dist/mcp/client.js.map +1 -1
  295. package/dist/settings/schema.d.ts.map +1 -1
  296. package/dist/settings/schema.js +3 -8
  297. package/dist/settings/schema.js.map +1 -1
  298. package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
  299. package/dist/vite-plugins/asset-extensions.js +2 -0
  300. package/dist/vite-plugins/asset-extensions.js.map +1 -1
  301. package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
  302. package/dist/vite-plugins/asset-imports.js +20 -6
  303. package/dist/vite-plugins/asset-imports.js.map +1 -1
  304. package/dist/vite-plugins/asset-specifier.d.ts +5 -1
  305. package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
  306. package/dist/vite-plugins/asset-specifier.js +10 -1
  307. package/dist/vite-plugins/asset-specifier.js.map +1 -1
  308. package/dist/vite-plugins/build-manifest.d.ts +5 -1
  309. package/dist/vite-plugins/build-manifest.d.ts.map +1 -1
  310. package/dist/vite-plugins/build-manifest.js +2 -1
  311. package/dist/vite-plugins/build-manifest.js.map +1 -1
  312. package/dist/vite-plugins/built-url.d.ts.map +1 -1
  313. package/dist/vite-plugins/built-url.js +5 -2
  314. package/dist/vite-plugins/built-url.js.map +1 -1
  315. package/dist/vite-plugins/css.d.ts.map +1 -1
  316. package/dist/vite-plugins/css.js +13 -5
  317. package/dist/vite-plugins/css.js.map +1 -1
  318. package/dist/vite-plugins/ensure-store.d.ts +1 -1
  319. package/dist/vite-plugins/ensure-store.d.ts.map +1 -1
  320. package/dist/vite-plugins/ensure-store.js +2 -2
  321. package/dist/vite-plugins/ensure-store.js.map +1 -1
  322. package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts +6 -1
  323. package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts.map +1 -1
  324. package/dist/vite-plugins/fast-refresh/refresh-filter.js +3 -1
  325. package/dist/vite-plugins/fast-refresh/refresh-filter.js.map +1 -1
  326. package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts.map +1 -1
  327. package/dist/vite-plugins/fast-refresh/swc-refresh.js +23 -14
  328. package/dist/vite-plugins/fast-refresh/swc-refresh.js.map +1 -1
  329. package/dist/vite-plugins/font-name.d.ts +3 -0
  330. package/dist/vite-plugins/font-name.d.ts.map +1 -0
  331. package/dist/vite-plugins/font-name.js +406 -0
  332. package/dist/vite-plugins/font-name.js.map +1 -0
  333. package/dist/vite-plugins/font-worker-env.d.ts +4 -0
  334. package/dist/vite-plugins/font-worker-env.d.ts.map +1 -0
  335. package/dist/vite-plugins/font-worker-env.js +19 -0
  336. package/dist/vite-plugins/font-worker-env.js.map +1 -0
  337. package/dist/vite-plugins/font.d.ts +4 -0
  338. package/dist/vite-plugins/font.d.ts.map +1 -0
  339. package/dist/vite-plugins/font.js +111 -0
  340. package/dist/vite-plugins/font.js.map +1 -0
  341. package/dist/vite-plugins/i18n.d.ts +11 -2
  342. package/dist/vite-plugins/i18n.d.ts.map +1 -1
  343. package/dist/vite-plugins/i18n.js +74 -8
  344. package/dist/vite-plugins/i18n.js.map +1 -1
  345. package/dist/vite-plugins/icon-worker-env.d.ts +4 -0
  346. package/dist/vite-plugins/icon-worker-env.d.ts.map +1 -0
  347. package/dist/vite-plugins/icon-worker-env.js +23 -0
  348. package/dist/vite-plugins/icon-worker-env.js.map +1 -0
  349. package/dist/vite-plugins/icons.d.ts.map +1 -1
  350. package/dist/vite-plugins/icons.js +4 -9
  351. package/dist/vite-plugins/icons.js.map +1 -1
  352. package/dist/vite-plugins/index.d.ts +10 -1
  353. package/dist/vite-plugins/index.d.ts.map +1 -1
  354. package/dist/vite-plugins/index.js +17 -3
  355. package/dist/vite-plugins/index.js.map +1 -1
  356. package/dist/vite-plugins/native.d.ts.map +1 -1
  357. package/dist/vite-plugins/native.js +0 -4
  358. package/dist/vite-plugins/native.js.map +1 -1
  359. package/dist/vite-plugins/react-compiler.d.ts.map +1 -1
  360. package/dist/vite-plugins/react-compiler.js +57 -18
  361. package/dist/vite-plugins/react-compiler.js.map +1 -1
  362. package/dist/vite-plugins/resource-shared.d.ts +3 -1
  363. package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
  364. package/dist/vite-plugins/resource-shared.js +3 -1
  365. package/dist/vite-plugins/resource-shared.js.map +1 -1
  366. package/dist/vite-plugins/resources.d.ts.map +1 -1
  367. package/dist/vite-plugins/resources.js +9 -6
  368. package/dist/vite-plugins/resources.js.map +1 -1
  369. package/dist/vite-plugins/self-contained.d.ts.map +1 -1
  370. package/dist/vite-plugins/self-contained.js +159 -158
  371. package/dist/vite-plugins/self-contained.js.map +1 -1
  372. package/dist/vite-plugins/settings-worker-env.d.ts +1 -1
  373. package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
  374. package/dist/vite-plugins/settings-worker-env.js +4 -4
  375. package/dist/vite-plugins/settings-worker-env.js.map +1 -1
  376. package/dist/vite-plugins/settings.d.ts.map +1 -1
  377. package/dist/vite-plugins/settings.js +25 -14
  378. package/dist/vite-plugins/settings.js.map +1 -1
  379. package/dist/vite-plugins/store-links.d.ts.map +1 -1
  380. package/dist/vite-plugins/store-links.js +9 -5
  381. package/dist/vite-plugins/store-links.js.map +1 -1
  382. package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
  383. package/dist/vite-plugins/undeclared-library.js +18 -15
  384. package/dist/vite-plugins/undeclared-library.js.map +1 -1
  385. package/dist/vite-plugins/worker.d.ts.map +1 -1
  386. package/dist/vite-plugins/worker.js +21 -13
  387. package/dist/vite-plugins/worker.js.map +1 -1
  388. package/dist/vitest-plugin.d.ts +4 -3
  389. package/dist/vitest-plugin.d.ts.map +1 -1
  390. package/dist/vitest-plugin.js +12 -8
  391. package/dist/vitest-plugin.js.map +1 -1
  392. package/env.d.ts +9 -0
  393. package/package.json +18 -13
  394. package/src/builder.ts +45 -12
  395. package/src/cli.ts +15 -2
  396. package/src/codegen/config-dependencies.ts +470 -0
  397. package/src/codegen/freshness.ts +5 -1
  398. package/src/codegen/reference.ts +1 -0
  399. package/src/codegen/run-codegen.ts +51 -21
  400. package/src/codegen/store-resolver.ts +9 -4
  401. package/src/commands/build.ts +13 -2
  402. package/src/commands/cleanup.ts +48 -0
  403. package/src/commands/codegen.ts +6 -5
  404. package/src/commands/deploy.ts +10 -2
  405. package/src/commands/dev.ts +45 -4
  406. package/src/commands/docs.ts +1 -0
  407. package/src/deploy/depends.ts +30 -3
  408. package/src/deploy/download.ts +33 -24
  409. package/src/deploy/freedesktop/metainfo.ts +73 -21
  410. package/src/deploy/freedesktop/validate.ts +80 -15
  411. package/src/deploy/native-addon.ts +183 -0
  412. package/src/deploy/nfpm/config.ts +13 -4
  413. package/src/deploy/nfpm/contents.ts +8 -0
  414. package/src/deploy/node-runtime/download.ts +2 -2
  415. package/src/deploy/node-runtime/elf.ts +46 -5
  416. package/src/deploy/node-runtime/guard.ts +10 -14
  417. package/src/deploy/node-runtime/index.ts +148 -12
  418. package/src/deploy/node-runtime/sonames.ts +17 -0
  419. package/src/deploy/notices/node-runtime.ts +2 -2
  420. package/src/deploy/payload/launcher.ts +20 -1
  421. package/src/deploy/payload/stage.ts +76 -5
  422. package/src/deploy/run-deploy.ts +227 -72
  423. package/src/deploy/settings/arch.ts +40 -8
  424. package/src/deploy/settings/build-manifest.ts +28 -3
  425. package/src/deploy/settings/extra-files.ts +30 -4
  426. package/src/deploy/settings/index.ts +7 -2
  427. package/src/deploy/settings/libraries.ts +2 -1
  428. package/src/deploy/settings/paths.ts +80 -13
  429. package/src/deploy/targets/appimage.ts +1 -0
  430. package/src/deploy/targets/flatpak-pnpm.ts +4 -4
  431. package/src/deploy/targets/flatpak-source.ts +15 -2
  432. package/src/deploy/targets/flatpak.ts +1 -0
  433. package/src/deploy/targets/nfpm-target.ts +14 -6
  434. package/src/deploy/types.ts +5 -1
  435. package/src/deploy/vendored/appimagetool.ts +2 -2
  436. package/src/deploy/vendored/nfpm.ts +1 -1
  437. package/src/dev/catalog-writes.ts +35 -0
  438. package/src/dev/entry-env.ts +2 -1
  439. package/src/dev/font-dir.ts +11 -0
  440. package/src/dev/headless.ts +40 -0
  441. package/src/dev/runner-deps.ts +20 -7
  442. package/src/dev/runner-main.ts +12 -3
  443. package/src/dev/runner.ts +37 -7
  444. package/src/dev/supervisor.ts +183 -32
  445. package/src/dev/vite-dev-server.ts +20 -2
  446. package/src/dev/watch-ignore.ts +16 -0
  447. package/src/i18n/catalogs.ts +21 -8
  448. package/src/i18n/source-messages.ts +1446 -29
  449. package/src/internal/agent-rules.ts +7 -2
  450. package/src/internal/banner.ts +27 -6
  451. package/src/internal/build-manifest.ts +25 -1
  452. package/src/internal/build-output.ts +171 -0
  453. package/src/internal/cache-root.ts +12 -0
  454. package/src/internal/compile-cache-store.ts +50 -0
  455. package/src/internal/compile-cache.ts +20 -0
  456. package/src/internal/deploy-out-dir.ts +8 -0
  457. package/src/internal/docs-elements.ts +10 -4
  458. package/src/internal/entry-arg.ts +8 -1
  459. package/src/internal/errors.ts +1 -1
  460. package/src/internal/font-path.ts +15 -0
  461. package/src/internal/font-staging.ts +131 -0
  462. package/src/internal/icon-staging.ts +58 -0
  463. package/src/internal/import-scan.ts +206 -0
  464. package/src/internal/module-hash.ts +22 -0
  465. package/src/internal/output-directory.ts +699 -0
  466. package/src/internal/parent-process.ts +110 -0
  467. package/src/internal/prepare-project.ts +11 -5
  468. package/src/internal/react-compiler-cache.ts +246 -0
  469. package/src/internal/source-imports.ts +57 -12
  470. package/src/internal/staging-file.ts +42 -0
  471. package/src/internal/xdg-banner.ts +13 -0
  472. package/src/internal/xdg-data-dirs.ts +1 -1
  473. package/src/mcp/client.ts +2 -2
  474. package/src/settings/schema.ts +4 -10
  475. package/src/vite-plugins/asset-extensions.ts +2 -0
  476. package/src/vite-plugins/asset-imports.ts +23 -5
  477. package/src/vite-plugins/asset-specifier.ts +17 -0
  478. package/src/vite-plugins/build-manifest.ts +7 -1
  479. package/src/vite-plugins/built-url.ts +6 -2
  480. package/src/vite-plugins/css.ts +16 -5
  481. package/src/vite-plugins/ensure-store.ts +2 -2
  482. package/src/vite-plugins/fast-refresh/refresh-filter.ts +10 -1
  483. package/src/vite-plugins/fast-refresh/swc-refresh.ts +33 -14
  484. package/src/vite-plugins/font-name.ts +582 -0
  485. package/src/vite-plugins/font-worker-env.ts +25 -0
  486. package/src/vite-plugins/font.ts +180 -0
  487. package/src/vite-plugins/i18n.ts +122 -11
  488. package/src/vite-plugins/icon-worker-env.ts +36 -0
  489. package/src/vite-plugins/icons.ts +4 -10
  490. package/src/vite-plugins/index.ts +34 -9
  491. package/src/vite-plugins/native.ts +0 -5
  492. package/src/vite-plugins/react-compiler.ts +83 -19
  493. package/src/vite-plugins/resource-shared.ts +4 -0
  494. package/src/vite-plugins/resources.ts +11 -5
  495. package/src/vite-plugins/self-contained.ts +184 -185
  496. package/src/vite-plugins/settings-worker-env.ts +4 -4
  497. package/src/vite-plugins/settings.ts +36 -16
  498. package/src/vite-plugins/store-links.ts +10 -5
  499. package/src/vite-plugins/undeclared-library.ts +19 -15
  500. package/src/vite-plugins/worker.ts +31 -15
  501. package/src/vitest-plugin.ts +12 -8
@@ -1,9 +1,11 @@
1
- import { readFileSync } from "node:fs";
1
+ import { closeSync, openSync, readFileSync, readSync } from "node:fs";
2
2
  const ELF_MAGIC = "ELF";
3
+ const ELF_MAGIC_SIZE = 4;
3
4
  const CLASS_64 = 2;
4
5
  const LITTLE_ENDIAN = 1;
5
6
  const OFFSET_CLASS = 4;
6
7
  const OFFSET_DATA = 5;
8
+ const OFFSET_MACHINE = 0x12;
7
9
  const OFFSET_SECTION_HEADERS = 0x28;
8
10
  const OFFSET_SECTION_ENTRY_SIZE = 0x3A;
9
11
  const OFFSET_SECTION_COUNT = 0x3C;
@@ -17,8 +19,9 @@ const DT_NEEDED = 1;
17
19
  const DYNAMIC_VALUE_OFFSET = 8;
18
20
  const GLIBC_VERSION = /GLIBC_(\d+)\.(\d+)/g;
19
21
  const VERSION_RADIX = 1000;
22
+ const hasElfMagic = (buffer) => buffer.length >= OFFSET_CLASS && buffer.subarray(0, 4).toString("latin1") === ELF_MAGIC;
20
23
  const assertElf64 = (buffer, path) => {
21
- if (buffer.length < OFFSET_SECTION_NAME_INDEX || buffer.subarray(0, 4).toString("latin1") !== ELF_MAGIC) {
24
+ if (buffer.length < OFFSET_SECTION_NAME_INDEX || !hasElfMagic(buffer)) {
22
25
  throw new Error(`Cannot read ${path}: it is not an ELF binary`);
23
26
  }
24
27
  if (buffer.readUInt8(OFFSET_CLASS) !== CLASS_64 || buffer.readUInt8(OFFSET_DATA) !== LITTLE_ENDIAN) {
@@ -86,15 +89,41 @@ const readGlibcMinimum = (strings) => {
86
89
  return formatVersion(highestVersion(found));
87
90
  };
88
91
  const stringTable = (buffer, dynstr) => dynstr === undefined ? Buffer.alloc(0) : buffer.subarray(dynstr.offset, dynstr.offset + dynstr.size);
89
- const readElfInfo = (path) => {
90
- const buffer = readFileSync(path);
92
+ const readElfBuffer = (buffer, path) => {
91
93
  assertElf64(buffer, path);
92
94
  const sections = readSections(buffer);
93
95
  const strings = stringTable(buffer, sectionFor(sections, ".dynstr"));
94
96
  return {
97
+ machine: buffer.readUInt16LE(OFFSET_MACHINE),
95
98
  needed: readNeeded(buffer, sectionFor(sections, ".dynamic"), strings),
96
99
  glibcMinimum: readGlibcMinimum(strings),
97
100
  };
98
101
  };
99
- export { readElfInfo };
102
+ const readElfInfo = (path) => readElfBuffer(readFileSync(path), path);
103
+ const readFilePrefix = (descriptor, size) => {
104
+ const buffer = Buffer.alloc(size);
105
+ const bytesRead = readSync(descriptor, buffer, 0, size, 0);
106
+ return buffer.subarray(0, bytesRead);
107
+ };
108
+ const readOptionalElfInfo = (path) => {
109
+ const descriptor = openSync(path, "r");
110
+ try {
111
+ const prefix = readFilePrefix(descriptor, ELF_MAGIC_SIZE);
112
+ return hasElfMagic(prefix) ? readElfBuffer(readFileSync(descriptor), path) : null;
113
+ }
114
+ finally {
115
+ closeSync(descriptor);
116
+ }
117
+ };
118
+ const glibcMinimumForFiles = (paths) => {
119
+ const versions = [];
120
+ for (const path of paths) {
121
+ const minimum = readOptionalElfInfo(path)?.glibcMinimum;
122
+ if (minimum !== undefined && minimum !== null) {
123
+ versions.push(minimum.split(".").map(Number));
124
+ }
125
+ }
126
+ return formatVersion(highestVersion(versions));
127
+ };
128
+ export { glibcMinimumForFiles, readElfInfo, readOptionalElfInfo };
100
129
  //# sourceMappingURL=elf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"elf.js","sourceRoot":"","sources":["../../../src/deploy/node-runtime/elf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,M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QAAQ,CAAC,aAAa,CAAC;SACvB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACpD,OAAO,EAAE,CAAC;IAEf,OAAO,aAAa,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,MAA8B,EAAU,EAAE,CAC3E,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAEzG,MAAM,WAAW,GAAG,CAAC,IAAY,EAAW,EAAE;IAC1C,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAClC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1B,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAErE,OAAO;QACH,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC;QACrE,YAAY,EAAE,gBAAgB,CAAC,OAAO,CAAC;KAC1C,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAgB,WAAW,EAAE,CAAC","sourcesContent":["import { readFileSync } from \"node:fs\";\n\ntype ElfSection = {\n name: string;\n offset: number;\n size: number;\n};\n\ntype ElfInfo = {\n needed: string[];\n glibcMinimum: string | null;\n};\n\ntype DynamicEntry = {\n tag: number;\n value: number;\n};\n\nconst ELF_MAGIC = \"ELF\";\nconst CLASS_64 = 2;\nconst LITTLE_ENDIAN = 1;\nconst OFFSET_CLASS = 4;\nconst OFFSET_DATA = 5;\nconst OFFSET_SECTION_HEADERS = 0x28;\nconst OFFSET_SECTION_ENTRY_SIZE = 0x3A;\nconst OFFSET_SECTION_COUNT = 0x3C;\nconst OFFSET_SECTION_NAME_INDEX = 0x3E;\nconst SECTION_NAME = 0;\nconst SECTION_OFFSET = 24;\nconst SECTION_SIZE = 32;\nconst DYNAMIC_ENTRY_SIZE = 16;\nconst DT_NULL = 0;\nconst DT_NEEDED = 1;\nconst DYNAMIC_VALUE_OFFSET = 8;\nconst GLIBC_VERSION = /GLIBC_(\\d+)\\.(\\d+)/g;\nconst VERSION_RADIX = 1000;\n\nconst assertElf64 = (buffer: Buffer, path: string): void => {\n if (buffer.length < OFFSET_SECTION_NAME_INDEX || buffer.subarray(0, 4).toString(\"latin1\") !== ELF_MAGIC) {\n throw new Error(`Cannot read ${path}: it is not an ELF binary`);\n }\n\n if (buffer.readUInt8(OFFSET_CLASS) !== CLASS_64 || buffer.readUInt8(OFFSET_DATA) !== LITTLE_ENDIAN) {\n throw new Error(`Cannot read ${path}: only little-endian 64-bit ELF binaries are supported`);\n }\n};\n\nconst readCString = (buffer: Buffer, start: number): string => {\n const end = buffer.indexOf(0, start);\n\n return buffer.subarray(start, end === -1 ? buffer.length : end).toString(\"latin1\");\n};\n\nconst readSection = (buffer: Buffer, base: number, names: Buffer): ElfSection => ({\n name: readCString(names, buffer.readUInt32LE(base + SECTION_NAME)),\n offset: Number(buffer.readBigUInt64LE(base + SECTION_OFFSET)),\n size: Number(buffer.readBigUInt64LE(base + SECTION_SIZE)),\n});\n\nconst readSections = (buffer: Buffer): ElfSection[] => {\n const headers = Number(buffer.readBigUInt64LE(OFFSET_SECTION_HEADERS));\n const entrySize = buffer.readUInt16LE(OFFSET_SECTION_ENTRY_SIZE);\n const count = buffer.readUInt16LE(OFFSET_SECTION_COUNT);\n const nameIndex = buffer.readUInt16LE(OFFSET_SECTION_NAME_INDEX);\n const nameBase = headers + nameIndex * entrySize;\n const nameOffset = Number(buffer.readBigUInt64LE(nameBase + SECTION_OFFSET));\n const nameSize = Number(buffer.readBigUInt64LE(nameBase + SECTION_SIZE));\n const names = buffer.subarray(nameOffset, nameOffset + nameSize);\n\n return Array.from({ length: count }, (_, index) => readSection(buffer, headers + index * entrySize, names));\n};\n\nconst sectionFor = (sections: ElfSection[], name: string): ElfSection | undefined =>\n sections.find((section) => section.name === name);\n\nconst readDynamicEntries = (buffer: Buffer, dynamic: ElfSection): DynamicEntry[] => {\n const entries: DynamicEntry[] = [];\n\n for (let cursor = 0; cursor + DYNAMIC_ENTRY_SIZE <= dynamic.size; cursor += DYNAMIC_ENTRY_SIZE) {\n const base = dynamic.offset + cursor;\n const tag = Number(buffer.readBigUInt64LE(base));\n\n if (tag === DT_NULL) {\n break;\n }\n\n entries.push({ tag, value: Number(buffer.readBigUInt64LE(base + DYNAMIC_VALUE_OFFSET)) });\n }\n\n return entries;\n};\n\nconst readNeeded = (buffer: Buffer, dynamic: ElfSection | undefined, strings: Buffer): string[] => {\n if (dynamic === undefined) {\n return [];\n }\n\n return readDynamicEntries(buffer, dynamic)\n .filter((entry) => entry.tag === DT_NEEDED)\n .map((entry) => readCString(strings, entry.value));\n};\n\nconst getRank = (version: number[]): number => (version[0] ?? 0) * VERSION_RADIX + (version[1] ?? 0);\n\nconst highestVersion = (versions: number[][]): number[] | null => {\n let highest: number[] | null = null;\n\n for (const version of versions) {\n if (highest === null || getRank(version) > getRank(highest)) {\n highest = version;\n }\n }\n\n return highest;\n};\n\nconst formatVersion = (version: number[] | null): string | null =>\n version === null ? null : `${String(version[0] ?? 0)}.${String(version[1] ?? 0)}`;\n\nconst readGlibcMinimum = (strings: Buffer): string | null => {\n const found = strings\n .toString(\"latin1\")\n .matchAll(GLIBC_VERSION)\n .map((match) => [Number(match[1]), Number(match[2])])\n .toArray();\n\n return formatVersion(highestVersion(found));\n};\n\nconst stringTable = (buffer: Buffer, dynstr: ElfSection | undefined): Buffer =>\n dynstr === undefined ? Buffer.alloc(0) : buffer.subarray(dynstr.offset, dynstr.offset + dynstr.size);\n\nconst readElfInfo = (path: string): ElfInfo => {\n const buffer = readFileSync(path);\n assertElf64(buffer, path);\n const sections = readSections(buffer);\n const strings = stringTable(buffer, sectionFor(sections, \".dynstr\"));\n\n return {\n needed: readNeeded(buffer, sectionFor(sections, \".dynamic\"), strings),\n glibcMinimum: readGlibcMinimum(strings),\n };\n};\n\nexport { type ElfInfo, readElfInfo };\n"]}
1
+ {"version":3,"file":"elf.js","sourceRoot":"","sources":["../../../src/deploy/node-runtime/elf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAmBtE,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,sBAAsB,GAAG,IAAI,CAAC;AACpC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AACvC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AACvC,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,OAAO,GAAG,CAAC,CAAC;AAClB,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,aAAa,GAAG,qBA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CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACtF,CAAC;YAAS,CAAC;QACP,SAAS,CAAC,UAAU,CAAC,CAAC;IAC1B,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,KAAuB,EAAiB,EAAE;IACpE,MAAM,QAAQ,GAAe,EAAE,CAAC;IAEhC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;QAExD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YAC5C,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QAClD,CAAC;IACL,CAAC;IAED,OAAO,aAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,OAAO,EAAgB,oBAAoB,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["import { closeSync, openSync, readFileSync, readSync } from \"node:fs\";\n\ntype ElfSection = {\n name: string;\n offset: number;\n size: number;\n};\n\ntype ElfInfo = {\n machine: number;\n needed: string[];\n glibcMinimum: string | null;\n};\n\ntype DynamicEntry = {\n tag: number;\n value: number;\n};\n\nconst ELF_MAGIC = \"ELF\";\nconst ELF_MAGIC_SIZE = 4;\nconst CLASS_64 = 2;\nconst LITTLE_ENDIAN = 1;\nconst OFFSET_CLASS = 4;\nconst OFFSET_DATA = 5;\nconst OFFSET_MACHINE = 0x12;\nconst OFFSET_SECTION_HEADERS = 0x28;\nconst OFFSET_SECTION_ENTRY_SIZE = 0x3A;\nconst OFFSET_SECTION_COUNT = 0x3C;\nconst OFFSET_SECTION_NAME_INDEX = 0x3E;\nconst SECTION_NAME = 0;\nconst SECTION_OFFSET = 24;\nconst SECTION_SIZE = 32;\nconst DYNAMIC_ENTRY_SIZE = 16;\nconst DT_NULL = 0;\nconst DT_NEEDED = 1;\nconst DYNAMIC_VALUE_OFFSET = 8;\nconst GLIBC_VERSION = /GLIBC_(\\d+)\\.(\\d+)/g;\nconst VERSION_RADIX = 1000;\n\nconst hasElfMagic = (buffer: Buffer): boolean =>\n buffer.length >= OFFSET_CLASS && buffer.subarray(0, 4).toString(\"latin1\") === ELF_MAGIC;\n\nconst assertElf64 = (buffer: Buffer, path: string): void => {\n if (buffer.length < OFFSET_SECTION_NAME_INDEX || !hasElfMagic(buffer)) {\n throw new Error(`Cannot read ${path}: it is not an ELF binary`);\n }\n\n if (buffer.readUInt8(OFFSET_CLASS) !== CLASS_64 || buffer.readUInt8(OFFSET_DATA) !== LITTLE_ENDIAN) {\n throw new Error(`Cannot read ${path}: only little-endian 64-bit ELF binaries are supported`);\n }\n};\n\nconst readCString = (buffer: Buffer, start: number): string => {\n const end = buffer.indexOf(0, start);\n\n return buffer.subarray(start, end === -1 ? buffer.length : end).toString(\"latin1\");\n};\n\nconst readSection = (buffer: Buffer, base: number, names: Buffer): ElfSection => ({\n name: readCString(names, buffer.readUInt32LE(base + SECTION_NAME)),\n offset: Number(buffer.readBigUInt64LE(base + SECTION_OFFSET)),\n size: Number(buffer.readBigUInt64LE(base + SECTION_SIZE)),\n});\n\nconst readSections = (buffer: Buffer): ElfSection[] => {\n const headers = Number(buffer.readBigUInt64LE(OFFSET_SECTION_HEADERS));\n const entrySize = buffer.readUInt16LE(OFFSET_SECTION_ENTRY_SIZE);\n const count = buffer.readUInt16LE(OFFSET_SECTION_COUNT);\n const nameIndex = buffer.readUInt16LE(OFFSET_SECTION_NAME_INDEX);\n const nameBase = headers + nameIndex * entrySize;\n const nameOffset = Number(buffer.readBigUInt64LE(nameBase + SECTION_OFFSET));\n const nameSize = Number(buffer.readBigUInt64LE(nameBase + SECTION_SIZE));\n const names = buffer.subarray(nameOffset, nameOffset + nameSize);\n\n return Array.from({ length: count }, (_, index) => readSection(buffer, headers + index * entrySize, names));\n};\n\nconst sectionFor = (sections: ElfSection[], name: string): ElfSection | undefined =>\n sections.find((section) => section.name === name);\n\nconst readDynamicEntries = (buffer: Buffer, dynamic: ElfSection): DynamicEntry[] => {\n const entries: DynamicEntry[] = [];\n\n for (let cursor = 0; cursor + DYNAMIC_ENTRY_SIZE <= dynamic.size; cursor += DYNAMIC_ENTRY_SIZE) {\n const base = dynamic.offset + cursor;\n const tag = Number(buffer.readBigUInt64LE(base));\n\n if (tag === DT_NULL) {\n break;\n }\n\n entries.push({ tag, value: Number(buffer.readBigUInt64LE(base + DYNAMIC_VALUE_OFFSET)) });\n }\n\n return entries;\n};\n\nconst readNeeded = (buffer: Buffer, dynamic: ElfSection | undefined, strings: Buffer): string[] => {\n if (dynamic === undefined) {\n return [];\n }\n\n return readDynamicEntries(buffer, dynamic)\n .filter((entry) => entry.tag === DT_NEEDED)\n .map((entry) => readCString(strings, entry.value));\n};\n\nconst getRank = (version: number[]): number => (version[0] ?? 0) * VERSION_RADIX + (version[1] ?? 0);\n\nconst highestVersion = (versions: number[][]): number[] | null => {\n let highest: number[] | null = null;\n\n for (const version of versions) {\n if (highest === null || getRank(version) > getRank(highest)) {\n highest = version;\n }\n }\n\n return highest;\n};\n\nconst formatVersion = (version: number[] | null): string | null =>\n version === null ? null : `${String(version[0] ?? 0)}.${String(version[1] ?? 0)}`;\n\nconst readGlibcMinimum = (strings: Buffer): string | null => {\n const found = strings\n .toString(\"latin1\")\n .matchAll(GLIBC_VERSION)\n .map((match) => [Number(match[1]), Number(match[2])])\n .toArray();\n\n return formatVersion(highestVersion(found));\n};\n\nconst stringTable = (buffer: Buffer, dynstr: ElfSection | undefined): Buffer =>\n dynstr === undefined ? Buffer.alloc(0) : buffer.subarray(dynstr.offset, dynstr.offset + dynstr.size);\n\nconst readElfBuffer = (buffer: Buffer, path: string): ElfInfo => {\n assertElf64(buffer, path);\n const sections = readSections(buffer);\n const strings = stringTable(buffer, sectionFor(sections, \".dynstr\"));\n\n return {\n machine: buffer.readUInt16LE(OFFSET_MACHINE),\n needed: readNeeded(buffer, sectionFor(sections, \".dynamic\"), strings),\n glibcMinimum: readGlibcMinimum(strings),\n };\n};\n\nconst readElfInfo = (path: string): ElfInfo => readElfBuffer(readFileSync(path), path);\n\nconst readFilePrefix = (descriptor: number, size: number): Buffer => {\n const buffer = Buffer.alloc(size);\n const bytesRead = readSync(descriptor, buffer, 0, size, 0);\n\n return buffer.subarray(0, bytesRead);\n};\n\nconst readOptionalElfInfo = (path: string): ElfInfo | null => {\n const descriptor = openSync(path, \"r\");\n\n try {\n const prefix = readFilePrefix(descriptor, ELF_MAGIC_SIZE);\n\n return hasElfMagic(prefix) ? readElfBuffer(readFileSync(descriptor), path) : null;\n } finally {\n closeSync(descriptor);\n }\n};\n\nconst glibcMinimumForFiles = (paths: Iterable<string>): string | null => {\n const versions: number[][] = [];\n\n for (const path of paths) {\n const minimum = readOptionalElfInfo(path)?.glibcMinimum;\n\n if (minimum !== undefined && minimum !== null) {\n versions.push(minimum.split(\".\").map(Number));\n }\n }\n\n return formatVersion(highestVersion(versions));\n};\n\nexport { type ElfInfo, glibcMinimumForFiles, readElfInfo, readOptionalElfInfo };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../../src/deploy/node-runtime/guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAcxC,QAAA,MAAM,kBAAkB,GAAI,MAAM,OAAO,EAAE,QAAQ,MAAM,KAAG,IAY3D,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../../src/deploy/node-runtime/guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAWxC,QAAA,MAAM,kBAAkB,GAAI,MAAM,OAAO,EAAE,QAAQ,MAAM,KAAG,IAW3D,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,22 +1,15 @@
1
- const PORTABLE_LIBRARIES = new Set([
2
- "ld-linux-aarch64.so.1",
3
- "ld-linux-x86-64.so.2",
4
- "libc.so.6",
5
- "libdl.so.2",
6
- "libgcc_s.so.1",
7
- "libm.so.6",
8
- "libpthread.so.0",
9
- "librt.so.1",
10
- "libstdc++.so.6",
11
- ]);
1
+ import { RUNTIME_SONAMES } from "./sonames.js";
2
+ const DOWNLOAD_REMEDY = "The packages GTKX generates declare the libraries an official release links against, and this release " +
3
+ "links against more. Report it to GTKX, and pin `deploy.node.version` to a release it already packages.";
4
+ const SOURCE_REMEDY = 'Use `deploy.node.source: "download"` to fetch an official self-contained build instead.';
5
+ const remedyFor = (source) => (source === "download" ? DOWNLOAD_REMEDY : SOURCE_REMEDY);
12
6
  const assertPortableNode = (info, source) => {
13
- const foreign = info.needed.filter((library) => !PORTABLE_LIBRARIES.has(library));
7
+ const foreign = info.needed.filter((library) => !RUNTIME_SONAMES.has(library));
14
8
  if (foreign.length === 0) {
15
9
  return;
16
10
  }
17
11
  throw new Error(`Cannot bundle this Node.js binary: \`deploy.node.source: "${source}"\` picked one linked against ` +
18
- `${foreign.join(", ")}, which the target machine will not have. ` +
19
- 'Use `deploy.node.source: "download"` to fetch an official self-contained build instead.');
12
+ `${foreign.join(", ")}, which the packages GTKX generates do not require. ${remedyFor(source)}`);
20
13
  };
21
14
  export { assertPortableNode };
22
15
  //# sourceMappingURL=guard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"guard.js","sourceRoot":"","sources":["../../../src/deploy/node-runtime/guard.ts"],"names":[],"mappings":"AAEA,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IAC/B,uBAAuB;IACvB,sBAAsB;IACtB,WAAW;IACX,YAAY;IACZ,eAAe;IACf,WAAW;IACX,iBAAiB;IACjB,YAAY;IACZ,gBAAgB;CACnB,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,CAAC,IAAa,EAAE,MAAc,EAAQ,EAAE;IAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAElF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO;IACX,CAAC;IAED,MAAM,IAAI,KAAK,CACX,6DAA6D,MAAM,gCAAgC;QACnG,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,4CAA4C;QACjE,yFAAyF,CAC5F,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import type { ElfInfo } from \"./elf.js\";\n\nconst PORTABLE_LIBRARIES = new Set([\n \"ld-linux-aarch64.so.1\",\n \"ld-linux-x86-64.so.2\",\n \"libc.so.6\",\n \"libdl.so.2\",\n \"libgcc_s.so.1\",\n \"libm.so.6\",\n \"libpthread.so.0\",\n \"librt.so.1\",\n \"libstdc++.so.6\",\n]);\n\nconst assertPortableNode = (info: ElfInfo, source: string): void => {\n const foreign = info.needed.filter((library) => !PORTABLE_LIBRARIES.has(library));\n\n if (foreign.length === 0) {\n return;\n }\n\n throw new Error(\n `Cannot bundle this Node.js binary: \\`deploy.node.source: \"${source}\"\\` picked one linked against ` +\n `${foreign.join(\", \")}, which the target machine will not have. ` +\n 'Use `deploy.node.source: \"download\"` to fetch an official self-contained build instead.',\n );\n};\n\nexport { assertPortableNode };\n"]}
1
+ {"version":3,"file":"guard.js","sourceRoot":"","sources":["../../../src/deploy/node-runtime/guard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,eAAe,GACjB,wGAAwG;IACxG,wGAAwG,CAAC;AAE7G,MAAM,aAAa,GAAG,yFAAyF,CAAC;AAEhH,MAAM,SAAS,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;AAExG,MAAM,kBAAkB,GAAG,CAAC,IAAa,EAAE,MAAc,EAAQ,EAAE;IAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAE/E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO;IACX,CAAC;IAED,MAAM,IAAI,KAAK,CACX,6DAA6D,MAAM,gCAAgC;QACnG,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,uDAAuD,SAAS,CAAC,MAAM,CAAC,EAAE,CAClG,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import type { ElfInfo } from \"./elf.js\";\nimport { RUNTIME_SONAMES } from \"./sonames.js\";\n\nconst DOWNLOAD_REMEDY =\n \"The packages GTKX generates declare the libraries an official release links against, and this release \" +\n \"links against more. Report it to GTKX, and pin `deploy.node.version` to a release it already packages.\";\n\nconst SOURCE_REMEDY = 'Use `deploy.node.source: \"download\"` to fetch an official self-contained build instead.';\n\nconst remedyFor = (source: string): string => (source === \"download\" ? DOWNLOAD_REMEDY : SOURCE_REMEDY);\n\nconst assertPortableNode = (info: ElfInfo, source: string): void => {\n const foreign = info.needed.filter((library) => !RUNTIME_SONAMES.has(library));\n\n if (foreign.length === 0) {\n return;\n }\n\n throw new Error(\n `Cannot bundle this Node.js binary: \\`deploy.node.source: \"${source}\"\\` picked one linked against ` +\n `${foreign.join(\", \")}, which the packages GTKX generates do not require. ${remedyFor(source)}`,\n );\n};\n\nexport { assertPortableNode };\n"]}
@@ -1,5 +1,7 @@
1
1
  import type { DeploySettings, NodeRuntime } from "../types.js";
2
2
  declare const sourcePathFor: (settings: DeploySettings) => string;
3
+ declare const assertPortableRuntimeSource: (settings: DeploySettings) => void;
4
+ declare const resolveNodeVersion: (settings: DeploySettings) => string;
3
5
  declare const resolveNodeRuntime: (settings: DeploySettings) => Promise<NodeRuntime>;
4
- export { resolveNodeRuntime, sourcePathFor };
6
+ export { assertPortableRuntimeSource, resolveNodeRuntime, resolveNodeVersion, sourcePathFor };
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/deploy/node-runtime/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAgB/D,QAAA,MAAM,aAAa,GAAI,UAAU,cAAc,KAAG,MAajD,CAAC;AAyCF,QAAA,MAAM,kBAAkB,GAAU,UAAU,cAAc,KAAG,OAAO,CAAC,WAAW,CAU/E,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/deploy/node-runtime/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAgB,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAgG7E,QAAA,MAAM,aAAa,GAAI,UAAU,cAAc,KAAG,MAajD,CAAC;AAEF,QAAA,MAAM,2BAA2B,GAAI,UAAU,cAAc,KAAG,IAa/D,CAAC;AAEF,QAAA,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,MAatD,CAAC;AA+DF,QAAA,MAAM,kBAAkB,GAAU,UAAU,cAAc,KAAG,OAAO,CAAC,WAAW,CAY/E,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAC"}
@@ -1,17 +1,76 @@
1
- import { info, tryResolveExecutable } from "@gtkx/utils";
2
- import { chmodSync, copyFileSync, mkdirSync, statSync } from "node:fs";
1
+ import { MINIMUM_NODE_VERSION } from "@gtkx/config/internal";
2
+ import { info, tryResolveExecutable, warn } from "@gtkx/utils";
3
+ import { execFileSync } from "node:child_process";
4
+ import { chmodSync, copyFileSync, existsSync, mkdirSync, statSync } from "node:fs";
3
5
  import { join, resolve } from "node:path";
4
6
  import { runCliTool } from "../../internal/run-cli-tool.js";
7
+ import { elfMachineFor, hostArchName } from "../settings/arch.js";
5
8
  import { downloadNode } from "./download.js";
6
- import { readElfInfo } from "./elf.js";
9
+ import { readElfInfo, readOptionalElfInfo } from "./elf.js";
7
10
  import { assertPortableNode } from "./guard.js";
8
11
  import { licenseBesideNode } from "./license.js";
9
12
  const BYTES_PER_MIB = 1024 * 1024;
10
13
  const EXECUTABLE_MODE = 0o755;
11
14
  const NODE_FILENAME = "node";
15
+ const NODE_VERSION_PATTERN = /^v?(\d+)\.(\d+)\.(\d+)$/;
16
+ const VERSION_PROBE_TIMEOUT_MS = 10_000;
17
+ const VERSION_PROBE_MAX_BUFFER = 1024;
18
+ const nodeSourceFor = (settings) => settings.deploy.node?.source ?? "download";
19
+ const parseNodeVersion = (value, subject) => {
20
+ const match = NODE_VERSION_PATTERN.exec(value.trim());
21
+ if (match === null) {
22
+ throw new Error(`Cannot determine the Node.js version for ${subject}: expected a version such as 26.7.0`);
23
+ }
24
+ const parts = match.slice(1).map(Number);
25
+ return { parts, version: parts.map(String).join(".") };
26
+ };
27
+ const compareVersions = (left, right) => {
28
+ for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
29
+ const difference = (left[index] ?? 0) - (right[index] ?? 0);
30
+ if (difference !== 0) {
31
+ return difference;
32
+ }
33
+ }
34
+ return 0;
35
+ };
36
+ const supportedNodeVersion = (value, subject) => {
37
+ const parsed = parseNodeVersion(value, subject);
38
+ const minimum = parseNodeVersion(MINIMUM_NODE_VERSION, "GTKX");
39
+ if (compareVersions(parsed.parts, minimum.parts) < 0) {
40
+ throw new Error(`Cannot bundle Node.js ${parsed.version} for ${subject}: GTKX requires ${MINIMUM_NODE_VERSION} or newer`);
41
+ }
42
+ return parsed.version;
43
+ };
44
+ const probeNodeVersion = (path) => {
45
+ try {
46
+ const output = execFileSync(path, ["--version"], {
47
+ encoding: "utf8",
48
+ env: { ...process.env, NODE_OPTIONS: "" },
49
+ maxBuffer: VERSION_PROBE_MAX_BUFFER,
50
+ timeout: VERSION_PROBE_TIMEOUT_MS,
51
+ });
52
+ return supportedNodeVersion(output, path);
53
+ }
54
+ catch (error) {
55
+ if (error instanceof Error && error.message.startsWith("Cannot bundle Node.js")) {
56
+ throw error;
57
+ }
58
+ throw new Error(`Cannot determine the Node.js version from ${path}`, { cause: error });
59
+ }
60
+ };
61
+ const assertExpectedVersion = (configured, actual, source) => {
62
+ if (configured === undefined) {
63
+ return actual;
64
+ }
65
+ const expected = parseNodeVersion(configured, `deploy.node.source: "${source}"`).version;
66
+ if (expected !== actual) {
67
+ throw new Error(`The Node.js runtime from deploy.node.source "${source}" is ${actual}, not the configured ${expected}`);
68
+ }
69
+ return actual;
70
+ };
12
71
  const sourcePathFor = (settings) => {
13
72
  const node = settings.deploy.node ?? {};
14
- const source = node.source ?? "download";
73
+ const source = nodeSourceFor(settings);
15
74
  if (source === "host") {
16
75
  return process.execPath;
17
76
  }
@@ -20,6 +79,28 @@ const sourcePathFor = (settings) => {
20
79
  }
21
80
  return resolve(settings.paths.root, node.path);
22
81
  };
82
+ const assertPortableRuntimeSource = (settings) => {
83
+ const source = nodeSourceFor(settings);
84
+ if (source === "download") {
85
+ return;
86
+ }
87
+ const sourcePath = sourcePathFor(settings);
88
+ const elf = existsSync(sourcePath) ? readOptionalElfInfo(sourcePath) : null;
89
+ if (elf !== null) {
90
+ assertPortableNode(elf, source);
91
+ }
92
+ };
93
+ const resolveNodeVersion = (settings) => {
94
+ const node = settings.deploy.node ?? {};
95
+ const source = nodeSourceFor(settings);
96
+ if (source === "download") {
97
+ return supportedNodeVersion(node.version ?? MINIMUM_NODE_VERSION, 'deploy.node.source: "download"');
98
+ }
99
+ const actual = source === "host"
100
+ ? supportedNodeVersion(process.versions.node, 'deploy.node.source: "host"')
101
+ : probeNodeVersion(sourcePathFor(settings));
102
+ return assertExpectedVersion(node.version, actual, source);
103
+ };
23
104
  const didStripBinary = (path) => {
24
105
  if (tryResolveExecutable("strip") === undefined) {
25
106
  return false;
@@ -45,18 +126,30 @@ const stageFromSource = async (settings, version, source) => {
45
126
  return stageDownloadedNode(settings, version);
46
127
  }
47
128
  const sourcePath = sourcePathFor(settings);
48
- assertPortableNode(readElfInfo(sourcePath), source);
49
129
  return { path: stageNode(settings, sourcePath), licenseFile: licenseBesideNode(sourcePath) };
50
130
  };
131
+ const shouldStripRuntime = (settings, node, elf) => {
132
+ if (node.shouldStrip === false) {
133
+ return false;
134
+ }
135
+ if (elf.machine === elfMachineFor(hostArchName())) {
136
+ return true;
137
+ }
138
+ warn(`Skipping \`strip\` on the bundled Node.js: it was built for ${settings.arch.node} and \`strip\` reads ` +
139
+ `only ${hostArchName()}. The ${settings.arch.node} packages carry an unstripped runtime.`);
140
+ return false;
141
+ };
51
142
  const resolveNodeRuntime = async (settings) => {
52
143
  const node = settings.deploy.node ?? {};
53
- const source = node.source ?? "download";
54
- const version = node.version ?? process.versions.node;
144
+ const source = nodeSourceFor(settings);
145
+ const version = resolveNodeVersion(settings);
55
146
  const staged = await stageFromSource(settings, version, source);
56
- const isStripped = node.shouldStrip === false ? false : didStripBinary(staged.path);
57
147
  const elf = readElfInfo(staged.path);
58
- info(`Bundled Node.js v${version} (${megabytes(staged.path)} MiB, glibc >= ${elf.glibcMinimum ?? "unknown"})`);
148
+ assertPortableNode(elf, source);
149
+ const isStripped = shouldStripRuntime(settings, node, elf) && didStripBinary(staged.path);
150
+ const glibcMinimum = elf.glibcMinimum ?? "unknown";
151
+ info(`Bundled Node.js v${version} (${megabytes(staged.path)} MiB, runtime glibc >= ${glibcMinimum})`);
59
152
  return { ...staged, version, glibcMinimum: elf.glibcMinimum, isStripped };
60
153
  };
61
- export { resolveNodeRuntime, sourcePathFor };
154
+ export { assertPortableRuntimeSource, resolveNodeRuntime, resolveNodeVersion, sourcePathFor };
62
155
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/deploy/node-runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAOjD,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC;AAClC,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,MAAM,aAAa,GAAG,CAAC,QAAwB,EAAU,EAAE;IACvD,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC;IAEzC,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACpB,OAAO,OAAO,CAAC,QAAQ,CAAC;IAC5B,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,2FAA2F,CAAC,CAAC;IACjH,CAAC;IAED,OAA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AG,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,CAAC;AAC9E,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { info, tryResolveExecutable } from \"@gtkx/utils\";\nimport { chmodSync, copyFileSync, mkdirSync, statSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { DeploySettings, NodeRuntime } from \"../types.js\";\nimport { runCliTool } from \"../../internal/run-cli-tool.js\";\nimport { downloadNode } from \"./download.js\";\nimport { readElfInfo } from \"./elf.js\";\nimport { assertPortableNode } from \"./guard.js\";\nimport { licenseBesideNode } from \"./license.js\";\n\ntype StagedRuntime = {\n path: string;\n licenseFile: string | null;\n};\n\nconst BYTES_PER_MIB = 1024 * 1024;\nconst EXECUTABLE_MODE = 0o755;\nconst NODE_FILENAME = \"node\";\n\nconst sourcePathFor = (settings: DeploySettings): string => {\n const node = settings.deploy.node ?? {};\n const source = node.source ?? \"download\";\n\n if (source === \"host\") {\n return process.execPath;\n }\n\n if (node.path === undefined) {\n throw new Error('Cannot resolve the Node.js runtime: `deploy.node.source: \"path\"` needs `deploy.node.path`');\n }\n\n return resolve(settings.paths.root, node.path);\n};\n\nconst didStripBinary = (path: string): boolean => {\n if (tryResolveExecutable(\"strip\") === undefined) {\n return false;\n }\n\n runCliTool({ tool: \"strip\", args: [\"--strip-unneeded\", path], target: \"the bundled Node.js\" });\n\n return true;\n};\n\nconst megabytes = (path: string): string => (statSync(path).size / BYTES_PER_MIB).toFixed(1);\n\nconst stageNode = (settings: DeploySettings, sourcePath: string): string => {\n mkdirSync(settings.paths.runtime, { recursive: true });\n const staged = join(settings.paths.runtime, NODE_FILENAME);\n copyFileSync(sourcePath, staged);\n chmodSync(staged, EXECUTABLE_MODE);\n\n return staged;\n};\n\nconst stageDownloadedNode = async (settings: DeploySettings, version: string): Promise<StagedRuntime> => {\n const downloaded = await downloadNode(version, settings.arch.node, settings.paths.runtime);\n chmodSync(downloaded.path, EXECUTABLE_MODE);\n\n return downloaded;\n};\n\nconst stageFromSource = async (settings: DeploySettings, version: string, source: string): Promise<StagedRuntime> => {\n if (source === \"download\") {\n return stageDownloadedNode(settings, version);\n }\n\n const sourcePath = sourcePathFor(settings);\n assertPortableNode(readElfInfo(sourcePath), source);\n\n return { path: stageNode(settings, sourcePath), licenseFile: licenseBesideNode(sourcePath) };\n};\n\nconst resolveNodeRuntime = async (settings: DeploySettings): Promise<NodeRuntime> => {\n const node = settings.deploy.node ?? {};\n const source = node.source ?? \"download\";\n const version = node.version ?? process.versions.node;\n const staged = await stageFromSource(settings, version, source);\n const isStripped = node.shouldStrip === false ? false : didStripBinary(staged.path);\n const elf = readElfInfo(staged.path);\n info(`Bundled Node.js v${version} (${megabytes(staged.path)} MiB, glibc >= ${elf.glibcMinimum ?? \"unknown\"})`);\n\n return { ...staged, version, glibcMinimum: elf.glibcMinimum, isStripped };\n};\n\nexport { resolveNodeRuntime, sourcePathFor };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/deploy/node-runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,E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O,KAAK,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,0BAA0B,YAAY,GAAG,CAAC,CAAC;IAEtG,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,CAAC;AAC9E,CAAC,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { MINIMUM_NODE_VERSION } from \"@gtkx/config/internal\";\nimport { info, tryResolveExecutable, warn } from \"@gtkx/utils\";\nimport { execFileSync } from \"node:child_process\";\nimport { chmodSync, copyFileSync, existsSync, mkdirSync, statSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { DeployConfig, DeploySettings, NodeRuntime } from \"../types.js\";\nimport { runCliTool } from \"../../internal/run-cli-tool.js\";\nimport { elfMachineFor, hostArchName } from \"../settings/arch.js\";\nimport { downloadNode } from \"./download.js\";\nimport { type ElfInfo, readElfInfo, readOptionalElfInfo } from \"./elf.js\";\nimport { assertPortableNode } from \"./guard.js\";\nimport { licenseBesideNode } from \"./license.js\";\n\ntype StagedRuntime = {\n path: string;\n licenseFile: string | null;\n};\n\ntype NodeSource = \"download\" | \"host\" | \"path\";\n\nconst BYTES_PER_MIB = 1024 * 1024;\nconst EXECUTABLE_MODE = 0o755;\nconst NODE_FILENAME = \"node\";\nconst NODE_VERSION_PATTERN = /^v?(\\d+)\\.(\\d+)\\.(\\d+)$/;\nconst VERSION_PROBE_TIMEOUT_MS = 10_000;\nconst VERSION_PROBE_MAX_BUFFER = 1024;\n\nconst nodeSourceFor = (settings: DeploySettings): NodeSource => settings.deploy.node?.source ?? \"download\";\n\nconst parseNodeVersion = (value: string, subject: string): { parts: number[]; version: string } => {\n const match = NODE_VERSION_PATTERN.exec(value.trim());\n\n if (match === null) {\n throw new Error(`Cannot determine the Node.js version for ${subject}: expected a version such as 26.7.0`);\n }\n\n const parts = match.slice(1).map(Number);\n\n return { parts, version: parts.map(String).join(\".\") };\n};\n\nconst compareVersions = (left: number[], right: number[]): number => {\n for (let index = 0; index < Math.max(left.length, right.length); index += 1) {\n const difference = (left[index] ?? 0) - (right[index] ?? 0);\n\n if (difference !== 0) {\n return difference;\n }\n }\n\n return 0;\n};\n\nconst supportedNodeVersion = (value: string, subject: string): string => {\n const parsed = parseNodeVersion(value, subject);\n const minimum = parseNodeVersion(MINIMUM_NODE_VERSION, \"GTKX\");\n\n if (compareVersions(parsed.parts, minimum.parts) < 0) {\n throw new Error(\n `Cannot bundle Node.js ${parsed.version} for ${subject}: GTKX requires ${MINIMUM_NODE_VERSION} or newer`,\n );\n }\n\n return parsed.version;\n};\n\nconst probeNodeVersion = (path: string): string => {\n try {\n const output = execFileSync(path, [\"--version\"], {\n encoding: \"utf8\",\n env: { ...process.env, NODE_OPTIONS: \"\" },\n maxBuffer: VERSION_PROBE_MAX_BUFFER,\n timeout: VERSION_PROBE_TIMEOUT_MS,\n });\n\n return supportedNodeVersion(output, path);\n } catch (error) {\n if (error instanceof Error && error.message.startsWith(\"Cannot bundle Node.js\")) {\n throw error;\n }\n\n throw new Error(`Cannot determine the Node.js version from ${path}`, { cause: error });\n }\n};\n\nconst assertExpectedVersion = (configured: string | undefined, actual: string, source: NodeSource): string => {\n if (configured === undefined) {\n return actual;\n }\n\n const expected = parseNodeVersion(configured, `deploy.node.source: \"${source}\"`).version;\n\n if (expected !== actual) {\n throw new Error(\n `The Node.js runtime from deploy.node.source \"${source}\" is ${actual}, not the configured ${expected}`,\n );\n }\n\n return actual;\n};\n\nconst sourcePathFor = (settings: DeploySettings): string => {\n const node = settings.deploy.node ?? {};\n const source = nodeSourceFor(settings);\n\n if (source === \"host\") {\n return process.execPath;\n }\n\n if (node.path === undefined) {\n throw new Error('Cannot resolve the Node.js runtime: `deploy.node.source: \"path\"` needs `deploy.node.path`');\n }\n\n return resolve(settings.paths.root, node.path);\n};\n\nconst assertPortableRuntimeSource = (settings: DeploySettings): void => {\n const source = nodeSourceFor(settings);\n\n if (source === \"download\") {\n return;\n }\n\n const sourcePath = sourcePathFor(settings);\n const elf = existsSync(sourcePath) ? readOptionalElfInfo(sourcePath) : null;\n\n if (elf !== null) {\n assertPortableNode(elf, source);\n }\n};\n\nconst resolveNodeVersion = (settings: DeploySettings): string => {\n const node = settings.deploy.node ?? {};\n const source = nodeSourceFor(settings);\n\n if (source === \"download\") {\n return supportedNodeVersion(node.version ?? MINIMUM_NODE_VERSION, 'deploy.node.source: \"download\"');\n }\n\n const actual = source === \"host\"\n ? supportedNodeVersion(process.versions.node, 'deploy.node.source: \"host\"')\n : probeNodeVersion(sourcePathFor(settings));\n\n return assertExpectedVersion(node.version, actual, source);\n};\n\nconst didStripBinary = (path: string): boolean => {\n if (tryResolveExecutable(\"strip\") === undefined) {\n return false;\n }\n\n runCliTool({ tool: \"strip\", args: [\"--strip-unneeded\", path], target: \"the bundled Node.js\" });\n\n return true;\n};\n\nconst megabytes = (path: string): string => (statSync(path).size / BYTES_PER_MIB).toFixed(1);\n\nconst stageNode = (settings: DeploySettings, sourcePath: string): string => {\n mkdirSync(settings.paths.runtime, { recursive: true });\n const staged = join(settings.paths.runtime, NODE_FILENAME);\n copyFileSync(sourcePath, staged);\n chmodSync(staged, EXECUTABLE_MODE);\n\n return staged;\n};\n\nconst stageDownloadedNode = async (settings: DeploySettings, version: string): Promise<StagedRuntime> => {\n const downloaded = await downloadNode(version, settings.arch.node, settings.paths.runtime);\n chmodSync(downloaded.path, EXECUTABLE_MODE);\n\n return downloaded;\n};\n\nconst stageFromSource = async (\n settings: DeploySettings,\n version: string,\n source: NodeSource,\n): Promise<StagedRuntime> => {\n if (source === \"download\") {\n return stageDownloadedNode(settings, version);\n }\n\n const sourcePath = sourcePathFor(settings);\n\n return { path: stageNode(settings, sourcePath), licenseFile: licenseBesideNode(sourcePath) };\n};\n\ntype DeployNodeConfig = NonNullable<DeployConfig[\"node\"]>;\n\nconst shouldStripRuntime = (settings: DeploySettings, node: DeployNodeConfig, elf: ElfInfo): boolean => {\n if (node.shouldStrip === false) {\n return false;\n }\n\n if (elf.machine === elfMachineFor(hostArchName())) {\n return true;\n }\n\n warn(\n `Skipping \\`strip\\` on the bundled Node.js: it was built for ${settings.arch.node} and \\`strip\\` reads ` +\n `only ${hostArchName()}. The ${settings.arch.node} packages carry an unstripped runtime.`,\n );\n\n return false;\n};\n\nconst resolveNodeRuntime = async (settings: DeploySettings): Promise<NodeRuntime> => {\n const node = settings.deploy.node ?? {};\n const source = nodeSourceFor(settings);\n const version = resolveNodeVersion(settings);\n const staged = await stageFromSource(settings, version, source);\n const elf = readElfInfo(staged.path);\n assertPortableNode(elf, source);\n const isStripped = shouldStripRuntime(settings, node, elf) && didStripBinary(staged.path);\n const glibcMinimum = elf.glibcMinimum ?? \"unknown\";\n info(`Bundled Node.js v${version} (${megabytes(staged.path)} MiB, runtime glibc >= ${glibcMinimum})`);\n\n return { ...staged, version, glibcMinimum: elf.glibcMinimum, isStripped };\n};\n\nexport { assertPortableRuntimeSource, resolveNodeRuntime, resolveNodeVersion, sourcePathFor };\n"]}
@@ -0,0 +1,5 @@
1
+ declare const PACKAGED_SONAMES: readonly ["libatomic.so.1", "libgcc_s.so.1", "libstdc++.so.6"];
2
+ type PackagedSoname = (typeof PACKAGED_SONAMES)[number];
3
+ declare const RUNTIME_SONAMES: Set<string>;
4
+ export { PACKAGED_SONAMES, type PackagedSoname, RUNTIME_SONAMES };
5
+ //# sourceMappingURL=sonames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sonames.d.ts","sourceRoot":"","sources":["../../../src/deploy/node-runtime/sonames.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,gBAAgB,gEAAiE,CAAC;AAExF,KAAK,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,QAAA,MAAM,eAAe,EAAE,GAAG,CAAC,MAAM,CAAoD,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,13 @@
1
+ const GLIBC_SONAMES = [
2
+ "ld-linux-aarch64.so.1",
3
+ "ld-linux-x86-64.so.2",
4
+ "libc.so.6",
5
+ "libdl.so.2",
6
+ "libm.so.6",
7
+ "libpthread.so.0",
8
+ "librt.so.1",
9
+ ];
10
+ const PACKAGED_SONAMES = ["libatomic.so.1", "libgcc_s.so.1", "libstdc++.so.6"];
11
+ const RUNTIME_SONAMES = new Set([...GLIBC_SONAMES, ...PACKAGED_SONAMES]);
12
+ export { PACKAGED_SONAMES, RUNTIME_SONAMES };
13
+ //# sourceMappingURL=sonames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sonames.js","sourceRoot":"","sources":["../../../src/deploy/node-runtime/sonames.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG;IAClB,uBAAuB;IACvB,sBAAsB;IACtB,WAAW;IACX,YAAY;IACZ,WAAW;IACX,iBAAiB;IACjB,YAAY;CACN,CAAC;AAEX,MAAM,gBAAgB,GAAG,CAAC,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,CAAU,CAAC;AAIxF,MAAM,eAAe,GAAgB,IAAI,GAAG,CAAC,CAAC,GAAG,aAAa,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAuB,eAAe,EAAE,CAAC","sourcesContent":["const GLIBC_SONAMES = [\n \"ld-linux-aarch64.so.1\",\n \"ld-linux-x86-64.so.2\",\n \"libc.so.6\",\n \"libdl.so.2\",\n \"libm.so.6\",\n \"libpthread.so.0\",\n \"librt.so.1\",\n] as const;\n\nconst PACKAGED_SONAMES = [\"libatomic.so.1\", \"libgcc_s.so.1\", \"libstdc++.so.6\"] as const;\n\ntype PackagedSoname = (typeof PACKAGED_SONAMES)[number];\n\nconst RUNTIME_SONAMES: Set<string> = new Set([...GLIBC_SONAMES, ...PACKAGED_SONAMES]);\n\nexport { PACKAGED_SONAMES, type PackagedSoname, RUNTIME_SONAMES };\n"]}
@@ -1,5 +1,5 @@
1
1
  import { warn } from "@gtkx/utils";
2
- import { sourcePathFor } from "../node-runtime/index.js";
2
+ import { resolveNodeVersion, sourcePathFor } from "../node-runtime/index.js";
3
3
  import { licenseBesideNode } from "../node-runtime/license.js";
4
4
  import { NODE_FILENAME } from "../payload/launcher.js";
5
5
  import { nodeLicenseDestination } from "../payload/stage.js";
@@ -22,7 +22,7 @@ const MISSING_LICENSE = "Cannot read a license file for the Node.js runtime this
22
22
  'next to the binary, so point `deploy.node.path` at one, or use `deploy.node.source: "download"`, and ' +
23
23
  "the notices carry it.";
24
24
  const isSourceMode = (settings) => settings.deploy.flatpak?.mode === "source";
25
- const versionFor = (settings, node) => node?.version ?? settings.deploy.node?.version ?? process.versions.node;
25
+ const versionFor = (settings, node) => node?.version ?? resolveNodeVersion(settings);
26
26
  const licenseFileFor = (settings, node) => {
27
27
  if (node !== null) {
28
28
  return node.licenseFile;
@@ -1 +1 @@
1
- {"version":3,"file":"node-runtime.js","sourceRoot":"","sources":["../../../src/deploy/notices/node-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5D,MAAM,KAAK,GAAG,iBAAiB,CAAC;AAChC,MAAM,YAAY,GAAG,SAAS,CAAC;AAC/B,MAAM,UAAU,GAAG,gCAAgC,CAAC;AACpD,MAAM,WAAW,GAAG,kDAAkD,CAAC;AAEvE,MAAM,OAAO,GAAG;IACZ,oGAA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gBACrB,MAAM,EAAE,UAAU;gBAClB,SAAS,EAAE,cAAc,CAAC,IAAI,CAAC;gBAC/B,IAAI;aACP,CAAC;KACL,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { warn } from \"@gtkx/utils\";\nimport type { DeploySettings, NodeRuntime, NoticeSection } from \"../types.js\";\nimport { sourcePathFor } from \"../node-runtime/index.js\";\nimport { licenseBesideNode } from \"../node-runtime/license.js\";\nimport { NODE_FILENAME } from \"../payload/launcher.js\";\nimport { nodeLicenseDestination } from \"../payload/stage.js\";\nimport { copyrightLines, readLicenseText } from \"./text.js\";\n\nconst TITLE = \"Node.js runtime\";\nconst LICENSE_NAME = \"Node.js\";\nconst SOURCE_URL = \"https://github.com/nodejs/node\";\nconst LICENSE_URL = \"https://github.com/nodejs/node/blob/main/LICENSE\";\n\nconst SUMMARY = [\n \"This package carries the Node.js runtime that runs the application. Its license is the one Node.js\",\n \"publishes as a single document, covering Node.js itself under the MIT terms together with the\",\n \"components it embeds under theirs, among them V8, OpenSSL, ICU, libuv, zlib, brotli and llhttp.\",\n];\n\nconst CARRIED_SUMMARY = [\"The notice below is that document, reproduced from the release this package bundles.\"];\n\nconst MISSING_SUMMARY = [\n \"This run had no copy of that document at hand, so the notice below names it and it is published at\",\n `${LICENSE_URL}.`,\n];\n\nconst MISSING_LICENSE =\n \"Cannot read a license file for the Node.js runtime this deploy bundles. An official release unpacks it \" +\n 'next to the binary, so point `deploy.node.path` at one, or use `deploy.node.source: \"download\"`, and ' +\n \"the notices carry it.\";\n\nconst isSourceMode = (settings: DeploySettings): boolean => settings.deploy.flatpak?.mode === \"source\";\n\nconst versionFor = (settings: DeploySettings, node: NodeRuntime | null): string =>\n node?.version ?? settings.deploy.node?.version ?? process.versions.node;\n\nconst licenseFileFor = (settings: DeploySettings, node: NodeRuntime | null): string | null => {\n if (node !== null) {\n return node.licenseFile;\n }\n\n if ((settings.deploy.node?.source ?? \"download\") === \"download\") {\n return null;\n }\n\n return licenseBesideNode(sourcePathFor(settings));\n};\n\nconst textFor = (settings: DeploySettings, node: NodeRuntime | null): string | null => {\n const licenseFile = licenseFileFor(settings, node);\n\n return licenseFile === null ? null : readLicenseText(licenseFile);\n};\n\nconst extensionSummary = (settings: DeploySettings): string[] => [\n \"The flatpak built from source copies its runtime out of the Node SDK extension in the build sandbox.\",\n `That build installs the license file the extension ships as ${nodeLicenseDestination(settings)}, and`,\n \"installs nothing when the extension ships none, so read the text at the address above if that file is\",\n \"not in the package you received.\",\n];\n\nconst carriedSummary = (settings: DeploySettings, text: string | null): string[] => {\n if (isSourceMode(settings)) {\n return [...MISSING_SUMMARY, ...extensionSummary(settings)];\n }\n\n return text === null ? MISSING_SUMMARY : CARRIED_SUMMARY;\n};\n\nconst summaryFor = (settings: DeploySettings, text: string | null): string[] => [\n ...SUMMARY,\n ...carriedSummary(settings, text),\n];\n\nconst warnMissingLicense = (node: NodeRuntime | null, text: string | null): void => {\n if (node === null || text !== null) {\n return;\n }\n\n warn(MISSING_LICENSE);\n};\n\nconst nodeNotices = (settings: DeploySettings, node: NodeRuntime | null): NoticeSection => {\n const text = textFor(settings, node);\n warnMissingLicense(node, text);\n\n return {\n title: TITLE,\n files: [`lib/${settings.binaryName}/${NODE_FILENAME}`],\n summary: summaryFor(settings, text),\n notices: [{\n subject: `Node.js ${versionFor(settings, node)}`,\n license: LICENSE_NAME,\n source: SOURCE_URL,\n copyright: copyrightLines(text),\n text,\n }],\n };\n};\n\nexport { nodeNotices };\n"]}
1
+ {"version":3,"file":"node-runtime.js","sourceRoot":"","sources":["../../../src/deploy/notices/node-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAA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AAO;QACH,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,CAAC,OAAO,QAAQ,CAAC,UAAU,IAAI,aAAa,EAAE,CAAC;QACtD,OAAO,EAAE,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC;QACnC,OAAO,EAAE,CAAC;gBACN,OAAO,EAAE,WAAW,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE;gBAChD,OAAO,EAAE,YAAY;gBACrB,MAAM,EAAE,UAAU;gBAClB,SAAS,EAAE,cAAc,CAAC,IAAI,CAAC;gBAC/B,IAAI;aACP,CAAC;KACL,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { warn } from \"@gtkx/utils\";\nimport type { DeploySettings, NodeRuntime, NoticeSection } from \"../types.js\";\nimport { resolveNodeVersion, sourcePathFor } from \"../node-runtime/index.js\";\nimport { licenseBesideNode } from \"../node-runtime/license.js\";\nimport { NODE_FILENAME } from \"../payload/launcher.js\";\nimport { nodeLicenseDestination } from \"../payload/stage.js\";\nimport { copyrightLines, readLicenseText } from \"./text.js\";\n\nconst TITLE = \"Node.js runtime\";\nconst LICENSE_NAME = \"Node.js\";\nconst SOURCE_URL = \"https://github.com/nodejs/node\";\nconst LICENSE_URL = \"https://github.com/nodejs/node/blob/main/LICENSE\";\n\nconst SUMMARY = [\n \"This package carries the Node.js runtime that runs the application. Its license is the one Node.js\",\n \"publishes as a single document, covering Node.js itself under the MIT terms together with the\",\n \"components it embeds under theirs, among them V8, OpenSSL, ICU, libuv, zlib, brotli and llhttp.\",\n];\n\nconst CARRIED_SUMMARY = [\"The notice below is that document, reproduced from the release this package bundles.\"];\n\nconst MISSING_SUMMARY = [\n \"This run had no copy of that document at hand, so the notice below names it and it is published at\",\n `${LICENSE_URL}.`,\n];\n\nconst MISSING_LICENSE =\n \"Cannot read a license file for the Node.js runtime this deploy bundles. An official release unpacks it \" +\n 'next to the binary, so point `deploy.node.path` at one, or use `deploy.node.source: \"download\"`, and ' +\n \"the notices carry it.\";\n\nconst isSourceMode = (settings: DeploySettings): boolean => settings.deploy.flatpak?.mode === \"source\";\n\nconst versionFor = (settings: DeploySettings, node: NodeRuntime | null): string =>\n node?.version ?? resolveNodeVersion(settings);\n\nconst licenseFileFor = (settings: DeploySettings, node: NodeRuntime | null): string | null => {\n if (node !== null) {\n return node.licenseFile;\n }\n\n if ((settings.deploy.node?.source ?? \"download\") === \"download\") {\n return null;\n }\n\n return licenseBesideNode(sourcePathFor(settings));\n};\n\nconst textFor = (settings: DeploySettings, node: NodeRuntime | null): string | null => {\n const licenseFile = licenseFileFor(settings, node);\n\n return licenseFile === null ? null : readLicenseText(licenseFile);\n};\n\nconst extensionSummary = (settings: DeploySettings): string[] => [\n \"The flatpak built from source copies its runtime out of the Node SDK extension in the build sandbox.\",\n `That build installs the license file the extension ships as ${nodeLicenseDestination(settings)}, and`,\n \"installs nothing when the extension ships none, so read the text at the address above if that file is\",\n \"not in the package you received.\",\n];\n\nconst carriedSummary = (settings: DeploySettings, text: string | null): string[] => {\n if (isSourceMode(settings)) {\n return [...MISSING_SUMMARY, ...extensionSummary(settings)];\n }\n\n return text === null ? MISSING_SUMMARY : CARRIED_SUMMARY;\n};\n\nconst summaryFor = (settings: DeploySettings, text: string | null): string[] => [\n ...SUMMARY,\n ...carriedSummary(settings, text),\n];\n\nconst warnMissingLicense = (node: NodeRuntime | null, text: string | null): void => {\n if (node === null || text !== null) {\n return;\n }\n\n warn(MISSING_LICENSE);\n};\n\nconst nodeNotices = (settings: DeploySettings, node: NodeRuntime | null): NoticeSection => {\n const text = textFor(settings, node);\n warnMissingLicense(node, text);\n\n return {\n title: TITLE,\n files: [`lib/${settings.binaryName}/${NODE_FILENAME}`],\n summary: summaryFor(settings, text),\n notices: [{\n subject: `Node.js ${versionFor(settings, node)}`,\n license: LICENSE_NAME,\n source: SOURCE_URL,\n copyright: copyrightLines(text),\n text,\n }],\n };\n};\n\nexport { nodeNotices };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/launcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,QAAA,MAAM,aAAa,SAAS,CAAC;AAQ7B,QAAA,MAAM,cAAc,GAAI,UAAU,cAAc,KAAG,MAelD,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/launcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,QAAA,MAAM,aAAa,SAAS,CAAC;AA0B7B,QAAA,MAAM,cAAc,GAAI,UAAU,cAAc,KAAG,MAgBlD,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC"}
@@ -1,10 +1,22 @@
1
1
  import { BUNDLE_FILENAME } from "../../vite-plugins/esm-extension.js";
2
2
  const NODE_FILENAME = "node";
3
+ const SHELL_SINGLE_QUOTE = "'";
4
+ const SHELL_SINGLE_QUOTE_ESCAPE = "'\"'\"'";
3
5
  const compileCacheLines = (binaryName) => [
4
6
  "cache_home=${XDG_CACHE_HOME:-${HOME:-/tmp}/.cache}",
5
7
  `NODE_COMPILE_CACHE="$cache_home/${binaryName}/node"`,
6
8
  "export NODE_COMPILE_CACHE",
7
9
  ];
10
+ const shellQuote = (value) => SHELL_SINGLE_QUOTE + value.split(SHELL_SINGLE_QUOTE).join(SHELL_SINGLE_QUOTE_ESCAPE) + SHELL_SINGLE_QUOTE;
11
+ const launcherEnvLines = (settings) => Object.entries(settings.deploy.launcherEnv ?? {})
12
+ .toSorted(([left], [right]) => left.localeCompare(right))
13
+ .map(([name, value]) => `export ${name}=${shellQuote(value)}`);
14
+ const launcherCommand = (settings, libDir) => [
15
+ `"${libDir}/${NODE_FILENAME}"`,
16
+ ...(settings.deploy.nodeFlags ?? []).map((flag) => shellQuote(flag)),
17
+ `"${libDir}/${BUNDLE_FILENAME}"`,
18
+ '"$@"',
19
+ ].join(" ");
8
20
  const renderLauncher = (settings) => {
9
21
  const libDir = `$prefix/lib/${settings.binaryName}`;
10
22
  const shouldUseCompileCache = settings.deploy.node?.shouldUseCompileCache !== false;
@@ -16,7 +28,8 @@ const renderLauncher = (settings) => {
16
28
  'GTKX_LOCALE_DIR="$prefix/share/locale"',
17
29
  "export GTKX_LOCALE_DIR",
18
30
  ...(shouldUseCompileCache ? compileCacheLines(settings.binaryName) : []),
19
- `exec "${libDir}/${NODE_FILENAME}" "${libDir}/${BUNDLE_FILENAME}" "$@"`,
31
+ ...launcherEnvLines(settings),
32
+ `exec ${launcherCommand(settings, libDir)}`,
20
33
  "",
21
34
  ].join("\n");
22
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../../src/deploy/payload/launcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAY,EAAE,CAAC;IACxD,oDAAoD;IACpD,mCAAmC,UAAU,QAAQ;IACrD,2BAA2B;CAC9B,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,QAAwB,EAAU,EAAE;IACxD,MAAM,MAAM,GAAG,eAAe,QAAQ,CAAC,UAAU,EAAE,CAAC;IACpD,MAAM,qBAAqB,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,qBAAqB,KAAK,KAAK,CAAC;IAEpF,OAAO;QACH,WAAW;QACX,QAAQ;QACR,0BAA0B;QAC1B,wCAAwC;QACxC,wCAAwC;QACxC,wBAAwB;QACxB,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,SAAS,MAAM,IAAI,aAAa,MAAM,MAAM,IAAI,eAAe,QAAQ;QACvE,EAAE;KACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type { DeploySettings } from \"../types.js\";\nimport { BUNDLE_FILENAME } from \"../../vite-plugins/esm-extension.js\";\n\nconst NODE_FILENAME = \"node\";\n\nconst compileCacheLines = (binaryName: string): string[] => [\n \"cache_home=${XDG_CACHE_HOME:-${HOME:-/tmp}/.cache}\",\n `NODE_COMPILE_CACHE=\"$cache_home/${binaryName}/node\"`,\n \"export NODE_COMPILE_CACHE\",\n];\n\nconst renderLauncher = (settings: DeploySettings): string => {\n const libDir = `$prefix/lib/${settings.binaryName}`;\n const shouldUseCompileCache = settings.deploy.node?.shouldUseCompileCache !== false;\n\n return [\n \"#!/bin/sh\",\n \"set -e\",\n 'self=$(readlink -f \"$0\")',\n 'prefix=$(dirname \"$(dirname \"$self\")\")',\n 'GTKX_LOCALE_DIR=\"$prefix/share/locale\"',\n \"export GTKX_LOCALE_DIR\",\n ...(shouldUseCompileCache ? compileCacheLines(settings.binaryName) : []),\n `exec \"${libDir}/${NODE_FILENAME}\" \"${libDir}/${BUNDLE_FILENAME}\" \"$@\"`,\n \"\",\n ].join(\"\\n\");\n};\n\nexport { NODE_FILENAME, renderLauncher };\n"]}
1
+ {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../../src/deploy/payload/launcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,MAAM,aAAa,GAAG,MAAM,CAAC;AAC7B,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,yBAAyB,GAAG,SAAS,CAAC;AAE5C,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAY,EAAE,CAAC;IACxD,oDAAoD;IACpD,mCAAmC,UAAU,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AAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,GAAG,gBAAgB,CAAC,QAAQ,CAAC;QAC7B,QAAQ,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE;QAC3C,EAAE;KACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type { DeploySettings } from \"../types.js\";\nimport { BUNDLE_FILENAME } from \"../../vite-plugins/esm-extension.js\";\n\nconst NODE_FILENAME = \"node\";\nconst SHELL_SINGLE_QUOTE = \"'\";\nconst SHELL_SINGLE_QUOTE_ESCAPE = \"'\\\"'\\\"'\";\n\nconst compileCacheLines = (binaryName: string): string[] => [\n \"cache_home=${XDG_CACHE_HOME:-${HOME:-/tmp}/.cache}\",\n `NODE_COMPILE_CACHE=\"$cache_home/${binaryName}/node\"`,\n \"export NODE_COMPILE_CACHE\",\n];\n\nconst shellQuote = (value: string): string =>\n SHELL_SINGLE_QUOTE + value.split(SHELL_SINGLE_QUOTE).join(SHELL_SINGLE_QUOTE_ESCAPE) + SHELL_SINGLE_QUOTE;\n\nconst launcherEnvLines = (settings: DeploySettings): string[] =>\n Object.entries(settings.deploy.launcherEnv ?? {})\n .toSorted(([left], [right]) => left.localeCompare(right))\n .map(([name, value]) => `export ${name}=${shellQuote(value)}`);\n\nconst launcherCommand = (settings: DeploySettings, libDir: string): string =>\n [\n `\"${libDir}/${NODE_FILENAME}\"`,\n ...(settings.deploy.nodeFlags ?? []).map((flag) => shellQuote(flag)),\n `\"${libDir}/${BUNDLE_FILENAME}\"`,\n '\"$@\"',\n ].join(\" \");\n\nconst renderLauncher = (settings: DeploySettings): string => {\n const libDir = `$prefix/lib/${settings.binaryName}`;\n const shouldUseCompileCache = settings.deploy.node?.shouldUseCompileCache !== false;\n\n return [\n \"#!/bin/sh\",\n \"set -e\",\n 'self=$(readlink -f \"$0\")',\n 'prefix=$(dirname \"$(dirname \"$self\")\")',\n 'GTKX_LOCALE_DIR=\"$prefix/share/locale\"',\n \"export GTKX_LOCALE_DIR\",\n ...(shouldUseCompileCache ? compileCacheLines(settings.binaryName) : []),\n ...launcherEnvLines(settings),\n `exec ${launcherCommand(settings, libDir)}`,\n \"\",\n ].join(\"\\n\");\n};\n\nexport { NODE_FILENAME, renderLauncher };\n"]}
@@ -2,6 +2,7 @@ import type { DeploySettings, DeployTargetName, NodeRuntime, NoticeSection, Stag
2
2
  type StageRequest = {
3
3
  settings: DeploySettings;
4
4
  node: NodeRuntime | null;
5
+ addon: string | null;
5
6
  metadata: StagedMetadata;
6
7
  };
7
8
  type StagedMetadata = {
@@ -13,7 +14,7 @@ declare const NOTICES_FILENAME = "THIRD-PARTY-NOTICES";
13
14
  declare const licenseDestination: (settings: DeploySettings) => string;
14
15
  declare const noticesDestination: (settings: DeploySettings) => string;
15
16
  declare const nodeLicenseDestination: (settings: DeploySettings) => string;
16
- declare const stagePayload: ({ settings, node, metadata }: StageRequest) => StagedFile[];
17
+ declare const stagePayload: ({ settings, node, addon, metadata }: StageRequest) => StagedFile[];
17
18
  declare const stageOverlays: (settings: DeploySettings, notices: NoticeSection[], metadata: StagedMetadata) => Record<DeployTargetName, StagedFile[]>;
18
19
  export { licenseDestination, nodeLicenseDestination, NOTICES_FILENAME, noticesDestination, type StagedMetadata, stageOverlays, stagePayload, };
19
20
  //# sourceMappingURL=stage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/stage.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAa5G,KAAK,YAAY,GAAG;IAChB,QAAQ,EAAE,cAAc,CAAC;IACzB,IAAI,EAAE,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