diff --git a/24.10/flat/Cargo.lock b/24.10/flat/Cargo.lock new file mode 100644 index 00000000..15c068e9 --- /dev/null +++ b/24.10/flat/Cargo.lock @@ -0,0 +1,1553 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +dependencies = [ + "anstyle", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide 0.8.0", + "object", + "rustc-demangle", + "windows-targets", +] + +[[package]] +name = "base64-simd" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "781dd20c3aff0bd194fe7d2a977dd92f21c173891f3a03b677359e5fa457e5d5" +dependencies = [ + "simd-abstraction", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bindgen" +version = "0.69.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", + "which 4.4.2", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" + +[[package]] +name = "cc" +version = "1.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" +dependencies = [ + "shlex", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clap" +version = "4.5.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.5.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + +[[package]] +name = "cooked-waker" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147be55d677052dabc6b22252d5dd0fd4c29c8c27aa4f2fbef0f94aa003b406f" + +[[package]] +name = "copy_dir" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "543d1dd138ef086e2ff05e3a48cf9da045da2033d16f8538fd76b86cd49b2ca3" +dependencies = [ + "walkdir", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "serde", + "uuid", +] + +[[package]] +name = "deno_core" +version = "0.314.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fcd11ab87426c611b7170138a768dad7170c8fb66d8095b773d25e58fd254ea" +dependencies = [ + "anyhow", + "bincode", + "bit-set", + "bit-vec", + "bytes", + "cooked-waker", + "deno_core_icudata", + "deno_ops", + "deno_unsync", + "futures", + "libc", + "memoffset", + "parking_lot", + "percent-encoding", + "pin-project", + "serde", + "serde_json", + "serde_v8", + "smallvec", + "sourcemap", + "static_assertions", + "tokio", + "url", + "v8", +] + +[[package]] +name = "deno_core_icudata" +version = "0.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13951ea98c0a4c372f162d669193b4c9d991512de9f2381dd161027f34b26b1" + +[[package]] +name = "deno_ops" +version = "0.190.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a48a3e06cace18a2c49e148da067678c6af80e70757a8c3991301397cf6b9919" +dependencies = [ + "proc-macro-rules", + "proc-macro2", + "quote", + "strum", + "strum_macros", + "syn", + "thiserror", +] + +[[package]] +name = "deno_unsync" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f36b4ef61a04ce201b925a5dffa90f88437d37fee4836c758470dd15ba7f05e" +dependencies = [ + "parking_lot", + "tokio", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "flat" +version = "0.1.0" +dependencies = [ + "clap", + "deno_core", + "quick-js", + "rand", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fslock" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04412b8935272e3a9bae6f48c7bfff74c2911f60525404edfdd28e49884c3bfb" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "gzip-header" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95cc527b92e6029a62960ad99aa8a6660faa4555fe5f731aab13aa6a921795a2" +dependencies = [ + "crc32fast", +] + +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "if_chain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.159" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" + +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if", + "windows-targets", +] + +[[package]] +name = "libquickjs-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f0b24e9bd171b75ae0295bd428fb8fe58410fb23156e5f34a4657a70c3cee96" +dependencies = [ + "cc", + "copy_dir", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi", + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", + "rand", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "outref" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f222829ae9293e33a9f5e9f440c6760a3d450a64affe1846486b140db81c1f4" + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro-rules" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07c277e4e643ef00c1233393c673f655e3672cf7eb3ba08a00bdd0ea59139b5f" +dependencies = [ + "proc-macro-rules-macros", + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro-rules-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "207fffb0fe655d1d47f6af98cc2793405e85929bdbc420d685554ff07be27ac7" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-js" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19cb4cefcb00f4ab9b332664d06005a74f582ac16aa959c6ad5912957bd83e5f" +dependencies = [ + "libquickjs-sys", + "once_cell", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustversion" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "indexmap", + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_v8" +version = "0.223.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c127bb9f2024433d06789b242477c808fd7f7dc4c3278576dd5bc99c4e5c75ff" +dependencies = [ + "num-bigint", + "serde", + "smallvec", + "thiserror", + "v8", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "simd-abstraction" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cadb29c57caadc51ff8346233b5cec1d240b68ce55cf1afc764818791876987" +dependencies = [ + "outref", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "sourcemap" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "208d40b9e8cad9f93613778ea295ed8f3c2b1824217c6cfc7219d3f6f45b96d4" +dependencies = [ + "base64-simd", + "bitvec", + "data-encoding", + "debugid", + "if_chain", + "rustc-hash", + "rustc_version", + "serde", + "serde_json", + "unicode-id-start", + "url", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + +[[package]] +name = "syn" +version = "2.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "thiserror" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" + +[[package]] +name = "unicode-id-start" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97e2a3c5fc9de285c0e805d98eba666adb4b2d9e1049ce44821ff7707cc34e91" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" + +[[package]] +name = "v8" +version = "0.106.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a381badc47c6f15acb5fe0b5b40234162349ed9d4e4fd7c83a7f5547c0fc69c5" +dependencies = [ + "bindgen", + "bitflags", + "fslock", + "gzip-header", + "home", + "miniz_oxide 0.7.4", + "once_cell", + "paste", + "which 6.0.3", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + +[[package]] +name = "which" +version = "6.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f" +dependencies = [ + "either", + "home", + "rustix", + "winsafe", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winsafe" +version = "0.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/24.10/flat/Cargo.toml b/24.10/flat/Cargo.toml new file mode 100644 index 00000000..6eebd513 --- /dev/null +++ b/24.10/flat/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "flat" +version = "0.1.0" +edition = "2021" + +[profile.release] +lto = true +opt-level = 'z' + +[dependencies] +clap = { version = "4.5.20" } +deno_core = "0.314.1" +quick-js = "0.4.1" +rand = "0.8.5" diff --git a/24.10/flat/Dockerfile b/24.10/flat/Dockerfile new file mode 100644 index 00000000..5faffd92 --- /dev/null +++ b/24.10/flat/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:20.04 + +RUN apt-get update && \ + apt-get install -y curl build-essential + +# 安装Rustup和Rust工具链 +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" + +WORKDIR /project + +COPY . /project + +RUN cargo build --release \ No newline at end of file diff --git a/24.10/flat/src/main.rs b/24.10/flat/src/main.rs new file mode 100644 index 00000000..d23c4fe2 --- /dev/null +++ b/24.10/flat/src/main.rs @@ -0,0 +1,100 @@ +mod test; +use clap::{Arg, Command}; +use deno_core::JsRuntime; +use deno_core::RuntimeOptions; +use std::fs::File; +use std::io::{self, BufRead, BufReader}; + +fn main() { + // 定义参数形式为 flat [option] function [file] + let matches = Command::new("Flat") + .version("1.0") + .author("Your Name ") + .about("Processes lines of input with JavaScript") + .arg( + Arg::new("begin") + .short('b') + .long("begin") + .help("JavaScript code to execute before processing any lines") + .value_parser(clap::builder::ValueParser::string()), + ) + .arg( + Arg::new("end") + .short('e') + .long("end") + .help("JavaScript code to execute after processing all lines") + .value_parser(clap::builder::ValueParser::string()), + ) + .arg( + Arg::new("function") + .help("JavaScript code to process each line, l is the origin string") + .required(true) + .index(1), + ) + .arg( + Arg::new("file") + .help("Path to the input file. If not provided, reads from stdin.") + .index(2), + ) + .get_matches(); + + let begin_code = matches.get_one::("begin"); + let end_code = matches.get_one::("end").cloned(); + let js_function = matches.get_one::("function").unwrap(); + let file_path = matches.get_one::("file"); + + // 创建JavaScript 执行上下文 + let mut runtime = JsRuntime::new(RuntimeOptions::default()); + + // 创建全局变量 + runtime + .execute_script("", "var ctx = {}, n1=0, n2=0, n3=0, s='', arr=[];") + .expect("Eval failed"); + // 执行begin的代码块,如果有的话 + if let Some(code) = begin_code { + runtime + .execute_script("", code.to_string()) + .expect("Eval failed"); + } + + // 逐行读取文件或者管道内容 + let input: Box = if let Some(path) = file_path { + Box::new(BufReader::new( + File::open(path).expect("Failed to open file"), + )) + } else { + Box::new(io::stdin().lock()) + }; + let mut vec = vec![]; + for line in input.lines() { + let line = line.unwrap(); + let line = line.replace("'", "\\'"); + vec.push(line.to_string()); + // 先扔到数组里,每200行,处理一次 + if vec.len() == 200 { + eval(&mut vec, &mut runtime, &js_function); + } + } + if !vec.is_empty() { + eval(&mut vec, &mut runtime, &js_function); + } + // Execute end code if provided + if let Some(code) = end_code { + runtime.execute_script("", code).expect("Eval failed"); + } +} + +fn eval(vec: &mut Vec, runtime: &mut JsRuntime, js_function: &str) { + let mut func = "var ls = [".to_string(); + for ele in vec.iter() { + func.push_str("'"); + func.push_str(ele); + func.push_str("', ") + } + func.push_str("];"); + vec.clear(); + + func.push_str(&format!("ls.forEach(l=>{{ {} }})", js_function)); + let func = format!("{{ {} }}", func); + runtime.execute_script("", func).expect("Eval failed"); +} diff --git a/24.10/flat/src/test.rs b/24.10/flat/src/test.rs new file mode 100644 index 00000000..5dee3b5a --- /dev/null +++ b/24.10/flat/src/test.rs @@ -0,0 +1,46 @@ +use rand::{thread_rng, Rng}; +use std::fs::OpenOptions; +use std::io::Write; + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn write_rand_file() { + // 设置要写入的文件名 + let filename = "output.txt"; + + // 打开文件以进行追加 + let mut file = OpenOptions::new() + .append(true) + .create(true) + .open(filename) + .expect("无法打开文件"); + + // 创建一个随机数生成器 + let mut rng = thread_rng(); + + // 生成1000行随机字符串 + for _ in 0..1000 { + let length = rng.gen_range(1..=100); // 随机生成1到100之间的长度 + let random_string = generate_random_string(length); + writeln!(file, "{}", random_string).expect("写入文件时出错"); + } + + println!("成功向文件中追加了1000行数据。"); + } + // 生成随机字符串 + fn generate_random_string(length: usize) -> String { + // 字母和数字的集合 + const CHARSET: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + let mut rng = thread_rng(); + + // 随机选择字符并构建字符串 + (0..length) + .map(|_| { + let idx = rng.gen_range(0..CHARSET.len()); + CHARSET[idx] as char + }) + .collect() + } +} diff --git "a/24.10/js\350\257\255\346\263\225\347\232\204awk.md" "b/24.10/js\350\257\255\346\263\225\347\232\204awk.md" new file mode 100644 index 00000000..039a0c81 --- /dev/null +++ "b/24.10/js\350\257\255\346\263\225\347\232\204awk.md" @@ -0,0 +1,603 @@ +--- +title: js语法的awk +date: 2024-10-16 20:06:00 +tags: + - awk + - cli + - flat + - rust +--- +`awk`是一个非常强大的文本处理工具,我们在之前的文章中也介绍过,他的功能包括但不限于: +- 过滤文本 +- 对逐行文本进行简单文本处理 +- 对每一行按照指定符号拆分不同的列来处理 +- 开始和结束的时候分别运行指定代码 +- 甚至包含了`exec`每行执行shell + +此外`awk`的性能也非常高,可以说是`awk`是没有缺点的,但是作为用户的我,是有缺点的,因为不是每天都在用`awk`指令,导致经常忘记`awk`中的函数的语法,比如文本拆分函数是哪个?文本替换函数?正则匹配怎么写?等等这些问题,在一段时间不用之后就会忘记,然后再去查笔记和`gpt`。 + +所以我就在想为什么`awk`的`{}`的语法不能用js的语法呢?js我很熟悉啊,对`string`处理的函数倒背如流,但是一想确实并非所有人都对js非常熟悉。那我不如自己写一个`awk`吧。 + +# 思路整理 +`awk`的功能非常多,我觉得我的工具主要就是侧重于文本处理,对于其他的功能,我的工具都不做实现。按照`awk`的思想,他是对管道或者指定文件中的每一行文本逐行处理,需要做的是传入一个处理函数,该函数的返回值进行打印,所以大概是个js的`array.map()`函数的功能,但是考虑到希望实现过滤的功能,那么`array.flatMap()`好像更确切一些,所以我们这个工具就叫`flat`吧。 + +那么初步的计划就是这样: +```bash +$ cat app.log | flat 'l.split(" ")[0]' +# 从管道中读取并执行,与以下awk指令效果一致 +$ cat app.log | awk '{print $1}' + +$ flat 'l.split(" ")[0]' app.log +# 从文件中读取并执行,自己用代码进行拆分,默认不执行拆分指令。与以下awk指令效果一致 +$ awk '{print $1}' app.log +``` + +然后为了实现统计类型的编程,我们还需要`awk`中`BEGIN` `END`这样的函数指定,来执行初始化和收尾的工作,这里我希望用命令行参数指定的方式,这样感觉更规范一些。 +```bash +# 这里实现的功能为统计当前文件的字符数量 +$ flat --begin 'var wordCount = 0' --end 'wordCount' 'wordCount += l.length; null' app.log + +# 等价于 +$ awk 'BEGIN { wordCount = 0 }END { print wordCount }{wordCount += length($0)}' app.log +``` + +那大概功能就是这样了,指令格式为`flat [option] function [filepath]`,至少有一个`function`参数来对每一行文件执行的js代码,其中内置一些变量方便使用比如变量`l`就是当前行的字符串;`filepath`是可选的,如果有这个参数的话,就读取这个文件,如果没有这个参数的话,可以从管道中获取数据;`option`是可选的,目前想到需要提供的有`--begin -b`和`--end -e`两个来对齐`awk`的`BEGIN END`函数功能。其他的暂时不需要,以后有需求了再去定吧。 + +# 技术选型 +我们想要用`js`的语法来运行函数,因为`js`的语法简单好记和`java`高度相似,如果有拿不准的还可以再浏览器console中测试验证。 + +既然函数语法是`js`,那么最简单的实现方式就是用`node` `deno` `bun`这种js运行时来实现,但是`bun`没有打包为独立运行的二进制文件的功能,`node`和`deno`的打包完的话都需要把核心的运行时打包到二进制文件中,导致最终的文件大小超过了`50M`,这对于这么简单的一个功能来说实在是有点大了。所以排除`js`运行时。当然`java` `python`等解释型的也都排除,因为不保证机器上有`runtime`都需要打一个臃肿的包。 + +最后剩下`c` `golang` `rust`,首先排除`c`,c语言实现这个项目代码量都要远超其他两个,剩下俩,`rust`性能好一些,我们暂时选择用`rust`实现,并且在`rust`中也找到了非常精炼的`js`运行时的库`quick-js`,然后`cli`需要的基础的规范,参数指定,`--help`等,通过`clap`这个库来完成。 + +# 开整 +## 先实现clap读取参数的部分 +创建项目: +```bash +$ cargo new flat +$ cd flat +$ cargo add clap +``` + +```rs +use std::fs::File; +use std::io::{self, BufRead, BufReader}; +use quick_js::{Context, JsValue}; +use clap::{Arg, Command}; + +fn main() { + // 定义参数形式为 flat [option] function [file] + let matches = Command::new("Flat") + .version("1.0") + .author("Your Name ") + .about("Processes lines of input with JavaScript") + .arg(Arg::new("begin") + .short('b') + .long("begin") + .help("JavaScript code to execute before processing any lines") + .value_parser(clap::builder::ValueParser::string())) + .arg(Arg::new("end") + .short('e') + .long("end") + .help("JavaScript code to execute after processing all lines") + .value_parser(clap::builder::ValueParser::string())) + .arg(Arg::new("function") + .help("JavaScript code to process each line, l is the origin string") + .required(true) + .index(1)) + .arg(Arg::new("file") + .help("Path to the input file. If not provided, reads from stdin.") + .index(2)) + .get_matches(); + + let begin_code = matches.get_one::("begin"); + let end_code = matches.get_one::("end"); + let js_function = matches.get_one::("function").unwrap(); + let file_path = matches.get_one::("file"); + + if let Some(code) = begin_code { + println!("begin_code: {}", code); + } + if let Some(code) = end_code { + println!("end_code: {}", code); + } + println!("js_function: {}", js_function); + if let Some(path) = file_path { + println!("file_path: {}", path); + } +} +``` + +测试: +```bash +$ cargo run -- -b 'bbb' -e 'eee' 'jsjsjs' file +begin_code: bbb +end_code: eee +js_function: jsjsjs +file_path: file + +$ cargo run -- --begin 'bbb' 'jsjsjs' file +begin_code: bbb +js_function: jsjsjs +file_path: file + +$ cargo run -- -h +Usage: flat [OPTIONS] [file] + +Arguments: + JavaScript code to process each line, l is the origin string + [file] Path to the input file. If not provided, reads from stdin. + +Options: + -b, --begin JavaScript code to execute before processing any lines + -e, --end JavaScript code to execute after processing all lines + -h, --help Print help + -V, --version Print version +``` + +## 然后补全js代码执行的部分即可 +安装依赖 +```bash +$ cargo add quick-js +``` +添加js代码上下文`Context::new().unwrap()`,借助其`eval`方法即可运行js代码了,我们把当前行拼接字符串赋值给变量`l`,即可完成相应的功能了。 + +为了方便使用我们还定义了空对象`ctx`,`n1 n2 n3`三个数字,空字符串`s`,空数组`arr`,这里没有像`awk`中那样用`print`函数才进行打印,而是`eval`返回的对象不是`null/undefined`时m默认打印出来,所以如果不想打印的话,代码块最后可以添加个`null`。 +```rs +use std::fs::File; +use std::io::{self, BufRead, BufReader}; +use quick_js::{Context, JsValue}; +use clap::{Arg, Command}; + +fn main() { + // 定义参数形式为 flat [option] function [file] + let matches = Command::new("Flat") + .version("1.0") + .author("Your Name ") + .about("Processes lines of input with JavaScript") + .arg(Arg::new("begin") + .short('b') + .long("begin") + .help("JavaScript code to execute before processing any lines") + .value_parser(clap::builder::ValueParser::string())) + .arg(Arg::new("end") + .short('e') + .long("end") + .help("JavaScript code to execute after processing all lines") + .value_parser(clap::builder::ValueParser::string())) + .arg(Arg::new("function") + .help("JavaScript code to process each line, l is the origin string") + .required(true) + .index(1)) + .arg(Arg::new("file") + .help("Path to the input file. If not provided, reads from stdin.") + .index(2)) + .get_matches(); + + let begin_code = matches.get_one::("begin"); + let end_code = matches.get_one::("end"); + let js_function = matches.get_one::("function").unwrap(); + let file_path = matches.get_one::("file"); + + // 创建JavaScript 执行上下文 + let context = Context::new().unwrap(); + + // 创建全局变量 + let _ = context.eval("var ctx = {}, n1=0, n2=0, n3=0, s='', arr=[];"); + + // 执行begin的代码块,如果有的话 + if let Some(code) = begin_code { + if let Err(e) = context.eval(code) { + eprintln!("Error executing BEGIN JS: {:?}", e); + } + } + + // 逐行读取文件或者管道内容 + let input: Box = if let Some(path) = file_path { + Box::new(BufReader::new(File::open(path).expect("Failed to open file"))) + } else { + Box::new(io::stdin().lock()) + }; + + for line in input.lines() { + let line = line.unwrap(); + let func = format!("{{ var l='{}'; {} }}", line.replace("'", "\\'"), js_function); + // 将每一行传递给 JavaScript 函数 + let result = context.eval(&func); + // 处理执行结果 + match result { + Ok(JsValue::String(s)) => println!("{}", s), + Ok(JsValue::Int(s)) => println!("{}", s), + Ok(JsValue::Bool(s)) => println!("{}", s), + Ok(JsValue::Float(s)) => println!("{}", s), + Ok(JsValue::Array(s)) => println!("{:?}", s), + Ok(JsValue::Object(s)) => println!("{:?}", s), + Ok(_) => (), + Err(e) => eprintln!("Error executing JS: {:?}", e), + } + } + + // Execute end code if provided + if let Some(code) = end_code { + let result = context.eval(&code); + // 处理执行结果 + match result { + Ok(JsValue::String(s)) => println!("{}", s), + Ok(JsValue::Int(s)) => println!("{}", s), + Ok(JsValue::Bool(s)) => println!("{}", s), + Ok(JsValue::Float(s)) => println!("{}", s), + Ok(JsValue::Array(s)) => println!("{:?}", s), + Ok(JsValue::Object(s)) => println!("{:?}", s), + Ok(_) => (), + Err(e) => eprintln!("Error executing JS: {:?}", e), + } + } +} +``` +# 测试 +求文件的字符数量,结果一致。 +```bash +$ flat -b 'var sum = 0' 'sum += l.length; null' -e 'sum' test.txt +810915 + +$ awk 'BEGIN { sum = 0} {sum += length($0)} END {print sum}' test.txt +810915 +``` +虽然我们的这个实现是个“玩具”,但是还是找一个大文件,看一下和`awk`的性能差距,如下统计1亿多个字符的文件中一共有多少个字符,大概100多M, + + +在macM2上,`awk`只需要`2.58s`,而`flat`有`8.38s`满额了3倍以上,但是比想象中快一些,起码是同一个数量级的。 + +而在linux上,还是这个文件`awk`只需要`<1s`,而`flat`是`9s`,这个就差了10倍了。 + +我们可以思考下为什么我们的代码比`awk`慢了2倍,当然首先会想到,因为我们用了`quick-js`这个js运行时,他需要解释`js`代码来执行,肯定是比较慢的。而且每一行都需要解释,这肯定比`awk`这种纯的`native`程序慢。我们把`eval`删掉,只读取这文件耗时不到1s,所以有7s的时间都是用在了`context.eval`上面。 + +所以一种优化思路就是,每次`eval`执行不再拘泥于一行,例如凑够10行,拼一个jsFunction传入`context`去解释执行,这样就减少了解释器启动的次数,猜测可能有优化,但是估计优化幅度并不确定。 + +另外一个值得关注的是,我们采用了单线程的策略,读取文件=》执行函数=》再读下一行=》再执行,可以把读取和执行放到不同的线程中,但是实测效果并不明显。反而是文件快速读取完成都把数据堆在了`channel`中,占用了大量的内存,代码如下,并不建议这样修改。 + +```rs +use std::fs::File; +use std::io::{self, BufRead, BufReader}; +use quick_js::{Context, JsValue}; +use clap::{Arg, Command}; +use std::thread; +use std::sync::mpsc; + +fn main() { + // 定义参数形式为 flat [option] function [file] + let matches = Command::new("Flat") + .version("1.0") + .author("Your Name ") + .about("Processes lines of input with JavaScript") + .arg(Arg::new("begin") + .short('b') + .long("begin") + .help("JavaScript code to execute before processing any lines") + .value_parser(clap::builder::ValueParser::string())) + .arg(Arg::new("end") + .short('e') + .long("end") + .help("JavaScript code to execute after processing all lines") + .value_parser(clap::builder::ValueParser::string())) + .arg(Arg::new("function") + .help("JavaScript code to process each line, l is the origin string") + .required(true) + .index(1)) + .arg(Arg::new("file") + .help("Path to the input file. If not provided, reads from stdin.") + .index(2)) + .get_matches(); + + let begin_code = matches.get_one::("begin").cloned(); + let end_code = matches.get_one::("end").cloned(); + let js_function = matches.get_one::("function").unwrap().clone(); + let file_path = matches.get_one::("file").cloned(); + + // 创建JavaScript 执行上下文 + let context = Context::new().unwrap(); + + // 创建全局变量 + let _ = context.eval("var ctx = {}, n1=0, n2=0, n3=0, s='', arr=[];"); + + // 执行begin的代码块,如果有的话 + if let Some(code) = &begin_code { + if let Err(e) = context.eval(code) { + eprintln!("Error executing BEGIN JS: {:?}", e); + } + } + + // 创建通道 + let (sender, receiver) = mpsc::channel(); + + // 在新线程中读取文件 + let reader_thread = thread::spawn(move || { + let input: Box = if let Some(path) = file_path { + Box::new(BufReader::new(File::open(path).expect("Failed to open file"))) + } else { + Box::new(io::stdin().lock()) + }; + + for line in input.lines() { + if let Ok(line) = line { + if sender.send(line).is_err() { + break; + } + } + } + // println!("send finish") + }); + + // 在主线程中处理每一行 + for line in receiver { + let func = format!("{{ var l='{}'; {} }}", line.replace("'", "\\'"), js_function); + // 将每一行传递给 JavaScript 函数 + let result = context.eval(&func); + // 处理执行结果 + match result { + Ok(JsValue::String(s)) => println!("{}", s), + Ok(JsValue::Int(s)) => println!("{}", s), + Ok(JsValue::Bool(s)) => println!("{}", s), + Ok(JsValue::Float(s)) => println!("{}", s), + Ok(JsValue::Array(s)) => println!("{:?}", s), + Ok(JsValue::Object(s)) => println!("{:?}", s), + Ok(_) => (), + Err(e) => eprintln!("Error executing JS: {:?}", e), + } + } + + // 等待读取线程结束 + reader_thread.join().unwrap(); + + // Execute end code if provided + if let Some(code) = end_code { + let result = context.eval(&code); + // 处理执行结果 + match result { + Ok(JsValue::String(s)) => println!("{}", s), + Ok(JsValue::Int(s)) => println!("{}", s), + Ok(JsValue::Bool(s)) => println!("{}", s), + Ok(JsValue::Float(s)) => println!("{}", s), + Ok(JsValue::Array(s)) => println!("{:?}", s), + Ok(JsValue::Object(s)) => println!("{:?}", s), + Ok(_) => (), + Err(e) => eprintln!("Error executing JS: {:?}", e), + } + } +} +``` +# 优化 +因为`quick-js`是一个比较简单的实现,他的性能并不算高,但是很小巧,上面二进制文件的大小才1M左右。极限压缩可能也就几百K。如果换成`deno_core`这个`deno`的`js`运行时,的核心包。 +```bash +$ cargo add deno_core +``` +代码进行简单的替换: +```rs +use std::fs::File; +use std::io::{self, BufRead, BufReader}; +use clap::{Arg, Command}; +use deno_core::JsRuntime; +use deno_core::RuntimeOptions; + +fn main() { + // 定义参数形式为 flat [option] function [file] + let matches = Command::new("Flat") + .version("1.0") + .author("Your Name ") + .about("Processes lines of input with JavaScript") + .arg(Arg::new("begin") + .short('b') + .long("begin") + .help("JavaScript code to execute before processing any lines") + .value_parser(clap::builder::ValueParser::string())) + .arg(Arg::new("end") + .short('e') + .long("end") + .help("JavaScript code to execute after processing all lines") + .value_parser(clap::builder::ValueParser::string())) + .arg(Arg::new("function") + .help("JavaScript code to process each line, l is the origin string") + .required(true) + .index(1)) + .arg(Arg::new("file") + .help("Path to the input file. If not provided, reads from stdin.") + .index(2)) + .get_matches(); + + let begin_code = matches.get_one::("begin"); + let end_code = matches.get_one::("end").cloned(); + let js_function = matches.get_one::("function").unwrap(); + let file_path = matches.get_one::("file"); + + // 创建JavaScript 执行上下文 + let mut runtime = JsRuntime::new(RuntimeOptions::default()); + + // 创建全局变量 + runtime.execute_script("", "var ctx = {}, n1=0, n2=0, n3=0, s='', arr=[];").expect("Eval failed"); + // 执行begin的代码块,如果有的话 + if let Some(code) = begin_code { + runtime.execute_script("", code.to_string()).expect("Eval failed"); + } + + // 逐行读取文件或者管道内容 + let input: Box = if let Some(path) = file_path { + Box::new(BufReader::new(File::open(path).expect("Failed to open file"))) + } else { + Box::new(io::stdin().lock()) + }; + + for line in input.lines() { + let line = line.unwrap(); + let func = format!("{{ var l='{}'; {} }}", line.replace("'", "\\'"), js_function); + // 将每一行传递给 JavaScript 函数 + runtime.execute_script("", func).expect("Eval failed"); + } + + // Execute end code if provided + if let Some(code) = end_code { + runtime.execute_script("", code).expect("Eval failed"); + } +} +``` +此时的性能提高了2-3倍,计算1亿字符文件字符总数的测试中在gitpod的linux上耗时是`5s`,相比`awk`只有`0.5s`左右。差距在10倍左右。 +``` +$ time awk '{s+=length($0)} END {print s}' ../test.txt +119204505 + +real 0m0.577s +user 0m0.540s +sys 0m0.036s +``` +继续按照行数进行批次处理,如下每100行作为一个批次处理: +```rs +mod test; +use clap::{Arg, Command}; +use deno_core::JsRuntime; +use deno_core::RuntimeOptions; +use std::fs::File; +use std::io::{self, BufRead, BufReader}; + +fn main() { + // 定义参数形式为 flat [option] function [file] + let matches = Command::new("Flat") + .version("1.0") + .author("Your Name ") + .about("Processes lines of input with JavaScript") + .arg( + Arg::new("begin") + .short('b') + .long("begin") + .help("JavaScript code to execute before processing any lines") + .value_parser(clap::builder::ValueParser::string()), + ) + .arg( + Arg::new("end") + .short('e') + .long("end") + .help("JavaScript code to execute after processing all lines") + .value_parser(clap::builder::ValueParser::string()), + ) + .arg( + Arg::new("function") + .help("JavaScript code to process each line, l is the origin string") + .required(true) + .index(1), + ) + .arg( + Arg::new("file") + .help("Path to the input file. If not provided, reads from stdin.") + .index(2), + ) + .get_matches(); + + let begin_code = matches.get_one::("begin"); + let end_code = matches.get_one::("end").cloned(); + let js_function = matches.get_one::("function").unwrap(); + let file_path = matches.get_one::("file"); + + // 创建JavaScript 执行上下文 + let mut runtime = JsRuntime::new(RuntimeOptions::default()); + + // 创建全局变量 + runtime + .execute_script("", "var ctx = {}, n1=0, n2=0, n3=0, s='', arr=[];") + .expect("Eval failed"); + // 执行begin的代码块,如果有的话 + if let Some(code) = begin_code { + runtime + .execute_script("", code.to_string()) + .expect("Eval failed"); + } + + // 逐行读取文件或者管道内容 + let input: Box = if let Some(path) = file_path { + Box::new(BufReader::new( + File::open(path).expect("Failed to open file"), + )) + } else { + Box::new(io::stdin().lock()) + }; + let mut vec = vec![]; + for line in input.lines() { + let line = line.unwrap(); + let line = line.replace("'", "\\'"); + vec.push(line.to_string()); + // 先扔到数组里,每200行,处理一次 + if vec.len() == 200 { + eval(&mut vec, &mut runtime, &js_function); + } + } + if !vec.is_empty() { + eval(&mut vec, &mut runtime, &js_function); + } + // Execute end code if provided + if let Some(code) = end_code { + runtime.execute_script("", code).expect("Eval failed"); + } +} + +fn eval(vec: &mut Vec, runtime: &mut JsRuntime, js_function: &str) { + let mut func = "var ls = [".to_string(); + for ele in vec.iter() { + func.push_str("'"); + func.push_str(ele); + func.push_str("', ") + } + func.push_str("];"); + vec.clear(); + + func.push_str(&format!("ls.forEach(l=>{{ {} }})", js_function)); + let func = format!("{{ {} }}", func); + runtime.execute_script("", func).expect("Eval failed"); +} +``` +同样还是1亿字符文件计数的任务,耗时来到了2s,性能提高了一倍,此时对比`awk`的`0.5s`,差距在4倍,可以说是非常不错了,因为这里使用的是js语法,js解释器运行。 +```bash +$ time flat 'n1+=l.length' -e 'console.log(n1)' ../test.txt +119204505 + +real 0m2.114s +user 0m2.117s +sys 0m0.394s +``` +因为计数的任务比较简单,我们可以在测试一个负责场景,按照数字0将每一行进行拆分,然后把第0个元素取出,过滤出英文字母的个数,进行求和。 + +![compare](https://i.imgur.com/tn7sMYE.png) + +这个复杂场景对比可以看出我们的`flat`工具性能反而更好,我猜测与正则的运行逻辑不一致有关,但是不管怎么说,复杂语句上的性能,是会和`awk`逼近的。 + +# 可执行文件压缩 +但是使用`deno_core`会把一个v8引擎塞到二进制文件导致文件从`1M`突增到`41M`,这里我们对二进制文件进行压缩。 + +配置编译优化,拉满,实际测试配不配没太大区别。 +```yaml: Cargo.toml +... +[profile.release] +opt-level = 'z' +lto = true +debug = false +panic = "abort" +codegen-units = 1 +... +``` + +构建二进制文件,并用`strip`去掉二进制文件中的头部信息,这一步有一些帮助。 +```bash +$ cargo b -r +$ strip target/release/flat +``` + +用`upx`压缩二进制文件,这个工具用套壳压缩的方式可以大大减小文件大小,如下直接从41变14M了。运行时会自动解压。 +```bash +$ apt install upx +$ upx --best target/release/flat + Ultimate Packer for eXecutables + Copyright (C) 1996 - 2020 +UPX 3.96 Markus Oberhumer, Laszlo Molnar & John Reiser Jan 23rd 2020 + + File size Ratio Format Name + -------------------- ------ ----------- ----------- + 42491288 -> 14527856 34.19% linux/amd64 flat +``` + +后续我单独创建一个`repo`把这个工具发布出来。 \ No newline at end of file