@docusaurus/core 0.0.0-4900 → 0.0.0-4904

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.
@@ -4,17 +4,26 @@
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 { matchRoutes } from 'react-router-config';
8
+ import routes from '@generated/routes';
7
9
  // Memoize previously normalized pathnames.
8
- const pathnames = {};
10
+ const pathnames = new Map();
9
11
  export default function normalizeLocation(location) {
10
- if (pathnames[location.pathname]) {
12
+ if (pathnames.has(location.pathname)) {
11
13
  return {
12
14
  ...location,
13
- pathname: pathnames[location.pathname],
15
+ pathname: pathnames.get(location.pathname),
14
16
  };
15
17
  }
16
- const pathname = location.pathname.trim().replace(/\/index\.html$/, '') || '/';
17
- pathnames[location.pathname] = pathname;
18
+ // If the location was registered with an `.html` extension, we don't strip it
19
+ // away, or it will render to a 404 page.
20
+ const matchedRoutes = matchRoutes(routes, location.pathname);
21
+ if (matchedRoutes.some(({ route }) => route.exact === true)) {
22
+ pathnames.set(location.pathname, location.pathname);
23
+ return location;
24
+ }
25
+ const pathname = location.pathname.trim().replace(/(?:\/index)?\.html$/, '') || '/';
26
+ pathnames.set(location.pathname, pathname);
18
27
  return {
19
28
  ...location,
20
29
  pathname,
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-4900",
4
+ "version": "0.0.0-4904",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -41,17 +41,17 @@
41
41
  "@babel/runtime": "^7.17.9",
42
42
  "@babel/runtime-corejs3": "^7.17.9",
43
43
  "@babel/traverse": "^7.17.9",
44
- "@docusaurus/cssnano-preset": "0.0.0-4900",
45
- "@docusaurus/logger": "0.0.0-4900",
46
- "@docusaurus/mdx-loader": "0.0.0-4900",
44
+ "@docusaurus/cssnano-preset": "0.0.0-4904",
45
+ "@docusaurus/logger": "0.0.0-4904",
46
+ "@docusaurus/mdx-loader": "0.0.0-4904",
47
47
  "@docusaurus/react-loadable": "5.5.2",
48
- "@docusaurus/utils": "0.0.0-4900",
49
- "@docusaurus/utils-common": "0.0.0-4900",
50
- "@docusaurus/utils-validation": "0.0.0-4900",
48
+ "@docusaurus/utils": "0.0.0-4904",
49
+ "@docusaurus/utils-common": "0.0.0-4904",
50
+ "@docusaurus/utils-validation": "0.0.0-4904",
51
51
  "@slorber/static-site-generator-webpack-plugin": "^4.0.4",
52
52
  "@svgr/webpack": "^6.2.1",
53
53
  "autoprefixer": "^10.4.4",
54
- "babel-loader": "^8.2.4",
54
+ "babel-loader": "^8.2.5",
55
55
  "babel-plugin-dynamic-import-node": "2.3.0",
56
56
  "boxen": "^6.2.1",
57
57
  "chokidar": "^3.5.3",
@@ -60,7 +60,7 @@
60
60
  "combine-promises": "^1.1.0",
61
61
  "commander": "^5.1.0",
62
62
  "copy-webpack-plugin": "^10.2.4",
63
- "core-js": "^3.22.0",
63
+ "core-js": "^3.22.2",
64
64
  "css-loader": "^6.7.1",
65
65
  "css-minimizer-webpack-plugin": "^3.4.1",
66
66
  "cssnano": "^5.1.7",
@@ -94,7 +94,7 @@
94
94
  "serve-handler": "^6.1.3",
95
95
  "shelljs": "^0.8.5",
96
96
  "terser-webpack-plugin": "^5.3.1",
97
- "tslib": "^2.3.1",
97
+ "tslib": "^2.4.0",
98
98
  "update-notifier": "^5.1.0",
99
99
  "url-loader": "^4.1.1",
100
100
  "wait-on": "^6.0.1",
@@ -105,11 +105,11 @@
105
105
  "webpackbar": "^5.0.2"
106
106
  },
107
107
  "devDependencies": {
108
- "@docusaurus/module-type-aliases": "0.0.0-4900",
109
- "@docusaurus/types": "0.0.0-4900",
108
+ "@docusaurus/module-type-aliases": "0.0.0-4904",
109
+ "@docusaurus/types": "0.0.0-4904",
110
110
  "@types/detect-port": "^1.3.2",
111
111
  "@types/nprogress": "^0.2.0",
112
- "@types/react-dom": "^18.0.1",
112
+ "@types/react-dom": "^18.0.2",
113
113
  "@types/react-router-config": "^5.0.6",
114
114
  "@types/rtl-detect": "^1.0.0",
115
115
  "@types/serve-handler": "^6.1.1",
@@ -127,5 +127,5 @@
127
127
  "engines": {
128
128
  "node": ">=14"
129
129
  },
130
- "gitHead": "2b685fb483506ef5f6eb97d4a48b8524e3ce3ce9"
130
+ "gitHead": "a237dd7794660c64330a78c782cf066fae59355c"
131
131
  }