Skip to content

PluginDependency

A plugin another plugin cannot work without.

Import:

import type { PluginDependency } from '@mnaoumov/obsidian-lib/components/plugin-gate-component';

Signature:

export interface PluginDependency

Properties

PropertyTypeDescription
apiVersionRangestringThe semver range of API contract versions the dependent compiled against, e.g. '^2'.

A dependency whose published API falls outside the range counts as UNSATISFIED, which is what turns a silent behavioral mismatch between two independently released plugins into a visible "update this one" message. Spell "any version" as '>=0.0.0' — compare-versions rejects a bare *.
minPluginVersion?stringThe oldest release of the required plugin the dependent works with, e.g. '2.2.0'.

For a provider whose BEHAVIOR changed while its API contract stayed the same, which apiVersionRange cannot see. A dependency enabled below it counts as UNSATISFIED and asks the user to update it. Evaluated against manifest.version; a version that cannot be parsed counts as too old. A minimum rather than a range, because the only advice the gate can give is "update it", and an upper bound is a version no update reaches.
pluginIdstringThe manifest.id of the required plugin, as listed in Obsidian's community plugin registry.
pluginNamestringThe display name of the required plugin, shown to the user.
reasonDocumentFragment | stringA localized sentence saying what the dependent does with this plugin, shown in the settings banner.

The dependent owns this string because only it knows what it uses the other plugin for, and a user being asked to install something deserves to be told why.

Pass a DocumentFragment to mark up part of the sentence, such as a plugin name rendered as code. Each render appends a fresh clone of it, since the banner is rendered again on every refresh.

Links to this page: