@docusaurus/core 0.0.0-5941 → 0.0.0-5942

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.
Files changed (2) hide show
  1. package/lib/commands/serve.js +15 -4
  2. package/package.json +10 -10
@@ -52,10 +52,21 @@ async function serve(siteDirParam = '.', cliOptions = {}) {
52
52
  }
53
53
  // We do the redirect ourselves for a good reason
54
54
  // server-handler is annoying and won't include /baseUrl/ in redirects
55
- const normalizedUrl = (0, utils_common_1.applyTrailingSlash)(req.url, { trailingSlash, baseUrl });
56
- if (req.url !== normalizedUrl) {
57
- redirect(res, normalizedUrl);
58
- return;
55
+ // See https://github.com/facebook/docusaurus/issues/10078#issuecomment-2084932934
56
+ if (baseUrl !== '/') {
57
+ // Not super robust, but should be good enough for our use case
58
+ // See https://github.com/facebook/docusaurus/pull/10090
59
+ const looksLikeAsset = !!req.url.match(/.[a-z]{1,4}$/);
60
+ if (!looksLikeAsset) {
61
+ const normalizedUrl = (0, utils_common_1.applyTrailingSlash)(req.url, {
62
+ trailingSlash,
63
+ baseUrl,
64
+ });
65
+ if (req.url !== normalizedUrl) {
66
+ redirect(res, normalizedUrl);
67
+ return;
68
+ }
69
+ }
59
70
  }
60
71
  // Remove baseUrl before calling serveHandler, because /baseUrl/ should
61
72
  // serve /build/index.html, not /build/baseUrl/index.html (does not exist)
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-5941",
4
+ "version": "0.0.0-5942",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -43,12 +43,12 @@
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-5941",
47
- "@docusaurus/logger": "0.0.0-5941",
48
- "@docusaurus/mdx-loader": "0.0.0-5941",
49
- "@docusaurus/utils": "0.0.0-5941",
50
- "@docusaurus/utils-common": "0.0.0-5941",
51
- "@docusaurus/utils-validation": "0.0.0-5941",
46
+ "@docusaurus/cssnano-preset": "0.0.0-5942",
47
+ "@docusaurus/logger": "0.0.0-5942",
48
+ "@docusaurus/mdx-loader": "0.0.0-5942",
49
+ "@docusaurus/utils": "0.0.0-5942",
50
+ "@docusaurus/utils-common": "0.0.0-5942",
51
+ "@docusaurus/utils-validation": "0.0.0-5942",
52
52
  "autoprefixer": "^10.4.14",
53
53
  "babel-loader": "^9.1.3",
54
54
  "babel-plugin-dynamic-import-node": "^2.3.3",
@@ -103,8 +103,8 @@
103
103
  "webpackbar": "^5.0.2"
104
104
  },
105
105
  "devDependencies": {
106
- "@docusaurus/module-type-aliases": "0.0.0-5941",
107
- "@docusaurus/types": "0.0.0-5941",
106
+ "@docusaurus/module-type-aliases": "0.0.0-5942",
107
+ "@docusaurus/types": "0.0.0-5942",
108
108
  "@total-typescript/shoehorn": "^0.1.2",
109
109
  "@types/detect-port": "^1.3.3",
110
110
  "@types/react-dom": "^18.2.7",
@@ -124,5 +124,5 @@
124
124
  "engines": {
125
125
  "node": ">=18.0"
126
126
  },
127
- "gitHead": "a7af113c6e6ce762ad4ac764fb89a32252600e82"
127
+ "gitHead": "5fd6daf54c03147eaf467a7038b9d9b345531f83"
128
128
  }