diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index be1a804..5ac1f34 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -38,7 +38,7 @@ jobs: - target: x86_64-pc-windows-msvc os: windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rust run: scripts/ci/install-rust.sh stable ${{ matrix.target }} - name: Build asset @@ -51,7 +51,7 @@ jobs: name: Publish to crates.io runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rust (rustup) run: rustup update stable --no-self-update && rustup default stable - name: Publish diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 3032759..fc15608 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -36,7 +36,7 @@ jobs: # rust: stable # experimental: false steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rust run: scripts/ci/install-rust.sh ${{ matrix.rust }} - name: Install mdbook @@ -53,7 +53,7 @@ jobs: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rust run: rustup update stable && rustup default stable && rustup component add rustfmt - run: cargo fmt --check diff --git a/Cargo.lock b/Cargo.lock index d7ac7ab..a227d3e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,19 +29,6 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" -[[package]] -name = "ammonia" -version = "4.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17e913097e1a2124b46746c980134e8c954bc17a6a59bb3fde96f088d126dde6" -dependencies = [ - "cssparser", - "html5ever 0.35.0", - "maplit", - "tendril", - "url", -] - [[package]] name = "android_system_properties" version = "0.1.5" @@ -133,12 +120,79 @@ dependencies = [ "syn 2.0.114", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "axum" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" +dependencies = [ + "axum-core", + "base64", + "bytes", + "form_urlencoded", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sha1", + "sync_wrapper", + "tokio", + "tokio-tungstenite", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "better_scoped_tls" version = "1.0.1" @@ -163,6 +217,12 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.10.0" @@ -342,36 +402,38 @@ dependencies = [ ] [[package]] -name = "crypto-common" -version = "0.1.7" +name = "crossbeam-deque" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ - "generic-array", - "typenum", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] -name = "cssparser" -version = "0.35.0" +name = "crossbeam-epoch" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e901edd733a1472f944a45116df3f846f54d37e67e68640ac8bb69689aca2aa" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "cssparser-macros", - "dtoa-short", - "itoa", - "phf 0.11.3", - "smallvec", + "crossbeam-utils", ] [[package]] -name = "cssparser-macros" -version = "0.6.1" +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ - "quote", - "syn 2.0.114", + "generic-array", + "typenum", ] [[package]] @@ -409,6 +471,12 @@ dependencies = [ "syn 2.0.114", ] +[[package]] +name = "data-encoding" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" + [[package]] name = "derive_builder" version = "0.20.2" @@ -474,19 +542,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a5577f010d4e1bb3f3c4d6081e05718eb6992cf20119cab4d3abadff198b5ae" [[package]] -name = "dtoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" - -[[package]] -name = "dtoa-short" -version = "0.3.5" +name = "ego-tree" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" -dependencies = [ - "dtoa", -] +checksum = "b2972feb8dffe7bc8c5463b1dacda1b0dfbed3710e50f977d965429692d74cd8" [[package]] name = "either" @@ -513,7 +572,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ "log", - "regex", ] [[package]] @@ -522,10 +580,7 @@ version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" dependencies = [ - "anstream", - "anstyle", "env_filter", - "jiff", "log", ] @@ -563,6 +618,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "font-awesome-as-a-crate" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "932dcfbd51320af5f27f1ba02d2e567dec332cac7d2c221ba45d8e767264c4dc" + [[package]] name = "form_urlencoded" version = "1.2.2" @@ -582,6 +643,15 @@ dependencies = [ "syn 2.0.114", ] +[[package]] +name = "fsevent-sys" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" +dependencies = [ + "libc", +] + [[package]] name = "futf" version = "0.1.5" @@ -592,6 +662,58 @@ dependencies = [ "new_debug_unreachable", ] +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-macro", + "futures-sink", + "futures-task", + "pin-project-lite", + "slab", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -625,6 +747,19 @@ dependencies = [ "wasip2", ] +[[package]] +name = "globset" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52dfc19153a48bde0cbd630453615c8151bce3a5adfac7a0aebfbf0a1e1f57e3" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] + [[package]] name = "handlebars" version = "6.4.0" @@ -705,13 +840,99 @@ dependencies = [ [[package]] name = "html5ever" -version = "0.35.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55d958c2f74b664487a2035fe1dadb032c48718a03b63f3ab0b8537db8549ed4" +checksum = "6452c4751a24e1b99c3260d505eaeee76a050573e61f30ac2c924ddc7236f01e" dependencies = [ "log", - "markup5ever 0.35.0", - "match_token", + "markup5ever 0.36.1", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "http-range-header" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "bytes", + "http", + "http-body", + "hyper", + "pin-project-lite", + "tokio", + "tower-service", ] [[package]] @@ -846,6 +1067,22 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "ignore" +version = "0.4.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3d782a365a015e0f5c04902246139249abf769125006fbe7649e2ee88169b4a" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", +] + [[package]] name = "indexmap" version = "2.13.0" @@ -856,6 +1093,26 @@ dependencies = [ "hashbrown 0.16.1", ] +[[package]] +name = "inotify" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" +dependencies = [ + "bitflags 2.10.0", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] + [[package]] name = "is-macro" version = "0.3.7" @@ -881,39 +1138,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] -name = "jiff" -version = "0.2.18" +name = "js-sys" +version = "0.3.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" dependencies = [ - "jiff-static", - "log", - "portable-atomic", - "portable-atomic-util", - "serde_core", + "once_cell", + "wasm-bindgen", ] [[package]] -name = "jiff-static" -version = "0.2.18" +name = "kqueue" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +checksum = "eac30106d7dce88daf4a3fcb4879ea939476d5074a9b7ddd0fb97fa4bed5596a" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.114", + "kqueue-sys", + "libc", ] [[package]] -name = "js-sys" -version = "0.3.85" +name = "kqueue-sys" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" dependencies = [ - "once_cell", - "wasm-bindgen", + "bitflags 1.3.2", + "libc", ] +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "libc" version = "0.2.180" @@ -953,12 +1212,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - [[package]] name = "markup5ever" version = "0.11.0" @@ -968,16 +1221,16 @@ dependencies = [ "log", "phf 0.10.1", "phf_codegen 0.10.0", - "string_cache", - "string_cache_codegen", + "string_cache 0.8.9", + "string_cache_codegen 0.5.4", "tendril", ] [[package]] name = "markup5ever" -version = "0.35.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "311fe69c934650f8f19652b3946075f0fc41ad8757dbb68f1ca14e7900ecc1c3" +checksum = "6c3294c4d74d0742910f8c7b466f44dda9eb2d5742c1e430138df290a1e8451c" dependencies = [ "log", "tendril", @@ -997,43 +1250,49 @@ dependencies = [ ] [[package]] -name = "match_token" -version = "0.35.0" +name = "matchers" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac84fd3f360fcc43dc5f5d186f02a94192761a080e8bc58621ad4d12296a58cf" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.114", + "regex-automata", ] +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + [[package]] name = "mdbook" -version = "0.4.52" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93c284d2855916af7c5919cf9ad897cfc77d3c2db6f55429c7cfb769182030ec" +checksum = "380f0dd1c54930692986cfe33221a2d34dbfb39c9e9325923c0f6bf7aee119a5" dependencies = [ - "ammonia", "anyhow", - "chrono", + "axum", "clap", "clap_complete", - "elasticlunr-rs", - "env_logger", - "handlebars", - "hex", - "log", - "memchr", + "futures-util", + "ignore", + "mdbook-core", + "mdbook-driver", + "mdbook-html", + "mdbook-markdown", + "mdbook-preprocessor", + "mdbook-renderer", + "mdbook-summary", + "notify", + "notify-debouncer-mini", "opener", - "pulldown-cmark", - "regex", - "serde", - "serde_json", - "sha2", - "shlex", - "tempfile", + "pathdiff", + "tokio", "toml", - "topological-sort", + "tower-http", + "tracing", + "tracing-subscriber", + "walkdir", ] [[package]] @@ -1050,6 +1309,8 @@ dependencies = [ "libc", "log", "mdbook", + "mdbook-html", + "mdbook-renderer", "once_cell", "pathdiff", "pulldown-cmark", @@ -1064,6 +1325,118 @@ dependencies = [ "toml", ] +[[package]] +name = "mdbook-core" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39a3873d4afac65583f1acb56ff058df989d5b4a2464bb02c785549727d307ee" +dependencies = [ + "anyhow", + "regex", + "serde", + "serde_json", + "toml", + "tracing", +] + +[[package]] +name = "mdbook-driver" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a229930b29a9908560883e1f386eae25d8a971d259a80f49916a50627f04a42d" +dependencies = [ + "anyhow", + "indexmap", + "mdbook-core", + "mdbook-html", + "mdbook-markdown", + "mdbook-preprocessor", + "mdbook-renderer", + "mdbook-summary", + "regex", + "serde", + "serde_json", + "shlex", + "tempfile", + "toml", + "topological-sort", + "tracing", +] + +[[package]] +name = "mdbook-html" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dee80c03c65e3212fb528b8c9be5568a6a85cf795d03cf9fd6ba39ad52069ca" +dependencies = [ + "anyhow", + "ego-tree", + "elasticlunr-rs", + "font-awesome-as-a-crate", + "handlebars", + "hex", + "html5ever 0.36.1", + "indexmap", + "mdbook-core", + "mdbook-markdown", + "mdbook-renderer", + "pulldown-cmark", + "regex", + "serde", + "serde_json", + "sha2", + "tracing", +] + +[[package]] +name = "mdbook-markdown" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07c41bf35212f5d8b83e543aa6a4887dc5709c8489c5fb9ed00f1b51ce1a2cc6" +dependencies = [ + "pulldown-cmark", + "regex", + "tracing", +] + +[[package]] +name = "mdbook-preprocessor" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d87bf40be0597f26f0822f939a64f02bf92c4655ba04490aadbf83601a013bb" +dependencies = [ + "anyhow", + "mdbook-core", + "serde", + "serde_json", +] + +[[package]] +name = "mdbook-renderer" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93ed59f225b3ae4283c56bea633db83184627a090d892908bd66990c68e10b43" +dependencies = [ + "anyhow", + "mdbook-core", + "serde", + "serde_json", +] + +[[package]] +name = "mdbook-summary" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00d85b291d67a69c92e939450390fe34d6ea418a868c8f7b42f0b300af35a7b" +dependencies = [ + "anyhow", + "mdbook-core", + "memchr", + "pulldown-cmark", + "serde", + "tracing", +] + [[package]] name = "memchr" version = "2.7.6" @@ -1071,16 +1444,92 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] -name = "new_debug_unreachable" -version = "1.0.6" +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "normpath" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf23ab2b905654b4cb177e30b629937b3868311d4e1cba859f899c041046e69b" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "notify" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3" +dependencies = [ + "bitflags 2.10.0", + "fsevent-sys", + "inotify", + "kqueue", + "libc", + "log", + "mio", + "notify-types", + "walkdir", + "windows-sys 0.60.2", +] + +[[package]] +name = "notify-debouncer-mini" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17849edfaabd9a5fef1c606d99cfc615a8e99f7ac4366406d86c7942a3184cf2" +dependencies = [ + "log", + "notify", + "notify-types", + "tempfile", +] + +[[package]] +name = "notify-types" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +checksum = "42b8cfee0e339a0337359f3c88165702ac6e600dc01c0cc9579a92d62b08477a" +dependencies = [ + "bitflags 2.10.0", +] [[package]] -name = "normpath" -version = "1.5.0" +name = "nu-ansi-term" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf23ab2b905654b4cb177e30b629937b3868311d4e1cba859f899c041046e69b" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ "windows-sys 0.61.2", ] @@ -1268,6 +1717,16 @@ dependencies = [ "phf_shared 0.11.3", ] +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_shared 0.13.1", + "serde", +] + [[package]] name = "phf_codegen" version = "0.10.0" @@ -1280,12 +1739,12 @@ dependencies = [ [[package]] name = "phf_codegen" -version = "0.11.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" dependencies = [ - "phf_generator 0.11.3", - "phf_shared 0.11.3", + "phf_generator 0.13.1", + "phf_shared 0.13.1", ] [[package]] @@ -1295,7 +1754,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" dependencies = [ "phf_shared 0.10.0", - "rand", + "rand 0.8.5", ] [[package]] @@ -1305,7 +1764,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" dependencies = [ "phf_shared 0.11.3", - "rand", + "rand 0.8.5", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared 0.13.1", ] [[package]] @@ -1340,25 +1809,25 @@ dependencies = [ ] [[package]] -name = "pin-project-lite" -version = "0.2.16" +name = "phf_shared" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher 1.0.1", +] [[package]] -name = "portable-atomic" -version = "1.13.0" +name = "pin-project-lite" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] -name = "portable-atomic-util" -version = "0.2.4" +name = "pin-utils" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" -dependencies = [ - "portable-atomic", -] +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "potential_utf" @@ -1422,11 +1891,11 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.10.3" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76979bea66e7875e7509c4ec5300112b316af87fa7a252ca91c448b32dfe3993" +checksum = "7c3a14896dfa883796f1cb410461aef38810ea05f2b2c33c5aded3649095fdad" dependencies = [ - "bitflags", + "bitflags 2.10.0", "memchr", "pulldown-cmark-escape", "unicase", @@ -1434,15 +1903,15 @@ dependencies = [ [[package]] name = "pulldown-cmark-escape" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd348ff538bc9caeda7ee8cad2d1d48236a1f443c1fa3913c6a02fe0043b1dd3" +checksum = "007d8adb5ddab6f8e3f491ac63566a7d5002cc7ed73901f72057943fa71ae1ae" [[package]] name = "pulldown-cmark-to-cmark" -version = "14.0.1" +version = "22.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03ac1dab098faca0c377449f5dbe98a222a3f6d67089c2e308bd3c7076cd37bd" +checksum = "50793def1b900256624a709439404384204a5dc3a6ec580281bfaac35e882e90" dependencies = [ "pulldown-cmark", ] @@ -1469,8 +1938,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", ] [[package]] @@ -1480,7 +1959,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", ] [[package]] @@ -1492,13 +1981,22 @@ dependencies = [ "getrandom 0.2.17", ] +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + [[package]] name = "redox_syscall" version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags", + "bitflags 2.10.0", ] [[package]] @@ -1542,7 +2040,7 @@ version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" dependencies = [ - "bitflags", + "bitflags 2.10.0", "errno", "libc", "linux-raw-sys", @@ -1555,6 +2053,12 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + [[package]] name = "same-file" version = "1.0.6" @@ -1646,6 +2150,49 @@ dependencies = [ "zmij", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_spanned" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876ac351060d4f882bb1032b6369eb0aef79ad9df1ea8bc404874d8cc3d0cd98" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2" version = "0.10.9" @@ -1657,6 +2204,15 @@ dependencies = [ "digest", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1675,6 +2231,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + [[package]] name = "smallvec" version = "1.15.1" @@ -1692,6 +2254,16 @@ dependencies = [ "version_check", ] +[[package]] +name = "socket2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -1717,6 +2289,18 @@ dependencies = [ "serde", ] +[[package]] +name = "string_cache" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.13.1", + "precomputed-hash", +] + [[package]] name = "string_cache_codegen" version = "0.5.4" @@ -1729,6 +2313,18 @@ dependencies = [ "quote", ] +[[package]] +name = "string_cache_codegen" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69" +dependencies = [ + "phf_generator 0.13.1", + "phf_shared 0.13.1", + "proc-macro2", + "quote", +] + [[package]] name = "string_enum" version = "1.0.2" @@ -1770,9 +2366,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "18.0.1" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1c06698254e9b47daaf9bbb062af489a350bd8d10dfaab0cabbd32d46cec69d" +checksum = "623a4ee8bb19d87de6fc781e44e1696af20136d1c1eabf9f3712ff1fb50b6189" dependencies = [ "anyhow", "ast_node", @@ -1795,9 +2391,9 @@ dependencies = [ [[package]] name = "swc_core" -version = "55.0.2" +version = "59.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399bda66a590c521f3371a67d7a0ef579b149fd045691105dfd63bc6cfbfafd2" +checksum = "8acca6d8b73f36672a9b865faad33c75fc15875798c8f50f1583e11b1661d9af" dependencies = [ "swc_allocator", "swc_atoms", @@ -1810,11 +2406,11 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "20.0.0" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4682d975a3b4ea33f351e7938db4db41f757d9abe537af4780611ef006531698" +checksum = "27111582629a1cc116f9cffa6bfa501e6c849e0e66fafdf78cd404dce919117d" dependencies = [ - "bitflags", + "bitflags 2.10.0", "is-macro", "num-bigint", "once_cell", @@ -1829,11 +2425,11 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "33.0.0" +version = "36.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb866d9ca2df54daa4a460bdd105cd641d780f0578928cb1f7f4e54574bb2bb" +checksum = "0c4c7846e4c9ee7bb52e1958b5fe7a924088451cf699e01e7203d6f5210b055e" dependencies = [ - "bitflags", + "bitflags 2.10.0", "either", "num-bigint", "phf 0.11.3", @@ -1849,9 +2445,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "36.0.1" +version = "39.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf93abf3dc6d2b21a2a29c62b0197cd270b6105a483236ecba91993f895204e" +checksum = "5d4fb6ec9ec1d782104996b86119fb775c08073ce4ace8e90b3c27b75b1c0812" dependencies = [ "better_scoped_tls", "indexmap", @@ -1871,9 +2467,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "26.0.1" +version = "27.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3669c1d92ba315caff5a80df76141367acf61b2d846231a1960e25be65a20fbd" +checksum = "5c91e3ed13767ac74670e9cc9895d8c3502a9086fe69fe8a23295da08e6f7e02" dependencies = [ "dragonbox_ecma", "indexmap", @@ -1890,9 +2486,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "20.0.0" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e971a258717db3dc8939c38410d8b8cb8126f1b05b9758672daa7cae3e0248c2" +checksum = "7c1b3a04c999c14f09d81c959f8a84f71d594f2ad2456470eb38d78532e82dda" dependencies = [ "new_debug_unreachable", "num-bigint", @@ -1957,6 +2553,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" + [[package]] name = "synstructure" version = "0.13.2" @@ -2028,6 +2630,15 @@ dependencies = [ "syn 2.0.114", ] +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + [[package]] name = "tinystr" version = "0.8.2" @@ -2038,27 +2649,163 @@ dependencies = [ "zerovec", ] +[[package]] +name = "tokio" +version = "1.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25a406cddcc431a75d3d9afc6a7c0f7428d4891dd973e4d54c56b46127bf857" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml" -version = "0.5.11" +version = "0.9.12+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" dependencies = [ - "serde", + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow 0.7.15", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_parser" +version = "1.1.0+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2334f11ee363607eb04df9b8fc8a13ca1715a72ba8662a26ac285c98aabb4011" +dependencies = [ + "winnow 1.0.0", ] +[[package]] +name = "toml_writer" +version = "1.1.0+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d282ade6016312faf3e41e57ebbba0c073e4056dab1232ab1cb624199648f8ed" + [[package]] name = "topological-sort" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags 2.10.0", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "http-range-header", + "httpdate", + "mime", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + [[package]] name = "tracing" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2082,6 +2829,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", ] [[package]] @@ -2094,6 +2871,23 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "tungstenite" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8628dcc84e5a09eb3d8423d6cb682965dea9133204e8fb3efee74c2a0c259442" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.9.2", + "sha1", + "thiserror", + "utf-8", +] + [[package]] name = "typenum" version = "1.19.0" @@ -2160,6 +2954,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + [[package]] name = "vergen" version = "9.1.0" @@ -2272,14 +3072,14 @@ dependencies = [ [[package]] name = "web_atoms" -version = "0.1.3" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ffde1dc01240bdf9992e3205668b235e59421fd085e8a317ed98da0178d414" +checksum = "57a9779e9f04d2ac1ce317aee707aa2f6b773afba7b931222bff6983843b1576" dependencies = [ - "phf 0.11.3", - "phf_codegen 0.11.3", - "string_cache", - "string_cache_codegen", + "phf 0.13.1", + "phf_codegen 0.13.1", + "string_cache 0.9.0", + "string_cache_codegen 0.6.1", ] [[package]] @@ -2433,6 +3233,18 @@ version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" + +[[package]] +name = "winnow" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a90e88e4667264a994d34e6d1ab2d26d398dcdca8b7f52bec8668957517fc7d8" + [[package]] name = "wit-bindgen" version = "0.51.0" diff --git a/Cargo.toml b/Cargo.toml index dbd1d0b..1cc2fef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,8 +20,8 @@ doc = false env_logger = { version = "0.11.5", default-features = false } log = { version = "0.4.22", features = ["std"] } -# Disable the watch and serve features, we only use mdbook as a library -mdbook = { version = "0.4.52", default-features = false, features = ["search"] } +mdbook-renderer = "0.5.2" +mdbook-html = "0.5.2" # Disable unicode features, we don't need them regex = { version = "1.11.0", default-features = false, features = [ @@ -32,11 +32,11 @@ regex = { version = "1.11.0", default-features = false, features = [ serde_json = "1.0.128" serde = { version = "1.0.210", features = ["derive"] } -toml = "0.5.11" +toml = "0.9.12" # We use pulldown-cmark to mutate markdown, not to render HTML -pulldown-cmark = { version = "0.10.0", default-features = false } -pulldown-cmark-to-cmark = "14.0.0" +pulldown-cmark = { version = "0.13.0", default-features = false } +pulldown-cmark-to-cmark = "22.0.0" pathdiff = "0.2.1" @@ -44,7 +44,7 @@ anyhow = "1.0.89" once_cell = "1.20.2" -swc_core = { version = "55.0.2", features = [ +swc_core = { version = "59.0.1", features = [ "common", "ecma_parser_typescript", "ecma_ast", @@ -69,3 +69,4 @@ assert_cmd = "2.0.16" copy_dir = "0.1.3" select = "0.6.0" tempfile = "3.13.0" +mdbook = "0.5.2" diff --git a/src/angular/builder.rs b/src/angular/builder.rs index a092ee2..c1a02ec 100644 --- a/src/angular/builder.rs +++ b/src/angular/builder.rs @@ -5,7 +5,7 @@ mod utils; mod writer; use log::warn; -use mdbook::renderer::RenderContext; +use mdbook_renderer::RenderContext; use crate::{Builder, ChapterWithCodeBlocks, Config, Result}; @@ -34,7 +34,11 @@ pub(crate) fn build( } #[cfg(all(unix, feature = "background"))] Builder::Background => { - if ctx.config.get("output.html.live-reload-endpoint").is_some() { + if ctx + .config + .get::("output.html.live-reload-endpoint") + .is_ok() + { self::background::build(config, chapters) } else { warn!("The background option is ignored for commands that don't watch"); diff --git a/src/codeblock/mod.rs b/src/codeblock/mod.rs index 52214c2..464ed64 100644 --- a/src/codeblock/mod.rs +++ b/src/codeblock/mod.rs @@ -25,7 +25,7 @@ pub(crate) fn to_codeblock, C: AsRef>( reexport_path: Option<&Path>, language: L, code: C, - code_to_print: &Option, + code_to_print: Option<&str>, ) -> Result { let code = code.as_ref(); let flags = get_flags(language.as_ref()); @@ -58,7 +58,7 @@ pub(crate) fn to_codeblock, C: AsRef>( tag, } = parse_codeblock( code, - code_to_print.as_ref().map(AsRef::as_ref), + code_to_print, allow_playground, index, class_name, diff --git a/src/codeblock/parser.rs b/src/codeblock/parser.rs index 4fd37d8..4d595ff 100644 --- a/src/codeblock/parser.rs +++ b/src/codeblock/parser.rs @@ -147,11 +147,9 @@ impl CodeBlockVisitor { return Ok(()); }; - if self.tag.is_some() { + if let Some(tag) = &self.tag { return Err(Error::msg(format!( - "File contains more than one exported component class: {} and {}", - self.tag.as_ref().unwrap(), - name + "File contains more than one exported component class: {tag} and {name}" ))); } diff --git a/src/codeblock/playground/evaluate_expression.rs b/src/codeblock/playground/evaluate_expression.rs index e8ede7c..39a6be1 100644 --- a/src/codeblock/playground/evaluate_expression.rs +++ b/src/codeblock/playground/evaluate_expression.rs @@ -1,7 +1,10 @@ use serde_json::{Number, Value}; use swc_core::ecma::ast; -use super::{PlaygroundInputConfig, PlaygroundInputConfigExt, PlaygroundInputType}; +use super::{ + PlaygroundInputConfig, PlaygroundInputConfigExt, PlaygroundInputType, + ReadonlyPlaygroundInputConfigExt, +}; fn apply_unary( op: ast::UnaryOp, @@ -47,29 +50,22 @@ fn apply_unary( #[allow(clippy::too_many_lines)] fn apply_binary( op: ast::BinaryOp, - left: &Option, - right: &Option, + left: Option<&PlaygroundInputConfig>, + right: Option<&PlaygroundInputConfig>, ) -> Option { - fn values<'a>( - left: &'a Option, - right: &'a Option, - ) -> Option<(&'a Value, &'a Value)> { - Option::zip(left.get_default(), right.get_default()) - } - match op { ast::BinaryOp::NotEq | ast::BinaryOp::In | ast::BinaryOp::InstanceOf | ast::BinaryOp::EqEq => Some(PlaygroundInputConfig::boolean()), - ast::BinaryOp::EqEqEq => Some(if let Some((left, right)) = values(left, right) { - PlaygroundInputConfig::from_default(left.eq(right)) + ast::BinaryOp::EqEqEq => Some(if let (Some(left), Some(right)) = (left, right) { + PlaygroundInputConfig::from_default(left.get_default().eq(&right.get_default())) } else { PlaygroundInputConfig::boolean() }), - ast::BinaryOp::NotEqEq => Some(if let Some((left, right)) = values(left, right) { - PlaygroundInputConfig::from_default(!left.eq(right)) + ast::BinaryOp::NotEqEq => Some(if let (Some(left), Some(right)) = (left, right) { + PlaygroundInputConfig::from_default(!left.get_default().eq(&right.get_default())) } else { PlaygroundInputConfig::boolean() }), @@ -97,33 +93,35 @@ fn apply_binary( PlaygroundInputConfig::boolean() }), - ast::BinaryOp::BitAnd => { - i64_i64_to_i64_operator(values(left, right), std::ops::BitAnd::bitand) - } - ast::BinaryOp::BitOr => { - i64_i64_to_i64_operator(values(left, right), std::ops::BitOr::bitor) - } - ast::BinaryOp::BitXor => { - i64_i64_to_i64_operator(values(left, right), std::ops::BitXor::bitxor) - } - ast::BinaryOp::LShift => i64_i64_to_i64_operator(values(left, right), std::ops::Shl::shl), - ast::BinaryOp::RShift => i64_i64_to_i64_operator(values(left, right), std::ops::Shr::shr), + ast::BinaryOp::BitAnd => Some(i64_i64_to_i64_operator( + left, + right, + std::ops::BitAnd::bitand, + )), + ast::BinaryOp::BitOr => Some(i64_i64_to_i64_operator(left, right, std::ops::BitOr::bitor)), + ast::BinaryOp::BitXor => Some(i64_i64_to_i64_operator( + left, + right, + std::ops::BitXor::bitxor, + )), + ast::BinaryOp::LShift => Some(i64_i64_to_i64_operator(left, right, std::ops::Shl::shl)), + ast::BinaryOp::RShift => Some(i64_i64_to_i64_operator(left, right, std::ops::Shr::shr)), ast::BinaryOp::ZeroFillRShift => Some(PlaygroundInputConfig::number()), - ast::BinaryOp::Exp => f64_f64_to_f64_operator(values(left, right), f64::powf), - ast::BinaryOp::Mod => f64_f64_to_f64_operator(values(left, right), std::ops::Rem::rem), - ast::BinaryOp::Mul => f64_f64_to_f64_operator(values(left, right), std::ops::Mul::mul), - ast::BinaryOp::Div => f64_f64_to_f64_operator(values(left, right), std::ops::Div::div), - ast::BinaryOp::Sub => f64_f64_to_f64_operator(values(left, right), std::ops::Sub::sub), + ast::BinaryOp::Exp => Some(f64_f64_to_f64_operator(left, right, f64::powf)), + ast::BinaryOp::Mod => Some(f64_f64_to_f64_operator(left, right, std::ops::Rem::rem)), + ast::BinaryOp::Mul => Some(f64_f64_to_f64_operator(left, right, std::ops::Mul::mul)), + ast::BinaryOp::Div => Some(f64_f64_to_f64_operator(left, right, std::ops::Div::div)), + ast::BinaryOp::Sub => Some(f64_f64_to_f64_operator(left, right, std::ops::Sub::sub)), - ast::BinaryOp::Gt => f64_f64_to_bool_operator(values(left, right), |a, b| a > b), - ast::BinaryOp::GtEq => f64_f64_to_bool_operator(values(left, right), |a, b| a >= b), - ast::BinaryOp::Lt => f64_f64_to_bool_operator(values(left, right), |a, b| a < b), - ast::BinaryOp::LtEq => f64_f64_to_bool_operator(values(left, right), |a, b| a <= b), + ast::BinaryOp::Gt => Some(f64_f64_to_bool_operator(left, right, |a, b| a > b)), + ast::BinaryOp::GtEq => Some(f64_f64_to_bool_operator(left, right, |a, b| a >= b)), + ast::BinaryOp::Lt => Some(f64_f64_to_bool_operator(left, right, |a, b| a < b)), + ast::BinaryOp::LtEq => Some(f64_f64_to_bool_operator(left, right, |a, b| a <= b)), ast::BinaryOp::Add => { // Oh boy - if let Some((left, right)) = values(left, right) { + if let (Some(left), Some(right)) = (left.get_default(), right.get_default()) { match (left, right) { (Value::String(left), Value::String(right)) => { let mut result = String::with_capacity(left.len() + right.len()); @@ -172,62 +170,65 @@ fn apply_binary( } } -#[allow(clippy::unnecessary_wraps)] fn f64_f64_to_f64_operator( - values: Option<(&Value, &Value)>, + left: Option<&PlaygroundInputConfig>, + right: Option<&PlaygroundInputConfig>, f: F, -) -> Option +) -> PlaygroundInputConfig where F: Fn(f64, f64) -> f64, { - if let Some((Value::Number(left), Value::Number(right))) = values { + if let (Some(Value::Number(left)), Some(Value::Number(right))) = + (left.get_default(), right.get_default()) + { if let Some(value) = serde_json::Number::from_f64(f(left.as_f64().unwrap(), right.as_f64().unwrap())) { - Some(PlaygroundInputConfig::from_default(value)) + PlaygroundInputConfig::from_default(value) } else { - Some(PlaygroundInputConfig::number()) + PlaygroundInputConfig::number() } } else { - Some(PlaygroundInputConfig::number()) + PlaygroundInputConfig::number() } } -#[allow(clippy::unnecessary_wraps)] fn f64_f64_to_bool_operator( - values: Option<(&Value, &Value)>, + left: Option<&PlaygroundInputConfig>, + right: Option<&PlaygroundInputConfig>, f: F, -) -> Option +) -> PlaygroundInputConfig where F: Fn(f64, f64) -> bool, { - if let Some((Value::Number(left), Value::Number(right))) = values { - Some(PlaygroundInputConfig::from_default(f( - left.as_f64().unwrap(), - right.as_f64().unwrap(), - ))) + if let (Some(Value::Number(left)), Some(Value::Number(right))) = + (left.get_default(), right.get_default()) + { + PlaygroundInputConfig::from_default(f(left.as_f64().unwrap(), right.as_f64().unwrap())) } else { - Some(PlaygroundInputConfig::boolean()) + PlaygroundInputConfig::boolean() } } -#[allow(clippy::unnecessary_wraps)] fn i64_i64_to_i64_operator( - values: Option<(&Value, &Value)>, + left: Option<&PlaygroundInputConfig>, + right: Option<&PlaygroundInputConfig>, f: F, -) -> Option +) -> PlaygroundInputConfig where F: Fn(i64, i64) -> i64, { - if let Some((Value::Number(left), Value::Number(right))) = values { + if let (Some(Value::Number(left)), Some(Value::Number(right))) = + (left.get_default(), right.get_default()) + { if let Some(left) = left.as_i64() { if let Some(right) = right.as_i64() { - return Some(PlaygroundInputConfig::from_default(f(left, right))); + return PlaygroundInputConfig::from_default(f(left, right)); } } } - Some(PlaygroundInputConfig::number()) + PlaygroundInputConfig::number() } pub(super) fn ts_type_to_input_type>( @@ -297,7 +298,7 @@ pub(super) fn evaluate>(expr: T) -> Option apply_binary(*op, &evaluate(left), &evaluate(right)), + }) => apply_binary(*op, evaluate(left).as_ref(), evaluate(right).as_ref()), _ => None, } diff --git a/src/codeblock/playground/types.rs b/src/codeblock/playground/types.rs index d67c51e..8644924 100644 --- a/src/codeblock/playground/types.rs +++ b/src/codeblock/playground/types.rs @@ -37,29 +37,19 @@ pub(crate) struct PlaygroundInputConfig { default_: Option, } -pub(super) trait PlaygroundInputConfigExt { - fn extend(self, config: PlaygroundInputConfig) -> PlaygroundInputConfig; - +pub(super) trait ReadonlyPlaygroundInputConfigExt { fn as_boolean(&self) -> Option; - fn into_number(self) -> Option; - // fn into_string(self) -> Option; fn get_default(&self) -> Option<&Value>; } -impl PlaygroundInputConfigExt for PlaygroundInputConfig { - #[inline] - fn extend(self, config: PlaygroundInputConfig) -> PlaygroundInputConfig { - PlaygroundInputConfig { - default_: self.default_.or(config.default_), - type_: if self.type_.is_string() && config.type_.is_enum() { - config.type_ - } else { - self.type_ - }, - } - } +pub(super) trait PlaygroundInputConfigExt: ReadonlyPlaygroundInputConfigExt { + fn extend(self, config: PlaygroundInputConfig) -> PlaygroundInputConfig; + fn into_number(self) -> Option; +} + +impl ReadonlyPlaygroundInputConfigExt for PlaygroundInputConfig { fn as_boolean(&self) -> Option { if let Some(default_) = &self.default_ { match default_ { @@ -74,6 +64,25 @@ impl PlaygroundInputConfigExt for PlaygroundInputConfig { } } + #[inline] + fn get_default(&self) -> Option<&Value> { + self.default_.as_ref() + } +} + +impl PlaygroundInputConfigExt for PlaygroundInputConfig { + #[inline] + fn extend(self, config: PlaygroundInputConfig) -> PlaygroundInputConfig { + PlaygroundInputConfig { + default_: self.default_.or(config.default_), + type_: if self.type_.is_string() && config.type_.is_enum() { + config.type_ + } else { + self.type_ + }, + } + } + fn into_number(self) -> Option { if let Some(Value::Number(value)) = self.default_ { Some(value) @@ -81,18 +90,18 @@ impl PlaygroundInputConfigExt for PlaygroundInputConfig { None } } +} - // fn into_string(self) -> Option { - // if let Some(Value::String(value)) = self.default_ { - // Some(value) - // } else { - // None - // } - // } +impl ReadonlyPlaygroundInputConfigExt for Option { + #[inline] + fn as_boolean(&self) -> Option { + self.as_ref() + .and_then(ReadonlyPlaygroundInputConfigExt::as_boolean) + } #[inline] fn get_default(&self) -> Option<&Value> { - self.default_.as_ref() + self.as_ref().and_then(PlaygroundInputConfig::get_default) } } @@ -106,24 +115,21 @@ impl PlaygroundInputConfigExt for Option { } } - #[inline] - fn as_boolean(&self) -> Option { - self.as_ref().and_then(PlaygroundInputConfigExt::as_boolean) - } - #[inline] fn into_number(self) -> Option { self.and_then(PlaygroundInputConfigExt::into_number) } +} - // #[inline] - // fn into_string(self) -> Option { - // self.and_then(PlaygroundInputConfigExt::into_string) - // } +impl ReadonlyPlaygroundInputConfigExt for Option<&PlaygroundInputConfig> { + #[inline] + fn as_boolean(&self) -> Option { + self.and_then(ReadonlyPlaygroundInputConfigExt::as_boolean) + } #[inline] fn get_default(&self) -> Option<&Value> { - self.as_ref().and_then(PlaygroundInputConfig::get_default) + self.and_then(PlaygroundInputConfig::get_default) } } diff --git a/src/config.rs b/src/config.rs index 32eb669..7296a70 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,7 +1,7 @@ use std::path::{Path, PathBuf}; use anyhow::{anyhow, Context}; -use mdbook::renderer::RenderContext; +use mdbook_renderer::RenderContext; use serde::Deserialize; use toml::value::Table; @@ -32,7 +32,7 @@ pub enum Builder { Slow, } -#[derive(Deserialize)] +#[derive(Deserialize, Default)] #[serde(rename_all = "kebab-case", deny_unknown_fields)] struct DeConfig { #[allow(unused)] // the command option is defined by mdbook @@ -122,9 +122,9 @@ impl Config { /// the book contains an invalid configuration. pub fn read>(root: P) -> Result { let root = root.as_ref(); - let mut cfg = - mdbook::Config::from_disk(root.join("book.toml")).context("Error reading book.toml")?; - cfg.update_from_env(); + let mut cfg = mdbook_renderer::config::Config::from_disk(root.join("book.toml")) + .context("Error reading book.toml")?; + cfg.update_from_env()?; Self::from_config( &cfg, @@ -143,19 +143,24 @@ impl Config { Self::from_config(&ctx.config, &ctx.root, ctx.destination.clone()) } - fn from_config(config: &mdbook::Config, root: &Path, destination: PathBuf) -> Result { + fn from_config( + config: &mdbook_renderer::config::Config, + root: &Path, + destination: PathBuf, + ) -> Result { let angular_renderer_config = config - .get_renderer("angular") - .map_or_else(Default::default, ToOwned::to_owned); - let de_config: DeConfig = toml::Value::from(angular_renderer_config) - .try_into() - .context("Failed to parse mdbook-angular configuration")?; + .get::("output.angular") + .context("Failed to parse mdbook-angular configuration")? + .unwrap_or_default(); let book_source_folder = root.join(&config.book.src); let book_theme_folder = book_source_folder.join("../theme"); - let angular_root_folder = - PathBuf::from(de_config.workdir.unwrap_or("mdbook_angular".to_owned())); + let angular_root_folder = PathBuf::from( + angular_renderer_config + .workdir + .unwrap_or("mdbook_angular".to_owned()), + ); let angular_root_folder = if angular_root_folder.is_absolute() { angular_root_folder } else { @@ -164,8 +169,8 @@ impl Config { let target_folder = destination; - let zoneless = de_config.zoneless.unwrap_or(false); - let mut polyfills = de_config.polyfills.unwrap_or_default(); + let zoneless = angular_renderer_config.zoneless.unwrap_or(false); + let mut polyfills = angular_renderer_config.polyfills.unwrap_or_default(); let zone_polyfill = "zone.js".to_owned(); let has_zone_polyfill = polyfills.contains(&zone_polyfill); @@ -179,16 +184,20 @@ impl Config { } Ok(Config { - builder: de_config.builder, - collapsed: de_config.collapsed.unwrap_or(false), - playgrounds: de_config.playgrounds.unwrap_or(true), - tsconfig: de_config.tsconfig.map(|tsconfig| root.join(tsconfig)), - inline_style_language: de_config.inline_style_language.unwrap_or("css".to_owned()), - optimize: de_config.optimize.unwrap_or(false), + builder: angular_renderer_config.builder, + collapsed: angular_renderer_config.collapsed.unwrap_or(false), + playgrounds: angular_renderer_config.playgrounds.unwrap_or(true), + tsconfig: angular_renderer_config + .tsconfig + .map(|tsconfig| root.join(tsconfig)), + inline_style_language: angular_renderer_config + .inline_style_language + .unwrap_or("css".to_owned()), + optimize: angular_renderer_config.optimize.unwrap_or(false), zoneless, polyfills, - html: de_config.html, + html: angular_renderer_config.html, book_source_folder, book_theme_folder, diff --git a/src/lib.rs b/src/lib.rs index 9b13a89..7dc474f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,7 +6,7 @@ clippy::panic, clippy::semicolon_inside_block, clippy::str_to_string, - clippy::string_to_string, + clippy::implicit_clone, clippy::unnecessary_self_imports, clippy::use_debug )] @@ -27,7 +27,7 @@ pub const MDBOOK_ANGULAR_VERSION: &str = env!("CARGO_PKG_VERSION"); /// /// This crate can be used with any mdbook version that are semver compatible /// with this expected version. -pub const EXPECTED_MDBOOK_VERSION: &str = mdbook::MDBOOK_VERSION; +pub const EXPECTED_MDBOOK_VERSION: &str = mdbook_renderer::MDBOOK_VERSION; use std::{env, fs}; @@ -39,10 +39,8 @@ use log::debug; use log::warn; use markdown::process_markdown; use markdown::ChapterWithCodeBlocks; -use mdbook::{ - renderer::{HtmlHandlebars, RenderContext}, - BookItem, Renderer, -}; +use mdbook_html::HtmlHandlebars; +use mdbook_renderer::{RenderContext, Renderer}; fn validate_version(ctx: &RenderContext) -> Result<()> { let req = semver::VersionReq::parse(EXPECTED_MDBOOK_VERSION).unwrap(); @@ -93,22 +91,20 @@ impl AngularRenderer { let mut chapters_with_codeblocks = Vec::new(); let mut result: Result<()> = Ok(()); - ctx.book.for_each_mut(|item| { + ctx.book.for_each_chapter_mut(|chapter| { if result.is_err() { return; } - if let BookItem::Chapter(chapter) = item { - debug!("Processing chapter {}", &chapter.name); - match process_markdown(&config, chapter) { - Ok(processed) => { - debug!("Processed chapter {}", &chapter.name); - if let Some(processed) = processed { - chapters_with_codeblocks.push(processed); - } + debug!("Processing chapter {}", &chapter.name); + match process_markdown(&config, chapter) { + Ok(processed) => { + debug!("Processed chapter {}", &chapter.name); + if let Some(processed) = processed { + chapters_with_codeblocks.push(processed); } - Err(error) => result = Err(error), } + Err(error) => result = Err(error), } }); diff --git a/src/main.rs b/src/main.rs index 06c08c4..3bf44e9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,8 +7,8 @@ use std::{ use anyhow::{Context, Result}; use log::{warn, LevelFilter}; -use mdbook::renderer::RenderContext; use mdbook_angular::{stop_background_process, AngularRenderer, Config}; +use mdbook_renderer::RenderContext; fn main() -> Result<()> { init_logger(); diff --git a/src/markdown.rs b/src/markdown.rs index 5b781da..c6d7a78 100644 --- a/src/markdown.rs +++ b/src/markdown.rs @@ -11,7 +11,7 @@ use std::{ use anyhow::Context; use handlebars::Handlebars; -use mdbook::book::Chapter; +use mdbook_renderer::book::Chapter; use pathdiff::diff_paths; use pulldown_cmark::{CodeBlockKind, CowStr, Event, Options, Parser, Tag, TagEnd}; use pulldown_cmark_to_cmark::cmark as markdown_to_string; @@ -190,7 +190,7 @@ impl<'a> CodeBlockCollector<'a, '_> { ]); }; - return self.insert_code_block(None, None, language, &code, &Some(&code)); + return self.insert_code_block(None, None, language, &code, Some(&code)); } self.current_code = Some((language, code)); @@ -257,7 +257,7 @@ impl<'a> CodeBlockCollector<'a, '_> { reexport_path.as_deref(), flags.join(","), &contents, - &None, + None, )); let end = match_.end(); @@ -277,7 +277,7 @@ impl<'a> CodeBlockCollector<'a, '_> { reexport_path: Option<&Path>, language: L, code: C, - code_to_print: &Option, + code_to_print: Option<&str>, ) -> ProcessedEvent<'b> { let index = self.code_blocks.len(); let language = language.as_ref(); @@ -298,7 +298,10 @@ impl<'a> CodeBlockCollector<'a, '_> { match self.handlebars.render("playground", &data) { Ok(rendered) => { // println!("got here, {rendered}"); - ProcessedEvent::single(Event::Html(rendered.into())) + ProcessedEvent::multiple(vec![ + Event::HardBreak, + Event::Html(rendered.into()), + ]) } Err(error) => { self.error(error); diff --git a/test-book/book.toml b/test-book/book.toml index 081bd2b..d202a68 100644 --- a/test-book/book.toml +++ b/test-book/book.toml @@ -1,7 +1,6 @@ [book] authors = ["Bram Gotink"] language = "en" -multilingual = false src = "src" title = "Test Angular Book" diff --git a/tests/fixture.rs b/tests/fixture.rs index 1b25969..129e7b6 100644 --- a/tests/fixture.rs +++ b/tests/fixture.rs @@ -6,7 +6,7 @@ use std::{ }; use anyhow::Result; -use assert_cmd::cargo::cargo_bin; +use assert_cmd::cargo; use copy_dir::copy_dir; use select::{document::Document, predicate::*}; use tempfile::TempDir; @@ -30,10 +30,12 @@ impl Fixture { } pub fn run(env: Option>) -> Fixture { - let temp_dir = tempfile::Builder::new() + let mut temp_dir = tempfile::Builder::new() .prefix("mdbook-angular-tests") .tempdir() .expect("failed to create temporary directory"); + println!("Fixture directory {:?}", temp_dir.path()); + temp_dir.disable_cleanup(true); let fixture_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixture"); @@ -59,7 +61,7 @@ impl Fixture { .env_remove("RUST_LOG") .env( "MDBOOK_OUTPUT__ANGULAR__COMMAND", - cargo_bin("mdbook-angular"), + cargo::cargo_bin!("mdbook-angular"), ) .current_dir(&temp_dir) .stdin(Stdio::null()) @@ -77,6 +79,7 @@ impl Fixture { panic!("mdbook build failed"); } + temp_dir.disable_cleanup(false); Fixture(temp_dir) } @@ -123,7 +126,12 @@ impl Chapter { for code in self.0.find(Name("pre").child(Name("code"))) { assert_eq!( value, - code.parent().unwrap().parent().unwrap().is(Name("details")) + code.parent().unwrap().parent().unwrap().is(Name("details")), + "Parent name {} {} \"details\"? ({0} > {} > {})", + code.parent().unwrap().parent().unwrap().name().unwrap(), + if value { "==" } else { "!=" }, + code.parent().unwrap().name().unwrap(), + code.name().unwrap(), ); } } diff --git a/tests/fixture/book.toml b/tests/fixture/book.toml index 3e92940..73d9c10 100644 --- a/tests/fixture/book.toml +++ b/tests/fixture/book.toml @@ -1,7 +1,6 @@ [book] authors = [] language = "en" -multilingual = false src = "src" title = "Integration Test Book"