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.
17 lines
428 B
17 lines
428 B
import fs from 'fs'
|
|
import { defineLoader } from 'vitepress'
|
|
|
|
type Data = Record<string, boolean>[]
|
|
export declare const data: Data
|
|
|
|
export default defineLoader({
|
|
watch: ['./data/*'],
|
|
async load(files: string[]): Promise<Data> {
|
|
const data: Data = []
|
|
for (const file of files.sort().filter((file) => file.endsWith('.json'))) {
|
|
data.push(JSON.parse(fs.readFileSync(file, 'utf-8')))
|
|
}
|
|
return data
|
|
}
|
|
})
|