vitepress
Advanced tools
Comparing version 1.0.0-rc.15 to 1.0.0-rc.16
@@ -21,13 +21,5 @@ import { reactive, inject, markRaw, nextTick, readonly } from 'vue'; | ||
async function go(href = inBrowser ? location.href : '/') { | ||
href = normalizeHref(href); | ||
if ((await router.onBeforeRouteChange?.(href)) === false) | ||
return; | ||
const url = new URL(href, fakeHost); | ||
if (!siteDataRef.value.cleanUrls) { | ||
// ensure correct deep link so page refresh lands on correct files. | ||
// if cleanUrls is enabled, the server should handle this | ||
if (!url.pathname.endsWith('/') && !url.pathname.endsWith('.html')) { | ||
url.pathname += '.html'; | ||
href = url.pathname + url.search + url.hash; | ||
} | ||
} | ||
updateHistory(href); | ||
@@ -165,3 +157,3 @@ await loadPage(href); | ||
window.addEventListener('popstate', (e) => { | ||
loadPage(location.href, (e.state && e.state.scrollPosition) || 0); | ||
loadPage(normalizeHref(location.href), (e.state && e.state.scrollPosition) || 0); | ||
}); | ||
@@ -254,5 +246,5 @@ window.addEventListener('hashchange', (e) => { | ||
function shouldHotReload(payload) { | ||
const payloadPath = payload.path.replace(/(\bindex)?\.md$/, ''); | ||
const payloadPath = payload.path.replace(/(?:(^|\/)index)?\.md$/, '$1'); | ||
const locationPath = location.pathname | ||
.replace(/(\bindex)?\.html$/, '') | ||
.replace(/(?:(^|\/)index)?\.html$/, '') | ||
.slice(siteDataRef.value.base.length - 1); | ||
@@ -262,3 +254,3 @@ return payloadPath === locationPath; | ||
function updateHistory(href) { | ||
if (inBrowser && href !== location.href) { | ||
if (inBrowser && href !== normalizeHref(location.href)) { | ||
// save scroll position before changing url | ||
@@ -269,1 +261,11 @@ history.replaceState({ scrollPosition: window.scrollY }, document.title); | ||
} | ||
function normalizeHref(href) { | ||
const url = new URL(href, fakeHost); | ||
url.pathname = url.pathname.replace(/(^|\/)index(\.html)?$/, '$1'); | ||
// ensure correct deep link so page refresh lands on correct files. | ||
if (siteDataRef.value.cleanUrls) | ||
url.pathname = url.pathname.replace(/\.html$/, ''); | ||
else if (!url.pathname.endsWith('/') && !url.pathname.endsWith('.html')) | ||
url.pathname += '.html'; | ||
return url.pathname + url.search + url.hash; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { a as getDefaultExportFromCjs, p as c, q as clearCache, n as init, l as build, s as serve, k as createServer } from './serve-c3ff9837.js'; | ||
import { a as getDefaultExportFromCjs, p as c, q as clearCache, n as init, l as build, s as serve, k as createServer } from './serve-2b55a507.js'; | ||
import { createLogger } from 'vite'; | ||
@@ -298,3 +298,3 @@ import 'url'; | ||
var version = "1.0.0-rc.15"; | ||
var version = "1.0.0-rc.16"; | ||
@@ -301,0 +301,0 @@ function bindShortcuts(server, createDevServer) { |
@@ -1,3 +0,3 @@ | ||
import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-c3ff9837.js'; | ||
export { S as ScaffoldThemeType, l as build, k as createServer, b as defineConfig, e as defineConfigWithTheme, d as defineLoader, n as init, r as resolveConfig, j as resolvePages, i as resolveSiteData, h as resolveUserConfig, o as scaffold, s as serve } from './serve-c3ff9837.js'; | ||
import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-2b55a507.js'; | ||
export { S as ScaffoldThemeType, l as build, k as createServer, b as defineConfig, e as defineConfigWithTheme, d as defineLoader, n as init, r as resolveConfig, j as resolvePages, i as resolveSiteData, h as resolveUserConfig, o as scaffold, s as serve } from './serve-2b55a507.js'; | ||
import path from 'path'; | ||
@@ -4,0 +4,0 @@ import { normalizePath } from 'vite'; |
{ | ||
"name": "vitepress", | ||
"version": "1.0.0-rc.15", | ||
"version": "1.0.0-rc.16", | ||
"description": "Vite & Vue powered static site generator", | ||
@@ -93,3 +93,3 @@ "type": "module", | ||
"@types/cross-spawn": "^6.0.3", | ||
"@types/debug": "^4.1.8", | ||
"@types/debug": "^4.1.9", | ||
"@types/escape-html": "^1.0.2", | ||
@@ -139,3 +139,3 @@ "@types/fs-extra": "^11.0.2", | ||
"pkg-dir": "^7.0.0", | ||
"playwright-chromium": "^1.38.0", | ||
"playwright-chromium": "^1.38.1", | ||
"polka": "1.0.0-next.22", | ||
@@ -149,3 +149,3 @@ "postcss-prefix-selector": "^1.16.0", | ||
"rollup-plugin-dts": "^6.0.2", | ||
"rollup-plugin-esbuild": "^6.0.0", | ||
"rollup-plugin-esbuild": "^6.0.1", | ||
"semver": "^7.5.4", | ||
@@ -158,3 +158,3 @@ "shiki-processor": "^0.1.3", | ||
"typescript": "^5.2.2", | ||
"vitest": "^0.34.4", | ||
"vitest": "^0.34.5", | ||
"vue-tsc": "^1.8.13", | ||
@@ -161,0 +161,0 @@ "wait-on": "^7.0.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2926656
79145