diff --git a/Cargo.toml b/Cargo.toml index ea172cf5..3262b6e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,13 +26,13 @@ log = ["dep:log"] [dependencies] log = { version = "0.4", optional = true } unicode-id = { version = "0.3", features = ["no_std"] } -serde = { version = "1.0", features = ["derive"], optional = true } +serde = { version = "1", features = ["derive"], optional = true } [dev-dependencies] env_logger = "0.11" criterion = "0.5" pretty_assertions = "1" -swc_core = { version = "0.93.0", features = [ +swc_core = { version = "0.100", features = [ "ecma_ast", "ecma_visit", "ecma_parser", diff --git a/tests/mdx_expression_text.rs b/tests/mdx_expression_text.rs index 2590c2d8..8ecfba7d 100644 --- a/tests/mdx_expression_text.rs +++ b/tests/mdx_expression_text.rs @@ -67,7 +67,7 @@ fn mdx_expression_text_gnostic_core() -> Result<(), message::Message> { .err() .unwrap() .to_string(), - "1:4: Could not parse expression with swc: Unexpected eof (mdx:swc)", + "1:9: Could not parse expression with swc: Unexpected eof (mdx:swc)", "should crash on an incorrect line comment (1)" ); @@ -76,7 +76,7 @@ fn mdx_expression_text_gnostic_core() -> Result<(), message::Message> { .err() .unwrap() .to_string(), - "1:4: Could not parse expression with swc: Unexpected eof (mdx:swc)", + "1:13: Could not parse expression with swc: Unexpected eof (mdx:swc)", "should crash on an incorrect line comment (2)" ); diff --git a/tests/test_utils/swc.rs b/tests/test_utils/swc.rs index fb4b71e8..5a930466 100644 --- a/tests/test_utils/swc.rs +++ b/tests/test_utils/swc.rs @@ -7,12 +7,12 @@ use markdown::{MdxExpressionKind, MdxSignal}; use std::rc::Rc; use swc_core::common::{ comments::{Comment, SingleThreadedComments, SingleThreadedCommentsMap}, - source_map::Pos, + source_map::SmallPos, BytePos, FileName, SourceFile, Span, Spanned, }; use swc_core::ecma::ast::{EsVersion, Expr, Module, PropOrSpread}; use swc_core::ecma::parser::{ - error::Error as SwcError, parse_file_as_expr, parse_file_as_module, EsConfig, Syntax, + error::Error as SwcError, parse_file_as_expr, parse_file_as_module, EsSyntax, Syntax, }; use swc_core::ecma::visit::VisitMutWith; @@ -268,16 +268,16 @@ fn create_config(source: String) -> (SourceFile, Syntax, EsVersion) { ( // File. SourceFile::new( - FileName::Anon, + FileName::Anon.into(), false, - FileName::Anon, + FileName::Anon.into(), source, BytePos::from_usize(1), ), // Syntax. - Syntax::Es(EsConfig { + Syntax::Es(EsSyntax { jsx: true, - ..EsConfig::default() + ..EsSyntax::default() }), // Version. // To do: update once in a while (last checked: 2024-04-18). diff --git a/tests/test_utils/swc_utils.rs b/tests/test_utils/swc_utils.rs index 326550b1..b161f6c7 100644 --- a/tests/test_utils/swc_utils.rs +++ b/tests/test_utils/swc_utils.rs @@ -1,7 +1,7 @@ //! Lots of helpers for dealing with SWC, particularly from unist, and for //! building its ES AST. -use swc_core::common::{BytePos, Span, SyntaxContext, DUMMY_SP}; +use swc_core::common::{BytePos, Span, DUMMY_SP}; use swc_core::ecma::visit::{noop_visit_mut_type, VisitMut}; /// Visitor to fix SWC byte positions by removing a prefix. @@ -33,6 +33,5 @@ pub fn create_span(lo: u32, hi: u32) -> Span { Span { lo: BytePos(lo), hi: BytePos(hi), - ctxt: SyntaxContext::default(), } }