























@@ -7,6 +7,7 @@ import type { PluginCandidate } from "./discovery.js";
77import type { PluginInstallSourceInfo } from "./install-source-info.js";
88import { describePluginInstallSource } from "./install-source-info.js";
99import { hashJson, safeHashFile } from "./installed-plugin-index-hash.js";
10+import { hasOptionalMissingPluginManifestFile } from "./installed-plugin-index-manifest.js";
1011import type {
1112InstalledPluginIndexRecord,
1213InstalledPluginInstallRecordInfo,
@@ -219,6 +220,40 @@ function normalizePackageChannel(
219220};
220221}
221222223+function hashManifestlessBundleRecord(record: PluginManifestRecord): string {
224+return hashJson({
225+id: record.id,
226+name: record.name,
227+description: record.description,
228+version: record.version,
229+format: record.format,
230+bundleFormat: record.bundleFormat,
231+bundleCapabilities: record.bundleCapabilities ?? [],
232+skills: record.skills ?? [],
233+settingsFiles: record.settingsFiles ?? [],
234+hooks: record.hooks ?? [],
235+});
236+}
237+238+function resolveManifestHash(params: {
239+record: PluginManifestRecord;
240+diagnostics: PluginDiagnostic[];
241+}): string {
242+if (hasOptionalMissingPluginManifestFile(params.record)) {
243+return hashManifestlessBundleRecord(params.record);
244+}
245+const hash = safeHashFile({
246+filePath: params.record.manifestPath,
247+pluginId: params.record.id,
248+diagnostics: params.diagnostics,
249+required: true,
250+});
251+if (hash) {
252+return hash;
253+}
254+return "";
255+}
256+222257function buildCandidateLookup(
223258candidates: readonly PluginCandidate[],
224259): Map<string, PluginCandidate> {
@@ -244,13 +279,7 @@ export function buildInstalledPluginIndexRecords(params: {
244279const installRecord = params.installRecords[record.id];
245280const packageInstall = describePackageInstallSource(candidate);
246281const packageChannel = normalizePackageChannel(candidate?.packageManifest?.channel);
247-const manifestHash =
248-safeHashFile({
249-filePath: record.manifestPath,
250-pluginId: record.id,
251-diagnostics: params.diagnostics,
252-required: true,
253-}) ?? "";
282+const manifestHash = resolveManifestHash({ record, diagnostics: params.diagnostics });
254283const packageJson = resolvePackageJsonRecord({
255284 candidate,
256285 packageJsonPath,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。