9 lines
201 B
JavaScript
9 lines
201 B
JavaScript
export default async function(code) {
|
|
const {parse} = await import('acorn');
|
|
const ast = parse(code, {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
});
|
|
return ast.body[0].expression;
|
|
}
|