diff --git a/src/cmd/source_file.rs b/src/cmd/source_file.rs index 68c3578..0642900 100644 --- a/src/cmd/source_file.rs +++ b/src/cmd/source_file.rs @@ -1,13 +1,11 @@ -use std::sync::Arc; - use crate::{ error::{CommandError, to_shell_err}, - globals::{get_pwd, get_vfs, print_to_console, set_pwd}, + globals::{get_pwd, print_to_console, set_pwd}, }; use nu_engine::{CallExt, get_eval_block_with_early_return}; use nu_parser::parse; use nu_protocol::{ - Category, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, + Category, PipelineData, ShellError, Signature, SyntaxShape, Type, engine::{Command, EngineState, Stack, StateWorkingSet}, }; @@ -77,7 +75,6 @@ pub fn eval( let start_offset = working_set.next_span_start(); let _ = working_set.add_file(filename.into(), contents.as_bytes()); - // we dont need the block here just the delta let block = parse(&mut working_set, Some(filename), contents.as_bytes(), false); if let Some(err) = working_set.parse_errors.into_iter().next() { diff --git a/www/src/worker.ts b/www/src/worker.ts index f8750c4..3540354 100644 --- a/www/src/worker.ts +++ b/www/src/worker.ts @@ -11,13 +11,7 @@ import init, { // Initialize WASM await init(); -try { - await init_engine(); -} catch (error) { - console.error(error); -} -// Setup Callbacks to proxy messages back to Main Thread register_console_callback((msg: string, isCmd: boolean) => { self.postMessage({ type: "console", payload: { msg, isCmd } }); }); @@ -26,7 +20,12 @@ register_task_count_callback((count: number) => { self.postMessage({ type: "task_count", payload: count }); }); -// Handle messages from Main Thread +try { + await init_engine(); +} catch (error) { + console.error(error); +} + self.onmessage = async (e) => { const { id, type, payload } = e.data; @@ -51,7 +50,7 @@ self.onmessage = async (e) => { result = get_pwd_string(); break; default: - throw new Error(`Unknown message type: ${type}`); + throw new Error(`unknown message type: ${type}`); } self.postMessage({ id, type: `${type}_result`, payload: result }); } catch (err) {