Merge remote-tracking branch 'origin/main' into chore/replace-fast-glob-with-tinyglobby

pull/4132/head
Divyansh Singh 1 year ago
commit 3bd528dda3

@ -100,19 +100,19 @@
"dependencies": { "dependencies": {
"@docsearch/css": "^3.6.1", "@docsearch/css": "^3.6.1",
"@docsearch/js": "^3.6.1", "@docsearch/js": "^3.6.1",
"@shikijs/core": "^1.13.0", "@shikijs/core": "^1.15.2",
"@shikijs/transformers": "^1.13.0", "@shikijs/transformers": "^1.15.2",
"@types/markdown-it": "^14.1.2", "@types/markdown-it": "^14.1.2",
"@vitejs/plugin-vue": "^5.1.2", "@vitejs/plugin-vue": "^5.1.3",
"@vue/devtools-api": "^7.3.8", "@vue/devtools-api": "^7.3.9",
"@vue/shared": "^3.4.38", "@vue/shared": "^3.4.38",
"@vueuse/core": "^11.0.0", "@vueuse/core": "^11.0.3",
"@vueuse/integrations": "^11.0.0", "@vueuse/integrations": "^11.0.3",
"focus-trap": "^7.5.4", "focus-trap": "^7.5.4",
"mark.js": "8.11.1", "mark.js": "8.11.1",
"minisearch": "^7.1.0", "minisearch": "^7.1.0",
"shiki": "^1.13.0", "shiki": "^1.15.2",
"vite": "^5.4.1", "vite": "^5.4.2",
"vue": "^3.4.38" "vue": "^3.4.38"
}, },
"devDependencies": { "devDependencies": {
@ -140,7 +140,7 @@
"@types/markdown-it-emoji": "^3.0.1", "@types/markdown-it-emoji": "^3.0.1",
"@types/micromatch": "^4.0.9", "@types/micromatch": "^4.0.9",
"@types/minimist": "^1.2.5", "@types/minimist": "^1.2.5",
"@types/node": "^22.4.0", "@types/node": "^22.5.1",
"@types/postcss-prefix-selector": "^1.16.3", "@types/postcss-prefix-selector": "^1.16.3",
"@types/prompts": "^2.4.9", "@types/prompts": "^2.4.9",
"chokidar": "^3.6.0", "chokidar": "^3.6.0",
@ -156,15 +156,15 @@
"lodash.template": "^4.5.0", "lodash.template": "^4.5.0",
"lru-cache": "^11.0.0", "lru-cache": "^11.0.0",
"markdown-it": "^14.1.0", "markdown-it": "^14.1.0",
"markdown-it-anchor": "^9.0.1", "markdown-it-anchor": "^9.1.0",
"markdown-it-attrs": "^4.2.0", "markdown-it-attrs": "^4.2.0",
"markdown-it-container": "^4.0.0", "markdown-it-container": "^4.0.0",
"markdown-it-emoji": "^3.0.0", "markdown-it-emoji": "^3.0.0",
"markdown-it-mathjax3": "^4.3.2", "markdown-it-mathjax3": "^4.3.2",
"micromatch": "^4.0.7", "micromatch": "^4.0.8",
"minimist": "^1.2.8", "minimist": "^1.2.8",
"nanoid": "^5.0.7", "nanoid": "^5.0.7",
"ora": "^8.0.1", "ora": "^8.1.0",
"p-map": "^7.0.2", "p-map": "^7.0.2",
"path-to-regexp": "^6.2.2", "path-to-regexp": "^6.2.2",
"picocolors": "^1.0.1", "picocolors": "^1.0.1",
@ -176,7 +176,7 @@
"prompts": "^2.4.2", "prompts": "^2.4.2",
"punycode": "^2.3.1", "punycode": "^2.3.1",
"rimraf": "^6.0.1", "rimraf": "^6.0.1",
"rollup": "^4.20.0", "rollup": "^4.21.2",
"rollup-plugin-dts": "^6.1.1", "rollup-plugin-dts": "^6.1.1",
"rollup-plugin-esbuild": "^6.1.1", "rollup-plugin-esbuild": "^6.1.1",
"semver": "^7.6.3", "semver": "^7.6.3",
@ -187,8 +187,8 @@
"tinyglobby": "^0.2.5", "tinyglobby": "^0.2.5",
"typescript": "^5.5.4", "typescript": "^5.5.4",
"vitest": "^2.0.5", "vitest": "^2.0.5",
"vue-tsc": "^2.0.29", "vue-tsc": "^2.1.4",
"wait-on": "^7.2.0" "wait-on": "^8.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"markdown-it-mathjax3": "^4", "markdown-it-mathjax3": "^4",
@ -202,7 +202,7 @@
"optional": true "optional": true
} }
}, },
"packageManager": "pnpm@9.7.1", "packageManager": "pnpm@9.9.0",
"pnpm": { "pnpm": {
"peerDependencyRules": { "peerDependencyRules": {
"ignoreMissing": [ "ignoreMissing": [

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
import { defineComponent, h } from 'vue' import { defineComponent, h, watch } from 'vue'
import { useData, useRoute } from 'vitepress' import { useData, useRoute } from 'vitepress'
import { contentUpdatedCallbacks } from '../utils' import { contentUpdatedCallbacks } from '../utils'
@ -11,7 +11,8 @@ export const Content = defineComponent({
}, },
setup(props) { setup(props) {
const route = useRoute() const route = useRoute()
const { site } = useData() const { frontmatter, site } = useData()
watch(frontmatter, runCbs, { deep: true, flush: 'post' })
return () => return () =>
h( h(
props.as, props.as,

@ -48,7 +48,7 @@ export const containerPlugin = (
render: (tokens: Token[], idx: number) => render: (tokens: Token[], idx: number) =>
tokens[idx].nesting === 1 ? `<div class="vp-raw">\n` : `</div>\n` tokens[idx].nesting === 1 ? `<div class="vp-raw">\n` : `</div>\n`
}) })
.use(...createCodeGroup(options)) .use(...createCodeGroup(options, md))
} }
type ContainerArgs = [typeof container, string, { render: RenderRule }] type ContainerArgs = [typeof container, string, { render: RenderRule }]
@ -79,7 +79,7 @@ function createContainer(
] ]
} }
function createCodeGroup(options: Options): ContainerArgs { function createCodeGroup(options: Options, md: MarkdownIt): ContainerArgs {
return [ return [
container, container,
'code-group', 'code-group',
@ -111,7 +111,7 @@ function createCodeGroup(options: Options): ContainerArgs {
if (title) { if (title) {
const id = nanoid(7) const id = nanoid(7)
tabs += `<input type="radio" name="group-${name}" id="tab-${id}" ${checked}><label for="tab-${id}">${title}</label>` tabs += `<input type="radio" name="group-${name}" id="tab-${id}" ${checked}><label data-title="${md.utils.escapeHtml(title)}" for="tab-${id}">${title}</label>`
if (checked && !isHtml) tokens[i].info += ' active' if (checked && !isHtml) tokens[i].info += ' active'
checked = '' checked = ''

@ -57,21 +57,33 @@ export async function createMarkdownToVueRenderFn(
base, base,
siteConfig?.logger siteConfig?.logger
) )
pages = pages.map((p) => slash(p.replace(/\.md$/, ''))) pages = pages.map((p) => slash(p.replace(/\.md$/, '')))
const dynamicRoutes = new Map(
siteConfig?.dynamicRoutes?.routes.map((r) => [
r.fullPath,
path.join(srcDir, r.route)
]) || []
)
const rewrites = new Map(
Object.entries(siteConfig?.rewrites.map || {}).map(([key, value]) => [
path.join(srcDir, key),
path.join(srcDir, value!)
]) || []
)
return async ( return async (
src: string, src: string,
file: string, file: string,
publicDir: string publicDir: string
): Promise<MarkdownCompileResult> => { ): Promise<MarkdownCompileResult> => {
const fileOrig = file const fileOrig = dynamicRoutes.get(file) || file
const alias = file = rewrites.get(file) || file
siteConfig?.rewrites.map[file] || // virtual dynamic path file
siteConfig?.rewrites.map[file.slice(srcDir.length + 1)]
file = alias ? path.join(srcDir, alias) : file
const relativePath = slash(path.relative(srcDir, file)) const relativePath = slash(path.relative(srcDir, file))
const cacheKey = JSON.stringify({ src, file: fileOrig })
const cacheKey = JSON.stringify({ src, file: relativePath })
if (isBuild || options.cache !== false) { if (isBuild || options.cache !== false) {
const cached = cache.get(cacheKey) const cached = cache.get(cacheKey)
if (cached) { if (cached) {

@ -402,8 +402,9 @@ export async function createVitePressPlugin(
config.publicDir config.publicDir
) )
const relativePath = slash(path.relative(srcDir, file))
const payload: PageDataPayload = { const payload: PageDataPayload = {
path: `/${slash(path.relative(srcDir, file))}`, path: `/${siteConfig.rewrites.map[relativePath] || relativePath}`,
pageData pageData
} }

@ -28,7 +28,7 @@
* custom containers. * custom containers.
* *
* - `default`: The color used purely for subtle indication without any * - `default`: The color used purely for subtle indication without any
* special meanings attched to it such as bg color for menu hover state. * special meanings attached to it such as bg color for menu hover state.
* *
* - `brand`: Used for primary brand colors, such as link text, button with * - `brand`: Used for primary brand colors, such as link text, button with
* brand theme, etc. * brand theme, etc.

Loading…
Cancel
Save