perf: improve nodejs version support (#520)

This commit is contained in:
pengzhanbo 2025-03-12 23:39:13 +08:00 committed by GitHub
parent fb08a2dc10
commit 5a81b419c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 6 deletions

View File

@ -14,9 +14,13 @@ const vuepressVersion = __VUEPRESS_VERSION__
## 依赖环境
- [Node.js v20.6.0+](https://nodejs.org/)
- [Node.js](https://nodejs.org/) : **^18.19.0 || ^20.6.0 || >= 22.0.0** [+node-versions]
- [npm 8+](https://www.npmjs.com/) 或 [pnpm 8+](https://pnpm.io/zh/) 或 [Yarn 2+](https://yarnpkg.com/)
[+node-versions]: **^18.19.0** `18.19.0` 及以上但不高于 `19.0.0` 的版本
[+node-versions]: **^20.6.0** `20.6.0` 及以上但不高于 `21.0.0` 的版本
[+node-versions]: **>= 22.0.0** `22.0.0` 及以上的版本
:::: details 怎么安装依赖环境?
::: steps

View File

@ -18,11 +18,16 @@ export const EncryptSymbol: InjectionKey<Encrypt> = Symbol(
__VUEPRESS_DEV__ ? 'Encrypt' : '',
)
const storage = useSessionStorage('2a0a3d6afb2fdf1f', () => ({
s: [genSaltSync(10), genSaltSync(10)] as const,
g: '' as string,
p: {} as Record<string, string>,
}))
const storage = useSessionStorage('2a0a3d6afb2fdf1f', () => {
if (__VUEPRESS_SSR__) {
return { s: ['', ''] as const, g: '', p: {} as Record<string, string> }
}
return {
s: [genSaltSync(10), genSaltSync(10)] as const,
g: '' as string,
p: {} as Record<string, string>,
}
})
function mergeHash(hash: string) {
const [left, right] = storage.value.s