mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-30 12:52:43 +08:00
17 lines
553 B
JavaScript
17 lines
553 B
JavaScript
const fs = require('fs-extra')
|
|
|
|
const demoLoader = require('../loaders/naive-ui-demo-loader')
|
|
const docLoader = require('../loaders/naive-ui-doc-loader')
|
|
|
|
module.exports = async function getTransformedVueSrc(path) {
|
|
if (path.endsWith('.demo.md') || path.endsWith('.demo.vue')) {
|
|
const code = await fs.readFile(path, 'utf-8')
|
|
const type = path.endsWith('.vue') ? 'vue' : 'md'
|
|
return demoLoader(code, path, type)
|
|
}
|
|
else if (path.endsWith('.md')) {
|
|
const code = await fs.readFile(path, 'utf-8')
|
|
return docLoader(code, path)
|
|
}
|
|
}
|