1 | "use strict"
|
2 | exports.__esModule = true
|
3 |
|
4 | const moduleRequire = require('./module-require').default
|
5 |
|
6 | exports.default = function parse(content, context) {
|
7 |
|
8 | if (context == null) throw new Error("need context to parse properly")
|
9 |
|
10 | let parserOptions = context.parserOptions
|
11 | , parserPath = context.parserPath
|
12 |
|
13 | if (!parserPath) throw new Error("parserPath is required!")
|
14 |
|
15 |
|
16 | parserOptions = Object.assign({}, parserOptions)
|
17 | parserOptions.ecmaFeatures = Object.assign({}, parserOptions.ecmaFeatures)
|
18 |
|
19 |
|
20 | parserOptions.attachComment = true
|
21 |
|
22 |
|
23 | const parser = moduleRequire(parserPath)
|
24 |
|
25 | return parser.parse(content, parserOptions)
|
26 | }
|