fix(ci): preserve imported dist chunks after install

This commit is contained in:
Peter Steinberger
2026-04-29 01:12:59 +01:00
parent 054b2e1b7e
commit 03b1731d0f
5 changed files with 110 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ import {
} from "node:fs";
import { basename, dirname, isAbsolute, join, relative } from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import { expandPackageDistImportClosure } from "./lib/package-dist-imports.mjs";
import { resolveNpmRunner } from "./npm-runner.mjs";
export const BUNDLED_PLUGIN_INSTALL_TARGETS = [];
@@ -292,6 +293,16 @@ export function pruneInstalledPackageDist(params = {}) {
}
}
const installedFiles = listInstalledDistFiles(params);
const readFile = params.readFileSync ?? readFileSync;
expectedFiles = new Set(
expandPackageDistImportClosure({
files: installedFiles,
seedFiles: [...expectedFiles],
readText(relativePath) {
return readFile(join(packageRoot, relativePath), "utf8");
},
}),
);
const removed = [];
for (const relativePath of installedFiles) {