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 f10c6b7
Show file tree
Hide file tree
Showing 10 changed files with 351 additions and 260 deletions.
546 changes: 315 additions & 231 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
31 changes: 16 additions & 15 deletions libcorn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ categories = ["config"]
keywords = ["configuration", "language", "wasm", "pest", "peg"]

[features]
wasm = ["wasm-bindgen", "serde-wasm-bindgen", "console_error_panic_hook", "wee_alloc"]
bench = ["criterion"]
wasm = ["wasm-bindgen", "serde-wasm-bindgen", "console_error_panic_hook", "wee_alloc"]
lua51 = ["mlua/lua51"]
lua52 = ["mlua/lua52"]
lua53 = ["mlua/lua53"]
Expand All @@ -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 = ["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
4 changes: 2 additions & 2 deletions libcorn/src/lua.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::Value;
use mlua::prelude::*;

impl<'lua> ToLua<'lua> for Value<'lua> {
fn to_lua(self, lua: &'lua Lua) -> LuaResult<LuaValue<'lua>> {
impl<'lua> IntoLua<'lua> for Value<'lua> {
fn into_lua(self, lua: &'lua Lua) -> LuaResult<LuaValue<'lua>> {
lua.to_value(&self)
}
}
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
3 changes: 2 additions & 1 deletion 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

0 comments on commit f10c6b7

Please sign in to comment.