mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-10-17 23:15:16 +02:00
## Summary - Preserve class names in the save-cache bundle so `@actions/cache` error-name comparisons distinguish validation errors, benign cache-reservation races, and finalization errors correctly. - Add regression coverage that exercises the bundled `ValidationError`, `ReserveCacheError`, and `FinalizeCacheError` constructors. Fixes #1028 ## Verification - `npm run all` passed on Ubuntu 24.04 with Node 24.19.0: build, Biome, packaging, and all 159 tests across 15 suites. - `git diff --check` passed. The save-cache bundle increases by about 77 KB raw (14 KB gzip) to preserve the required names.
36 lines
904 B
JavaScript
36 lines
904 B
JavaScript
import { rm } from "node:fs/promises";
|
|
import { build } from "esbuild";
|
|
|
|
const builds = [
|
|
{
|
|
entryPoints: ["src/setup-uv.ts"],
|
|
outfile: "dist/setup/index.cjs",
|
|
staleOutfiles: ["dist/setup/index.mjs"],
|
|
},
|
|
{
|
|
entryPoints: ["src/save-cache.ts"],
|
|
// @actions/cache compares error.name to the error constructor's name.
|
|
keepNames: true,
|
|
outfile: "dist/save-cache/index.cjs",
|
|
staleOutfiles: ["dist/save-cache/index.mjs"],
|
|
},
|
|
{
|
|
entryPoints: ["src/update-known-checksums.ts"],
|
|
outfile: "dist/update-known-checksums/index.cjs",
|
|
staleOutfiles: ["dist/update-known-checksums/index.mjs"],
|
|
},
|
|
];
|
|
|
|
for (const { staleOutfiles, ...options } of builds) {
|
|
await Promise.all(
|
|
staleOutfiles.map((outfile) => rm(outfile, { force: true })),
|
|
);
|
|
await build({
|
|
bundle: true,
|
|
format: "cjs",
|
|
platform: "node",
|
|
target: "node24",
|
|
...options,
|
|
});
|
|
}
|