diff --git a/packages/docusaurus/src/client/serverEntry.tsx b/packages/docusaurus/src/client/serverEntry.tsx index 4e5c4f83e24b..53a3b149ae65 100644 --- a/packages/docusaurus/src/client/serverEntry.tsx +++ b/packages/docusaurus/src/client/serverEntry.tsx @@ -16,7 +16,7 @@ import { createStatefulBrokenLinks, BrokenLinksProvider, } from './BrokenLinksContext'; -import type {PageCollectedData, AppRenderer} from '../types'; +import type {PageCollectedData, AppRenderer} from '../common'; function buildSSRErrorMessage({ error, diff --git a/packages/docusaurus/src/commands/build.ts b/packages/docusaurus/src/commands/build.ts index 5e66e1dd4a6a..357ef95ff38e 100644 --- a/packages/docusaurus/src/commands/build.ts +++ b/packages/docusaurus/src/commands/build.ts @@ -29,7 +29,7 @@ import defaultSSRTemplate from '../templates/ssr.html.template'; import type {Manifest} from 'react-loadable-ssr-addon-v5-slorber'; import type {LoadedPlugin, Props} from '@docusaurus/types'; -import type {SiteCollectedData} from '../types'; +import type {SiteCollectedData} from '../common'; export type BuildCLIOptions = Pick< LoadContextOptions, diff --git a/packages/docusaurus/src/types.d.ts b/packages/docusaurus/src/common.d.ts similarity index 60% rename from packages/docusaurus/src/types.d.ts rename to packages/docusaurus/src/common.d.ts index 7c950b874604..e7a09e61b82e 100644 --- a/packages/docusaurus/src/types.d.ts +++ b/packages/docusaurus/src/common.d.ts @@ -5,22 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -import type {HelmetServerState} from 'react-helmet-async'; -import type {Manifest} from 'react-loadable-ssr-addon-v5-slorber'; -import type {SSRTemplateCompiled} from './templates/templates'; +// This file is for types that are common between client/server +// In particular the interface between SSG and serverEntry code -export type SSGParams = { - trailingSlash: boolean | undefined; - manifest: Manifest; - headTags: string; - preBodyTags: string; - postBodyTags: string; - outDir: string; - baseUrl: string; - noIndex: boolean; - DOCUSAURUS_VERSION: string; - ssrTemplate: SSRTemplateCompiled; -}; +import type {HelmetServerState} from 'react-helmet-async'; export type AppRenderResult = { html: string; diff --git a/packages/docusaurus/src/ssg.ts b/packages/docusaurus/src/ssg.ts index 15358555abef..2f8f84067a30 100644 --- a/packages/docusaurus/src/ssg.ts +++ b/packages/docusaurus/src/ssg.ts @@ -13,12 +13,23 @@ import pMap from 'p-map'; import {minify} from 'html-minifier-terser'; import {PerfLogger} from './utils'; import {renderSSRTemplate} from './templates/templates'; -import type { - AppRenderer, - AppRenderResult, - SiteCollectedData, - SSGParams, -} from './types'; +import type {AppRenderer, AppRenderResult, SiteCollectedData} from './common'; + +import type {Manifest} from 'react-loadable-ssr-addon-v5-slorber'; +import type {SSRTemplateCompiled} from './templates/templates'; + +export type SSGParams = { + trailingSlash: boolean | undefined; + manifest: Manifest; + headTags: string; + preBodyTags: string; + postBodyTags: string; + outDir: string; + baseUrl: string; + noIndex: boolean; + DOCUSAURUS_VERSION: string; + ssrTemplate: SSRTemplateCompiled; +}; // Secret way to set SSR plugin concurrency option // Waiting for feedback before documenting this officially? diff --git a/packages/docusaurus/src/templates/templates.ts b/packages/docusaurus/src/templates/templates.ts index ae62a8a7e724..ee59c9d38360 100644 --- a/packages/docusaurus/src/templates/templates.ts +++ b/packages/docusaurus/src/templates/templates.ts @@ -7,7 +7,8 @@ import * as eta from 'eta'; import {getBundles} from 'react-loadable-ssr-addon-v5-slorber'; -import type {SSGParams, AppRenderResult} from '../types'; +import type {SSGParams} from '../ssg'; +import type {AppRenderResult} from '../common'; import type {Manifest} from 'react-loadable-ssr-addon-v5-slorber'; // TODO this is historical server template data