add console.log automaticaly to 1-lvl expressions

This commit is contained in:
2022-11-15 11:44:04 +01:00
parent 900db4fb3e
commit e53679ff26
5 changed files with 148 additions and 8 deletions

View File

@@ -3,6 +3,8 @@ import { stringify } from 'javascript-stringify';
import { MAX_DATA_SIZE } from './app.config';
import { getType } from '@gkucmierz/utils/src/get-type';
import { addDefaultLog } from './utils/utils';
const log = console.log;
console.log = (...a) => l(a);
console.error = a => e(a);
@@ -61,7 +63,7 @@ const e = err => {
addEventListener('message', ({ data }) => {
try {
const code = new Function(data);
const code = new Function(addDefaultLog(data));
code();
} catch (e) {
console.error(e);