@vuepress/shared 2.0.0-rc.4 → 2.0.0-rc.6
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/dist/index.js +14 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -79,8 +79,20 @@ var isPlainObject = (val) => Object.prototype.toString.call(val) === "[object Ob
|
|
|
79
79
|
|
|
80
80
|
// src/utils/normalizeRoutePath.ts
|
|
81
81
|
var normalizeRoutePath = (path) => {
|
|
82
|
-
const
|
|
83
|
-
|
|
82
|
+
const [pathname, ...rest] = path.split(/(\?|#)/);
|
|
83
|
+
if (!pathname || pathname.endsWith("/"))
|
|
84
|
+
return path;
|
|
85
|
+
const queryAndHash = rest.length > 0 ? rest.join("") : "";
|
|
86
|
+
let routePath = pathname.replace(/(^|\/)README.md$/i, "$1index.html");
|
|
87
|
+
if (routePath.endsWith(".md")) {
|
|
88
|
+
routePath = routePath.substring(0, routePath.length - 3) + ".html";
|
|
89
|
+
} else if (!routePath.endsWith(".html")) {
|
|
90
|
+
routePath = routePath + ".html";
|
|
91
|
+
}
|
|
92
|
+
if (routePath.endsWith("/index.html")) {
|
|
93
|
+
return routePath.substring(0, routePath.length - 10) + queryAndHash;
|
|
94
|
+
}
|
|
95
|
+
return routePath + queryAndHash;
|
|
84
96
|
};
|
|
85
97
|
|
|
86
98
|
// src/utils/omit.ts
|