diff --git a/packages/docusaurus-types/src/index.d.ts b/packages/docusaurus-types/src/index.d.ts index 0a875e78e7de..a6cb0b00b483 100644 --- a/packages/docusaurus-types/src/index.d.ts +++ b/packages/docusaurus-types/src/index.d.ts @@ -67,7 +67,6 @@ export { Validate, ValidationSchema, AllContent, - PostBuildProps, RouteBuildMetadata, ConfigureWebpackUtils, PostCssOptions, diff --git a/packages/docusaurus-types/src/plugin.d.ts b/packages/docusaurus-types/src/plugin.d.ts index 9c4f14514557..4a7dceaa23bd 100644 --- a/packages/docusaurus-types/src/plugin.d.ts +++ b/packages/docusaurus-types/src/plugin.d.ts @@ -119,7 +119,7 @@ export type RouteBuildMetadata = { // For now the only need is our sitemap plugin to filter noindex pages noIndex: boolean; }; -export type PostBuildProps = Props & { +export type PostBuildProps = Props & { content: Content; // TODO Docusaurus v4: remove old messy unserializable "head" API @@ -141,7 +141,16 @@ export type Plugin = { allContent: AllContent; actions: PluginContentLoadedActions; }) => Promise | void; - postBuild?: (props: PostBuildProps) => Promise | void; + postBuild?: ( + props: Props & { + content: Content; + // TODO Docusaurus v4: remove old messy unserializable "head" API + // breaking change, replaced by routesBuildMetadata + // Reason: https://github.com/facebook/docusaurus/pull/10826 + head: {[location: string]: HelmetServerState}; + routesBuildMetadata: {[location: string]: RouteBuildMetadata}; + }, + ) => Promise | void; // TODO Docusaurus v4 ? // refactor the configureWebpack API surface: use an object instead of // multiple params (requires breaking change) diff --git a/packages/docusaurus/src/commands/build/buildLocale.ts b/packages/docusaurus/src/commands/build/buildLocale.ts index 05bb095e0581..1e1a2a61bb05 100644 --- a/packages/docusaurus/src/commands/build/buildLocale.ts +++ b/packages/docusaurus/src/commands/build/buildLocale.ts @@ -23,7 +23,6 @@ import type { ConfigureWebpackUtils, LoadedPlugin, Props, - PostBuildProps, } from '@docusaurus/types'; import type {SiteCollectedData} from '../../common'; import {BuildCLIOptions} from './build'; @@ -139,15 +138,12 @@ async function executePluginsPostBuild({ if (!plugin.postBuild) { return; } - - const postBuildProps: PostBuildProps = { + await plugin.postBuild({ ...props, head, routesBuildMetadata, content: plugin.content, - }; - - await plugin.postBuild(postBuildProps); + }); }), ); }