From ca5953539f138b57c3c9b0547caaacf0257ad0a6 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 21 Oct 2024 12:29:39 -0400 Subject: [PATCH] fix: update jsonc-parser to 0.26 (#128) --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/deno_json/mod.rs | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a6728b..fb6a78c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -253,9 +253,9 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jsonc-parser" -version = "0.23.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7725c320caac8c21d8228c1d055af27a995d371f78cc763073d3e068323641b5" +checksum = "0600d6a0361200299ef0c64cc5f1b910705cb397dd44250ad924f396a78725bf" dependencies = [ "serde_json", ] diff --git a/Cargo.toml b/Cargo.toml index 2b9c5e1..946b123 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ workspace = ["deno_json", "deno_semver", "package_json"] [dependencies] anyhow = "1.0.57" indexmap = { version = "2", features = ["serde"] } -jsonc-parser = { version = "0.23.0", features = ["serde"], optional = true } +jsonc-parser = { version = "0.26.0", features = ["serde"], optional = true } log = "0.4.20" glob = { version = "0.3.1", optional = true } ignore = { version = "0.4", optional = true } diff --git a/src/deno_json/mod.rs b/src/deno_json/mod.rs index 82faba3..8ac2d5f 100644 --- a/src/deno_json/mod.rs +++ b/src/deno_json/mod.rs @@ -10,6 +10,7 @@ use import_map::ImportMapWithDiagnostics; use indexmap::IndexMap; use jsonc_parser::common::Ranged; use jsonc_parser::CollectOptions; +use jsonc_parser::CommentCollectionStrategy; use jsonc_parser::ParseResult; use serde::de; use serde::de::Unexpected; @@ -837,7 +838,11 @@ impl ConfigFile { let jsonc = match jsonc_parser::parse_to_ast( text, &CollectOptions { - comments: need_comments_tokens, + comments: if need_comments_tokens { + CommentCollectionStrategy::Separate + } else { + CommentCollectionStrategy::Off + }, tokens: need_comments_tokens, }, &Default::default(),