Merge branch 'main' into perf/markdown-it-async

pull/4507/head
Divyansh Singh 8 months ago committed by GitHub
commit bc137980c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,3 +1,15 @@
## [2.0.0-alpha.2](https://github.com/vuejs/vitepress/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2025-01-23)
### Bug Fixes
- fix docsearch navigation and rendering ([e035027](https://github.com/vuejs/vitepress/commit/e0350275b39258a61ee867840ce1c6f5b2cecf2a))
- **types:** support preload built-in shiki languages as string ([#4513](https://github.com/vuejs/vitepress/issues/4513)) ([4f77b4f](https://github.com/vuejs/vitepress/commit/4f77b4fdfdbe945e482348a57731bff5fb4672fc))
### Features
- allow `markdown.config` and `markdown.preConfig` to accept async function ([#4512](https://github.com/vuejs/vitepress/issues/4512)) ([b88ae8d](https://github.com/vuejs/vitepress/commit/b88ae8d4a11a20104b2007c2631eb7aeb123d965))
- support same page navigation in `router.go` and expose decoded hash and query from the `route` object ([#4511](https://github.com/vuejs/vitepress/issues/4511)) ([23d3281](https://github.com/vuejs/vitepress/commit/23d3281ed6f1111ab15708ca1fd86202674f8ef7))
## [2.0.0-alpha.1](https://github.com/vuejs/vitepress/compare/v1.6.2...v2.0.0-alpha.1) (2025-01-22) ## [2.0.0-alpha.1](https://github.com/vuejs/vitepress/compare/v1.6.2...v2.0.0-alpha.1) (2025-01-22)
### Features ### Features

@ -1,6 +1,6 @@
{ {
"name": "vitepress", "name": "vitepress",
"version": "2.0.0-alpha.1", "version": "2.0.0-alpha.2",
"description": "Vite & Vue powered static site generator", "description": "Vite & Vue powered static site generator",
"keywords": [ "keywords": [
"vite", "vite",
@ -105,8 +105,8 @@
"@vitejs/plugin-vue": "^5.2.1", "@vitejs/plugin-vue": "^5.2.1",
"@vue/devtools-api": "^7.7.0", "@vue/devtools-api": "^7.7.0",
"@vue/shared": "^3.5.13", "@vue/shared": "^3.5.13",
"@vueuse/core": "^12.4.0", "@vueuse/core": "^12.5.0",
"@vueuse/integrations": "^12.4.0", "@vueuse/integrations": "^12.5.0",
"focus-trap": "^7.6.4", "focus-trap": "^7.6.4",
"mark.js": "8.11.1", "mark.js": "8.11.1",
"minisearch": "^7.1.1", "minisearch": "^7.1.1",
@ -140,7 +140,7 @@
"@types/markdown-it-container": "^2.0.10", "@types/markdown-it-container": "^2.0.10",
"@types/markdown-it-emoji": "^3.0.1", "@types/markdown-it-emoji": "^3.0.1",
"@types/minimist": "^1.2.5", "@types/minimist": "^1.2.5",
"@types/node": "^22.10.7", "@types/node": "^22.10.9",
"@types/picomatch": "^3.0.2", "@types/picomatch": "^3.0.2",
"@types/postcss-prefix-selector": "^1.16.3", "@types/postcss-prefix-selector": "^1.16.3",
"@types/prompts": "^2.4.9", "@types/prompts": "^2.4.9",
@ -153,7 +153,7 @@
"fs-extra": "^11.3.0", "fs-extra": "^11.3.0",
"get-port": "^7.1.0", "get-port": "^7.1.0",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",
"lint-staged": "^15.4.1", "lint-staged": "^15.4.2",
"lodash.template": "^4.5.0", "lodash.template": "^4.5.0",
"lru-cache": "^11.0.2", "lru-cache": "^11.0.2",
"markdown-it": "^14.1.0", "markdown-it": "^14.1.0",
@ -171,7 +171,7 @@
"picocolors": "^1.1.1", "picocolors": "^1.1.1",
"picomatch": "^4.0.2", "picomatch": "^4.0.2",
"pkg-dir": "^8.0.0", "pkg-dir": "^8.0.0",
"playwright-chromium": "^1.49.1", "playwright-chromium": "^1.50.0",
"polka": "^1.0.0-next.28", "polka": "^1.0.0-next.28",
"postcss-prefix-selector": "^2.1.0", "postcss-prefix-selector": "^2.1.0",
"prettier": "^3.4.2", "prettier": "^3.4.2",
@ -187,7 +187,7 @@
"sitemap": "^8.0.0", "sitemap": "^8.0.0",
"tinyglobby": "^0.2.10", "tinyglobby": "^0.2.10",
"typescript": "^5.7.3", "typescript": "^5.7.3",
"vitest": "^3.0.3", "vitest": "^3.0.4",
"vue-tsc": "^2.2.0", "vue-tsc": "^2.2.0",
"wait-on": "^8.0.2" "wait-on": "^8.0.2"
}, },

@ -21,7 +21,7 @@ importers:
version: 3.8.3 version: 3.8.3
'@docsearch/js': '@docsearch/js':
specifier: ^3.8.3 specifier: ^3.8.3
version: 3.8.3(@algolia/client-search@5.19.0) version: 3.8.3(@algolia/client-search@5.20.0)
'@iconify-json/simple-icons': '@iconify-json/simple-icons':
specifier: ^1.2.21 specifier: ^1.2.21
version: 1.2.21 version: 1.2.21
@ -39,7 +39,7 @@ importers:
version: 14.1.2 version: 14.1.2
'@vitejs/plugin-vue': '@vitejs/plugin-vue':
specifier: ^5.2.1 specifier: ^5.2.1
version: 5.2.1(vite@6.0.11(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1))(vue@3.5.13(typescript@5.7.3)) version: 5.2.1(vite@6.0.11(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3))
'@vue/devtools-api': '@vue/devtools-api':
specifier: ^7.7.0 specifier: ^7.7.0
version: 7.7.0 version: 7.7.0
@ -47,11 +47,11 @@ importers:
specifier: ^3.5.13 specifier: ^3.5.13
version: 3.5.13 version: 3.5.13
'@vueuse/core': '@vueuse/core':
specifier: ^12.4.0 specifier: ^12.5.0
version: 12.4.0(typescript@5.7.3) version: 12.5.0(typescript@5.7.3)
'@vueuse/integrations': '@vueuse/integrations':
specifier: ^12.4.0 specifier: ^12.5.0
version: 12.4.0(axios@1.7.9(debug@4.4.0))(focus-trap@7.6.4)(typescript@5.7.3) version: 12.5.0(axios@1.7.9(debug@4.4.0))(focus-trap@7.6.4)(typescript@5.7.3)
focus-trap: focus-trap:
specifier: ^7.6.4 specifier: ^7.6.4
version: 7.6.4 version: 7.6.4
@ -66,7 +66,7 @@ importers:
version: 2.1.0 version: 2.1.0
vite: vite:
specifier: ^6.0.11 specifier: ^6.0.11
version: 6.0.11(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1) version: 6.0.11(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0)
vue: vue:
specifier: ^3.5.13 specifier: ^3.5.13
version: 3.5.13(typescript@5.7.3) version: 3.5.13(typescript@5.7.3)
@ -144,8 +144,8 @@ importers:
specifier: ^1.2.5 specifier: ^1.2.5
version: 1.2.5 version: 1.2.5
'@types/node': '@types/node':
specifier: ^22.10.7 specifier: ^22.10.9
version: 22.10.7 version: 22.10.9
'@types/picomatch': '@types/picomatch':
specifier: ^3.0.2 specifier: ^3.0.2
version: 3.0.2 version: 3.0.2
@ -183,8 +183,8 @@ importers:
specifier: ^4.0.3 specifier: ^4.0.3
version: 4.0.3 version: 4.0.3
lint-staged: lint-staged:
specifier: ^15.4.1 specifier: ^15.4.2
version: 15.4.1 version: 15.4.2
lodash.template: lodash.template:
specifier: ^4.5.0 specifier: ^4.5.0
version: 4.5.0 version: 4.5.0
@ -237,8 +237,8 @@ importers:
specifier: ^8.0.0 specifier: ^8.0.0
version: 8.0.0 version: 8.0.0
playwright-chromium: playwright-chromium:
specifier: ^1.49.1 specifier: ^1.50.0
version: 1.49.1 version: 1.50.0
polka: polka:
specifier: ^1.0.0-next.28 specifier: ^1.0.0-next.28
version: 1.0.0-next.28 version: 1.0.0-next.28
@ -285,8 +285,8 @@ importers:
specifier: ^5.7.3 specifier: ^5.7.3
version: 5.7.3 version: 5.7.3
vitest: vitest:
specifier: ^3.0.3 specifier: ^3.0.4
version: 3.0.3(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1) version: 3.0.4(@types/debug@4.1.12)(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0)
vue-tsc: vue-tsc:
specifier: ^2.2.0 specifier: ^2.2.0
version: 2.2.0(typescript@5.7.3) version: 2.2.0(typescript@5.7.3)
@ -349,56 +349,56 @@ packages:
'@algolia/client-search': '>= 4.9.1 < 6' '@algolia/client-search': '>= 4.9.1 < 6'
algoliasearch: '>= 4.9.1 < 6' algoliasearch: '>= 4.9.1 < 6'
'@algolia/client-abtesting@5.19.0': '@algolia/client-abtesting@5.20.0':
resolution: {integrity: sha512-dMHwy2+nBL0SnIsC1iHvkBao64h4z+roGelOz11cxrDBrAdASxLxmfVMop8gmodQ2yZSacX0Rzevtxa+9SqxCw==} resolution: {integrity: sha512-YaEoNc1Xf2Yk6oCfXXkZ4+dIPLulCx8Ivqj0OsdkHWnsI3aOJChY5qsfyHhDBNSOhqn2ilgHWxSfyZrjxBcAww==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@algolia/client-analytics@5.19.0': '@algolia/client-analytics@5.20.0':
resolution: {integrity: sha512-CDW4RwnCHzU10upPJqS6N6YwDpDHno7w6/qXT9KPbPbt8szIIzCHrva4O9KIfx1OhdsHzfGSI5hMAiOOYl4DEQ==} resolution: {integrity: sha512-CIT9ni0+5sYwqehw+t5cesjho3ugKQjPVy/iPiJvtJX4g8Cdb6je6SPt2uX72cf2ISiXCAX9U3cY0nN0efnRDw==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@algolia/client-common@5.19.0': '@algolia/client-common@5.20.0':
resolution: {integrity: sha512-2ERRbICHXvtj5kfFpY5r8qu9pJII/NAHsdgUXnUitQFwPdPL7wXiupcvZJC7DSntOnE8AE0lM7oDsPhrJfj5nQ==} resolution: {integrity: sha512-iSTFT3IU8KNpbAHcBUJw2HUrPnMXeXLyGajmCL7gIzWOsYM4GabZDHXOFx93WGiXMti1dymz8k8R+bfHv1YZmA==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@algolia/client-insights@5.19.0': '@algolia/client-insights@5.20.0':
resolution: {integrity: sha512-xPOiGjo6I9mfjdJO7Y+p035aWePcbsItizIp+qVyfkfZiGgD+TbNxM12g7QhFAHIkx/mlYaocxPY/TmwPzTe+A==} resolution: {integrity: sha512-w9RIojD45z1csvW1vZmAko82fqE/Dm+Ovsy2ElTsjFDB0HMAiLh2FO86hMHbEXDPz6GhHKgGNmBRiRP8dDPgJg==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@algolia/client-personalization@5.19.0': '@algolia/client-personalization@5.20.0':
resolution: {integrity: sha512-B9eoce/fk8NLboGje+pMr72pw+PV7c5Z01On477heTZ7jkxoZ4X92dobeGuEQop61cJ93Gaevd1of4mBr4hu2A==} resolution: {integrity: sha512-p/hftHhrbiHaEcxubYOzqVV4gUqYWLpTwK+nl2xN3eTrSW9SNuFlAvUBFqPXSVBqc6J5XL9dNKn3y8OA1KElSQ==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@algolia/client-query-suggestions@5.19.0': '@algolia/client-query-suggestions@5.20.0':
resolution: {integrity: sha512-6fcP8d4S8XRDtVogrDvmSM6g5g6DndLc0pEm1GCKe9/ZkAzCmM3ZmW1wFYYPxdjMeifWy1vVEDMJK7sbE4W7MA==} resolution: {integrity: sha512-m4aAuis5vZi7P4gTfiEs6YPrk/9hNTESj3gEmGFgfJw3hO2ubdS4jSId1URd6dGdt0ax2QuapXufcrN58hPUcw==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@algolia/client-search@5.19.0': '@algolia/client-search@5.20.0':
resolution: {integrity: sha512-Ctg3xXD/1VtcwmkulR5+cKGOMj4r0wC49Y/KZdGQcqpydKn+e86F6l3tb3utLJQVq4lpEJud6kdRykFgcNsp8Q==} resolution: {integrity: sha512-KL1zWTzrlN4MSiaK1ea560iCA/UewMbS4ZsLQRPoDTWyrbDKVbztkPwwv764LAqgXk0fvkNZvJ3IelcK7DqhjQ==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@algolia/ingestion@1.19.0': '@algolia/ingestion@1.20.0':
resolution: {integrity: sha512-LO7w1MDV+ZLESwfPmXkp+KLeYeFrYEgtbCZG6buWjddhYraPQ9MuQWLhLLiaMlKxZ/sZvFTcZYuyI6Jx4WBhcg==} resolution: {integrity: sha512-shj2lTdzl9un4XJblrgqg54DoK6JeKFO8K8qInMu4XhE2JuB8De6PUuXAQwiRigZupbI0xq8aM0LKdc9+qiLQA==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@algolia/monitoring@1.19.0': '@algolia/monitoring@1.20.0':
resolution: {integrity: sha512-Mg4uoS0aIKeTpu6iv6O0Hj81s8UHagi5TLm9k2mLIib4vmMtX7WgIAHAcFIaqIZp5D6s5EVy1BaDOoZ7buuJHA==} resolution: {integrity: sha512-aF9blPwOhKtWvkjyyXh9P5peqmhCA1XxLBRgItT+K6pbT0q4hBDQrCid+pQZJYy4HFUKjB/NDDwyzFhj/rwKhw==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@algolia/recommend@5.19.0': '@algolia/recommend@5.20.0':
resolution: {integrity: sha512-PbgrMTbUPlmwfJsxjFhal4XqZO2kpBNRjemLVTkUiti4w/+kzcYO4Hg5zaBgVqPwvFDNQ8JS4SS3TBBem88u+g==} resolution: {integrity: sha512-T6B/WPdZR3b89/F9Vvk6QCbt/wrLAtrGoL8z4qPXDFApQ8MuTFWbleN/4rHn6APWO3ps+BUePIEbue2rY5MlRw==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@algolia/requester-browser-xhr@5.19.0': '@algolia/requester-browser-xhr@5.20.0':
resolution: {integrity: sha512-GfnhnQBT23mW/VMNs7m1qyEyZzhZz093aY2x8p0era96MMyNv8+FxGek5pjVX0b57tmSCZPf4EqNCpkGcGsmbw==} resolution: {integrity: sha512-t6//lXsq8E85JMenHrI6mhViipUT5riNhEfCcvtRsTV+KIBpC6Od18eK864dmBhoc5MubM0f+sGpKOqJIlBSCg==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@algolia/requester-fetch@5.19.0': '@algolia/requester-fetch@5.20.0':
resolution: {integrity: sha512-oyTt8ZJ4T4fYvW5avAnuEc6Laedcme9fAFryMD9ndUTIUe/P0kn3BuGcCLFjN3FDmdrETHSFkgPPf1hGy3sLCw==} resolution: {integrity: sha512-FHxYGqRY+6bgjKsK4aUsTAg6xMs2S21elPe4Y50GB0Y041ihvw41Vlwy2QS6K9ldoftX4JvXodbKTcmuQxywdQ==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@algolia/requester-node-http@5.19.0': '@algolia/requester-node-http@5.20.0':
resolution: {integrity: sha512-p6t8ue0XZNjcRiqNkb5QAM0qQRAKsCiebZ6n9JjWA+p8fWf8BvnhO55y2fO28g3GW0Imj7PrAuyBuxq8aDVQwQ==} resolution: {integrity: sha512-kmtQClq/w3vtPteDSPvaW9SPZL/xrIgMrxZyAgsFwrJk0vJxqyC5/hwHmrCraDnStnGSADnLpBf4SpZnwnkwWw==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
'@antfu/install-pkg@0.4.1': '@antfu/install-pkg@0.4.1':
@ -960,8 +960,8 @@ packages:
'@types/node@17.0.45': '@types/node@17.0.45':
resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==} resolution: {integrity: sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==}
'@types/node@22.10.7': '@types/node@22.10.9':
resolution: {integrity: sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg==} resolution: {integrity: sha512-Ir6hwgsKyNESl/gLOcEz3krR4CBGgliDqBQ2ma4wIhEx0w+xnoeTq3tdrNw15kU3SxogDjOgv9sqdtLW8mIHaw==}
'@types/normalize-package-data@2.4.4': '@types/normalize-package-data@2.4.4':
resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==}
@ -993,8 +993,8 @@ packages:
'@types/web-bluetooth@0.0.20': '@types/web-bluetooth@0.0.20':
resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==}
'@ungap/structured-clone@1.2.1': '@ungap/structured-clone@1.3.0':
resolution: {integrity: sha512-fEzPV3hSkSMltkw152tJKNARhOupqbH96MZWyRjNaYZOMIzbrTeQDG+MTc6Mr2pgzFQzFxAfmhGDNP5QK++2ZA==} resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
'@vitejs/plugin-vue@5.2.1': '@vitejs/plugin-vue@5.2.1':
resolution: {integrity: sha512-cxh314tzaWwOLqVes2gnnCtvBDcM1UMdn+iFR+UjAn411dPT3tOmqrJjbMd7koZpMAmBM/GqeV4n9ge7JSiJJQ==} resolution: {integrity: sha512-cxh314tzaWwOLqVes2gnnCtvBDcM1UMdn+iFR+UjAn411dPT3tOmqrJjbMd7koZpMAmBM/GqeV4n9ge7JSiJJQ==}
@ -1003,11 +1003,11 @@ packages:
vite: ^5.0.0 || ^6.0.0 vite: ^5.0.0 || ^6.0.0
vue: ^3.2.25 vue: ^3.2.25
'@vitest/expect@3.0.3': '@vitest/expect@3.0.4':
resolution: {integrity: sha512-SbRCHU4qr91xguu+dH3RUdI5dC86zm8aZWydbp961aIR7G8OYNN6ZiayFuf9WAngRbFOfdrLHCGgXTj3GtoMRQ==} resolution: {integrity: sha512-Nm5kJmYw6P2BxhJPkO3eKKhGYKRsnqJqf+r0yOGRKpEP+bSCBDsjXgiu1/5QFrnPMEgzfC38ZEjvCFgaNBC0Eg==}
'@vitest/mocker@3.0.3': '@vitest/mocker@3.0.4':
resolution: {integrity: sha512-XT2XBc4AN9UdaxJAeIlcSZ0ILi/GzmG5G8XSly4gaiqIvPV3HMTSIDZWJVX6QRJ0PX1m+W8Cy0K9ByXNb/bPIA==} resolution: {integrity: sha512-gEef35vKafJlfQbnyOXZ0Gcr9IBUsMTyTLXsEQwuyYAerpHqvXhzdBnDFuHLpFqth3F7b6BaFr4qV/Cs1ULx5A==}
peerDependencies: peerDependencies:
msw: ^2.4.9 msw: ^2.4.9
vite: ^5.0.0 || ^6.0.0 vite: ^5.0.0 || ^6.0.0
@ -1017,20 +1017,20 @@ packages:
vite: vite:
optional: true optional: true
'@vitest/pretty-format@3.0.3': '@vitest/pretty-format@3.0.4':
resolution: {integrity: sha512-gCrM9F7STYdsDoNjGgYXKPq4SkSxwwIU5nkaQvdUxiQ0EcNlez+PdKOVIsUJvh9P9IeIFmjn4IIREWblOBpP2Q==} resolution: {integrity: sha512-ts0fba+dEhK2aC9PFuZ9LTpULHpY/nd6jhAQ5IMU7Gaj7crPCTdCFfgvXxruRBLFS+MLraicCuFXxISEq8C93g==}
'@vitest/runner@3.0.3': '@vitest/runner@3.0.4':
resolution: {integrity: sha512-Rgi2kOAk5ZxWZlwPguRJFOBmWs6uvvyAAR9k3MvjRvYrG7xYvKChZcmnnpJCS98311CBDMqsW9MzzRFsj2gX3g==} resolution: {integrity: sha512-dKHzTQ7n9sExAcWH/0sh1elVgwc7OJ2lMOBrAm73J7AH6Pf9T12Zh3lNE1TETZaqrWFXtLlx3NVrLRb5hCK+iw==}
'@vitest/snapshot@3.0.3': '@vitest/snapshot@3.0.4':
resolution: {integrity: sha512-kNRcHlI4txBGztuJfPEJ68VezlPAXLRT1u5UCx219TU3kOG2DplNxhWLwDf2h6emwmTPogzLnGVwP6epDaJN6Q==} resolution: {integrity: sha512-+p5knMLwIk7lTQkM3NonZ9zBewzVp9EVkVpvNta0/PlFWpiqLaRcF4+33L1it3uRUCh0BGLOaXPPGEjNKfWb4w==}
'@vitest/spy@3.0.3': '@vitest/spy@3.0.4':
resolution: {integrity: sha512-7/dgux8ZBbF7lEIKNnEqQlyRaER9nkAL9eTmdKJkDO3hS8p59ATGwKOCUDHcBLKr7h/oi/6hP+7djQk8049T2A==} resolution: {integrity: sha512-sXIMF0oauYyUy2hN49VFTYodzEAu744MmGcPR3ZBsPM20G+1/cSW/n1U+3Yu/zHxX2bIDe1oJASOkml+osTU6Q==}
'@vitest/utils@3.0.3': '@vitest/utils@3.0.4':
resolution: {integrity: sha512-f+s8CvyzPtMFY1eZKkIHGhPsQgYo5qCm6O8KZoim9qm1/jT64qBgGpO5tHscNH6BzRHM+edLNOP+3vO8+8pE/A==} resolution: {integrity: sha512-8BqC1ksYsHtbWH+DfpOAKrFw3jl3Uf9J7yeFh85Pz52IWuh1hBBtyfEbRNNZNjl8H8A5yMLH9/t+k7HIKzQcZQ==}
'@volar/language-core@2.4.11': '@volar/language-core@2.4.11':
resolution: {integrity: sha512-lN2C1+ByfW9/JRPpqScuZt/4OrUUse57GLI6TbLgTIqBVemdl1wNcZ1qYGEo2+Gw8coYLgCy7SuKqn6IrQcQgg==} resolution: {integrity: sha512-lN2C1+ByfW9/JRPpqScuZt/4OrUUse57GLI6TbLgTIqBVemdl1wNcZ1qYGEo2+Gw8coYLgCy7SuKqn6IrQcQgg==}
@ -1090,11 +1090,11 @@ packages:
'@vue/shared@3.5.13': '@vue/shared@3.5.13':
resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==} resolution: {integrity: sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==}
'@vueuse/core@12.4.0': '@vueuse/core@12.5.0':
resolution: {integrity: sha512-XnjQYcJwCsyXyIafyA6SvyN/OBtfPnjvJmbxNxQjCcyWD198urwm5TYvIUUyAxEAN0K7HJggOgT15cOlWFyLeA==} resolution: {integrity: sha512-GVyH1iYqNANwcahAx8JBm6awaNgvR/SwZ1fjr10b8l1HIgDp82ngNbfzJUgOgWEoxjL+URAggnlilAEXwCOZtg==}
'@vueuse/integrations@12.4.0': '@vueuse/integrations@12.5.0':
resolution: {integrity: sha512-EZm+TLoZMeEwDnccnEqB54CvvcVKbVnJubOF380HqdyZAxWfQ8egnFCESdlXWEIbxFgjfhcGfZUvQx5Nqw9Ofw==} resolution: {integrity: sha512-HYLt8M6mjUfcoUOzyBcX2RjpfapIwHPBmQJtTmXOQW845Y/Osu9VuTJ5kPvnmWJ6IUa05WpblfOwZ+P0G4iZsQ==}
peerDependencies: peerDependencies:
async-validator: ^4 async-validator: ^4
axios: ^1 axios: ^1
@ -1134,11 +1134,11 @@ packages:
universal-cookie: universal-cookie:
optional: true optional: true
'@vueuse/metadata@12.4.0': '@vueuse/metadata@12.5.0':
resolution: {integrity: sha512-AhPuHs/qtYrKHUlEoNO6zCXufu8OgbR8S/n2oMw1OQuBQJ3+HOLQ+EpvXs+feOlZMa0p8QVvDWNlmcJJY8rW2g==} resolution: {integrity: sha512-Ui7Lo2a7AxrMAXRF+fAp9QsXuwTeeZ8fIB9wsLHqzq9MQk+2gMYE2IGJW48VMJ8ecvCB3z3GsGLKLbSasQ5Qlg==}
'@vueuse/shared@12.4.0': '@vueuse/shared@12.5.0':
resolution: {integrity: sha512-9yLgbHVIF12OSCojnjTIoZL1+UA10+O4E1aD6Hpfo/DKVm5o3SZIwz6CupqGy3+IcKI8d6Jnl26EQj/YucnW0Q==} resolution: {integrity: sha512-vMpcL1lStUU6O+kdj6YdHDixh0odjPAUM15uJ9f7MY781jcYkIwFA4iv2EfoIPO6vBmvutI1HxxAwmf0cx5ISQ==}
acorn@8.14.0: acorn@8.14.0:
resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==}
@ -1148,8 +1148,8 @@ packages:
add-stream@1.0.0: add-stream@1.0.0:
resolution: {integrity: sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ==} resolution: {integrity: sha512-qQLMr+8o0WC4FZGQTcJiKBVC59JylcPSrTtk6usvmIDFUOCKegapy1VHQwRbFMOFyb/inzUVqHs+eMYKDM1YeQ==}
algoliasearch@5.19.0: algoliasearch@5.20.0:
resolution: {integrity: sha512-zrLtGhC63z3sVLDDKGW+SlCRN9eJHFTgdEmoAOpsVh6wgGL1GgTTDou7tpCBjevzgIvi3AIyDAQO3Xjbg5eqZg==} resolution: {integrity: sha512-groO71Fvi5SWpxjI9Ia+chy0QBwT61mg6yxJV27f5YFf+Mw+STT75K6SHySpP8Co5LsCrtsbCH5dJZSRtkSKaQ==}
engines: {node: '>= 14.0.0'} engines: {node: '>= 14.0.0'}
alien-signals@0.4.14: alien-signals@0.4.14:
@ -1286,8 +1286,8 @@ packages:
comma-separated-tokens@2.0.3: comma-separated-tokens@2.0.3:
resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==}
commander@12.1.0: commander@13.1.0:
resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} resolution: {integrity: sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==}
engines: {node: '>=18'} engines: {node: '>=18'}
commander@6.2.1: commander@6.2.1:
@ -1836,8 +1836,8 @@ packages:
linkify-it@5.0.0: linkify-it@5.0.0:
resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==} resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==}
lint-staged@15.4.1: lint-staged@15.4.2:
resolution: {integrity: sha512-P8yJuVRyLrm5KxCtFx+gjI5Bil+wO7wnTl7C3bXhvtTaAFGirzeB24++D0wGoUwxrUKecNiehemgCob9YL39NA==} resolution: {integrity: sha512-gCqzB/Li281uZJgReNci+oXXqUEdrFAQAzTE/LwoxxiEuP41vozNe4BATS+4ehdqkWn+Z6bGc3EDcBja3npBVw==}
engines: {node: '>=18.12.0'} engines: {node: '>=18.12.0'}
hasBin: true hasBin: true
@ -2163,13 +2163,13 @@ packages:
pkg-types@1.3.1: pkg-types@1.3.1:
resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==} resolution: {integrity: sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==}
playwright-chromium@1.49.1: playwright-chromium@1.50.0:
resolution: {integrity: sha512-XAQDkZ1Eem1OONhfS8B2LM2mgHG/i5jIxooxjvqjbF/9GnLnRTJHdQamNjo1e4FZvt7J0BFD/15+qAcT0eKlfA==} resolution: {integrity: sha512-gyI1ATjSCn0kCHCV8lGS65h0tRSlJvdlwgvXwY5EyUHW+YLPnOtnMaCiNmHgrcVK8ofsXWq3alaUfnmirNzBlA==}
engines: {node: '>=18'} engines: {node: '>=18'}
hasBin: true hasBin: true
playwright-core@1.49.1: playwright-core@1.50.0:
resolution: {integrity: sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==} resolution: {integrity: sha512-CXkSSlr4JaZs2tZHI40DsZUN/NIwgaUPsyLuOAaIZp2CyF2sN5MM5NJsyB188lFSSozFxQ5fPT4qM+f0tH/6wQ==}
engines: {node: '>=18'} engines: {node: '>=18'}
hasBin: true hasBin: true
@ -2624,8 +2624,8 @@ packages:
vfile@6.0.3: vfile@6.0.3:
resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==} resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}
vite-node@3.0.3: vite-node@3.0.4:
resolution: {integrity: sha512-0sQcwhwAEw/UJGojbhOrnq3HtiZ3tC7BzpAa0lx3QaTX0S3YX70iGcik25UBdB96pmdwjyY2uyKNYruxCDmiEg==} resolution: {integrity: sha512-7JZKEzcYV2Nx3u6rlvN8qdo3QV7Fxyt6hx+CCKz9fbWxdX5IvUOmTWEAxMrWxaiSf7CKGLJQ5rFu8prb/jBjOA==}
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
hasBin: true hasBin: true
@ -2672,20 +2672,23 @@ packages:
vitepress-plugin-group-icons@1.3.5: vitepress-plugin-group-icons@1.3.5:
resolution: {integrity: sha512-1f1NP7osRYlNTR0yS5CAqcaasKHRSAzFKpeCUOfCPwYLAFxhCxsEbRtPBm0U1CfrDVa303MsjX18ngGpFGxIMA==} resolution: {integrity: sha512-1f1NP7osRYlNTR0yS5CAqcaasKHRSAzFKpeCUOfCPwYLAFxhCxsEbRtPBm0U1CfrDVa303MsjX18ngGpFGxIMA==}
vitest@3.0.3: vitest@3.0.4:
resolution: {integrity: sha512-dWdwTFUW9rcnL0LyF2F+IfvNQWB0w9DERySCk8VMG75F8k25C7LsZoh6XfCjPvcR8Nb+Lqi9JKr6vnzH7HSrpQ==} resolution: {integrity: sha512-6XG8oTKy2gnJIFTHP6LD7ExFeNLxiTkK3CfMvT7IfR8IN+BYICCf0lXUQmX7i7JoxUP8QmeP4mTnWXgflu4yjw==}
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
hasBin: true hasBin: true
peerDependencies: peerDependencies:
'@edge-runtime/vm': '*' '@edge-runtime/vm': '*'
'@types/debug': ^4.1.12
'@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0
'@vitest/browser': 3.0.3 '@vitest/browser': 3.0.4
'@vitest/ui': 3.0.3 '@vitest/ui': 3.0.4
happy-dom: '*' happy-dom: '*'
jsdom: '*' jsdom: '*'
peerDependenciesMeta: peerDependenciesMeta:
'@edge-runtime/vm': '@edge-runtime/vm':
optional: true optional: true
'@types/debug':
optional: true
'@types/node': '@types/node':
optional: true optional: true
'@vitest/browser': '@vitest/browser':
@ -2761,8 +2764,8 @@ packages:
resolution: {integrity: sha512-f9s+fUkX04BxQf+7mMWAp5zk61pciie+fFLC9hX9UVvCeJQfNHRHXpeo5MPcR0EUf57PYLdt+ZO4f3Ipk2oZUw==} resolution: {integrity: sha512-f9s+fUkX04BxQf+7mMWAp5zk61pciie+fFLC9hX9UVvCeJQfNHRHXpeo5MPcR0EUf57PYLdt+ZO4f3Ipk2oZUw==}
engines: {node: '>=0.1'} engines: {node: '>=0.1'}
yaml@2.6.1: yaml@2.7.0:
resolution: {integrity: sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==} resolution: {integrity: sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==}
engines: {node: '>= 14'} engines: {node: '>= 14'}
hasBin: true hasBin: true
@ -2778,109 +2781,109 @@ packages:
snapshots: snapshots:
'@algolia/autocomplete-core@1.17.9(@algolia/client-search@5.19.0)(algoliasearch@5.19.0)': '@algolia/autocomplete-core@1.17.9(@algolia/client-search@5.20.0)(algoliasearch@5.20.0)':
dependencies: dependencies:
'@algolia/autocomplete-plugin-algolia-insights': 1.17.9(@algolia/client-search@5.19.0)(algoliasearch@5.19.0) '@algolia/autocomplete-plugin-algolia-insights': 1.17.9(@algolia/client-search@5.20.0)(algoliasearch@5.20.0)
'@algolia/autocomplete-shared': 1.17.9(@algolia/client-search@5.19.0)(algoliasearch@5.19.0) '@algolia/autocomplete-shared': 1.17.9(@algolia/client-search@5.20.0)(algoliasearch@5.20.0)
transitivePeerDependencies: transitivePeerDependencies:
- '@algolia/client-search' - '@algolia/client-search'
- algoliasearch - algoliasearch
- search-insights - search-insights
'@algolia/autocomplete-plugin-algolia-insights@1.17.9(@algolia/client-search@5.19.0)(algoliasearch@5.19.0)': '@algolia/autocomplete-plugin-algolia-insights@1.17.9(@algolia/client-search@5.20.0)(algoliasearch@5.20.0)':
dependencies: dependencies:
'@algolia/autocomplete-shared': 1.17.9(@algolia/client-search@5.19.0)(algoliasearch@5.19.0) '@algolia/autocomplete-shared': 1.17.9(@algolia/client-search@5.20.0)(algoliasearch@5.20.0)
transitivePeerDependencies: transitivePeerDependencies:
- '@algolia/client-search' - '@algolia/client-search'
- algoliasearch - algoliasearch
'@algolia/autocomplete-preset-algolia@1.17.9(@algolia/client-search@5.19.0)(algoliasearch@5.19.0)': '@algolia/autocomplete-preset-algolia@1.17.9(@algolia/client-search@5.20.0)(algoliasearch@5.20.0)':
dependencies: dependencies:
'@algolia/autocomplete-shared': 1.17.9(@algolia/client-search@5.19.0)(algoliasearch@5.19.0) '@algolia/autocomplete-shared': 1.17.9(@algolia/client-search@5.20.0)(algoliasearch@5.20.0)
'@algolia/client-search': 5.19.0 '@algolia/client-search': 5.20.0
algoliasearch: 5.19.0 algoliasearch: 5.20.0
'@algolia/autocomplete-shared@1.17.9(@algolia/client-search@5.19.0)(algoliasearch@5.19.0)': '@algolia/autocomplete-shared@1.17.9(@algolia/client-search@5.20.0)(algoliasearch@5.20.0)':
dependencies: dependencies:
'@algolia/client-search': 5.19.0 '@algolia/client-search': 5.20.0
algoliasearch: 5.19.0 algoliasearch: 5.20.0
'@algolia/client-abtesting@5.19.0': '@algolia/client-abtesting@5.20.0':
dependencies: dependencies:
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@algolia/requester-browser-xhr': 5.19.0 '@algolia/requester-browser-xhr': 5.20.0
'@algolia/requester-fetch': 5.19.0 '@algolia/requester-fetch': 5.20.0
'@algolia/requester-node-http': 5.19.0 '@algolia/requester-node-http': 5.20.0
'@algolia/client-analytics@5.19.0': '@algolia/client-analytics@5.20.0':
dependencies: dependencies:
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@algolia/requester-browser-xhr': 5.19.0 '@algolia/requester-browser-xhr': 5.20.0
'@algolia/requester-fetch': 5.19.0 '@algolia/requester-fetch': 5.20.0
'@algolia/requester-node-http': 5.19.0 '@algolia/requester-node-http': 5.20.0
'@algolia/client-common@5.19.0': {} '@algolia/client-common@5.20.0': {}
'@algolia/client-insights@5.19.0': '@algolia/client-insights@5.20.0':
dependencies: dependencies:
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@algolia/requester-browser-xhr': 5.19.0 '@algolia/requester-browser-xhr': 5.20.0
'@algolia/requester-fetch': 5.19.0 '@algolia/requester-fetch': 5.20.0
'@algolia/requester-node-http': 5.19.0 '@algolia/requester-node-http': 5.20.0
'@algolia/client-personalization@5.19.0': '@algolia/client-personalization@5.20.0':
dependencies: dependencies:
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@algolia/requester-browser-xhr': 5.19.0 '@algolia/requester-browser-xhr': 5.20.0
'@algolia/requester-fetch': 5.19.0 '@algolia/requester-fetch': 5.20.0
'@algolia/requester-node-http': 5.19.0 '@algolia/requester-node-http': 5.20.0
'@algolia/client-query-suggestions@5.19.0': '@algolia/client-query-suggestions@5.20.0':
dependencies: dependencies:
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@algolia/requester-browser-xhr': 5.19.0 '@algolia/requester-browser-xhr': 5.20.0
'@algolia/requester-fetch': 5.19.0 '@algolia/requester-fetch': 5.20.0
'@algolia/requester-node-http': 5.19.0 '@algolia/requester-node-http': 5.20.0
'@algolia/client-search@5.19.0': '@algolia/client-search@5.20.0':
dependencies: dependencies:
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@algolia/requester-browser-xhr': 5.19.0 '@algolia/requester-browser-xhr': 5.20.0
'@algolia/requester-fetch': 5.19.0 '@algolia/requester-fetch': 5.20.0
'@algolia/requester-node-http': 5.19.0 '@algolia/requester-node-http': 5.20.0
'@algolia/ingestion@1.19.0': '@algolia/ingestion@1.20.0':
dependencies: dependencies:
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@algolia/requester-browser-xhr': 5.19.0 '@algolia/requester-browser-xhr': 5.20.0
'@algolia/requester-fetch': 5.19.0 '@algolia/requester-fetch': 5.20.0
'@algolia/requester-node-http': 5.19.0 '@algolia/requester-node-http': 5.20.0
'@algolia/monitoring@1.19.0': '@algolia/monitoring@1.20.0':
dependencies: dependencies:
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@algolia/requester-browser-xhr': 5.19.0 '@algolia/requester-browser-xhr': 5.20.0
'@algolia/requester-fetch': 5.19.0 '@algolia/requester-fetch': 5.20.0
'@algolia/requester-node-http': 5.19.0 '@algolia/requester-node-http': 5.20.0
'@algolia/recommend@5.19.0': '@algolia/recommend@5.20.0':
dependencies: dependencies:
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@algolia/requester-browser-xhr': 5.19.0 '@algolia/requester-browser-xhr': 5.20.0
'@algolia/requester-fetch': 5.19.0 '@algolia/requester-fetch': 5.20.0
'@algolia/requester-node-http': 5.19.0 '@algolia/requester-node-http': 5.20.0
'@algolia/requester-browser-xhr@5.19.0': '@algolia/requester-browser-xhr@5.20.0':
dependencies: dependencies:
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@algolia/requester-fetch@5.19.0': '@algolia/requester-fetch@5.20.0':
dependencies: dependencies:
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@algolia/requester-node-http@5.19.0': '@algolia/requester-node-http@5.20.0':
dependencies: dependencies:
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@antfu/install-pkg@0.4.1': '@antfu/install-pkg@0.4.1':
dependencies: dependencies:
@ -2934,9 +2937,9 @@ snapshots:
'@docsearch/css@3.8.3': {} '@docsearch/css@3.8.3': {}
'@docsearch/js@3.8.3(@algolia/client-search@5.19.0)': '@docsearch/js@3.8.3(@algolia/client-search@5.20.0)':
dependencies: dependencies:
'@docsearch/react': 3.8.3(@algolia/client-search@5.19.0) '@docsearch/react': 3.8.3(@algolia/client-search@5.20.0)
preact: 10.25.4 preact: 10.25.4
transitivePeerDependencies: transitivePeerDependencies:
- '@algolia/client-search' - '@algolia/client-search'
@ -2945,12 +2948,12 @@ snapshots:
- react-dom - react-dom
- search-insights - search-insights
'@docsearch/react@3.8.3(@algolia/client-search@5.19.0)': '@docsearch/react@3.8.3(@algolia/client-search@5.20.0)':
dependencies: dependencies:
'@algolia/autocomplete-core': 1.17.9(@algolia/client-search@5.19.0)(algoliasearch@5.19.0) '@algolia/autocomplete-core': 1.17.9(@algolia/client-search@5.20.0)(algoliasearch@5.20.0)
'@algolia/autocomplete-preset-algolia': 1.17.9(@algolia/client-search@5.19.0)(algoliasearch@5.19.0) '@algolia/autocomplete-preset-algolia': 1.17.9(@algolia/client-search@5.20.0)(algoliasearch@5.20.0)
'@docsearch/css': 3.8.3 '@docsearch/css': 3.8.3
algoliasearch: 5.19.0 algoliasearch: 5.20.0
transitivePeerDependencies: transitivePeerDependencies:
- '@algolia/client-search' - '@algolia/client-search'
@ -3321,7 +3324,7 @@ snapshots:
'@types/cross-spawn@6.0.6': '@types/cross-spawn@6.0.6':
dependencies: dependencies:
'@types/node': 22.10.7 '@types/node': 22.10.9
'@types/debug@4.1.12': '@types/debug@4.1.12':
dependencies: dependencies:
@ -3332,7 +3335,7 @@ snapshots:
'@types/fs-extra@11.0.4': '@types/fs-extra@11.0.4':
dependencies: dependencies:
'@types/jsonfile': 6.1.4 '@types/jsonfile': 6.1.4
'@types/node': 22.10.7 '@types/node': 22.10.9
'@types/hast@3.0.4': '@types/hast@3.0.4':
dependencies: dependencies:
@ -3344,7 +3347,7 @@ snapshots:
'@types/jsonfile@6.1.4': '@types/jsonfile@6.1.4':
dependencies: dependencies:
'@types/node': 22.10.7 '@types/node': 22.10.9
'@types/linkify-it@5.0.0': {} '@types/linkify-it@5.0.0': {}
@ -3387,7 +3390,7 @@ snapshots:
'@types/node@17.0.45': {} '@types/node@17.0.45': {}
'@types/node@22.10.7': '@types/node@22.10.9':
dependencies: dependencies:
undici-types: 6.20.0 undici-types: 6.20.0
@ -3401,14 +3404,14 @@ snapshots:
'@types/prompts@2.4.9': '@types/prompts@2.4.9':
dependencies: dependencies:
'@types/node': 22.10.7 '@types/node': 22.10.9
kleur: 3.0.3 kleur: 3.0.3
'@types/resolve@1.20.2': {} '@types/resolve@1.20.2': {}
'@types/sax@1.2.7': '@types/sax@1.2.7':
dependencies: dependencies:
'@types/node': 22.10.7 '@types/node': 22.10.9
'@types/semver@7.5.8': {} '@types/semver@7.5.8': {}
@ -3418,50 +3421,50 @@ snapshots:
'@types/web-bluetooth@0.0.20': {} '@types/web-bluetooth@0.0.20': {}
'@ungap/structured-clone@1.2.1': {} '@ungap/structured-clone@1.3.0': {}
'@vitejs/plugin-vue@5.2.1(vite@6.0.11(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1))(vue@3.5.13(typescript@5.7.3))': '@vitejs/plugin-vue@5.2.1(vite@6.0.11(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3))':
dependencies: dependencies:
vite: 6.0.11(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1) vite: 6.0.11(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0)
vue: 3.5.13(typescript@5.7.3) vue: 3.5.13(typescript@5.7.3)
'@vitest/expect@3.0.3': '@vitest/expect@3.0.4':
dependencies: dependencies:
'@vitest/spy': 3.0.3 '@vitest/spy': 3.0.4
'@vitest/utils': 3.0.3 '@vitest/utils': 3.0.4
chai: 5.1.2 chai: 5.1.2
tinyrainbow: 2.0.0 tinyrainbow: 2.0.0
'@vitest/mocker@3.0.3(vite@6.0.11(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1))': '@vitest/mocker@3.0.4(vite@6.0.11(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0))':
dependencies: dependencies:
'@vitest/spy': 3.0.3 '@vitest/spy': 3.0.4
estree-walker: 3.0.3 estree-walker: 3.0.3
magic-string: 0.30.17 magic-string: 0.30.17
optionalDependencies: optionalDependencies:
vite: 6.0.11(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1) vite: 6.0.11(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0)
'@vitest/pretty-format@3.0.3': '@vitest/pretty-format@3.0.4':
dependencies: dependencies:
tinyrainbow: 2.0.0 tinyrainbow: 2.0.0
'@vitest/runner@3.0.3': '@vitest/runner@3.0.4':
dependencies: dependencies:
'@vitest/utils': 3.0.3 '@vitest/utils': 3.0.4
pathe: 2.0.2 pathe: 2.0.2
'@vitest/snapshot@3.0.3': '@vitest/snapshot@3.0.4':
dependencies: dependencies:
'@vitest/pretty-format': 3.0.3 '@vitest/pretty-format': 3.0.4
magic-string: 0.30.17 magic-string: 0.30.17
pathe: 2.0.2 pathe: 2.0.2
'@vitest/spy@3.0.3': '@vitest/spy@3.0.4':
dependencies: dependencies:
tinyspy: 3.0.2 tinyspy: 3.0.2
'@vitest/utils@3.0.3': '@vitest/utils@3.0.4':
dependencies: dependencies:
'@vitest/pretty-format': 3.0.3 '@vitest/pretty-format': 3.0.4
loupe: 3.1.2 loupe: 3.1.2
tinyrainbow: 2.0.0 tinyrainbow: 2.0.0
@ -3567,19 +3570,19 @@ snapshots:
'@vue/shared@3.5.13': {} '@vue/shared@3.5.13': {}
'@vueuse/core@12.4.0(typescript@5.7.3)': '@vueuse/core@12.5.0(typescript@5.7.3)':
dependencies: dependencies:
'@types/web-bluetooth': 0.0.20 '@types/web-bluetooth': 0.0.20
'@vueuse/metadata': 12.4.0 '@vueuse/metadata': 12.5.0
'@vueuse/shared': 12.4.0(typescript@5.7.3) '@vueuse/shared': 12.5.0(typescript@5.7.3)
vue: 3.5.13(typescript@5.7.3) vue: 3.5.13(typescript@5.7.3)
transitivePeerDependencies: transitivePeerDependencies:
- typescript - typescript
'@vueuse/integrations@12.4.0(axios@1.7.9(debug@4.4.0))(focus-trap@7.6.4)(typescript@5.7.3)': '@vueuse/integrations@12.5.0(axios@1.7.9(debug@4.4.0))(focus-trap@7.6.4)(typescript@5.7.3)':
dependencies: dependencies:
'@vueuse/core': 12.4.0(typescript@5.7.3) '@vueuse/core': 12.5.0(typescript@5.7.3)
'@vueuse/shared': 12.4.0(typescript@5.7.3) '@vueuse/shared': 12.5.0(typescript@5.7.3)
vue: 3.5.13(typescript@5.7.3) vue: 3.5.13(typescript@5.7.3)
optionalDependencies: optionalDependencies:
axios: 1.7.9(debug@4.4.0) axios: 1.7.9(debug@4.4.0)
@ -3587,9 +3590,9 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- typescript - typescript
'@vueuse/metadata@12.4.0': {} '@vueuse/metadata@12.5.0': {}
'@vueuse/shared@12.4.0(typescript@5.7.3)': '@vueuse/shared@12.5.0(typescript@5.7.3)':
dependencies: dependencies:
vue: 3.5.13(typescript@5.7.3) vue: 3.5.13(typescript@5.7.3)
transitivePeerDependencies: transitivePeerDependencies:
@ -3599,21 +3602,21 @@ snapshots:
add-stream@1.0.0: {} add-stream@1.0.0: {}
algoliasearch@5.19.0: algoliasearch@5.20.0:
dependencies: dependencies:
'@algolia/client-abtesting': 5.19.0 '@algolia/client-abtesting': 5.20.0
'@algolia/client-analytics': 5.19.0 '@algolia/client-analytics': 5.20.0
'@algolia/client-common': 5.19.0 '@algolia/client-common': 5.20.0
'@algolia/client-insights': 5.19.0 '@algolia/client-insights': 5.20.0
'@algolia/client-personalization': 5.19.0 '@algolia/client-personalization': 5.20.0
'@algolia/client-query-suggestions': 5.19.0 '@algolia/client-query-suggestions': 5.20.0
'@algolia/client-search': 5.19.0 '@algolia/client-search': 5.20.0
'@algolia/ingestion': 1.19.0 '@algolia/ingestion': 1.20.0
'@algolia/monitoring': 1.19.0 '@algolia/monitoring': 1.20.0
'@algolia/recommend': 5.19.0 '@algolia/recommend': 5.20.0
'@algolia/requester-browser-xhr': 5.19.0 '@algolia/requester-browser-xhr': 5.20.0
'@algolia/requester-fetch': 5.19.0 '@algolia/requester-fetch': 5.20.0
'@algolia/requester-node-http': 5.19.0 '@algolia/requester-node-http': 5.20.0
alien-signals@0.4.14: {} alien-signals@0.4.14: {}
@ -3740,7 +3743,7 @@ snapshots:
comma-separated-tokens@2.0.3: {} comma-separated-tokens@2.0.3: {}
commander@12.1.0: {} commander@13.1.0: {}
commander@6.2.1: {} commander@6.2.1: {}
@ -4298,10 +4301,10 @@ snapshots:
dependencies: dependencies:
uc.micro: 2.1.0 uc.micro: 2.1.0
lint-staged@15.4.1: lint-staged@15.4.2:
dependencies: dependencies:
chalk: 5.4.1 chalk: 5.4.1
commander: 12.1.0 commander: 13.1.0
debug: 4.4.0 debug: 4.4.0
execa: 8.0.1 execa: 8.0.1
lilconfig: 3.1.3 lilconfig: 3.1.3
@ -4309,7 +4312,7 @@ snapshots:
micromatch: 4.0.8 micromatch: 4.0.8
pidtree: 0.6.0 pidtree: 0.6.0
string-argv: 0.3.2 string-argv: 0.3.2
yaml: 2.6.1 yaml: 2.7.0
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
@ -4410,7 +4413,7 @@ snapshots:
dependencies: dependencies:
'@types/hast': 3.0.4 '@types/hast': 3.0.4
'@types/mdast': 4.0.4 '@types/mdast': 4.0.4
'@ungap/structured-clone': 1.2.1 '@ungap/structured-clone': 1.3.0
devlop: 1.1.0 devlop: 1.1.0
micromark-util-sanitize-uri: 2.0.1 micromark-util-sanitize-uri: 2.0.1
trim-lines: 3.0.1 trim-lines: 3.0.1
@ -4628,11 +4631,11 @@ snapshots:
mlly: 1.7.4 mlly: 1.7.4
pathe: 2.0.2 pathe: 2.0.2
playwright-chromium@1.49.1: playwright-chromium@1.50.0:
dependencies: dependencies:
playwright-core: 1.49.1 playwright-core: 1.50.0
playwright-core@1.49.1: {} playwright-core@1.50.0: {}
polka@1.0.0-next.28: polka@1.0.0-next.28:
dependencies: dependencies:
@ -5082,13 +5085,13 @@ snapshots:
'@types/unist': 3.0.3 '@types/unist': 3.0.3
vfile-message: 4.0.2 vfile-message: 4.0.2
vite-node@3.0.3(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1): vite-node@3.0.4(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0):
dependencies: dependencies:
cac: 6.7.14 cac: 6.7.14
debug: 4.4.0 debug: 4.4.0
es-module-lexer: 1.6.0 es-module-lexer: 1.6.0
pathe: 2.0.2 pathe: 2.0.2
vite: 6.0.11(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1) vite: 6.0.11(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0)
transitivePeerDependencies: transitivePeerDependencies:
- '@types/node' - '@types/node'
- jiti - jiti
@ -5103,16 +5106,16 @@ snapshots:
- tsx - tsx
- yaml - yaml
vite@6.0.11(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1): vite@6.0.11(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0):
dependencies: dependencies:
esbuild: 0.24.2 esbuild: 0.24.2
postcss: 8.5.1 postcss: 8.5.1
rollup: 4.31.0 rollup: 4.31.0
optionalDependencies: optionalDependencies:
'@types/node': 22.10.7 '@types/node': 22.10.9
fsevents: 2.3.3 fsevents: 2.3.3
jiti: 1.21.7 jiti: 1.21.7
yaml: 2.6.1 yaml: 2.7.0
vitepress-plugin-group-icons@1.3.5: vitepress-plugin-group-icons@1.3.5:
dependencies: dependencies:
@ -5122,15 +5125,15 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
vitest@3.0.3(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1): vitest@3.0.4(@types/debug@4.1.12)(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0):
dependencies: dependencies:
'@vitest/expect': 3.0.3 '@vitest/expect': 3.0.4
'@vitest/mocker': 3.0.3(vite@6.0.11(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1)) '@vitest/mocker': 3.0.4(vite@6.0.11(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0))
'@vitest/pretty-format': 3.0.3 '@vitest/pretty-format': 3.0.4
'@vitest/runner': 3.0.3 '@vitest/runner': 3.0.4
'@vitest/snapshot': 3.0.3 '@vitest/snapshot': 3.0.4
'@vitest/spy': 3.0.3 '@vitest/spy': 3.0.4
'@vitest/utils': 3.0.3 '@vitest/utils': 3.0.4
chai: 5.1.2 chai: 5.1.2
debug: 4.4.0 debug: 4.4.0
expect-type: 1.1.0 expect-type: 1.1.0
@ -5141,11 +5144,12 @@ snapshots:
tinyexec: 0.3.2 tinyexec: 0.3.2
tinypool: 1.0.2 tinypool: 1.0.2
tinyrainbow: 2.0.0 tinyrainbow: 2.0.0
vite: 6.0.11(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1) vite: 6.0.11(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0)
vite-node: 3.0.3(@types/node@22.10.7)(jiti@1.21.7)(yaml@2.6.1) vite-node: 3.0.4(@types/node@22.10.9)(jiti@1.21.7)(yaml@2.7.0)
why-is-node-running: 2.3.0 why-is-node-running: 2.3.0
optionalDependencies: optionalDependencies:
'@types/node': 22.10.7 '@types/debug': 4.1.12
'@types/node': 22.10.9
transitivePeerDependencies: transitivePeerDependencies:
- jiti - jiti
- less - less
@ -5239,7 +5243,7 @@ snapshots:
xmldom-sre@0.1.31: {} xmldom-sre@0.1.31: {}
yaml@2.6.1: {} yaml@2.7.0: {}
yoctocolors@2.1.1: {} yoctocolors@2.1.1: {}

@ -159,19 +159,14 @@ function newRouter(): Router {
if (inBrowser) { if (inBrowser) {
createApp().then(({ app, router, data }) => { createApp().then(({ app, router, data }) => {
// wait until page component is fetched before mounting // wait until page component is fetched before mounting
router.go().then(() => { router.go(location.href, { initialLoad: true }).then(() => {
// dynamically update head tags // dynamically update head tags
useUpdateHead(router.route, data.site) useUpdateHead(router.route, data.site)
app.mount('#app') app.mount('#app')
// scroll to hash on new tab during dev // scroll to hash on new tab during dev
if (import.meta.env.DEV && location.hash) { if (import.meta.env.DEV && location.hash) {
const target = document.getElementById( scrollTo(location.hash)
decodeURIComponent(location.hash).slice(1)
)
if (target) {
scrollTo(target, location.hash)
}
} }
}) })
}) })

@ -7,6 +7,8 @@ import { getScrollOffset, inBrowser, withBase } from './utils'
export interface Route { export interface Route {
path: string path: string
hash: string
query: string
data: PageData data: PageData
component: Component | null component: Component | null
} }
@ -19,7 +21,15 @@ export interface Router {
/** /**
* Navigate to a new URL. * Navigate to a new URL.
*/ */
go: (to?: string) => Promise<void> go: (
to: string,
options?: {
// @internal
initialLoad?: boolean
// Whether to smoothly scroll to the target position.
smoothScroll?: boolean
}
) => Promise<void>
/** /**
* Called before the route changes. Return `false` to cancel the navigation. * Called before the route changes. Return `false` to cancel the navigation.
*/ */
@ -37,10 +47,6 @@ export interface Router {
* Called after the route changes. * Called after the route changes.
*/ */
onAfterRouteChange?: (to: string) => Awaitable<void> onAfterRouteChange?: (to: string) => Awaitable<void>
/**
* @deprecated use `onAfterRouteChange` instead
*/
onAfterRouteChanged?: (to: string) => Awaitable<void>
} }
export const RouterSymbol: InjectionKey<Router> = Symbol() export const RouterSymbol: InjectionKey<Router> = Symbol()
@ -51,6 +57,8 @@ const fakeHost = 'http://a.com'
const getDefaultRoute = (): Route => ({ const getDefaultRoute = (): Route => ({
path: '/', path: '/',
hash: '',
query: '',
component: null, component: null,
data: notFoundPageData data: notFoundPageData
}) })
@ -68,39 +76,32 @@ export function createRouter(
const router: Router = { const router: Router = {
route, route,
go async go(href, options) {
} href = normalizeHref(href)
if ((await router.onBeforeRouteChange?.(href)) === false) return
async function go(href: string = inBrowser ? location.href : '/') { if (!inBrowser || (await changeRoute(href, options))) await loadPage(href)
href = normalizeHref(href) syncRouteQueryAndHash()
if ((await router.onBeforeRouteChange?.(href)) === false) return await router.onAfterRouteChange?.(href)
if (inBrowser && href !== normalizeHref(location.href)) {
// save scroll position before changing url
history.replaceState({ scrollPosition: window.scrollY }, '')
history.pushState({}, '', href)
} }
await loadPage(href)
await (router.onAfterRouteChange ?? router.onAfterRouteChanged)?.(href)
} }
let latestPendingPath: string | null = null let latestPendingPath: string | null = null
async function loadPage(href: string, scrollPosition = 0, isRetry = false) { async function loadPage(href: string, scrollPosition = 0, isRetry = false) {
if ((await router.onBeforePageLoad?.(href)) === false) return if ((await router.onBeforePageLoad?.(href)) === false) return
const targetLoc = new URL(href, fakeHost) const targetLoc = new URL(href, fakeHost)
const pendingPath = (latestPendingPath = targetLoc.pathname) const pendingPath = (latestPendingPath = targetLoc.pathname)
try { try {
let page = await loadPageModule(pendingPath) let page = await loadPageModule(pendingPath)
if (!page) { if (!page) throw new Error(`Page not found: ${pendingPath}`)
throw new Error(`Page not found: ${pendingPath}`)
}
if (latestPendingPath === pendingPath) { if (latestPendingPath === pendingPath) {
latestPendingPath = null latestPendingPath = null
const { default: comp, __pageData } = page const { default: comp, __pageData } = page
if (!comp) { if (!comp) throw new Error(`Invalid route component: ${comp}`)
throw new Error(`Invalid route component: ${comp}`)
}
await router.onAfterPageLoad?.(href) await router.onAfterPageLoad?.(href)
@ -109,36 +110,25 @@ export function createRouter(
route.data = import.meta.env.PROD route.data = import.meta.env.PROD
? markRaw(__pageData) ? markRaw(__pageData)
: (readonly(__pageData) as PageData) : (readonly(__pageData) as PageData)
syncRouteQueryAndHash(targetLoc)
if (inBrowser) { if (inBrowser) {
nextTick(() => { nextTick(() => {
let actualPathname = let actualPathname =
siteDataRef.value.base + siteDataRef.value.base +
__pageData.relativePath.replace(/(?:(^|\/)index)?\.md$/, '$1') __pageData.relativePath.replace(/(?:(^|\/)index)?\.md$/, '$1')
if (!siteDataRef.value.cleanUrls && !actualPathname.endsWith('/')) { if (!siteDataRef.value.cleanUrls && !actualPathname.endsWith('/')) {
actualPathname += '.html' actualPathname += '.html'
} }
if (actualPathname !== targetLoc.pathname) { if (actualPathname !== targetLoc.pathname) {
targetLoc.pathname = actualPathname targetLoc.pathname = actualPathname
href = actualPathname + targetLoc.search + targetLoc.hash href = actualPathname + targetLoc.search + targetLoc.hash
history.replaceState({}, '', href) history.replaceState({}, '', href)
} }
if (targetLoc.hash && !scrollPosition) { return scrollTo(targetLoc.hash, false, scrollPosition)
let target: HTMLElement | null = null
try {
target = document.getElementById(
decodeURIComponent(targetLoc.hash).slice(1)
)
} catch (e) {
console.warn(e)
}
if (target) {
scrollTo(target, targetLoc.hash)
return
}
}
window.scrollTo(0, scrollPosition)
}) })
} }
} }
@ -173,14 +163,22 @@ export function createRouter(
.replace(/^\//, '') .replace(/^\//, '')
: '404.md' : '404.md'
route.data = { ...notFoundPageData, relativePath } route.data = { ...notFoundPageData, relativePath }
syncRouteQueryAndHash(targetLoc)
} }
} }
} }
function syncRouteQueryAndHash(
loc: { search: string; hash: string } = inBrowser
? location
: { search: '', hash: '' }
) {
route.query = loc.search
route.hash = decodeURIComponent(loc.hash)
}
if (inBrowser) { if (inBrowser) {
if (history.state === null) { if (history.state === null) history.replaceState({}, '')
history.replaceState({}, '')
}
window.addEventListener( window.addEventListener(
'click', 'click',
(e) => { (e) => {
@ -193,8 +191,9 @@ export function createRouter(
e.shiftKey || e.shiftKey ||
e.altKey || e.altKey ||
e.metaKey e.metaKey
) ) {
return return
}
const link = e.target.closest<HTMLAnchorElement | SVGAElement>('a') const link = e.target.closest<HTMLAnchorElement | SVGAElement>('a')
if ( if (
@ -202,47 +201,24 @@ export function createRouter(
link.closest('.vp-raw') || link.closest('.vp-raw') ||
link.hasAttribute('download') || link.hasAttribute('download') ||
link.hasAttribute('target') link.hasAttribute('target')
) ) {
return return
}
const linkHref = const linkHref =
link.getAttribute('href') ?? link.getAttribute('href') ??
(link instanceof SVGAElement ? link.getAttribute('xlink:href') : null) (link instanceof SVGAElement ? link.getAttribute('xlink:href') : null)
if (linkHref == null) return if (linkHref == null) return
const { href, origin, pathname, hash, search } = new URL( const { href, origin, pathname } = new URL(linkHref, link.baseURI)
linkHref, const currentLoc = new URL(location.href) // copy to keep old data
link.baseURI
)
const currentUrl = new URL(location.href) // copy to keep old data
// only intercept inbound html links // only intercept inbound html links
if (origin === currentUrl.origin && treatAsHtml(pathname)) { if (origin === currentLoc.origin && treatAsHtml(pathname)) {
e.preventDefault() e.preventDefault()
if ( router.go(href, {
pathname === currentUrl.pathname && // use smooth scroll when clicking on header anchor links
search === currentUrl.search smoothScroll: link.classList.contains('header-anchor')
) { })
// 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)
}
} else {
go(href)
}
} }
}, },
{ capture: true } { capture: true }
@ -252,11 +228,13 @@ export function createRouter(
if (e.state === null) return if (e.state === null) return
const href = normalizeHref(location.href) const href = normalizeHref(location.href)
await loadPage(href, (e.state && e.state.scrollPosition) || 0) await loadPage(href, (e.state && e.state.scrollPosition) || 0)
await (router.onAfterRouteChange ?? router.onAfterRouteChanged)?.(href) syncRouteQueryAndHash()
await router.onAfterRouteChange?.(href)
}) })
window.addEventListener('hashchange', (e) => { window.addEventListener('hashchange', (e) => {
e.preventDefault() e.preventDefault()
syncRouteQueryAndHash()
}) })
} }
@ -267,9 +245,7 @@ export function createRouter(
export function useRouter(): Router { export function useRouter(): Router {
const router = inject(RouterSymbol) const router = inject(RouterSymbol)
if (!router) { if (!router) throw new Error('useRouter() is called without provider.')
throw new Error('useRouter() is called without provider.')
}
return router return router
} }
@ -277,13 +253,16 @@ export function useRoute(): Route {
return useRouter().route return useRouter().route
} }
export function scrollTo(el: Element, hash: string, smooth = false) { export function scrollTo(hash: string, smooth = false, scrollPosition = 0) {
if (!hash || scrollPosition) {
window.scrollTo(0, scrollPosition)
return
}
let target: Element | null = null let target: Element | null = null
try { try {
target = el.classList.contains('header-anchor') target = document.getElementById(decodeURIComponent(hash).slice(1))
? el
: document.getElementById(decodeURIComponent(hash).slice(1))
} catch (e) { } catch (e) {
console.warn(e) console.warn(e)
} }
@ -293,17 +272,20 @@ export function scrollTo(el: Element, hash: string, smooth = false) {
window.getComputedStyle(target).paddingTop, window.getComputedStyle(target).paddingTop,
10 10
) )
const targetTop = const targetTop =
window.scrollY + window.scrollY +
target.getBoundingClientRect().top - target.getBoundingClientRect().top -
getScrollOffset() + getScrollOffset() +
targetPadding targetPadding
function scrollToTarget() { function scrollToTarget() {
// only smooth scroll if distance is smaller than screen height. // only smooth scroll if distance is smaller than screen height.
if (!smooth || Math.abs(targetTop - window.scrollY) > window.innerHeight) if (!smooth || Math.abs(targetTop - window.scrollY) > window.innerHeight)
window.scrollTo(0, targetTop) window.scrollTo(0, targetTop)
else window.scrollTo({ left: 0, top: targetTop, behavior: 'smooth' }) else window.scrollTo({ left: 0, top: targetTop, behavior: 'smooth' })
} }
requestAnimationFrame(scrollToTarget) requestAnimationFrame(scrollToTarget)
} }
} }
@ -313,9 +295,7 @@ function handleHMR(route: Route): void {
if (import.meta.hot) { if (import.meta.hot) {
// hot reload pageData // hot reload pageData
import.meta.hot.on('vitepress:pageData', (payload: PageDataPayload) => { import.meta.hot.on('vitepress:pageData', (payload: PageDataPayload) => {
if (shouldHotReload(payload)) { if (shouldHotReload(payload)) route.data = payload.pageData
route.data = payload.pageData
}
}) })
} }
} }
@ -332,9 +312,47 @@ function normalizeHref(href: string): string {
const url = new URL(href, fakeHost) const url = new URL(href, fakeHost)
url.pathname = url.pathname.replace(/(^|\/)index(\.html)?$/, '$1') url.pathname = url.pathname.replace(/(^|\/)index(\.html)?$/, '$1')
// ensure correct deep link so page refresh lands on correct files. // ensure correct deep link so page refresh lands on correct files.
if (siteDataRef.value.cleanUrls) if (siteDataRef.value.cleanUrls) {
url.pathname = url.pathname.replace(/\.html$/, '') url.pathname = url.pathname.replace(/\.html$/, '')
else if (!url.pathname.endsWith('/') && !url.pathname.endsWith('.html')) } else if (!url.pathname.endsWith('/') && !url.pathname.endsWith('.html')) {
url.pathname += '.html' url.pathname += '.html'
}
return url.pathname + url.search + url.hash return url.pathname + url.search + url.hash
} }
async function changeRoute(
href: string,
{ smoothScroll = false, initialLoad = false } = {}
): Promise<boolean> {
const loc = normalizeHref(location.href)
const { pathname, hash } = new URL(href, fakeHost)
const currentLoc = new URL(loc, fakeHost)
if (href === loc) {
if (!initialLoad) {
scrollTo(hash, smoothScroll)
return false
}
} else {
// save scroll position before changing URL
history.replaceState({ scrollPosition: window.scrollY }, '')
history.pushState({}, '', href)
if (pathname === currentLoc.pathname) {
// scroll between hash anchors on the same page, avoid duplicate entries
if (hash !== currentLoc.hash) {
window.dispatchEvent(
new HashChangeEvent('hashchange', {
oldURL: currentLoc.href,
newURL: href
})
)
scrollTo(hash, smoothScroll)
}
return false
}
}
return true
}

Loading…
Cancel
Save