Skip to content

Commit

Permalink
🖥️: remove unnessecary decanonicalize of lively.transpiler
Browse files Browse the repository at this point in the history
  • Loading branch information
merryman authored and linusha committed Jul 23, 2024
1 parent 9741894 commit e26a66c
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions lively.vm/lib/esm-eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,28 @@ function getEs6Transpiler (System, options, env) {
}

if (System.transpiler === 'lively.transpiler') {
let Transpiler = System.get(System.decanonicalize('lively.transpiler')).default;
let Transpiler = System.get('lively.transpiler').default;
let transpiler = new Transpiler(System, options.targetModule, env);
return (source, options) => transpiler.transpileDoit(source, options);
}

throw new Error('Sorry, currently only babel is supported as es6 transpiler for runEval!');
}

function evalEnd (System, code, options, result) {
System.get('@lively-env').evaluationEnd(options.targetModule);
System.debug && console.log(`[lively.module] runEval in module ${options.targetModule} done`);

emit('lively.vm/doitresult', {
code: code,
result,
waitForPromise: options.waitForPromise,
targetModule: options.targetModule
}, Date.now(), System);

return result;
}

export function runEval (System, code, options) {
options = {
targetModule: null,
Expand Down Expand Up @@ -237,17 +251,3 @@ export function runEval (System, code, options) {
? evalEnd(System, originalSource, options, result)
: Promise.resolve(result).then(result => evalEnd(System, originalSource, options, result));
}

function evalEnd (System, code, options, result) {
System.get('@lively-env').evaluationEnd(options.targetModule);
System.debug && console.log(`[lively.module] runEval in module ${options.targetModule} done`);

emit('lively.vm/doitresult', {
code: code,
result,
waitForPromise: options.waitForPromise,
targetModule: options.targetModule
}, Date.now(), System);

return result;
}

0 comments on commit e26a66c

Please sign in to comment.