@@ -4,6 +4,7 @@ import path from "node:path";
44import { resolveUserPath } from "../utils.js" ;
55import { resolveCompatibilityHostVersion } from "../version.js" ;
66import { resolveBundledPluginsDir } from "./bundled-dir.js" ;
7+ import { normalizePluginsConfig } from "./config-state.js" ;
78import { getCurrentPluginMetadataSnapshot } from "./current-plugin-metadata-snapshot.js" ;
89import type { PluginDiscoveryResult } from "./discovery.js" ;
910import { fileSignatureMatches , hashJson } from "./installed-plugin-index-hash.js" ;
@@ -31,6 +32,7 @@ import {
3132} from "./installed-plugin-index.js" ;
3233import { registerPluginMetadataProcessMemoLifecycleClear } from "./plugin-metadata-lifecycle.js" ;
3334import type { PluginRegistrySnapshotSource } from "./plugin-registry-snapshot.types.js" ;
35+ import { resolvePluginCacheInputs } from "./roots.js" ;
3436
3537export type PluginRegistrySnapshot = InstalledPluginIndex ;
3638export type PluginRegistryRecord = InstalledPluginIndexRecord ;
@@ -148,11 +150,30 @@ function resolvePluginRegistrySnapshotMemoKey(
148150 ...( params . stateDir ? { stateDir : params . stateDir } : { } ) ,
149151 } ) ,
150152 ) ,
153+ pluginRoots : fingerprintPluginSourceRoots ( params , env ) ,
151154 stateDir : params . stateDir ? resolveUserPath ( params . stateDir , env ) : null ,
152155 workspaceDir : params . workspaceDir ? resolveUserPath ( params . workspaceDir , env ) : null ,
153156 } ) ;
154157}
155158
159+ function fingerprintPluginSourceRoots (
160+ params : LoadPluginRegistryParams ,
161+ env : NodeJS . ProcessEnv ,
162+ ) : unknown {
163+ const workspaceDir = params . workspaceDir ? resolveUserPath ( params . workspaceDir , env ) : undefined ;
164+ const cacheInputs = resolvePluginCacheInputs ( {
165+ workspaceDir,
166+ loadPaths : normalizePluginsConfig ( params . config ?. plugins ) . loadPaths ,
167+ env,
168+ } ) ;
169+ return {
170+ global : fileFingerprint ( cacheInputs . roots . global ) ,
171+ loadPaths : cacheInputs . loadPaths . map ( ( entry ) => fileFingerprint ( entry ) ) ,
172+ stock : cacheInputs . roots . stock ? fileFingerprint ( cacheInputs . roots . stock ) : null ,
173+ workspace : cacheInputs . roots . workspace ? fileFingerprint ( cacheInputs . roots . workspace ) : null ,
174+ } ;
175+ }
176+
156177function fileFingerprint ( filePath : string ) : unknown {
157178 try {
158179 const stat = fs . statSync ( filePath , { bigint : true } ) ;
0 commit comments