diff --git a/packages/amaro-wasm/build.ncl b/packages/amaro-wasm/build.ncl index 02f2073ab..d5dead2a1 100644 --- a/packages/amaro-wasm/build.ncl +++ b/packages/amaro-wasm/build.ncl @@ -5,11 +5,17 @@ let rust = import "../rust/build.ncl" in let toolchain = import "../toolchain/build.ncl" in let wasm-bindgen-cli = import "../wasm-bindgen-cli/build.ncl" in -# The amaro version node and node-lts bundle (both 1.1.11 since node 26.12.1 / 24.22.1), used in -# the Source URL, upstream_version and the test, so a bump is one edit here (plus node and -# node-lts's own `amaro`). Its tag vendors the swc tree the TypeScript stripper is built from -# (deps/swc, with Cargo.lock). build.sh still loops over amaro_versions, should two ever differ. -let amaro = "1.1.11" in +# The amaro versions node and node-lts bundle, read from versions.ncl (the one place they are +# recorded): each distinct one, in versions.ncl's field order. Each tag vendors the swc tree the +# TypeScript stripper is built from (deps/swc, with Cargo.lock); build.sh builds every one. +let versions = import "versions.ncl" in +let amaro_versions = + std.array.fold_left + (fun acc v => if std.array.elem v acc then acc else acc @ [v]) + [] + (std.record.values versions.bundled) +in +let amaro = std.string.join " " amaro_versions in # the rust package's version; build.sh fails if rustc is not this version let rustc = "1.99.1" in { @@ -23,25 +29,30 @@ let rustc = "1.99.1" in # # The rust package ships no wasm32 std and no rust-lld: std is built with -Zbuild-std from the # rustc source tarball of the same version, and llvm's wasm-ld links. - build_deps = [ - { file = "build.sh" } | Local, - { - url = "https://github.com/nodejs/amaro/archive/refs/tags/v%{amaro}.tar.gz", - sha256 = "f65b4e8ae9ab519e8db1824377eb621d7fce66e21ae1020621d8f54b6ed774fa", - extract = false, - } | Source, - { - # the rust package's own source - url = "gs://minimal-staging-archives/rustc-%{rustc}-src.tar.xz", - sha256 = "6451598a99e77f07571960f6b21d577399d3a30f33e80cbd2e3a4aae6535d265", - extract = false, - } | Source, - base, - llvm, - rust, - toolchain, - wasm-bindgen-cli, - ], + build_deps = + [{ file = "build.sh" } | Local] + @ std.array.map + (fun v => + { + url = "https://github.com/nodejs/amaro/archive/refs/tags/v%{v}.tar.gz", + sha256 = versions.tag_sha256."%{v}", + extract = false, + } | Source + ) + amaro_versions + @ [ + { + # the rust package's own source + url = "gs://minimal-staging-archives/rustc-%{rustc}-src.tar.xz", + sha256 = "6451598a99e77f07571960f6b21d577399d3a30f33e80cbd2e3a4aae6535d265", + extract = false, + } | Source, + base, + llvm, + rust, + toolchain, + wasm-bindgen-cli, + ], # cargo fetches the crates in swc's Cargo.lock and std's library/Cargo.lock (--locked). needs = @@ -62,7 +73,8 @@ let rustc = "1.99.1" in attrs = { - upstream_version = amaro, + # node's entry (the current line) is the version pkgmgr checks upstream against. + upstream_version = versions.bundled.node, license_spdx = "MIT AND Apache-2.0", source_provenance = { category = 'GithubRepo, diff --git a/packages/amaro-wasm/versions.ncl b/packages/amaro-wasm/versions.ncl new file mode 100644 index 000000000..53ff036e2 --- /dev/null +++ b/packages/amaro-wasm/versions.ncl @@ -0,0 +1,20 @@ +# The amaro (node's built-in TypeScript type stripper) each node line bundles, as ONE value. +# +# node and node-lts read their own entry in `bundled` (their build.sh fails unless +# deps/amaro/package.json is that version), and amaro-wasm builds the swc wasm for every +# distinct version listed there, from that version's tag tarball pinned in `tag_sha256`. So a +# node bump that moves its bundled amaro edits this file (and the shipped-blob pin on that +# node's `splice deps/amaro/dist/index.js` line), and amaro-wasm rebuilds with it in the same +# change. pkgmgr's updater makes those edits: it reads deps/amaro from the new node tarball, +# rewrites the entry, pins the new tag tarball and re-derives the splice pin. +{ + bundled = { + node = "1.1.11", + node-lts = "1.1.11", + }, + # https://github.com/nodejs/amaro/archive/refs/tags/v.tar.gz, one per version + # `bundled` names (an unlisted one fails evaluation). + tag_sha256 = { + "1.1.11" = "f65b4e8ae9ab519e8db1824377eb621d7fce66e21ae1020621d8f54b6ed774fa", + }, +} diff --git a/packages/node-lts/build.ncl b/packages/node-lts/build.ncl index 7674155b7..652d80f39 100644 --- a/packages/node-lts/build.ncl +++ b/packages/node-lts/build.ncl @@ -33,7 +33,8 @@ let undici_llhttp = "9.3.0" in let npm_undici = "6.28.0" in # The llhttp that the npm-vendored undici pins (forwarded so a bump is one edit). let npm_undici_llhttp = "8.1.0" in -let amaro = "1.1.11" in +# amaro is recorded once, in amaro-wasm/versions.ncl, so node, node-lts and amaro-wasm agree. +let amaro = (import "../amaro-wasm/versions.ncl").bundled.node-lts in let version = "24.22.1" in { name = "node-lts", diff --git a/packages/node/build.ncl b/packages/node/build.ncl index 03f781cc6..e9bba527e 100644 --- a/packages/node/build.ncl +++ b/packages/node/build.ncl @@ -34,7 +34,8 @@ let undici_llhttp = "9.3.1" in let npm_undici = "6.28.0" in # The llhttp that the npm-vendored undici pins (forwarded so a bump is one edit). let npm_undici_llhttp = "8.1.0" in -let amaro = "1.1.11" in +# amaro is recorded once, in amaro-wasm/versions.ncl, so node, node-lts and amaro-wasm agree. +let amaro = (import "../amaro-wasm/versions.ncl").bundled.node in let version = "26.12.1" in { name = "node",