From c3133635cd20944d34e202d880c3003b1a2e9520 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Thu, 28 Apr 2022 16:03:59 +0800 Subject: [PATCH] refactor: remove long-deprecated routesLoaded lifecycle --- packages/docusaurus-types/src/index.d.ts | 1 - packages/docusaurus/src/server/plugins/index.ts | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/packages/docusaurus-types/src/index.d.ts b/packages/docusaurus-types/src/index.d.ts index a3663572b9e0..101f80944366 100644 --- a/packages/docusaurus-types/src/index.d.ts +++ b/packages/docusaurus-types/src/index.d.ts @@ -319,7 +319,6 @@ export type Plugin = { allContent: AllContent; actions: PluginContentLoadedActions; }) => Promise | void; - routesLoaded?: (routes: RouteConfig[]) => void; // TODO remove soon, deprecated (alpha-60) postBuild?: ( props: Props & { content: Content; diff --git a/packages/docusaurus/src/server/plugins/index.ts b/packages/docusaurus/src/server/plugins/index.ts index 82c3a53c89fe..93553d18202d 100644 --- a/packages/docusaurus/src/server/plugins/index.ts +++ b/packages/docusaurus/src/server/plugins/index.ts @@ -19,7 +19,6 @@ import type { } from '@docusaurus/types'; import {initPlugins} from './init'; import {createBootstrapPlugin, createMDXFallbackPlugin} from './synthetic'; -import logger from '@docusaurus/logger'; import _ from 'lodash'; import {localizePluginTranslationFile} from '../translations/translations'; import {applyRouteTrailingSlash, sortConfig} from './routeConfig'; @@ -147,21 +146,6 @@ export async function loadPlugins(context: LoadContext): Promise<{ }), ); - // 4. Plugin Lifecycle - routesLoaded. - await Promise.all( - loadedPlugins.map(async (plugin) => { - if (!plugin.routesLoaded) { - return; - } - - // TODO alpha-60: remove this deprecated lifecycle soon - // 1 user reported usage of this lifecycle: https://github.com/facebook/docusaurus/issues/3918 - logger.error`Plugin code=${'routesLoaded'} lifecycle is deprecated. If you think we should keep this lifecycle, please report here: url=${'https://github.com/facebook/docusaurus/issues/3918'}`; - - await plugin.routesLoaded(pluginsRouteConfigs); - }), - ); - // Sort the route config. This ensures that route with nested // routes are always placed last. sortConfig(pluginsRouteConfigs, context.siteConfig.baseUrl);