Skip to content

Commit 56325ef

Browse files
authored
chore: mark the plugin API as experimental (#16276)
Marking the Plugin API as experimental in both docs and types, previously it was internal.
1 parent ac4fc31 commit 56325ef

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

docs/plugins/plugin-api.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ Payload's plugin system is built around a simple contract: a plugin is a functio
1010

1111
This page covers the advanced plugin API that makes plugins more powerful: execution ordering via `order`, typed cross-plugin communication via `RegisteredPlugins`, and the `definePlugin` helper that ties it all together.
1212

13-
<Banner type="info">
14-
The API on this page is marked `@internal` while we finalize the design. It is
15-
safe to use across Payload's own plugins, but the surface may change before
16-
being declared stable.
13+
<Banner type="warning">
14+
The API on this page is **experimental**. It is safe to use across Payload's
15+
own plugins, but the surface may change before being declared stable.
1716
</Banner>
1817

1918
## The basics still work

packages/payload/src/config/definePlugin.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ function buildPluginsMap(plugins: Plugin[] | undefined): PluginsMap {
1919
* The `plugin` function receives a single object containing `config`, `plugins`
2020
* (a slug-keyed map of other plugins), and any user-provided options spread in.
2121
*
22+
* @experimental
23+
*
2224
* @example
2325
* // With options:
2426
* export const seoPlugin = definePlugin<SEOPluginOptions>({

packages/payload/src/config/types.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,23 @@ type Prettify<T> = {
144144
[K in keyof T]: T[K]
145145
} & NonNullable<unknown>
146146

147+
/**
148+
* @experimental The plugin API (`order`, `slug`, `options`) may change before being declared stable.
149+
*/
147150
export type Plugin = ((config: Config) => Config | Promise<Config>) & {
148-
/** @internal Plugin options exposed for cross-plugin mutation. */
151+
/** @experimental Plugin options exposed for cross-plugin mutation. */
149152
options?: Record<string, unknown>
150-
/** @internal Execution order - lower values run first. Defaults to 0. */
153+
/** @experimental Execution order - lower values run first. Defaults to 0. */
151154
order?: number
152-
/** @internal Unique identifier for cross-plugin discovery via `config.plugins`. */
155+
/** @experimental Unique identifier for cross-plugin discovery via `config.plugins`. */
153156
slug?: string
154157
}
155158

156159
/**
157160
* A map of plugin slugs to Plugin instances, built from `config.plugins`.
158161
* Registered slugs (via `RegisteredPlugins` module augmentation) return typed options.
162+
*
163+
* @experimental
159164
*/
160165
export type PluginsMap = {
161166
[K in keyof RegisteredPlugins]: ({ options: RegisteredPlugins[K] } & Plugin) | undefined

packages/payload/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ export interface GeneratedTypes {}
271271
* Maps plugin slug to plugin options type, enabling typed cross-plugin
272272
* discovery via the `plugins` map passed to `definePlugin` functions.
273273
*
274+
* @experimental
275+
*
274276
* @example
275277
* // In a plugin package's index.ts:
276278
* declare module 'payload' {

0 commit comments

Comments
 (0)