2021-04-05 14:38:39 +08:00
|
|
|
const fs = require('fs-extra')
|
2020-11-12 13:30:04 +08:00
|
|
|
|
|
|
|
const demoLoader = require('../loaders/naive-ui-demo-loader')
|
|
|
|
const docLoader = require('../loaders/naive-ui-doc-loader')
|
|
|
|
|
2021-02-02 13:11:34 +08:00
|
|
|
module.exports = async function getTransformedVueSrc (path) {
|
2020-11-12 13:30:04 +08:00
|
|
|
if (path.endsWith('.demo.md')) {
|
|
|
|
const code = await fs.readFile(path, 'utf-8')
|
|
|
|
return demoLoader(code, path)
|
|
|
|
} else if (path.endsWith('.md')) {
|
|
|
|
const code = await fs.readFile(path, 'utf-8')
|
2021-04-05 14:38:39 +08:00
|
|
|
return docLoader(code, path)
|
2020-11-12 13:30:04 +08:00
|
|
|
}
|
|
|
|
}
|