@docusaurus/core 4.0.0-canary-6848 → 4.0.0-canary-6858
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/server/brokenLinks.js +21 -5
- package/package.json +13 -13
|
@@ -19,6 +19,22 @@ function matchRoutes(routeConfig, pathname) {
|
|
|
19
19
|
// We don't actually access component here, so it's fine.
|
|
20
20
|
return (0, react_router_config_1.matchRoutes)(routeConfig, pathname);
|
|
21
21
|
}
|
|
22
|
+
function safeDecodeURI(value) {
|
|
23
|
+
try {
|
|
24
|
+
return decodeURI(value);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function safeDecodeURIComponent(value) {
|
|
31
|
+
try {
|
|
32
|
+
return decodeURIComponent(value);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
22
38
|
function createBrokenLinksHelper({ collectedLinks, routes, }) {
|
|
23
39
|
const validPathnames = new Set(collectedLinks.keys());
|
|
24
40
|
// IMPORTANT: this is an optimization
|
|
@@ -57,7 +73,7 @@ function createBrokenLinksHelper({ collectedLinks, routes, }) {
|
|
|
57
73
|
return false;
|
|
58
74
|
}
|
|
59
75
|
function isPathBrokenLink(linkPath) {
|
|
60
|
-
const pathnames = [linkPath.pathname,
|
|
76
|
+
const pathnames = [linkPath.pathname, safeDecodeURI(linkPath.pathname)];
|
|
61
77
|
if (pathnames.some((p) => validPathnames.has(p))) {
|
|
62
78
|
return false;
|
|
63
79
|
}
|
|
@@ -79,14 +95,14 @@ function createBrokenLinksHelper({ collectedLinks, routes, }) {
|
|
|
79
95
|
return false;
|
|
80
96
|
}
|
|
81
97
|
const targetPage = collectedLinks.get(pathname) ??
|
|
82
|
-
collectedLinks.get(
|
|
98
|
+
collectedLinks.get(safeDecodeURI(pathname)) ??
|
|
83
99
|
// The broken link checker should not care about a trailing slash
|
|
84
100
|
// Those are already covered by the broken pathname checker
|
|
85
101
|
// See https://github.com/facebook/docusaurus/issues/10116
|
|
86
102
|
collectedLinks.get((0, utils_common_1.addTrailingSlash)(pathname)) ??
|
|
87
|
-
collectedLinks.get((0, utils_common_1.addTrailingSlash)(
|
|
103
|
+
collectedLinks.get((0, utils_common_1.addTrailingSlash)(safeDecodeURI(pathname))) ??
|
|
88
104
|
collectedLinks.get((0, utils_common_1.removeTrailingSlash)(pathname)) ??
|
|
89
|
-
collectedLinks.get((0, utils_common_1.removeTrailingSlash)(
|
|
105
|
+
collectedLinks.get((0, utils_common_1.removeTrailingSlash)(safeDecodeURI(pathname)));
|
|
90
106
|
// link with anchor to a page that does not exist (or did not collect any
|
|
91
107
|
// link/anchor) is considered as a broken anchor
|
|
92
108
|
if (!targetPage) {
|
|
@@ -94,7 +110,7 @@ function createBrokenLinksHelper({ collectedLinks, routes, }) {
|
|
|
94
110
|
}
|
|
95
111
|
// it's a not broken anchor if the anchor exists on the target page
|
|
96
112
|
if (targetPage.anchors.has(hash) ||
|
|
97
|
-
targetPage.anchors.has(
|
|
113
|
+
targetPage.anchors.has(safeDecodeURIComponent(hash))) {
|
|
98
114
|
return false;
|
|
99
115
|
}
|
|
100
116
|
return true;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/core",
|
|
3
3
|
"description": "Easy to Maintain Open Source Documentation Websites",
|
|
4
|
-
"version": "4.0.0-canary-
|
|
4
|
+
"version": "4.0.0-canary-6858",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"url": "https://github.com/facebook/docusaurus/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@docusaurus/babel": "4.0.0-canary-
|
|
37
|
-
"@docusaurus/bundler": "4.0.0-canary-
|
|
38
|
-
"@docusaurus/glob": "4.0.0-canary-
|
|
39
|
-
"@docusaurus/logger": "4.0.0-canary-
|
|
40
|
-
"@docusaurus/mdx-loader": "4.0.0-canary-
|
|
41
|
-
"@docusaurus/utils": "4.0.0-canary-
|
|
42
|
-
"@docusaurus/utils-common": "4.0.0-canary-
|
|
43
|
-
"@docusaurus/utils-validation": "4.0.0-canary-
|
|
36
|
+
"@docusaurus/babel": "4.0.0-canary-6858",
|
|
37
|
+
"@docusaurus/bundler": "4.0.0-canary-6858",
|
|
38
|
+
"@docusaurus/glob": "4.0.0-canary-6858",
|
|
39
|
+
"@docusaurus/logger": "4.0.0-canary-6858",
|
|
40
|
+
"@docusaurus/mdx-loader": "4.0.0-canary-6858",
|
|
41
|
+
"@docusaurus/utils": "4.0.0-canary-6858",
|
|
42
|
+
"@docusaurus/utils-common": "4.0.0-canary-6858",
|
|
43
|
+
"@docusaurus/utils-validation": "4.0.0-canary-6858",
|
|
44
44
|
"boxen": "^8.0.1",
|
|
45
45
|
"cli-table3": "^0.6.5",
|
|
46
46
|
"combine-promises": "^1.2.0",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"webpack-merge": "^6.0.1"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@docusaurus/module-type-aliases": "4.0.0-canary-
|
|
78
|
-
"@docusaurus/types": "4.0.0-canary-
|
|
77
|
+
"@docusaurus/module-type-aliases": "4.0.0-canary-6858",
|
|
78
|
+
"@docusaurus/types": "4.0.0-canary-6858",
|
|
79
79
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
80
80
|
"@types/escape-html": "^1.0.4",
|
|
81
81
|
"@types/history": "^4.7.11",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"utility-types": "^3.11.0"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
|
-
"@docusaurus/faster": "4.0.0-canary-
|
|
93
|
+
"@docusaurus/faster": "4.0.0-canary-6858",
|
|
94
94
|
"@mdx-js/react": "^3.1.1",
|
|
95
95
|
"react": "^19.3.0",
|
|
96
96
|
"react-dom": "^19.3.0"
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"engines": {
|
|
104
104
|
"node": ">=24.21"
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "90fa884c0e0054316bff1a2d5cca623325ceefdd"
|
|
107
107
|
}
|