@advjs/parser
Version:
A parser for advjs.
35 lines (32 loc) • 863 B
JavaScript
import { read } from 'to-vfile';
import { matter } from 'vfile-matter';
import { r as resolveConfig } from './shared/parser.DrhHNYiA.mjs';
export { c as convertMdToAdv, a as parseAst, p as parseChild } from './shared/parser.DrhHNYiA.mjs';
import 'rehype-stringify';
import 'remark-frontmatter';
import 'remark-gfm';
import 'remark-parse';
import 'remark-rehype';
import 'unified';
import 'js-yaml';
async function load(filepath) {
const data = await parse(filepath);
const entries = /* @__PURE__ */ new Set([
filepath
]);
data.entries = Array.from(entries);
return data;
}
async function parse(filepath) {
const file = await read(filepath);
matter(file, { strip: true });
const config = resolveConfig(file.data);
return {
file,
raw: String(file),
filepath,
config,
frontmatter: file.data
};
}
export { load, parse };