Files
orca/src/shared/plugins/installation/plugin-host-version.ts
T
Neil 8e61c440df plugins: derive the publisher from where a plugin comes from, like a Go module path (#36281)
The manifest publisher is deprecated and ignored for catalog and Git installs:
catalog installs use the listing id, Git URL installs the URL owner, folders
'local' (or their still-declared publisher). Existing installs keep their key.
A format 2 manifest may omit publisher only with engines.orca >=1.4.246, so
older Orca reports 'requires Orca X' instead of failing to parse it. The v2
catalog documents an optional ownerId, which older Orca already strips.
2026-10-30 00:45:00 -07:00

27 lines
1.1 KiB
TypeScript

import { satisfiesOrcaEngineRange } from '../manifest/plugin-manifest-engine-range'
import {
PLUGIN_DERIVED_PUBLISHER_SINCE,
PLUGIN_MANIFEST_V2_SINCE,
PLUGIN_SCHEMA_SINCE_V1
} from '../manifest/plugin-schema-field-docs'
/** The newest "since" this build's schemas cite: everything up to it is readable here. */
export const PLUGIN_SCHEMA_NEWEST_SINCE = [
PLUGIN_SCHEMA_SINCE_V1,
PLUGIN_MANIFEST_V2_SINCE,
PLUGIN_DERIVED_PUBLISHER_SINCE
].reduce((newest, version) => (satisfiesOrcaEngineRange(version, `>=${newest}`) ? version : newest))
/**
* The version plugins are gated against. Why not the app version alone: development and local
* builds keep the package version of the last version bump while already reading every field
* their schemas define, so a plugin correctly declaring `>=<newest since>` would be refused by
* the build that introduced the field. Releases are at or past that version, so this changes
* nothing for them.
*/
export function pluginHostVersion(appVersion: string): string {
return satisfiesOrcaEngineRange(appVersion, `>=${PLUGIN_SCHEMA_NEWEST_SINCE}`)
? appVersion
: PLUGIN_SCHEMA_NEWEST_SINCE
}