From ec248ddaecb5adba5584d39c90cf76bcf5a8e9f2 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Mon, 10 Jun 2024 18:31:16 +0200 Subject: [PATCH] fix: update deno_core to latest to work better with rust 1.78 (#3890) --- backend/Cargo.lock | 399 +++++++++++++++++-------- backend/Cargo.toml | 27 +- backend/windmill-worker/Cargo.toml | 3 + backend/windmill-worker/build.rs | 59 +++- backend/windmill-worker/src/js_eval.rs | 123 ++++++-- backend/windmill-worker/src/runtime.js | 2 + 6 files changed, 446 insertions(+), 167 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index dc305d2099..7153c4bc26 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -447,9 +447,9 @@ dependencies = [ [[package]] name = "ast_node" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e521452c6bce47ee5a5461c5e5d707212907826de14124962c58fcaf463115e" +checksum = "2ab31376d309dd3bfc9cfb3c11c93ce0e0741bbe0354b20e7f8c60b044730b79" dependencies = [ "proc-macro2", "quote", @@ -999,7 +999,7 @@ dependencies = [ "once_cell", "pin-project-lite", "pin-utils", - "rustls 0.21.12", + "rustls 0.21.11", "tokio", "tracing", ] @@ -2574,9 +2574,9 @@ dependencies = [ [[package]] name = "deno_ast" -version = "0.33.3" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f61944e781d268799bf65857e664d3c09a37590043d4b0ed10facefc9bea473" +checksum = "042645e6a505a359b288723ded5c8b30fdc4f70514a3bcd7a49221cc89c1ba90" dependencies = [ "anyhow", "base64 0.21.7", @@ -2608,26 +2608,28 @@ dependencies = [ "swc_visit", "swc_visit_macros", "text_lines", + "thiserror", "unicode-width", "url", ] [[package]] name = "deno_console" -version = "0.138.0" +version = "0.155.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "127f3cd696c88f4304aff28c621403b467e1ea032fef9a68d97224f23f0feca0" +checksum = "1010ed683985a70fce7f449c39b1d1a62675ab178b86f70eff954a161aa6dcaf" dependencies = [ "deno_core", ] [[package]] name = "deno_core" -version = "0.262.0" +version = "0.284.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0c12fbe4f2c497ff53de92dd698a27d93f8e9c2519ea5684f608cb9f4ef44b" +checksum = "f4a5c809e81be26fcfbbce4275573251f6a156137b67059889e9e38f73e75b63" dependencies = [ "anyhow", + "bincode", "bit-set", "bit-vec", "bytes", @@ -2637,7 +2639,6 @@ dependencies = [ "deno_unsync", "futures", "libc", - "log", "memoffset", "parking_lot", "pin-project", @@ -2645,7 +2646,7 @@ dependencies = [ "serde_json", "serde_v8", "smallvec", - "sourcemap 7.1.1", + "sourcemap", "static_assertions", "tokio", "url", @@ -2660,9 +2661,9 @@ checksum = "a13951ea98c0a4c372f162d669193b4c9d991512de9f2381dd161027f34b26b1" [[package]] name = "deno_fetch" -version = "0.162.0" +version = "0.179.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bda01ee18545896687663c44c74833b51f1a9c2b1afa5dc9b963174a8639c02" +checksum = "f3369e2461bd27dd73761d3d5644e9de4e950a5eaf5a6f8b35befa70925e83b7" dependencies = [ "bytes", "data-url", @@ -2670,7 +2671,6 @@ dependencies = [ "deno_tls", "dyn-clone", "http 0.2.12", - "pin-project", "reqwest 0.11.20", "serde", "serde_json", @@ -2703,10 +2703,27 @@ dependencies = [ ] [[package]] -name = "deno_ops" -version = "0.138.0" +name = "deno_net" +version = "0.147.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04698b09128a026abe3d8a82fdb231baf1a35f07443844728fe1441b2c2340f1" +checksum = "39018ef0287bf6f5fb562d0f70436f6f4d3751a2ae4cecc6bbc81ed872cc7049" +dependencies = [ + "deno_core", + "deno_tls", + "pin-project", + "rustls-tokio-stream", + "serde", + "socket2 0.5.7", + "tokio", + "trust-dns-proto", + "trust-dns-resolver", +] + +[[package]] +name = "deno_ops" +version = "0.160.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "517e54d41a2da6a69b8f534294334d79d9115ddd43aea88a5ceefdb717e6d85e" dependencies = [ "proc-macro-rules", "proc-macro2", @@ -2729,18 +2746,18 @@ dependencies = [ [[package]] name = "deno_tls" -version = "0.125.0" +version = "0.142.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60348b1603059601ec4573e2e1f36579039668fa0b1cd47baba39056ce0f5e7a" +checksum = "afcb8854b60991f30b7f6ac1f71660118f13aab1693a23ec3187d17e94328fd2" dependencies = [ "deno_core", "deno_native_certs", - "once_cell", - "rustls 0.21.12", + "rustls 0.21.11", "rustls-pemfile 1.0.4", "rustls-tokio-stream", "rustls-webpki 0.101.7", "serde", + "tokio", "webpki-roots 0.25.4", ] @@ -2755,20 +2772,19 @@ dependencies = [ [[package]] name = "deno_url" -version = "0.138.0" +version = "0.155.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf8297e19f3ac7ef20915a997897ee50727c25c6c27483abcac51c2071e9fc4d" +checksum = "24064eadd07ab4f790c930620da96bd60652986d1ebd6865421cb338f8f06b99" dependencies = [ "deno_core", - "serde", "urlpattern", ] [[package]] name = "deno_web" -version = "0.169.0" +version = "0.186.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4020ea0467666c8e3cb751be833c12b7bc9df203f8e36c0fa23225f6547f2cc7" +checksum = "f968c158f3c8eac2a87f7dd200b80b3f55b31653bf73b312444fefa2f11d4aba" dependencies = [ "async-trait", "base64-simd 0.8.0", @@ -2780,14 +2796,13 @@ dependencies = [ "serde", "tokio", "uuid 1.8.0", - "windows-sys 0.48.0", ] [[package]] name = "deno_webidl" -version = "0.138.0" +version = "0.155.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "344a5a4dd5628298e533e7e192bee6d2cf141b14e22fc998b8dbaf64d8153758" +checksum = "3c69595f53f1abdf59a55b2d60ffe9a9eea3c14c96b42336124252105d532d23" dependencies = [ "deno_core", ] @@ -2985,11 +3000,10 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "dprint-swc-ext" -version = "0.14.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebaedd46a16dd179b260a9fcb56be5780814afcb20f615eedde6acf971c9628e" +checksum = "019d17f2c2457c5a70a7cf4505b1a562ca8ab168c0ac0c005744efbd29fcb8fe" dependencies = [ - "bumpalo", "num-bigint", "rustc-hash", "swc_atoms", @@ -3318,9 +3332,9 @@ dependencies = [ [[package]] name = "from_variant" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a0b11eeb173ce52f84ebd943d42e58813a2ebb78a6a3ff0a243b71c5199cd7b" +checksum = "fdc9cc75639b041067353b9bce2450d6847e547276c6fbe4487d7407980e07db" dependencies = [ "proc-macro2", "swc_macros_common", @@ -3535,7 +3549,7 @@ dependencies = [ "hyper 0.14.29", "hyper-rustls", "ring 0.16.20", - "rustls 0.21.12", + "rustls 0.21.11", "rustls-pemfile 1.0.4", "serde", "serde_json", @@ -3800,6 +3814,15 @@ dependencies = [ "subtle", ] +[[package]] +name = "gzip-header" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95cc527b92e6029a62960ad99aa8a6660faa4555fe5f731aab13aa6a921795a2" +dependencies = [ + "crc32fast", +] + [[package]] name = "h2" version = "0.3.26" @@ -3960,6 +3983,17 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + [[package]] name = "hstr" version = "0.2.10" @@ -4124,7 +4158,7 @@ dependencies = [ "http 0.2.12", "hyper 0.14.29", "log", - "rustls 0.21.12", + "rustls 0.21.11", "rustls-native-certs", "tokio", "tokio-rustls 0.24.1", @@ -4208,6 +4242,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "idna" version = "0.5.0" @@ -4303,6 +4347,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "ipconfig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" +dependencies = [ + "socket2 0.5.7", + "widestring", + "windows-sys 0.48.0", + "winreg 0.50.0", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -4597,6 +4653,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.3.8" @@ -4647,6 +4709,15 @@ dependencies = [ "hashbrown 0.14.5", ] +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "lz4_flex" version = "0.11.3" @@ -4784,6 +4855,12 @@ dependencies = [ "malachite-nz", ] +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + [[package]] name = "matchers" version = "0.1.0" @@ -5782,17 +5859,6 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" -[[package]] -name = "pmutil" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "polling" version = "2.8.0" @@ -6155,6 +6221,12 @@ dependencies = [ "reborrow", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quick-xml" version = "0.30.0" @@ -6496,7 +6568,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.12", + "rustls 0.21.11", "rustls-native-certs", "rustls-pemfile 1.0.4", "serde", @@ -6561,6 +6633,16 @@ dependencies = [ "winreg 0.52.0", ] +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -6815,9 +6897,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.12" +version = "0.21.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" dependencies = [ "log", "ring 0.17.8", @@ -6878,12 +6960,12 @@ checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-tokio-stream" -version = "0.2.17" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded7a36e8ac05b8ada77a84c5ceec95361942ee9dedb60a82f93f788a791aae8" +checksum = "fd707225bb670bcd2876886bb571753d1ce03a9cedfa2e629a79984ca9a93cfb" dependencies = [ "futures", - "rustls 0.21.12", + "rustls 0.21.11", "socket2 0.5.7", "tokio", ] @@ -7313,12 +7395,10 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.171.0" +version = "0.193.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a2746b1f9e4015ee5f325bb87ab0f1891b76c38dfb1675bc83857eaf6451d0" +checksum = "21ec612dfc7ab70330b5405e8015b25e637bbfe1d79c4bd173557933aea66e76" dependencies = [ - "bytes", - "derive_more", "num-bigint", "serde", "smallvec", @@ -7600,30 +7680,16 @@ dependencies = [ [[package]] name = "sourcemap" -version = "6.4.1" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4cbf65ca7dc576cf50e21f8d0712d96d4fcfd797389744b7b222a85cdf5bd90" -dependencies = [ - "data-encoding", - "debugid", - "if_chain", - "rustc_version 0.2.3", - "serde", - "serde_json", - "unicode-id", - "url", -] - -[[package]] -name = "sourcemap" -version = "7.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7768edd06c02535e0d50653968f46e1e0d3aa54742190d35dd9466f59de9c71" +checksum = "208d40b9e8cad9f93613778ea295ed8f3c2b1824217c6cfc7219d3f6f45b96d4" dependencies = [ "base64-simd 0.7.0", + "bitvec", "data-encoding", "debugid", "if_chain", + "rustc-hash", "rustc_version 0.2.3", "serde", "serde_json", @@ -7762,7 +7828,7 @@ dependencies = [ "once_cell", "paste", "percent-encoding", - "rustls 0.21.12", + "rustls 0.21.11", "rustls-pemfile 1.0.4", "serde", "serde_json", @@ -7956,9 +8022,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "string_enum" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6960defec35d15d58331ffb8a315d551634f757fe139c7b3d6063cae88ec90f6" +checksum = "05e383308aebc257e7d7920224fa055c632478d92744eca77f99be8fa1545b90" dependencies = [ "proc-macro2", "quote", @@ -8051,9 +8117,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "swc_atoms" -version = "0.6.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d538eaaa6f085161d088a04cf0a3a5a52c5a7f2b3bd9b83f73f058b0ed357c0" +checksum = "bb6567e4e67485b3e7662b486f1565bdae54bd5b9d6b16b2ba1a9babb1e42125" dependencies = [ "hstr", "once_cell", @@ -8077,9 +8143,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.33.17" +version = "0.33.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "095c158fe55b36faeebb4274692643a6d7cdc5b7902e1d5968ddbe52b7de1d1c" +checksum = "a2f9706038906e66f3919028f9f7a37f3ed552f1b85578e93f4468742e2da438" dependencies = [ "ast_node", "better_scoped_tls", @@ -8092,7 +8158,7 @@ dependencies = [ "rustc-hash", "serde", "siphasher", - "sourcemap 6.4.1", + "sourcemap", "swc_atoms", "swc_eq_ignore_macros", "swc_visit", @@ -8103,9 +8169,9 @@ dependencies = [ [[package]] name = "swc_config" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce837c5eae1cb200a310940de989fd9b3d12ed62d7752bc69b39ef8aa775ec04" +checksum = "7be1a689e146be1eae53139482cb061dcf0fa01dff296bbe7b96fff92d8e2936" dependencies = [ "anyhow", "indexmap 2.2.6", @@ -8117,9 +8183,9 @@ dependencies = [ [[package]] name = "swc_config_macro" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2574f75082322a27d990116cd2a24de52945fc94172b24ca0b3e9e2a6ceb6b" +checksum = "7c5f56139042c1a95b54f5ca48baa0e0172d369bcc9d3d473dad1de36bae8399" dependencies = [ "proc-macro2", "quote", @@ -8129,9 +8195,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.112.2" +version = "0.113.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852a48a24a2533de88298c6b25355bc68fdee31ac21cb4fb8939b7001715353c" +checksum = "dc1690cc0c9ab60b44ac0225ba1e231ac532f7ba1d754df761c6ee607561afae" dependencies = [ "bitflags 2.5.0", "is-macro", @@ -8142,21 +8208,21 @@ dependencies = [ "string_enum", "swc_atoms", "swc_common", - "unicode-id", + "unicode-id-start", ] [[package]] name = "swc_ecma_codegen" -version = "0.148.3" +version = "0.149.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79df3f8c5ed028fce5dc24acb83002c0854f8b9d7e893292aeee394a6b9eaf4" +checksum = "4fef147127a2926ca26171c7afcbf028ff86dc543ced87d316713f25620a15b9" dependencies = [ "memchr", "num-bigint", "once_cell", "rustc-hash", "serde", - "sourcemap 6.4.1", + "sourcemap", "swc_atoms", "swc_common", "swc_ecma_ast", @@ -8166,9 +8232,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen_macros" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "394b8239424b339a12012ceb18726ed0244fce6bf6345053cb9320b2791dcaa5" +checksum = "090e409af49c8d1a3c13b3aab1ed09dd4eda982207eb3e63c2ad342f072b49c8" dependencies = [ "proc-macro2", "quote", @@ -8178,9 +8244,9 @@ dependencies = [ [[package]] name = "swc_ecma_loader" -version = "0.45.19" +version = "0.45.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c16051bce5421992a1b49350735bf4d110f761fd68ae7098af17a64ad639b8d" +checksum = "92c68f934bd2c51f29c4ad0bcae09924e9dc30d7ce0680367d45b42d40338a67" dependencies = [ "anyhow", "pathdiff", @@ -8192,9 +8258,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.143.3" +version = "0.144.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ff55811ed5de14b05e9a2979bae2bce3c807582f559b4325948463265307d9" +checksum = "0499e69683ae5d67a20ff0279b94bc90f29df7922a46331b54d5dd367bf89570" dependencies = [ "either", "new_debug_unreachable", @@ -8214,9 +8280,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.137.4" +version = "0.138.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "803bb435fdd532d5c931f0d487e48dbc94750d26c9336d79a6f1c04c62f08d93" +checksum = "eddb95c2bdad1c9c29edf35712e1e0f9b9ddc1cdb5ba2d582fd93468cb075a03" dependencies = [ "better_scoped_tls", "bitflags 2.5.0", @@ -8237,9 +8303,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.126.4" +version = "0.127.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486479e75907547d4c65ca6deed8faa465a2e9475cc9605be36a0e5eb609f578" +checksum = "53043d81678f3c693604eeb1d1f0fe6ba10f303104a31b954dbeebed9cadf530" dependencies = [ "swc_atoms", "swc_common", @@ -8251,9 +8317,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_macros" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17e309b88f337da54ef7fe4c5b99c2c522927071f797ee6c9fb8b6bf2d100481" +checksum = "500a1dadad1e0e41e417d633b3d6d5de677c9e0d3159b94ba3348436cdb15aab" dependencies = [ "proc-macro2", "quote", @@ -8263,9 +8329,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.171.4" +version = "0.172.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2822bc6c28bb1a96090a3b2caa28f45efbaecb333714d30868a2390eaae943f" +checksum = "7fbc414d6a9c5479cfb4c6e92fcdac504582bd7bc89a0ed7f8808b72dc8bd1f0" dependencies = [ "either", "rustc-hash", @@ -8283,9 +8349,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.183.4" +version = "0.184.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8984ebb8955116c426457a0c70b0aa9a08a06656e245781ff617a9cd1e289697" +checksum = "565a76c4ca47ce31d78301c0beab878e4c2cb4f624691254d834ec8c0e236755" dependencies = [ "base64 0.21.7", "dashmap", @@ -8307,9 +8373,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.188.4" +version = "0.189.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2e898fbab993abb60fb67009521908f2317f1d33f804e5b38d769f52e58572e" +checksum = "e209026c1d3c577cafac257d87e7c0d23119282fbdc8ed03d7f56077e95beb90" dependencies = [ "ryu-js", "serde", @@ -8324,9 +8390,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.127.4" +version = "0.128.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ff9e77ea18468895d26bd38656885860fede2acd24d1687f64363aaf8910441" +checksum = "fe5242670bc74e0a0b64b9d4912b37be36944517ce0881314162aeb4381272c3" dependencies = [ "indexmap 2.2.6", "num_cpus", @@ -8342,9 +8408,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.98.2" +version = "0.99.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb71511a816c7c84ddc96e6939389be261caf20858486a5e76948551f110e1f" +checksum = "28a6ce28ad8e591f8d627f1f9cb26b25e5d83052a9bc1b674d95fc28040cfa98" dependencies = [ "num-bigint", "swc_atoms", @@ -8367,9 +8433,9 @@ dependencies = [ [[package]] name = "swc_macros_common" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50176cfc1cbc8bb22f41c6fe9d1ec53fbe057001219b5954961b8ad0f336fce9" +checksum = "91745f3561057493d2da768437c427c0e979dff7396507ae02f16c981c4a8466" dependencies = [ "proc-macro2", "quote", @@ -8378,9 +8444,9 @@ dependencies = [ [[package]] name = "swc_visit" -version = "0.5.8" +version = "0.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b27078d8571abe23aa52ef608dd1df89096a37d867cf691cbb4f4c392322b7c9" +checksum = "043d11fe683dcb934583ead49405c0896a5af5face522e4682c16971ef7871b9" dependencies = [ "either", "swc_visit_macros", @@ -8388,12 +8454,11 @@ dependencies = [ [[package]] name = "swc_visit_macros" -version = "0.5.9" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8bb05975506741555ea4d10c3a3bdb0e2357cd58e1a4a4332b8ebb4b44c34d" +checksum = "4ae9ef18ff8daffa999f729db056d2821cd2f790f3a11e46422d19f46bb193e7" dependencies = [ "Inflector", - "pmutil", "proc-macro2", "quote", "swc_macros_common", @@ -8826,7 +8891,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.12", + "rustls 0.21.11", "tokio", ] @@ -9176,6 +9241,54 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "trust-dns-proto" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand 0.8.5", + "serde", + "smallvec", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6" +dependencies = [ + "cfg-if", + "futures-util", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot", + "rand 0.8.5", + "resolv-conf", + "serde", + "smallvec", + "thiserror", + "tokio", + "tracing", + "trust-dns-proto", +] + [[package]] name = "try-lock" version = "0.2.5" @@ -9348,9 +9461,9 @@ checksum = "b1b6def86329695390197b82c1e244a54a131ceb66c996f2088a3876e2ae083f" [[package]] name = "unicode-id-start" -version = "1.1.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8f73150333cb58412db36f2aca8f2875b013049705cc77b94ded70a1ab1f5da" +checksum = "02aebfa694eccbbbffdd92922c7de136b9fe764396d2f10e21bce1681477cfc1" [[package]] name = "unicode-ident" @@ -9473,7 +9586,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", - "idna", + "idna 0.5.0", "percent-encoding", "serde", ] @@ -9524,12 +9637,15 @@ dependencies = [ [[package]] name = "v8" -version = "0.83.2" +version = "0.92.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f6c8a960dd2eb74b22eda64f7e9f3d1688f82b80202828dc0425ebdeda826ef" +checksum = "234589219e37a7496cbce73d971586db8369871be2420372c45a579b6a919b15" dependencies = [ "bitflags 2.5.0", "fslock", + "gzip-header", + "home", + "miniz_oxide", "once_cell", "which 5.0.0", ] @@ -9804,6 +9920,12 @@ dependencies = [ "web-sys", ] +[[package]] +name = "widestring" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" + [[package]] name = "winapi" version = "0.3.9" @@ -10229,6 +10351,7 @@ dependencies = [ "deno_console", "deno_core", "deno_fetch", + "deno_net", "deno_tls", "deno_url", "deno_web", @@ -10281,6 +10404,7 @@ dependencies = [ "windmill-parser-sql", "windmill-parser-ts", "windmill-queue", + "zstd 0.12.4", ] [[package]] @@ -10610,6 +10734,15 @@ dependencies = [ "zstd-safe 5.0.2+zstd.1.5.2", ] +[[package]] +name = "zstd" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +dependencies = [ + "zstd-safe 6.0.6", +] + [[package]] name = "zstd" version = "0.13.1" @@ -10629,6 +10762,16 @@ dependencies = [ "zstd-sys", ] +[[package]] +name = "zstd-safe" +version = "6.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +dependencies = [ + "libc", + "zstd-sys", +] + [[package]] name = "zstd-safe" version = "7.1.0" diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 4e4963aca5..7391b8672f 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -159,19 +159,20 @@ tokio-util = { version = "^0", features = ["io"] } json-pointer = "^0" itertools = "^0" regex = "^1" -deno_fetch = "0.162.0" -deno_tls = "0.125.0" -deno_console = "0.138.0" -deno_url = "0.138.0" -deno_webidl = "0.138.0" -deno_web = "0.169.0" -deno_core = "0.262.0" -deno_ast = { version = "0.33.3", features = ["transpiling"] } +deno_fetch = "0.179.0" +deno_tls = "0.142.0" +deno_console = "0.155.0" +deno_url = "0.155.0" +deno_webidl = "0.155.0" +deno_web = "0.186.0" +deno_net = "0.147.0" +deno_core = "0.284.0" +deno_ast = { version = "0.39.0", features = ["transpiling"] } async-recursion = "^1" -swc_common = "=0.33.17" -swc_ecma_parser = "=0.143.3" -swc_ecma_ast = "=0.112.2" -swc_ecma_visit = "=0.98.2" +swc_common = "=0.33.26" +swc_ecma_parser = "=0.144.1" +swc_ecma_ast = "=0.113.4" +swc_ecma_visit = "=0.99.1" base64 = "0.21.0" hmac = "0.12.1" sha2 = "0.10.6" @@ -237,7 +238,7 @@ indexmap = { version = "2.2.5", features = ["serde"]} datafusion = "38.0.0" object_store = { version = "0.9.1", features = ["aws", "azure"] } openidconnect = { version = "3.4.0" } - +zstd = "=0.12.4" aws-config = "^1" aws-sdk-sts = "^1" diff --git a/backend/windmill-worker/Cargo.toml b/backend/windmill-worker/Cargo.toml index c84caad0b9..0888670ce9 100644 --- a/backend/windmill-worker/Cargo.toml +++ b/backend/windmill-worker/Cargo.toml @@ -58,6 +58,7 @@ bit-vec.workspace = true deno_fetch.workspace = true deno_webidl.workspace = true deno_web.workspace = true +deno_net.workspace = true deno_console.workspace = true deno_url.workspace = true deno_core.workspace = true @@ -91,3 +92,5 @@ deno_web.workspace = true deno_console.workspace = true deno_url.workspace = true deno_core.workspace = true +deno_net.workspace = true +zstd.workspace = true \ No newline at end of file diff --git a/backend/windmill-worker/build.rs b/backend/windmill-worker/build.rs index 869403e55a..3e6280ef1b 100644 --- a/backend/windmill-worker/build.rs +++ b/backend/windmill-worker/build.rs @@ -1,6 +1,8 @@ use deno_fetch::FetchPermissions; +use deno_net::NetPermissions; use deno_web::{BlobStore, TimersPermission}; use std::env; +use std::io::Write; use std::path::PathBuf; use std::sync::Arc; @@ -33,6 +35,32 @@ impl TimersPermission for PermissionsContainer { } } +impl NetPermissions for PermissionsContainer { + fn check_read( + &mut self, + _p: &std::path::Path, + _api_name: &str, + ) -> Result<(), deno_core::error::AnyError> { + Ok(()) + } + + fn check_write( + &mut self, + _p: &std::path::Path, + _api_name: &str, + ) -> Result<(), deno_core::error::AnyError> { + Ok(()) + } + + fn check_net>( + &mut self, + _host: &(T, Option), + _api_name: &str, + ) -> Result<(), deno_core::error::AnyError> { + Ok(()) + } +} + deno_core::extension!( fetch, esm_entry_point = "ext:fetch/src/runtime.js", @@ -52,6 +80,7 @@ fn main() { None, ), deno_fetch::deno_fetch::init_ops_and_esm::(Default::default()), + deno_net::deno_net::init_ops_and_esm::(None, None), fetch::init_ops_and_esm(), ]; @@ -60,16 +89,36 @@ fn main() { let snapshot_path = o.join("FETCH_SNAPSHOT.bin"); // Create the snapshot. - let _ = deno_core::snapshot_util::create_snapshot( - deno_core::snapshot_util::CreateSnapshotOptions { + let output = deno_core::snapshot::create_snapshot( + deno_core::snapshot::CreateSnapshotOptions { cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"), - snapshot_path: snapshot_path, startup_snapshot: None, extensions: exts, - compression_cb: None, with_runtime_cb: None, skip_op_registration: false, + extension_transpiler: None, }, None, - ); + ) + .unwrap(); + + // NOTE(bartlomieju): Compressing the TSC snapshot in debug build took + // ~45s on M1 MacBook Pro; without compression it took ~1s. + // Thus we're not using compressed snapshot, trading off + // a lot of build time for some startup time in debug build. + let mut file = std::fs::File::create(snapshot_path).unwrap(); + if cfg!(debug_assertions) { + file.write_all(&output.output).unwrap(); + } else { + let mut vec = Vec::with_capacity(output.output.len()); + vec.extend((output.output.len() as u32).to_le_bytes()); + vec.extend_from_slice( + &zstd::bulk::compress(&output.output, 22).expect("snapshot compression failed"), + ); + file.write_all(&vec).unwrap(); + } + + for path in output.files_loaded_during_snapshot { + println!("cargo:rerun-if-changed={}", path.display()); + } } diff --git a/backend/windmill-worker/src/js_eval.rs b/backend/windmill-worker/src/js_eval.rs index 8856cb9db5..883c5dbf1c 100644 --- a/backend/windmill-worker/src/js_eval.rs +++ b/backend/windmill-worker/src/js_eval.rs @@ -15,14 +15,15 @@ use std::{ sync::Arc, }; -use deno_ast::{ParseParams, SourceTextInfo}; +use deno_ast::ParseParams; use deno_core::{ error::AnyError, op2, serde_v8, url, v8::{self, IsolateHandle}, - Extension, JsRuntime, Op, OpState, PollEventLoopOptions, RuntimeOptions, Snapshot, + Extension, JsRuntime, OpState, PollEventLoopOptions, RuntimeOptions, }; use deno_fetch::FetchPermissions; +use deno_net::NetPermissions; use deno_tls::{rustls::RootCertStore, rustls_pemfile}; use deno_web::{BlobStore, TimersPermission}; use itertools::Itertools; @@ -106,6 +107,32 @@ impl TimersPermission for PermissionsContainer { } } +impl NetPermissions for PermissionsContainer { + fn check_read( + &mut self, + _p: &std::path::Path, + _api_name: &str, + ) -> Result<(), deno_core::error::AnyError> { + Ok(()) + } + + fn check_write( + &mut self, + _p: &std::path::Path, + _api_name: &str, + ) -> Result<(), deno_core::error::AnyError> { + Ok(()) + } + + fn check_net>( + &mut self, + _host: &(T, Option), + _api_name: &str, + ) -> Result<(), deno_core::error::AnyError> { + Ok(()) + } +} + pub struct OptAuthedClient(Option); pub async fn eval_timeout( @@ -187,21 +214,21 @@ pub async fn eval_timeout( timeout( std::time::Duration::from_millis(10000), tokio::task::spawn_blocking(move || { - let mut ops = vec![op_get_context::DECL]; + let mut ops = vec![op_get_context()]; if authed_client.is_some() { ops.extend([ // An op for summing an array of numbers // The op-layer automatically deserializes inputs // and serializes the returned Result & value - op_variable::DECL, - op_resource::DECL, + op_variable(), + op_resource(), ]) } if by_id.is_some() && authed_client.is_some() { - ops.push(op_get_result::DECL); - ops.push(op_get_id::DECL); + ops.push(op_get_result()); + ops.push(op_get_id()); } let ext = Extension { name: "js_eval", ops: ops.into(), ..Default::default() }; @@ -437,7 +464,7 @@ function get_from_env(name) {{ }, ); - let script = context.execute_script("", code.into())?; + let script = context.execute_script("", code)?; let fut = context.resolve(script); let global = context .with_event_loop_promise(fut, PollEventLoopOptions::default()) @@ -562,13 +589,17 @@ fn op_get_context(op_state: Rc>, #[string] id: &str) -> String pub fn transpile_ts(expr: String) -> anyhow::Result { let parsed = deno_ast::parse_module(ParseParams { specifier: url::Url::parse("file:///eval.ts")?, - text_info: SourceTextInfo::from_string(expr), capture_tokens: false, scope_analysis: false, media_type: deno_ast::MediaType::TypeScript, maybe_syntax: None, + text: deno_core::ModuleCodeString::from(expr).into(), })?; - Ok(parsed.transpile(&Default::default())?.text) + Ok(parsed + .transpile(&Default::default(), &Default::default())? + .into_source() + .into_string()? + .text) } static RUNTIME_SNAPSHOT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/FETCH_SNAPSHOT.bin")); @@ -606,7 +637,7 @@ pub async fn eval_fetch_timeout( .collect::>(); let result_f = tokio::task::spawn_blocking(move || { - let ops = vec![op_get_static_args::DECL, op_log::DECL]; + let ops = vec![op_get_static_args(), op_log()]; let ext = Extension { name: "windmill", ops: ops.into(), ..Default::default() }; let deno_fetch_options = if let Some(cert_path) = env::var("DENO_CERT").ok() { @@ -630,6 +661,7 @@ pub async fn eval_fetch_timeout( None, ), deno_fetch::deno_fetch::init_ops::(deno_fetch_options), + deno_net::deno_net::init_ops::(None, None), ext, ]; @@ -641,9 +673,10 @@ pub async fn eval_fetch_timeout( deno_core::v8::CreateParams::default() .heap_limits(0 as usize, 1024 * 1024 * 128 as usize), ), - startup_snapshot: Some(Snapshot::Static(RUNTIME_SNAPSHOT)), + // startup_snapshot: None, + startup_snapshot: Some(RUNTIME_SNAPSHOT), module_loader: Some(Rc::new(deno_core::FsModuleLoader)), - // startup_snapshot: Some(Snapshot::Static(buffer)), + extension_transpiler: None, ..Default::default() }; @@ -653,6 +686,7 @@ pub async fn eval_fetch_timeout( // let instant = Instant::now(); let mut js_runtime: JsRuntime = JsRuntime::new(options); + tracing::error!("js_runtime created"); // tracing::info!("ttc: {:?}", instant.elapsed()); js_runtime.add_near_heap_limit_callback(move |x,y| { @@ -735,17 +769,17 @@ async fn eval_fetch( ) -> anyhow::Result> { if let Some(env_code) = env_code.as_ref() { let _ = js_runtime - .load_side_module( + .load_side_es_module_from_code( &deno_core::resolve_url("file:///windmill.ts")?, - Some(format!("{env_code}\n{}", WINDMILL_CLIENT.to_string()).into()), + format!("{env_code}\n{}", WINDMILL_CLIENT.to_string()), ) .await?; } let _ = js_runtime - .load_side_module( + .load_side_es_module_from_code( &deno_core::resolve_url("file:///eval.ts")?, - Some(format!("{}\n{expr}", env_code.unwrap_or_default()).into()), + format!("{}\n{expr}", env_code.unwrap_or_default()), ) .await?; @@ -754,9 +788,7 @@ async fn eval_fetch( r#" let args = Deno.core.ops.op_get_static_args().map(JSON.parse) import("file:///eval.ts").then((module) => module.main(...args)).then(JSON.stringify) -"# - .to_string() - .into(), +"#, )?; let fut = js_runtime.resolve(script); @@ -817,7 +849,7 @@ mod tests { let code = "value.test + params.test"; - let ops = vec![op_get_context::DECL]; + let ops = vec![op_get_context()]; let ext = Extension { name: "js_eval", ops: ops.into(), ..Default::default() }; let exts = vec![ext]; @@ -882,6 +914,55 @@ multiline template`"; Ok(()) } + // #[tokio::test] + // async fn test_eval_timeout_bug() -> anyhow::Result<()> { + // let ops = vec![op_get_static_args(), op_log()]; + // let ext = Extension { name: "windmill", ops: ops.into(), ..Default::default() }; + + // let deno_fetch_options = if let Some(cert_path) = env::var("DENO_CERT").ok() { + // let mut cert_store_provider = ContainerRootCertStoreProvider::new(); + // cert_store_provider.add_certificate(cert_path)?; + + // deno_fetch::Options { + // root_cert_store_provider: Some(Arc::new(cert_store_provider)), + // ..Default::default() + // } + // } else { + // Default::default() + // }; + + // let exts: Vec = vec![ + // deno_webidl::deno_webidl::init_ops(), + // deno_url::deno_url::init_ops(), + // deno_console::deno_console::init_ops(), + // deno_web::deno_web::init_ops::( + // Arc::new(BlobStore::default()), + // None, + // ), + // deno_fetch::deno_fetch::init_ops::(deno_fetch_options), + // deno_net::deno_net::init_ops::(None, None), + // ext, + // ]; + + // // Use our snapshot to provision our new runtime + // let options = RuntimeOptions { + // is_main: true, + // extensions: exts, + // create_params: Some( + // deno_core::v8::CreateParams::default() + // .heap_limits(0 as usize, 1024 * 1024 * 128 as usize), + // ), + // // startup_snapshot: None, + // startup_snapshot: Some(RUNTIME_SNAPSHOT), + // module_loader: Some(Rc::new(deno_core::FsModuleLoader)), + // extension_transpiler: None, + // ..Default::default() + // }; + + // let mut js_runtime: JsRuntime = JsRuntime::new(options); + // Ok(()) + // } + // #[tokio::test] // async fn test_eval_fetch_timeout() -> anyhow::Result<()> { // let code = r#"export async function main() { return "" }"#; diff --git a/backend/windmill-worker/src/runtime.js b/backend/windmill-worker/src/runtime.js index 4c119b2f1a..0f1706063a 100644 --- a/backend/windmill-worker/src/runtime.js +++ b/backend/windmill-worker/src/runtime.js @@ -11,6 +11,8 @@ import * as headers from "ext:deno_fetch/20_headers.js"; import * as streams from "ext:deno_web/06_streams.js"; import * as timers from "ext:deno_web/02_timers.js"; import * as url from "ext:deno_url/00_url.js"; +import * as net from "ext:deno_net/01_net.js"; +import * as tls from "ext:deno_net/02_tls.js"; import * as urlPattern from "ext:deno_url/01_urlpattern.js"; import * as webidl from "ext:deno_webidl/00_webidl.js"; import * as response from "ext:deno_fetch/23_response.js";