From 0fccb8cf9b66af88c0f756fb2b0dc3445a2f5a3b Mon Sep 17 00:00:00 2001 From: Ruthenic Date: Thu, 1 Sep 2022 18:22:39 -0400 Subject: [PATCH] allow utilization of custom parser functions --- src/main.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 6b2c2ee..0defbf3 100644 --- a/src/main.js +++ b/src/main.js @@ -11,12 +11,14 @@ export default function preprocess(opts) { const state = { failedIf: false } - const parse = this.parse + const parse = opts.parser ?? this.parse + const rollupThis = this const comments = [] const ast = recast.parse(code, { - parser: this + parser: { parse } }) + walk(ast, { //WALK CST FOR COMPTIME_VARS enter(node, parent, prop, index) { if (parent?.type === "MemberExpression" && parent?.property === node) {