@servable/tools
Version:
Servable tools is a utility that builds a protocol's manifest and documents it.
23 lines (19 loc) • 471 B
JavaScript
import commentsParser from 'parse-comments'
import importFileAsText from "../../lib/importFileAsText.js"
import extractAst from './extractAst.js'
export default async ({ file }) => {
try {
const { path } = file
const text = await importFileAsText(path)
const ast = commentsParser.parse(text)
const astAdapted = extractAst({ ast })
return {
...file,
ast,
astAdapted
}
} catch (e) {
console.error(e)
}
return file
}