From 3614080f5e7c8e95d48945e5fcde6d751ede5888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 9 Jul 2024 20:11:47 +0100 Subject: [PATCH] fix: Upgrade deno_ast to 0.40.0 and deno_graph 0.80.0 (#607) --- Cargo.lock | 48 ++++++++++++++++++++++++------------------------ Cargo.toml | 5 +++-- src/interface.rs | 19 +++++-------------- src/ts_type.rs | 18 +++++------------- 4 files changed, 37 insertions(+), 53 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0a2ee2aa..e6d0066d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -502,9 +502,9 @@ dependencies = [ [[package]] name = "deno_ast" -version = "0.39.2" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "132aace7b62c317da51f84f1cfbbbfc56ce643110821937c04b36c916db64341" +checksum = "4d08372522975cce97fe0efbe42fea508c76eea4421619de6d63baae32792f7d" dependencies = [ "anyhow", "base64", @@ -594,9 +594,9 @@ dependencies = [ [[package]] name = "deno_graph" -version = "0.79.0" +version = "0.80.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caa95531b3eb65aced626d8dd8117b29b3e57763e0c1ace502101fb56b8a2c31" +checksum = "e1ec763fcd824d63cc056f153ba7fbf6254b515c347ec8b7d1a21515742547bb" dependencies = [ "anyhow", "async-trait", @@ -708,9 +708,9 @@ dependencies = [ [[package]] name = "dprint-swc-ext" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "019d17f2c2457c5a70a7cf4505b1a562ca8ab168c0ac0c005744efbd29fcb8fe" +checksum = "5a0d5b63e52434314e3d767c463b1f68c467c31e61d279bc019227016c44e535" dependencies = [ "num-bigint", "rustc-hash", @@ -1227,9 +1227,9 @@ checksum = "b52c1b33ff98142aecea13138bd399b68aa7ab5d9546c300988c345004001eea" [[package]] name = "new_debug_unreachable" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "num-bigint" @@ -1989,9 +1989,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.33.26" +version = "0.34.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2f9706038906e66f3919028f9f7a37f3ed552f1b85578e93f4468742e2da438" +checksum = "9087befec6b63911f9d2f239e4f91c9b21589c169b86ed2d616944d23cf4a243" dependencies = [ "ast_node", "better_scoped_tls", @@ -2015,9 +2015,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.113.7" +version = "0.115.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98a534a8360a076a030989f6d121ba6044345594bdf0457c4629f432742026b8" +checksum = "7be1306930c235435a892104c00c2b5e16231043c085d5a10bd3e7537b15659b" dependencies = [ "bitflags 2.5.0", "is-macro", @@ -2033,9 +2033,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.149.3" +version = "0.151.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb2bef3f4998865b2d466fb2ef9410a03449d255d199f3eb807fb19acc3862b" +checksum = "f5141a8cb4eb69e090e6aea5d49061b46919be5210f3d084f9d9ad63d30f5cff" dependencies = [ "memchr", "num-bigint", @@ -2064,9 +2064,9 @@ dependencies = [ [[package]] name = "swc_ecma_loader" -version = "0.45.28" +version = "0.46.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c68f934bd2c51f29c4ad0bcae09924e9dc30d7ce0680367d45b42d40338a67" +checksum = "5a9febebf047d1286e7b723fa2758f3229da2c103834f3eaee69833f46692612" dependencies = [ "anyhow", "pathdiff", @@ -2078,9 +2078,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.144.3" +version = "0.146.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0b4193b9c127db1990a5a08111aafe0122bc8b138646807c63f2a6521b7da4" +checksum = "0a4e0c2e85f12c63b85c805e923079b04d1fb3e25edd069d638eed5f2098de74" dependencies = [ "either", "new_debug_unreachable", @@ -2100,9 +2100,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.138.4" +version = "0.140.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b76d09313cdd8f99bc1519fb04f8a93427c7a6f4bfbc64b39fcc5a378ab1b7" +checksum = "d37dc505c92af56d0f77cf6f31a6ccd37ac40cad1e01ff77277e0b1c70e8f8ff" dependencies = [ "better_scoped_tls", "bitflags 2.5.0", @@ -2123,9 +2123,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.128.3" +version = "0.130.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02f470d8cc31adf6189b228636201ee3cdd268c0b5a2d0407f83093dfa96ff91" +checksum = "13e62b199454a576c5fdbd7e1bef8ab88a395427456d8a713d994b7d469833aa" dependencies = [ "indexmap 2.1.0", "num_cpus", @@ -2142,9 +2142,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.99.1" +version = "0.101.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a6ce28ad8e591f8d627f1f9cb26b25e5d83052a9bc1b674d95fc28040cfa98" +checksum = "ce0d997f0c9b4e181225f603d161f6757c2a97022258170982cfe005ec69ec92" dependencies = [ "num-bigint", "swc_atoms", diff --git a/Cargo.toml b/Cargo.toml index af01c722..5a86b961 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,8 @@ repository = "https://github.com/denoland/deno_doc" members = ["lib"] [workspace.dependencies] -deno_graph = { version = "0.79.0", default-features = false, features = ["symbols"] } +deno_graph = { version = "0.80.0", default-features = false, features = ["symbols"] } +deno_ast = { version = "0.40.0" } import_map = "0.20.0" serde = { version = "1.0.140", features = ["derive"] } @@ -26,7 +27,7 @@ required-features = ["html"] [dependencies] anyhow = "1.0.58" cfg-if = "1.0.0" -deno_ast = "0.39.0" +deno_ast.workspace = true deno_graph.workspace = true indexmap = "2.0.2" futures = "0.3.26" diff --git a/src/interface.rs b/src/interface.rs index 7d0e63bf..e8062050 100644 --- a/src/interface.rs +++ b/src/interface.rs @@ -145,7 +145,7 @@ pub fn get_doc_for_ts_interface_decl( js_doc: method_js_doc, location: get_location(parsed_source, ts_getter_sig.start()), computed: ts_getter_sig.computed, - optional: ts_getter_sig.optional, + optional: false, params: vec![], return_type: maybe_return_type, type_params: vec![], @@ -169,7 +169,7 @@ pub fn get_doc_for_ts_interface_decl( js_doc: method_js_doc, location: get_location(parsed_source, ts_setter_sig.start()), computed: ts_setter_sig.computed, - optional: ts_setter_sig.optional, + optional: false, params, return_type: None, type_params: vec![], @@ -183,28 +183,19 @@ pub fn get_doc_for_ts_interface_decl( { let name = expr_to_name(&ts_prop_sig.key); - let mut params = vec![]; - - for param in &ts_prop_sig.params { - let param_def = ts_fn_param_to_param_def(parsed_source, param); - params.push(param_def); - } - let ts_type = ts_prop_sig .type_ann .as_deref() .map(|type_ann| TsTypeDef::new(parsed_source, &type_ann.type_ann)); - let type_params = maybe_type_param_decl_to_type_param_defs( - parsed_source, - ts_prop_sig.type_params.as_deref(), - ); + let type_params = + maybe_type_param_decl_to_type_param_defs(parsed_source, None); let prop_def = PropertyDef { name, js_doc: prop_js_doc, location: get_location(parsed_source, ts_prop_sig.start()), - params, + params: vec![], ts_type, readonly: ts_prop_sig.readonly, computed: ts_prop_sig.computed, diff --git a/src/ts_type.rs b/src/ts_type.rs index 58029d3d..3cd3f21f 100644 --- a/src/ts_type.rs +++ b/src/ts_type.rs @@ -397,7 +397,7 @@ impl TsTypeDef { location: get_location(parsed_source, ts_getter_sig.start()), params: vec![], computed: ts_getter_sig.computed, - optional: ts_getter_sig.optional, + optional: false, return_type: maybe_return_type, type_params: vec![], }; @@ -422,7 +422,7 @@ impl TsTypeDef { location: get_location(parsed_source, ts_setter_sig.start()), params, computed: ts_setter_sig.computed, - optional: ts_setter_sig.optional, + optional: false, return_type: None, type_params: vec![], }; @@ -435,26 +435,18 @@ impl TsTypeDef { { let name = expr_to_name(&ts_prop_sig.key); - let params = ts_prop_sig - .params - .iter() - .map(|param| ts_fn_param_to_param_def(parsed_source, param)) - .collect(); - let ts_type = ts_prop_sig .type_ann .as_ref() .map(|rt| TsTypeDef::new(parsed_source, &rt.type_ann)); - let type_params = maybe_type_param_decl_to_type_param_defs( - parsed_source, - ts_prop_sig.type_params.as_deref(), - ); + let type_params = + maybe_type_param_decl_to_type_param_defs(parsed_source, None); let prop_def = PropertyDef { name, js_doc, location: get_location(parsed_source, ts_prop_sig.start()), - params, + params: vec![], ts_type, readonly: ts_prop_sig.readonly, computed: ts_prop_sig.computed,