Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.warnings.forEach(warning => {
console.warn(warning.message); // eslint-disable-line no-console
dispatch(
actions.correction.show(warning.message, {
line: warning.lineNumber,
column: warning.columnNumber,
path: warning.path,
source: warning.source,
severity: warning.severity || 'warning',
})
);
});
}
if (!initializedResizeListener) {
initializeResizeListener();
}
// Testing
const ttt = Date.now();
const testRunner = manager.testRunner;
try {
testRunner.initialize();
testRunner.findTests(modules);
await testRunner.runTests();
const aggregatedResults = testRunner.reportResults();
debug(`Test Evaluation time: ${Date.now() - ttt}ms`);
dispatch({
type: 'test-result',
result: Encode(aggregatedResults),
});
// End - Testing
} catch (error) {
dispatch({
type: 'test-result',
error: testRunner.reportError(error),
});
}
debug(`Total time: ${Date.now() - startTime}ms`);
dispatch({
type: 'success',
});
const main = absolute(foundMain);
managerModuleToTranspile = modules[main];
// TODO: make this a separate lifecycle
// await manager.preset.setup(manager);
dispatch({ type: 'status', status: 'transpiling' });
manager.setStage('transpilation');
await manager.verifyTreeTranspiled();
await manager.transpileModules(managerModuleToTranspile);
debug(`Transpilation time ${Date.now() - t}ms`);
dispatch({ type: 'status', status: 'evaluating' });
manager.setStage('evaluation');
if (!skipEval) {
resetScreen();
try {
// We set it as a time value for people that run two sandboxes on one computer
// they execute at the same time and we don't want them to conflict, so we check
// if the message was set a second ago
if (
firstLoad &&
localStorage.getItem('running') &&
Date.now() - +localStorage.getItem('running') > 8000
) {
localStorage.removeItem('running');
showRunOnClick();
export default function showError(ref: ErrorRecord) {
const errorToSend = buildDynamicError(ref);
if (errorToSend) {
dispatch(
actions.error.show(errorToSend.title, errorToSend.message, {
line: errorToSend.line,
column: errorToSend.column,
path: errorToSend.path,
payload: errorToSend.payload,
})
);
} else {
// Show based on error
actions.error.show(ref.error.name, ref.error.message, {
line: ref.error.lineNumber,
column: ref.error.columnNumber,
path: ref.error.fileName,
payload: {},
});
}
public dispatch(message: Object) {
dispatch(message);
}
function sseTerminalMessage(msg: string) {
dispatch({
type: 'terminal:message',
data: `> Sandbox Container: ${msg}\n\r`,
});
}
function sendUrlChange(url: string) {
dispatch({
type: 'urlchange',
url,
});
}
action: () => {
dispatch(
actions.source.modules.rename(
rawModule.module.path,
`${basename(rawModule.module.path)}.js`
)
);
},
},
function sendResize() {
const height = getDocumentHeight();
if (lastHeight !== height) {
if (document.body) {
dispatch({
type: 'resize',
height,
});
}
}
lastHeight = height;
}