1
0
Fork 0
mirror of synced 2024-10-02 18:16:29 +13:00

Simplify and remove magic strings

This commit is contained in:
Adria Navarro 2024-01-31 17:05:20 +01:00
parent 805b24975b
commit 507aa8af93
2 changed files with 2 additions and 4 deletions

View file

@ -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)`,
{}
)

View file

@ -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