Skip to content

Commit abd8dbd

Browse files
authored
Merge branch 'main' into resolve-route
2 parents 24dd4ac + e08e81f commit abd8dbd

File tree

11 files changed

+116
-14
lines changed

11 files changed

+116
-14
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

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/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/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/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
})

packages/bundler-webpack/src/build/createClientConfig.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,18 @@ export const createClientConfig = async (
8484
// enable runtimeChunk
8585
config.optimization.runtimeChunk(true)
8686

87-
// minify css
88-
config.optimization
89-
.minimizer('css-minimizer-webpack-plugin')
90-
.use(CssMinimizerPlugin, [
91-
{
92-
minify:
93-
CssMinimizerPlugin.lightningCssMinify as CssMinimizerPlugin.BasicMinimizerImplementation<unknown>,
94-
},
95-
])
87+
// minimize
88+
config.optimization.minimize(true)
89+
90+
// minimizer
91+
config.optimization.set('minimizer', [
92+
// keep the default minimizer
93+
'...',
94+
// add css minimizer
95+
new CssMinimizerPlugin({
96+
minify: CssMinimizerPlugin.lightningCssMinify,
97+
}),
98+
])
9699

97100
// disable performance hints
98101
if (!app.env.isDebug) {

packages/client/src/resolvers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export const resolvers = reactive({
9797
resolveRouteLocale: (
9898
locales: SiteData['locales'],
9999
routePath: string,
100-
): RouteLocale => resolveLocalePath(locales, routePath),
100+
): RouteLocale => resolveLocalePath(locales, decodeURI(routePath)),
101101

102102
/**
103103
* Resolve site data for specific locale

0 commit comments

Comments
 (0)