Skip to content

Commit

Permalink
build: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeStanger committed Jun 16, 2024
1 parent 6b42e9b commit a3c05b4
Show file tree
Hide file tree
Showing 9 changed files with 398 additions and 234 deletions.
571 changes: 364 additions & 207 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/outputs/yaml/complex_keys.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
with_underscore: 0
with-dash: 1
"with_\U0001F33D": 2
with_🌽: 2
'!"£$%^&*()_': 3
j12345: 4
foo:
Expand Down
13 changes: 7 additions & 6 deletions corn-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ keywords = ["configuration", "language", "pest", "peg", "cli"]

[dependencies]
libcorn = { version = "0.9.2", path = "../libcorn" }
clap = { version = "4.0.15", features = ["derive"] }
colored = "2.0.0"
clap = { version = "4.5.7", features = ["derive"] }
colored = "2.1.0"
serde = { version = "1.0.133", features = ["derive"] }
serde_json = "1.0.75"
serde_yaml = "0.9.11"
toml = "0.7.4"
pest = "2.3.0"
serde_json = "1.0.117"
serde_yaml = "0.9.34"
# use this specific version as newer versions cause error on `None` and `()` types
toml_edit = { version = "=0.19.14", features = ["serde"] }
pest = "2.7.10"
2 changes: 1 addition & 1 deletion corn-cli/src/bin/corn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn serialize(config: &Value, output_type: OutputType) -> Result<String, Error> {
match output_type {
OutputType::Json => serde_json::to_string_pretty(&config).map_err(Error::from),
OutputType::Yaml => serde_yaml::to_string(&config).map_err(Error::from),
OutputType::Toml => toml::to_string_pretty(&config).map_err(Error::from),
OutputType::Toml => toml_edit::ser::to_string_pretty(&config).map_err(Error::from),
}
}

Expand Down
4 changes: 2 additions & 2 deletions corn-cli/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ impl From<serde_yaml::Error> for Error {
}
}

impl From<toml::ser::Error> for Error {
fn from(err: toml::ser::Error) -> Self {
impl From<toml_edit::ser::Error> for Error {
fn from(err: toml_edit::ser::Error) -> Self {
Self::Serializing(err.to_string())
}
}
Expand Down
29 changes: 15 additions & 14 deletions libcorn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,30 @@ name = "corn"
crate-type = ["cdylib", "rlib"]

[dependencies]
pest = "2.6.0"
pest_derive = "2.6.0"
pest = "2.7.10"
pest_derive = "2.7.10"
cfg-if = "1.0.0"
serde = { version = "1.0.133", features = ["derive"] }
indexmap = { version = "2.0.0", features = ["serde"] }
thiserror = "1.0.40"
wasm-bindgen = { version = "0.2.83", optional = true }
serde-wasm-bindgen = { version = "0.5.0", optional = true }
serde = { version = "1.0.203", features = ["derive"] }
indexmap = { version = "2.2.6", features = ["serde"] }
thiserror = "1.0.61"
wasm-bindgen = { version = "0.2.92", optional = true }
serde-wasm-bindgen = { version = "0.6.5", optional = true }
console_error_panic_hook = { version = "0.1.7", optional = true }
wee_alloc = { version = "0.4.5", optional = true }
mlua = { version = "0.8.9", features = ["vendored", "module", "macros", "serialize"], optional = true }
mlua = { version = "0.9.8", features = ["vendored", "module", "macros", "serialize"], optional = true }

# bench
criterion = { version = "0.5.1", features = ["html_reports"], optional = true }

[dev-dependencies]
paste = "1.0.6"
wasm-bindgen-test = { version = "0.3.29" }
paste = "1.0.15"
wasm-bindgen-test = { version = "0.3.42" }
# required for testing
serde_json = "1.0.75"
serde_yaml = "0.9.11"
serde_bytes = "0.11.9"
toml = "0.7.4"
serde_json = "1.0.117"
serde_yaml = "0.9.34"
serde_bytes = "0.11.14"
# use this specific version as newer versions cause error on `None` and `()` types
toml_edit = { version = "=0.19.14", features = ["serde"] }

[[bench]]
name = "serde"
Expand Down
4 changes: 4 additions & 0 deletions libcorn/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ pub enum Value<'a> {
/// true or false
Boolean(bool),
/// `null` literal.
///
/// Takes an optional unit type as the `toml` crate
/// errors when encountering unit types,
/// but can handle `None` types (or could, on the old pinned version).
Null(Option<()>),
}

Expand Down
2 changes: 1 addition & 1 deletion libcorn/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ impl<'a> CornParser<'a> {
}

let child_obj = obj
.remove(part)
.shift_remove(part)
.unwrap_or_else(|| Value::Object(IndexMap::new()));

match child_obj {
Expand Down
5 changes: 3 additions & 2 deletions libcorn/tests/parser_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ macro_rules! generate_eq_tests {
let valid = fs::read_to_string(format!("../assets/outputs/toml/{}.toml", test_name)).unwrap().replace("\r", "");

let config = parse(input.as_str()).unwrap();
let serialized = toml::to_string_pretty(&config).unwrap().replace("\r", "");
println!("{config:?}");
let serialized = toml_edit::ser::to_string_pretty(&config).unwrap().replace("\r", "");

assert_eq!(serialized.trim(), valid.trim());
}
Expand Down Expand Up @@ -97,4 +98,4 @@ generate_eq_tests!(
very_compact
);

generate_invalid_tests!(invalid, invalid_input, invalid_nesting, invalid_spread);
generate_invalid_tests!(invalid, invalid_input, invalid_nesting, invalid_spread);

0 comments on commit a3c05b4

Please sign in to comment.