Skip to content

Commit 5cda79f

Browse files
committed
Merge branch 'main' into route-option
2 parents 675c02d + 5615fd3 commit 5cda79f

File tree

79 files changed

+1339
-864
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1339
-864
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@v4
2424

2525
- name: Install pnpm
26-
uses: pnpm/action-setup@v2
26+
uses: pnpm/action-setup@v4
2727

2828
- name: Use Node.js ${{ matrix.node }}
2929
uses: actions/setup-node@v4

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- uses: actions/checkout@v4
2424

2525
- name: Install pnpm
26-
uses: pnpm/action-setup@v2
26+
uses: pnpm/action-setup@v4
2727

2828
- name: Setup Node.js
2929
uses: actions/setup-node@v4

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- uses: actions/checkout@v4
2525

2626
- name: Install pnpm
27-
uses: pnpm/action-setup@v2
27+
uses: pnpm/action-setup@v4
2828

2929
- name: Use Node.js ${{ matrix.node }}
3030
uses: actions/setup-node@v4

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"frontmatter",
2929
"globby",
3030
"gtag",
31+
"lightningcss",
3132
"mdit",
3233
"nprogress",
3334
"prefetch",

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# [2.0.0-rc.11](https://github.com/vuepress/core/compare/v2.0.0-rc.10...v2.0.0-rc.11) (2024-05-16)
2+
3+
4+
### Features
5+
6+
* **client:** improve AutoLinkProps ([#1554](https://github.com/vuepress/core/issues/1554)) ([0777d09](https://github.com/vuepress/core/commit/0777d098e420ebc44ed9bb983009ee5d6367bb1d))
7+
* **client:** support slot props in AutoLink ([630e29a](https://github.com/vuepress/core/commit/630e29a0a64973cf41369b854c0663ea36b12608))
8+
9+
10+
111
# [2.0.0-rc.10](https://github.com/vuepress/core/compare/v2.0.0-rc.9...v2.0.0-rc.10) (2024-05-16)
212

313

e2e/docs/.vuepress/config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ export default defineUserConfig({
4141
['meta', { name: 'bar', content: 'foobar zh' }],
4242
],
4343
},
44+
'/中文/': {
45+
lang: '中文',
46+
title: 'VuePress E2E',
47+
description: 'VuePress E2E 测试站点',
48+
head: [
49+
['meta', { name: 'foo-中文', content: 'foo-中文' }],
50+
['meta', { name: 'bar', content: '中文' }],
51+
],
52+
},
4453
},
4554

4655
markdown: {

e2e/docs/.vuepress/theme/client/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { defineClientConfig } from 'vuepress/client'
22
import RootComponentFromTheme from './components/RootComponentFromTheme.vue'
3+
import CssModulesLayout from './layouts/CssModulesLayout.vue'
34
import CustomLayout from './layouts/CustomLayout.vue'
45
import Layout from './layouts/Layout.vue'
56
import NotFound from './layouts/NotFound.vue'
@@ -16,6 +17,7 @@ export default defineClientConfig({
1617
},
1718

1819
layouts: {
20+
CssModulesLayout,
1921
CustomLayout,
2022
Layout,
2123
NotFound,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script setup lang="ts">
2+
import styles from '../styles/styles.module.css'
3+
import variables from '../styles/variables.module.scss'
4+
</script>
5+
6+
<template>
7+
<div class="e2e-theme-css-modules-layout">
8+
<main class="e2e-theme-css-modules-layout-content">
9+
<div id="e2e-theme-css-modules-scss">{{ variables.fooScss }}</div>
10+
<div id="e2e-theme-css-modules-css" :class="styles.greenText">
11+
CSS modules green text
12+
</div>
13+
<Content />
14+
</main>
15+
</div>
16+
</template>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.greenText {
2+
color: rgb(0, 129, 0);
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:export {
2+
fooScss: 234px;
3+
}

e2e/docs/components/auto-link.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,39 @@
11
# AutoLink
22

33
<div id="route-link">
4-
<AutoLink v-for="item in routeLinksConfig" v-bind="item" />
4+
<AutoLink v-for="item in routeLinksConfig" :config="item" />
55
</div>
66

77
<div id="external-link">
8-
<AutoLink v-for="item in externalLinksConfig" v-bind="item" />
8+
<AutoLink v-for="item in externalLinksConfig" :config="item" />
99
</div>
1010

1111
<div id="config">
12-
<AutoLink v-bind="{ text: 'text1', link: '/', ariaLabel: 'label' }" />
13-
<AutoLink v-bind="{ text: 'text2', link: 'https://example.com/test/' }" />
12+
<AutoLink :config="{ text: 'text1', link: '/', ariaLabel: 'label' }" />
13+
<AutoLink :config="{ text: 'text2', link: 'https://example.com/test/' }" />
14+
</div>
15+
16+
<div id="attrs">
17+
<AutoLink class="class" :config="{ text: 'text1', link: '/', ariaLabel: 'label', icon: 'icon1' }" />
18+
<AutoLink id="id" :config="{ text: 'text2', link: 'https://example.com/test/', unknown: 'value' }" />
19+
<AutoLink download="example-test.png" :config="{ text: 'text3', link: 'https://example.com/test.png' }" />
20+
</div>
21+
22+
<div id="slots">
23+
<AutoLink :config="{ text: 'text1', link: '/', ariaLabel: 'label', icon: 'icon1' }">
24+
slot-text
25+
</AutoLink>
26+
<AutoLink :config="{ text: 'text2', link: '/', ariaLabel: 'label', icon: 'icon1' }">
27+
<template v-slot="{ ariaLabel }">{{ ariaLabel }}</template>
28+
</AutoLink>
29+
<AutoLink :config="{ text: 'text3', link: '/', ariaLabel: 'label', icon: 'icon1' }">
30+
<template #before>before</template>
31+
<template #after>after</template>
32+
</AutoLink>
33+
<AutoLink :config="{ text: 'text4', link: '/', ariaLabel: 'label', icon: 'icon1' }">
34+
<template #before="{ ariaLabel }">before {{ ariaLabel }}</template>
35+
<template #after="{ ariaLabel }">after {{ ariaLabel }}</template>
36+
</AutoLink>
1437
</div>
1538

1639
<script setup lang="ts">

e2e/docs/styles/css-container.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Check if the `@container` rule could be supported and minimized correctly.
2+
3+
<div class="container">
4+
5+
Container text
6+
7+
</div>
8+
9+
<style>
10+
.container {
11+
container-type: inline-size;
12+
}
13+
.container p {
14+
font-size: clamp(.75rem, calc(100cqw / 40), 2rem);
15+
text-align: left;
16+
}
17+
@container (max-width: 480px) {
18+
.container p {
19+
text-align: center;
20+
font-weight: bold;
21+
}
22+
}
23+
</style>

e2e/docs/styles/css-modules.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
layout: CssModulesLayout
3+
---

e2e/docs/zh/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
foo
1+
bar

e2e/docs/中文/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
baz

e2e/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vuepress/e2e",
3-
"version": "2.0.0-rc.10",
3+
"version": "2.0.0-rc.11",
44
"private": true,
55
"type": "module",
66
"scripts": {
@@ -19,7 +19,7 @@
1919
"@vuepress-e2e/conditional-exports": "file:./modules/conditional-exports",
2020
"@vuepress/bundler-vite": "workspace:*",
2121
"@vuepress/bundler-webpack": "workspace:*",
22-
"sass": "^1.77.1",
22+
"sass": "^1.77.2",
2323
"sass-loader": "^14.2.1",
2424
"vue": "^3.4.27",
2525
"vuepress": "workspace:*"

e2e/tests/components/auto-link.spec.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,41 @@ test('should render config correctly', async ({ page }) => {
3636
await expect(locator.nth(1)).toHaveAttribute('target', '_blank')
3737
await expect(locator.nth(1)).toHaveAttribute('rel', 'noopener noreferrer')
3838
})
39+
40+
test('should append attrs correctly', async ({ page }) => {
41+
const locator = page.locator('.e2e-theme-content #attrs a')
42+
43+
await expect(locator.nth(0)).toHaveText('text1')
44+
await expect(locator.nth(0)).toHaveAttribute('href', BASE)
45+
await expect(locator.nth(0)).toHaveAttribute('aria-label', 'label')
46+
await expect(locator.nth(0)).toHaveAttribute('class', /class/)
47+
await expect(locator.nth(0)).not.toHaveAttribute('icon')
48+
49+
await expect(locator.nth(1)).toHaveText('text2')
50+
await expect(locator.nth(1)).toHaveAttribute(
51+
'href',
52+
'https://example.com/test/',
53+
)
54+
await expect(locator.nth(1)).toHaveAttribute('target', '_blank')
55+
await expect(locator.nth(1)).toHaveAttribute('rel', 'noopener noreferrer')
56+
await expect(locator.nth(1)).toHaveAttribute('id', 'id')
57+
await expect(locator.nth(1)).not.toHaveAttribute('unknown')
58+
59+
await expect(locator.nth(2)).toHaveText('text3')
60+
await expect(locator.nth(2)).toHaveAttribute(
61+
'href',
62+
'https://example.com/test.png',
63+
)
64+
await expect(locator.nth(2)).toHaveAttribute('target', '_blank')
65+
await expect(locator.nth(2)).toHaveAttribute('rel', 'noopener noreferrer')
66+
await expect(locator.nth(2)).toHaveAttribute('download', 'example-test.png')
67+
})
68+
69+
test('should render slots correctly', async ({ page }) => {
70+
const locator = page.locator('.e2e-theme-content #slots a')
71+
72+
await expect(locator.nth(0)).toHaveText('slot-text')
73+
await expect(locator.nth(1)).toHaveText('label')
74+
await expect(locator.nth(2)).toHaveText('beforetext3after')
75+
await expect(locator.nth(3)).toHaveText('before labeltext4after label')
76+
})

e2e/tests/site-data.spec.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,50 @@ test.describe('zh-CN', () => {
9595
await expect(fooZhLocator.first()).toHaveAttribute('content', 'foo-zh')
9696
})
9797
})
98+
99+
test.describe('non-ASCII', () => {
100+
test.beforeEach(async ({ page }) => page.goto('中文/'))
101+
102+
test('lang', async ({ page }) => {
103+
await expect(page.locator('html')).toHaveAttribute('lang', '中文')
104+
})
105+
106+
test('title', async ({ page }) => {
107+
const locator = page.locator('head title')
108+
109+
await expect(page).toHaveTitle('VuePress E2E')
110+
await expect(locator).toHaveCount(1)
111+
await expect(locator.first()).toHaveText('VuePress E2E', {
112+
useInnerText: true,
113+
})
114+
})
115+
116+
test('description', async ({ page }) => {
117+
const locator = page.locator('head meta[name="description"]')
118+
119+
await expect(locator).toHaveCount(1)
120+
await expect(locator.first()).toHaveAttribute(
121+
'content',
122+
'VuePress E2E 测试站点',
123+
)
124+
})
125+
126+
test('head', async ({ page }) => {
127+
const fooLocator = page.locator('head meta[name="foo"]')
128+
const barLocator = page.locator('head meta[name="bar"]')
129+
const bazLocator = page.locator('head meta[name="baz"]')
130+
const fooChsLocator = page.locator('head meta[name="foo-中文"]')
131+
132+
await expect(fooLocator).toHaveCount(1)
133+
await expect(fooLocator.first()).toHaveAttribute('content', 'foo')
134+
135+
await expect(barLocator).toHaveCount(1)
136+
await expect(barLocator.first()).toHaveAttribute('content', '中文')
137+
138+
await expect(bazLocator).toHaveCount(1)
139+
await expect(bazLocator.first()).toHaveAttribute('content', 'baz')
140+
141+
await expect(fooChsLocator).toHaveCount(1)
142+
await expect(fooChsLocator.first()).toHaveAttribute('content', 'foo-中文')
143+
})
144+
})

e2e/tests/styles/css-modules.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { expect, test } from '@playwright/test'
2+
3+
test('Should load CSS modules correctly', async ({ page }) => {
4+
await page.goto('styles/css-modules.html')
5+
await expect(page.locator('#e2e-theme-css-modules-scss')).toHaveText('234px')
6+
await expect(page.locator('#e2e-theme-css-modules-css')).toHaveCSS(
7+
'color',
8+
'rgb(0, 129, 0)',
9+
)
10+
})

e2e/tests/update-head.spec.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ test('should update head correctly', async ({ page }) => {
99
const bazLocator = page.locator('head meta[name="baz"]')
1010
const fooEnLocator = page.locator('head meta[name="foo-en"]')
1111
const fooZhLocator = page.locator('head meta[name="foo-zh"]')
12+
const fooChsLocator = page.locator('head meta[name="foo-中文"]')
1213

1314
// en-US
1415
await page.goto('')
@@ -36,6 +37,8 @@ test('should update head correctly', async ({ page }) => {
3637
await expect(bazLocator.first()).toHaveAttribute('content', 'foobar baz')
3738
await expect(fooEnLocator).toHaveCount(1)
3839
await expect(fooEnLocator.first()).toHaveAttribute('content', 'foo-en')
40+
await expect(fooZhLocator).toHaveCount(0)
41+
await expect(fooChsLocator).toHaveCount(0)
3942

4043
// navigate to zh-CN
4144
await page.locator('.e2e-theme-nav a', { hasText: 'zh-CN' }).click()
@@ -61,6 +64,37 @@ test('should update head correctly', async ({ page }) => {
6164
await expect(barLocator.first()).toHaveAttribute('content', 'foobar zh')
6265
await expect(bazLocator).toHaveCount(1)
6366
await expect(bazLocator.first()).toHaveAttribute('content', 'baz')
67+
await expect(fooEnLocator).toHaveCount(0)
6468
await expect(fooZhLocator).toHaveCount(1)
6569
await expect(fooZhLocator.first()).toHaveAttribute('content', 'foo-zh')
70+
await expect(fooChsLocator).toHaveCount(0)
71+
72+
// navigate to non-ASCII path
73+
await page.locator('.e2e-theme-nav a', { hasText: '中文' }).click()
74+
75+
// lang
76+
await expect(htmlLocator).toHaveAttribute('lang', '中文')
77+
// title
78+
await expect(page).toHaveTitle('VuePress E2E')
79+
await expect(titleLocator).toHaveCount(1)
80+
await expect(titleLocator.first()).toHaveText('VuePress E2E', {
81+
useInnerText: true,
82+
})
83+
// description
84+
await expect(descriptionLocator).toHaveCount(1)
85+
await expect(descriptionLocator.first()).toHaveAttribute(
86+
'content',
87+
'VuePress E2E 测试站点',
88+
)
89+
// head
90+
await expect(fooLocator).toHaveCount(1)
91+
await expect(fooLocator.first()).toHaveAttribute('content', 'foo')
92+
await expect(barLocator).toHaveCount(1)
93+
await expect(barLocator.first()).toHaveAttribute('content', '中文')
94+
await expect(bazLocator).toHaveCount(1)
95+
await expect(bazLocator.first()).toHaveAttribute('content', 'baz')
96+
await expect(fooEnLocator).toHaveCount(0)
97+
await expect(fooZhLocator).toHaveCount(0)
98+
await expect(fooChsLocator).toHaveCount(1)
99+
await expect(fooChsLocator.first()).toHaveAttribute('content', 'foo-中文')
66100
})

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vuepress/monorepo",
3-
"version": "2.0.0-rc.10",
3+
"version": "2.0.0-rc.11",
44
"private": true,
55
"type": "module",
66
"scripts": {
@@ -43,7 +43,7 @@
4343
"eslint-config-vuepress": "^4.10.1",
4444
"eslint-config-vuepress-typescript": "^4.10.1",
4545
"husky": "^9.0.11",
46-
"lint-staged": "^15.2.2",
46+
"lint-staged": "^15.2.4",
4747
"prettier": "^3.2.5",
4848
"prettier-config-vuepress": "^4.4.0",
4949
"rimraf": "^5.0.7",
@@ -53,9 +53,9 @@
5353
"typescript": "^5.4.5",
5454
"vite": "~5.2.11",
5555
"vitest": "^1.6.0",
56-
"vue-tsc": "^2.0.17"
56+
"vue-tsc": "^2.0.19"
5757
},
58-
"packageManager": "[email protected].1",
58+
"packageManager": "[email protected].2",
5959
"engines": {
6060
"node": ">=18.16.0"
6161
}

packages/bundler-vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vuepress/bundler-vite",
3-
"version": "2.0.0-rc.10",
3+
"version": "2.0.0-rc.11",
44
"description": "Bundler vite package of VuePress",
55
"keywords": [
66
"vuepress-bundler",

0 commit comments

Comments
 (0)