Merge branch 'vuejs:main' into main

pull/3640/head
Timothy Lau 2 years ago committed by GitHub
commit 9d9d34feed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v3
- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v4

@ -156,7 +156,7 @@ Don't enable options like _Auto Minify_ for HTML code. It will remove comments f
uses: actions/checkout@v4
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
# - uses: pnpm/action-setup@v2 # Uncomment this if you're using pnpm
# - uses: pnpm/action-setup@v3 # Uncomment this if you're using pnpm
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
- name: Setup Node
uses: actions/setup-node@v4

@ -7,13 +7,16 @@ titleTemplate: Vite & Vue Powered Static Site Generator
hero:
name: VitePress
text: Vite & Vue Powered Static Site Generator
tagline: Simple, powerful, and fast. Meet the modern SSG framework you've always wanted.
tagline: Markdown to Beautiful Docs in Minutes
actions:
- theme: brand
text: Get Started
text: What is VitePress?
link: /guide/what-is-vitepress
- theme: alt
text: Quickstart
link: /guide/getting-started
- theme: alt
text: View on GitHub
text: GitHub
link: https://github.com/vuejs/vitepress
image:
src: /vitepress-logo-large.webp

@ -10,7 +10,7 @@
"lunaria:open": "open-cli .vitepress/dist/_translations/index.html"
},
"devDependencies": {
"@lunariajs/core": "^0.0.28",
"@lunariajs/core": "^0.0.31",
"markdown-it-mathjax3": "^4.3.2",
"open-cli": "^8.0.0",
"vitepress": "workspace:*"

@ -156,7 +156,7 @@ Não ative opções como _Auto Minify_ para código HTML. Isso removerá coment
uses: actions/checkout@v4
with:
fetch-depth: 0 # Não necessário se lastUpdated não estiver habilitado
# - uses: pnpm/action-setup@v2 # Descomente isso se estiver usando pnpm
# - uses: pnpm/action-setup@v3 # Descomente isso se estiver usando pnpm
# - uses: oven-sh/setup-bun@v1 # Descomente isso se estiver usando Bun
- name: Setup Node
uses: actions/setup-node@v4

@ -7,13 +7,16 @@ titleTemplate: Gerador de Site Estático desenvolvido com Vite & Vue
hero:
name: VitePress
text: Gerador de Site Estático Vite & Vue
tagline: Simples, poderoso e rápido. Conheça o moderno framework SSG que você sempre quis.
tagline: Markdown para Lindos Documentos em Minutos
actions:
- theme: brand
text: O que é VitePress?
link: /pt/guide/what-is-vitepress
- theme: alt
text: Iniciar
link: /pt/guide/getting-started
- theme: alt
text: Ver no GitHub
text: GitHub
link: https://github.com/vuejs/vitepress
image:
src: /vitepress-logo-large.webp

@ -156,7 +156,7 @@ Cache-Control: max-age=31536000,immutable
uses: actions/checkout@v4
with:
fetch-depth: 0 # 如果未启用 lastUpdated则不需要
# - uses: pnpm/action-setup@v2 # 如果使用 pnpm请取消注释
# - uses: pnpm/action-setup@v3 # 如果使用 pnpm请取消注释
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun请取消注释
- name: Setup Node
uses: actions/setup-node@v4

@ -7,9 +7,12 @@ titleTemplate: 由 Vite 和 Vue 驱动的静态站点生成器
hero:
name: VitePress
text: 由 Vite 和 Vue 驱动的静态站点生成器
tagline: 简单、强大、快速。就是你想要的现代 SSG 框架!
tagline: 将 Markdown 变成优雅的文档,只需几分钟
actions:
- theme: brand
text: 什么是 VitePress?
link: /zh/guide/what-is-vitepress
- theme: alt
text: 快速开始
link: /zh/guide/getting-started
- theme: alt

@ -3,7 +3,7 @@
"version": "1.0.0-rc.45",
"description": "Vite & Vue powered static site generator",
"type": "module",
"packageManager": "pnpm@8.15.3",
"packageManager": "pnpm@8.15.4",
"main": "dist/node/index.js",
"types": "types/index.d.ts",
"exports": {
@ -92,21 +92,21 @@
"release": "node scripts/release.js"
},
"dependencies": {
"@docsearch/css": "^3.5.2",
"@docsearch/js": "^3.5.2",
"@docsearch/css": "^3.6.0",
"@docsearch/js": "^3.6.0",
"@shikijs/core": "^1.1.7",
"@shikijs/transformers": "^1.1.7",
"@types/markdown-it": "^13.0.7",
"@vitejs/plugin-vue": "^5.0.4",
"@vue/devtools-api": "^7.0.14",
"@vueuse/core": "^10.7.2",
"@vueuse/integrations": "^10.7.2",
"@vue/devtools-api": "^7.0.16",
"@vueuse/core": "^10.9.0",
"@vueuse/integrations": "^10.9.0",
"focus-trap": "^7.5.4",
"mark.js": "8.11.1",
"minisearch": "^6.3.0",
"shiki": "^1.1.5",
"@shikijs/core": "^1.1.5",
"@shikijs/transformers": "^1.1.5",
"vite": "^5.1.3",
"vue": "^3.4.19"
"shiki": "^1.1.7",
"vite": "^5.1.5",
"vue": "^3.4.21"
},
"peerDependencies": {
"markdown-it-mathjax3": "^4.3.2",
@ -129,12 +129,12 @@
"@mdit-vue/plugin-title": "^2.0.0",
"@mdit-vue/plugin-toc": "^2.0.0",
"@mdit-vue/shared": "^2.0.0",
"@polka/compression": "1.0.0-next.25",
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@types/compression": "^1.7.5",
"@types/cross-spawn": "^6.0.6",
"@types/debug": "^4.1.12",
"@types/escape-html": "^1.0.4",
@ -146,12 +146,11 @@
"@types/markdown-it-emoji": "^2.0.4",
"@types/micromatch": "^4.0.6",
"@types/minimist": "^1.2.5",
"@types/node": "^20.11.19",
"@types/node": "^20.11.25",
"@types/postcss-prefix-selector": "^1.16.3",
"@types/prompts": "^2.4.9",
"@vue/shared": "^3.4.19",
"@vue/shared": "^3.4.21",
"chokidar": "^3.6.0",
"compression": "^1.7.4",
"conventional-changelog-cli": "^4.1.0",
"cross-spawn": "^7.0.3",
"debug": "^4.3.4",
@ -173,31 +172,31 @@
"markdown-it-mathjax3": "^4.3.2",
"micromatch": "^4.0.5",
"minimist": "^1.2.8",
"nanoid": "^5.0.5",
"nanoid": "^5.0.6",
"npm-run-all": "^4.1.5",
"ora": "^8.0.1",
"p-map": "^7.0.1",
"path-to-regexp": "^6.2.1",
"picocolors": "^1.0.0",
"pkg-dir": "^8.0.0",
"playwright-chromium": "^1.41.2",
"polka": "1.0.0-next.24",
"playwright-chromium": "^1.42.1",
"polka": "1.0.0-next.25",
"postcss-prefix-selector": "^1.16.0",
"prettier": "^3.2.5",
"prompts": "^2.4.2",
"punycode": "^2.3.1",
"rimraf": "^5.0.5",
"rollup": "^4.12.0",
"rollup": "^4.12.1",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-esbuild": "^6.1.1",
"semver": "^7.6.0",
"simple-git-hooks": "^2.9.0",
"simple-git-hooks": "^2.10.0",
"sirv": "^2.0.4",
"sitemap": "^7.1.1",
"supports-color": "^9.4.0",
"typescript": "^5.3.3",
"vitest": "^1.3.0",
"vue-tsc": "^1.8.27",
"typescript": "^5.4.2",
"vitest": "^1.3.1",
"vue-tsc": "^2.0.6",
"wait-on": "^7.2.0"
},
"simple-git-hooks": {

File diff suppressed because it is too large Load Diff

@ -2,7 +2,6 @@
import { useWindowScroll } from '@vueuse/core'
import { ref, watchPostEffect } from 'vue'
import { useData } from '../composables/data'
import { useLocalNav } from '../composables/local-nav'
import { useSidebar } from '../composables/sidebar'
import VPNavBarAppearance from './VPNavBarAppearance.vue'
import VPNavBarExtra from './VPNavBarExtra.vue'
@ -23,7 +22,6 @@ defineEmits<{
const { y } = useWindowScroll()
const { hasSidebar } = useSidebar()
const { hasLocalNav } = useLocalNav()
const { frontmatter } = useData()
const classes = ref<Record<string, boolean>>({})
@ -31,8 +29,8 @@ const classes = ref<Record<string, boolean>>({})
watchPostEffect(() => {
classes.value = {
'has-sidebar': hasSidebar.value,
'has-local-nav': hasLocalNav.value,
top: frontmatter.value.layout === 'home' && y.value === 0,
'home': frontmatter.value.layout === 'home',
'top': y.value === 0,
}
})
</script>
@ -79,16 +77,16 @@ watchPostEffect(() => {
transition: background-color 0.5s;
}
.VPNavBar.has-local-nav {
.VPNavBar:not(.home) {
background-color: var(--vp-nav-bg-color);
}
@media (min-width: 960px) {
.VPNavBar.has-local-nav {
.VPNavBar:not(.home) {
background-color: transparent;
}
.VPNavBar:not(.has-sidebar):not(.top) {
.VPNavBar:not(.has-sidebar):not(.home.top) {
background-color: var(--vp-nav-bg-color);
}
}
@ -188,12 +186,12 @@ watchPostEffect(() => {
}
@media (min-width: 960px) {
.VPNavBar:not(.top) .content-body {
.VPNavBar:not(.home.top) .content-body {
position: relative;
background-color: var(--vp-nav-bg-color);
}
.VPNavBar:not(.has-sidebar):not(.top) .content-body {
.VPNavBar:not(.has-sidebar):not(.home.top) .content-body {
background-color: transparent;
}
}
@ -253,16 +251,16 @@ watchPostEffect(() => {
transition: background-color 0.5s;
}
.VPNavBar.has-local-nav .divider-line {
.VPNavBar:not(.home) .divider-line {
background-color: var(--vp-c-gutter);
}
@media (min-width: 960px) {
.VPNavBar:not(.top) .divider-line {
.VPNavBar:not(.home.top) .divider-line {
background-color: var(--vp-c-gutter);
}
.VPNavBar:not(.has-sidebar):not(.top) .divider {
.VPNavBar:not(.has-sidebar):not(.home.top) .divider {
background-color: var(--vp-c-gutter);
}
}

@ -8,7 +8,10 @@ export function usePrevNext() {
return computed(() => {
const sidebar = getSidebar(theme.value.sidebar, page.value.relativePath)
const candidates = getFlatSideBarLinks(sidebar)
const links = getFlatSideBarLinks(sidebar)
// ignore inner-page links with hashes
const candidates = uniqBy(links, (link) => link.link.replace(/[?#].*$/, ''))
const index = candidates.findIndex((link) => {
return isActive(page.value.relativePath, link.link)
@ -61,3 +64,11 @@ export function usePrevNext() {
}
})
}
function uniqBy<T>(array: T[], keyFn: (item: T) => any): T[] {
const seen = new Set()
return array.filter((item) => {
const k = keyFn(item)
return seen.has(k) ? false : seen.add(k)
})
}

@ -1,8 +1,8 @@
import compression from 'compression'
import compression from '@polka/compression'
import fs from 'fs-extra'
import path from 'path'
import polka, { type IOptions } from 'polka'
import sirv, { type RequestHandler } from 'sirv'
import sirv from 'sirv'
import { resolveConfig } from '../config'
function trimChar(str: string, char: string) {
@ -37,7 +37,7 @@ export async function serve(options: ServeOptions = {}) {
res.end()
}
const compress = compression() as RequestHandler
const compress = compression({ brotli: true })
const serve = sirv(config.outDir, {
etag: true,
maxAge: 31536000,

Loading…
Cancel
Save