Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions plugins/blog/plugin-blog/src/node/blogPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addViteSsrNoExternal, getPageExcerpt } from '@vuepress/helper'
import { getPageExcerpt } from '@vuepress/helper'
import type { Page, PluginFunction } from 'vuepress/core'
import { createPage, preparePageChunk, prepareRoutes } from 'vuepress/core'
import type { CategoriesMap, TypesMap } from '../shared/index.js'
Expand Down Expand Up @@ -74,10 +74,6 @@ export const blogPlugin =
__BLOG_META_SCOPE__: metaScope,
}),

extendsBundlerOptions: (bundlerOptions: unknown) => {
addViteSsrNoExternal(bundlerOptions, app, '@vuepress/helper')
},

extendsPage: (page) => {
// Generate page excerpt
if (
Expand Down
52 changes: 1 addition & 51 deletions plugins/blog/plugin-comment/src/node/commentPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import {
addCustomElement,
addViteOptimizeDepsExclude,
addViteOptimizeDepsInclude,
addViteSsrExternal,
addViteSsrNoExternal,
getFullLocaleConfig,
isModuleAvailable,
} from '@vuepress/helper'
import { getFullLocaleConfig, isModuleAvailable } from '@vuepress/helper'
import type { PluginFunction } from 'vuepress/core'
import { getAlias, getProviderPackage } from './getProvider.js'
import { walineLocalesInfo } from './locales.js'
Expand Down Expand Up @@ -74,48 +66,6 @@ export const commentPlugin =
return result
},

extendsBundlerOptions: (bundlerOptions: unknown) => {
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check, default-case
switch (options.provider) {
case 'Artalk': {
addViteOptimizeDepsExclude(
bundlerOptions,
app,
'artalk/dist/Artalk.mjs',
)
addViteSsrExternal(bundlerOptions, app, 'artalk')
break
}

case 'Giscus': {
addCustomElement(bundlerOptions, app, 'GiscusWidget')
addViteSsrExternal(bundlerOptions, app, 'giscus')
break
}

case 'Twikoo': {
addViteOptimizeDepsInclude(bundlerOptions, app, 'twikoo')
addViteSsrExternal(bundlerOptions, app, 'twikoo')
break
}

case 'Waline': {
addViteOptimizeDepsInclude(bundlerOptions, app, [
'@waline/client > autosize',
'@waline/client > recaptcha-v3',
])
addViteOptimizeDepsExclude(bundlerOptions, app, '@waline/client')
addViteSsrExternal(bundlerOptions, app, '@waline/client')
break
}
}

addViteSsrNoExternal(bundlerOptions, app, [
'@vuepress/helper',
'@vuepress/plugin-comment',
])
},

clientConfigFile: `${CLIENT_FOLDER}config.js`,
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addViteSsrNoExternal, getFullLocaleConfig } from '@vuepress/helper'
import { getFullLocaleConfig } from '@vuepress/helper'
import type { Page, PluginFunction } from 'vuepress/core'
import type { ReadingTime } from '../shared/index.js'
import { getReadingTime } from './getReadingTime.js'
Expand Down Expand Up @@ -50,9 +50,5 @@ export const readingTimePlugin =
options.wordPerMinute ?? 300,
)
},

extendsBundlerOptions: (bundlerOptions: unknown) => {
addViteSsrNoExternal(bundlerOptions, app, '@vuepress/helper')
},
}
}
6 changes: 1 addition & 5 deletions plugins/features/plugin-catalog/src/node/catalogPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addViteSsrNoExternal, getFullLocaleConfig } from '@vuepress/helper'
import { getFullLocaleConfig } from '@vuepress/helper'
import type { PluginFunction } from 'vuepress/core'
import { getDirname, path } from 'vuepress/utils'
import { generateCatalogPage } from './generateCatalogPage.js'
Expand Down Expand Up @@ -49,10 +49,6 @@ export const catalogPlugin =

onInitialized: () => generateCatalogPage(app, options),

extendsBundlerOptions: (bundlerOptions: unknown) => {
addViteSsrNoExternal(bundlerOptions, app, '@vuepress/helper')
},

...(component
? {}
: { clientConfigFile: path.join(__dirname, '../client/config.js') }),
Expand Down
11 changes: 1 addition & 10 deletions plugins/features/plugin-copy-code/src/node/copyCodePlugin.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
addViteSsrNoExternal,
getFullLocaleConfig,
isArray,
isString,
} from '@vuepress/helper'
import { getFullLocaleConfig, isArray, isString } from '@vuepress/helper'
import type { PluginFunction } from 'vuepress/core'
import { getDirname, path } from 'vuepress/utils'
import { copyCodeLocaleInfo } from './locales.js'
Expand Down Expand Up @@ -62,10 +57,6 @@ export const copyCodePlugin =
__CC_SHOW_IN_MOBILE__: options.showInMobile ?? false,
}),

extendsBundlerOptions: (bundlerOptions: unknown) => {
addViteSsrNoExternal(bundlerOptions, app, '@vuepress/helper')
},

clientConfigFile: path.resolve(__dirname, '../client/config.js'),
}
}
10 changes: 1 addition & 9 deletions plugins/features/plugin-copyright/src/node/copyrightPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
Logger,
addViteSsrNoExternal,
getFullLocaleConfig,
} from '@vuepress/helper'
import { Logger, getFullLocaleConfig } from '@vuepress/helper'
import type { Page, PluginFunction } from 'vuepress/core'
import { getDirname, path } from 'vuepress/utils'
import type {
Expand Down Expand Up @@ -102,10 +98,6 @@ export const copyrightPlugin =
}
},

extendsBundlerOptions: (bundlerOptions: unknown) => {
addViteSsrNoExternal(bundlerOptions, app, '@vuepress/helper')
},

clientConfigFile: path.resolve(__dirname, '../client/config.js'),
}
}
8 changes: 0 additions & 8 deletions plugins/features/plugin-icon/src/node/iconPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { extractInfo, icon, stringifyAttrs } from '@mdit/plugin-icon'
import { addCustomElement, addViteSsrNoExternal } from '@vuepress/helper'
import type { Plugin } from 'vuepress/core'

import { getAssetsType } from './getAssetsType.js'
Expand Down Expand Up @@ -33,13 +32,6 @@ export const iconPlugin = (options: IconPluginOptions = {}): Plugin => {
return {
name: PLUGIN_NAME,

extendsBundlerOptions: (bundlerOptions, app) => {
addViteSsrNoExternal(bundlerOptions, app, '@vuepress/helper')

if (iconType === 'iconify')
addCustomElement(bundlerOptions, app, 'iconify-icon')
},

extendsMarkdown: (md) => {
if (options.markdown ?? true) {
md.use(icon, {
Expand Down
1 change: 0 additions & 1 deletion plugins/features/plugin-medium-zoom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"clean": "rimraf ./dist"
},
"dependencies": {
"@vuepress/helper": "workspace:*",
"medium-zoom": "^1.1.0",
"vue": "catalog:"
},
Expand Down
13 changes: 1 addition & 12 deletions plugins/features/plugin-photo-swipe/src/node/photoSwipePlugin.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
addViteOptimizeDepsExclude,
addViteSsrNoExternal,
entries,
fromEntries,
getFullLocaleConfig,
} from '@vuepress/helper'
import { entries, fromEntries, getFullLocaleConfig } from '@vuepress/helper'
import type { PluginFunction } from 'vuepress/core'
import { getDirname, path } from 'vuepress/utils'
import { photoSwipeLocaleInfo } from './locales.js'
Expand Down Expand Up @@ -68,11 +62,6 @@ export const photoSwipePlugin =
),
}),

extendsBundlerOptions: (bundlerOptions: unknown) => {
addViteOptimizeDepsExclude(bundlerOptions, app, 'photoswipe')
addViteSsrNoExternal(bundlerOptions, app, '@vuepress/helper')
},

clientConfigFile: path.resolve(__dirname, '../client/config.js'),
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ export default defineComponent({
const renderMermaid = async (): Promise<void> => {
if (__VUEPRESS_SSR__) return

const { default: mermaid } = await import(
/* webpackChunkName: "mermaid" */ 'mermaid/dist/mermaid.esm.min.mjs'
)
const { default: mermaid } = await import('mermaid')

mermaid.initialize({
theme: isDarkMode.value ? 'dark' : 'default',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {
addViteOptimizeDepsExclude,
addViteOptimizeDepsInclude,
addViteSsrExternal,
addViteSsrNoExternal,
deepAssign,
isArray,
} from '@vuepress/helper'
import { deepAssign, isArray } from '@vuepress/helper'
import type { Plugin } from 'vuepress/core'
import {
chartjs,
Expand Down Expand Up @@ -118,54 +111,6 @@ export const markdownChartPlugin =
if (status.mermaid) md.use(mermaid)
},

extendsBundlerOptions: (bundlerOptions: unknown) => {
addViteSsrNoExternal(bundlerOptions, app, [
'@vuepress/helper',
'fflate',
])

if (status.chartjs) {
addViteOptimizeDepsExclude(
bundlerOptions,
app,
'chart.js/auto/auto.mjs',
)
addViteSsrExternal(bundlerOptions, app, 'chart.js')
}

if (status.echarts) {
addViteOptimizeDepsExclude(bundlerOptions, app, 'echarts')
addViteSsrExternal(bundlerOptions, app, 'echarts')
}

if (status.flowchart) {
addViteOptimizeDepsExclude(bundlerOptions, app, 'flowchart.ts')
addViteSsrExternal(bundlerOptions, app, 'flowchart.ts')
}

if (status.markmap) {
addViteOptimizeDepsInclude(bundlerOptions, app, [
'markmap-lib',
'markmap-toolbar',
'markmap-view',
])
addViteSsrExternal(bundlerOptions, app, [
'markmap-lib',
'markmap-toolbar',
'markmap-view',
])
}

if (status.mermaid) {
addViteOptimizeDepsExclude(
bundlerOptions,
app,
'mermaid/dist/mermaid.esm.min.mjs',
)
addViteSsrExternal(bundlerOptions, app, 'mermaid')
}
},

clientConfigFile: () => prepareConfigFile(app, status),
}
}
1 change: 0 additions & 1 deletion plugins/markdown/plugin-markdown-file-tree/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
},
"dependencies": {
"@types/markdown-it": "^14.1.2",
"@vuepress/helper": "workspace:*",
"@vueuse/core": "catalog:",
"vue": "catalog:"
},
Expand Down
14 changes: 0 additions & 14 deletions plugins/markdown/plugin-revealjs/src/node/revealJsPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import {
addViteOptimizeDepsExclude,
addViteSsrExternal,
} from '@vuepress/helper'
import type { Plugin } from 'vuepress/core'
import type { RevealJsPluginOptions } from './options.js'
import {
Expand Down Expand Up @@ -48,16 +44,6 @@ export const revealJsPlugin = ({
}: RevealJsPluginOptions = {}): Plugin => ({
name: PLUGIN_NAME,

extendsBundlerOptions: (bundlerOptions, app) => {
addViteOptimizeDepsExclude(bundlerOptions, app, [
'reveal.js',
'reveal.js/plugin/markdown',
...plugins.map((plugin) => `reveal.js/plugin/${plugin}`),
])

addViteSsrExternal(bundlerOptions, app, 'reveal.js')
},

extendsMarkdown: (md) => {
md.use(revealJs)
},
Expand Down
12 changes: 1 addition & 11 deletions plugins/pwa/plugin-pwa/src/node/pwaPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
addViteOptimizeDepsExclude,
addViteSsrNoExternal,
customizeDevServer,
} from '@vuepress/helper'
import { customizeDevServer } from '@vuepress/helper'
import type { PluginFunction } from 'vuepress/core'
import { generateManifest } from './generateManifest.js'
import { generateServiceWorker } from './generateServiceWorker.js'
Expand Down Expand Up @@ -60,12 +56,6 @@ export const pwaPlugin =
name: PLUGIN_NAME,

extendsBundlerOptions: (bundlerOptions: unknown) => {
addViteOptimizeDepsExclude(bundlerOptions, app, [
'mitt',
'register-service-worker',
])
addViteSsrNoExternal(bundlerOptions, app, '@vuepress/helper')

customizeDevServer(bundlerOptions, app, {
path: '/manifest.webmanifest',
response: async (_, response) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ export const DocSearch = defineComponent({
const initialize = async (): Promise<void> => {
if (__VUEPRESS_SSR__) return

const { default: docsearch } = await import('@docsearch/js')
const { default: docsearch } = await import(
/* webpackChunkName: "docsearch" */ '@docsearch/js'
)
// eslint-disable-next-line @typescript-eslint/no-deprecated
const { indexName, indices, searchParameters, ...rest } = options.value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ export const MeiliSearch = defineComponent({
const initialize = async (): Promise<void> => {
if (__VUEPRESS_SSR__) return

const { docsearch } = await import('meilisearch-docsearch')
const { docsearch } = await import(
/* webpackChunkName: "meilisearch" */ 'meilisearch-docsearch'
)
const { searchParams } = meilisearchOptions.value
let rawFilter: (string[] | string)[] = []

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Logger,
addViteSsrExternal,
entries,
fromEntries,
getFullLocaleConfig,
Expand Down Expand Up @@ -51,10 +50,6 @@ export const meilisearchPlugin =
__ML_SEARCH_OPTIONS__: options,
},

extendsBundlerOptions: (bundlerOptions) => {
addViteSsrExternal(bundlerOptions, app, 'meilisearch-docsearch')
},

clientConfigFile: path.resolve(__dirname, '../client/config.js'),
}
}
Loading
Loading