git.delta.rocks / jrsonnet / refs/commits / 47e40b265d54

difftreelog

Merge pull request #118 from CertainLach/feature/upstream-std-sync

Yaroslav Bolyukin2023-07-17parents: #e0d3ba2 #397e1ed.patch.diff
in: master

11 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -24,20 +24,69 @@
 ]
 
 [[package]]
+name = "anstream"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163"
+dependencies = [
+ "anstyle",
+ "anstyle-parse",
+ "anstyle-query",
+ "anstyle-wincon",
+ "colorchoice",
+ "is-terminal",
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd"
+
+[[package]]
+name = "anstyle-parse"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333"
+dependencies = [
+ "utf8parse",
+]
+
+[[package]]
+name = "anstyle-query"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
+dependencies = [
+ "windows-sys",
+]
+
+[[package]]
+name = "anstyle-wincon"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188"
+dependencies = [
+ "anstyle",
+ "windows-sys",
+]
+
+[[package]]
 name = "anyhow"
-version = "1.0.69"
+version = "1.0.72"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
+checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854"
 
 [[package]]
 name = "async-trait"
-version = "0.1.64"
+version = "0.1.71"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2"
+checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn",
+ "syn 2.0.26",
 ]
 
 [[package]]
@@ -48,9 +97,9 @@
 
 [[package]]
 name = "base64"
-version = "0.21.0"
+version = "0.21.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
+checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d"
 
 [[package]]
 name = "bincode"
@@ -68,10 +117,16 @@
 checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
 
 [[package]]
+name = "bitflags"
+version = "2.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
+
+[[package]]
 name = "block-buffer"
-version = "0.10.3"
+version = "0.10.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
 dependencies = [
  "generic-array",
 ]
@@ -90,55 +145,65 @@
 
 [[package]]
 name = "clap"
-version = "4.1.6"
+version = "4.3.12"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3"
+checksum = "3eab9e8ceb9afdade1ab3f0fd8dbce5b1b2f468ad653baf10e771781b2b67b73"
 dependencies = [
- "bitflags",
+ "clap_builder",
  "clap_derive",
- "clap_lex",
- "is-terminal",
  "once_cell",
+]
+
+[[package]]
+name = "clap_builder"
+version = "4.3.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f2763db829349bf00cfc06251268865ed4363b93a943174f638daf3ecdba2cd"
+dependencies = [
+ "anstream",
+ "anstyle",
+ "clap_lex",
  "strsim",
- "termcolor",
 ]
 
 [[package]]
 name = "clap_complete"
-version = "4.1.3"
+version = "4.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0012995dc3a54314f4710f5631d74767e73c534b8757221708303e48eef7a19b"
+checksum = "5fc443334c81a804575546c5a8a79b4913b50e28d69232903604cada1de817ce"
 dependencies = [
  "clap",
 ]
 
 [[package]]
 name = "clap_derive"
-version = "4.1.0"
+version = "4.3.12"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"
+checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050"
 dependencies = [
  "heck",
- "proc-macro-error",
  "proc-macro2",
  "quote",
- "syn",
+ "syn 2.0.26",
 ]
 
 [[package]]
 name = "clap_lex"
-version = "0.3.2"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
+
+[[package]]
+name = "colorchoice"
+version = "1.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09"
-dependencies = [
- "os_str_bytes",
-]
+checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
 
 [[package]]
 name = "cpufeatures"
-version = "0.2.5"
+version = "0.2.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
+checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1"
 dependencies = [
  "libc",
 ]
@@ -155,9 +220,9 @@
 
 [[package]]
 name = "digest"
-version = "0.10.6"
+version = "0.10.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f"
+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
 dependencies = [
  "block-buffer",
  "crypto-common",
@@ -165,13 +230,13 @@
 
 [[package]]
 name = "errno"
-version = "0.2.8"
+version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
+checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
 dependencies = [
  "errno-dragonfly",
  "libc",
- "winapi",
+ "windows-sys",
 ]
 
 [[package]]
@@ -186,9 +251,9 @@
 
 [[package]]
 name = "generic-array"
-version = "0.14.6"
+version = "0.14.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
 dependencies = [
  "typenum",
  "version_check",
@@ -217,47 +282,36 @@
 
 [[package]]
 name = "hermit-abi"
-version = "0.3.1"
+version = "0.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
+checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
 
 [[package]]
 name = "indexmap"
-version = "1.9.2"
+version = "1.9.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
+checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
 dependencies = [
  "autocfg",
  "hashbrown 0.12.3",
-]
-
-[[package]]
-name = "io-lifetimes"
-version = "1.0.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
-dependencies = [
- "libc",
- "windows-sys",
 ]
 
 [[package]]
 name = "is-terminal"
-version = "0.4.4"
+version = "0.4.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857"
+checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
 dependencies = [
  "hermit-abi",
- "io-lifetimes",
  "rustix",
  "windows-sys",
 ]
 
 [[package]]
 name = "itoa"
-version = "1.0.5"
+version = "1.0.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
+checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
 
 [[package]]
 name = "jrsonnet"
@@ -325,7 +379,7 @@
 dependencies = [
  "proc-macro2",
  "quote",
- "syn",
+ "syn 1.0.109",
 ]
 
 [[package]]
@@ -345,7 +399,7 @@
 dependencies = [
  "proc-macro2",
  "quote",
- "syn",
+ "syn 1.0.109",
 ]
 
 [[package]]
@@ -375,7 +429,9 @@
  "serde",
  "serde_json",
  "serde_yaml_with_quirks",
+ "sha1",
  "sha2",
+ "sha3",
  "structdump",
 ]
 
@@ -388,10 +444,19 @@
 ]
 
 [[package]]
+name = "keccak"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940"
+dependencies = [
+ "cpufeatures",
+]
+
+[[package]]
 name = "libc"
-version = "0.2.139"
+version = "0.2.147"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
+checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
 
 [[package]]
 name = "libjsonnet"
@@ -411,15 +476,15 @@
 
 [[package]]
 name = "linux-raw-sys"
-version = "0.1.4"
+version = "0.4.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
+checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0"
 
 [[package]]
 name = "lock_api"
-version = "0.4.9"
+version = "0.4.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df"
+checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16"
 dependencies = [
  "autocfg",
  "scopeguard",
@@ -483,15 +548,9 @@
 
 [[package]]
 name = "once_cell"
-version = "1.17.1"
+version = "1.18.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
-
-[[package]]
-name = "os_str_bytes"
-version = "6.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
+checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
 
 [[package]]
 name = "parking_lot"
@@ -505,15 +564,15 @@
 
 [[package]]
 name = "parking_lot_core"
-version = "0.9.7"
+version = "0.9.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521"
+checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447"
 dependencies = [
  "cfg-if",
  "libc",
  "redox_syscall",
  "smallvec",
- "windows-sys",
+ "windows-targets",
 ]
 
 [[package]]
@@ -550,54 +609,30 @@
 checksum = "9fa00462b37ead6d11a82c9d568b26682d78e0477dc02d1966c013af80969739"
 
 [[package]]
-name = "proc-macro-error"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
-dependencies = [
- "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "syn",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro-error-attr"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
-dependencies = [
- "proc-macro2",
- "quote",
- "version_check",
-]
-
-[[package]]
 name = "proc-macro2"
-version = "1.0.51"
+version = "1.0.65"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
+checksum = "92de25114670a878b1261c79c9f8f729fb97e95bac93f6312f583c60dd6a1dfe"
 dependencies = [
  "unicode-ident",
 ]
 
 [[package]]
 name = "quote"
-version = "1.0.23"
+version = "1.0.30"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
+checksum = "5907a1b7c277254a8b15170f6e7c97cfa60ee7872a3217663bb81151e48184bb"
 dependencies = [
  "proc-macro2",
 ]
 
 [[package]]
 name = "redox_syscall"
-version = "0.2.16"
+version = "0.3.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
+checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
 dependencies = [
- "bitflags",
+ "bitflags 1.3.2",
 ]
 
 [[package]]
@@ -608,13 +643,12 @@
 
 [[package]]
 name = "rustix"
-version = "0.36.8"
+version = "0.38.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
+checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5"
 dependencies = [
- "bitflags",
+ "bitflags 2.3.3",
  "errno",
- "io-lifetimes",
  "libc",
  "linux-raw-sys",
  "windows-sys",
@@ -622,9 +656,9 @@
 
 [[package]]
 name = "ryu"
-version = "1.0.12"
+version = "1.0.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
+checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
 
 [[package]]
 name = "scopeguard"
@@ -634,29 +668,29 @@
 
 [[package]]
 name = "serde"
-version = "1.0.152"
+version = "1.0.171"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
+checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9"
 dependencies = [
  "serde_derive",
 ]
 
 [[package]]
 name = "serde_derive"
-version = "1.0.152"
+version = "1.0.171"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
+checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn",
+ "syn 2.0.26",
 ]
 
 [[package]]
 name = "serde_json"
-version = "1.0.93"
+version = "1.0.103"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
+checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b"
 dependencies = [
  "itoa",
  "ryu",
@@ -676,10 +710,21 @@
 ]
 
 [[package]]
+name = "sha1"
+version = "0.10.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
+dependencies = [
+ "cfg-if",
+ "cpufeatures",
+ "digest",
+]
+
+[[package]]
 name = "sha2"
-version = "0.10.6"
+version = "0.10.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
+checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8"
 dependencies = [
  "cfg-if",
  "cpufeatures",
@@ -687,10 +732,20 @@
 ]
 
 [[package]]
+name = "sha3"
+version = "0.10.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60"
+dependencies = [
+ "digest",
+ "keccak",
+]
+
+[[package]]
 name = "smallvec"
-version = "1.10.0"
+version = "1.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
+checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9"
 
 [[package]]
 name = "static_assertions"
@@ -723,7 +778,7 @@
 dependencies = [
  "proc-macro2",
  "quote",
- "syn",
+ "syn 1.0.109",
 ]
 
 [[package]]
@@ -738,12 +793,14 @@
 ]
 
 [[package]]
-name = "termcolor"
-version = "1.2.0"
+name = "syn"
+version = "2.0.26"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
+checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970"
 dependencies = [
- "winapi-util",
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
 ]
 
 [[package]]
@@ -758,22 +815,22 @@
 
 [[package]]
 name = "thiserror"
-version = "1.0.38"
+version = "1.0.43"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
+checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42"
 dependencies = [
  "thiserror-impl",
 ]
 
 [[package]]
 name = "thiserror-impl"
-version = "1.0.38"
+version = "1.0.43"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
+checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn",
+ "syn 2.0.26",
 ]
 
 [[package]]
@@ -784,9 +841,9 @@
 
 [[package]]
 name = "unicode-ident"
-version = "1.0.6"
+version = "1.0.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
+checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
 
 [[package]]
 name = "unicode-width"
@@ -795,6 +852,12 @@
 checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
 
 [[package]]
+name = "utf8parse"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
+
+[[package]]
 name = "version_check"
 version = "0.9.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -815,15 +878,6 @@
 version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
-[[package]]
-name = "winapi-util"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
-dependencies = [
- "winapi",
-]
 
 [[package]]
 name = "winapi-x86_64-pc-windows-gnu"
@@ -833,18 +887,18 @@
 
 [[package]]
 name = "windows-sys"
-version = "0.45.0"
+version = "0.48.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
 dependencies = [
  "windows-targets",
 ]
 
 [[package]]
 name = "windows-targets"
-version = "0.42.1"
+version = "0.48.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
+checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
 dependencies = [
  "windows_aarch64_gnullvm",
  "windows_aarch64_msvc",
@@ -857,45 +911,45 @@
 
 [[package]]
 name = "windows_aarch64_gnullvm"
-version = "0.42.1"
+version = "0.48.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
+checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
 
 [[package]]
 name = "windows_aarch64_msvc"
-version = "0.42.1"
+version = "0.48.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
+checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
 
 [[package]]
 name = "windows_i686_gnu"
-version = "0.42.1"
+version = "0.48.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
+checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
 
 [[package]]
 name = "windows_i686_msvc"
-version = "0.42.1"
+version = "0.48.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
+checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
 
 [[package]]
 name = "windows_x86_64_gnu"
-version = "0.42.1"
+version = "0.48.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
+checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
 
 [[package]]
 name = "windows_x86_64_gnullvm"
-version = "0.42.1"
+version = "0.48.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
+checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
 
 [[package]]
 name = "windows_x86_64_msvc"
-version = "0.42.1"
+version = "0.48.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
+checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
 
 [[package]]
 name = "yaml-rust"
modifiedcrates/jrsonnet-stdlib/Cargo.tomldiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/Cargo.toml
+++ b/crates/jrsonnet-stdlib/Cargo.toml
@@ -32,8 +32,12 @@
 
 # std.md5
 md5 = "0.7.0"
+# std.sha1
+sha1 = "0.10.5"
 # std.sha256, std.sha512
 sha2 = "0.10.6"
+# std.sha3
+sha3 = "0.10.8"
 # std.base64
 base64 = "0.21.0"
 # std.parseJson
modifiedcrates/jrsonnet-stdlib/src/arrays.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/arrays.rs
+++ b/crates/jrsonnet-stdlib/src/arrays.rs
@@ -1,12 +1,22 @@
+#![allow(non_snake_case)]
+
 use jrsonnet_evaluator::{
 	error::{ErrorKind::RuntimeError, Result},
 	function::{builtin, FuncVal},
 	throw,
 	typed::{BoundedI32, BoundedUsize, Either2, NativeFn, Typed},
 	val::{equals, ArrValue, IndexableVal, StrValue},
-	Either, IStr, Val,
+	Either, IStr, Thunk, Val,
 };
 
+pub(crate) fn eval_on_empty(on_empty: Option<Thunk<Val>>) -> Result<Val> {
+	if let Some(on_empty) = on_empty {
+		on_empty.evaluate()
+	} else {
+		throw!("expected non-empty array")
+	}
+}
+
 #[builtin]
 pub fn builtin_make_array(sz: BoundedI32<0, { i32::MAX }>, func: FuncVal) -> Result<ArrValue> {
 	if *sz == 0 {
@@ -221,6 +231,11 @@
 }
 
 #[builtin]
+pub fn builtin_contains(arr: IndexableVal, elem: Val) -> Result<bool> {
+	builtin_member(arr, elem)
+}
+
+#[builtin]
 pub fn builtin_count(arr: ArrValue, x: Val) -> Result<usize> {
 	let mut count = 0;
 	for item in arr.iter() {
@@ -230,3 +245,35 @@
 	}
 	Ok(count)
 }
+
+#[builtin]
+pub fn builtin_avg(arr: Vec<f64>, onEmpty: Option<Thunk<Val>>) -> Result<Val> {
+	if arr.is_empty() {
+		return eval_on_empty(onEmpty);
+	}
+	Ok(Val::Num(arr.iter().sum::<f64>() / (arr.len() as f64)))
+}
+
+#[builtin]
+pub fn builtin_remove_at(
+	arr: ArrValue,
+	index: usize,
+) -> Result<ArrValue> {
+	let newArrLeft = arr.clone().slice(None, Some(index), None);
+	let newArrRight = arr.slice(Some(index + 1), None, None);
+	
+	Ok(ArrValue::extended(
+		newArrLeft.unwrap_or(ArrValue::empty()),
+		newArrRight.unwrap_or(ArrValue::empty()))
+	)
+}
+
+#[builtin]
+pub fn builtin_remove(arr: ArrValue, elem: Val) -> Result<ArrValue> {
+	for (index, item) in arr.iter().enumerate() {
+		if equals(&item?, &elem)? {
+			return builtin_remove_at(arr.clone(), index) 
+		}
+	}
+	Ok(arr)
+}
modifiedcrates/jrsonnet-stdlib/src/hash.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/hash.rs
+++ b/crates/jrsonnet-stdlib/src/hash.rs
@@ -16,3 +16,15 @@
 	use sha2::digest::Digest;
 	format!("{:x}", sha2::Sha512::digest(s.as_bytes()))
 }
+
+#[builtin]
+pub fn builtin_sha1(s: IStr) -> String {
+	use sha1::digest::Digest;
+	format!("{:x}", sha1::Sha1::digest(s.as_bytes()))
+}
+
+#[builtin]
+pub fn builtin_sha3(s: IStr) -> String {
+	use sha3::digest::Digest;
+	format!("{:x}", sha3::Sha3_512::digest(s.as_bytes()))
+}
modifiedcrates/jrsonnet-stdlib/src/lib.rsdiffbeforeafterboth
before · crates/jrsonnet-stdlib/src/lib.rs
1use std::{2	cell::{Ref, RefCell, RefMut},3	collections::HashMap,4	rc::Rc,5};67use jrsonnet_evaluator::{8	error::{ErrorKind::*, Result},9	function::{builtin::Builtin, CallLocation, FuncVal, TlaArg},10	gc::TraceBox,11	tb,12	trace::PathResolver,13	ContextBuilder, IStr, ObjValue, ObjValueBuilder, State, Thunk, Val,14};15use jrsonnet_gcmodule::{Cc, Trace};16use jrsonnet_parser::Source;1718mod expr;19mod types;20pub use types::*;21mod arrays;22pub use arrays::*;23mod math;24pub use math::*;25mod operator;26pub use operator::*;27mod sort;28pub use sort::*;29mod hash;30pub use hash::*;31mod encoding;32pub use encoding::*;33mod objects;34pub use objects::*;35mod manifest;36pub use manifest::*;37mod parse;38pub use parse::*;39mod strings;40pub use strings::*;41mod misc;42pub use misc::*;43mod sets;44pub use sets::*;45mod compat;46pub use compat::*;4748pub fn stdlib_uncached(settings: Rc<RefCell<Settings>>) -> ObjValue {49	let mut builder = ObjValueBuilder::new();5051	let expr = expr::stdlib_expr();52	let eval = jrsonnet_evaluator::evaluate(ContextBuilder::dangerous_empty_state().build(), &expr)53		.expect("stdlib.jsonnet should have no errors")54		.as_obj()55		.expect("stdlib.jsonnet should evaluate to object");5657	builder.with_super(eval);5859	for (name, builtin) in [60		// Types61		("type", builtin_type::INST),62		("isString", builtin_is_string::INST),63		("isNumber", builtin_is_number::INST),64		("isBoolean", builtin_is_boolean::INST),65		("isObject", builtin_is_object::INST),66		("isArray", builtin_is_array::INST),67		("isFunction", builtin_is_function::INST),68		// Arrays69		("makeArray", builtin_make_array::INST),70		("repeat", builtin_repeat::INST),71		("slice", builtin_slice::INST),72		("map", builtin_map::INST),73		("flatMap", builtin_flatmap::INST),74		("filter", builtin_filter::INST),75		("foldl", builtin_foldl::INST),76		("foldr", builtin_foldr::INST),77		("range", builtin_range::INST),78		("join", builtin_join::INST),79		("reverse", builtin_reverse::INST),80		("any", builtin_any::INST),81		("all", builtin_all::INST),82		("member", builtin_member::INST),83		("count", builtin_count::INST),84		// Math85		("abs", builtin_abs::INST),86		("sign", builtin_sign::INST),87		("max", builtin_max::INST),88		("min", builtin_min::INST),89		("sum", builtin_sum::INST),90		("modulo", builtin_modulo::INST),91		("floor", builtin_floor::INST),92		("ceil", builtin_ceil::INST),93		("log", builtin_log::INST),94		("pow", builtin_pow::INST),95		("sqrt", builtin_sqrt::INST),96		("sin", builtin_sin::INST),97		("cos", builtin_cos::INST),98		("tan", builtin_tan::INST),99		("asin", builtin_asin::INST),100		("acos", builtin_acos::INST),101		("atan", builtin_atan::INST),102		("exp", builtin_exp::INST),103		("mantissa", builtin_mantissa::INST),104		("exponent", builtin_exponent::INST),105		// Operator106		("mod", builtin_mod::INST),107		("primitiveEquals", builtin_primitive_equals::INST),108		("equals", builtin_equals::INST),109		("xor", builtin_xor::INST),110		("format", builtin_format::INST),111		// Sort112		("sort", builtin_sort::INST),113		("uniq", builtin_uniq::INST),114		("set", builtin_set::INST),115		// Hash116		("md5", builtin_md5::INST),117		("sha256", builtin_sha256::INST),118		("sha512", builtin_sha512::INST),119		// Encoding120		("encodeUTF8", builtin_encode_utf8::INST),121		("decodeUTF8", builtin_decode_utf8::INST),122		("base64", builtin_base64::INST),123		("base64Decode", builtin_base64_decode::INST),124		("base64DecodeBytes", builtin_base64_decode_bytes::INST),125		// Objects126		("objectFieldsEx", builtin_object_fields_ex::INST),127		("objectHasEx", builtin_object_has_ex::INST),128		// Manifest129		("escapeStringJson", builtin_escape_string_json::INST),130		("manifestJsonEx", builtin_manifest_json_ex::INST),131		("manifestYamlDoc", builtin_manifest_yaml_doc::INST),132		("manifestTomlEx", builtin_manifest_toml_ex::INST),133		// Parsing134		("parseJson", builtin_parse_json::INST),135		("parseYaml", builtin_parse_yaml::INST),136		// Strings137		("codepoint", builtin_codepoint::INST),138		("substr", builtin_substr::INST),139		("char", builtin_char::INST),140		("strReplace", builtin_str_replace::INST),141		("splitLimit", builtin_splitlimit::INST),142		("asciiUpper", builtin_ascii_upper::INST),143		("asciiLower", builtin_ascii_lower::INST),144		("findSubstr", builtin_find_substr::INST),145		("parseInt", builtin_parse_int::INST),146		#[cfg(feature = "exp-bigint")]147		("bigint", builtin_bigint::INST),148		("parseOctal", builtin_parse_octal::INST),149		("parseHex", builtin_parse_hex::INST),150		// Misc151		("length", builtin_length::INST),152		("startsWith", builtin_starts_with::INST),153		("endsWith", builtin_ends_with::INST),154		// Sets155		("setMember", builtin_set_member::INST),156		("setInter", builtin_set_inter::INST),157		// Compat158		("__compare", builtin___compare::INST),159	]160	.iter()161	.cloned()162	{163		builder164			.member(name.into())165			.hide()166			.value(Val::Func(FuncVal::StaticBuiltin(builtin)))167			.expect("no conflict");168	}169170	builder171		.member("extVar".into())172		.hide()173		.value(Val::Func(FuncVal::builtin(builtin_ext_var {174			settings: settings.clone(),175		})))176		.expect("no conflict");177	builder178		.member("native".into())179		.hide()180		.value(Val::Func(FuncVal::builtin(builtin_native {181			settings: settings.clone(),182		})))183		.expect("no conflict");184	builder185		.member("trace".into())186		.hide()187		.value(Val::Func(FuncVal::builtin(builtin_trace { settings })))188		.expect("no conflict");189190	builder191		.member("id".into())192		.hide()193		.value(Val::Func(FuncVal::Id))194		.expect("no conflict");195196	builder.build()197}198199pub trait TracePrinter {200	fn print_trace(&self, loc: CallLocation, value: IStr);201}202203pub struct StdTracePrinter {204	resolver: PathResolver,205}206impl StdTracePrinter {207	pub fn new(resolver: PathResolver) -> Self {208		Self { resolver }209	}210}211impl TracePrinter for StdTracePrinter {212	fn print_trace(&self, loc: CallLocation, value: IStr) {213		eprint!("TRACE:");214		if let Some(loc) = loc.0 {215			let locs = loc.0.map_source_locations(&[loc.1]);216			eprint!(217				" {}:{}",218				match loc.0.source_path().path() {219					Some(p) => self.resolver.resolve(p),220					None => loc.0.source_path().to_string(),221				},222				locs[0].line223			);224		}225		eprintln!(" {value}");226	}227}228229pub struct Settings {230	/// Used for `std.extVar`231	pub ext_vars: HashMap<IStr, TlaArg>,232	/// Used for `std.native`233	pub ext_natives: HashMap<IStr, Cc<TraceBox<dyn Builtin>>>,234	/// Used for `std.trace`235	pub trace_printer: Box<dyn TracePrinter>,236	/// Used for `std.thisFile`237	pub path_resolver: PathResolver,238}239240fn extvar_source(name: &str, code: impl Into<IStr>) -> Source {241	let source_name = format!("<extvar:{name}>");242	Source::new_virtual(source_name.into(), code.into())243}244245#[derive(Trace, Clone)]246pub struct ContextInitializer {247	/// When we don't need to support legacy-this-file, we can reuse same context for all files248	#[cfg(not(feature = "legacy-this-file"))]249	context: jrsonnet_evaluator::Context,250	/// For `populate`251	#[cfg(not(feature = "legacy-this-file"))]252	stdlib_thunk: Thunk<Val>,253	/// Otherwise, we can only keep first stdlib layer, and then stack thisFile on top of it254	#[cfg(feature = "legacy-this-file")]255	stdlib_obj: ObjValue,256	settings: Rc<RefCell<Settings>>,257}258impl ContextInitializer {259	pub fn new(_s: State, resolver: PathResolver) -> Self {260		let settings = Settings {261			ext_vars: Default::default(),262			ext_natives: Default::default(),263			trace_printer: Box::new(StdTracePrinter::new(resolver.clone())),264			path_resolver: resolver,265		};266		let settings = Rc::new(RefCell::new(settings));267		let stdlib_obj = stdlib_uncached(settings.clone());268		#[cfg(not(feature = "legacy-this-file"))]269		let stdlib_thunk = Thunk::evaluated(Val::Obj(stdlib_obj));270		Self {271			#[cfg(not(feature = "legacy-this-file"))]272			context: {273				let mut context = ContextBuilder::with_capacity(_s, 1);274				context.bind("std".into(), stdlib_thunk.clone());275				context.build()276			},277			#[cfg(not(feature = "legacy-this-file"))]278			stdlib_thunk,279			#[cfg(feature = "legacy-this-file")]280			stdlib_obj,281			settings,282		}283	}284	pub fn settings(&self) -> Ref<Settings> {285		self.settings.borrow()286	}287	pub fn settings_mut(&self) -> RefMut<Settings> {288		self.settings.borrow_mut()289	}290	pub fn add_ext_var(&self, name: IStr, value: Val) {291		self.settings_mut()292			.ext_vars293			.insert(name, TlaArg::Val(value));294	}295	pub fn add_ext_str(&self, name: IStr, value: IStr) {296		self.settings_mut()297			.ext_vars298			.insert(name, TlaArg::String(value));299	}300	pub fn add_ext_code(&self, name: &str, code: impl Into<IStr>) -> Result<()> {301		let code = code.into();302		let source = extvar_source(name, code.clone());303		let parsed = jrsonnet_parser::parse(304			&code,305			&jrsonnet_parser::ParserSettings {306				source: source.clone(),307			},308		)309		.map_err(|e| ImportSyntaxError {310			path: source,311			error: Box::new(e),312		})?;313		// self.data_mut().volatile_files.insert(source_name, code);314		self.settings_mut()315			.ext_vars316			.insert(name.into(), TlaArg::Code(parsed));317		Ok(())318	}319	pub fn add_native(&self, name: IStr, cb: impl Builtin) {320		self.settings_mut()321			.ext_natives322			.insert(name, Cc::new(tb!(cb)));323	}324}325impl jrsonnet_evaluator::ContextInitializer for ContextInitializer {326	fn reserve_vars(&self) -> usize {327		1328	}329	#[cfg(not(feature = "legacy-this-file"))]330	fn initialize(&self, _s: State, _source: Source) -> jrsonnet_evaluator::Context {331		self.context.clone()332	}333	#[cfg(not(feature = "legacy-this-file"))]334	fn populate(&self, _for_file: Source, builder: &mut ContextBuilder) {335		builder.bind("std".into(), self.stdlib_thunk.clone());336	}337	#[cfg(feature = "legacy-this-file")]338	fn populate(&self, source: Source, builder: &mut ContextBuilder) {339		use jrsonnet_evaluator::val::StrValue;340341		let mut std = ObjValueBuilder::new();342		std.with_super(self.stdlib_obj.clone());343		std.member("thisFile".into())344			.hide()345			.value(Val::Str(StrValue::Flat(346				match source.source_path().path() {347					Some(p) => self.settings().path_resolver.resolve(p).into(),348					None => source.source_path().to_string().into(),349				},350			)))351			.expect("this object builder is empty");352		let stdlib_with_this_file = std.build();353354		builder.bind(355			"std".into(),356			Thunk::evaluated(Val::Obj(stdlib_with_this_file)),357		);358	}359	fn as_any(&self) -> &dyn std::any::Any {360		self361	}362}363364pub trait StateExt {365	/// This method was previously implemented in jrsonnet-evaluator itself366	fn with_stdlib(&self);367}368369impl StateExt for State {370	fn with_stdlib(&self) {371		let initializer = ContextInitializer::new(self.clone(), PathResolver::new_cwd_fallback());372		self.settings_mut().context_initializer = tb!(initializer)373	}374}
after · crates/jrsonnet-stdlib/src/lib.rs
1use std::{2	cell::{Ref, RefCell, RefMut},3	collections::HashMap,4	rc::Rc,5};67use jrsonnet_evaluator::{8	error::{ErrorKind::*, Result},9	function::{builtin::Builtin, CallLocation, FuncVal, TlaArg},10	gc::TraceBox,11	tb,12	trace::PathResolver,13	ContextBuilder, IStr, ObjValue, ObjValueBuilder, State, Thunk, Val,14};15use jrsonnet_gcmodule::{Cc, Trace};16use jrsonnet_parser::Source;1718mod expr;19mod types;20pub use types::*;21mod arrays;22pub use arrays::*;23mod math;24pub use math::*;25mod operator;26pub use operator::*;27mod sort;28pub use sort::*;29mod hash;30pub use hash::*;31mod encoding;32pub use encoding::*;33mod objects;34pub use objects::*;35mod manifest;36pub use manifest::*;37mod parse;38pub use parse::*;39mod strings;40pub use strings::*;41mod misc;42pub use misc::*;43mod sets;44pub use sets::*;45mod compat;46pub use compat::*;4748pub fn stdlib_uncached(settings: Rc<RefCell<Settings>>) -> ObjValue {49	let mut builder = ObjValueBuilder::new();5051	let expr = expr::stdlib_expr();52	let eval = jrsonnet_evaluator::evaluate(ContextBuilder::dangerous_empty_state().build(), &expr)53		.expect("stdlib.jsonnet should have no errors")54		.as_obj()55		.expect("stdlib.jsonnet should evaluate to object");5657	builder.with_super(eval);5859	for (name, builtin) in [60		// Types61		("type", builtin_type::INST),62		("isString", builtin_is_string::INST),63		("isNumber", builtin_is_number::INST),64		("isBoolean", builtin_is_boolean::INST),65		("isObject", builtin_is_object::INST),66		("isArray", builtin_is_array::INST),67		("isFunction", builtin_is_function::INST),68		// Arrays69		("makeArray", builtin_make_array::INST),70		("repeat", builtin_repeat::INST),71		("slice", builtin_slice::INST),72		("map", builtin_map::INST),73		("flatMap", builtin_flatmap::INST),74		("filter", builtin_filter::INST),75		("foldl", builtin_foldl::INST),76		("foldr", builtin_foldr::INST),77		("range", builtin_range::INST),78		("join", builtin_join::INST),79		("reverse", builtin_reverse::INST),80		("any", builtin_any::INST),81		("all", builtin_all::INST),82		("member", builtin_member::INST),83		("contains", builtin_member::INST),84		("count", builtin_count::INST),85		("avg", builtin_avg::INST),86		("removeAt", builtin_remove_at::INST),87		("remove", builtin_remove::INST),88		// Math89		("abs", builtin_abs::INST),90		("sign", builtin_sign::INST),91		("max", builtin_max::INST),92		("min", builtin_min::INST),93		("sum", builtin_sum::INST),94		("modulo", builtin_modulo::INST),95		("floor", builtin_floor::INST),96		("ceil", builtin_ceil::INST),97		("log", builtin_log::INST),98		("pow", builtin_pow::INST),99		("sqrt", builtin_sqrt::INST),100		("sin", builtin_sin::INST),101		("cos", builtin_cos::INST),102		("tan", builtin_tan::INST),103		("asin", builtin_asin::INST),104		("acos", builtin_acos::INST),105		("atan", builtin_atan::INST),106		("exp", builtin_exp::INST),107		("mantissa", builtin_mantissa::INST),108		("exponent", builtin_exponent::INST),109		("round", builtin_round::INST),110		("isEven", builtin_is_even::INST),111		("isOdd", builtin_is_odd::INST),112		("isInteger", builtin_is_integer::INST),113		("isDecimal", builtin_is_decimal::INST),114		// Operator115		("mod", builtin_mod::INST),116		("primitiveEquals", builtin_primitive_equals::INST),117		("equals", builtin_equals::INST),118		("xor", builtin_xor::INST),119		("xnor", builtin_xnor::INST),120		("format", builtin_format::INST),121		// Sort122		("sort", builtin_sort::INST),123		("uniq", builtin_uniq::INST),124		("set", builtin_set::INST),125		("minArray", builtin_min_array::INST),126		("maxArray", builtin_max_array::INST),127		// Hash128		("md5", builtin_md5::INST),129		("sha1", builtin_sha1::INST),130		("sha256", builtin_sha256::INST),131		("sha512", builtin_sha512::INST),132		("sha3", builtin_sha3::INST),133		// Encoding134		("encodeUTF8", builtin_encode_utf8::INST),135		("decodeUTF8", builtin_decode_utf8::INST),136		("base64", builtin_base64::INST),137		("base64Decode", builtin_base64_decode::INST),138		("base64DecodeBytes", builtin_base64_decode_bytes::INST),139		// Objects140		("objectFieldsEx", builtin_object_fields_ex::INST),141		("objectHasEx", builtin_object_has_ex::INST),142		("objectRemoveKey", builtin_object_remove_key::INST),143		// Manifest144		("escapeStringJson", builtin_escape_string_json::INST),145		("manifestJsonEx", builtin_manifest_json_ex::INST),146		("manifestYamlDoc", builtin_manifest_yaml_doc::INST),147		("manifestTomlEx", builtin_manifest_toml_ex::INST),148		// Parsing149		("parseJson", builtin_parse_json::INST),150		("parseYaml", builtin_parse_yaml::INST),151		// Strings152		("codepoint", builtin_codepoint::INST),153		("substr", builtin_substr::INST),154		("char", builtin_char::INST),155		("strReplace", builtin_str_replace::INST),156		("isEmpty", builtin_is_empty::INST),157		("equalsIgnoreCase", builtin_equals_ignore_case::INST),158		("splitLimit", builtin_splitlimit::INST),159		("asciiUpper", builtin_ascii_upper::INST),160		("asciiLower", builtin_ascii_lower::INST),161		("findSubstr", builtin_find_substr::INST),162		("parseInt", builtin_parse_int::INST),163		#[cfg(feature = "exp-bigint")]164		("bigint", builtin_bigint::INST),165		("parseOctal", builtin_parse_octal::INST),166		("parseHex", builtin_parse_hex::INST),167		// Misc168		("length", builtin_length::INST),169		("startsWith", builtin_starts_with::INST),170		("endsWith", builtin_ends_with::INST),171		// Sets172		("setMember", builtin_set_member::INST),173		("setInter", builtin_set_inter::INST),174		// Compat175		("__compare", builtin___compare::INST),176	]177	.iter()178	.cloned()179	{180		builder181			.member(name.into())182			.hide()183			.value(Val::Func(FuncVal::StaticBuiltin(builtin)))184			.expect("no conflict");185	}186187	builder188		.member("extVar".into())189		.hide()190		.value(Val::Func(FuncVal::builtin(builtin_ext_var {191			settings: settings.clone(),192		})))193		.expect("no conflict");194	builder195		.member("native".into())196		.hide()197		.value(Val::Func(FuncVal::builtin(builtin_native {198			settings: settings.clone(),199		})))200		.expect("no conflict");201	builder202		.member("trace".into())203		.hide()204		.value(Val::Func(FuncVal::builtin(builtin_trace { settings })))205		.expect("no conflict");206207	builder208		.member("id".into())209		.hide()210		.value(Val::Func(FuncVal::Id))211		.expect("no conflict");212213	builder.build()214}215216pub trait TracePrinter {217	fn print_trace(&self, loc: CallLocation, value: IStr);218}219220pub struct StdTracePrinter {221	resolver: PathResolver,222}223impl StdTracePrinter {224	pub fn new(resolver: PathResolver) -> Self {225		Self { resolver }226	}227}228impl TracePrinter for StdTracePrinter {229	fn print_trace(&self, loc: CallLocation, value: IStr) {230		eprint!("TRACE:");231		if let Some(loc) = loc.0 {232			let locs = loc.0.map_source_locations(&[loc.1]);233			eprint!(234				" {}:{}",235				match loc.0.source_path().path() {236					Some(p) => self.resolver.resolve(p),237					None => loc.0.source_path().to_string(),238				},239				locs[0].line240			);241		}242		eprintln!(" {value}");243	}244}245246pub struct Settings {247	/// Used for `std.extVar`248	pub ext_vars: HashMap<IStr, TlaArg>,249	/// Used for `std.native`250	pub ext_natives: HashMap<IStr, Cc<TraceBox<dyn Builtin>>>,251	/// Used for `std.trace`252	pub trace_printer: Box<dyn TracePrinter>,253	/// Used for `std.thisFile`254	pub path_resolver: PathResolver,255}256257fn extvar_source(name: &str, code: impl Into<IStr>) -> Source {258	let source_name = format!("<extvar:{name}>");259	Source::new_virtual(source_name.into(), code.into())260}261262#[derive(Trace, Clone)]263pub struct ContextInitializer {264	/// When we don't need to support legacy-this-file, we can reuse same context for all files265	#[cfg(not(feature = "legacy-this-file"))]266	context: jrsonnet_evaluator::Context,267	/// For `populate`268	#[cfg(not(feature = "legacy-this-file"))]269	stdlib_thunk: Thunk<Val>,270	/// Otherwise, we can only keep first stdlib layer, and then stack thisFile on top of it271	#[cfg(feature = "legacy-this-file")]272	stdlib_obj: ObjValue,273	settings: Rc<RefCell<Settings>>,274}275impl ContextInitializer {276	pub fn new(_s: State, resolver: PathResolver) -> Self {277		let settings = Settings {278			ext_vars: Default::default(),279			ext_natives: Default::default(),280			trace_printer: Box::new(StdTracePrinter::new(resolver.clone())),281			path_resolver: resolver,282		};283		let settings = Rc::new(RefCell::new(settings));284		let stdlib_obj = stdlib_uncached(settings.clone());285		#[cfg(not(feature = "legacy-this-file"))]286		let stdlib_thunk = Thunk::evaluated(Val::Obj(stdlib_obj));287		Self {288			#[cfg(not(feature = "legacy-this-file"))]289			context: {290				let mut context = ContextBuilder::with_capacity(_s, 1);291				context.bind("std".into(), stdlib_thunk.clone());292				context.build()293			},294			#[cfg(not(feature = "legacy-this-file"))]295			stdlib_thunk,296			#[cfg(feature = "legacy-this-file")]297			stdlib_obj,298			settings,299		}300	}301	pub fn settings(&self) -> Ref<Settings> {302		self.settings.borrow()303	}304	pub fn settings_mut(&self) -> RefMut<Settings> {305		self.settings.borrow_mut()306	}307	pub fn add_ext_var(&self, name: IStr, value: Val) {308		self.settings_mut()309			.ext_vars310			.insert(name, TlaArg::Val(value));311	}312	pub fn add_ext_str(&self, name: IStr, value: IStr) {313		self.settings_mut()314			.ext_vars315			.insert(name, TlaArg::String(value));316	}317	pub fn add_ext_code(&self, name: &str, code: impl Into<IStr>) -> Result<()> {318		let code = code.into();319		let source = extvar_source(name, code.clone());320		let parsed = jrsonnet_parser::parse(321			&code,322			&jrsonnet_parser::ParserSettings {323				source: source.clone(),324			},325		)326		.map_err(|e| ImportSyntaxError {327			path: source,328			error: Box::new(e),329		})?;330		// self.data_mut().volatile_files.insert(source_name, code);331		self.settings_mut()332			.ext_vars333			.insert(name.into(), TlaArg::Code(parsed));334		Ok(())335	}336	pub fn add_native(&self, name: IStr, cb: impl Builtin) {337		self.settings_mut()338			.ext_natives339			.insert(name, Cc::new(tb!(cb)));340	}341}342impl jrsonnet_evaluator::ContextInitializer for ContextInitializer {343	fn reserve_vars(&self) -> usize {344		1345	}346	#[cfg(not(feature = "legacy-this-file"))]347	fn initialize(&self, _s: State, _source: Source) -> jrsonnet_evaluator::Context {348		self.context.clone()349	}350	#[cfg(not(feature = "legacy-this-file"))]351	fn populate(&self, _for_file: Source, builder: &mut ContextBuilder) {352		builder.bind("std".into(), self.stdlib_thunk.clone());353	}354	#[cfg(feature = "legacy-this-file")]355	fn populate(&self, source: Source, builder: &mut ContextBuilder) {356		use jrsonnet_evaluator::val::StrValue;357358		let mut std = ObjValueBuilder::new();359		std.with_super(self.stdlib_obj.clone());360		std.member("thisFile".into())361			.hide()362			.value(Val::Str(StrValue::Flat(363				match source.source_path().path() {364					Some(p) => self.settings().path_resolver.resolve(p).into(),365					None => source.source_path().to_string().into(),366				},367			)))368			.expect("this object builder is empty");369		let stdlib_with_this_file = std.build();370371		builder.bind(372			"std".into(),373			Thunk::evaluated(Val::Obj(stdlib_with_this_file)),374		);375	}376	fn as_any(&self) -> &dyn std::any::Any {377		self378	}379}380381pub trait StateExt {382	/// This method was previously implemented in jrsonnet-evaluator itself383	fn with_stdlib(&self);384}385386impl StateExt for State {387	fn with_stdlib(&self) {388		let initializer = ContextInitializer::new(self.clone(), PathResolver::new_cwd_fallback());389		self.settings_mut().context_initializer = tb!(initializer)390	}391}
modifiedcrates/jrsonnet-stdlib/src/math.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/math.rs
+++ b/crates/jrsonnet-stdlib/src/math.rs
@@ -114,3 +114,28 @@
 pub fn builtin_exponent(x: f64) -> i16 {
 	frexp(x).1
 }
+
+#[builtin]
+pub fn builtin_round(x: f64) -> f64 {
+	x.round()
+}
+
+#[builtin]
+pub fn builtin_is_even(x: f64) -> bool {
+	builtin_round(x) % 2.0 == 0.0
+}
+
+#[builtin]
+pub fn builtin_is_odd(x: f64) -> bool {
+	builtin_round(x) % 2.0 == 1.0
+}
+
+#[builtin]
+pub fn builtin_is_integer(x: f64) -> bool {
+	builtin_round(x) == x
+}
+
+#[builtin]
+pub fn builtin_is_decimal(x: f64) -> bool {
+	builtin_round(x) != x
+}
modifiedcrates/jrsonnet-stdlib/src/objects.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/objects.rs
+++ b/crates/jrsonnet-stdlib/src/objects.rs
@@ -1,9 +1,10 @@
 use jrsonnet_evaluator::{
 	function::builtin,
 	val::{StrValue, Val},
-	IStr, ObjValue,
+	IStr, ObjValue, ObjValueBuilder,
 };
 
+
 #[builtin]
 pub fn builtin_object_fields_ex(
 	obj: ObjValue,
@@ -27,3 +28,16 @@
 pub fn builtin_object_has_ex(obj: ObjValue, fname: IStr, hidden: bool) -> bool {
 	obj.has_field_ex(fname, hidden)
 }
+
+#[builtin]
+pub fn builtin_object_remove_key(obj: ObjValue, key: IStr) -> ObjValue {
+	let mut new_obj = ObjValueBuilder::with_capacity(obj.len() - 1);
+	for (k, v) in obj.iter() {
+		if k == key {
+			continue
+		}
+		new_obj.member(k).value_unchecked(v.unwrap())
+	}
+
+	new_obj.build()
+}
modifiedcrates/jrsonnet-stdlib/src/operator.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/operator.rs
+++ b/crates/jrsonnet-stdlib/src/operator.rs
@@ -39,6 +39,11 @@
 }
 
 #[builtin]
+pub fn builtin_xnor(x: bool, y: bool) -> bool {
+	x == y
+}
+
+#[builtin]
 pub fn builtin_format(str: IStr, vals: Val) -> Result<String> {
 	std_format(&str, vals)
 }
modifiedcrates/jrsonnet-stdlib/src/sort.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/sort.rs
+++ b/crates/jrsonnet-stdlib/src/sort.rs
@@ -1,3 +1,5 @@
+#![allow(non_snake_case)]
+
 use std::cmp::Ordering;
 
 use jrsonnet_evaluator::{
@@ -9,6 +11,9 @@
 	Thunk, Val,
 };
 use jrsonnet_gcmodule::Cc;
+use jrsonnet_parser::BinaryOpType;
+
+use crate::eval_on_empty;
 
 #[derive(Copy, Clone)]
 enum SortKeyType {
@@ -64,15 +69,13 @@
 			let mut err = None;
 			// evaluate_compare_op will never return equal on types, which are different from
 			// jsonnet perspective
-			values.sort_unstable_by(|a, b| {
-				match evaluate_compare_op(a, b, jrsonnet_parser::BinaryOpType::Lt) {
-					Ok(ord) => ord,
-					Err(e) if err.is_none() => {
-						let _ = err.insert(e);
-						Ordering::Equal
-					}
-					Err(_) => Ordering::Equal,
+			values.sort_unstable_by(|a, b| match evaluate_compare_op(a, b, BinaryOpType::Lt) {
+				Ok(ord) => ord,
+				Err(e) if err.is_none() => {
+					let _ = err.insert(e);
+					Ordering::Equal
 				}
+				Err(_) => Ordering::Equal,
 			});
 			if let Some(err) = err {
 				return Err(err);
@@ -105,16 +108,16 @@
 			let mut err = None;
 			// evaluate_compare_op will never return equal on types, which are different from
 			// jsonnet perspective
-			vk.sort_by(|(_a, ak), (_b, bk)| {
-				match evaluate_compare_op(ak, bk, jrsonnet_parser::BinaryOpType::Lt) {
+			vk.sort_by(
+				|(_a, ak), (_b, bk)| match evaluate_compare_op(ak, bk, BinaryOpType::Lt) {
 					Ok(ord) => ord,
 					Err(e) if err.is_none() => {
 						let _ = err.insert(e);
 						Ordering::Equal
 					}
 					Err(_) => Ordering::Equal,
-				}
-			});
+				},
+			);
 			if let Some(err) = err {
 				return Err(err);
 			}
@@ -138,7 +141,6 @@
 }
 
 #[builtin]
-#[allow(non_snake_case)]
 pub fn builtin_sort(arr: ArrValue, keyF: Option<FuncVal>) -> Result<ArrValue> {
 	super::sort::sort(arr, keyF.unwrap_or_else(FuncVal::identity))
 }
@@ -206,3 +208,50 @@
 		Ok(ArrValue::lazy(Cc::new(arr)))
 	}
 }
+
+
+fn eval_keyf(val: Val, key_f: &Option<FuncVal>) -> Result<Val> {
+	if let Some(key_f) = key_f {
+		key_f.evaluate_simple(&(val,), false)
+	} else {
+		Ok(val)
+	}
+}
+
+fn array_top1(arr: ArrValue, key_f: Option<FuncVal>, ordering: Ordering) -> Result<Val> {
+	let mut iter = arr.iter();
+	let mut min = iter.next().expect("not empty")?;
+	let mut min_key = eval_keyf(min.clone(), &key_f)?;
+	for item in iter {
+		let cur = item?;
+		let cur_key = eval_keyf(cur.clone(), &key_f)?;
+		if evaluate_compare_op(&cur_key, &min_key, BinaryOpType::Lt)? == ordering {
+			min = cur;
+			min_key = cur_key;
+		}
+	}
+	Ok(min)
+}
+
+#[builtin]
+pub fn builtin_min_array(
+	arr: ArrValue,
+	keyF: Option<FuncVal>,
+	onEmpty: Option<Thunk<Val>>,
+) -> Result<Val> {
+	if arr.is_empty() {
+		return eval_on_empty(onEmpty);
+	}
+	array_top1(arr, keyF, Ordering::Less)
+}
+#[builtin]
+pub fn builtin_max_array(
+	arr: ArrValue,
+	keyF: Option<FuncVal>,
+	onEmpty: Option<Thunk<Val>>,
+) -> Result<Val> {
+	if arr.is_empty() {
+		return eval_on_empty(onEmpty);
+	}
+	array_top1(arr, keyF, Ordering::Greater)
+}
modifiedcrates/jrsonnet-stdlib/src/std.jsonnetdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/std.jsonnet
+++ b/crates/jrsonnet-stdlib/src/std.jsonnet
@@ -274,6 +274,12 @@
   objectValuesAll(o)::
     [o[k] for k in std.objectFieldsAll(o)],
 
+  objectKeysValues(o)::
+    [{ key: k, value: o[k] } for k in std.objectFields(o)],
+	
+  objectKeysValuesAll(o)::
+		[{ key: k, value: o[k] } for k in std.objectFieldsAll(o)],
+
   resolvePath(f, r)::
     local arr = std.split(f, '/');
     std.join('/', std.makeArray(std.length(arr) - 1, function(i) arr[i]) + [r]),
modifiedcrates/jrsonnet-stdlib/src/strings.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/strings.rs
+++ b/crates/jrsonnet-stdlib/src/strings.rs
@@ -28,6 +28,16 @@
 }
 
 #[builtin]
+pub fn builtin_is_empty(str: String) -> bool {
+	str.is_empty()
+}
+
+#[builtin]
+pub fn builtin_equals_ignore_case(x: String, y: String) -> bool {
+	x.to_ascii_lowercase() == y.to_ascii_lowercase()
+}
+
+#[builtin]
 pub fn builtin_splitlimit(str: IStr, c: IStr, maxsplits: Either![usize, M1]) -> ArrValue {
 	use Either2::*;
 	match maxsplits {