You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vitepress/lib/app/composables/siteData.js

23 lines
402 B

import serialized from '@siteData'
import { hot } from '@hmr'
import { ref, readonly } from 'vue'
/**
* @param {string} data
*/
const parse = (data) => readonly(JSON.parse(data))
// site data
const siteDataRef = ref(parse(serialized))
5 years ago
export function useSiteData() {
return siteDataRef
5 years ago
}
// hmr
5 years ago
if (__DEV__) {
hot.accept('/@siteData', (m) => {
siteDataRef.value = parse(m.default)
})
}