mirror of https://github.com/vuejs/vitepress
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.
24 lines
540 B
24 lines
540 B
2 years ago
|
import fs from 'fs'
|
||
|
import path from 'path'
|
||
|
import { fileURLToPath } from 'url'
|
||
|
|
||
|
const dirname = path.dirname(fileURLToPath(import.meta.url))
|
||
|
|
||
2 years ago
|
type Data = Record<string, boolean>[]
|
||
|
export declare const data: Data
|
||
|
|
||
2 years ago
|
export default {
|
||
|
watch: ['./data/*'],
|
||
2 years ago
|
async load(): Promise<Data> {
|
||
2 years ago
|
const foo = fs.readFileSync(
|
||
|
path.resolve(dirname, './data/foo.json'),
|
||
|
'utf-8'
|
||
|
)
|
||
|
const bar = fs.readFileSync(
|
||
|
path.resolve(dirname, './data/bar.json'),
|
||
|
'utf-8'
|
||
|
)
|
||
|
return [JSON.parse(foo), JSON.parse(bar)]
|
||
|
}
|
||
|
}
|