1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | 'use strict';
|
10 |
|
11 | const flowParser = require('flow-parser');
|
12 |
|
13 | const defaultOptions = {
|
14 | enums: true,
|
15 | esproposal_class_instance_fields: true,
|
16 | esproposal_class_static_fields: true,
|
17 | esproposal_decorators: true,
|
18 | esproposal_export_star_as: true,
|
19 | esproposal_optional_chaining: true,
|
20 | esproposal_nullish_coalescing: true,
|
21 | tokens: true,
|
22 | types: true,
|
23 | };
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | module.exports = function(options=defaultOptions) {
|
29 | return {
|
30 | parse(code) {
|
31 | return flowParser.parse(code, options);
|
32 | },
|
33 | };
|
34 | };
|