# Plugin Dependencies
URL: https://pro.rv-grid.com/api/plugin-dependencies/
Source: src/content/docs/api/plugin-dependencies.md
### `ensurePlugin`

Return an existing plugin instance by class, or create and register one.

Use this for auto-installed plugin dependencies so host-provided plugin
instances are reused and duplicate runtime plugins are not added.

```ts
export function ensurePlugin<T extends PluginBaseComponent>(
  providers: PluginProviders,
  pluginClass: RuntimePluginConstructor & (new (...args: any[]) => T),
  createPlugin: () => T,
): T;
```

---

### `PluginDependencyKind`

```ts
export type PluginDependencyKind =
  | 'required'
  | 'optional'
  | 'auto-installed'
  | 'event-integration'
  | 'config-integration'
  | 'ordering';
```

---

### `PluginDependencyPluginConstructor`

```ts
export type PluginDependencyPluginConstructor = abstract new (...args: any[]) => unknown;
```

---

### `PluginDependencyPluginRef`

```ts
export type PluginDependencyPluginRef =
  | PluginDependencyPluginConstructor
  | (() => PluginDependencyPluginConstructor);
```

---

### `PluginDependencyContract`

```ts
export type PluginDependencyContract =
  | 'aggregators'
  | 'auto-size-column'
  | 'column-types'
  | 'core-grouping'
  | 'direct-event-manager-config'
  | 'direct-history-config'
  | 'filtering'
  | 'direct-pagination-config'
  | 'direct-pivot-config'
  | 'direct-tree-config'
  | 'gantt-runtime'
  | 'json-clipboard'
  | 'overlay-producer'
  | 'pagination-capable-plugin'
  | 'pro-plugin-infrastructure'
  | 'pro-ui'
  | 'row-order'
  | 'row-select'
  | 'sorting-capable-plugin'
  | 'tree-data';
```

---

### `PluginDependencyAdditionalDataKey` (Extended from `index.ts`)

```ts
export type PluginDependencyAdditionalDataKey = keyof AdditionalData & string;
```

---

### `PluginDependencyTarget`

```ts
export type PluginDependencyTarget =
  | {
    readonly type: 'plugin';
    readonly plugin: PluginDependencyPluginRef;
  }
  | {
    readonly type: 'plugins';
    readonly plugins: readonly PluginDependencyPluginRef[];
    readonly mode?: 'all' | 'one-of';
  }
  | {
    readonly type: 'additionalData';
    readonly key: PluginDependencyAdditionalDataKey;
    readonly path?: readonly string[];
  }
  | {
    readonly type: 'event';
    readonly event: keyof HTMLRevoGridElementEventMap & string;
  }
  | {
    readonly type: 'events';
    readonly events: readonly (keyof HTMLRevoGridElementEventMap & string)[];
  }
  | {
    readonly type: 'contract';
    readonly contract: PluginDependencyContract;
  }
  | {
    readonly type: 'property';
    readonly property: keyof HTMLRevoGridElement & string;
    readonly path?: readonly string[];
  }
  | {
    readonly type: 'ordering';
    readonly relativeTo: 'other-grid-plugins';
    readonly position: 'before' | 'after';
  };
```

---

### `PluginDependency`

```ts
interface PluginDependency {
  kind: PluginDependencyKind;
  target: PluginDependencyTarget | readonly PluginDependencyTarget[];
  description: string
}
```

---

### `warnRequiredPluginDependencies`

Warns when required plugin class dependencies are missing.

Metadata remains descriptive: this does not auto-install, reorder, or block plugin execution.

```ts
warnRequiredPluginDependencies: (plugin: unknown, providers: PluginProviders, dependencies?: readonly PluginDependency[] | undefined) => void;
```
