@docusaurus/core 0.0.0-5868 → 0.0.0-5869
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.
|
@@ -12,7 +12,6 @@ const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
|
12
12
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
13
13
|
const react_router_config_1 = require("react-router-config");
|
|
14
14
|
const utils_1 = require("@docusaurus/utils");
|
|
15
|
-
const routes_1 = require("./routes");
|
|
16
15
|
function matchRoutes(routeConfig, pathname) {
|
|
17
16
|
// @ts-expect-error: React router types RouteConfig with an actual React
|
|
18
17
|
// component, but we load route components with string paths.
|
|
@@ -127,7 +126,7 @@ function getBrokenLinksForPage({ pagePath, helper, }) {
|
|
|
127
126
|
*/
|
|
128
127
|
function filterIntermediateRoutes(routesInput) {
|
|
129
128
|
const routesWithout404 = routesInput.filter((route) => route.path !== '*');
|
|
130
|
-
return (0,
|
|
129
|
+
return (0, utils_1.flattenRoutes)(routesWithout404);
|
|
131
130
|
}
|
|
132
131
|
function getBrokenLinks({ collectedLinks, routes, }) {
|
|
133
132
|
const filteredRoutes = filterIntermediateRoutes(routes);
|
|
@@ -114,7 +114,7 @@ function genChunkNames(routeModule, prefix, name, res) {
|
|
|
114
114
|
* `routesPaths`, and `routesChunkNames` accordingly.
|
|
115
115
|
*/
|
|
116
116
|
function genRouteCode(routeConfig, res) {
|
|
117
|
-
const { path: routePath, component, modules = {}, context, routes: subroutes, priority, exact, ...props } = routeConfig;
|
|
117
|
+
const { path: routePath, component, modules = {}, context, routes: subroutes, priority, exact, metadata, ...props } = routeConfig;
|
|
118
118
|
if (typeof routePath !== 'string' || !component) {
|
|
119
119
|
throw new Error(`Invalid route config: path must be a string and component is required.
|
|
120
120
|
${JSON.stringify(routeConfig)}`);
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type { LoadContext, RouteConfig, GlobalData, LoadedPlugin } from '@docusaurus/types';
|
|
8
|
-
import type { PluginIdentifier } from '@docusaurus/types/src/plugin';
|
|
7
|
+
import type { LoadContext, RouteConfig, GlobalData, PluginIdentifier, LoadedPlugin } from '@docusaurus/types';
|
|
9
8
|
export type LoadPluginsResult = {
|
|
10
9
|
plugins: LoadedPlugin[];
|
|
11
10
|
routes: RouteConfig[];
|
package/lib/server/routes.d.ts
CHANGED
|
@@ -5,6 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { RouteConfig, ReportingSeverity } from '@docusaurus/types';
|
|
8
|
-
export declare function getAllFinalRoutes(routeConfig: RouteConfig[]): RouteConfig[];
|
|
9
8
|
export declare function handleDuplicateRoutes(routes: RouteConfig[], onDuplicateRoutes: ReportingSeverity): void;
|
|
10
9
|
export declare function getRoutesPaths(routeConfigs: RouteConfig[], baseUrl: string): string[];
|
package/lib/server/routes.js
CHANGED
|
@@ -6,23 +6,15 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.getRoutesPaths = exports.handleDuplicateRoutes =
|
|
9
|
+
exports.getRoutesPaths = exports.handleDuplicateRoutes = void 0;
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
12
|
const utils_1 = require("@docusaurus/utils");
|
|
13
|
-
// Recursively get the final routes (routes with no subroutes)
|
|
14
|
-
function getAllFinalRoutes(routeConfig) {
|
|
15
|
-
function getFinalRoutes(route) {
|
|
16
|
-
return route.routes ? route.routes.flatMap(getFinalRoutes) : [route];
|
|
17
|
-
}
|
|
18
|
-
return routeConfig.flatMap(getFinalRoutes);
|
|
19
|
-
}
|
|
20
|
-
exports.getAllFinalRoutes = getAllFinalRoutes;
|
|
21
13
|
function handleDuplicateRoutes(routes, onDuplicateRoutes) {
|
|
22
14
|
if (onDuplicateRoutes === 'ignore') {
|
|
23
15
|
return;
|
|
24
16
|
}
|
|
25
|
-
const allRoutes =
|
|
17
|
+
const allRoutes = (0, utils_1.flattenRoutes)(routes).map((routeConfig) => routeConfig.path);
|
|
26
18
|
const seenRoutes = new Set();
|
|
27
19
|
const duplicatePaths = allRoutes.filter((route) => {
|
|
28
20
|
if (seenRoutes.has(route)) {
|
|
@@ -43,12 +35,19 @@ exports.handleDuplicateRoutes = handleDuplicateRoutes;
|
|
|
43
35
|
* This is rendered through the catch-all ComponentCreator("*") route
|
|
44
36
|
* Note CDNs only understand the 404.html file by convention
|
|
45
37
|
* The extension probably permits to avoid emitting "/404/index.html"
|
|
38
|
+
*
|
|
39
|
+
* TODO we should probably deprecate/remove "postBuild({routesPaths})
|
|
40
|
+
* The 404 generation handling can be moved to the SSG code
|
|
41
|
+
* We only need getAllFinalRoutes() utils IMHO
|
|
42
|
+
* This would be a plugin lifecycle breaking change :/
|
|
43
|
+
* Although not many plugins probably use this
|
|
44
|
+
*
|
|
46
45
|
*/
|
|
47
46
|
const NotFoundRoutePath = '/404.html';
|
|
48
47
|
function getRoutesPaths(routeConfigs, baseUrl) {
|
|
49
48
|
return [
|
|
50
49
|
(0, utils_1.normalizeUrl)([baseUrl, NotFoundRoutePath]),
|
|
51
|
-
...
|
|
50
|
+
...(0, utils_1.flattenRoutes)(routeConfigs).map((r) => r.path),
|
|
52
51
|
];
|
|
53
52
|
}
|
|
54
53
|
exports.getRoutesPaths = getRoutesPaths;
|
package/lib/server/site.d.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type { LoadContext, Props } from '@docusaurus/types';
|
|
8
|
-
import type { PluginIdentifier } from '@docusaurus/types/src/plugin';
|
|
7
|
+
import type { LoadContext, Props, PluginIdentifier } from '@docusaurus/types';
|
|
9
8
|
export type LoadContextParams = {
|
|
10
9
|
/** Usually the CWD; can be overridden with command argument. */
|
|
11
10
|
siteDir: string;
|
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-5869",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"@babel/runtime": "^7.22.6",
|
|
44
44
|
"@babel/runtime-corejs3": "^7.22.6",
|
|
45
45
|
"@babel/traverse": "^7.22.8",
|
|
46
|
-
"@docusaurus/cssnano-preset": "0.0.0-
|
|
47
|
-
"@docusaurus/logger": "0.0.0-
|
|
48
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
46
|
+
"@docusaurus/cssnano-preset": "0.0.0-5869",
|
|
47
|
+
"@docusaurus/logger": "0.0.0-5869",
|
|
48
|
+
"@docusaurus/mdx-loader": "0.0.0-5869",
|
|
49
49
|
"@docusaurus/react-loadable": "5.5.2",
|
|
50
|
-
"@docusaurus/utils": "0.0.0-
|
|
51
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
52
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
50
|
+
"@docusaurus/utils": "0.0.0-5869",
|
|
51
|
+
"@docusaurus/utils-common": "0.0.0-5869",
|
|
52
|
+
"@docusaurus/utils-validation": "0.0.0-5869",
|
|
53
53
|
"@svgr/webpack": "^6.5.1",
|
|
54
54
|
"autoprefixer": "^10.4.14",
|
|
55
55
|
"babel-loader": "^9.1.3",
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
"webpackbar": "^5.0.2"
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
109
|
-
"@docusaurus/types": "0.0.0-
|
|
108
|
+
"@docusaurus/module-type-aliases": "0.0.0-5869",
|
|
109
|
+
"@docusaurus/types": "0.0.0-5869",
|
|
110
110
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
111
111
|
"@types/detect-port": "^1.3.3",
|
|
112
112
|
"@types/react-dom": "^18.2.7",
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"engines": {
|
|
127
127
|
"node": ">=18.0"
|
|
128
128
|
},
|
|
129
|
-
"gitHead": "
|
|
129
|
+
"gitHead": "b04beb0c2db54db2bf9f87733009a35221383933"
|
|
130
130
|
}
|