mirror of https://github.com/sveltejs/svelte
preserve js comments where possible (#4293)
parent
9269212844
commit
f12340acf0
@ -1,14 +1,13 @@
|
|||||||
import * as acorn from 'acorn';
|
import { Node } from 'acorn';
|
||||||
|
import * as code_red from 'code-red';
|
||||||
|
|
||||||
const Parser = acorn.Parser;
|
export const parse = (source: string): Node => code_red.parse(source, {
|
||||||
|
|
||||||
export const parse = (source: string) => Parser.parse(source, {
|
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
ecmaVersion: 11,
|
ecmaVersion: 11,
|
||||||
locations: true
|
locations: true
|
||||||
});
|
});
|
||||||
|
|
||||||
export const parse_expression_at = (source: string, index: number) => Parser.parseExpressionAt(source, index, {
|
export const parse_expression_at = (source: string, index: number): Node => code_red.parseExpressionAt(source, index, {
|
||||||
ecmaVersion: 11,
|
ecmaVersion: 11,
|
||||||
locations: true
|
locations: true
|
||||||
});
|
});
|
Loading…
Reference in new issue