You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/src/parse/acorn.ts

15 lines
420 B

import * as acorn from 'acorn';
import dynamicImport from 'acorn-dynamic-import';
const Parser = acorn.Parser.extend(dynamicImport);
export const parse = (source: string) => Parser.parse(source, {
sourceType: 'module',
ecmaVersion: 9,
preserveParens: true
});
export const parse_expression_at = (source: string, index: number) => Parser.parseExpressionAt(source, index, {
ecmaVersion: 9,
preserveParens: true
});