allow utilization of custom parser functions

master
Drake 2 years ago
parent 8e422f40e6
commit 0fccb8cf9b

@ -11,12 +11,14 @@ export default function preprocess(opts) {
const state = { const state = {
failedIf: false failedIf: false
} }
const parse = this.parse const parse = opts.parser ?? this.parse
const rollupThis = this
const comments = [] const comments = []
const ast = recast.parse(code, { const ast = recast.parse(code, {
parser: this parser: { parse }
}) })
walk(ast, { //WALK CST FOR COMPTIME_VARS walk(ast, { //WALK CST FOR COMPTIME_VARS
enter(node, parent, prop, index) { enter(node, parent, prop, index) {
if (parent?.type === "MemberExpression" && parent?.property === node) { if (parent?.type === "MemberExpression" && parent?.property === node) {

Loading…
Cancel
Save