From 8f5141c1915d66d85e811ab3ac97f8631f87be05 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 30 Aug 2024 11:50:31 -0400 Subject: [PATCH] fix: deno_ast 0.42 (#659) --- Cargo.lock | 20 ++++++++++---------- Cargo.toml | 2 +- src/swc.rs | 28 ++++++++++++++-------------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6486ac26..9213f999 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -131,9 +131,9 @@ checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a" [[package]] name = "deno_ast" -version = "0.41.2" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a8207814a257d99164dbf780a73b9dee17af4db983f4b23ffbf20c7340d52f5" +checksum = "3b08d11d9e4086b00d3428650e31153cf5896586411763cb88a6423ce5b18791" dependencies = [ "deno_media_type", "deno_terminal", @@ -235,9 +235,9 @@ dependencies = [ [[package]] name = "dprint-swc-ext" -version = "0.18.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f385cdad3065151fae39262ad43003099234689856a0dc476e8804c5ba8f475b" +checksum = "0ba28c12892aadb751c2ba7001d8460faee4748a04b4edc51c7121cc67ee03db" dependencies = [ "allocator-api2", "bumpalo", @@ -770,9 +770,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.36.2" +version = "0.37.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1802b1642488aec58597dc55ea88992c165660d6e44e9838d4d93f7b78ab95f3" +checksum = "12d0a8eaaf1606c9207077d75828008cb2dfb51b095a766bd2b72ef893576e31" dependencies = [ "ast_node", "better_scoped_tls", @@ -796,9 +796,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.117.4" +version = "0.118.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5da2f0310e8cd84b8c803095e75b2cbca872c71fc7f7404d4c9c8117d894960" +checksum = "a6f866d12e4d519052b92a0a86d1ac7ff17570da1272ca0c89b3d6f802cd79df" dependencies = [ "bitflags", "is-macro", @@ -814,9 +814,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.148.1" +version = "0.149.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8204235f635274dba4adc30c47ac896fd126ddfc53b27210676722423cbb2e7" +checksum = "683dada14722714588b56481399c699378b35b2ba4deb5c4db2fb627a97fb54b" dependencies = [ "either", "new_debug_unreachable", diff --git a/Cargo.toml b/Cargo.toml index 98e70c0e..b3883894 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ harness = false [dependencies] anyhow = "1.0.64" -deno_ast = { version = "0.41.2", features = ["view"] } +deno_ast = { version = "0.42.0", features = ["view"] } dprint-core = { version = "0.66.2", features = ["formatting"] } dprint-core-macros = "0.1.0" percent-encoding = "2.3.1" diff --git a/src/swc.rs b/src/swc.rs index 75ef88d2..f7a4728d 100644 --- a/src/swc.rs +++ b/src/swc.rs @@ -244,6 +244,20 @@ mod tests { ); } + #[test] + fn it_should_error_when_var_stmts_sep_by_comma() { + run_fatal_diagnostic_test( + "./test.ts", + "let a = 0, let b = 1;", + concat!( + "Unexpected token `let`. Expected let is reserved in const, let, class declaration at file:///test.ts:1:12\n", + "\n", + " let a = 0, let b = 1;\n", + " ~~~" + ), + ); + } + fn run_fatal_diagnostic_test(file_path: &str, text: &str, expected: &str) { let file_path = PathBuf::from(file_path); assert_eq!(parse_swc_ast(&file_path, text.into()).err().unwrap().to_string(), expected); @@ -263,20 +277,6 @@ mod tests { ); } - #[test] - fn it_should_error_when_var_stmts_sep_by_comma() { - run_non_fatal_diagnostic_test( - "./test.ts", - "let a = 0, let b = 1;", - concat!( - "Expected a semicolon at file:///test.ts:1:16\n", - "\n", - " let a = 0, let b = 1;\n", - " ~" - ), - ); - } - #[test] fn it_should_error_for_exected_expr_issue_121() { run_non_fatal_diagnostic_test(