Skip to content

Commit c4eff84

Browse files
committed
Merge branch 'route-link' into auto-link
2 parents 923619c + f3b3fb0 commit c4eff84

File tree

17 files changed

+5760
-4428
lines changed

17 files changed

+5760
-4428
lines changed

e2e/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
"@vuepress-e2e/conditional-exports": "file:./modules/conditional-exports",
2020
"@vuepress/bundler-vite": "workspace:*",
2121
"@vuepress/bundler-webpack": "workspace:*",
22-
"sass": "^1.74.1",
23-
"sass-loader": "^14.1.1",
24-
"vue": "^3.4.21",
22+
"sass": "^1.75.0",
23+
"sass-loader": "^14.2.1",
24+
"vue": "^3.4.23",
2525
"vuepress": "workspace:*"
2626
},
2727
"devDependencies": {
28-
"@playwright/test": "^1.43.0",
28+
"@playwright/test": "^1.43.1",
2929
"anywhere": "^1.6.0",
3030
"cross-env": "^7.0.3"
3131
}

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
},
3131
"prettier": "prettier-config-vuepress",
3232
"devDependencies": {
33-
"@commitlint/cli": "^19.2.1",
34-
"@commitlint/config-conventional": "^19.1.0",
33+
"@commitlint/cli": "^19.2.2",
34+
"@commitlint/config-conventional": "^19.2.2",
3535
"@commitlint/types": "^19.0.3",
36-
"@types/node": "^20.12.5",
36+
"@types/node": "^20.12.7",
3737
"@types/webpack-env": "^1.18.4",
38-
"@vitest/coverage-istanbul": "^1.4.0",
38+
"@vitest/coverage-istanbul": "^1.5.0",
3939
"bumpp": "^9.4.0",
4040
"conventional-changelog-cli": "^4.1.0",
4141
"eslint": "^8.57.0",
@@ -49,11 +49,11 @@
4949
"sort-package-json": "^2.10.0",
5050
"tsconfig-vuepress": "^4.5.0",
5151
"tsup": "^8.0.2",
52-
"typescript": "^5.4.4",
53-
"vite": "~5.2.8",
54-
"vitest": "^1.4.0"
52+
"typescript": "^5.4.5",
53+
"vite": "~5.2.10",
54+
"vitest": "^1.5.0"
5555
},
56-
"packageManager": "pnpm@8.15.6",
56+
"packageManager": "pnpm@9.0.4",
5757
"engines": {
5858
"node": ">=18.16.0"
5959
}

packages/bundler-vite/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
"connect-history-api-fallback": "^2.0.0",
4343
"postcss": "^8.4.38",
4444
"postcss-load-config": "^5.0.3",
45-
"rollup": "^4.14.1",
46-
"vite": "~5.2.8",
47-
"vue": "^3.4.21",
48-
"vue-router": "^4.3.0"
45+
"rollup": "^4.16.0",
46+
"vite": "~5.2.10",
47+
"vue": "^3.4.23",
48+
"vue-router": "^4.3.2"
4949
},
5050
"publishConfig": {
5151
"access": "public"

packages/bundler-vite/src/plugins/vuepressMainPlugin.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ import 'vuepress/client-app'
8282
host: app.options.host,
8383
port: app.options.port,
8484
open: app.options.open,
85+
// ref: https://github.com/vitejs/vite/issues/15784#issuecomment-1923683823
86+
fs: { cachedChecks: false },
8587
},
8688
build: {
8789
ssr: isServer,

packages/bundler-webpack/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@
4545
"autoprefixer": "^10.4.19",
4646
"chokidar": "^3.6.0",
4747
"copy-webpack-plugin": "^12.0.2",
48-
"css-loader": "^7.0.0",
48+
"css-loader": "^7.1.1",
4949
"esbuild-loader": "~4.1.0",
5050
"express": "^4.19.2",
5151
"html-webpack-plugin": "^5.6.0",
52-
"mini-css-extract-plugin": "^2.8.1",
52+
"mini-css-extract-plugin": "^2.9.0",
5353
"postcss": "^8.4.38",
5454
"postcss-csso": "^6.0.1",
5555
"postcss-loader": "^8.1.1",
56-
"style-loader": "^3.3.4",
57-
"vue": "^3.4.21",
56+
"style-loader": "^4.0.0",
57+
"vue": "^3.4.23",
5858
"vue-loader": "^17.4.2",
59-
"vue-router": "^4.3.0",
59+
"vue-router": "^4.3.2",
6060
"webpack": "^5.91.0",
6161
"webpack-chain": "^6.5.1",
6262
"webpack-dev-server": "^5.0.4",

packages/client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"dependencies": {
4040
"@vue/devtools-api": "^6.6.1",
4141
"@vuepress/shared": "workspace:*",
42-
"vue": "^3.4.21",
43-
"vue-router": "^4.3.0"
42+
"vue": "^3.4.23",
43+
"vue-router": "^4.3.2"
4444
},
4545
"publishConfig": {
4646
"access": "public"

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"@vuepress/markdown": "workspace:*",
3636
"@vuepress/shared": "workspace:*",
3737
"@vuepress/utils": "workspace:*",
38-
"vue": "^3.4.21"
38+
"vue": "^3.4.23"
3939
},
4040
"publishConfig": {
4141
"access": "public"

packages/core/src/page/resolvePageChunkInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { path, sanitizeFileName } from '@vuepress/utils'
1+
import { path, transformPathToFileName } from '@vuepress/utils'
22
import type { App } from '../types/index.js'
33

44
/**
@@ -17,7 +17,7 @@ export const resolvePageChunkInfo = ({
1717
} => {
1818
const chunkFilePathRelative = path.join('pages', `${htmlFilePathRelative}.js`)
1919
const chunkFilePath = app.dir.temp(chunkFilePathRelative)
20-
const chunkName = sanitizeFileName(path.basename(htmlFilePathRelative))
20+
const chunkName = transformPathToFileName(htmlFilePathRelative)
2121

2222
return {
2323
chunkFilePath,

packages/core/src/page/resolvePagePermalink.ts

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,23 @@ export const resolvePagePermalink = ({
2020
pathInferred: string | null
2121
pathLocale: string
2222
}): string | null => {
23-
// use permalink in frontmatter directly
23+
// frontmatter.permalink has the highest priority
24+
if (frontmatter.permalink === null) {
25+
return null
26+
}
2427
if (isString(frontmatter.permalink)) {
2528
return frontmatter.permalink
2629
}
2730

28-
// get permalink pattern
29-
const permalinkPattern = getPermalinkPattern({ app, frontmatter })
30-
if (permalinkPattern === null) {
31+
// frontmatter.permalinkPattern has higher priority than app.options.permalinkPattern
32+
if (frontmatter.permalinkPattern === null) {
33+
return null
34+
}
35+
36+
const permalinkPattern =
37+
frontmatter.permalinkPattern || app.options.permalinkPattern
38+
39+
if (!isString(permalinkPattern)) {
3140
return null
3241
}
3342

@@ -45,22 +54,3 @@ export const resolvePagePermalink = ({
4554

4655
return ensureLeadingSlash(link)
4756
}
48-
49-
/**
50-
* Get permalink pattern from frontmatter or app options
51-
*/
52-
const getPermalinkPattern = ({
53-
app,
54-
frontmatter,
55-
}: {
56-
app: App
57-
frontmatter: PageFrontmatter
58-
}): string | null => {
59-
if (frontmatter.permalinkPattern === null) {
60-
return null
61-
}
62-
if (isString(frontmatter.permalinkPattern)) {
63-
return frontmatter.permalinkPattern
64-
}
65-
return app.options.permalinkPattern
66-
}

packages/core/tests/page/resolvePagePermalink.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@ describe('core > page > resolvePagePermalink', () => {
3636
expect(resolved).toBe('/frontmatter')
3737
})
3838

39+
it('should return null', () => {
40+
const resolved = resolvePagePermalink({
41+
app: appWithPermalinkPattern,
42+
frontmatter: {
43+
permalink: null,
44+
},
45+
slug: '',
46+
date: '',
47+
pathInferred: '/inferred',
48+
pathLocale: '',
49+
})
50+
51+
expect(resolved).toBe(null)
52+
})
53+
3954
it('should use permalinkPattern in frontmatter', () => {
4055
const resolved = resolvePagePermalink({
4156
app,

packages/markdown/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
"clean": "rimraf dist"
3232
},
3333
"dependencies": {
34-
"@mdit-vue/plugin-component": "^2.1.0",
35-
"@mdit-vue/plugin-frontmatter": "^2.1.0",
36-
"@mdit-vue/plugin-headers": "^2.1.0",
37-
"@mdit-vue/plugin-sfc": "^2.1.0",
38-
"@mdit-vue/plugin-title": "^2.1.0",
39-
"@mdit-vue/plugin-toc": "^2.1.0",
40-
"@mdit-vue/shared": "^2.1.0",
34+
"@mdit-vue/plugin-component": "^2.1.2",
35+
"@mdit-vue/plugin-frontmatter": "^2.1.2",
36+
"@mdit-vue/plugin-headers": "^2.1.2",
37+
"@mdit-vue/plugin-sfc": "^2.1.2",
38+
"@mdit-vue/plugin-title": "^2.1.2",
39+
"@mdit-vue/plugin-toc": "^2.1.2",
40+
"@mdit-vue/shared": "^2.1.2",
4141
"@mdit-vue/types": "^2.1.0",
42-
"@types/markdown-it": "^14.0.0",
42+
"@types/markdown-it": "^14.0.1",
4343
"@types/markdown-it-emoji": "^2.0.5",
4444
"@vuepress/shared": "workspace:*",
4545
"@vuepress/utils": "workspace:*",

packages/shared/src/types/page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export type PageFrontmatter<
6262
head?: HeadConfig[]
6363
lang?: string
6464
layout?: string
65-
permalink?: string
65+
permalink?: string | null
6666
permalinkPattern?: string | null
6767
routeMeta?: Record<string, unknown>
6868
title?: string

packages/shared/tests/normalizeRoutePath.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,18 @@ const testCases = [
183183
[['foo/.md'], 'foo/.html'],
184184
[['/.md'], '/.html'],
185185
[['/foo/.md'], '/foo/.html'],
186+
[['.md', '/a/'], '/a/.html'],
187+
[['foo/.md', '/a/'], '/a/foo/.html'],
188+
[['/.md', '/a/'], '/.html'],
189+
[['/foo/.md', '/a/'], '/foo/.html'],
190+
[['.md', '/a/index.html'], '/a/.html'],
191+
[['foo/.md', '/a/index.html'], '/a/foo/.html'],
192+
[['/.md', '/a/index.html'], '/.html'],
193+
[['/foo/.md', '/a/index.html'], '/foo/.html'],
194+
[['.md', '/a/b.html'], '/a/.html'],
195+
[['foo/.md', '/a/b.html'], '/a/foo/.html'],
196+
[['/.md', '/a/b.html'], '/.html'],
197+
[['/foo/.md', '/a/b.html'], '/foo/.html'],
186198
]
187199

188200
describe('should normalize clean paths correctly', () => {

packages/utils/src/module/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from './getDirname.js'
22
export * from './importFile.js'
33
export * from './isChildPath.js'
44
export * from './sanitizeFileName.js'
5+
export * from './transformPathToFileName.js'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { sanitizeFileName } from './sanitizeFileName.js'
2+
3+
/**
4+
* Transforms a path to a file name, replacing slashes with underscores
5+
*/
6+
export const transformPathToFileName = (rawPath: string): string =>
7+
sanitizeFileName(rawPath.replace(/\//g, '_'))

packages/vuepress/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@vuepress/markdown": "workspace:*",
5656
"@vuepress/shared": "workspace:*",
5757
"@vuepress/utils": "workspace:*",
58-
"vue": "^3.4.21"
58+
"vue": "^3.4.23"
5959
},
6060
"peerDependencies": {
6161
"@vuepress/bundler-vite": "workspace:*",

0 commit comments

Comments
 (0)