@gtkx/cli 1.6.0 → 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 (578) hide show
  1. package/README.md +47 -44
  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 +49 -16
  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 +2 -7
  21. package/dist/codegen/reference.js.map +1 -1
  22. package/dist/codegen/report.d.ts.map +1 -1
  23. package/dist/codegen/report.js +5 -16
  24. package/dist/codegen/report.js.map +1 -1
  25. package/dist/codegen/run-codegen.d.ts +9 -8
  26. package/dist/codegen/run-codegen.d.ts.map +1 -1
  27. package/dist/codegen/run-codegen.js +60 -113
  28. package/dist/codegen/run-codegen.js.map +1 -1
  29. package/dist/codegen/store-resolver.d.ts +3 -2
  30. package/dist/codegen/store-resolver.d.ts.map +1 -1
  31. package/dist/codegen/store-resolver.js +14 -20
  32. package/dist/codegen/store-resolver.js.map +1 -1
  33. package/dist/commands/build.d.ts +5 -0
  34. package/dist/commands/build.d.ts.map +1 -1
  35. package/dist/commands/build.js +83 -10
  36. package/dist/commands/build.js.map +1 -1
  37. package/dist/commands/cleanup.d.ts +9 -0
  38. package/dist/commands/cleanup.d.ts.map +1 -0
  39. package/dist/commands/cleanup.js +42 -0
  40. package/dist/commands/cleanup.js.map +1 -0
  41. package/dist/commands/codegen.d.ts +1 -0
  42. package/dist/commands/codegen.d.ts.map +1 -1
  43. package/dist/commands/codegen.js +6 -5
  44. package/dist/commands/codegen.js.map +1 -1
  45. package/dist/commands/deploy.d.ts +5 -0
  46. package/dist/commands/deploy.d.ts.map +1 -1
  47. package/dist/commands/deploy.js +10 -2
  48. package/dist/commands/deploy.js.map +1 -1
  49. package/dist/commands/dev.d.ts +9 -0
  50. package/dist/commands/dev.d.ts.map +1 -1
  51. package/dist/commands/dev.js +31 -4
  52. package/dist/commands/dev.js.map +1 -1
  53. package/dist/commands/docs.d.ts.map +1 -1
  54. package/dist/commands/docs.js +6 -15
  55. package/dist/commands/docs.js.map +1 -1
  56. package/dist/deploy/depends.d.ts.map +1 -1
  57. package/dist/deploy/depends.js +24 -2
  58. package/dist/deploy/depends.js.map +1 -1
  59. package/dist/deploy/download.d.ts +7 -3
  60. package/dist/deploy/download.d.ts.map +1 -1
  61. package/dist/deploy/download.js +19 -20
  62. package/dist/deploy/download.js.map +1 -1
  63. package/dist/deploy/freedesktop/copyright.d.ts.map +1 -1
  64. package/dist/deploy/freedesktop/copyright.js +2 -13
  65. package/dist/deploy/freedesktop/copyright.js.map +1 -1
  66. package/dist/deploy/freedesktop/metainfo.d.ts.map +1 -1
  67. package/dist/deploy/freedesktop/metainfo.js +41 -2
  68. package/dist/deploy/freedesktop/metainfo.js.map +1 -1
  69. package/dist/deploy/freedesktop/validate.d.ts.map +1 -1
  70. package/dist/deploy/freedesktop/validate.js +58 -14
  71. package/dist/deploy/freedesktop/validate.js.map +1 -1
  72. package/dist/deploy/freedesktop/xml.d.ts.map +1 -1
  73. package/dist/deploy/freedesktop/xml.js +21 -25
  74. package/dist/deploy/freedesktop/xml.js.map +1 -1
  75. package/dist/deploy/native-addon.d.ts +5 -0
  76. package/dist/deploy/native-addon.d.ts.map +1 -0
  77. package/dist/deploy/native-addon.js +134 -0
  78. package/dist/deploy/native-addon.js.map +1 -0
  79. package/dist/deploy/nfpm/config.d.ts +3 -2
  80. package/dist/deploy/nfpm/config.d.ts.map +1 -1
  81. package/dist/deploy/nfpm/config.js +7 -4
  82. package/dist/deploy/nfpm/config.js.map +1 -1
  83. package/dist/deploy/nfpm/contents.d.ts.map +1 -1
  84. package/dist/deploy/nfpm/contents.js +8 -0
  85. package/dist/deploy/nfpm/contents.js.map +1 -1
  86. package/dist/deploy/node-runtime/download.js +2 -2
  87. package/dist/deploy/node-runtime/download.js.map +1 -1
  88. package/dist/deploy/node-runtime/elf.d.ts +4 -1
  89. package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
  90. package/dist/deploy/node-runtime/elf.js +34 -5
  91. package/dist/deploy/node-runtime/elf.js.map +1 -1
  92. package/dist/deploy/node-runtime/guard.d.ts.map +1 -1
  93. package/dist/deploy/node-runtime/guard.js +7 -14
  94. package/dist/deploy/node-runtime/guard.js.map +1 -1
  95. package/dist/deploy/node-runtime/index.d.ts +3 -1
  96. package/dist/deploy/node-runtime/index.d.ts.map +1 -1
  97. package/dist/deploy/node-runtime/index.js +103 -10
  98. package/dist/deploy/node-runtime/index.js.map +1 -1
  99. package/dist/deploy/node-runtime/license.d.ts.map +1 -1
  100. package/dist/deploy/node-runtime/license.js +2 -9
  101. package/dist/deploy/node-runtime/license.js.map +1 -1
  102. package/dist/deploy/node-runtime/sonames.d.ts +5 -0
  103. package/dist/deploy/node-runtime/sonames.d.ts.map +1 -0
  104. package/dist/deploy/node-runtime/sonames.js +13 -0
  105. package/dist/deploy/node-runtime/sonames.js.map +1 -0
  106. package/dist/deploy/notices/node-runtime.js +2 -2
  107. package/dist/deploy/notices/node-runtime.js.map +1 -1
  108. package/dist/deploy/notices/packages.d.ts.map +1 -1
  109. package/dist/deploy/notices/packages.js +3 -10
  110. package/dist/deploy/notices/packages.js.map +1 -1
  111. package/dist/deploy/payload/copy-tree.d.ts.map +1 -1
  112. package/dist/deploy/payload/copy-tree.js +3 -3
  113. package/dist/deploy/payload/copy-tree.js.map +1 -1
  114. package/dist/deploy/payload/launcher.d.ts.map +1 -1
  115. package/dist/deploy/payload/launcher.js +14 -1
  116. package/dist/deploy/payload/launcher.js.map +1 -1
  117. package/dist/deploy/payload/stage.d.ts +2 -1
  118. package/dist/deploy/payload/stage.d.ts.map +1 -1
  119. package/dist/deploy/payload/stage.js +47 -8
  120. package/dist/deploy/payload/stage.js.map +1 -1
  121. package/dist/deploy/run-deploy.d.ts +2 -0
  122. package/dist/deploy/run-deploy.d.ts.map +1 -1
  123. package/dist/deploy/run-deploy.js +197 -52
  124. package/dist/deploy/run-deploy.js.map +1 -1
  125. package/dist/deploy/settings/arch.d.ts +9 -3
  126. package/dist/deploy/settings/arch.d.ts.map +1 -1
  127. package/dist/deploy/settings/arch.js +27 -6
  128. package/dist/deploy/settings/arch.js.map +1 -1
  129. package/dist/deploy/settings/build-manifest.d.ts +6 -1
  130. package/dist/deploy/settings/build-manifest.d.ts.map +1 -1
  131. package/dist/deploy/settings/build-manifest.js +17 -17
  132. package/dist/deploy/settings/build-manifest.js.map +1 -1
  133. package/dist/deploy/settings/extra-files.d.ts +1 -1
  134. package/dist/deploy/settings/extra-files.d.ts.map +1 -1
  135. package/dist/deploy/settings/extra-files.js +25 -3
  136. package/dist/deploy/settings/extra-files.js.map +1 -1
  137. package/dist/deploy/settings/index.d.ts +3 -1
  138. package/dist/deploy/settings/index.d.ts.map +1 -1
  139. package/dist/deploy/settings/index.js +4 -2
  140. package/dist/deploy/settings/index.js.map +1 -1
  141. package/dist/deploy/settings/libraries.d.ts.map +1 -1
  142. package/dist/deploy/settings/libraries.js +3 -19
  143. package/dist/deploy/settings/libraries.js.map +1 -1
  144. package/dist/deploy/settings/paths.d.ts +4 -3
  145. package/dist/deploy/settings/paths.d.ts.map +1 -1
  146. package/dist/deploy/settings/paths.js +118 -19
  147. package/dist/deploy/settings/paths.js.map +1 -1
  148. package/dist/deploy/settings/screenshots.d.ts.map +1 -1
  149. package/dist/deploy/settings/screenshots.js +6 -31
  150. package/dist/deploy/settings/screenshots.js.map +1 -1
  151. package/dist/deploy/targets/appimage.d.ts.map +1 -1
  152. package/dist/deploy/targets/appimage.js +1 -0
  153. package/dist/deploy/targets/appimage.js.map +1 -1
  154. package/dist/deploy/targets/flatpak-pnpm.js +4 -4
  155. package/dist/deploy/targets/flatpak-pnpm.js.map +1 -1
  156. package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
  157. package/dist/deploy/targets/flatpak-source.js +17 -6
  158. package/dist/deploy/targets/flatpak-source.js.map +1 -1
  159. package/dist/deploy/targets/flatpak-sources.js +1 -1
  160. package/dist/deploy/targets/flatpak-sources.js.map +1 -1
  161. package/dist/deploy/targets/flatpak.d.ts.map +1 -1
  162. package/dist/deploy/targets/flatpak.js +1 -0
  163. package/dist/deploy/targets/flatpak.js.map +1 -1
  164. package/dist/deploy/targets/nfpm-target.d.ts.map +1 -1
  165. package/dist/deploy/targets/nfpm-target.js +13 -7
  166. package/dist/deploy/targets/nfpm-target.js.map +1 -1
  167. package/dist/deploy/types.d.ts +5 -2
  168. package/dist/deploy/types.d.ts.map +1 -1
  169. package/dist/deploy/types.js.map +1 -1
  170. package/dist/deploy/vendored/appimagetool.js +2 -2
  171. package/dist/deploy/vendored/appimagetool.js.map +1 -1
  172. package/dist/deploy/vendored/nfpm.js +1 -1
  173. package/dist/deploy/vendored/nfpm.js.map +1 -1
  174. package/dist/dev/catalog-writes.d.ts +8 -0
  175. package/dist/dev/catalog-writes.d.ts.map +1 -0
  176. package/dist/dev/catalog-writes.js +26 -0
  177. package/dist/dev/catalog-writes.js.map +1 -0
  178. package/dist/dev/entry-env.d.ts +2 -1
  179. package/dist/dev/entry-env.d.ts.map +1 -1
  180. package/dist/dev/entry-env.js +2 -1
  181. package/dist/dev/entry-env.js.map +1 -1
  182. package/dist/dev/font-dir.d.ts +3 -0
  183. package/dist/dev/font-dir.d.ts.map +1 -0
  184. package/dist/dev/font-dir.js +9 -0
  185. package/dist/dev/font-dir.js.map +1 -0
  186. package/dist/dev/headless.d.ts +3 -0
  187. package/dist/dev/headless.d.ts.map +1 -0
  188. package/dist/dev/headless.js +35 -0
  189. package/dist/dev/headless.js.map +1 -0
  190. package/dist/dev/runner-deps.d.ts +1 -1
  191. package/dist/dev/runner-deps.d.ts.map +1 -1
  192. package/dist/dev/runner-deps.js +12 -7
  193. package/dist/dev/runner-deps.js.map +1 -1
  194. package/dist/dev/runner-main.d.ts.map +1 -1
  195. package/dist/dev/runner-main.js +11 -5
  196. package/dist/dev/runner-main.js.map +1 -1
  197. package/dist/dev/runner.d.ts +2 -0
  198. package/dist/dev/runner.d.ts.map +1 -1
  199. package/dist/dev/runner.js +26 -7
  200. package/dist/dev/runner.js.map +1 -1
  201. package/dist/dev/schema-dir.d.ts +1 -1
  202. package/dist/dev/schema-dir.d.ts.map +1 -1
  203. package/dist/dev/schema-dir.js +2 -4
  204. package/dist/dev/schema-dir.js.map +1 -1
  205. package/dist/dev/supervisor.d.ts +3 -1
  206. package/dist/dev/supervisor.d.ts.map +1 -1
  207. package/dist/dev/supervisor.js +132 -29
  208. package/dist/dev/supervisor.js.map +1 -1
  209. package/dist/dev/vite-dev-server.d.ts +1 -1
  210. package/dist/dev/vite-dev-server.d.ts.map +1 -1
  211. package/dist/dev/vite-dev-server.js +14 -2
  212. package/dist/dev/vite-dev-server.js.map +1 -1
  213. package/dist/dev/watch-ignore.d.ts +3 -0
  214. package/dist/dev/watch-ignore.d.ts.map +1 -0
  215. package/dist/dev/watch-ignore.js +11 -0
  216. package/dist/dev/watch-ignore.js.map +1 -0
  217. package/dist/i18n/catalogs.d.ts +6 -2
  218. package/dist/i18n/catalogs.d.ts.map +1 -1
  219. package/dist/i18n/catalogs.js +12 -8
  220. package/dist/i18n/catalogs.js.map +1 -1
  221. package/dist/i18n/metadata-templates.d.ts.map +1 -1
  222. package/dist/i18n/metadata-templates.js +2 -1
  223. package/dist/i18n/metadata-templates.js.map +1 -1
  224. package/dist/i18n/source-messages.d.ts +5 -21
  225. package/dist/i18n/source-messages.d.ts.map +1 -1
  226. package/dist/i18n/source-messages.js +1037 -92
  227. package/dist/i18n/source-messages.js.map +1 -1
  228. package/dist/i18n/types.d.ts +6 -7
  229. package/dist/i18n/types.d.ts.map +1 -1
  230. package/dist/i18n/types.js +83 -96
  231. package/dist/i18n/types.js.map +1 -1
  232. package/dist/internal/agent-rules.d.ts.map +1 -1
  233. package/dist/internal/agent-rules.js +7 -2
  234. package/dist/internal/agent-rules.js.map +1 -1
  235. package/dist/internal/banner.d.ts +4 -2
  236. package/dist/internal/banner.d.ts.map +1 -1
  237. package/dist/internal/banner.js +19 -5
  238. package/dist/internal/banner.js.map +1 -1
  239. package/dist/internal/build-manifest.d.ts +5 -2
  240. package/dist/internal/build-manifest.d.ts.map +1 -1
  241. package/dist/internal/build-manifest.js +15 -2
  242. package/dist/internal/build-manifest.js.map +1 -1
  243. package/dist/internal/build-output.d.ts +8 -0
  244. package/dist/internal/build-output.d.ts.map +1 -0
  245. package/dist/internal/build-output.js +116 -0
  246. package/dist/internal/build-output.js.map +1 -0
  247. package/dist/internal/cache-root.d.ts +3 -0
  248. package/dist/internal/cache-root.d.ts.map +1 -0
  249. package/dist/internal/cache-root.js +9 -0
  250. package/dist/internal/cache-root.js.map +1 -0
  251. package/dist/internal/compile-cache-store.d.ts +4 -0
  252. package/dist/internal/compile-cache-store.d.ts.map +1 -0
  253. package/dist/internal/compile-cache-store.js +41 -0
  254. package/dist/internal/compile-cache-store.js.map +1 -0
  255. package/dist/internal/compile-cache.d.ts +4 -0
  256. package/dist/internal/compile-cache.d.ts.map +1 -0
  257. package/dist/internal/compile-cache.js +16 -0
  258. package/dist/internal/compile-cache.js.map +1 -0
  259. package/dist/internal/deploy-out-dir.d.ts +4 -0
  260. package/dist/internal/deploy-out-dir.d.ts.map +1 -0
  261. package/dist/internal/deploy-out-dir.js +5 -0
  262. package/dist/internal/deploy-out-dir.js.map +1 -0
  263. package/dist/internal/docs-elements.d.ts +1 -0
  264. package/dist/internal/docs-elements.d.ts.map +1 -1
  265. package/dist/internal/docs-elements.js +6 -5
  266. package/dist/internal/docs-elements.js.map +1 -1
  267. package/dist/internal/entry-arg.d.ts +4 -1
  268. package/dist/internal/entry-arg.d.ts.map +1 -1
  269. package/dist/internal/entry-arg.js +7 -1
  270. package/dist/internal/entry-arg.js.map +1 -1
  271. package/dist/internal/errors.d.ts +2 -1
  272. package/dist/internal/errors.d.ts.map +1 -1
  273. package/dist/internal/errors.js +1 -1
  274. package/dist/internal/errors.js.map +1 -1
  275. package/dist/internal/font-path.d.ts +4 -0
  276. package/dist/internal/font-path.d.ts.map +1 -0
  277. package/dist/internal/font-path.js +12 -0
  278. package/dist/internal/font-path.js.map +1 -0
  279. package/dist/internal/font-staging.d.ts +6 -0
  280. package/dist/internal/font-staging.d.ts.map +1 -0
  281. package/dist/internal/font-staging.js +94 -0
  282. package/dist/internal/font-staging.js.map +1 -0
  283. package/dist/internal/icon-path.d.ts.map +1 -1
  284. package/dist/internal/icon-path.js +5 -16
  285. package/dist/internal/icon-path.js.map +1 -1
  286. package/dist/internal/icon-staging.d.ts +3 -0
  287. package/dist/internal/icon-staging.d.ts.map +1 -0
  288. package/dist/internal/icon-staging.js +40 -0
  289. package/dist/internal/icon-staging.js.map +1 -0
  290. package/dist/internal/import-scan.d.ts +4 -0
  291. package/dist/internal/import-scan.d.ts.map +1 -0
  292. package/dist/internal/import-scan.js +138 -0
  293. package/dist/internal/import-scan.js.map +1 -0
  294. package/dist/internal/module-hash.d.ts +3 -0
  295. package/dist/internal/module-hash.d.ts.map +1 -0
  296. package/dist/internal/module-hash.js +19 -0
  297. package/dist/internal/module-hash.js.map +1 -0
  298. package/dist/internal/output-directory.d.ts +15 -0
  299. package/dist/internal/output-directory.d.ts.map +1 -0
  300. package/dist/internal/output-directory.js +490 -0
  301. package/dist/internal/output-directory.js.map +1 -0
  302. package/dist/internal/parent-process.d.ts +12 -0
  303. package/dist/internal/parent-process.d.ts.map +1 -0
  304. package/dist/internal/parent-process.js +74 -0
  305. package/dist/internal/parent-process.js.map +1 -0
  306. package/dist/internal/prepare-project.d.ts +3 -0
  307. package/dist/internal/prepare-project.d.ts.map +1 -1
  308. package/dist/internal/prepare-project.js +9 -3
  309. package/dist/internal/prepare-project.js.map +1 -1
  310. package/dist/internal/react-compiler-cache.d.ts +13 -0
  311. package/dist/internal/react-compiler-cache.d.ts.map +1 -0
  312. package/dist/internal/react-compiler-cache.js +182 -0
  313. package/dist/internal/react-compiler-cache.js.map +1 -0
  314. package/dist/internal/source-imports.d.ts +7 -2
  315. package/dist/internal/source-imports.d.ts.map +1 -1
  316. package/dist/internal/source-imports.js +38 -49
  317. package/dist/internal/source-imports.js.map +1 -1
  318. package/dist/internal/staging-file.d.ts +5 -0
  319. package/dist/internal/staging-file.d.ts.map +1 -0
  320. package/dist/internal/staging-file.js +35 -0
  321. package/dist/internal/staging-file.js.map +1 -0
  322. package/dist/internal/xdg-banner.d.ts +4 -0
  323. package/dist/internal/xdg-banner.d.ts.map +1 -0
  324. package/dist/internal/xdg-banner.js +11 -0
  325. package/dist/internal/xdg-banner.js.map +1 -0
  326. package/dist/internal/xdg-data-dirs.d.ts +2 -1
  327. package/dist/internal/xdg-data-dirs.d.ts.map +1 -1
  328. package/dist/internal/xdg-data-dirs.js +1 -1
  329. package/dist/internal/xdg-data-dirs.js.map +1 -1
  330. package/dist/mcp/client.js +2 -2
  331. package/dist/mcp/client.js.map +1 -1
  332. package/dist/settings/render.d.ts +0 -1
  333. package/dist/settings/render.d.ts.map +1 -1
  334. package/dist/settings/render.js +1 -11
  335. package/dist/settings/render.js.map +1 -1
  336. package/dist/settings/schema.d.ts +2 -2
  337. package/dist/settings/schema.d.ts.map +1 -1
  338. package/dist/settings/schema.js +24 -70
  339. package/dist/settings/schema.js.map +1 -1
  340. package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
  341. package/dist/vite-plugins/asset-extensions.js +2 -0
  342. package/dist/vite-plugins/asset-extensions.js.map +1 -1
  343. package/dist/vite-plugins/asset-imports.d.ts +1 -2
  344. package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
  345. package/dist/vite-plugins/asset-imports.js +36 -35
  346. package/dist/vite-plugins/asset-imports.js.map +1 -1
  347. package/dist/vite-plugins/asset-specifier.d.ts +5 -3
  348. package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
  349. package/dist/vite-plugins/asset-specifier.js +10 -4
  350. package/dist/vite-plugins/asset-specifier.js.map +1 -1
  351. package/dist/vite-plugins/build-manifest.d.ts +5 -1
  352. package/dist/vite-plugins/build-manifest.d.ts.map +1 -1
  353. package/dist/vite-plugins/build-manifest.js +2 -1
  354. package/dist/vite-plugins/build-manifest.js.map +1 -1
  355. package/dist/vite-plugins/built-url.d.ts.map +1 -1
  356. package/dist/vite-plugins/built-url.js +5 -2
  357. package/dist/vite-plugins/built-url.js.map +1 -1
  358. package/dist/vite-plugins/css.d.ts.map +1 -1
  359. package/dist/vite-plugins/css.js +13 -5
  360. package/dist/vite-plugins/css.js.map +1 -1
  361. package/dist/vite-plugins/ensure-store.d.ts +1 -1
  362. package/dist/vite-plugins/ensure-store.d.ts.map +1 -1
  363. package/dist/vite-plugins/ensure-store.js +2 -2
  364. package/dist/vite-plugins/ensure-store.js.map +1 -1
  365. package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts +6 -1
  366. package/dist/vite-plugins/fast-refresh/refresh-filter.d.ts.map +1 -1
  367. package/dist/vite-plugins/fast-refresh/refresh-filter.js +3 -1
  368. package/dist/vite-plugins/fast-refresh/refresh-filter.js.map +1 -1
  369. package/dist/vite-plugins/fast-refresh/swc-refresh.d.ts.map +1 -1
  370. package/dist/vite-plugins/fast-refresh/swc-refresh.js +23 -14
  371. package/dist/vite-plugins/fast-refresh/swc-refresh.js.map +1 -1
  372. package/dist/vite-plugins/font-name.d.ts +3 -0
  373. package/dist/vite-plugins/font-name.d.ts.map +1 -0
  374. package/dist/vite-plugins/font-name.js +406 -0
  375. package/dist/vite-plugins/font-name.js.map +1 -0
  376. package/dist/vite-plugins/font-worker-env.d.ts +4 -0
  377. package/dist/vite-plugins/font-worker-env.d.ts.map +1 -0
  378. package/dist/vite-plugins/font-worker-env.js +19 -0
  379. package/dist/vite-plugins/font-worker-env.js.map +1 -0
  380. package/dist/vite-plugins/font.d.ts +4 -0
  381. package/dist/vite-plugins/font.d.ts.map +1 -0
  382. package/dist/vite-plugins/font.js +111 -0
  383. package/dist/vite-plugins/font.js.map +1 -0
  384. package/dist/vite-plugins/i18n.d.ts +11 -2
  385. package/dist/vite-plugins/i18n.d.ts.map +1 -1
  386. package/dist/vite-plugins/i18n.js +75 -8
  387. package/dist/vite-plugins/i18n.js.map +1 -1
  388. package/dist/vite-plugins/icon-worker-env.d.ts +4 -0
  389. package/dist/vite-plugins/icon-worker-env.d.ts.map +1 -0
  390. package/dist/vite-plugins/icon-worker-env.js +23 -0
  391. package/dist/vite-plugins/icon-worker-env.js.map +1 -0
  392. package/dist/vite-plugins/icons.d.ts.map +1 -1
  393. package/dist/vite-plugins/icons.js +4 -9
  394. package/dist/vite-plugins/icons.js.map +1 -1
  395. package/dist/vite-plugins/index.d.ts +10 -1
  396. package/dist/vite-plugins/index.d.ts.map +1 -1
  397. package/dist/vite-plugins/index.js +19 -7
  398. package/dist/vite-plugins/index.js.map +1 -1
  399. package/dist/vite-plugins/native.d.ts.map +1 -1
  400. package/dist/vite-plugins/native.js +0 -4
  401. package/dist/vite-plugins/native.js.map +1 -1
  402. package/dist/vite-plugins/react-compiler.d.ts.map +1 -1
  403. package/dist/vite-plugins/react-compiler.js +57 -18
  404. package/dist/vite-plugins/react-compiler.js.map +1 -1
  405. package/dist/vite-plugins/resource-shared.d.ts +3 -1
  406. package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
  407. package/dist/vite-plugins/resource-shared.js +3 -1
  408. package/dist/vite-plugins/resource-shared.js.map +1 -1
  409. package/dist/vite-plugins/resources.d.ts.map +1 -1
  410. package/dist/vite-plugins/resources.js +40 -102
  411. package/dist/vite-plugins/resources.js.map +1 -1
  412. package/dist/vite-plugins/self-contained.d.ts.map +1 -1
  413. package/dist/vite-plugins/self-contained.js +159 -158
  414. package/dist/vite-plugins/self-contained.js.map +1 -1
  415. package/dist/vite-plugins/settings-worker-env.d.ts +1 -1
  416. package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
  417. package/dist/vite-plugins/settings-worker-env.js +5 -7
  418. package/dist/vite-plugins/settings-worker-env.js.map +1 -1
  419. package/dist/vite-plugins/settings.d.ts +1 -2
  420. package/dist/vite-plugins/settings.d.ts.map +1 -1
  421. package/dist/vite-plugins/settings.js +32 -27
  422. package/dist/vite-plugins/settings.js.map +1 -1
  423. package/dist/vite-plugins/store-links.d.ts.map +1 -1
  424. package/dist/vite-plugins/store-links.js +9 -5
  425. package/dist/vite-plugins/store-links.js.map +1 -1
  426. package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
  427. package/dist/vite-plugins/undeclared-library.js +25 -25
  428. package/dist/vite-plugins/undeclared-library.js.map +1 -1
  429. package/dist/vite-plugins/worker.d.ts.map +1 -1
  430. package/dist/vite-plugins/worker.js +21 -14
  431. package/dist/vite-plugins/worker.js.map +1 -1
  432. package/dist/vitest-plugin.d.ts +4 -3
  433. package/dist/vitest-plugin.d.ts.map +1 -1
  434. package/dist/vitest-plugin.js +12 -8
  435. package/dist/vitest-plugin.js.map +1 -1
  436. package/env.d.ts +9 -0
  437. package/package.json +28 -17
  438. package/src/builder.ts +45 -12
  439. package/src/cli.ts +15 -2
  440. package/src/codegen/config-dependencies.ts +470 -0
  441. package/src/codegen/freshness.ts +70 -17
  442. package/src/codegen/reference.ts +2 -8
  443. package/src/codegen/report.ts +5 -21
  444. package/src/codegen/run-codegen.ts +73 -160
  445. package/src/codegen/store-resolver.ts +16 -27
  446. package/src/commands/build.ts +13 -2
  447. package/src/commands/cleanup.ts +48 -0
  448. package/src/commands/codegen.ts +6 -5
  449. package/src/commands/deploy.ts +10 -2
  450. package/src/commands/dev.ts +45 -4
  451. package/src/commands/docs.ts +6 -17
  452. package/src/deploy/depends.ts +30 -3
  453. package/src/deploy/download.ts +33 -24
  454. package/src/deploy/freedesktop/copyright.ts +2 -14
  455. package/src/deploy/freedesktop/metainfo.ts +73 -21
  456. package/src/deploy/freedesktop/validate.ts +80 -15
  457. package/src/deploy/freedesktop/xml.ts +24 -32
  458. package/src/deploy/native-addon.ts +183 -0
  459. package/src/deploy/nfpm/config.ts +13 -4
  460. package/src/deploy/nfpm/contents.ts +8 -0
  461. package/src/deploy/node-runtime/download.ts +2 -2
  462. package/src/deploy/node-runtime/elf.ts +46 -5
  463. package/src/deploy/node-runtime/guard.ts +10 -14
  464. package/src/deploy/node-runtime/index.ts +148 -12
  465. package/src/deploy/node-runtime/license.ts +2 -8
  466. package/src/deploy/node-runtime/sonames.ts +17 -0
  467. package/src/deploy/notices/node-runtime.ts +2 -2
  468. package/src/deploy/notices/packages.ts +3 -11
  469. package/src/deploy/payload/copy-tree.ts +3 -4
  470. package/src/deploy/payload/launcher.ts +20 -1
  471. package/src/deploy/payload/stage.ts +78 -11
  472. package/src/deploy/run-deploy.ts +227 -72
  473. package/src/deploy/settings/arch.ts +40 -8
  474. package/src/deploy/settings/build-manifest.ts +30 -17
  475. package/src/deploy/settings/extra-files.ts +30 -4
  476. package/src/deploy/settings/index.ts +7 -2
  477. package/src/deploy/settings/libraries.ts +2 -22
  478. package/src/deploy/settings/paths.ts +78 -21
  479. package/src/deploy/settings/screenshots.ts +8 -46
  480. package/src/deploy/targets/appimage.ts +1 -0
  481. package/src/deploy/targets/flatpak-pnpm.ts +4 -4
  482. package/src/deploy/targets/flatpak-source.ts +19 -6
  483. package/src/deploy/targets/flatpak-sources.ts +1 -1
  484. package/src/deploy/targets/flatpak.ts +1 -0
  485. package/src/deploy/targets/nfpm-target.ts +14 -6
  486. package/src/deploy/types.ts +5 -1
  487. package/src/deploy/vendored/appimagetool.ts +2 -2
  488. package/src/deploy/vendored/nfpm.ts +1 -1
  489. package/src/dev/catalog-writes.ts +35 -0
  490. package/src/dev/entry-env.ts +2 -1
  491. package/src/dev/font-dir.ts +11 -0
  492. package/src/dev/headless.ts +40 -0
  493. package/src/dev/runner-deps.ts +20 -7
  494. package/src/dev/runner-main.ts +13 -5
  495. package/src/dev/runner.ts +37 -7
  496. package/src/dev/schema-dir.ts +2 -4
  497. package/src/dev/supervisor.ts +183 -32
  498. package/src/dev/vite-dev-server.ts +20 -2
  499. package/src/dev/watch-ignore.ts +16 -0
  500. package/src/i18n/catalogs.ts +23 -9
  501. package/src/i18n/metadata-templates.ts +2 -1
  502. package/src/i18n/source-messages.ts +1641 -262
  503. package/src/i18n/types.ts +97 -131
  504. package/src/internal/agent-rules.ts +7 -2
  505. package/src/internal/banner.ts +27 -6
  506. package/src/internal/build-manifest.ts +25 -1
  507. package/src/internal/build-output.ts +171 -0
  508. package/src/internal/cache-root.ts +12 -0
  509. package/src/internal/compile-cache-store.ts +50 -0
  510. package/src/internal/compile-cache.ts +20 -0
  511. package/src/internal/deploy-out-dir.ts +8 -0
  512. package/src/internal/docs-elements.ts +11 -5
  513. package/src/internal/entry-arg.ts +8 -1
  514. package/src/internal/errors.ts +1 -1
  515. package/src/internal/font-path.ts +15 -0
  516. package/src/internal/font-staging.ts +131 -0
  517. package/src/internal/icon-path.ts +6 -19
  518. package/src/internal/icon-staging.ts +58 -0
  519. package/src/internal/import-scan.ts +206 -0
  520. package/src/internal/module-hash.ts +22 -0
  521. package/src/internal/output-directory.ts +699 -0
  522. package/src/internal/parent-process.ts +110 -0
  523. package/src/internal/prepare-project.ts +11 -5
  524. package/src/internal/react-compiler-cache.ts +246 -0
  525. package/src/internal/source-imports.ts +64 -55
  526. package/src/internal/staging-file.ts +42 -0
  527. package/src/internal/xdg-banner.ts +13 -0
  528. package/src/internal/xdg-data-dirs.ts +1 -1
  529. package/src/mcp/client.ts +2 -2
  530. package/src/settings/render.ts +1 -13
  531. package/src/settings/schema.ts +23 -91
  532. package/src/vite-plugins/asset-extensions.ts +2 -0
  533. package/src/vite-plugins/asset-imports.ts +39 -45
  534. package/src/vite-plugins/asset-specifier.ts +17 -5
  535. package/src/vite-plugins/build-manifest.ts +7 -1
  536. package/src/vite-plugins/built-url.ts +6 -2
  537. package/src/vite-plugins/css.ts +16 -5
  538. package/src/vite-plugins/ensure-store.ts +2 -2
  539. package/src/vite-plugins/fast-refresh/refresh-filter.ts +10 -1
  540. package/src/vite-plugins/fast-refresh/swc-refresh.ts +33 -14
  541. package/src/vite-plugins/font-name.ts +582 -0
  542. package/src/vite-plugins/font-worker-env.ts +25 -0
  543. package/src/vite-plugins/font.ts +180 -0
  544. package/src/vite-plugins/i18n.ts +123 -11
  545. package/src/vite-plugins/icon-worker-env.ts +36 -0
  546. package/src/vite-plugins/icons.ts +4 -10
  547. package/src/vite-plugins/index.ts +36 -13
  548. package/src/vite-plugins/native.ts +0 -5
  549. package/src/vite-plugins/react-compiler.ts +83 -19
  550. package/src/vite-plugins/resource-shared.ts +4 -0
  551. package/src/vite-plugins/resources.ts +47 -144
  552. package/src/vite-plugins/self-contained.ts +184 -185
  553. package/src/vite-plugins/settings-worker-env.ts +5 -7
  554. package/src/vite-plugins/settings.ts +44 -33
  555. package/src/vite-plugins/store-links.ts +10 -5
  556. package/src/vite-plugins/undeclared-library.ts +30 -32
  557. package/src/vite-plugins/worker.ts +31 -16
  558. package/src/vitest-plugin.ts +12 -8
  559. package/dist/i18n/binding-extractor.d.ts +0 -30
  560. package/dist/i18n/binding-extractor.d.ts.map +0 -1
  561. package/dist/i18n/binding-extractor.js +0 -1324
  562. package/dist/i18n/binding-extractor.js.map +0 -1
  563. package/dist/i18n/extractor-plugin.d.ts +0 -8
  564. package/dist/i18n/extractor-plugin.d.ts.map +0 -1
  565. package/dist/i18n/extractor-plugin.js +0 -247
  566. package/dist/i18n/extractor-plugin.js.map +0 -1
  567. package/dist/internal/data-dir.d.ts +0 -4
  568. package/dist/internal/data-dir.d.ts.map +0 -1
  569. package/dist/internal/data-dir.js +0 -52
  570. package/dist/internal/data-dir.js.map +0 -1
  571. package/dist/vite-plugins/animated.d.ts +0 -5
  572. package/dist/vite-plugins/animated.d.ts.map +0 -1
  573. package/dist/vite-plugins/animated.js +0 -325
  574. package/dist/vite-plugins/animated.js.map +0 -1
  575. package/src/i18n/binding-extractor.ts +0 -1969
  576. package/src/i18n/extractor-plugin.ts +0 -413
  577. package/src/internal/data-dir.ts +0 -70
  578. package/src/vite-plugins/animated.ts +0 -486
@@ -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;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iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;AACjG,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,KAAK,EAAE,QAAwB,EAAwB,EAAE;IAChF,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IACtD,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAChE,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpF,MAAM,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,oBAAoB,OAAO,KAAK,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,GAAG,CAAC,YAAY,IAAI,SAAS,GAAG,CAAC,CAAC;IAE/G,OAAO,EAAE,GAAG,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,EAAgB,WAAW,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AASjD,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC;AAClC,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,aAAa,GAAG,MAAM,CAAC;AAC7B,MAAM,oBAAoB,GAAG,yBAAyB,CAAC;AACvD,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAEtC,MAAM,aAAa,GAAG,CAAC,QAAwB,EAAc,EAAE,CAAC,QAAQ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YAAY,EAAE,SAAS,QAAQ,CAAC,IAAI,CAAC,IAAI,wCAAwC,CAC5F,CAAC;IAEF,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,KAAK,EAAE,QAAwB,EAAwB,EAAE;IAChF,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IACxC,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAChE,MAAM,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrC,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,UAAU,GAAG,kBAAkB,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1F,MAAM,YAAY,GAAG,GAAG,CAAC,YAAY,IAAI,SAAS,CAAC;IACnD,IAAI,CAAC,oBAAoB,OAAO,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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../../src/deploy/node-runtime/license.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,gBAAgB,YAAY,CAAC;AAiBnC,QAAA,MAAM,iBAAiB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAC8B,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"license.d.ts","sourceRoot":"","sources":["../../../src/deploy/node-runtime/license.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,gBAAgB,YAAY,CAAC;AAWnC,QAAA,MAAM,iBAAiB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,IAC8B,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,19 +1,12 @@
1
- import { readFileSync } from "node:fs";
2
1
  import { dirname, join } from "node:path";
2
+ import { readLicenseText } from "../notices/text.js";
3
3
  const LICENSE_FILENAME = "LICENSE";
4
4
  const NODE_MARKER = "Node.js";
5
5
  const licenseCandidates = (binary) => {
6
6
  const dir = dirname(binary);
7
7
  return [join(dir, LICENSE_FILENAME), join(dir, "..", LICENSE_FILENAME)];
8
8
  };
9
- const isNodeLicense = (path) => {
10
- try {
11
- return readFileSync(path, "utf8").includes(NODE_MARKER);
12
- }
13
- catch {
14
- return false;
15
- }
16
- };
9
+ const isNodeLicense = (path) => readLicenseText(path)?.includes(NODE_MARKER) === true;
17
10
  const licenseBesideNode = (binary) => licenseCandidates(binary).find((candidate) => isNodeLicense(candidate)) ?? null;
18
11
  export { LICENSE_FILENAME, licenseBesideNode };
19
12
  //# sourceMappingURL=license.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"license.js","sourceRoot":"","sources":["../../../src/deploy/node-runtime/license.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,gBAAgB,GAAG,SAAS,CAAC;AACnC,MAAM,WAAW,GAAG,SAAS,CAAC;AAE9B,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAY,EAAE;IACnD,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5B,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC5E,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,IAAY,EAAW,EAAE;IAC5C,IAAI,CAAC;QACD,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAiB,EAAE,CACxD,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\nconst LICENSE_FILENAME = \"LICENSE\";\nconst NODE_MARKER = \"Node.js\";\n\nconst licenseCandidates = (binary: string): string[] => {\n const dir = dirname(binary);\n\n return [join(dir, LICENSE_FILENAME), join(dir, \"..\", LICENSE_FILENAME)];\n};\n\nconst isNodeLicense = (path: string): boolean => {\n try {\n return readFileSync(path, \"utf8\").includes(NODE_MARKER);\n } catch {\n return false;\n }\n};\n\nconst licenseBesideNode = (binary: string): string | null =>\n licenseCandidates(binary).find((candidate) => isNodeLicense(candidate)) ?? null;\n\nexport { LICENSE_FILENAME, licenseBesideNode };\n"]}
1
+ {"version":3,"file":"license.js","sourceRoot":"","sources":["../../../src/deploy/node-runtime/license.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,gBAAgB,GAAG,SAAS,CAAC;AACnC,MAAM,WAAW,GAAG,SAAS,CAAC;AAE9B,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAY,EAAE;IACnD,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5B,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAC5E,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;AAEvG,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAiB,EAAE,CACxD,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import { dirname, join } from \"node:path\";\nimport { readLicenseText } from \"../notices/text.js\";\n\nconst LICENSE_FILENAME = \"LICENSE\";\nconst NODE_MARKER = \"Node.js\";\n\nconst licenseCandidates = (binary: string): string[] => {\n const dir = dirname(binary);\n\n return [join(dir, LICENSE_FILENAME), join(dir, \"..\", LICENSE_FILENAME)];\n};\n\nconst isNodeLicense = (path: string): boolean => readLicenseText(path)?.includes(NODE_MARKER) === true;\n\nconst licenseBesideNode = (binary: string): string | null =>\n licenseCandidates(binary).find((candidate) => isNodeLicense(candidate)) ?? null;\n\nexport { LICENSE_FILENAME, licenseBesideNode };\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,oGAAoG;IACpG,+FAA+F;IAC/F,iGAAiG;CACpG,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,sFAAsF,CAAC,CAAC;AAEjH,MAAM,eAAe,GAAG;IACpB,oGAAoG;IACpG,GAAG,WAAW,GAAG;CACpB,CAAC;AAEF,MAAM,eAAe,GACjB,yGAAyG;IACzG,uGAAuG;IACvG,uBAAuB,CAAC;AAE5B,MAAM,YAAY,GAAG,CAAC,QAAwB,EAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,QAAQ,CAAC;AAEvG,MAAM,UAAU,GAAG,CAAC,QAAw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7D,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,QAAwB,EAAE,IAAmB,EAAY,EAAE,CAAC;IAC5E,GAAG,OAAO;IACV,GAAG,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC;CACpC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,IAAwB,EAAE,IAAmB,EAAQ,EAAE;IAC/E,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACjC,OAAO;IACX,CAAC;IAED,IAAI,CAAC,eAAe,CAAC,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,QAAwB,EAAE,IAAwB,EAAiB,EAAE;IACtF,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACrC,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAE/B,OAAO;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 { 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,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,oGAAoG;IACpG,+FAA+F;IAC/F,iGAAiG;CACpG,CAAC;AAEF,MAAM,eAAe,GAA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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":"packages.d.ts","sourceRoot":"","sources":["../../../src/deploy/notices/packages.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACtB,CAAC;AAmGF,QAAA,MAAM,eAAe,GAAI,UAAU,cAAc,EAAE,UAAU,eAAe,EAAE,KAAG,cAAc,EAY9F,CAAC;AAEF,OAAO,EAAE,KAAK,cAAc,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../src/deploy/notices/packages.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACtB,CAAC;AA0FF,QAAA,MAAM,eAAe,GAAI,UAAU,cAAc,EAAE,UAAU,eAAe,EAAE,KAAG,cAAc,EAY9F,CAAC;AAEF,OAAO,EAAE,KAAK,cAAc,EAAE,eAAe,EAAE,CAAC"}
@@ -1,13 +1,10 @@
1
1
  import { sortStringsBy, warn } from "@gtkx/utils";
2
+ import hostedGitInfo from "hosted-git-info";
2
3
  import { existsSync, realpathSync } from "node:fs";
3
4
  import { join, resolve } from "node:path";
4
5
  import { readPackageManifest } from "../settings/package-manifest.js";
5
6
  import { copyrightLines, licenseTextIn } from "./text.js";
6
7
  const MANIFEST_FILENAME = "package.json";
7
- const GIT_PREFIX = /^git\+/;
8
- const GIT_SUFFIX = /\.git$/;
9
- const GIT_SCHEME = /^git:\/\//;
10
- const GITHUB_SLUG = /^(?:github:)?(?<slug>[\w.-]+\/[\w.-]+)$/;
11
8
  const realPath = (path) => {
12
9
  try {
13
10
  return realpathSync(path);
@@ -28,12 +25,8 @@ const sourceUrl = (manifest) => {
28
25
  if (configured === null) {
29
26
  return null;
30
27
  }
31
- const url = configured.replace(GIT_PREFIX, "").replace(GIT_SUFFIX, "").replace(GIT_SCHEME, "https://");
32
- const slug = GITHUB_SLUG.exec(url)?.groups?.slug;
33
- if (slug !== undefined) {
34
- return `https://github.com/${slug}`;
35
- }
36
- return url.startsWith("http") ? url : null;
28
+ const url = configured.replace(/^git\+/, "").replace(/\.git$/, "").replace(/^git:\/\//, "https://");
29
+ return hostedGitInfo.fromUrl(url)?.browse() ?? (url.startsWith("http") ? url : null);
37
30
  };
38
31
  const missingPackage = (entry) => ({
39
32
  name: entry.name,
@@ -1 +1 @@
1
- {"version":3,"file":"packages.js","sourceRoot":"","sources":["../../../src/deploy/notices/packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAwB,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAY1D,MAAM,iBAAiB,GAAG,cAAc,CAAC;AACzC,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,UAAU,GAAG,WAAW,CAAC;AAC/B,MAAM,WAAW,GAAG,yCAAyC,CAAC;AAE9D,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE;IACtC,IAAI,CAAC;QACD,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;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CAAC;AACnB,CAAC,CAAC;AAEF,OAAO,EAAuB,eAAe,EAAE,CAAC","sourcesContent":["import { sortStringsBy, warn } from \"@gtkx/utils\";\nimport { existsSync, realpathSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { RecordedPackage } from \"../../internal/build-manifest.js\";\nimport type { DeploySettings } from \"../types.js\";\nimport { type PackageManifest, readPackageManifest } from \"../settings/package-manifest.js\";\nimport { copyrightLines, licenseTextIn } from \"./text.js\";\n\ntype BundledPackage = {\n name: string;\n version: string | null;\n license: string | null;\n source: string | null;\n copyright: string[];\n text: string | null;\n isPresent: boolean;\n};\n\nconst MANIFEST_FILENAME = \"package.json\";\nconst GIT_PREFIX = /^git\\+/;\nconst GIT_SUFFIX = /\\.git$/;\nconst GIT_SCHEME = /^git:\\/\\//;\nconst GITHUB_SLUG = /^(?:github:)?(?<slug>[\\w.-]+\\/[\\w.-]+)$/;\n\nconst realPath = (path: string): string => {\n try {\n return realpathSync(path);\n } catch {\n return path;\n }\n};\n\nconst authorLine = (manifest: PackageManifest): string[] => {\n const { name, email } = manifest.author;\n\n if (name === null) {\n return [];\n }\n\n return [email === null ? name : `${name} <${email}>`];\n};\n\nconst sourceUrl = (manifest: PackageManifest): string | null => {\n const configured = manifest.repository ?? manifest.homepage;\n\n if (configured === null) {\n return null;\n }\n\n const url = configured.replace(GIT_PREFIX, \"\").replace(GIT_SUFFIX, \"\").replace(GIT_SCHEME, \"https://\");\n const slug = GITHUB_SLUG.exec(url)?.groups?.slug;\n\n if (slug !== undefined) {\n return `https://github.com/${slug}`;\n }\n\n return url.startsWith(\"http\") ? url : null;\n};\n\nconst missingPackage = (entry: RecordedPackage): BundledPackage => ({\n name: entry.name,\n version: entry.version,\n license: null,\n source: null,\n copyright: [],\n text: null,\n isPresent: false,\n});\n\nconst packageIn = (entry: RecordedPackage, dir: string): BundledPackage => {\n if (!existsSync(join(dir, MANIFEST_FILENAME))) {\n return missingPackage(entry);\n }\n\n const manifest = readPackageManifest(dir);\n const text = licenseTextIn(dir);\n const copyright = copyrightLines(text);\n\n return {\n name: manifest.name ?? entry.name,\n version: manifest.version ?? entry.version,\n license: manifest.license,\n source: sourceUrl(manifest),\n copyright: copyright.length === 0 ? authorLine(manifest) : copyright,\n text,\n isPresent: true,\n };\n};\n\nconst keyFor = (entry: BundledPackage): string => `${entry.name}@${entry.version ?? \"\"}`;\n\nconst dedupe = (entries: BundledPackage[]): BundledPackage[] => {\n const unique: Map<string, BundledPackage> = new Map();\n\n for (const entry of entries) {\n unique.set(keyFor(entry), entry);\n }\n\n return sortStringsBy(unique.values(), keyFor);\n};\n\nconst warnMissing = (entries: BundledPackage[]): void => {\n const missing = entries.filter((entry) => !entry.isPresent);\n\n if (missing.length === 0) {\n return;\n }\n\n warn(\n `The third-party notices name ${missing.map((entry) => keyFor(entry)).join(\", \")} without any license: ` +\n \"`gtkx build` recorded where each package was installed and those directories are no longer there. \" +\n \"Deploy from the tree the build ran in, or build again, so the notices carry their terms.\",\n );\n};\n\nconst bundledPackages = (settings: DeploySettings, recorded: RecordedPackage[]): BundledPackage[] => {\n const root = realPath(settings.paths.root);\n\n const entries = recorded\n .map((entry) => ({ entry, dir: resolve(settings.paths.dist, entry.dir) }))\n .filter(({ dir }) => realPath(dir) !== root)\n .map(({ entry, dir }) => packageIn(entry, dir));\n\n const bundled = dedupe(entries);\n warnMissing(bundled);\n\n return bundled;\n};\n\nexport { type BundledPackage, bundledPackages };\n"]}
1
+ {"version":3,"file":"packages.js","sourceRoot":"","sources":["../../../src/deploy/notices/packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAwB,mBAAmB,EAAE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AS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IAEpD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,WAAW,CAAC,OAAO,CAAC,CAAC;IAErB,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAEF,OAAO,EAAuB,eAAe,EAAE,CAAC","sourcesContent":["import { sortStringsBy, warn } from \"@gtkx/utils\";\nimport hostedGitInfo from \"hosted-git-info\";\nimport { existsSync, realpathSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { RecordedPackage } from \"../../internal/build-manifest.js\";\nimport type { DeploySettings } from \"../types.js\";\nimport { type PackageManifest, readPackageManifest } from \"../settings/package-manifest.js\";\nimport { copyrightLines, licenseTextIn } from \"./text.js\";\n\ntype BundledPackage = {\n name: string;\n version: string | null;\n license: string | null;\n source: string | null;\n copyright: string[];\n text: string | null;\n isPresent: boolean;\n};\n\nconst MANIFEST_FILENAME = \"package.json\";\n\nconst realPath = (path: string): string => {\n try {\n return realpathSync(path);\n } catch {\n return path;\n }\n};\n\nconst authorLine = (manifest: PackageManifest): string[] => {\n const { name, email } = manifest.author;\n\n if (name === null) {\n return [];\n }\n\n return [email === null ? name : `${name} <${email}>`];\n};\n\nconst sourceUrl = (manifest: PackageManifest): string | null => {\n const configured = manifest.repository ?? manifest.homepage;\n\n if (configured === null) {\n return null;\n }\n\n const url = configured.replace(/^git\\+/, \"\").replace(/\\.git$/, \"\").replace(/^git:\\/\\//, \"https://\");\n\n return hostedGitInfo.fromUrl(url)?.browse() ?? (url.startsWith(\"http\") ? url : null);\n};\n\nconst missingPackage = (entry: RecordedPackage): BundledPackage => ({\n name: entry.name,\n version: entry.version,\n license: null,\n source: null,\n copyright: [],\n text: null,\n isPresent: false,\n});\n\nconst packageIn = (entry: RecordedPackage, dir: string): BundledPackage => {\n if (!existsSync(join(dir, MANIFEST_FILENAME))) {\n return missingPackage(entry);\n }\n\n const manifest = readPackageManifest(dir);\n const text = licenseTextIn(dir);\n const copyright = copyrightLines(text);\n\n return {\n name: manifest.name ?? entry.name,\n version: manifest.version ?? entry.version,\n license: manifest.license,\n source: sourceUrl(manifest),\n copyright: copyright.length === 0 ? authorLine(manifest) : copyright,\n text,\n isPresent: true,\n };\n};\n\nconst keyFor = (entry: BundledPackage): string => `${entry.name}@${entry.version ?? \"\"}`;\n\nconst dedupe = (entries: BundledPackage[]): BundledPackage[] => {\n const unique: Map<string, BundledPackage> = new Map();\n\n for (const entry of entries) {\n unique.set(keyFor(entry), entry);\n }\n\n return sortStringsBy(unique.values(), keyFor);\n};\n\nconst warnMissing = (entries: BundledPackage[]): void => {\n const missing = entries.filter((entry) => !entry.isPresent);\n\n if (missing.length === 0) {\n return;\n }\n\n warn(\n `The third-party notices name ${missing.map((entry) => keyFor(entry)).join(\", \")} without any license: ` +\n \"`gtkx build` recorded where each package was installed and those directories are no longer there. \" +\n \"Deploy from the tree the build ran in, or build again, so the notices carry their terms.\",\n );\n};\n\nconst bundledPackages = (settings: DeploySettings, recorded: RecordedPackage[]): BundledPackage[] => {\n const root = realPath(settings.paths.root);\n\n const entries = recorded\n .map((entry) => ({ entry, dir: resolve(settings.paths.dist, entry.dir) }))\n .filter(({ dir }) => realPath(dir) !== root)\n .map(({ entry, dir }) => packageIn(entry, dir));\n\n const bundled = dedupe(entries);\n warnMissing(bundled);\n\n return bundled;\n};\n\nexport { type BundledPackage, bundledPackages };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"copy-tree.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,QAAA,MAAM,eAAe,MAAQ,CAAC;AA8B9B,QAAA,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,EAAE,QAAQ,MAAM,EAAE,aAAmB,KAAG,UAG7E,CAAC;AAEP,QAAA,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,EAAE,UAAU,MAAM,EAAE,aAAoB,KAAG,UAGjF,CAAC;AAIP,QAAA,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MACmC,CAAC;AAE9E,QAAA,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,EAAE,WAAW,MAAM,KAAG,UAAU,EAEwB,CAAC;AAExG,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"copy-tree.d.ts","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,QAAA,MAAM,eAAe,MAAQ,CAAC;AA4B9B,QAAA,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,EAAE,QAAQ,MAAM,EAAE,aAAmB,KAAG,UAG7E,CAAC;AAEP,QAAA,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAK,MAAM,EAAE,UAAU,MAAM,EAAE,aAAoB,KAAG,UAGjF,CAAC;AAIP,QAAA,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,MACmC,CAAC;AAE9E,QAAA,MAAM,QAAQ,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,EAAE,WAAW,MAAM,KAAG,UAAU,EAEwB,CAAC;AAExG,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC"}
@@ -1,5 +1,6 @@
1
+ import { isPathInside } from "@gtkx/utils";
1
2
  import { chmodSync, copyFileSync, mkdirSync, statSync, writeFileSync } from "node:fs";
2
- import { dirname, isAbsolute, join, relative } from "node:path";
3
+ import { dirname, join } from "node:path";
3
4
  import { listFilesRecursive } from "../../internal/list-files.js";
4
5
  const EXECUTABLE_MODE = 0o755;
5
6
  const READABLE_MODE = 0o644;
@@ -11,8 +12,7 @@ const modeFor = (rel) => {
11
12
  return EXECUTABLE_SUFFIXES.some((suffix) => name.endsWith(suffix)) ? EXECUTABLE_MODE : READABLE_MODE;
12
13
  };
13
14
  const assertInsideRoot = (root, rel, abs) => {
14
- const escape = relative(root, abs);
15
- if (escape.length === 0 || escape.startsWith("..") || isAbsolute(escape)) {
15
+ if (!isPathInside(root, abs)) {
16
16
  throw new Error(`Cannot stage "${rel}": it resolves outside the staging directory`);
17
17
  }
18
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"copy-tree.js","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7C,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,YAAY,GAAG,KAAK,CAAC;AAE3B,MAAM,OAAO,GAAG,CAAC,GAAW,EAAU,EAAE;IACpC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;IAE1C,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa,CAAC;AACzG,CAAC,CAAC;AAEF,MAAM,gB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EAAE,CAAC,MAAM,EAAE,EAAE;IAClC,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACpC,CAAC,CAAC,CAAC;AAEP,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC;AAE7E,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAU,EAAE,CAC/C,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,eAAe,CAAC;AAE9E,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,OAAe,EAAE,SAAiB,EAAgB,EAAE,CAChF,kBAAkB,CAAC,SAAS,CAAC;KACxB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAExG,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { chmodSync, copyFileSync, mkdirSync, statSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, relative } from \"node:path\";\nimport type { StagedFile } from \"../types.js\";\nimport { listFilesRecursive } from \"../../internal/list-files.js\";\n\nconst EXECUTABLE_MODE = 0o755;\nconst READABLE_MODE = 0o644;\nconst EXECUTABLE_SUFFIXES = [\".node\", \".so\"];\nconst MODE_MASK = 0o7777;\nconst EXECUTE_MASK = 0o111;\n\nconst modeFor = (rel: string): number => {\n const name = rel.split(\"/\").at(-1) ?? rel;\n\n return EXECUTABLE_SUFFIXES.some((suffix) => name.endsWith(suffix)) ? EXECUTABLE_MODE : READABLE_MODE;\n};\n\nconst assertInsideRoot = (root: string, rel: string, abs: string): void => {\n const escape = relative(root, abs);\n\n if (escape.length === 0 || escape.startsWith(\"..\") || isAbsolute(escape)) {\n throw new Error(`Cannot stage \"${rel}\": it resolves outside the staging directory`);\n }\n};\n\nconst placeFile = (root: string, rel: string, mode: number, write: (target: string) => void): StagedFile => {\n const abs = join(root, rel);\n assertInsideRoot(root, rel, abs);\n mkdirSync(dirname(abs), { recursive: true });\n write(abs);\n chmodSync(abs, mode);\n\n return { rel, abs, mode };\n};\n\nconst copyInto = (root: string, rel: string, source: string, mode = modeFor(rel)): StagedFile =>\n placeFile(root, rel, mode, (target) => {\n copyFileSync(source, target);\n });\n\nconst writeInto = (root: string, rel: string, contents: string, mode = READABLE_MODE): StagedFile =>\n placeFile(root, rel, mode, (target) => {\n writeFileSync(target, contents);\n });\n\nconst sourceMode = (path: string): number => statSync(path).mode & MODE_MASK;\n\nconst executableModeFor = (path: string): number =>\n (sourceMode(path) & EXECUTE_MASK) === 0 ? READABLE_MODE : EXECUTABLE_MODE;\n\nconst copyTree = (root: string, relBase: string, sourceDir: string): StagedFile[] =>\n listFilesRecursive(sourceDir)\n .map((file) => copyInto(root, join(relBase, file.rel), file.absPath, sourceMode(file.absPath)));\n\nexport { copyInto, copyTree, EXECUTABLE_MODE, executableModeFor, writeInto };\n"]}
1
+ {"version":3,"file":"copy-tree.js","sourceRoot":"","sources":["../../../src/deploy/payload/copy-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,aAAa,GAAG,KAAK,CAAC;AAC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FileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport type { StagedFile } from \"../types.js\";\nimport { listFilesRecursive } from \"../../internal/list-files.js\";\n\nconst EXECUTABLE_MODE = 0o755;\nconst READABLE_MODE = 0o644;\nconst EXECUTABLE_SUFFIXES = [\".node\", \".so\"];\nconst MODE_MASK = 0o7777;\nconst EXECUTE_MASK = 0o111;\n\nconst modeFor = (rel: string): number => {\n const name = rel.split(\"/\").at(-1) ?? rel;\n\n return EXECUTABLE_SUFFIXES.some((suffix) => name.endsWith(suffix)) ? EXECUTABLE_MODE : READABLE_MODE;\n};\n\nconst assertInsideRoot = (root: string, rel: string, abs: string): void => {\n if (!isPathInside(root, abs)) {\n throw new Error(`Cannot stage \"${rel}\": it resolves outside the staging directory`);\n }\n};\n\nconst placeFile = (root: string, rel: string, mode: number, write: (target: string) => void): StagedFile => {\n const abs = join(root, rel);\n assertInsideRoot(root, rel, abs);\n mkdirSync(dirname(abs), { recursive: true });\n write(abs);\n chmodSync(abs, mode);\n\n return { rel, abs, mode };\n};\n\nconst copyInto = (root: string, rel: string, source: string, mode = modeFor(rel)): StagedFile =>\n placeFile(root, rel, mode, (target) => {\n copyFileSync(source, target);\n });\n\nconst writeInto = (root: string, rel: string, contents: string, mode = READABLE_MODE): StagedFile =>\n placeFile(root, rel, mode, (target) => {\n writeFileSync(target, contents);\n });\n\nconst sourceMode = (path: string): number => statSync(path).mode & MODE_MASK;\n\nconst executableModeFor = (path: string): number =>\n (sourceMode(path) & EXECUTE_MASK) === 0 ? READABLE_MODE : EXECUTABLE_MODE;\n\nconst copyTree = (root: string, relBase: string, sourceDir: string): StagedFile[] =>\n listFilesRecursive(sourceDir)\n .map((file) => copyInto(root, join(relBase, file.rel), file.absPath, sourceMode(file.absPath)));\n\nexport { copyInto, copyTree, EXECUTABLE_MODE, executableModeFor, writeInto };\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,QAAQ;IACrD,2BAA2B;CAC9B,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,KAAa,EAA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C,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,WAAW,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC;CAC5B,CAAC;AAEF,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