Simplify and remove magic strings
This commit is contained in:
parent
805b24975b
commit
507aa8af93
|
@ -107,10 +107,8 @@ export function init() {
|
|||
}
|
||||
}
|
||||
|
||||
// We need to warp up the actual run in a `cb` function to be able to extract its value from isolated-vm
|
||||
js = js.replace(/run\(\);$/, "cb(run());")
|
||||
const script = jsIsolate.compileModuleSync(
|
||||
`import helpers from "compiled_module";${js}`,
|
||||
`import helpers from "compiled_module";const result=${js};cb(result)`,
|
||||
{}
|
||||
)
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ module.exports.processJS = (handlebars, context) => {
|
|||
try {
|
||||
// Wrap JS in a function and immediately invoke it.
|
||||
// This is required to allow the final `return` statement to be valid.
|
||||
const js = `function run(){${atob(handlebars)}};run();`
|
||||
const js = `(function(){${atob(handlebars)}})();`
|
||||
|
||||
// Our $ context function gets a value from context.
|
||||
// We clone the context to avoid mutation in the binding affecting real
|
||||
|
|
Loading…
Reference in New Issue