summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/Cargo.toml6
-rw-r--r--cli/tsc_config.rs31
2 files changed, 5 insertions, 32 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index 49369798e..a7ebe3199 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -44,15 +44,15 @@ base64 = "0.13.0"
byteorder = "1.4.2"
clap = "2.33.3"
dissimilar = "1.0.2"
-dprint-plugin-json = "0.9.0"
-dprint-plugin-markdown = "0.6.0"
+dprint-plugin-json = "0.10.1"
+dprint-plugin-markdown = "0.6.2"
dprint-plugin-typescript = "0.41.0"
encoding_rs = "0.8.28"
env_logger = "0.8.2"
filetime = "0.2.14"
http = "0.2.3"
indexmap = { version = "1.6.1", features = ["serde"] }
-jsonc-parser = "0.15.1"
+jsonc-parser = { version = "0.17.0", features = ["serde"] }
lazy_static = "1.4.0"
libc = "0.2.86"
log = { version = "0.4.14", features = ["serde"] }
diff --git a/cli/tsc_config.rs b/cli/tsc_config.rs
index b89b3bf61..9211f92a5 100644
--- a/cli/tsc_config.rs
+++ b/cli/tsc_config.rs
@@ -8,13 +8,11 @@ use deno_core::serde::Serializer;
use deno_core::serde_json;
use deno_core::serde_json::json;
use deno_core::serde_json::Value;
-use jsonc_parser::JsonValue;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::fmt;
use std::path::Path;
use std::path::PathBuf;
-use std::str::FromStr;
/// The transpile options that are significant out of a user provided tsconfig
/// file, that we want to deserialize out of the final config for a transpile.
@@ -148,31 +146,6 @@ pub fn json_merge(a: &mut Value, b: &Value) {
}
}
-/// Convert a jsonc libraries `JsonValue` to a serde `Value`.
-fn jsonc_to_serde(j: JsonValue) -> Value {
- match j {
- JsonValue::Array(arr) => {
- let vec = arr.into_iter().map(jsonc_to_serde).collect();
- Value::Array(vec)
- }
- JsonValue::Boolean(bool) => Value::Bool(bool),
- JsonValue::Null => Value::Null,
- JsonValue::Number(num) => {
- let number =
- serde_json::Number::from_str(&num).expect("could not parse number");
- Value::Number(number)
- }
- JsonValue::Object(obj) => {
- let mut map = serde_json::map::Map::new();
- for (key, json_value) in obj.into_iter() {
- map.insert(key, jsonc_to_serde(json_value));
- }
- Value::Object(map)
- }
- JsonValue::String(str) => Value::String(str),
- }
-}
-
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct TsConfigJson {
@@ -220,8 +193,8 @@ pub fn parse_config(
path: &Path,
) -> Result<(Value, Option<IgnoredCompilerOptions>), AnyError> {
assert!(!config_text.is_empty());
- let jsonc = jsonc_parser::parse_to_value(config_text)?.unwrap();
- let config: TsConfigJson = serde_json::from_value(jsonc_to_serde(jsonc))?;
+ let jsonc = jsonc_parser::parse_to_serde_value(config_text)?.unwrap();
+ let config: TsConfigJson = serde_json::from_value(jsonc)?;
if let Some(compiler_options) = config.compiler_options {
parse_compiler_options(&compiler_options, Some(path.to_owned()), false)