diff --git a/bindings/binding_typescript_wasm/Cargo.toml b/bindings/binding_typescript_wasm/Cargo.toml index 5c409250b71..b0294c16491 100644 --- a/bindings/binding_typescript_wasm/Cargo.toml +++ b/bindings/binding_typescript_wasm/Cargo.toml @@ -24,8 +24,11 @@ serde = { version = "1", features = ["derive"] } serde-wasm-bindgen = "0.4.5" serde_json = "1.0.120" swc_core = { version = "0.96.1", features = [ - "ecma_ast_serde", + "common", + "common_sourcemap", + "ecma_ast", "ecma_codegen", + "ecma_parser", "ecma_transforms", "ecma_transforms_typescript", "ecma_visit", diff --git a/bindings/binding_typescript_wasm/src/lib.rs b/bindings/binding_typescript_wasm/src/lib.rs index 33cebd37c75..304987a3015 100644 --- a/bindings/binding_typescript_wasm/src/lib.rs +++ b/bindings/binding_typescript_wasm/src/lib.rs @@ -1,7 +1,6 @@ use anyhow::{Context, Error}; use serde::{Deserialize, Serialize}; use swc_core::{ - base::{config::ErrorFormat, HandlerOpts}, common::{ comments::SingleThreadedComments, errors::ColorConfig, source_map::SourceMapGenConfig, sync::Lrc, FileName, Mark, SourceMap, GLOBALS, @@ -21,7 +20,7 @@ use swc_core::{ visit::VisitMutWith, }, }; -use swc_error_reporters::handler::try_with_handler; +use swc_error_reporters::handler::{try_with_handler, HandlerOpts}; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::{ future_to_promise, @@ -79,7 +78,7 @@ pub fn transform_sync(input: JsString, options: JsValue) -> Result Result { ) } -pub fn convert_err( - err: Error, - error_format: Option, -) -> wasm_bindgen::prelude::JsValue { - error_format - .unwrap_or(ErrorFormat::Normal) - .format(&err) - .into() +pub fn convert_err(err: Error) -> wasm_bindgen::prelude::JsValue { + format!("{:?}", err).into() } struct TsSourceMapGenConfig;