|
|
@ -26,16 +26,19 @@ export default function preprocess(opts) {
|
|
|
|
delete parent[prop]
|
|
|
|
delete parent[prop]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return //ignore childs of objects ie console.log
|
|
|
|
return //ignore childs of objects ie console.log
|
|
|
|
} else if (node.type === "Identifier") {
|
|
|
|
} else if (node.type === "Identifier" && !parent.type.startsWith("TS")) {
|
|
|
|
|
|
|
|
if (parent.type === "VariableDeclarator") {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
if (opts.values) {
|
|
|
|
if (opts.values) {
|
|
|
|
for (const i in opts.values) {
|
|
|
|
for (const i in opts.values) {
|
|
|
|
if (i === node.name) {
|
|
|
|
if (i === node.name) {
|
|
|
|
console.log(`Found comp-time var ${i} with value ${opts.values[i]}`)
|
|
|
|
console.log(`Found comp-time var ${i} with value ${opts.values[i]}`)
|
|
|
|
const res = eval(`(${opts.values[i]})`)
|
|
|
|
const res = eval(`(${opts.values[i]})`)
|
|
|
|
if (typeof res === "string") {
|
|
|
|
if (typeof res === "string") {
|
|
|
|
parent[prop] = [ parse(`('${res}')`).body[0].expression ]
|
|
|
|
parent[prop] = [ rollupThis.parse(`('${res}')`).body[0].expression ]
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
parent[prop] = [ parse(`(${res})`).body[0].expression ]
|
|
|
|
parent[prop] = [ rollupThis.parse(`(${res})`).body[0].expression ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|