diff --git a/Cargo.lock b/Cargo.lock index daf7b2c..599eae8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -63,6 +73,41 @@ dependencies = [ "libloading", ] +[[package]] +name = "darling" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.52", +] + +[[package]] +name = "darling_macro" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.52", +] + [[package]] name = "either" version = "1.10.0" @@ -70,15 +115,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] -name = "getrandom" -version = "0.2.12" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "glob" @@ -86,6 +132,29 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indexmap" +version = "2.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +dependencies = [ + "equivalent", + "hashbrown", + "serde", +] + [[package]] name = "itertools" version = "0.12.1" @@ -168,85 +237,103 @@ name = "mrml" version = "0.1.0" dependencies = [ "magnus", - "mrml 1.2.11", + "mrml 3.0.4", "serde", "serde_json", ] [[package]] name = "mrml" -version = "1.2.11" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21c524cad4503cd722fb13286c5199914f2786280733d947d623cbdcb5e6437" +checksum = "11090cceb14c2eaf9d10c1503937b3a53323f322c475f409c1e51a0d86949a8d" dependencies = [ - "rand", + "indexmap", + "mrml-json-macros", + "mrml-macros", + "mrml-print-macros", + "rustc-hash", "serde", "serde_json", + "thiserror", "xmlparser", ] [[package]] -name = "nom" -version = "7.1.3" +name = "mrml-common-macros" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +checksum = "c141a78933cb6151e19b1d3daacfd5d2903bc1caf96f6424b6eccc48ca8ce00f" dependencies = [ - "memchr", - "minimal-lexical", + "syn 2.0.52", ] [[package]] -name = "ppv-lite86" -version = "0.2.17" +name = "mrml-json-macros" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "7f95ec01fb63c45d3efecf90aba38b8fbeb53e879d6a7c536f870bc0559ac00b" +dependencies = [ + "Inflector", + "darling", + "mrml-common-macros", + "proc-macro2", + "quote", + "syn 2.0.52", +] [[package]] -name = "proc-macro2" -version = "1.0.78" +name = "mrml-macros" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "573a6a8f4b79efc885ff5eaead81be779c8a948792d4bc5aea7979616a2141f2" dependencies = [ - "unicode-ident", + "Inflector", + "mrml-common-macros", + "proc-macro2", + "quote", + "syn 2.0.52", ] [[package]] -name = "quote" -version = "1.0.35" +name = "mrml-print-macros" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "2a8afc55347b59aa867594a9c13a46122ab04872580a8c1055d59853666fc971" dependencies = [ + "darling", + "mrml-common-macros", "proc-macro2", + "quote", + "syn 2.0.52", ] [[package]] -name = "rand" -version = "0.8.5" +name = "nom" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ - "libc", - "rand_chacha", - "rand_core", + "memchr", + "minimal-lexical", ] [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "proc-macro2" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ - "ppv-lite86", - "rand_core", + "unicode-ident", ] [[package]] -name = "rand_core" -version = "0.6.4" +name = "quote" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ - "getrandom", + "proc-macro2", ] [[package]] @@ -363,6 +450,12 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "syn" version = "1.0.109" @@ -386,16 +479,30 @@ dependencies = [ ] [[package]] -name = "unicode-ident" -version = "1.0.12" +name = "thiserror" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +dependencies = [ + "thiserror-impl", +] [[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +name = "thiserror-impl" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.52", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "windows-targets" diff --git a/ext/mrml/Cargo.toml b/ext/mrml/Cargo.toml index a027b64..1c93470 100644 --- a/ext/mrml/Cargo.toml +++ b/ext/mrml/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Jonian Guveli "] edition = "2018" [dependencies] -mrml = "1.2" +mrml = "3.0" magnus = "0.5" [dependencies.serde] diff --git a/ext/mrml/src/lib.rs b/ext/mrml/src/lib.rs index eff9476..2446773 100644 --- a/ext/mrml/src/lib.rs +++ b/ext/mrml/src/lib.rs @@ -4,9 +4,9 @@ use magnus::{ Error, ExceptionClass, RModule }; -use mrml::mjml::MJML; +use mrml::mjml::Mjml; use mrml::prelude::print::Print; -use mrml::prelude::render::Options; +use mrml::prelude::render::RenderOptions; fn mrml_error() -> ExceptionClass { *memoize!(ExceptionClass: { @@ -24,7 +24,7 @@ macro_rules! error { #[magnus::wrap(class = "MRML::Template", free_immediately, size)] struct Template { - res: MJML + res: Mjml } impl Template { @@ -36,7 +36,7 @@ impl Template { } fn from_json(input: String) -> Result { - match serde_json::from_str::(&input) { + match serde_json::from_str::(&input) { Ok(res) => Ok(Self { res }), Err(ex) => Err(error!(ex)) } @@ -62,7 +62,7 @@ impl Template { } fn to_html(&self) -> Result { - match self.res.render(&Options::default()) { + match self.res.render(&RenderOptions::default()) { Ok(res) => Ok(res), Err(ex) => Err(error!(ex)) }