1 | const {parse} = require('meriyah');
|
2 | const astMatcher = require('ast-matcher');
|
3 |
|
4 | function _parser(contents) {
|
5 | // Turn on range to get position info in scope analysis.
|
6 | return parse(contents, {
|
7 | module: true,
|
8 | next: true,
|
9 | ranges: true,
|
10 | webcompact: true,
|
11 | specDeviation: true
|
12 | });
|
13 | }
|
14 |
|
15 | module.exports = function() {
|
16 | if (!astMatcher.__amd_parser_set) {
|
17 | astMatcher.setParser(_parser);
|
18 | astMatcher.__amd_parser_set = true;
|
19 | }
|
20 | };
|
21 |
|