From dbeab088e3a9ce648eb33303016441cf1674b0c3 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 11 Jul 2024 00:10:41 -0400 Subject: [PATCH] feat: add root cwd setting (#36) --- .github/workflows/ci.generate.ts | 18 +- .github/workflows/ci.yml | 33 +- .github/workflows/release.yml | 2 +- Cargo.lock | 590 ++++++++++++++++--------------- Cargo.toml | 16 +- README.md | 10 +- deployment/schema.json | 22 +- rust-toolchain.toml | 2 +- src/configuration.rs | 53 +-- src/handler.rs | 89 +++-- src/lib.rs | 2 +- tests/tests.rs | 49 ++- 12 files changed, 464 insertions(+), 422 deletions(-) diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts index 8fdad5a..984010d 100644 --- a/.github/workflows/ci.generate.ts +++ b/.github/workflows/ci.generate.ts @@ -1,7 +1,8 @@ import * as yaml from "https://deno.land/std@0.170.0/encoding/yaml.ts"; enum OperatingSystem { - Mac = "macOS-latest", + Macx86 = "macos-12", + MacArm = "macos-latest", Windows = "windows-latest", Linux = "ubuntu-20.04", } @@ -13,12 +14,13 @@ interface ProfileData { } const profileDataItems: ProfileData[] = [{ - os: OperatingSystem.Mac, + os: OperatingSystem.Macx86, target: "x86_64-apple-darwin", runTests: true, }, { - os: OperatingSystem.Mac, + os: OperatingSystem.MacArm, target: "aarch64-apple-darwin", + runTests: true, }, { os: OperatingSystem.Windows, target: "x86_64-pc-windows-msvc", @@ -83,7 +85,7 @@ const ci = { RUST_BACKTRACE: "full", }, steps: [ - { uses: "actions/checkout@v2" }, + { uses: "actions/checkout@v4" }, { uses: "dsherret/rust-toolchain-file@v1" }, { name: "Cache cargo", @@ -119,11 +121,6 @@ const ci = { "rustup target add aarch64-unknown-linux-musl", ].join("\n"), }, - { - name: "Setup (Mac aarch64)", - if: "matrix.config.target == 'aarch64-apple-darwin'", - run: "rustup target add aarch64-apple-darwin", - }, { name: "Build (Debug)", if: "!startsWith(github.ref, 'refs/tags/')", @@ -160,7 +157,8 @@ const ci = { ...profiles.map((profile) => { function getRunSteps() { switch (profile.os) { - case OperatingSystem.Mac: + case OperatingSystem.MacArm: + case OperatingSystem.Macx86: return [ `cd target/${profile.target}/release`, `zip -r ${profile.zipFileName} dprint-plugin-exec`, diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 947c8ab..2845598 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,11 +20,11 @@ jobs: strategy: matrix: config: - - os: macOS-latest + - os: macos-12 run_tests: 'true' target: x86_64-apple-darwin - - os: macOS-latest - run_tests: 'false' + - os: macos-latest + run_tests: 'true' target: aarch64-apple-darwin - os: windows-latest run_tests: 'true' @@ -53,7 +53,7 @@ jobs: CARGO_INCREMENTAL: 0 RUST_BACKTRACE: full steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dsherret/rust-toolchain-file@v1 - name: Cache cargo if: 'startsWith(github.ref, ''refs/tags/'') != true' @@ -78,9 +78,6 @@ jobs: sudo apt install gcc-aarch64-linux-gnu sudo apt install musl musl-dev musl-tools rustup target add aarch64-unknown-linux-musl - - name: Setup (Mac aarch64) - if: matrix.config.target == 'aarch64-apple-darwin' - run: rustup target add aarch64-apple-darwin - name: Build (Debug) if: '!startsWith(github.ref, ''refs/tags/'')' env: @@ -229,8 +226,6 @@ jobs: run: 'echo "::set-output name=CHECKSUM::$(shasum -a 256 plugin.json | awk ''{print $1}'')"' - name: Update Config Schema Version run: 'sed -i ''s/exec\/0.0.0/exec\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/'' deployment/schema.json' - - name: Create release notes - run: deno run -A ./scripts/generate_release_notes.ts ${{ steps.get_tag_version.outputs.TAG_VERSION }} ${{ steps.get_plugin_file_checksum.outputs.CHECKSUM }} > ${{ github.workspace }}-CHANGELOG.txt - name: Release uses: softprops/action-gh-release@v1 env: @@ -246,5 +241,23 @@ jobs: dprint-plugin-exec-aarch64-unknown-linux-musl.zip plugin.json deployment/schema.json - body_path: ${{ github.workspace }}-CHANGELOG.txt + body: |- + ## Install + + Dependencies: + + - Install dprint's CLI >= 0.40.0 + + In a dprint configuration file: + + 1. Specify the plugin url and checksum in the `"plugins"` array or run `dprint config add exec`: + ```jsonc + { + // etc... + "plugins": [ + "https://plugins.dprint.dev/exec-${{ steps.get_tag_version.outputs.TAG_VERSION }}.json@${{ steps.get_plugin_file_checksum.outputs.CHECKSUM }}" + ] + } + ``` + 2. Follow the configuration setup instructions found at https://github.com/dprint/dprint-plugin-exec#configuration draft: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c83c600..2eb564f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Clone repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: token: ${{ secrets.GH_DPRINTBOT_PAT }} diff --git a/Cargo.lock b/Cargo.lock index 73d3da0..21e0f4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -17,43 +17,61 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + [[package]] name = "anyhow" -version = "1.0.72" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "async-trait" -version = "0.1.72" +version = "0.1.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -66,36 +84,24 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.3.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" -version = "0.7.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "block-padding", - "byte-tools", - "byteorder", "generic-array", ] -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - [[package]] name = "bstr" -version = "1.7.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" dependencies = [ "memchr", "serde", @@ -103,36 +109,24 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +dependencies = [ + "allocator-api2", +] [[package]] name = "bytes" -version = "1.1.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.83" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" [[package]] name = "cfg-if" @@ -142,63 +136,89 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "console" -version = "0.15.7" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" dependencies = [ "encode_unicode", "lazy_static", "libc", "unicode-width", - "windows-sys 0.45.0", + "windows-sys", +] + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", ] [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.8" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "cfg-if", - "lazy_static", + "generic-array", + "typenum", +] + +[[package]] +name = "deno_terminal" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e6337d4e7f375f8b986409a76fbeecfa4bd8a1343e63355729ae4befa058eaf" +dependencies = [ + "once_cell", + "termcolor", ] [[package]] name = "diff" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" [[package]] name = "digest" -version = "0.8.1" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "generic-array", + "block-buffer", + "crypto-common", ] [[package]] name = "dprint-core" -version = "0.63.3" +version = "0.67.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7227b28d24aafee21ff72512336c797fa00bb3ea803186b1b105a68abc97660b" +checksum = "2309841cd79a9c60d2976f46b2df63d9a1a52211a3c62424e1e105b52dd5c436" dependencies = [ "anyhow", "async-trait", "bumpalo", "crossbeam-channel", "futures", + "hashbrown", "indexmap", "libc", "parking_lot", @@ -213,12 +233,13 @@ dependencies = [ [[package]] name = "dprint-development" -version = "0.9.5" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2502cba4299d334fc11a8a3357eb459f378dc285d7fbbb365c595a0ce48c73" +checksum = "12bc835c6195bc3bd68ccc71b86ccb33cc2e9253cfc875bc371acea1ff034268" dependencies = [ "anyhow", "console", + "file_test_runner", "serde_json", "similar", ] @@ -252,22 +273,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fnv" -version = "1.0.7" +name = "file_test_runner" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +checksum = "d5eedfda6f865129a89c9cf35dc8203aaed94adf3ac42c2d8d7769ac32ca290d" +dependencies = [ + "anyhow", + "crossbeam-channel", + "deno_terminal", + "parking_lot", + "regex", + "thiserror", +] [[package]] name = "futures" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -280,9 +303,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -290,15 +313,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -307,38 +330,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -354,37 +377,38 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.12.4" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", + "version_check", ] [[package]] name = "gimli" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "globset" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" +checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" dependencies = [ "aho-corasick", "bstr", - "fnv", "log", - "regex", + "regex-automata", + "regex-syntax", ] [[package]] name = "handlebars" -version = "4.4.0" +version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39b3bc2a8f715298032cf5087e58573809374b08160aa7d750582bdb82d2683" +checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b" dependencies = [ "log", "pest", @@ -396,15 +420,19 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] [[package]] name = "indexmap" -version = "2.0.2" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", @@ -413,81 +441,73 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "lock_api" -version = "0.4.6" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ + "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "maplit" -version = "1.0.2" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] [[package]] name = "object" -version = "0.32.1" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" dependencies = [ "memchr", ] [[package]] -name = "opaque-debug" -version = "0.2.3" +name = "once_cell" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -495,31 +515,33 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.1" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys 0.32.0", + "windows-targets", ] [[package]] name = "pest" -version = "2.1.3" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" dependencies = [ + "memchr", + "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.1.0" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +checksum = "2a548d2beca6773b1c244554d36fcf8548a8a58e74156968211567250e48e49a" dependencies = [ "pest", "pest_generator", @@ -527,33 +549,33 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.1.3" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" +checksum = "3c93a82e8d145725dcbaf44e5ea887c8a869efdcc28706df2d08c69e17077183" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 1.0.103", + "syn", ] [[package]] name = "pest_meta" -version = "2.1.3" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" +checksum = "a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f" dependencies = [ - "maplit", + "once_cell", "pest", - "sha-1", + "sha2", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -573,36 +595,36 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.32" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.10.2" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", @@ -612,9 +634,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", @@ -623,15 +645,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" @@ -641,41 +663,41 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.178" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60363bdd39a7be0266a520dab25fdc9241d2f987b08a01e01f0ec6d06a981348" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.178" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28482318d6641454cb273da158647922d1be6b5a2fcc6165cd89ebdd7ed576b" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn", ] [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.120" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" dependencies = [ "indexmap", "itoa", @@ -684,37 +706,36 @@ dependencies = [ ] [[package]] -name = "sha-1" -version = "0.8.2" +name = "sha2" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "block-buffer", + "cfg-if", + "cpufeatures", "digest", - "fake-simd", - "opaque-debug", ] [[package]] name = "similar" -version = "2.2.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" +checksum = "fa42c91313f1d05da9b26f267f931cf178d4aba455b4c4622dd7355eb80c6640" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.8.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "splitty" @@ -724,9 +745,9 @@ checksum = "8dae68aa5bd5dc2d3a2137b0f6bcdd8255dce1983dc155fe0246572e179c9c3a" [[package]] name = "syn" -version = "1.0.103" +version = "2.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" dependencies = [ "proc-macro2", "quote", @@ -734,41 +755,39 @@ dependencies = [ ] [[package]] -name = "syn" -version = "2.0.27" +name = "termcolor" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 1.0.103", + "syn", ] [[package]] name = "tokio" -version = "1.33.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "pin-project-lite", @@ -777,20 +796,20 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn", ] [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", @@ -801,27 +820,33 @@ dependencies = [ [[package]] name = "typenum" -version = "1.15.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" -version = "0.1.3" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + +[[package]] +name = "version_check" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "winapi" @@ -840,122 +865,115 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +name = "winapi-util" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys", +] [[package]] -name = "windows-sys" -version = "0.32.0" +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" -dependencies = [ - "windows_aarch64_msvc 0.32.0", - "windows_i686_gnu 0.32.0", - "windows_i686_msvc 0.32.0", - "windows_x86_64_gnu 0.32.0", - "windows_x86_64_msvc 0.32.0", -] +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.45.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.2", + "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.32.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_i686_gnu" -version = "0.32.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] -name = "windows_i686_msvc" -version = "0.32.0" +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.32.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" +name = "windows_x86_64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" +name = "windows_x86_64_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "windows_x86_64_msvc" -version = "0.32.0" +name = "yansi" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" +name = "zerocopy" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] [[package]] -name = "yansi" -version = "0.5.1" +name = "zerocopy-derive" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index 3941532..c8d8898 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,15 +18,15 @@ overflow-checks = false panic = "abort" [dependencies] -anyhow = "1.0.68" -dprint-core = { version = "0.63.3", features = ["process"] } -globset = "0.4.13" -handlebars = "4.4.0" -serde = { version = "1.0.147", features = ["derive"] } +anyhow = "1.0.86" +dprint-core = { version = "0.67.0", features = ["process"] } +globset = "0.4.14" +handlebars = "5.1.2" +serde = { version = "1.0.204", features = ["derive"] } splitty = "1.0.1" -tokio = { version = "1.33.0", features = ["time"] } +tokio = { version = "1.38.0", features = ["time"] } [dev-dependencies] -dprint-development = "0.9.5" +dprint-development = "0.10.1" pretty_assertions = "1.4.0" -serde_json = "1.0.107" +serde_json = "1.0.120" diff --git a/README.md b/README.md index addecaf..11b0a5f 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,13 @@ This plugin executes CLI commands to format code via stdin (recommended) or via "lineWidth": 120, "indentWidth": 2, "useTabs": false, - "newLineKind": "lf", "cacheKey": "1", "timeout": 30, + // you may need to set this for when the dprint executable has a different + // cwd than this configuration file (see https://dprint.dev/config/#configuration-variables) + "cwd": "${configDir}", + // now define your commands, for example... "commands": [{ "command": "rustfmt", @@ -48,6 +51,7 @@ General config: - `cacheKey` - Optional value used to bust dprint's incremental cache (ex. provide `"1"`). This is useful if you want to force formatting to occur because the underlying command's code has changed. - `timeout` - Number of seconds to allow an executable format to occur before a timeout error occurs (default: `30`). +- `cwd` - Recommend setting this to `${configDir}` to force it to use the cwd of the current config file. Command config: @@ -57,7 +61,7 @@ Command config: - `associations` - File patterns to format with this command. If specified, then you MUST specify associations on this plugin's config as well. - You may have associations match multiple binaries in order to format a file with multiple binaries instead of just one. The order in the config file will dictate the order the formatting occurs in. - `stdin` - If the text should be provided via stdin (default: `true`) -- `cwd` - Current working directory to use when launching this command (default: dprint's cwd) +- `cwd` - Current working directory to use when launching this command (default: dprint's cwd or the root `cwd` setting if set) Command templates (ex. see the prettier example above): @@ -74,6 +78,7 @@ Command templates (ex. see the prettier example above): { // ...etc... "exec": { + "cwd": "${configDir}", "commands": [{ "command": "yapf", "exts": ["py"] @@ -111,6 +116,7 @@ Use the `rustfmt` binary so you can format stdin. // ...etc... "exec": { "commands": [{ + "cwd": "${configDir}", "command": "rustfmt --edition 2021", "exts": ["rs"] }] diff --git a/deployment/schema.json b/deployment/schema.json index edde7ed..ad3fb4b 100644 --- a/deployment/schema.json +++ b/deployment/schema.json @@ -30,24 +30,6 @@ "description": "" }] }, - "newLineKind": { - "description": "The kind of newline to use.", - "type": "string", - "default": "lf", - "oneOf": [{ - "const": "auto", - "description": "For each file, uses the newline kind found at the end of the last line." - }, { - "const": "crlf", - "description": "Uses carriage return, line feed." - }, { - "const": "lf", - "description": "Uses line feed." - }, { - "const": "system", - "description": "Uses the system standard (ex. crlf on Windows)." - }] - }, "associations": { "description": "Glob pattern that associates this plugin with certain file paths (ex. \"**/*.{rs,java,py}\").", "anyOf": [{ @@ -65,6 +47,10 @@ "description": "Optional value used to bust dprint's incremental cache (ex. provide \"1\"). This is useful if you want to force formatting to occur because the underlying command has changed.", "type": "string" }, + "cwd": { + "type": "string", + "description": "The current working directory to launch all executables with." + }, "timeout": { "description": "Number of seconds to allow a format to progress before a timeout error occurs.", "type": "number", diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 3c4b81e..93c0233 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.73.0" +channel = "1.79.0" components = ["clippy", "rustfmt"] diff --git a/src/configuration.rs b/src/configuration.rs index 040194b..3708dd8 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -5,7 +5,6 @@ use dprint_core::configuration::ConfigKeyMap; use dprint_core::configuration::ConfigKeyValue; use dprint_core::configuration::ConfigurationDiagnostic; use dprint_core::configuration::GlobalConfiguration; -use dprint_core::configuration::NewLineKind; use dprint_core::configuration::ResolveConfigurationResult; use dprint_core::configuration::RECOMMENDED_GLOBAL_CONFIGURATION; use globset::GlobMatcher; @@ -24,7 +23,6 @@ pub struct Configuration { pub line_width: u32, pub use_tabs: bool, pub indent_width: u8, - pub new_line_kind: NewLineKind, /// Formatting commands to run pub commands: Vec, pub timeout: u32, @@ -124,19 +122,13 @@ impl Configuration { .unwrap_or(RECOMMENDED_GLOBAL_CONFIGURATION.indent_width), &mut diagnostics, ), - new_line_kind: get_value( - &mut config, - "newLineKind", - global_config - .new_line_kind - .unwrap_or(RECOMMENDED_GLOBAL_CONFIGURATION.new_line_kind), - &mut diagnostics, - ), commands: Vec::new(), timeout: get_value(&mut config, "timeout", 30, &mut diagnostics), }; - if let Some(commands) = config.remove("commands").and_then(|c| c.into_array()) { + let root_cwd = get_nullable_value(&mut config, "cwd", &mut diagnostics); + + if let Some(commands) = config.swap_remove("commands").and_then(|c| c.into_array()) { for (i, element) in commands.into_iter().enumerate() { let Some(command_obj) = element.into_object() else { diagnostics.push(ConfigurationDiagnostic { @@ -145,7 +137,7 @@ impl Configuration { }); continue; }; - let result = parse_command_obj(command_obj); + let result = parse_command_obj(command_obj, root_cwd.as_ref()); diagnostics.extend(result.1.into_iter().map(|mut diagnostic| { diagnostic.property_name = format!("commands[{}].{}", i, diagnostic.property_name); diagnostic @@ -174,6 +166,7 @@ impl Configuration { fn parse_command_obj( mut command_obj: ConfigKeyMap, + root_cwd: Option<&String>, ) -> (Option, Vec) { let mut diagnostics = Vec::new(); let mut command = splitty::split_unquoted_whitespace(&get_value( @@ -212,7 +205,7 @@ fn parse_command_obj( executable: command.remove(0), args: command, associations: { - let maybe_value = command_obj.remove("associations").and_then(|value| match value { + let maybe_value = command_obj.swap_remove("associations").and_then(|value| match value { ConfigKeyValue::String(value) => Some(value), ConfigKeyValue::Array(mut value) => match value.len() { 0 => None, @@ -259,11 +252,10 @@ fn parse_command_obj( } }) }, - cwd: get_cwd(get_nullable_value( - &mut command_obj, - "cwd", - &mut diagnostics, - )), + cwd: get_cwd( + get_nullable_value(&mut command_obj, "cwd", &mut diagnostics) + .or_else(|| root_cwd.map(ToOwned::to_owned)), + ), stdin: get_value(&mut command_obj, "stdin", true, &mut diagnostics), file_extensions: take_string_or_string_vec(&mut command_obj, "exts", &mut diagnostics) .into_iter() @@ -300,7 +292,7 @@ fn take_string_or_string_vec( diagnostics: &mut Vec, ) -> Vec { command_obj - .remove(key) + .swap_remove(key) .map(|values| match values { ConfigKeyValue::String(value) => vec![value], ConfigKeyValue::Array(elements) => { @@ -326,7 +318,7 @@ fn take_string_or_string_vec( vec![] } }) - .unwrap_or_else(Vec::new) + .unwrap_or_default() } fn get_cwd(dir: Option) -> PathBuf { @@ -341,7 +333,6 @@ mod tests { use super::*; use dprint_core::configuration::resolve_global_config; use dprint_core::configuration::ConfigKeyValue; - use dprint_core::configuration::NewLineKind; use pretty_assertions::assert_eq; use serde_json::json; @@ -350,14 +341,12 @@ mod tests { let mut global_config = ConfigKeyMap::from([ ("lineWidth".to_string(), ConfigKeyValue::from_i32(80)), ("indentWidth".to_string(), ConfigKeyValue::from_i32(8)), - ("newLineKind".to_string(), ConfigKeyValue::from_str("crlf")), ("useTabs".to_string(), ConfigKeyValue::from_bool(true)), ]); let global_config = resolve_global_config(&mut global_config).config; let config = Configuration::resolve(ConfigKeyMap::new(), &global_config).config; assert_eq!(config.line_width, 80); assert_eq!(config.indent_width, 8); - assert_eq!(config.new_line_kind, NewLineKind::CarriageReturnLineFeed); assert!(config.use_tabs); } @@ -371,7 +360,6 @@ mod tests { let config = result.config; assert_eq!(config.line_width, 120); assert_eq!(config.indent_width, 2); - assert_eq!(config.new_line_kind, NewLineKind::LineFeed); assert!(!config.use_tabs); assert_eq!(config.cache_key, "2"); assert_eq!(config.timeout, 5); @@ -397,6 +385,23 @@ mod tests { ) } + #[test] + fn cwd_test() { + let unresolved_config = parse_config(json!({ + "cwd": "test-cwd", + "commands": [{ + "command": "1" + }, { + "cwd": "test-cwd2", + "command": "1" + }] + })); + let result = Configuration::resolve(unresolved_config, &Default::default()); + let config = result.config; + assert_eq!(config.commands[0].cwd, PathBuf::from("test-cwd")); + assert_eq!(config.commands[1].cwd, PathBuf::from("test-cwd2")); + } + #[test] fn handle_associations_value() { let unresolved_config = parse_config(json!({ diff --git a/src/handler.rs b/src/handler.rs index 6133f82..9b067ff 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -1,6 +1,4 @@ use std::borrow::Cow; -use std::io::BufRead; -use std::io::BufReader; use std::io::Write; use std::ops::Deref; use std::ops::DerefMut; @@ -18,10 +16,8 @@ use anyhow::Error; use anyhow::Result; use dprint_core::async_runtime::async_trait; use dprint_core::async_runtime::LocalBoxFuture; -use dprint_core::configuration::resolve_new_line_kind; use dprint_core::configuration::ConfigKeyMap; use dprint_core::configuration::GlobalConfiguration; -use dprint_core::configuration::NewLineKind; use dprint_core::plugins::AsyncPluginHandler; use dprint_core::plugins::CancellationToken; use dprint_core::plugins::FileMatchingInfo; @@ -128,9 +124,9 @@ impl AsyncPluginHandler for ExecHandler { return Ok(None); } - format_text( + format_bytes( request.file_path, - request.file_text, + request.file_bytes, request.config, request.token.clone(), ) @@ -138,13 +134,36 @@ impl AsyncPluginHandler for ExecHandler { } } -pub async fn format_text( +pub async fn format_bytes( file_path: PathBuf, - original_file_text: String, + original_file_bytes: Vec, config: Arc, token: Arc, ) -> FormatResult { - let mut file_text: Cow = Cow::Borrowed(&original_file_text); + fn trim_bytes_len(bytes: &[u8]) -> usize { + let mut start = 0; + let mut end = bytes.len(); + + while start < end && bytes[start].is_ascii_whitespace() { + start += 1; + } + + if start == end { + return 0; + } + + while end > start && bytes[end - 1].is_ascii_whitespace() { + end -= 1; + } + + if end < start { + 0 + } else { + end - start + } + } + + let mut file_bytes: Cow> = Cow::Borrowed(&original_file_bytes); for command in select_commands(&config, &file_path)? { // format here let args = maybe_substitute_variables(&file_path, &config, command); @@ -168,9 +187,8 @@ pub async fn format_text( let (out_tx, out_rx) = oneshot::channel(); let mut handles = Vec::with_capacity(2); if let Some(stdout) = child.stdout.take() { - let eol = resolve_new_line_kind(&file_text, config.new_line_kind); handles.push(dprint_core::async_runtime::spawn_blocking(|| { - read_stream_lines(stdout, eol, out_tx) + read_stream_lines(stdout, out_tx) })); } else { let _ = child.kill(); @@ -180,9 +198,8 @@ pub async fn format_text( // capturing stderr let (err_tx, err_rx) = oneshot::channel(); if let Some(stderr) = child.stderr.take() { - let system_eol = resolve_new_line_kind(&file_text, NewLineKind::System); handles.push(dprint_core::async_runtime::spawn_blocking(|| { - read_stream_lines(stderr, system_eol, err_tx) + read_stream_lines(stderr, err_tx) })); } @@ -196,10 +213,10 @@ pub async fn format_text( "Cannot open the command's stdin. Perhaps you meant to set the command's \"stdin\" configuration to false?", ) })?; - let file_text = file_text.to_string(); + let file_bytes = file_bytes.into_owned(); dprint_core::async_runtime::spawn_blocking(move || { stdin - .write_all(file_text.as_bytes()) + .write_all(&file_bytes) .map_err(|err| anyhow!("Cannot write into the command's stdin. {}", err)) }) .await??; @@ -235,15 +252,17 @@ pub async fn format_text( } result = result_future => { let (ok_text, exit_status) = result?; - file_text = Cow::Owned(handle_child_exit_status(ok_text, err_rx, exit_status).await?) + file_bytes = Cow::Owned(handle_child_exit_status(ok_text, err_rx, exit_status).await?) } } } const MIN_CHARS_TO_EMPTY: usize = 100; - Ok(if file_text == original_file_text { + Ok(if *file_bytes == original_file_bytes { None - } else if original_file_text.trim().len() > MIN_CHARS_TO_EMPTY && file_text.trim().is_empty() { + } else if trim_bytes_len(&original_file_bytes) > MIN_CHARS_TO_EMPTY + && trim_bytes_len(&file_bytes) == 0 + { // prevent someone formatting all their files to empty files bail!( concat!( @@ -253,7 +272,7 @@ pub async fn format_text( MIN_CHARS_TO_EMPTY ) } else { - Some(file_text.to_string()) + Some(file_bytes.into_owned()) }) } @@ -282,19 +301,21 @@ fn select_commands<'a>( } async fn handle_child_exit_status( - ok_text: String, - err_rx: Receiver, + ok_text: Vec, + err_rx: Receiver>, exit_status: ExitStatus, -) -> Result { +) -> Result, Error> { if exit_status.success() { return Ok(ok_text); } Err(anyhow!( "Child process exited with code {}: {}", exit_status.code().unwrap(), - err_rx - .await - .expect("Could not propagate error message from child process") + String::from_utf8_lossy( + &err_rx + .await + .expect("Could not propagate error message from child process") + ) )) } @@ -305,17 +326,13 @@ fn timeout_err(config: &Configuration) -> Error { ) } -fn read_stream_lines(readable: R, eol: &str, sender: Sender) -> Result<(), Error> +fn read_stream_lines(mut readable: R, sender: Sender>) -> Result<(), Error> where R: std::io::Read + Unpin, { - let mut reader = BufReader::new(readable).lines(); - let mut formatted = String::new(); - while let Some(line) = reader.next() { - formatted.push_str(line?.as_str()); - formatted.push_str(eol); - } - let _ignore = sender.send(formatted); // ignore error as that means the other end is closed + let mut bytes = Vec::new(); + readable.read_to_end(&mut bytes)?; + let _ignore = sender.send(bytes); // ignore error as that means the other end is closed Ok(()) } @@ -364,7 +381,7 @@ mod test { use dprint_core::plugins::NullCancellationToken; use crate::configuration::Configuration; - use crate::format_text; + use crate::format_bytes; #[tokio::test] async fn should_error_output_empty_file() { @@ -377,9 +394,9 @@ mod test { }"#; let unresolved_config = serde_json::from_str(unresolved_config).unwrap(); let config = Configuration::resolve(unresolved_config, &Default::default()).config; - let result = format_text( + let result = format_bytes( PathBuf::from("path.txt"), - "1".repeat(101), + "1".repeat(101).into_bytes(), Arc::new(config), token, ) diff --git a/src/lib.rs b/src/lib.rs index 0128410..a7e3559 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,4 +6,4 @@ pub mod handler; #[cfg(feature = "process")] pub use main::*; -pub use handler::format_text; +pub use handler::format_bytes; diff --git a/tests/tests.rs b/tests/tests.rs index 5de5e63..47e4fad 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -29,32 +29,31 @@ fn test_specs() { fix_failures: false, format_twice: true, }, - { - move |file_name, file_text, spec_config| { - let map: ConfigKeyMap = serde_json::from_value(spec_config.clone().into()).unwrap(); - let config_result = Configuration::resolve(map, &Default::default()); - ensure_no_diagnostics(&config_result.diagnostics); + Arc::new(move |file_name, file_text, spec_config| { + let map: ConfigKeyMap = serde_json::from_value(spec_config.clone().into()).unwrap(); + let config_result = Configuration::resolve(map, &Default::default()); + ensure_no_diagnostics(&config_result.diagnostics); - let mut file = file_name.to_path_buf(); - let mut td = tests_dir.clone(); - if !file_name.ends_with(Path::new("default.txt")) { - td.push(file_name); - file = td.clone(); - } - - eprintln!("{}", file_name.display()); - let file_text = file_text.to_string(); - handle.block_on(async { - dprint_plugin_exec::handler::format_text( - file, - file_text, - Arc::new(config_result.config), - Arc::new(dprint_core::plugins::NullCancellationToken), - ) - .await - }) + let mut file = file_name.to_path_buf(); + let mut td = tests_dir.clone(); + if !file_name.ends_with(Path::new("default.txt")) { + td.push(file_name); + file = td.clone(); } - }, - move |_file_name, _file_text, _spec_config| panic!("Not supported."), + + eprintln!("{}", file_name.display()); + let file_text = file_text.to_string(); + handle.block_on(async { + dprint_plugin_exec::handler::format_bytes( + file, + file_text.into_bytes(), + Arc::new(config_result.config), + Arc::new(dprint_core::plugins::NullCancellationToken), + ) + .await + .map(|maybe_bytes| maybe_bytes.map(|bytes| String::from_utf8(bytes).unwrap())) + }) + }), + Arc::new(move |_file_name, _file_text, _spec_config| panic!("Not supported.")), ) }