From ffd74cb1a1344e79fb1312349f6e7b4156950d71 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 26 Jul 2022 21:24:56 -0400 Subject: [PATCH] chore: update jsonc_parser to 0.20 (#15316) --- Cargo.lock | 8 ++++---- cli/Cargo.toml | 4 ++-- cli/args/config_file.rs | 35 ++++++++++++++++++----------------- cli/tools/vendor/mod.rs | 4 +++- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c3e84f40ba..d0e8aeecd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1371,9 +1371,9 @@ dependencies = [ [[package]] name = "dprint-plugin-json" -version = "0.15.3" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e5fe967adc699073aa92ce4c931de1932ee58f4b755c3b32fed15580636558" +checksum = "db127f7ccb9b497b5b32e5e8eca4b19a7f191e38a3505195f029d5fbb728e51a" dependencies = [ "anyhow", "dprint-core", @@ -2342,9 +2342,9 @@ dependencies = [ [[package]] name = "jsonc-parser" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34bbb0cd324c4ed32861be1d00c58635b94d03a2d2c70f6aec5f1a419c532783" +checksum = "ccff81ff106af12c93c06935c50ee0723325095e8cbb8c0b41ed276b9469c4cb" dependencies = [ "serde_json", ] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index f38a8e651d..254d165c32 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -63,7 +63,7 @@ clap_complete = "=3.1.2" clap_complete_fig = "=3.1.5" data-url = "=0.1.1" dissimilar = "=1.0.3" -dprint-plugin-json = "=0.15.3" +dprint-plugin-json = "=0.15.4" dprint-plugin-markdown = "=0.13.3" dprint-plugin-typescript = "=0.71.1" encoding_rs = "=0.8.31" @@ -73,7 +73,7 @@ fancy-regex = "=0.9.0" http = "=0.2.6" import_map = "=0.12.1" indexmap = "1.8.1" -jsonc-parser = { version = "=0.19.0", features = ["serde"] } +jsonc-parser = { version = "=0.20.0", features = ["serde"] } libc = "=0.2.126" log = { version = "=0.4.17", features = ["serde"] } mitata = '=0.0.7' diff --git a/cli/args/config_file.rs b/cli/args/config_file.rs index bead2a284e..1739309ffd 100644 --- a/cli/args/config_file.rs +++ b/cli/args/config_file.rs @@ -557,23 +557,24 @@ impl ConfigFile { text: &str, specifier: &ModuleSpecifier, ) -> Result { - let jsonc = match jsonc_parser::parse_to_serde_value(text) { - Ok(None) => json!({}), - Ok(Some(value)) if value.is_object() => value, - Ok(Some(_)) => { - return Err(anyhow!( - "config file JSON {:?} should be an object", - specifier, - )) - } - Err(e) => { - return Err(anyhow!( - "Unable to parse config file JSON {:?} because of {}", - specifier, - e.to_string() - )) - } - }; + let jsonc = + match jsonc_parser::parse_to_serde_value(text, &Default::default()) { + Ok(None) => json!({}), + Ok(Some(value)) if value.is_object() => value, + Ok(Some(_)) => { + return Err(anyhow!( + "config file JSON {:?} should be an object", + specifier, + )) + } + Err(e) => { + return Err(anyhow!( + "Unable to parse config file JSON {:?} because of {}", + specifier, + e.to_string() + )) + } + }; let json: ConfigFileJson = serde_json::from_value(jsonc)?; Ok(Self { diff --git a/cli/tools/vendor/mod.rs b/cli/tools/vendor/mod.rs index a7b26aa793..a81965a153 100644 --- a/cli/tools/vendor/mod.rs +++ b/cli/tools/vendor/mod.rs @@ -203,7 +203,9 @@ fn update_config_text( ) -> Option { use jsonc_parser::ast::ObjectProp; use jsonc_parser::ast::Value; - let ast = jsonc_parser::parse_to_ast(text, &Default::default()).ok()?; + let ast = + jsonc_parser::parse_to_ast(text, &Default::default(), &Default::default()) + .ok()?; let obj = match ast.value { Some(Value::Object(obj)) => obj, _ => return None, // shouldn't happen, so ignore