mirror of
https://github.com/denoland/deno.git
synced 2024-12-13 02:52:54 -05:00
chore: update jsonc_parser to 0.20 (#15316)
This commit is contained in:
parent
7733597166
commit
a6c2387d8e
4 changed files with 27 additions and 24 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -1371,9 +1371,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dprint-plugin-json"
|
name = "dprint-plugin-json"
|
||||||
version = "0.15.3"
|
version = "0.15.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f1e5fe967adc699073aa92ce4c931de1932ee58f4b755c3b32fed15580636558"
|
checksum = "db127f7ccb9b497b5b32e5e8eca4b19a7f191e38a3505195f029d5fbb728e51a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"dprint-core",
|
"dprint-core",
|
||||||
|
@ -2342,9 +2342,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jsonc-parser"
|
name = "jsonc-parser"
|
||||||
version = "0.19.0"
|
version = "0.20.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "34bbb0cd324c4ed32861be1d00c58635b94d03a2d2c70f6aec5f1a419c532783"
|
checksum = "ccff81ff106af12c93c06935c50ee0723325095e8cbb8c0b41ed276b9469c4cb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
|
|
@ -63,7 +63,7 @@ clap_complete = "=3.1.2"
|
||||||
clap_complete_fig = "=3.1.5"
|
clap_complete_fig = "=3.1.5"
|
||||||
data-url = "=0.1.1"
|
data-url = "=0.1.1"
|
||||||
dissimilar = "=1.0.3"
|
dissimilar = "=1.0.3"
|
||||||
dprint-plugin-json = "=0.15.3"
|
dprint-plugin-json = "=0.15.4"
|
||||||
dprint-plugin-markdown = "=0.13.3"
|
dprint-plugin-markdown = "=0.13.3"
|
||||||
dprint-plugin-typescript = "=0.71.1"
|
dprint-plugin-typescript = "=0.71.1"
|
||||||
encoding_rs = "=0.8.31"
|
encoding_rs = "=0.8.31"
|
||||||
|
@ -73,7 +73,7 @@ fancy-regex = "=0.9.0"
|
||||||
http = "=0.2.6"
|
http = "=0.2.6"
|
||||||
import_map = "=0.12.1"
|
import_map = "=0.12.1"
|
||||||
indexmap = "1.8.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"
|
libc = "=0.2.126"
|
||||||
log = { version = "=0.4.17", features = ["serde"] }
|
log = { version = "=0.4.17", features = ["serde"] }
|
||||||
mitata = '=0.0.7'
|
mitata = '=0.0.7'
|
||||||
|
|
|
@ -557,23 +557,24 @@ impl ConfigFile {
|
||||||
text: &str,
|
text: &str,
|
||||||
specifier: &ModuleSpecifier,
|
specifier: &ModuleSpecifier,
|
||||||
) -> Result<Self, AnyError> {
|
) -> Result<Self, AnyError> {
|
||||||
let jsonc = match jsonc_parser::parse_to_serde_value(text) {
|
let jsonc =
|
||||||
Ok(None) => json!({}),
|
match jsonc_parser::parse_to_serde_value(text, &Default::default()) {
|
||||||
Ok(Some(value)) if value.is_object() => value,
|
Ok(None) => json!({}),
|
||||||
Ok(Some(_)) => {
|
Ok(Some(value)) if value.is_object() => value,
|
||||||
return Err(anyhow!(
|
Ok(Some(_)) => {
|
||||||
"config file JSON {:?} should be an object",
|
return Err(anyhow!(
|
||||||
specifier,
|
"config file JSON {:?} should be an object",
|
||||||
))
|
specifier,
|
||||||
}
|
))
|
||||||
Err(e) => {
|
}
|
||||||
return Err(anyhow!(
|
Err(e) => {
|
||||||
"Unable to parse config file JSON {:?} because of {}",
|
return Err(anyhow!(
|
||||||
specifier,
|
"Unable to parse config file JSON {:?} because of {}",
|
||||||
e.to_string()
|
specifier,
|
||||||
))
|
e.to_string()
|
||||||
}
|
))
|
||||||
};
|
}
|
||||||
|
};
|
||||||
let json: ConfigFileJson = serde_json::from_value(jsonc)?;
|
let json: ConfigFileJson = serde_json::from_value(jsonc)?;
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
|
|
4
cli/tools/vendor/mod.rs
vendored
4
cli/tools/vendor/mod.rs
vendored
|
@ -203,7 +203,9 @@ fn update_config_text(
|
||||||
) -> Option<String> {
|
) -> Option<String> {
|
||||||
use jsonc_parser::ast::ObjectProp;
|
use jsonc_parser::ast::ObjectProp;
|
||||||
use jsonc_parser::ast::Value;
|
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 {
|
let obj = match ast.value {
|
||||||
Some(Value::Object(obj)) => obj,
|
Some(Value::Object(obj)) => obj,
|
||||||
_ => return None, // shouldn't happen, so ignore
|
_ => return None, // shouldn't happen, so ignore
|
||||||
|
|
Loading…
Reference in a new issue