@docusaurus/core 0.0.0-4727 → 0.0.0-4731
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 +9 -11
- package/lib/server/routes.d.ts +2 -4
- package/lib/server/routes.js +1 -4
- package/package.json +10 -10
|
@@ -16,26 +16,24 @@ const utils_2 = require("./utils");
|
|
|
16
16
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
17
17
|
const combine_promises_1 = tslib_1.__importDefault(require("combine-promises"));
|
|
18
18
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
19
|
-
function toReactRouterRoutes(routes) {
|
|
20
|
-
// @ts-expect-error: types incompatible???
|
|
21
|
-
return routes;
|
|
22
|
-
}
|
|
23
19
|
// matchRoutes does not support qs/anchors, so we remove it!
|
|
24
20
|
function onlyPathname(link) {
|
|
25
21
|
return link.split('#')[0].split('?')[0];
|
|
26
22
|
}
|
|
27
23
|
function getPageBrokenLinks({ pagePath, pageLinks, routes, }) {
|
|
28
|
-
// ReactRouter is able to support links like ./../somePath
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
// resolvePathname is used internally by ReactRouter
|
|
24
|
+
// ReactRouter is able to support links like ./../somePath but `matchRoutes`
|
|
25
|
+
// does not do this resolution internally. We must resolve the links before
|
|
26
|
+
// using `matchRoutes`. `resolvePathname` is used internally by React Router
|
|
32
27
|
function resolveLink(link) {
|
|
33
28
|
const resolvedLink = (0, utils_1.resolvePathname)(onlyPathname(link), pagePath);
|
|
34
29
|
return { link, resolvedLink };
|
|
35
30
|
}
|
|
36
31
|
function isBrokenLink(link) {
|
|
37
32
|
const matchedRoutes = [link, decodeURI(link)]
|
|
38
|
-
|
|
33
|
+
// @ts-expect-error: React router types RouteConfig with an actual React
|
|
34
|
+
// component, but we load route components with string paths.
|
|
35
|
+
// We don't actually access component here, so it's fine.
|
|
36
|
+
.map((l) => (0, react_router_config_1.matchRoutes)(routes, l))
|
|
39
37
|
.reduce((prev, cur) => prev.concat(cur));
|
|
40
38
|
return matchedRoutes.length === 0;
|
|
41
39
|
}
|
|
@@ -44,8 +42,8 @@ function getPageBrokenLinks({ pagePath, pageLinks, routes, }) {
|
|
|
44
42
|
/**
|
|
45
43
|
* The route defs can be recursive, and have a parent match-all route. We don't
|
|
46
44
|
* want to match broken links like /docs/brokenLink against /docs/*. For this
|
|
47
|
-
* reason, we only consider the "final routes"
|
|
48
|
-
* We also need to remove the match
|
|
45
|
+
* reason, we only consider the "final routes" that do not have subroutes.
|
|
46
|
+
* We also need to remove the match-all 404 route
|
|
49
47
|
*/
|
|
50
48
|
function filterIntermediateRoutes(routesInput) {
|
|
51
49
|
const routesWithout404 = routesInput.filter((route) => route.path !== '*');
|
package/lib/server/routes.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { ChunkRegistry, RouteConfig, ChunkNames } from '@docusaurus/types';
|
|
8
|
-
|
|
8
|
+
export default function loadRoutes(pluginsRouteConfigs: RouteConfig[], baseUrl: string): Promise<{
|
|
9
9
|
registry: {
|
|
10
10
|
[chunkName: string]: ChunkRegistry;
|
|
11
11
|
};
|
|
@@ -14,6 +14,4 @@ declare type LoadedRoutes = {
|
|
|
14
14
|
[routePath: string]: ChunkNames;
|
|
15
15
|
};
|
|
16
16
|
routesPaths: string[];
|
|
17
|
-
}
|
|
18
|
-
export default function loadRoutes(pluginsRouteConfigs: RouteConfig[], baseUrl: string): Promise<LoadedRoutes>;
|
|
19
|
-
export {};
|
|
17
|
+
}>;
|
package/lib/server/routes.js
CHANGED
|
@@ -141,10 +141,7 @@ registry, value, prefix, name) {
|
|
|
141
141
|
const modulePath = getModulePath(value);
|
|
142
142
|
const chunkName = (0, utils_1.genChunkName)(modulePath, prefix, name);
|
|
143
143
|
const loader = `() => import(/* webpackChunkName: '${chunkName}' */ '${(0, utils_1.escapePath)(modulePath)}')`;
|
|
144
|
-
registry[chunkName] = {
|
|
145
|
-
loader,
|
|
146
|
-
modulePath,
|
|
147
|
-
};
|
|
144
|
+
registry[chunkName] = { loader, modulePath };
|
|
148
145
|
return chunkName;
|
|
149
146
|
}
|
|
150
147
|
const newValue = {};
|
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": "0.0.0-
|
|
4
|
+
"version": "0.0.0-4731",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"@babel/runtime": "^7.17.7",
|
|
42
42
|
"@babel/runtime-corejs3": "^7.17.7",
|
|
43
43
|
"@babel/traverse": "^7.17.3",
|
|
44
|
-
"@docusaurus/cssnano-preset": "0.0.0-
|
|
45
|
-
"@docusaurus/logger": "0.0.0-
|
|
46
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
44
|
+
"@docusaurus/cssnano-preset": "0.0.0-4731",
|
|
45
|
+
"@docusaurus/logger": "0.0.0-4731",
|
|
46
|
+
"@docusaurus/mdx-loader": "0.0.0-4731",
|
|
47
47
|
"@docusaurus/react-loadable": "5.5.2",
|
|
48
|
-
"@docusaurus/utils": "0.0.0-
|
|
49
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
50
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
48
|
+
"@docusaurus/utils": "0.0.0-4731",
|
|
49
|
+
"@docusaurus/utils-common": "0.0.0-4731",
|
|
50
|
+
"@docusaurus/utils-validation": "0.0.0-4731",
|
|
51
51
|
"@slorber/static-site-generator-webpack-plugin": "^4.0.1",
|
|
52
52
|
"@svgr/webpack": "^6.2.1",
|
|
53
53
|
"autoprefixer": "^10.4.2",
|
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
"webpackbar": "^5.0.2"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
110
|
-
"@docusaurus/types": "0.0.0-
|
|
109
|
+
"@docusaurus/module-type-aliases": "0.0.0-4731",
|
|
110
|
+
"@docusaurus/types": "0.0.0-4731",
|
|
111
111
|
"@types/detect-port": "^1.3.2",
|
|
112
112
|
"@types/nprogress": "^0.2.0",
|
|
113
113
|
"@types/react-dom": "^17.0.13",
|
|
@@ -128,5 +128,5 @@
|
|
|
128
128
|
"engines": {
|
|
129
129
|
"node": ">=14"
|
|
130
130
|
},
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "f3787c5cd81d0d934005814e3038d897f5ba58aa"
|
|
132
132
|
}
|