Skip to content

Commit 949dd68

Browse files
committed
perf(plugins): make package-manifest cache key trust-aware
1 parent 13c930e commit 949dd68

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/plugins/discovery.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,13 @@ function readCandidatePackageManifest(params: {
507507
rootRealPath?: string;
508508
packageManifestCache?: Map<string, PackageManifest | null>;
509509
}): PackageManifest | null {
510-
const cacheKey = params.rootRealPath ?? path.resolve(params.dir);
510+
const trustMode =
511+
params.origin === "bundled"
512+
? "trusted"
513+
: params.rejectHardlinks
514+
? "external-reject"
515+
: "external-allow";
516+
const cacheKey = `${trustMode}:${params.rootRealPath ?? path.resolve(params.dir)}`;
511517
const cached = params.packageManifestCache?.get(cacheKey);
512518
if (cached !== undefined) {
513519
return cached;

0 commit comments

Comments
 (0)