From 9de9b7f10246afb3cfc8cd4a6531aa3585c9ce6a Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Thu, 10 Oct 2024 01:29:28 +0800 Subject: [PATCH] feat(core)!: remove headers field from page data --- packages/core/src/page/createPage.ts | 1 - packages/core/src/types/page.ts | 12 +++++++++++- packages/core/tests/page/createPage.spec.ts | 1 - packages/shared/src/types/page.ts | 5 ----- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/core/src/page/createPage.ts b/packages/core/src/page/createPage.ts index 2e9946dec2..aed67e2aec 100644 --- a/packages/core/src/page/createPage.ts +++ b/packages/core/src/page/createPage.ts @@ -101,7 +101,6 @@ export const createPage = async ( title, lang, frontmatter, - headers, }, // base fields diff --git a/packages/core/src/types/page.ts b/packages/core/src/types/page.ts index 0532d3d594..ce2cb36e92 100644 --- a/packages/core/src/types/page.ts +++ b/packages/core/src/types/page.ts @@ -1,5 +1,10 @@ import type { MarkdownLink, MarkdownSfcBlocks } from '@vuepress/markdown' -import type { PageBase, PageData, PageFrontmatter } from '@vuepress/shared' +import type { + PageBase, + PageData, + PageFrontmatter, + PageHeader, +} from '@vuepress/shared' /** * Vuepress Page @@ -40,6 +45,11 @@ export type Page< */ deps: string[] + /** + * Headers of the page + */ + headers: PageHeader[] + /** * Links of the page */ diff --git a/packages/core/tests/page/createPage.spec.ts b/packages/core/tests/page/createPage.spec.ts index 313fed3876..bb9bfedeea 100644 --- a/packages/core/tests/page/createPage.spec.ts +++ b/packages/core/tests/page/createPage.spec.ts @@ -34,7 +34,6 @@ describe('should work without plugins', () => { expect(page.data.lang).toBe('en-US') expect(page.data.title).toBe('') expect(page.data.frontmatter).toEqual({}) - expect(page.data.headers).toEqual([]) // base fields expect(page.path).toBe('/') diff --git a/packages/shared/src/types/page.ts b/packages/shared/src/types/page.ts index a1d05f2372..cde6f1e052 100644 --- a/packages/shared/src/types/page.ts +++ b/packages/shared/src/types/page.ts @@ -36,11 +36,6 @@ export interface PageBase< * Front matter of the page */ frontmatter: PageFrontmatter - - /** - * Headers of the page - */ - headers: PageHeader[] } /**