How to use babylon.parseExpression:
16 17 18 19 20 21 22 23 24 25
if (t.isIdentifier(nodePath.node.id)) { const replaceCode = state.replacers[`${kind} ${nodePath.node.id.name} =`] if (replaceCode) { const newAst = parseExpression(replaceCode) nodePath.get('init').replaceWith(newAst) } } },
How to use babylon.parse:
451 452 453 454 455 456 457 458 459 460
return map; } }; File.prototype.parse = function parse(code) { var parseCode = _babylon.parse; var parserOpts = this.opts.parserOpts; if (parserOpts) { parserOpts = (0, _assign2.default)({}, this.parserOpts, parserOpts);