From 5709c57daef1724cd455865f0c56e619086ffb0e Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Fri, 13 Sep 2024 01:53:31 +0800 Subject: [PATCH 1/2] refactor(core): improve comments --- e2e/docs/.vuepress/plugins/foo/fooPlugin.ts | 3 +- packages/core/src/app/appInit.ts | 2 + packages/core/src/app/appPrepare.ts | 2 + packages/core/src/app/appUse.ts | 7 ++ packages/core/src/app/createBaseApp.ts | 6 +- packages/core/src/app/createBuildApp.ts | 2 +- packages/core/src/app/createDevApp.ts | 2 +- .../src/app/prepare/prepareClientConfigs.ts | 2 + .../core/src/app/prepare/prepareSiteData.ts | 2 + packages/core/src/app/resolveAppDir.ts | 2 + packages/core/src/app/resolveAppEnv.ts | 2 + packages/core/src/app/resolveAppMarkdown.ts | 2 + packages/core/src/app/resolveAppOptions.ts | 2 + packages/core/src/app/resolveAppPages.ts | 2 + packages/core/src/app/resolveAppSiteData.ts | 2 + packages/core/src/app/resolveAppVersion.ts | 2 + packages/core/src/app/resolveAppWriteTemp.ts | 2 + packages/core/src/app/resolvePluginObject.ts | 2 + packages/core/src/app/resolveThemeInfo.ts | 2 + .../core/src/app/setupAppThemeAndPlugins.ts | 2 + packages/core/src/page/createPage.ts | 3 + packages/core/src/page/inferPagePath.ts | 2 + packages/core/src/page/parsePageContent.ts | 2 + .../core/src/page/renderPageSfcBlocksToVue.ts | 2 + .../core/src/page/resolvePageChunkInfo.ts | 2 + .../core/src/page/resolvePageComponentInfo.ts | 2 + packages/core/src/page/resolvePageContent.ts | 2 + packages/core/src/page/resolvePageDate.ts | 2 + packages/core/src/page/resolvePageFilePath.ts | 2 + packages/core/src/page/resolvePageHtmlInfo.ts | 2 + packages/core/src/page/resolvePageLang.ts | 2 + packages/core/src/page/resolvePagePath.ts | 2 + .../core/src/page/resolvePagePermalink.ts | 2 + .../core/src/page/resolvePageRouteMeta.ts | 2 + packages/core/src/page/resolvePageSlug.ts | 2 + .../core/src/pluginApi/createHookQueue.ts | 2 + .../core/src/pluginApi/createPluginApi.ts | 5 ++ .../src/pluginApi/createPluginApiHooks.ts | 5 ++ .../pluginApi/createPluginApiRegisterHooks.ts | 5 ++ .../src/pluginApi/normalizeAliasDefineHook.ts | 2 + .../normalizeClientConfigFileHook.ts | 2 + packages/core/src/types/app/options.ts | 90 ++++++++++++++++++- packages/core/src/types/app/utils.ts | 23 +++++ packages/core/src/types/bundler.ts | 11 +++ packages/core/src/types/plugin.ts | 8 +- 45 files changed, 225 insertions(+), 9 deletions(-) diff --git a/e2e/docs/.vuepress/plugins/foo/fooPlugin.ts b/e2e/docs/.vuepress/plugins/foo/fooPlugin.ts index 93ef0c8cff..a6031278ff 100644 --- a/e2e/docs/.vuepress/plugins/foo/fooPlugin.ts +++ b/e2e/docs/.vuepress/plugins/foo/fooPlugin.ts @@ -1,8 +1,9 @@ +import type { Plugin } from 'vuepress/core' import { getDirname, path } from 'vuepress/utils' const __dirname = getDirname(import.meta.url) -export const fooPlugin = { +export const fooPlugin: Plugin = { name: 'test-plugin', clientConfigFile: path.resolve( __dirname, diff --git a/packages/core/src/app/appInit.ts b/packages/core/src/app/appInit.ts index 1db287fd28..95ce110178 100644 --- a/packages/core/src/app/appInit.ts +++ b/packages/core/src/app/appInit.ts @@ -9,6 +9,8 @@ const log = debug('vuepress:core/app') * Initialize a vuepress app * * Plugins should be used before initialization. + * + * @internal */ export const appInit = async (app: App): Promise => { log('init start') diff --git a/packages/core/src/app/appPrepare.ts b/packages/core/src/app/appPrepare.ts index f8d2585f50..15dd6986b7 100644 --- a/packages/core/src/app/appPrepare.ts +++ b/packages/core/src/app/appPrepare.ts @@ -18,6 +18,8 @@ const log = debug('vuepress:core/app') * - routes * - site data * - other files that generated by plugins + * + * @internal */ export const appPrepare = async (app: App): Promise => { log('prepare start') diff --git a/packages/core/src/app/appUse.ts b/packages/core/src/app/appUse.ts index df53e43cab..9c98443a39 100644 --- a/packages/core/src/app/appUse.ts +++ b/packages/core/src/app/appUse.ts @@ -4,6 +4,13 @@ import { resolvePluginObject } from './resolvePluginObject.js' const log = debug('vuepress:core/app') +/** + * Use a plugin in vuepress app. + * + * Should be called before initialization. + * + * @internal + */ export const appUse = (app: App, rawPlugin: Plugin): App => { const pluginObject = resolvePluginObject(app, rawPlugin) diff --git a/packages/core/src/app/createBaseApp.ts b/packages/core/src/app/createBaseApp.ts index dc2b2ecaf4..dc8b18750d 100644 --- a/packages/core/src/app/createBaseApp.ts +++ b/packages/core/src/app/createBaseApp.ts @@ -17,7 +17,11 @@ import { resolveAppWriteTemp } from './resolveAppWriteTemp.js' import { setupAppThemeAndPlugins } from './setupAppThemeAndPlugins.js' /** - * Create vuepress app + * Create base vuepress app. + * + * Notice that the base app could not be used for dev nor build. + * + * It would be used for creating dev app or build app, or for testing. */ export const createBaseApp = (config: AppConfig): App => { const options = resolveAppOptions(config) diff --git a/packages/core/src/app/createBuildApp.ts b/packages/core/src/app/createBuildApp.ts index 2bc29eddff..13e1651b8e 100644 --- a/packages/core/src/app/createBuildApp.ts +++ b/packages/core/src/app/createBuildApp.ts @@ -2,7 +2,7 @@ import type { AppConfig, BuildApp } from '../types/index.js' import { createBaseApp } from './createBaseApp.js' /** - * Create vuepress build app + * Create vuepress build app. */ export const createBuildApp = (config: AppConfig): BuildApp => { const app = createBaseApp(config) as BuildApp diff --git a/packages/core/src/app/createDevApp.ts b/packages/core/src/app/createDevApp.ts index 3a0f4003e6..3d21ea35ed 100644 --- a/packages/core/src/app/createDevApp.ts +++ b/packages/core/src/app/createDevApp.ts @@ -2,7 +2,7 @@ import type { AppConfig, DevApp } from '../types/index.js' import { createBaseApp } from './createBaseApp.js' /** - * Create vuepress dev app + * Create vuepress dev app. */ export const createDevApp = (config: AppConfig): DevApp => { const app = createBaseApp(config) as DevApp diff --git a/packages/core/src/app/prepare/prepareClientConfigs.ts b/packages/core/src/app/prepare/prepareClientConfigs.ts index 59bb1f5624..4636bd5556 100644 --- a/packages/core/src/app/prepare/prepareClientConfigs.ts +++ b/packages/core/src/app/prepare/prepareClientConfigs.ts @@ -2,6 +2,8 @@ import type { App } from '../../types/index.js' /** * Generate client configs temp file + * + * @internal */ export const prepareClientConfigs = async (app: App): Promise => { // plugin hook: clientConfigFile diff --git a/packages/core/src/app/prepare/prepareSiteData.ts b/packages/core/src/app/prepare/prepareSiteData.ts index c2749c0dc2..7121e72845 100644 --- a/packages/core/src/app/prepare/prepareSiteData.ts +++ b/packages/core/src/app/prepare/prepareSiteData.ts @@ -17,6 +17,8 @@ if (import.meta.hot) { /** * Generate site data temp file + * + * @internal */ export const prepareSiteData = async (app: App): Promise => { let content = `\ diff --git a/packages/core/src/app/resolveAppDir.ts b/packages/core/src/app/resolveAppDir.ts index 5e78b9d344..18819dca9d 100644 --- a/packages/core/src/app/resolveAppDir.ts +++ b/packages/core/src/app/resolveAppDir.ts @@ -6,6 +6,8 @@ const require = createRequire(import.meta.url) /** * Create directory util function + * + * @internal */ export const createAppDirFunction = (baseDir: string): AppDirFunction => diff --git a/packages/core/src/app/resolveAppEnv.ts b/packages/core/src/app/resolveAppEnv.ts index 7ec4bf96c0..d0b069c6a4 100644 --- a/packages/core/src/app/resolveAppEnv.ts +++ b/packages/core/src/app/resolveAppEnv.ts @@ -2,6 +2,8 @@ import type { AppEnv, AppOptions } from '../types/index.js' /** * Resolve environment flags for vuepress app + * + * @internal */ export const resolveAppEnv = (options: AppOptions): AppEnv => ({ isBuild: false, diff --git a/packages/core/src/app/resolveAppMarkdown.ts b/packages/core/src/app/resolveAppMarkdown.ts index 84ce7d0a1a..d3b35b4ef2 100644 --- a/packages/core/src/app/resolveAppMarkdown.ts +++ b/packages/core/src/app/resolveAppMarkdown.ts @@ -4,6 +4,8 @@ import type { App } from '../types/index.js' /** * Resolve markdown-it instance for vuepress app + * + * @internal */ export const resolveAppMarkdown = async (app: App): Promise => { // plugin hook: extendsMarkdownOptions diff --git a/packages/core/src/app/resolveAppOptions.ts b/packages/core/src/app/resolveAppOptions.ts index 63b9379962..756227ffe5 100644 --- a/packages/core/src/app/resolveAppOptions.ts +++ b/packages/core/src/app/resolveAppOptions.ts @@ -6,6 +6,8 @@ const require = createRequire(import.meta.url) /** * Create app options with default values + * + * @internal */ export const resolveAppOptions = ({ // site config diff --git a/packages/core/src/app/resolveAppPages.ts b/packages/core/src/app/resolveAppPages.ts index d8cd00bd41..51ed100308 100644 --- a/packages/core/src/app/resolveAppPages.ts +++ b/packages/core/src/app/resolveAppPages.ts @@ -6,6 +6,8 @@ const log = debug('vuepress:core/app') /** * Resolve pages for vuepress app + * + * @internal */ export const resolveAppPages = async (app: App): Promise => { log('resolveAppPages start') diff --git a/packages/core/src/app/resolveAppSiteData.ts b/packages/core/src/app/resolveAppSiteData.ts index 9f2b654e3e..bc37720131 100644 --- a/packages/core/src/app/resolveAppSiteData.ts +++ b/packages/core/src/app/resolveAppSiteData.ts @@ -4,6 +4,8 @@ import type { AppOptions, SiteData } from '../types/index.js' * Resolve site data for vuepress app * * Site data will also be used in client + * + * @internal */ export const resolveAppSiteData = (options: AppOptions): SiteData => ({ base: options.base, diff --git a/packages/core/src/app/resolveAppVersion.ts b/packages/core/src/app/resolveAppVersion.ts index 590340ffc4..5f356432a3 100644 --- a/packages/core/src/app/resolveAppVersion.ts +++ b/packages/core/src/app/resolveAppVersion.ts @@ -5,6 +5,8 @@ const require = createRequire(import.meta.url) /** * Resolve version of vuepress app + * + * @internal */ export const resolveAppVersion = (): string => { const pkgJson = fs.readJsonSync( diff --git a/packages/core/src/app/resolveAppWriteTemp.ts b/packages/core/src/app/resolveAppWriteTemp.ts index f4e3b6c7d5..2a3560f072 100644 --- a/packages/core/src/app/resolveAppWriteTemp.ts +++ b/packages/core/src/app/resolveAppWriteTemp.ts @@ -3,6 +3,8 @@ import type { AppDir, AppWriteTemp } from '../types/index.js' /** * Resolve write temp file util for vuepress app + * + * @internal */ export const resolveAppWriteTemp = (dir: AppDir): AppWriteTemp => { const writeTemp: AppWriteTemp = async (file: string, content: string) => { diff --git a/packages/core/src/app/resolvePluginObject.ts b/packages/core/src/app/resolvePluginObject.ts index 8ccdd72aaa..4636f48ac0 100644 --- a/packages/core/src/app/resolvePluginObject.ts +++ b/packages/core/src/app/resolvePluginObject.ts @@ -3,6 +3,8 @@ import type { App, Plugin, PluginObject } from '../types/index.js' /** * Resolve a plugin object according to name / path / module and config + * + * @internal */ export const resolvePluginObject = ( app: App, diff --git a/packages/core/src/app/resolveThemeInfo.ts b/packages/core/src/app/resolveThemeInfo.ts index 34e9ff3b0d..b16c371429 100644 --- a/packages/core/src/app/resolveThemeInfo.ts +++ b/packages/core/src/app/resolveThemeInfo.ts @@ -3,6 +3,8 @@ import { resolvePluginObject } from './resolvePluginObject.js' /** * Resolve theme info and its parent theme info + * + * @internal */ export const resolveThemeInfo = (app: App, theme: Theme): ThemeInfo => { // resolve current theme info diff --git a/packages/core/src/app/setupAppThemeAndPlugins.ts b/packages/core/src/app/setupAppThemeAndPlugins.ts index f28c9f04e7..39aceda92b 100644 --- a/packages/core/src/app/setupAppThemeAndPlugins.ts +++ b/packages/core/src/app/setupAppThemeAndPlugins.ts @@ -3,6 +3,8 @@ import { resolveThemeInfo } from './resolveThemeInfo.js' /** * Setup theme and plugins for vuepress app + * + * @internal */ export const setupAppThemeAndPlugins = (app: App, config: AppConfig): void => { // recursively resolve theme info diff --git a/packages/core/src/page/createPage.ts b/packages/core/src/page/createPage.ts index 600d60d63d..2e9946dec2 100644 --- a/packages/core/src/page/createPage.ts +++ b/packages/core/src/page/createPage.ts @@ -13,6 +13,9 @@ import { resolvePagePermalink } from './resolvePagePermalink.js' import { resolvePageRouteMeta } from './resolvePageRouteMeta.js' import { resolvePageSlug } from './resolvePageSlug.js' +/** + * Create vuepress page object + */ export const createPage = async ( app: App, options: PageOptions, diff --git a/packages/core/src/page/inferPagePath.ts b/packages/core/src/page/inferPagePath.ts index 8d082ea93c..2a406c7b66 100644 --- a/packages/core/src/page/inferPagePath.ts +++ b/packages/core/src/page/inferPagePath.ts @@ -7,6 +7,8 @@ import type { App } from '../types/index.js' /** * Infer page path according to file path + * + * @internal */ export const inferPagePath = ({ app, diff --git a/packages/core/src/page/parsePageContent.ts b/packages/core/src/page/parsePageContent.ts index 8af9d92b96..03e036a87e 100644 --- a/packages/core/src/page/parsePageContent.ts +++ b/packages/core/src/page/parsePageContent.ts @@ -9,6 +9,8 @@ import type { App, PageFrontmatter, PageOptions } from '../types/index.js' /** * Render page content and extract related info + * + * @internal */ export const parsePageContent = ({ app, diff --git a/packages/core/src/page/renderPageSfcBlocksToVue.ts b/packages/core/src/page/renderPageSfcBlocksToVue.ts index 7428643823..79f15e92ca 100644 --- a/packages/core/src/page/renderPageSfcBlocksToVue.ts +++ b/packages/core/src/page/renderPageSfcBlocksToVue.ts @@ -2,6 +2,8 @@ import type { MarkdownSfcBlocks } from '@vuepress/markdown' /** * Render page sfc blocks to vue component + * + * @internal */ export const renderPageSfcBlocksToVue = ( sfcBlocks: MarkdownSfcBlocks, diff --git a/packages/core/src/page/resolvePageChunkInfo.ts b/packages/core/src/page/resolvePageChunkInfo.ts index 037018c6cc..0d5c6b994f 100644 --- a/packages/core/src/page/resolvePageChunkInfo.ts +++ b/packages/core/src/page/resolvePageChunkInfo.ts @@ -3,6 +3,8 @@ import type { App } from '../types/index.js' /** * Resolve page data file path + * + * @internal */ export const resolvePageChunkInfo = ({ app, diff --git a/packages/core/src/page/resolvePageComponentInfo.ts b/packages/core/src/page/resolvePageComponentInfo.ts index b1ee312cc4..1e5d4d6156 100644 --- a/packages/core/src/page/resolvePageComponentInfo.ts +++ b/packages/core/src/page/resolvePageComponentInfo.ts @@ -3,6 +3,8 @@ import type { App } from '../types/index.js' /** * Resolve page component and related info + * + * @internal */ export const resolvePageComponentInfo = ({ app, diff --git a/packages/core/src/page/resolvePageContent.ts b/packages/core/src/page/resolvePageContent.ts index c4bda0732b..51a1aa3ab2 100644 --- a/packages/core/src/page/resolvePageContent.ts +++ b/packages/core/src/page/resolvePageContent.ts @@ -9,6 +9,8 @@ const FALLBACK_CONTENT = '' /** * Resolve page content according to `content` or `filePath` + * + * @internal */ export const resolvePageContent = async ({ filePath, diff --git a/packages/core/src/page/resolvePageDate.ts b/packages/core/src/page/resolvePageDate.ts index d371062f68..f9b2d5312c 100644 --- a/packages/core/src/page/resolvePageDate.ts +++ b/packages/core/src/page/resolvePageDate.ts @@ -10,6 +10,8 @@ const DEFAULT_DATE = '0000-00-00' * Resolve page date according to frontmatter or file path * * It will be resolved as 'yyyy-MM-dd' format + * + * @internal */ export const resolvePageDate = ({ frontmatter, diff --git a/packages/core/src/page/resolvePageFilePath.ts b/packages/core/src/page/resolvePageFilePath.ts index ee5a1b01ed..32d34e23a5 100644 --- a/packages/core/src/page/resolvePageFilePath.ts +++ b/packages/core/src/page/resolvePageFilePath.ts @@ -3,6 +3,8 @@ import type { App, PageOptions } from '../types/index.js' /** * Resolve absolute and relative path of page file + * + * @internal */ export const resolvePageFilePath = ({ app, diff --git a/packages/core/src/page/resolvePageHtmlInfo.ts b/packages/core/src/page/resolvePageHtmlInfo.ts index 677921ed04..0417e4edbe 100644 --- a/packages/core/src/page/resolvePageHtmlInfo.ts +++ b/packages/core/src/page/resolvePageHtmlInfo.ts @@ -3,6 +3,8 @@ import type { App } from '../types/index.js' /** * Resolve page rendered html file path + * + * @internal */ export const resolvePageHtmlInfo = ({ app, diff --git a/packages/core/src/page/resolvePageLang.ts b/packages/core/src/page/resolvePageLang.ts index 3f2f243256..d0774e871c 100644 --- a/packages/core/src/page/resolvePageLang.ts +++ b/packages/core/src/page/resolvePageLang.ts @@ -3,6 +3,8 @@ import type { App, PageFrontmatter } from '../types/index.js' /** * Resolve language of page + * + * @internal */ export const resolvePageLang = ({ app, diff --git a/packages/core/src/page/resolvePagePath.ts b/packages/core/src/page/resolvePagePath.ts index c40e366455..0edac439de 100644 --- a/packages/core/src/page/resolvePagePath.ts +++ b/packages/core/src/page/resolvePagePath.ts @@ -3,6 +3,8 @@ import type { PageOptions } from '../types/index.js' /** * Resolve the final route path of a page + * + * @internal */ export const resolvePagePath = ({ permalink, diff --git a/packages/core/src/page/resolvePagePermalink.ts b/packages/core/src/page/resolvePagePermalink.ts index 15a421dec1..4b62c069f7 100644 --- a/packages/core/src/page/resolvePagePermalink.ts +++ b/packages/core/src/page/resolvePagePermalink.ts @@ -4,6 +4,8 @@ import type { App, PageFrontmatter } from '../types/index.js' /** * Resolve page permalink from frontmatter / options / pattern + * + * @internal */ export const resolvePagePermalink = ({ app, diff --git a/packages/core/src/page/resolvePageRouteMeta.ts b/packages/core/src/page/resolvePageRouteMeta.ts index 76e5030a91..fa66e39d36 100644 --- a/packages/core/src/page/resolvePageRouteMeta.ts +++ b/packages/core/src/page/resolvePageRouteMeta.ts @@ -2,6 +2,8 @@ import type { PageFrontmatter } from '../types/index.js' /** * Resolve page route meta + * + * @internal */ export const resolvePageRouteMeta = ({ frontmatter, diff --git a/packages/core/src/page/resolvePageSlug.ts b/packages/core/src/page/resolvePageSlug.ts index a7329ffbaa..f9c3704571 100644 --- a/packages/core/src/page/resolvePageSlug.ts +++ b/packages/core/src/page/resolvePageSlug.ts @@ -4,6 +4,8 @@ const DATE_RE = /(\d{4}-\d{1,2}(-\d{1,2})?)-(.*)/ /** * Resolve page slug from filename + * + * @internal */ export const resolvePageSlug = ({ filePathRelative, diff --git a/packages/core/src/pluginApi/createHookQueue.ts b/packages/core/src/pluginApi/createHookQueue.ts index 09331eee3e..9fb70cc9ad 100644 --- a/packages/core/src/pluginApi/createHookQueue.ts +++ b/packages/core/src/pluginApi/createHookQueue.ts @@ -10,6 +10,8 @@ const log = debug('vuepress:core/plugin-api') /** * Create hook queue for plugin system + * + * @internal */ export const createHookQueue = (name: T): HookQueue => { const items: HookItem[] = [] diff --git a/packages/core/src/pluginApi/createPluginApi.ts b/packages/core/src/pluginApi/createPluginApi.ts index 4f90cda435..18aa270ed7 100644 --- a/packages/core/src/pluginApi/createPluginApi.ts +++ b/packages/core/src/pluginApi/createPluginApi.ts @@ -2,6 +2,11 @@ import type { PluginApi } from '../types/index.js' import { createPluginApiHooks } from './createPluginApiHooks.js' import { createPluginApiRegisterHooks } from './createPluginApiRegisterHooks.js' +/** + * Create vuepress plugin api + * + * @internal + */ export const createPluginApi = (): PluginApi => { const plugins: PluginApi['plugins'] = [] const hooks = createPluginApiHooks() diff --git a/packages/core/src/pluginApi/createPluginApiHooks.ts b/packages/core/src/pluginApi/createPluginApiHooks.ts index 0cefc33067..d8369985bb 100644 --- a/packages/core/src/pluginApi/createPluginApiHooks.ts +++ b/packages/core/src/pluginApi/createPluginApiHooks.ts @@ -1,6 +1,11 @@ import type { PluginApi } from '../types/index.js' import { createHookQueue } from './createHookQueue.js' +/** + * Create hooks for plugin api + * + * @internal + */ export const createPluginApiHooks = (): PluginApi['hooks'] => ({ // life cycle hooks onInitialized: createHookQueue('onInitialized'), diff --git a/packages/core/src/pluginApi/createPluginApiRegisterHooks.ts b/packages/core/src/pluginApi/createPluginApiRegisterHooks.ts index 79ee344016..22c94c4a01 100644 --- a/packages/core/src/pluginApi/createPluginApiRegisterHooks.ts +++ b/packages/core/src/pluginApi/createPluginApiRegisterHooks.ts @@ -2,6 +2,11 @@ import type { PluginApi } from '../types/index.js' import { normalizeAliasDefineHook } from './normalizeAliasDefineHook.js' import { normalizeClientConfigFileHook } from './normalizeClientConfigFileHook.js' +/** + * Create registerHooks method for plugin api + * + * @internal + */ export const createPluginApiRegisterHooks = ( plugins: PluginApi['plugins'], diff --git a/packages/core/src/pluginApi/normalizeAliasDefineHook.ts b/packages/core/src/pluginApi/normalizeAliasDefineHook.ts index 6c3da1a21b..1b12ac361b 100644 --- a/packages/core/src/pluginApi/normalizeAliasDefineHook.ts +++ b/packages/core/src/pluginApi/normalizeAliasDefineHook.ts @@ -3,6 +3,8 @@ import type { AliasDefineHook } from '../types/index.js' /** * Normalize alias and define hook + * + * @internal */ export const normalizeAliasDefineHook = (hook: AliasDefineHook['exposed']): AliasDefineHook['normalized'] => diff --git a/packages/core/src/pluginApi/normalizeClientConfigFileHook.ts b/packages/core/src/pluginApi/normalizeClientConfigFileHook.ts index bba349702c..a6475852e4 100644 --- a/packages/core/src/pluginApi/normalizeClientConfigFileHook.ts +++ b/packages/core/src/pluginApi/normalizeClientConfigFileHook.ts @@ -4,6 +4,8 @@ import type { ClientConfigFileHook } from '../types/index.js' /** * Normalize hook for client config file + * + * @internal */ export const normalizeClientConfigFileHook = (hook: ClientConfigFileHook['exposed']): ClientConfigFileHook['normalized'] => diff --git a/packages/core/src/types/app/options.ts b/packages/core/src/types/app/options.ts index 4cbcabbc37..74a11478f6 100644 --- a/packages/core/src/types/app/options.ts +++ b/packages/core/src/types/app/options.ts @@ -9,18 +9,98 @@ import type { Theme } from '../theme.js' * Vuepress app common config that shared between dev and build */ export interface AppConfigCommon extends Partial { + /** + * Source directory of the markdown files. + * + * Vuepress will load markdown files from this directory. + * + * @required + */ source: string + + /** + * Destination directory of the output files. + * + * Vuepress will output the static site files to this directory. + * + * @default `${source}/.vuepress/dist` + */ dest?: string + + /** + * Temp files directory. + * + * Vuepress will write temp files to this directory. + * + * @default `${source}/.vuepress/.temp` + */ temp?: string + + /** + * Cache files directory. + * + * Vuepress will write cache files to this directory. + * + * @default `${source}/.vuepress/.cache` + */ cache?: string + + /** + * Public files directory. + * + * Vuepress will copy the files from public directory to the output directory. + * + * @default `${source}/.vuepress/public` + */ public?: string + /** + * Whether to enable debug mode + * + * @default false + */ debug?: boolean + + /** + * Markdown options + * + * @default {} + */ markdown?: MarkdownOptions + + /** + * Patterns to match the markdown files as pages + * + * @default ['**\/*.md', '!.vuepress', '!node_modules'] + */ pagePatterns?: string[] + + /** + * Pattern to generate permalink for pages + * + * @default null + */ permalinkPattern?: string | null + + /** + * Vuepress bundler + * + * @required + */ bundler: Bundler + + /** + * Vuepress theme + * + * @required + */ theme: Theme + + /** + * Vuepress plugins + * + * @default [] + */ plugins?: PluginConfig } @@ -87,17 +167,21 @@ export interface AppConfigBuild { /** * Specify the HTML template renderer to be used for build * - * @default templateRenderer from '@vuepress/utils' + * @default `import { templateRenderer } from '@vuepress/utils'` */ templateBuildRenderer?: TemplateRenderer } /** - * Vuepress app config + * Vuepress app user config. + * + * It would be provided by user, typically via a config file. */ export type AppConfig = AppConfigBuild & AppConfigCommon & AppConfigDev /** - * Vuepress app options + * Vuepress app options that resolved from user config. + * + * It fills all optional fields with a default value. */ export type AppOptions = Required diff --git a/packages/core/src/types/app/utils.ts b/packages/core/src/types/app/utils.ts index 0e70eb5508..fdfb3fd4a7 100644 --- a/packages/core/src/types/app/utils.ts +++ b/packages/core/src/types/app/utils.ts @@ -7,11 +7,34 @@ export type AppDirFunction = (...args: string[]) => string * Directory utils */ export interface AppDir { + /** + * Resolve file path in cache directory + */ cache: AppDirFunction + + /** + * Resolve file path in temp directory + */ temp: AppDirFunction + + /** + * Resolve file path in source directory + */ source: AppDirFunction + + /** + * Resolve file path in dest directory + */ dest: AppDirFunction + + /** + * Resolve file path in public directory + */ public: AppDirFunction + + /** + * Resolve file path in client directory + */ client: AppDirFunction } diff --git a/packages/core/src/types/bundler.ts b/packages/core/src/types/bundler.ts index cd3b8dc2a7..0f8e64fa78 100644 --- a/packages/core/src/types/bundler.ts +++ b/packages/core/src/types/bundler.ts @@ -8,8 +8,19 @@ import type { App } from './app/index.js' * - build: bundle assets for deployment */ export interface Bundler { + /** + * Name of the bundler + */ name: string + + /** + * Method to run vuepress app in dev mode, starting dev server + */ dev: (app: App) => Promise<() => Promise> + + /** + * Method to run vuepress app in build mode, generating static pages and assets + */ build: (app: App) => Promise } diff --git a/packages/core/src/types/plugin.ts b/packages/core/src/types/plugin.ts index ae52a6b334..99e65f7517 100644 --- a/packages/core/src/types/plugin.ts +++ b/packages/core/src/types/plugin.ts @@ -27,10 +27,14 @@ export type PluginFunction = ( * Vuepress plugin object */ export interface PluginObject extends Partial { - // plugin name + /** + * Name of the plugin + */ name: string - // allow use a plugin multiple times or not + /** + * Allow the plugin to be used multiple times or not + */ multiple?: boolean } From 25a33968c350a3bd58927e15953bf3daad51c397 Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Fri, 13 Sep 2024 03:25:48 +0800 Subject: [PATCH 2/2] feat(utils-bundler): add utils-bundler package --- CONTRIBUTING.md | 3 +- CONTRIBUTING_zh.md | 3 +- packages/bundler-vite/package.json | 1 + packages/bundler-vite/src/build/build.ts | 23 +++----- packages/bundler-vite/src/build/renderPage.ts | 25 +++----- packages/bundler-webpack/package.json | 1 + packages/bundler-webpack/src/build/build.ts | 30 +++------- .../bundler-webpack/src/build/renderPage.ts | 31 ++++------ packages/utils-bundler/README.md | 12 ++++ packages/utils-bundler/package.json | 59 +++++++++++++++++++ .../src/build/createVueServerApp.ts | 29 +++++++++ .../utils-bundler/src/build/getSsrTemplate.ts | 8 +++ packages/utils-bundler/src/build/index.ts | 3 + .../src/build/renderPageToString.ts | 51 ++++++++++++++++ packages/utils-bundler/src/index.ts | 1 + pnpm-lock.yaml | 27 +++++++++ vitest.config.ts | 1 + 17 files changed, 229 insertions(+), 79 deletions(-) create mode 100644 packages/utils-bundler/README.md create mode 100644 packages/utils-bundler/package.json create mode 100644 packages/utils-bundler/src/build/createVueServerApp.ts create mode 100644 packages/utils-bundler/src/build/getSsrTemplate.ts create mode 100644 packages/utils-bundler/src/build/index.ts create mode 100644 packages/utils-bundler/src/build/renderPageToString.ts create mode 100644 packages/utils-bundler/src/index.ts diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3b8d66d7d9..66d88322dd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,10 +17,11 @@ Wrapper of core packages: - `vuepress`: A wrapper of the above packages, and provides `vuepress` command line tool. Users need to choose and install bundler and theme by themselves. -Bundler packages: +Bundler and related packages: - `bundler-vite`: The VuePress bundler package with vite. Use vite to `dev` and `build` VuePress app that generated by `@vuepress/core`. - `bundler-webpack`: The VuePress bundler package with webpack. Use webpack to `dev` and `build` VuePress app that generated by `@vuepress/core`. +- `utils-bundler`: Utilities for bundler packages. ## Development Setup diff --git a/CONTRIBUTING_zh.md b/CONTRIBUTING_zh.md index d4f6060cae..4e04f55f9d 100644 --- a/CONTRIBUTING_zh.md +++ b/CONTRIBUTING_zh.md @@ -17,10 +17,11 @@ Core Packages 的封装: - `vuepress`: 是上述 Core Packages 的封装,提供了 `vuepress` 命令行工具。用户需要在此包的基础上自行选择并安装打包工具和主题。 -Bundler Packages : +Bundler 及其相关 Packages : - `bundler-vite`: 基于 Vite 的 Bundler 模块。使用 Vite 对 VuePress App 执行 `dev` 和 `build` 操作。 - `bundler-webpack`: 基于 Webpack 的 Bundler 模块。使用 Webpack 对 VuePress App 执行 `dev` 和 `build` 操作。 +- `utils-bundler`: 供 Bundler 模块使用的工具函数模块。 ## 开发配置 diff --git a/packages/bundler-vite/package.json b/packages/bundler-vite/package.json index f98c07bf4f..b12dbbbce5 100644 --- a/packages/bundler-vite/package.json +++ b/packages/bundler-vite/package.json @@ -40,6 +40,7 @@ "@vuepress/core": "workspace:*", "@vuepress/shared": "workspace:*", "@vuepress/utils": "workspace:*", + "@vuepress/utils-bundler": "workspace:*", "autoprefixer": "^10.4.20", "connect-history-api-fallback": "^2.0.0", "postcss": "^8.4.45", diff --git a/packages/bundler-vite/src/build/build.ts b/packages/bundler-vite/src/build/build.ts index 33466ea6b0..ad2950a7ee 100644 --- a/packages/bundler-vite/src/build/build.ts +++ b/packages/bundler-vite/src/build/build.ts @@ -1,6 +1,6 @@ -import type { CreateVueAppFunction } from '@vuepress/client' import type { App, Bundler } from '@vuepress/core' -import { colors, debug, fs, importFile, withSpinner } from '@vuepress/utils' +import { colors, debug, fs, withSpinner } from '@vuepress/utils' +import { createVueServerApp, getSsrTemplate } from '@vuepress/utils-bundler' import type { OutputAsset, OutputChunk, RollupOutput } from 'rollup' import { build as viteBuild } from 'vite' import { resolveViteConfig } from '../resolveViteConfig.js' @@ -58,19 +58,11 @@ export const build = async ( (item) => item.type === 'chunk' && item.isEntry, ) as OutputChunk - // load the compiled server bundle - const serverEntryPath = app.dir.temp('.server', serverEntryChunk.fileName) - const { createVueApp } = await importFile<{ - createVueApp: CreateVueAppFunction - }>(serverEntryPath) - // create vue ssr app - const { app: vueApp, router: vueRouter } = await createVueApp() - const { renderToString } = await import('vue/server-renderer') - - // load ssr template file - const ssrTemplate = await fs.readFile(app.options.templateBuild, { - encoding: 'utf8', - }) + // create vue ssr app and get ssr template + const { vueApp, vueRouter } = await createVueServerApp( + app.dir.temp('.server', serverEntryChunk.fileName), + ) + const ssrTemplate = await getSsrTemplate(app) // pre-render pages to html files for (const page of app.pages) { @@ -80,7 +72,6 @@ export const build = async ( page, vueApp, vueRouter, - renderToString, ssrTemplate, output: clientOutput.output, outputEntryChunk: clientEntryChunk, diff --git a/packages/bundler-vite/src/build/renderPage.ts b/packages/bundler-vite/src/build/renderPage.ts index a0af5b2374..0410975dd5 100644 --- a/packages/bundler-vite/src/build/renderPage.ts +++ b/packages/bundler-vite/src/build/renderPage.ts @@ -1,10 +1,8 @@ import type { App, Page } from '@vuepress/core' -import type { VuepressSSRContext } from '@vuepress/shared' import { fs, renderHead } from '@vuepress/utils' +import { renderPageToString } from '@vuepress/utils-bundler' import type { OutputAsset, OutputChunk, RollupOutput } from 'rollup' import type { App as VueApp } from 'vue' -import { ssrContextKey } from 'vue' -import type { SSRContext } from 'vue/server-renderer' import type { Router } from 'vue-router' import { renderPagePrefetchLinks } from './renderPagePrefetchLinks.js' import { renderPagePreloadLinks } from './renderPagePreloadLinks.js' @@ -17,7 +15,6 @@ export const renderPage = async ({ page, vueApp, vueRouter, - renderToString, ssrTemplate, output, outputEntryChunk, @@ -27,32 +24,24 @@ export const renderPage = async ({ page: Page vueApp: VueApp vueRouter: Router - renderToString: (input: VueApp, context: SSRContext) => Promise ssrTemplate: string output: RollupOutput['output'] outputEntryChunk: OutputChunk outputCssAsset: OutputAsset | undefined }): Promise => { - // switch to current page route - await vueRouter.push(page.path) - await vueRouter.isReady() - - // create vue ssr context with default values - delete vueApp._context.provides[ssrContextKey] - const ssrContext: VuepressSSRContext = { - lang: 'en', - head: [], - } - // render current page to string - const pageRendered = await renderToString(vueApp, ssrContext) + const { ssrContext, ssrString } = await renderPageToString({ + page, + vueApp, + vueRouter, + }) // resolve page chunks const pageChunkFiles = resolvePageChunkFiles({ page, output }) // generate html string const html = await app.options.templateBuildRenderer(ssrTemplate, { - content: pageRendered, + content: ssrString, head: ssrContext.head.map(renderHead).join(''), lang: ssrContext.lang, prefetch: renderPagePrefetchLinks({ diff --git a/packages/bundler-webpack/package.json b/packages/bundler-webpack/package.json index 28d32a8f12..6b9b1baea8 100644 --- a/packages/bundler-webpack/package.json +++ b/packages/bundler-webpack/package.json @@ -42,6 +42,7 @@ "@vuepress/core": "workspace:*", "@vuepress/shared": "workspace:*", "@vuepress/utils": "workspace:*", + "@vuepress/utils-bundler": "workspace:*", "autoprefixer": "^10.4.20", "chokidar": "^3.6.0", "copy-webpack-plugin": "^12.0.2", diff --git a/packages/bundler-webpack/src/build/build.ts b/packages/bundler-webpack/src/build/build.ts index 82774429d3..9443e5c82b 100644 --- a/packages/bundler-webpack/src/build/build.ts +++ b/packages/bundler-webpack/src/build/build.ts @@ -1,13 +1,6 @@ -import type { CreateVueAppFunction } from '@vuepress/client' import type { App, Bundler } from '@vuepress/core' -import { - colors, - debug, - fs, - importFileDefault, - logger, - withSpinner, -} from '@vuepress/utils' +import { colors, debug, fs, logger, withSpinner } from '@vuepress/utils' +import { createVueServerApp, getSsrTemplate } from '@vuepress/utils-bundler' import webpack from 'webpack' import { resolveWebpackConfig } from '../resolveWebpackConfig.js' import type { WebpackBundlerOptions } from '../types.js' @@ -80,19 +73,11 @@ export const build = async ( const { initialFilesMeta, asyncFilesMeta, moduleFilesMetaMap } = resolveClientManifestMeta(clientManifest) - // load the compiled server bundle - const serverEntryPath = app.dir.temp('.server/app.cjs') - const { createVueApp } = await importFileDefault<{ - createVueApp: CreateVueAppFunction - }>(serverEntryPath) - // create vue ssr app - const { app: vueApp, router: vueRouter } = await createVueApp() - const { renderToString } = await import('vue/server-renderer') - - // load ssr template file - const ssrTemplate = await fs.readFile(app.options.templateBuild, { - encoding: 'utf8', - }) + // create vue ssr app and get ssr template + const { vueApp, vueRouter } = await createVueServerApp( + app.dir.temp('.server/app.cjs'), + ) + const ssrTemplate = await getSsrTemplate(app) // pre-render pages to html files for (const page of app.pages) { @@ -104,7 +89,6 @@ export const build = async ( page, vueApp, vueRouter, - renderToString, ssrTemplate, initialFilesMeta, asyncFilesMeta, diff --git a/packages/bundler-webpack/src/build/renderPage.ts b/packages/bundler-webpack/src/build/renderPage.ts index 6d3c888dd9..e06082afab 100644 --- a/packages/bundler-webpack/src/build/renderPage.ts +++ b/packages/bundler-webpack/src/build/renderPage.ts @@ -1,9 +1,8 @@ import type { App, Page } from '@vuepress/core' -import type { VuepressSSRContext } from '@vuepress/shared' import { fs, renderHead } from '@vuepress/utils' +import type { PageSSRContext } from '@vuepress/utils-bundler' +import { renderPageToString } from '@vuepress/utils-bundler' import type { App as VueApp } from 'vue' -import { ssrContextKey } from 'vue' -import type { SSRContext } from 'vue/server-renderer' import type { Router } from 'vue-router' import { renderPagePrefetchLinks } from './renderPagePrefetchLinks.js' import { renderPagePreloadLinks } from './renderPagePreloadLinks.js' @@ -12,7 +11,7 @@ import { renderPageStyles } from './renderPageStyles.js' import { resolvePageClientFilesMeta } from './resolvePageClientFilesMeta.js' import type { FileMeta, ModuleFilesMetaMap } from './types.js' -interface PageRenderContext extends SSRContext, VuepressSSRContext { +interface WebpackPageSSRContext extends PageSSRContext { /** * Injected by vuepress-ssr-loader * @@ -29,7 +28,6 @@ export const renderPage = async ({ page, vueApp, vueRouter, - renderToString, ssrTemplate, initialFilesMeta, asyncFilesMeta, @@ -39,26 +37,19 @@ export const renderPage = async ({ page: Page vueApp: VueApp vueRouter: Router - renderToString: (input: VueApp, context: SSRContext) => Promise ssrTemplate: string initialFilesMeta: FileMeta[] asyncFilesMeta: FileMeta[] moduleFilesMetaMap: ModuleFilesMetaMap }): Promise => { - // switch to current page route - await vueRouter.push(page.path) - await vueRouter.isReady() - - // create vue ssr context with default values - delete vueApp._context.provides[ssrContextKey] - const ssrContext: PageRenderContext = { - _registeredComponents: new Set(), - lang: 'en', - head: [], - } - // render current page to string - const pageRendered = await renderToString(vueApp, ssrContext) + const { ssrContext, ssrString } = + await renderPageToString({ + page, + vueApp, + vueRouter, + ssrContextInit: { _registeredComponents: new Set() }, + }) // resolve client files that used by this page const pageClientFilesMeta = resolvePageClientFilesMeta({ @@ -68,7 +59,7 @@ export const renderPage = async ({ // generate html string const html = await app.options.templateBuildRenderer(ssrTemplate, { - content: pageRendered, + content: ssrString, head: ssrContext.head.map(renderHead).join(''), lang: ssrContext.lang, prefetch: renderPagePrefetchLinks({ diff --git a/packages/utils-bundler/README.md b/packages/utils-bundler/README.md new file mode 100644 index 0000000000..e3862713be --- /dev/null +++ b/packages/utils-bundler/README.md @@ -0,0 +1,12 @@ +# @vuepress/utils-bundler + +[![npm](https://badgen.net/npm/v/@vuepress/utils-bundler/next)](https://www.npmjs.com/package/@vuepress/utils-bundler) +[![license](https://badgen.net/github/license/vuepress/core)](https://github.com/vuepress/core/blob/main/LICENSE) + +## Documentation + +https://vuepress.vuejs.org + +## License + +[MIT](https://github.com/vuepress/core/blob/main/LICENSE) diff --git a/packages/utils-bundler/package.json b/packages/utils-bundler/package.json new file mode 100644 index 0000000000..3eee8106f3 --- /dev/null +++ b/packages/utils-bundler/package.json @@ -0,0 +1,59 @@ +{ + "name": "@vuepress/utils-bundler", + "version": "2.0.0-rc.15", + "description": "Utils package of VuePress bundler", + "keywords": [ + "bundler", + "vuepress", + "utils" + ], + "homepage": "https://github.com/vuepress", + "bugs": { + "url": "https://github.com/vuepress/core/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/vuepress/core.git" + }, + "license": "MIT", + "author": "meteorlxy", + "type": "module", + "exports": { + ".": "./dist/index.js", + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "tsup", + "clean": "rimraf dist" + }, + "dependencies": { + "@vuepress/client": "workspace:*", + "@vuepress/core": "workspace:*", + "@vuepress/shared": "workspace:*", + "@vuepress/utils": "workspace:*", + "vue": "^3.5.3", + "vue-router": "^4.4.3" + }, + "publishConfig": { + "access": "public" + }, + "tsup": { + "clean": true, + "dts": "./src/index.ts", + "entry": [ + "./src/index.ts" + ], + "format": [ + "esm" + ], + "outDir": "./dist", + "sourcemap": false, + "target": "es2022", + "tsconfig": "../../tsconfig.dts.json" + } +} diff --git a/packages/utils-bundler/src/build/createVueServerApp.ts b/packages/utils-bundler/src/build/createVueServerApp.ts new file mode 100644 index 0000000000..515525527a --- /dev/null +++ b/packages/utils-bundler/src/build/createVueServerApp.ts @@ -0,0 +1,29 @@ +import type { CreateVueAppFunction } from '@vuepress/client' +import { importFile, importFileDefault } from '@vuepress/utils' +import type { App } from 'vue' +import type { Router } from 'vue-router' + +/** + * Create vue app and router for server side rendering + */ +export const createVueServerApp = async ( + serverAppPath: string, +): Promise<{ + vueApp: App + vueRouter: Router +}> => { + // use different import function for cjs and esm + const importer = serverAppPath.endsWith('.cjs') + ? importFileDefault + : importFile + + // import the server app entry file + const { createVueApp } = await importer<{ + createVueApp: CreateVueAppFunction + }>(serverAppPath) + + // create vue app + const { app, router } = await createVueApp() + + return { vueApp: app, vueRouter: router } +} diff --git a/packages/utils-bundler/src/build/getSsrTemplate.ts b/packages/utils-bundler/src/build/getSsrTemplate.ts new file mode 100644 index 0000000000..113f04e4e2 --- /dev/null +++ b/packages/utils-bundler/src/build/getSsrTemplate.ts @@ -0,0 +1,8 @@ +import type { App } from '@vuepress/core' +import { fs } from '@vuepress/utils' + +/** + * Util to read the ssr template file + */ +export const getSsrTemplate = async (app: App): Promise => + fs.readFile(app.options.templateBuild, { encoding: 'utf8' }) diff --git a/packages/utils-bundler/src/build/index.ts b/packages/utils-bundler/src/build/index.ts new file mode 100644 index 0000000000..a3e53e9f79 --- /dev/null +++ b/packages/utils-bundler/src/build/index.ts @@ -0,0 +1,3 @@ +export * from './createVueServerApp' +export * from './getSsrTemplate' +export * from './renderPageToString' diff --git a/packages/utils-bundler/src/build/renderPageToString.ts b/packages/utils-bundler/src/build/renderPageToString.ts new file mode 100644 index 0000000000..8885738401 --- /dev/null +++ b/packages/utils-bundler/src/build/renderPageToString.ts @@ -0,0 +1,51 @@ +import type { Page } from '@vuepress/core' +import type { VuepressSSRContext } from '@vuepress/shared' +import type { App as VueApp } from 'vue' +import { ssrContextKey } from 'vue' +import type { SSRContext } from 'vue/server-renderer' +import type { Router } from 'vue-router' + +export type PageSSRContext = SSRContext & VuepressSSRContext + +/** + * Render a vuepress page to string + */ +export const renderPageToString = async < + T extends PageSSRContext = PageSSRContext, +>({ + page, + vueApp, + vueRouter, + ssrContextInit, +}: { + page: Page + vueApp: VueApp + vueRouter: Router + ssrContextInit?: Partial +}): Promise<{ + ssrContext: T + ssrString: string +}> => { + // switch to current page route + await vueRouter.push(page.path) + await vueRouter.isReady() + + // create vue ssr context with default values + delete vueApp._context.provides[ssrContextKey] + const ssrContext = { + lang: 'en', + head: [], + ...ssrContextInit, + } satisfies PageSSRContext as T + + // lazy load renderToString function + const { renderToString } = await import('vue/server-renderer') + + // render current page to string + const ssrString = await renderToString(vueApp, ssrContext) + + return { + ssrContext, + ssrString, + } +} diff --git a/packages/utils-bundler/src/index.ts b/packages/utils-bundler/src/index.ts new file mode 100644 index 0000000000..5cdad37752 --- /dev/null +++ b/packages/utils-bundler/src/index.ts @@ -0,0 +1 @@ +export * from './build/index.js' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 84e966ef62..92c106f63d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -138,6 +138,9 @@ importers: '@vuepress/utils': specifier: workspace:* version: link:../utils + '@vuepress/utils-bundler': + specifier: workspace:* + version: link:../utils-bundler autoprefixer: specifier: ^10.4.20 version: 10.4.20(postcss@8.4.45) @@ -187,6 +190,9 @@ importers: '@vuepress/utils': specifier: workspace:* version: link:../utils + '@vuepress/utils-bundler': + specifier: workspace:* + version: link:../utils-bundler autoprefixer: specifier: ^10.4.20 version: 10.4.20(postcss@8.4.45) @@ -406,6 +412,27 @@ importers: specifier: ^2.0.1 version: 2.0.1 + packages/utils-bundler: + dependencies: + '@vuepress/client': + specifier: workspace:* + version: link:../client + '@vuepress/core': + specifier: workspace:* + version: link:../core + '@vuepress/shared': + specifier: workspace:* + version: link:../shared + '@vuepress/utils': + specifier: workspace:* + version: link:../utils + vue: + specifier: ^3.5.3 + version: 3.5.3(typescript@5.6.2) + vue-router: + specifier: ^4.4.3 + version: 4.4.3(vue@3.5.3(typescript@5.6.2)) + packages/vuepress: dependencies: '@vuepress/bundler-vite': diff --git a/vitest.config.ts b/vitest.config.ts index b273f940d2..5a23a49981 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -17,6 +17,7 @@ export default defineConfig({ exclude: [ 'packages/bundler-*/**', 'packages/client/**', + 'packages/utils-bundler/**', 'packages/vuepress/**', ], include: ['packages/*/src/**'],