vitepress
Advanced tools
Comparing version 1.2.3 to 1.3.0
@@ -25,3 +25,3 @@ import siteData from '@siteData'; | ||
storageKey: APPEARANCE_KEY, | ||
initialValue: () => typeof appearance === 'string' ? appearance : 'auto', | ||
initialValue: () => (appearance === 'dark' ? 'dark' : 'auto'), | ||
...(typeof appearance === 'object' ? appearance : {}) | ||
@@ -28,0 +28,0 @@ }) |
@@ -120,48 +120,49 @@ import { inject, markRaw, nextTick, reactive, readonly } from 'vue'; | ||
window.addEventListener('click', (e) => { | ||
// temporary fix for docsearch action buttons | ||
const button = e.target.closest('button'); | ||
if (button) | ||
if (e.defaultPrevented || | ||
!(e.target instanceof Element) || | ||
e.target.closest('button') || // temporary fix for docsearch action buttons | ||
e.button !== 0 || | ||
e.ctrlKey || | ||
e.shiftKey || | ||
e.altKey || | ||
e.metaKey) | ||
return; | ||
const link = e.target.closest('a'); | ||
if (link && | ||
!link.closest('.vp-raw') && | ||
(link instanceof SVGElement || !link.download)) { | ||
const { target } = link; | ||
const { href, origin, pathname, hash, search } = new URL(link.href instanceof SVGAnimatedString | ||
? link.href.animVal | ||
: link.href, link.baseURI); | ||
const currentUrl = new URL(location.href); // copy to keep old data | ||
// only intercept inbound html links | ||
if (!e.ctrlKey && | ||
!e.shiftKey && | ||
!e.altKey && | ||
!e.metaKey && | ||
!target && | ||
origin === currentUrl.origin && | ||
treatAsHtml(pathname)) { | ||
e.preventDefault(); | ||
if (pathname === currentUrl.pathname && | ||
search === currentUrl.search) { | ||
// scroll between hash anchors in the same page | ||
// avoid duplicate history entries when the hash is same | ||
if (hash !== currentUrl.hash) { | ||
history.pushState({}, '', href); | ||
// still emit the event so we can listen to it in themes | ||
window.dispatchEvent(new HashChangeEvent('hashchange', { | ||
oldURL: currentUrl.href, | ||
newURL: href | ||
})); | ||
} | ||
if (hash) { | ||
// use smooth scroll when clicking on header anchor links | ||
scrollTo(link, hash, link.classList.contains('header-anchor')); | ||
} | ||
else { | ||
window.scrollTo(0, 0); | ||
} | ||
if (!link || | ||
link.closest('.vp-raw') || | ||
link.hasAttribute('download') || | ||
link.hasAttribute('target')) | ||
return; | ||
const linkHref = link.getAttribute('href') ?? | ||
(link instanceof SVGAElement ? link.getAttribute('xlink:href') : null); | ||
if (linkHref == null) | ||
return; | ||
const { href, origin, pathname, hash, search } = new URL(linkHref, link.baseURI); | ||
const currentUrl = new URL(location.href); // copy to keep old data | ||
// only intercept inbound html links | ||
if (origin === currentUrl.origin && treatAsHtml(pathname)) { | ||
e.preventDefault(); | ||
if (pathname === currentUrl.pathname && | ||
search === currentUrl.search) { | ||
// scroll between hash anchors in the same page | ||
// avoid duplicate history entries when the hash is same | ||
if (hash !== currentUrl.hash) { | ||
history.pushState({}, '', href); | ||
// still emit the event so we can listen to it in themes | ||
window.dispatchEvent(new HashChangeEvent('hashchange', { | ||
oldURL: currentUrl.href, | ||
newURL: href | ||
})); | ||
} | ||
if (hash) { | ||
// use smooth scroll when clicking on header anchor links | ||
scrollTo(link, hash, link.classList.contains('header-anchor')); | ||
} | ||
else { | ||
go(href); | ||
window.scrollTo(0, 0); | ||
} | ||
} | ||
else { | ||
go(href); | ||
} | ||
} | ||
@@ -168,0 +169,0 @@ }, { capture: true }); |
@@ -15,2 +15,3 @@ import './styles/vars.css'; | ||
export { default as VPButton } from './components/VPButton.vue'; | ||
export { default as VPHomeContent } from './components/VPHomeContent.vue'; | ||
export { default as VPHomeHero } from './components/VPHomeHero.vue'; | ||
@@ -17,0 +18,0 @@ export { default as VPHomeFeatures } from './components/VPHomeFeatures.vue'; |
@@ -1,2 +0,2 @@ | ||
import { a as getDefaultExportFromCjs, q as c, t as clearCache, n as init, b as build, o as serve, v as version, p as createServer } from './serve-CEEKiiuH.js'; | ||
import { a as getDefaultExportFromCjs, q as c, t as clearCache, n as init, b as build, o as serve, v as version, p as createServer } from './serve-BhLFz9dF.js'; | ||
import { createLogger } from 'vite'; | ||
@@ -404,14 +404,20 @@ import 'path'; | ||
} | ||
const createDevServer = async () => { | ||
const server = await createServer(root, argv, async () => { | ||
if (!restartPromise) { | ||
restartPromise = (async () => { | ||
await server.close(); | ||
await createDevServer(); | ||
})().finally(() => { | ||
restartPromise = void 0; | ||
}); | ||
const open = argv.open; | ||
delete argv.open; | ||
const createDevServer = async (isRestart = true) => { | ||
const server = await createServer( | ||
root, | ||
!isRestart ? { ...argv, open } : argv, | ||
async () => { | ||
if (!restartPromise) { | ||
restartPromise = (async () => { | ||
await server.close(); | ||
await createDevServer(); | ||
})().finally(() => { | ||
restartPromise = void 0; | ||
}); | ||
} | ||
return restartPromise; | ||
} | ||
return restartPromise; | ||
}); | ||
); | ||
await server.listen(); | ||
@@ -422,3 +428,3 @@ logVersion(server.config.logger); | ||
}; | ||
createDevServer().catch((err) => { | ||
createDevServer(false).catch((err) => { | ||
createLogger().error( | ||
@@ -433,3 +439,3 @@ `${c.red(`failed to start server. error:`)} | ||
createLogger().info("", { clear: true }); | ||
init(); | ||
init(argv.root); | ||
} else { | ||
@@ -436,0 +442,0 @@ logVersion(); |
import { normalizePath } from 'vite'; | ||
export { loadEnv } from 'vite'; | ||
import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-CEEKiiuH.js'; | ||
export { S as ScaffoldThemeType, b as build, p as createServer, e as defineConfig, h as defineConfigWithTheme, d as defineLoader, n as init, j as mergeConfig, r as resolveConfig, l as resolvePages, k as resolveSiteData, i as resolveUserConfig, s as scaffold, o as serve } from './serve-CEEKiiuH.js'; | ||
import { g as glob, c as createMarkdownRenderer, f as fs, m as matter, a as getDefaultExportFromCjs } from './serve-BhLFz9dF.js'; | ||
export { S as ScaffoldThemeType, b as build, p as createServer, e as defineConfig, h as defineConfigWithTheme, d as defineLoader, n as init, j as mergeConfig, r as resolveConfig, l as resolvePages, k as resolveSiteData, i as resolveUserConfig, s as scaffold, o as serve } from './serve-BhLFz9dF.js'; | ||
import path from 'path'; | ||
@@ -6,0 +6,0 @@ import 'crypto'; |
{ | ||
"name": "vitepress", | ||
"version": "1.2.3", | ||
"version": "1.3.0", | ||
"description": "Vite & Vue powered static site generator", | ||
@@ -60,4 +60,3 @@ "keywords": [ | ||
"lint-staged": { | ||
"*": "prettier --write --ignore-unknown", | ||
"package.json": "sort-package-json" | ||
"*": "prettier --write --ignore-unknown" | ||
}, | ||
@@ -67,16 +66,16 @@ "dependencies": { | ||
"@docsearch/js": "^3.6.0", | ||
"@shikijs/core": "^1.6.2", | ||
"@shikijs/transformers": "^1.6.2", | ||
"@shikijs/core": "^1.10.3", | ||
"@shikijs/transformers": "^1.10.3", | ||
"@types/markdown-it": "^14.1.1", | ||
"@vitejs/plugin-vue": "^5.0.5", | ||
"@vue/devtools-api": "^7.2.1", | ||
"@vue/shared": "^3.4.27", | ||
"@vueuse/core": "^10.10.0", | ||
"@vueuse/integrations": "^10.10.0", | ||
"@vue/devtools-api": "^7.3.5", | ||
"@vue/shared": "^3.4.31", | ||
"@vueuse/core": "^10.11.0", | ||
"@vueuse/integrations": "^10.11.0", | ||
"focus-trap": "^7.5.4", | ||
"mark.js": "8.11.1", | ||
"minisearch": "^6.3.0", | ||
"shiki": "^1.6.2", | ||
"vite": "^5.2.12", | ||
"vue": "^3.4.27" | ||
"shiki": "^1.10.3", | ||
"vite": "^5.3.3", | ||
"vue": "^3.4.31" | ||
}, | ||
@@ -94,6 +93,6 @@ "devDependencies": { | ||
"@rollup/plugin-alias": "^5.1.0", | ||
"@rollup/plugin-commonjs": "^25.0.8", | ||
"@rollup/plugin-commonjs": "^26.0.1", | ||
"@rollup/plugin-json": "^6.1.0", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@rollup/plugin-replace": "^5.0.5", | ||
"@rollup/plugin-replace": "^5.0.7", | ||
"@types/cross-spawn": "^6.0.6", | ||
@@ -107,5 +106,5 @@ "@types/debug": "^4.1.12", | ||
"@types/markdown-it-emoji": "^3.0.1", | ||
"@types/micromatch": "^4.0.7", | ||
"@types/micromatch": "^4.0.9", | ||
"@types/minimist": "^1.2.5", | ||
"@types/node": "^20.14.1", | ||
"@types/node": "^20.14.10", | ||
"@types/postcss-prefix-selector": "^1.16.3", | ||
@@ -117,4 +116,4 @@ "@types/prompts": "^2.4.9", | ||
"debug": "^4.3.5", | ||
"esbuild": "^0.21.4", | ||
"execa": "^9.1.0", | ||
"esbuild": "^0.23.0", | ||
"execa": "^9.3.0", | ||
"fast-glob": "^3.3.2", | ||
@@ -124,5 +123,5 @@ "fs-extra": "^11.2.0", | ||
"gray-matter": "^4.0.3", | ||
"lint-staged": "^15.2.5", | ||
"lint-staged": "^15.2.7", | ||
"lodash.template": "^4.5.0", | ||
"lru-cache": "^10.2.2", | ||
"lru-cache": "^10.3.1", | ||
"markdown-it": "^14.1.0", | ||
@@ -137,3 +136,2 @@ "markdown-it-anchor": "^9.0.1", | ||
"nanoid": "^5.0.7", | ||
"npm-run-all": "^4.1.5", | ||
"ora": "^8.0.1", | ||
@@ -144,9 +142,9 @@ "p-map": "^7.0.2", | ||
"pkg-dir": "^8.0.0", | ||
"playwright-chromium": "^1.44.1", | ||
"playwright-chromium": "^1.45.1", | ||
"polka": "^1.0.0-next.25", | ||
"postcss-prefix-selector": "^1.16.1", | ||
"prettier": "^3.3.0", | ||
"prettier": "^3.3.2", | ||
"prompts": "^2.4.2", | ||
"punycode": "^2.3.1", | ||
"rimraf": "^5.0.7", | ||
"rimraf": "^5.0.8", | ||
"rollup": "^4.18.0", | ||
@@ -159,7 +157,6 @@ "rollup-plugin-dts": "^6.1.1", | ||
"sitemap": "^8.0.0", | ||
"sort-package-json": "^2.10.0", | ||
"supports-color": "^9.4.0", | ||
"typescript": "^5.4.5", | ||
"typescript": "^5.5.3", | ||
"vitest": "^1.6.0", | ||
"vue-tsc": "^2.0.19", | ||
"vue-tsc": "^2.0.26", | ||
"wait-on": "^7.2.0" | ||
@@ -180,16 +177,16 @@ }, | ||
"scripts": { | ||
"dev": "rimraf dist && run-s dev:shared dev:start", | ||
"dev:start": "run-p dev:client dev:node dev:watch", | ||
"dev:client": "tsc --sourcemap -w -p src/client", | ||
"dev": "rimraf dist && pnpm dev:shared && pnpm dev:start", | ||
"dev:start": "pnpm --stream '/^dev:(client|node|watch)$/'", | ||
"dev:client": "tsc --sourcemap -w --preserveWatchOutput -p src/client", | ||
"dev:node": "DEV=true pnpm build:node -w", | ||
"dev:shared": "node scripts/copyShared", | ||
"dev:watch": "node scripts/watchAndCopy", | ||
"build": "run-s build:prepare build:client build:node", | ||
"build": "pnpm build:prepare && pnpm build:client && pnpm build:node", | ||
"build:prepare": "rimraf dist && node scripts/copyShared", | ||
"build:client": "vue-tsc --noEmit -p src/client && tsc -p src/client && node scripts/copyClient", | ||
"build:node": "tsc -p src/node --noEmit && rollup --config rollup.config.ts --configPlugin esbuild", | ||
"test": "run-p --aggregate-output test:unit test:e2e test:init", | ||
"test": "pnpm --aggregate-output --reporter=append-only '/^test:(unit|e2e|init)$/'", | ||
"test:unit": "vitest run -r __tests__/unit", | ||
"test:unit:watch": "vitest -r __tests__/unit", | ||
"test:e2e": "run-s test:e2e-dev test:e2e-build", | ||
"test:e2e": "pnpm test:e2e-dev && pnpm test:e2e-build", | ||
"test:e2e:site:dev": "pnpm -F=tests-e2e site:dev", | ||
@@ -204,6 +201,6 @@ "test:e2e:site:build": "pnpm -F=tests-e2e site:build", | ||
"test:init:watch": "pnpm -F=tests-init watch", | ||
"docs": "run-p dev docs:dev", | ||
"docs": "pnpm --stream '/^(docs:)?dev$/'", | ||
"docs:dev": "wait-on -d 100 dist/node/cli.js && pnpm -F=docs dev", | ||
"docs:debug": "NODE_OPTIONS='--inspect-brk' pnpm docs:dev", | ||
"docs:build": "run-s build docs:build:only", | ||
"docs:build": "pnpm build && pnpm docs:build:only", | ||
"docs:build:only": "pnpm -F=docs build", | ||
@@ -215,3 +212,3 @@ "docs:preview": "pnpm -F=docs preview", | ||
"format:fail": "prettier --check .", | ||
"check": "run-s format:fail build test", | ||
"check": "pnpm format:fail && pnpm build && pnpm test", | ||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", | ||
@@ -218,0 +215,0 @@ "release": "node scripts/release.js" |
@@ -22,2 +22,3 @@ // so that users can do `import DefaultTheme from 'vitepress/theme'` | ||
export declare const VPDocAsideSponsors: DefineComponent | ||
export declare const VPHomeContent: DefineComponent | ||
export declare const VPHomeFeatures: DefineComponent | ||
@@ -24,0 +25,0 @@ export declare const VPHomeHero: DefineComponent |
@@ -165,4 +165,9 @@ import type MarkdownIt from 'markdown-it' | ||
export type NavItem = NavItemWithLink | NavItemWithChildren | ||
export type NavItem = NavItemComponent | NavItemWithLink | NavItemWithChildren | ||
export interface NavItemComponent { | ||
component: string | ||
props?: Record<string, any> | ||
} | ||
export interface NavItemWithLink { | ||
@@ -190,3 +195,3 @@ text: string | ||
text?: string | ||
items: (NavItemChildren | NavItemWithLink)[] | ||
items: (NavItemComponent | NavItemChildren | NavItemWithLink)[] | ||
@@ -422,3 +427,3 @@ /** | ||
/** | ||
* @see https://lucaong.github.io/minisearch/modules/_minisearch_.html#options | ||
* @see https://lucaong.github.io/minisearch/types/MiniSearch.Options.html | ||
*/ | ||
@@ -430,3 +435,3 @@ options?: Pick< | ||
/** | ||
* @see https://lucaong.github.io/minisearch/modules/_minisearch_.html#searchoptions-1 | ||
* @see https://lucaong.github.io/minisearch/types/MiniSearch.SearchOptions.html | ||
*/ | ||
@@ -433,0 +438,0 @@ searchOptions?: MiniSearchOptions['searchOptions'] |
@@ -123,2 +123,3 @@ // types shared between server and client | ||
| 'force-dark' | ||
| 'force-auto' | ||
| (Omit<UseDarkOptions, 'initialValue'> & { initialValue?: 'dark' }) | ||
@@ -125,0 +126,0 @@ themeConfig: ThemeConfig |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
2664296
73
172
53991
Updated@shikijs/core@^1.10.3
Updated@vue/devtools-api@^7.3.5
Updated@vue/shared@^3.4.31
Updated@vueuse/core@^10.11.0
Updatedshiki@^1.10.3
Updatedvite@^5.3.3
Updatedvue@^3.4.31