diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..d0758fb --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ + +[target.x86_64-pc-windows-msvc] +rustflags = ["-C", "link-arg=/DEBUG:NONE"] diff --git a/Cargo.lock b/Cargo.lock index c340ca0..74c6bc1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -74,7 +74,7 @@ dependencies = [ [[package]] name = "andromeda" -version = "0.1.2" +version = "0.1.3" dependencies = [ "andromeda-core", "andromeda-runtime", @@ -126,7 +126,7 @@ dependencies = [ [[package]] name = "andromeda-core" -version = "0.1.2" +version = "0.1.3" dependencies = [ "anyhow", "anymap", @@ -150,7 +150,7 @@ dependencies = [ [[package]] name = "andromeda-runtime" -version = "0.1.2" +version = "0.1.3" dependencies = [ "andromeda-core", "anyhow", @@ -169,7 +169,7 @@ dependencies = [ "nova_vm", "oxc-miette", "oxc_diagnostics", - "rand 0.9.2", + "rand 0.10.0", "ring", "rusqlite", "rustls", @@ -481,26 +481,6 @@ dependencies = [ "scoped-tls", ] -[[package]] -name = "bincode" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" -dependencies = [ - "bincode_derive", - "serde", - "unty", -] - -[[package]] -name = "bincode_derive" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09" -dependencies = [ - "virtue", -] - [[package]] name = "bit-set" version = "0.8.0" @@ -624,6 +604,16 @@ dependencies = [ "serde", ] +[[package]] +name = "calendrical_calculations" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0b39595c6ee54a8d0900204ba4c401d0ab4eb45adaf07178e8d017541529e7" +dependencies = [ + "core_maths", + "displaydoc", +] + [[package]] name = "capacity_builder" version = "0.5.0" @@ -677,6 +667,17 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chacha20" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.0", +] + [[package]] name = "chrono" version = "0.4.43" @@ -755,6 +756,15 @@ dependencies = [ "cc", ] +[[package]] +name = "cobs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror 2.0.18", +] + [[package]] name = "codespan-reporting" version = "0.12.0" @@ -787,6 +797,16 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "compact_str" version = "0.9.0" @@ -957,6 +977,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "crc32fast" version = "1.5.0" @@ -1227,7 +1256,8 @@ dependencies = [ [[package]] name = "dof" version = "0.4.0" -source = "git+https://github.com/aapoalas/usdt.git?branch=nova-aarch64-branch#5b878f257e6aff4895b1864a6ee1b3f217d924e4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ed9b77e3c2a83995eedff2fbf992eef44c9f319b8016254f68108e27a4d06e7" dependencies = [ "goblin", "pretty-hex", @@ -1312,14 +1342,15 @@ dependencies = [ [[package]] name = "dragonbox_ecma" -version = "0.0.5" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d742b56656e8b14d63e7ea9806597b1849ae25412584c8adf78c0f67bd985e66" +checksum = "fd8e701084c37e7ef62d3f9e453b618130cbc0ef3573847785952a3ac3f746bf" [[package]] name = "dtrace-parser" version = "0.3.0" -source = "git+https://github.com/aapoalas/usdt.git?branch=nova-aarch64-branch#5b878f257e6aff4895b1864a6ee1b3f217d924e4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc09b90bda5770641457f1c0a42c8203c48f5a3d9799dcf1bafbd84e30ccf080" dependencies = [ "pest", "pest_derive", @@ -1347,21 +1378,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51a3f9ed30f00d410e138929ee98104d8e951eed49e0fb3e84234ec818193d63" -[[package]] -name = "ecmascript_futex" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ed37845e5171492eddd7ae96c797e584ff96499623f8f830b2f0b818565b62" -dependencies = [ - "ecmascript_atomics", - "js-sys", - "libc", - "rustversion", - "wasm-bindgen", - "web-sys", - "windows-sys 0.61.2", -] - [[package]] name = "editpe" version = "0.1.0" @@ -1381,6 +1397,18 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + [[package]] name = "encode_unicode" version = "1.0.0" @@ -1828,8 +1856,22 @@ checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", - "r-efi", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.0", "wasip2", + "wasip3", ] [[package]] @@ -2272,6 +2314,28 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_calendar" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f0e52e009b6b16ba9c0693578796f2dd4aaa59a7f8f920423706714a89ac4e" +dependencies = [ + "calendrical_calculations", + "displaydoc", + "icu_calendar_data", + "icu_locale", + "icu_locale_core", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_calendar_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527f04223b17edfe0bd43baf14a0cb1b017830db65f3950dc00224860a9a446d" + [[package]] name = "icu_collections" version = "2.1.1" @@ -2285,6 +2349,21 @@ dependencies = [ "zerovec", ] +[[package]] +name = "icu_locale" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "532b11722e350ab6bf916ba6eb0efe3ee54b932666afec989465f9243fe6dd60" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_locale_data", + "icu_provider", + "potential_utf", + "tinystr", + "zerovec", +] + [[package]] name = "icu_locale_core" version = "2.1.1" @@ -2293,11 +2372,18 @@ checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" dependencies = [ "displaydoc", "litemap", + "serde", "tinystr", "writeable", "zerovec", ] +[[package]] +name = "icu_locale_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c5f1d16b4c3a2642d3a719f18f6b06070ab0aef246a6418130c955ae08aa831" + [[package]] name = "icu_normalizer" version = "2.1.1" @@ -2346,6 +2432,8 @@ checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" dependencies = [ "displaydoc", "icu_locale_core", + "serde", + "stable_deref_trait", "writeable", "yoke", "zerofrom", @@ -2353,6 +2441,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "idna" version = "0.4.0" @@ -2536,9 +2630,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "ixdtf" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "84de9d95a6d2547d9b77ee3f25fa0ee32e3c3a6484d47a55adebc0439c077992" [[package]] name = "jiff" @@ -2564,6 +2664,12 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "jiff-tzdb" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c900ef84826f1338a557697dc8fc601df9ca9af4ac137c7fb61d4c6f2dfd3076" + [[package]] name = "jni-sys" version = "0.3.0" @@ -2625,6 +2731,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "lebe" version = "0.5.3" @@ -3105,12 +3217,11 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" [[package]] name = "nova_vm" -version = "0.3.1" -source = "git+https://github.com/trynova/nova?rev=87e9118e4e25f062e1c1879281fe1770dccfe914#87e9118e4e25f062e1c1879281fe1770dccfe914" +version = "1.0.0" +source = "git+https://github.com/trynova/nova?rev=a5d0193b88a7c4abea4819bb68447f93121ff000#a5d0193b88a7c4abea4819bb68447f93121ff000" dependencies = [ "ahash", "ecmascript_atomics", - "ecmascript_futex", "fast-float", "hashbrown 0.16.1", "lexical", @@ -3125,13 +3236,14 @@ dependencies = [ "oxc_semantic", "oxc_span", "oxc_syntax", - "rand 0.9.2", + "rand 0.10.0", "regex", "ryu-js", "small_string", "soavec", "soavec_derive", "sonic-rs", + "temporal_rs", "unicode-normalization", "usdt", "wtf8", @@ -3311,25 +3423,22 @@ checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" [[package]] name = "oxc-browserslist" -version = "2.1.5" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b48a7bf4591453d69792e735a8025b2c2c33ab75e02754023284ad17cfbbe04" +checksum = "c86f358f5705f4da4bce0af2792b6d24d64be9c465bdc70a752b2f168c5ff721" dependencies = [ - "bincode", "flate2", - "nom 8.0.0", + "postcard", "rustc-hash 2.1.1", "serde", - "serde_json", "thiserror 2.0.18", - "time", ] [[package]] name = "oxc-miette" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f02105a875f3751a0b44b4c822b01177728dd9049ae6fb419e9b04887d730ed1" +checksum = "60a7ba54c704edefead1f44e9ef09c43e5cfae666bdc33516b066011f0e6ebf7" dependencies = [ "backtrace", "backtrace-ext", @@ -3348,9 +3457,9 @@ dependencies = [ [[package]] name = "oxc-miette-derive" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "003b4612827f6501183873fb0735da92157e3c7daa71c40921c7d2758fec2229" +checksum = "d4faecb54d0971f948fbc1918df69b26007e6f279a204793669542e1e8b75eb3" dependencies = [ "proc-macro2", "quote", @@ -3359,12 +3468,11 @@ dependencies = [ [[package]] name = "oxc_allocator" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60ca9e1e73193a2060cc36d6a52b008e313c9d15e58a9c3de0097d4918697af9" +checksum = "93d4e5a43018728a7f6aa14b1034c43a0869fc0d05002a181d5dacc698e488b9" dependencies = [ "allocator-api2", - "bumpalo", "hashbrown 0.16.1", "oxc_data_structures", "rustc-hash 2.1.1", @@ -3372,9 +3480,9 @@ dependencies = [ [[package]] name = "oxc_ast" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3b58ca83e7a169425f638d05474fc5666c8996fbe21b0a281e3c74750638b53" +checksum = "12b7429c1035c3bf0de582ae4458d4f769566d574cfe71e170e328a123337a8d" dependencies = [ "bitflags 2.10.0", "oxc_allocator", @@ -3389,9 +3497,9 @@ dependencies = [ [[package]] name = "oxc_ast_macros" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "079b778ec2017539e54123eff2b5fdea09deb6de76fc539cce4774806946bfeb" +checksum = "1d3d3eb4a7b45c9f407f96ecafddad0a88cbf085dca7d74f3e4191ba03d2d5f3" dependencies = [ "phf 0.13.1", "proc-macro2", @@ -3401,9 +3509,9 @@ dependencies = [ [[package]] name = "oxc_ast_visit" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e451cb1bfca987bc7d68975af38ccbdec8016634592a762cd2320b925a36d1" +checksum = "87408c66c769e714cc74c24626403c63b0fd76f251d0971404a347611280668d" dependencies = [ "oxc_allocator", "oxc_ast", @@ -3413,9 +3521,9 @@ dependencies = [ [[package]] name = "oxc_codegen" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a41f2e1efaff4d28e45d96a35bf64fa00cc8d7460829cb293b0296ff2feaac3" +checksum = "db5daa86977bc78c58c19ecf96afad677eb3dbc3726901d6a02b19ad1cf77f9c" dependencies = [ "bitflags 2.10.0", "cow-utils", @@ -3434,9 +3542,9 @@ dependencies = [ [[package]] name = "oxc_compat" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40d7a8e5b8449e81a4944adf9b4f0f2626f67bbde689d871c468a88814dd85e4" +checksum = "4d7987ecf86a8b5c4232dba5cdbe3b639bc0e3618e8c6a7c0a4797447a2baf57" dependencies = [ "cow-utils", "oxc-browserslist", @@ -3447,18 +3555,18 @@ dependencies = [ [[package]] name = "oxc_data_structures" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26e88f1dec1481f1c274c775659e92dfd71aeea023a4bccbaee861427e7706f" +checksum = "af06d9ab1bfd8baff16ef7dcc6824ea1fea0938ba41b1e113b882738e285d8ee" dependencies = [ "ropey", ] [[package]] name = "oxc_diagnostics" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f9eac375dd26c626775a3d7fad941fda7bce022448dd26165f4feb1ab186652" +checksum = "908b7dae769982c7ade68f6ba3b4edb32b5a5941800fe8118f9c96fe4cfa7982" dependencies = [ "cow-utils", "oxc-miette", @@ -3467,24 +3575,25 @@ dependencies = [ [[package]] name = "oxc_ecmascript" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6da6f9a94e8b2772848a71e133ba47723c8ba4ed749552100b8c46f2e449b747" +checksum = "78e4efa8dd802bb4e15536c71b081540f7bf4fc046b7043bc2e650cea40f62ca" dependencies = [ "cow-utils", "num-bigint", "num-traits", "oxc_allocator", "oxc_ast", + "oxc_regular_expression", "oxc_span", "oxc_syntax", ] [[package]] name = "oxc_estree" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6277ef2f1caaf759b16164787e39803ca91bd3582e5664ae3111c85aa62edd7" +checksum = "f5e33d1f099a1e5c8f820df64654b1657f0aaf744d4137377726902738bfba80" [[package]] name = "oxc_index" @@ -3498,9 +3607,9 @@ dependencies = [ [[package]] name = "oxc_mangler" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55b91673c0bcff873f0da4d23737455424147bf91f38e6051eb112969952a3be" +checksum = "24ea391da3da4ae3f218b9457af29eb3a245372cc80c48694a7c1a398e5df539" dependencies = [ "itertools 0.14.0", "oxc_allocator", @@ -3515,15 +3624,15 @@ dependencies = [ [[package]] name = "oxc_minifier" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eecdc0ae4601dcea3f551501ca74821249e82ae917ad29b8a5182eb78b71ccc7" +checksum = "de969df0153fb14e363e1afe62bf6c1c4c01b8f8ab72b5763c569dd0215cb3e6" dependencies = [ "cow-utils", + "itoa", "oxc_allocator", "oxc_ast", "oxc_ast_visit", - "oxc_codegen", "oxc_compat", "oxc_data_structures", "oxc_ecmascript", @@ -3533,6 +3642,7 @@ dependencies = [ "oxc_regular_expression", "oxc_semantic", "oxc_span", + "oxc_str", "oxc_syntax", "oxc_traverse", "rustc-hash 2.1.1", @@ -3540,9 +3650,9 @@ dependencies = [ [[package]] name = "oxc_parser" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0b7195ec44f6edc67458409dca5a6660956ac2075496511f6bf843132beb57" +checksum = "fa019a6d043e2087d8506c6716a55ee680ffb3eb564ab52bed0328d4076afb33" dependencies = [ "bitflags 2.10.0", "cow-utils", @@ -3563,9 +3673,9 @@ dependencies = [ [[package]] name = "oxc_regular_expression" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c43bcf966ad7622484eb91a63555b128214b1e71e06ba4ebe767e825500cc3f" +checksum = "0f28f7617dc3d0dd642ca4f9be4c8cf5365f114dc27a745d1ebfa82b8f729ef3" dependencies = [ "bitflags 2.10.0", "oxc_allocator", @@ -3579,11 +3689,12 @@ dependencies = [ [[package]] name = "oxc_semantic" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "857d307b9c5229fe00a1513c8f821f3927014ad3cf8184a44c6fa10aa9dde45f" +checksum = "c5ab63f46cfbf4ef58b5a78439202593fe4a8511281ba1de32303e2c28b0e5e8" dependencies = [ "itertools 0.14.0", + "memchr", "oxc_allocator", "oxc_ast", "oxc_ast_visit", @@ -3593,9 +3704,9 @@ dependencies = [ "oxc_index", "oxc_span", "oxc_syntax", - "phf 0.13.1", "rustc-hash 2.1.1", "self_cell", + "smallvec", ] [[package]] @@ -3613,22 +3724,35 @@ dependencies = [ [[package]] name = "oxc_span" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fda7457a6eea895d8d529d42f06cc5985de04ba6785dea98582010eceb4ac3f" +checksum = "6813c0f28625a9a1c8906144396fb7ee22a2a7722d49b707a06d19f81be450ef" dependencies = [ "compact_str", "oxc-miette", "oxc_allocator", "oxc_ast_macros", "oxc_estree", + "oxc_str", +] + +[[package]] +name = "oxc_str" +version = "0.116.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b163ab61908f1d636704bb57425692c38a7addde8e7244ff0dd92394084a17fe" +dependencies = [ + "compact_str", + "hashbrown 0.16.1", + "oxc_allocator", + "oxc_estree", ] [[package]] name = "oxc_syntax" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edea141e6e25054872e6e3b93e8f173b8812be5c49c39817aaa78f02a197a3c7" +checksum = "06c82e33172f5613c4b7cf502d90b4ea866cd9103cb5e818a938889aef847daf" dependencies = [ "bitflags 2.10.0", "cow-utils", @@ -3636,7 +3760,6 @@ dependencies = [ "nonmax", "oxc_allocator", "oxc_ast_macros", - "oxc_data_structures", "oxc_estree", "oxc_index", "oxc_span", @@ -3646,9 +3769,9 @@ dependencies = [ [[package]] name = "oxc_transformer" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "902c7824030fb827bc804a05607d08bc9aad816d82c97c4c43def8fe4c305be3" +checksum = "ccf953e1375c8f32c30630741358399f3c42f5a8f8fddb8fdc7fbb526c71972e" dependencies = [ "base64", "compact_str", @@ -3675,9 +3798,9 @@ dependencies = [ [[package]] name = "oxc_traverse" -version = "0.105.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e12bb5cbc6617931d76493c19ee06b2de176917fdaade50f06670e852f5f08" +checksum = "5c36f3713080a74481e1d725dcfcec7a1e0ebce350df427f1babc0cd4c8865f1" dependencies = [ "itoa", "oxc_allocator", @@ -3687,6 +3810,7 @@ dependencies = [ "oxc_ecmascript", "oxc_semantic", "oxc_span", + "oxc_str", "oxc_syntax", "rustc-hash 2.1.1", ] @@ -3932,12 +4056,26 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "postcard" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "serde", +] + [[package]] name = "potential_utf" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" dependencies = [ + "serde_core", + "writeable", "zerovec", ] @@ -3968,6 +4106,16 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbc83ee4a840062f368f9096d80077a9841ec117e17e7f700df81958f1451254" +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.111", +] + [[package]] name = "prettytable-rs" version = "0.10.0" @@ -4093,6 +4241,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "rancor" version = "0.1.1" @@ -4123,6 +4277,17 @@ dependencies = [ "rand_core 0.9.3", ] +[[package]] +name = "rand" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc266eb313df6c5c09c1c7b1fbe2510961e5bcd3add930c1e31f7ed9da0feff8" +dependencies = [ + "chacha20", + "getrandom 0.4.2", + "rand_core 0.10.0", +] + [[package]] name = "rand_chacha" version = "0.3.1" @@ -4161,6 +4326,12 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "rand_core" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" + [[package]] name = "range-alloc" version = "0.1.4" @@ -4301,9 +4472,9 @@ dependencies = [ [[package]] name = "reedline" -version = "0.45.0" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67478e45862a0c29fd99658e382c07b1b80b9c1b7d946ce6bd2e4a679141554b" +checksum = "fe9e7c532bfc2759bc8a28902c04e8b993fc13ebd085ee4292eb1b230fa9beef" dependencies = [ "chrono", "crossterm", @@ -4342,9 +4513,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.2" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -4549,9 +4720,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.36" +version = "0.23.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" +checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" dependencies = [ "aws-lc-rs", "log", @@ -4696,9 +4867,9 @@ dependencies = [ [[package]] name = "self_cell" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16c2f82143577edb4921b71ede051dac62ca3c16084e918bf7b40c96ae10eb33" +checksum = "b12e76d157a900eb52e81bc6e9f3069344290341720e9178cde2407113ac8d89" [[package]] name = "semver" @@ -4834,7 +5005,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -4845,7 +5016,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest", ] @@ -4965,8 +5136,8 @@ dependencies = [ [[package]] name = "small_string" -version = "0.2.0" -source = "git+https://github.com/trynova/nova?rev=87e9118e4e25f062e1c1879281fe1770dccfe914#87e9118e4e25f062e1c1879281fe1770dccfe914" +version = "1.0.0" +source = "git+https://github.com/trynova/nova?rev=a5d0193b88a7c4abea4819bb68447f93121ff000#a5d0193b88a7c4abea4819bb68447f93121ff000" dependencies = [ "wtf8", ] @@ -4976,6 +5147,9 @@ name = "smallvec" version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +dependencies = [ + "serde", +] [[package]] name = "smartstring" @@ -5051,22 +5225,23 @@ dependencies = [ [[package]] name = "sonic-rs" -version = "0.3.17" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0275f9f2f07d47556fe60c2759da8bc4be6083b047b491b2d476aa0bfa558eb1" +checksum = "e16b39f36452a4fa6f14a481b02e9ba5c6842c6a44d0545da967eca122f2eed9" dependencies = [ + "ahash", "bumpalo", "bytes", "cfg-if", "faststr", "itoa", "ref-cast", - "ryu", "serde", "simdutf8", "sonic-number", "sonic-simd", "thiserror 2.0.18", + "zmij", ] [[package]] @@ -5431,6 +5606,24 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "temporal_rs" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88afde3bd75d2fc68d77a914bece426aa08aa7649ffd0cdd4a11c3d4d33474d1" +dependencies = [ + "core_maths", + "iana-time-zone", + "icu_calendar", + "icu_locale", + "ixdtf", + "num-traits", + "timezone_provider", + "tinystr", + "web-time", + "writeable", +] + [[package]] name = "term" version = "0.7.0" @@ -5591,6 +5784,20 @@ dependencies = [ "time-core", ] +[[package]] +name = "timezone_provider" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9ba0000e9e73862f3e7ca1ff159e2ddf915c9d8bb11e38a7874760f445d993" +dependencies = [ + "combine", + "jiff-tzdb", + "tinystr", + "tzif", + "zerotrie", + "zerovec", +] + [[package]] name = "tiny_http" version = "0.12.0" @@ -5610,6 +5817,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" dependencies = [ "displaydoc", + "serde_core", "zerovec", ] @@ -5949,6 +6157,15 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +[[package]] +name = "tzif" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0376dfa52cce372f3b095010fd064fb850a5d8fbfd5be8b0ffa3d64eeab5a5d" +dependencies = [ + "combine", +] + [[package]] name = "ucd-trie" version = "0.1.7" @@ -6018,6 +6235,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "unsafe-libyaml" version = "0.2.11" @@ -6030,17 +6253,11 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" -[[package]] -name = "unty" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" - [[package]] name = "ureq" -version = "3.1.4" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d39cb1dbab692d82a977c0392ffac19e188bd9186a9f32806f0aaa859d75585a" +checksum = "fdc97a28575b85cfedf2a7e7d3cc64b3e11bd8ac766666318003abbacc7a21fc" dependencies = [ "base64", "cookie_store", @@ -6084,7 +6301,8 @@ dependencies = [ [[package]] name = "usdt" version = "0.6.0" -source = "git+https://github.com/aapoalas/usdt.git?branch=nova-aarch64-branch#5b878f257e6aff4895b1864a6ee1b3f217d924e4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1953f8d8a98ac7883c230963291acb65c7ed6ae3e2e4c99d5c65f4e65cc9db38" dependencies = [ "dof", "goblin", @@ -6098,7 +6316,8 @@ dependencies = [ [[package]] name = "usdt-attr-macro" version = "0.6.0" -source = "git+https://github.com/aapoalas/usdt.git?branch=nova-aarch64-branch#5b878f257e6aff4895b1864a6ee1b3f217d924e4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55d0d673848744c556fcfe8479f87b6974459106e4c41f38375f6d559bb0ee28" dependencies = [ "dtrace-parser", "proc-macro2", @@ -6111,7 +6330,8 @@ dependencies = [ [[package]] name = "usdt-impl" version = "0.6.0" -source = "git+https://github.com/aapoalas/usdt.git?branch=nova-aarch64-branch#5b878f257e6aff4895b1864a6ee1b3f217d924e4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf0085a93af1ca095d8b1dc8672cc4620fcd1db5dff8d165486067badce05555" dependencies = [ "byteorder", "dof", @@ -6129,7 +6349,8 @@ dependencies = [ [[package]] name = "usdt-macro" version = "0.6.0" -source = "git+https://github.com/aapoalas/usdt.git?branch=nova-aarch64-branch#5b878f257e6aff4895b1864a6ee1b3f217d924e4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9bf594f86b676f7e2fd3d523d50f9d0cffecff6c19729ff5dbebe86c4cb8cb2" dependencies = [ "dtrace-parser", "proc-macro2", @@ -6191,12 +6412,6 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "virtue" -version = "0.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1" - [[package]] name = "vsimd" version = "0.8.0" @@ -6252,7 +6467,16 @@ version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.46.0", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", ] [[package]] @@ -6313,6 +6537,40 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.10.0", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + [[package]] name = "web-sys" version = "0.3.83" @@ -6323,11 +6581,21 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webpki-roots" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12bed680863276c63889429bfd6cab3b99943659923822de1c8a39c49e4d722c" +checksum = "22cfaf3c063993ff62e73cb4311efde4db1efb31ab78a3e5c457939ad5cc0bed" dependencies = [ "rustls-pki-types", ] @@ -6913,6 +7181,94 @@ version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn 2.0.111", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.111", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.10.0", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "writeable" version = "0.6.2" @@ -7074,6 +7430,7 @@ version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" dependencies = [ + "serde", "yoke", "zerofrom", "zerovec-derive", diff --git a/Cargo.toml b/Cargo.toml index 4be4ee9..c837b19 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ authors = ["the Andromeda team"] edition = "2024" license = "Mozilla Public License 2.0" repository = "https://github.com/tryandromeda/andromeda" -version = "0.1.2" +version = "0.1.3" [workspace.dependencies] andromeda-core = { path = "crates/core" } @@ -44,24 +44,24 @@ libsui = "0.12.6" log = "0.4.29" lru = "0.16.3" lsp-types = "0.97.0" -nova_vm = { git = "https://github.com/trynova/nova", rev = "87e9118e4e25f062e1c1879281fe1770dccfe914" } +nova_vm = { git = "https://github.com/trynova/nova", rev = "a5d0193b88a7c4abea4819bb68447f93121ff000" } nu-ansi-term = "0.50.3" owo-colors = "4.2.3" -oxc_codegen = "0.105.0" -oxc_ast = "0.105.0" -oxc_minifier = "0.105.0" -oxc_mangler = "0.105.0" -oxc_allocator = "0.105.0" -oxc_diagnostics = "0.105.0" -oxc-miette = { version = "2.6.0", features = ["fancy"] } -oxc_parser = "0.105.0" -oxc_semantic = "0.105.0" -oxc_span = "0.105.0" -oxc_transformer = "0.105.0" -rand = "0.9.2" -reedline = "0.45.0" -regex = "1.12.2" -rustls = "0.23.36" +oxc_codegen = "0.116.0" +oxc_ast = "0.116.0" +oxc_minifier = "0.116.0" +oxc_mangler = "0.116.0" +oxc_allocator = "0.116.0" +oxc_diagnostics = "0.116.0" +oxc-miette = { version = "2.7.0", features = ["fancy"] } +oxc_parser = "0.116.0" +oxc_semantic = "0.116.0" +oxc_span = "0.116.0" +oxc_transformer = "0.116.0" +rand = "0.10.0" +reedline = "0.46.0" +regex = "1.12.3" +rustls = "0.23.37" rustls-pemfile = "2.2.0" rustls-pki-types = "1.14.0" ring = "0.17.14" @@ -85,12 +85,15 @@ tokio = { version = "1.49.0", features = ["rt", "sync", "time", "fs"] } tokio-rustls = "0.26.4" tokio-test = "0.4.5" tower-lsp = "0.20.0" -ureq = { version = "3.1.4", features = ["json"] } +ureq = { version = "3.2.0", features = ["json"] } url = { version = "2.5.8", features = ["serde", "expose_internals"] } uuid = { version = "1.19.0", features = ["v4"] } -webpki-roots = "1.0.5" +webpki-roots = "1.0.6" wgpu = { version = "27.0.1", features = ["wgsl", "webgpu"] } +[profile.dev] +split-debuginfo = "packed" + [profile.release] lto = true diff --git a/README.md b/README.md index e9ac329..cb5d8a2 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Discord Server](https://img.shields.io/discord/1264947585882259599.svg?logo=discord&style=flat-square)](https://discord.gg/tgjAnX2Ny3) -**A modern, fast, and secure JavaScript & TypeScript runtime** built from the +**A modern, fast(eventually), and secure JavaScript & TypeScript runtime** built from the ground up in [Rust 🦀](https://www.rust-lang.org/) and powered by [Nova Engine](https://trynova.dev/) and [Oxc](https://oxc.rs). diff --git a/crates/cli/src/lint.rs b/crates/cli/src/lint.rs index 5237369..043cedf 100644 --- a/crates/cli/src/lint.rs +++ b/crates/cli/src/lint.rs @@ -891,8 +891,7 @@ fn check_statement_for_expressions( // Check for exception parameter reassignment if let Some(handler) = &try_stmt.handler { if let Some(param) = &handler.param - && let oxc_ast::ast::BindingPatternKind::BindingIdentifier(ident) = - ¶m.pattern.kind + && let oxc_ast::ast::BindingPattern::BindingIdentifier(ident) = ¶m.pattern { let exception_name = ident.name.to_string(); check_ex_assign_in_catch( diff --git a/crates/cli/src/repl.rs b/crates/cli/src/repl.rs index 19adb5b..194b4e6 100644 --- a/crates/cli/src/repl.rs +++ b/crates/cli/src/repl.rs @@ -11,27 +11,14 @@ use crate::styles::format_js_value; use andromeda_core::{HostData, RuntimeHostHooks}; use andromeda_runtime::{RuntimeMacroTask, recommended_builtins, recommended_extensions}; use console::Style; -use nova_vm::ecmascript::types::IntoObject; use nova_vm::{ ecmascript::{ - builtins::{ArgumentsList, Behaviour, BuiltinFunctionArgs, create_builtin_function}, - execution::{ - Agent, JsResult, - agent::{GcAgent, Options}, - }, - scripts_and_modules::{ - module::module_semantics::source_text_module_records::parse_module, - script::{parse_script, script_evaluation}, - }, - types::{ - self, InternalMethods, IntoValue, Object, OrdinaryObject, PropertyDescriptor, - PropertyKey, Value, - }, - }, - engine::{ - context::{Bindable, GcScope}, - rootable::Scopable, + Agent, AgentOptions, ArgumentsList, Behaviour, BuiltinFunctionArgs, GcAgent, + InternalMethods, JsResult, Object, OrdinaryObject, PropertyDescriptor, PropertyKey, + String as NovaString, Value, create_builtin_function, parse_module, parse_script, + script_evaluation, }, + engine::{Bindable, GcScope, Scopable}, }; use oxc_diagnostics::OxcDiagnostic; use reedline::{Reedline, Signal}; @@ -77,7 +64,7 @@ pub fn run_repl_with_config( let host_hooks: &RuntimeHostHooks = &*Box::leak(Box::new(host_hooks)); let mut agent = GcAgent::new( - Options { + AgentOptions { no_block: false, disable_gc: effective_disable_gc, print_internals: effective_print_internals, @@ -105,7 +92,7 @@ pub fn run_repl_with_config( agent.run_in_realm(&realm, |agent, mut gc| { for builtin in recommended_builtins() { let realm_obj = agent.current_realm(gc.nogc()); - let source_text = types::String::from_str(agent, builtin, gc.nogc()); + let source_text = NovaString::from_str(agent, builtin, gc.nogc()); let script = match parse_script(agent, source_text, realm_obj, true, None, gc.nogc()) { Ok(script) => script, Err(errors) => { @@ -207,7 +194,7 @@ pub fn run_repl_with_config( let start_time = std::time::Instant::now(); agent.run_in_realm(&realm, |agent, mut gc| { let realm_obj = agent.current_realm(gc.nogc()); - let source_text = types::String::from_string(agent, input.clone(), gc.nogc()); + let source_text = NovaString::from_string(agent, input.clone(), gc.nogc()); let script = match parse_script(agent, source_text, realm_obj, true, None, gc.nogc()) { Ok(script) => script, Err(errors) => { @@ -278,7 +265,7 @@ fn initialize_global_object(agent: &mut Agent, global_object: Object, mut gc: Gc agent, property_key.unbind(), PropertyDescriptor { - value: Some(andromeda_obj.get(agent).into_value()), + value: Some(andromeda_obj.get(agent).into()), writable: Some(true), enumerable: Some(false), configurable: Some(true), @@ -292,7 +279,7 @@ fn initialize_global_object(agent: &mut Agent, global_object: Object, mut gc: Gc for extension in &mut extensions { for (idx, file) in extension.files.iter().enumerate() { let specifier = format!("", extension.name, idx); - let source_text = types::String::from_str(agent, file, gc.nogc()); + let source_text = NovaString::from_str(agent, file, gc.nogc()); let module = match parse_module( agent, source_text, @@ -307,7 +294,7 @@ fn initialize_global_object(agent: &mut Agent, global_object: Object, mut gc: Gc } }; if agent - .run_parsed_module(module.unbind(), None, gc.reborrow()) + .run_module(module.unbind(), None, gc.reborrow()) .unbind() .is_err() { @@ -330,21 +317,19 @@ fn initialize_global_object(agent: &mut Agent, global_object: Object, mut gc: Gc agent, property_key.unbind(), PropertyDescriptor { - value: Some(function.into_value().unbind()), + value: Some(Value::from(function).unbind()), ..Default::default() }, gc.reborrow(), ) .unwrap(); } else { - andromeda_obj - .get(agent) - .into_object() + Object::from(andromeda_obj.get(agent)) .internal_define_own_property( agent, property_key.unbind(), PropertyDescriptor { - value: Some(function.into_value().unbind()), + value: Some(Value::from(function).unbind()), ..Default::default() }, gc.reborrow(), @@ -373,7 +358,7 @@ fn initialize_global_object_with_internals(agent: &mut Agent, global: Object, mu let args = args.bind(gc.nogc()); let Value::ArrayBuffer(array_buffer) = args.get(0) else { return Err(agent.throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Cannot detach non ArrayBuffer argument", gc.into_nogc(), )); @@ -401,7 +386,7 @@ fn initialize_global_object_with_internals(agent: &mut Agent, global: Object, mu gc, ) .unbind(); - Ok(realm.global_object(agent).into_value().unbind()) + Ok(Value::from(realm.global_object(agent)).unbind()) } initialize_global_object(agent, global, gc.reborrow()); ().unbind(); @@ -413,7 +398,7 @@ fn initialize_global_object_with_internals(agent: &mut Agent, global: Object, mu agent, property_key.unbind(), PropertyDescriptor { - value: Some(nova_obj.get(agent).into_value()), + value: Some(nova_obj.get(agent).into()), writable: Some(true), enumerable: Some(false), configurable: Some(true), @@ -436,7 +421,7 @@ fn initialize_global_object_with_internals(agent: &mut Agent, global: Object, mu agent, property_key.unbind(), PropertyDescriptor { - value: Some(function.into_value().unbind()), + value: Some(Value::from(function).unbind()), writable: Some(true), enumerable: Some(false), configurable: Some(true), @@ -459,7 +444,7 @@ fn initialize_global_object_with_internals(agent: &mut Agent, global: Object, mu agent, property_key.unbind(), PropertyDescriptor { - value: Some(function.into_value().unbind()), + value: Some(Value::from(function).unbind()), writable: Some(true), enumerable: Some(false), configurable: Some(true), diff --git a/crates/core/src/event_loop.rs b/crates/core/src/event_loop.rs index df726c4..1861f8f 100644 --- a/crates/core/src/event_loop.rs +++ b/crates/core/src/event_loop.rs @@ -2,7 +2,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -use nova_vm::{ecmascript::types::Value, engine::Global}; +use nova_vm::{ecmascript::Value, engine::Global}; /// Collection of tasks dispatched and handled by the Runtime. #[derive(Debug)] diff --git a/crates/core/src/extension.rs b/crates/core/src/extension.rs index f4d53a7..c7b0715 100644 --- a/crates/core/src/extension.rs +++ b/crates/core/src/extension.rs @@ -4,14 +4,10 @@ use nova_vm::{ ecmascript::{ - builtins::{Behaviour, BuiltinFunctionArgs, RegularFn, create_builtin_function}, - execution::Agent, - scripts_and_modules::{ - module::module_semantics::source_text_module_records::parse_module, script::HostDefined, - }, - types::{InternalMethods, IntoValue, Object, PropertyDescriptor, PropertyKey}, + Agent, Behaviour, BuiltinFunctionArgs, HostDefined, InternalMethods, Object, + PropertyDescriptor, PropertyKey, RegularFn, Value, create_builtin_function, parse_module, }, - engine::context::{Bindable, GcScope}, + engine::{Bindable, GcScope}, }; use crate::{HostData, OpsStorage, RuntimeError, exit_with_parse_errors, print_enhanced_error}; @@ -62,8 +58,7 @@ impl Extension { ) { for (idx, file_source) in self.files.iter().enumerate() { let specifier = format!("", self.name, idx); - let source_text = - nova_vm::ecmascript::types::String::from_str(agent, file_source, gc.nogc()); + let source_text = nova_vm::ecmascript::String::from_str(agent, file_source, gc.nogc()); let module = match parse_module( agent, @@ -77,7 +72,7 @@ impl Extension { }; let eval_result = agent - .run_parsed_module(module.unbind(), None, gc.reborrow()) + .run_module(module.unbind(), None, gc.reborrow()) .unbind(); if let Err(e) = eval_result { let error_value = e.value(); @@ -105,7 +100,7 @@ impl Extension { agent, property_key.unbind(), PropertyDescriptor { - value: Some(function.into_value().unbind()), + value: Some(Value::from(function).unbind()), ..Default::default() }, gc.reborrow(), @@ -117,7 +112,7 @@ impl Extension { agent, property_key.unbind(), PropertyDescriptor { - value: Some(function.into_value().unbind()), + value: Some(Value::from(function).unbind()), ..Default::default() }, gc.reborrow(), diff --git a/crates/core/src/host_data.rs b/crates/core/src/host_data.rs index 7d52858..2e452b1 100644 --- a/crates/core/src/host_data.rs +++ b/crates/core/src/host_data.rs @@ -47,13 +47,13 @@ impl HostData { } } - /// Get an owned senderto the macro tasks event loop. + /// Get an owned sender to the macro tasks event loop. pub fn macro_task_tx(&self) -> Sender> { self.macro_task_tx.clone() } /// Spawn an async task in the Tokio Runtime that self-registers and unregisters automatically. - /// It's given [TaskId] is returned. + /// Its given [TaskId] is returned. pub fn spawn_macro_task(&self, future: F) -> TaskId where F: Future + Send + 'static, @@ -73,22 +73,27 @@ impl HostData { task_id } - /// Abort a MacroTask execution given it's [TaskId]. + /// Abort a MacroTask execution given its [TaskId]. pub fn abort_macro_task(&self, task_id: TaskId) { let tasks = self.tasks.borrow(); - let task = tasks.get(&task_id).unwrap(); + let Some(task) = tasks.get(&task_id) else { + eprintln!("abort_macro_task: task {} not found", task_id.index()); + return; + }; task.abort(); // Manually decrease the macro tasks counter as the task was aborted. self.macro_task_count.fetch_sub(1, Ordering::Release); } - /// Clear a MacroTask given it's [TaskId]. + /// Clear a MacroTask given its [TaskId]. pub fn clear_macro_task(&self, task_id: TaskId) { - self.tasks.borrow_mut().remove(&task_id).unwrap(); + if self.tasks.borrow_mut().remove(&task_id).is_none() { + eprintln!("clear_macro_task: task {} not found", task_id.index()); + } } - /// Abort a MacroTask execution given it's [TaskId] with proper error handling. + /// Abort a MacroTask execution given its [TaskId] with proper error handling. pub fn abort_macro_task_safe(&self, task_id: TaskId) -> RuntimeResult<()> { let tasks = self.tasks.borrow(); let task = tasks @@ -101,7 +106,7 @@ impl HostData { Ok(()) } - /// Clear a MacroTask given it's [TaskId] with proper error handling. + /// Clear a MacroTask given its [TaskId] with proper error handling. pub fn clear_macro_task_safe(&self, task_id: TaskId) -> RuntimeResult<()> { self.tasks .borrow_mut() diff --git a/crates/core/src/module/mod.rs b/crates/core/src/module/mod.rs index 7aec930..020edc1 100644 --- a/crates/core/src/module/mod.rs +++ b/crates/core/src/module/mod.rs @@ -1520,7 +1520,7 @@ impl ModuleVisitor { ast::Declaration::VariableDeclaration(var_decl) => { // Handle: export const x = 1, y = 2; for declarator in &var_decl.declarations { - self.extract_binding_names(&declarator.id.kind); + self.extract_binding_names(&declarator.id); } } ast::Declaration::FunctionDeclaration(func) => { @@ -1600,9 +1600,9 @@ impl ModuleVisitor { } /// Extract names from binding patterns (handles destructuring) - fn extract_binding_names(&mut self, binding: &ast::BindingPatternKind) { + fn extract_binding_names(&mut self, binding: &ast::BindingPattern) { match binding { - ast::BindingPatternKind::BindingIdentifier(id) => { + ast::BindingPattern::BindingIdentifier(id) => { // Simple binding: const x = 1 self.exports.push(ModuleExport { name: Some(id.name.as_str().to_owned()), @@ -1611,29 +1611,29 @@ impl ModuleVisitor { source_name: None, }); } - ast::BindingPatternKind::ObjectPattern(obj_pattern) => { + ast::BindingPattern::ObjectPattern(obj_pattern) => { // Object destructuring: const { x, y } = obj for property in &obj_pattern.properties { - self.extract_binding_names(&property.value.kind); + self.extract_binding_names(&property.value); } // Handle rest: const { ...rest } = obj if let Some(rest) = &obj_pattern.rest { - self.extract_binding_names(&rest.argument.kind); + self.extract_binding_names(&rest.argument); } } - ast::BindingPatternKind::ArrayPattern(arr_pattern) => { + ast::BindingPattern::ArrayPattern(arr_pattern) => { // Array destructuring: const [x, y] = arr for element in arr_pattern.elements.iter().flatten() { - self.extract_binding_names(&element.kind); + self.extract_binding_names(element); } // Handle rest: const [...rest] = arr if let Some(rest) = &arr_pattern.rest { - self.extract_binding_names(&rest.argument.kind); + self.extract_binding_names(&rest.argument); } } - ast::BindingPatternKind::AssignmentPattern(assignment) => { + ast::BindingPattern::AssignmentPattern(assignment) => { // Default values: const { x = 5 } = obj - self.extract_binding_names(&assignment.left.kind); + self.extract_binding_names(&assignment.left); } } } diff --git a/crates/core/src/runtime.rs b/crates/core/src/runtime.rs index 1ef507b..25fac3d 100644 --- a/crates/core/src/runtime.rs +++ b/crates/core/src/runtime.rs @@ -16,30 +16,13 @@ use std::{ use nova_vm::{ ecmascript::{ - builtins::promise_objects::promise_abstract_operations::promise_capability_records::PromiseCapability, - execution::{ - Agent, JsResult, - agent::{ExceptionType, GcAgent, HostHooks, Job, Options, RealmRoot}, - }, - scripts_and_modules::{ - module::module_semantics::{ - ModuleRequest, Referrer, - abstract_module_records::AbstractModule, - cyclic_module_records::GraphLoadingStateRecord, - finish_loading_imported_module, - source_text_module_records::{SourceTextModule, parse_module}, - }, - script::{HostDefined, parse_script, script_evaluation}, - }, - types::{ - self, InternalMethods, IntoObject, IntoValue, Object, OrdinaryObject, - PropertyDescriptor, PropertyKey, String as NovaString, Value, - }, - }, - engine::{ - context::{Bindable, GcScope, NoGcScope}, - rootable::Scopable, + AbstractModule, Agent, AgentOptions, ExceptionType, GcAgent, GraphLoadingStateRecord, + HostDefined, HostHooks, InternalMethods, Job, JsResult, ModuleRequest, Object, + OrdinaryObject, PromiseCapability, PropertyDescriptor, PropertyKey, RealmRoot, Referrer, + SourceTextModule, String as NovaString, Value, finish_loading_imported_module, + parse_module, parse_script, script_evaluation, }, + engine::{Bindable, GcScope, NoGcScope, Scopable}, }; use crate::{ @@ -590,7 +573,7 @@ impl HostHooks for RuntimeHostHooks { fn finalize_import_meta<'gc>( &self, _agent: &mut Agent, - _import_meta: types::OrdinaryObject<'gc>, + _import_meta: OrdinaryObject<'gc>, _module_record: SourceTextModule<'gc>, _gc: NoGcScope<'gc, '_>, ) { @@ -720,7 +703,7 @@ impl Runtime { let host_hooks: &RuntimeHostHooks = &*Box::leak(Box::new(host_hooks)); let mut agent = GcAgent::new( - Options { + AgentOptions { no_block: false, disable_gc: false, print_internals: config.verbose, @@ -746,7 +729,7 @@ impl Runtime { agent, property_key.unbind(), PropertyDescriptor { - value: Some(andromeda_obj.get(agent).into_value()), + value: Some(andromeda_obj.get(agent).into()), writable: Some(true), enumerable: Some(false), configurable: Some(true), @@ -760,7 +743,7 @@ impl Runtime { extension.load::( agent, global_object, - andromeda_obj.get(agent).into_object(), + andromeda_obj.get(agent).into(), gc.borrow_mut(), ); } @@ -782,7 +765,7 @@ impl Runtime { self.agent.run_in_realm(&self.realm_root, |agent, mut gc| { for builtin in &self.config.builtins { let realm = agent.current_realm(gc.nogc()); - let source_text = types::String::from_str(agent, builtin, gc.nogc()); + let source_text = NovaString::from_str(agent, builtin, gc.nogc()); let script = match parse_script( agent, source_text, @@ -838,7 +821,7 @@ impl Runtime { continue; } result = self.agent.run_in_realm(&self.realm_root, |agent, mut gc| { - let source_text = types::String::from_string(agent, file_content, gc.nogc()); + let source_text = NovaString::from_string(agent, file_content, gc.nogc()); let realm = agent.current_realm(gc.nogc()); let module = match parse_module( @@ -859,7 +842,7 @@ impl Runtime { }; agent - .run_parsed_module(module.unbind(), None, gc.reborrow()) + .run_module(module.unbind(), None, gc.reborrow()) .unbind() .map(|_| Value::Null) }); diff --git a/crates/runtime/src/event_loop.rs b/crates/runtime/src/event_loop.rs index 7e45c5d..c2938b2 100644 --- a/crates/runtime/src/event_loop.rs +++ b/crates/runtime/src/event_loop.rs @@ -3,7 +3,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use crate::ext::{LockMode, cron::CronId, interval::IntervalId, timeout::TimeoutId}; -use nova_vm::{ecmascript::types::Value, engine::Global}; +use nova_vm::{ecmascript::Value, engine::Global}; use tokio::net::TcpStream; use tokio_rustls::client::TlsStream; diff --git a/crates/runtime/src/ext/broadcast_channel/mod.rs b/crates/runtime/src/ext/broadcast_channel/mod.rs index 429d19f..5b1e23b 100644 --- a/crates/runtime/src/ext/broadcast_channel/mod.rs +++ b/crates/runtime/src/ext/broadcast_channel/mod.rs @@ -4,12 +4,8 @@ use andromeda_core::{Extension, ExtensionOp}; use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult}, - types::Value, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, JsResult, Value}, + engine::{Bindable, GcScope}, }; use std::collections::HashMap; use std::sync::{Arc, Mutex, RwLock}; diff --git a/crates/runtime/src/ext/cache_storage/mod.rs b/crates/runtime/src/ext/cache_storage/mod.rs index c5497a1..44a4430 100644 --- a/crates/runtime/src/ext/cache_storage/mod.rs +++ b/crates/runtime/src/ext/cache_storage/mod.rs @@ -4,12 +4,8 @@ use andromeda_core::{Extension, ExtensionOp, HostData}; use nova_vm::{ - ecmascript::{ - builtins::{ArgumentsList, Array}, - execution::{Agent, JsResult}, - types::Value, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, Array, JsResult, Value}, + engine::{Bindable, GcScope}, }; use rusqlite::{Connection, params}; use serde::{Deserialize, Serialize}; @@ -233,7 +229,7 @@ impl CacheStorageExt { } Err(_) => Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to open cache", gc.nogc(), ) diff --git a/crates/runtime/src/ext/canvas/context2d.rs b/crates/runtime/src/ext/canvas/context2d.rs index 0a9ff09..20eb1c4 100644 --- a/crates/runtime/src/ext/canvas/context2d.rs +++ b/crates/runtime/src/ext/canvas/context2d.rs @@ -9,14 +9,10 @@ use super::renderer::{Point, Rect}; use crate::RuntimeMacroTask; use crate::ext::canvas::renderer::{CompositeOperation, LineCap, LineJoin, RenderState}; use andromeda_core::HostData; -use nova_vm::ecmascript::types::Number; +use nova_vm::ecmascript::Number; use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult}, - types::Value, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, JsResult, Value}, + engine::{Bindable, GcScope}, }; /// A command to be executed on the canvas diff --git a/crates/runtime/src/ext/canvas/mod.rs b/crates/runtime/src/ext/canvas/mod.rs index 5eb3881..0b38e3e 100644 --- a/crates/runtime/src/ext/canvas/mod.rs +++ b/crates/runtime/src/ext/canvas/mod.rs @@ -30,13 +30,8 @@ use crate::ext::canvas::context2d::{ internal_canvas_stroke, }; use nova_vm::{ - SmallInteger, - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult}, - types::Value, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, JsResult, SmallInteger, Value}, + engine::{Bindable, GcScope}, }; // Helper functions for text rendering diff --git a/crates/runtime/src/ext/console/mod.rs b/crates/runtime/src/ext/console/mod.rs index 849382e..90a3e67 100644 --- a/crates/runtime/src/ext/console/mod.rs +++ b/crates/runtime/src/ext/console/mod.rs @@ -8,12 +8,8 @@ use std::time::{SystemTime, UNIX_EPOCH}; use andromeda_core::{ErrorReporter, Extension, ExtensionOp, HostData, OpsStorage, RuntimeError}; use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult}, - types::Value, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, JsResult, Value}, + engine::{Bindable, GcScope}, }; /// Storage for console state (timers, counters, group indentation) diff --git a/crates/runtime/src/ext/cron/mod.rs b/crates/runtime/src/ext/cron/mod.rs index 415dfef..bd67507 100644 --- a/crates/runtime/src/ext/cron/mod.rs +++ b/crates/runtime/src/ext/cron/mod.rs @@ -5,15 +5,8 @@ use crate::RuntimeMacroTask; use andromeda_core::{Extension, ExtensionOp, HostData, MacroTask, OpsStorage}; use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult}, - types::Value, - }, - engine::{ - Global, - context::{Bindable, GcScope}, - }, + ecmascript::{Agent, ArgumentsList, JsResult, Value}, + engine::{Bindable, GcScope, Global}, }; use std::collections::HashMap; use std::time::Duration; @@ -66,9 +59,9 @@ impl CronId { pub fn run( &self, - agent: &mut nova_vm::ecmascript::execution::agent::GcAgent, + agent: &mut nova_vm::ecmascript::GcAgent, host_data: &HostData, - realm_root: &nova_vm::ecmascript::execution::agent::RealmRoot, + realm_root: &nova_vm::ecmascript::RealmRoot, ) { let storage = host_data.storage.borrow(); if let Some(crons_storage) = storage.get::() @@ -98,15 +91,14 @@ pub struct CronJob { impl CronJob { pub fn run( &self, - agent: &mut nova_vm::ecmascript::execution::agent::GcAgent, + agent: &mut nova_vm::ecmascript::GcAgent, _host_data: &HostData, - realm_root: &nova_vm::ecmascript::execution::agent::RealmRoot, + realm_root: &nova_vm::ecmascript::RealmRoot, ) { let global_callback = &self.callback; agent.run_in_realm(realm_root, |agent, mut gc| { let callback = global_callback.get(agent, gc.nogc()); - let callback_function: nova_vm::ecmascript::types::Function = - callback.try_into().unwrap(); + let callback_function: nova_vm::ecmascript::Function = callback.try_into().unwrap(); callback_function .call(agent, Value::Undefined, &mut [], gc.reborrow()) .unwrap(); diff --git a/crates/runtime/src/ext/crypto/mod.rs b/crates/runtime/src/ext/crypto/mod.rs index fe00a29..a12ad20 100644 --- a/crates/runtime/src/ext/crypto/mod.rs +++ b/crates/runtime/src/ext/crypto/mod.rs @@ -5,14 +5,10 @@ mod subtle; use andromeda_core::{Extension, ExtensionOp, OpsStorage}; use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult}, - types::Value, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, JsResult, Value}, + engine::{Bindable, GcScope}, }; -use rand::RngCore; +use rand::Rng; use std::collections::HashMap; pub use subtle::{CryptoExtResources, SimpleCryptoKey, SubtleCrypto}; @@ -180,13 +176,11 @@ impl CryptoExt { let random_data_base64 = base64_simd::STANDARD.encode_to_string(&bytes); - Ok(nova_vm::ecmascript::types::String::from_string( - agent, - random_data_base64, - gc.into_nogc(), + Ok( + nova_vm::ecmascript::String::from_string(agent, random_data_base64, gc.into_nogc()) + .unbind() + .into(), ) - .unbind() - .into()) } fn internal_crypto_random_uuid<'gc>( agent: &mut Agent, @@ -223,7 +217,7 @@ impl CryptoExt { ); Ok( - nova_vm::ecmascript::types::String::from_string(agent, uuid, gc.nogc()) + nova_vm::ecmascript::String::from_string(agent, uuid, gc.nogc()) .unbind() .into(), ) @@ -346,7 +340,7 @@ impl CryptoExt { let gc = gc.into_nogc(); Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "CryptoKey creation not yet implemented", gc, ) @@ -361,7 +355,7 @@ impl CryptoExt { ) -> JsResult<'gc, Value<'gc>> { // TODO: Implement CryptoKey type getter Ok( - nova_vm::ecmascript::types::String::from_string(agent, "secret".to_string(), gc.nogc()) + nova_vm::ecmascript::String::from_string(agent, "secret".to_string(), gc.nogc()) .unbind() .into(), ) @@ -385,13 +379,9 @@ impl CryptoExt { ) -> JsResult<'gc, Value<'gc>> { // TODO: Implement CryptoKey algorithm getter Ok( - nova_vm::ecmascript::types::String::from_string( - agent, - "AES-GCM".to_string(), - gc.nogc(), - ) - .unbind() - .into(), + nova_vm::ecmascript::String::from_string(agent, "AES-GCM".to_string(), gc.nogc()) + .unbind() + .into(), ) } @@ -402,7 +392,7 @@ impl CryptoExt { gc: GcScope<'gc, '_>, ) -> JsResult<'gc, Value<'gc>> { // TODO: Implement CryptoKey usages getter - Ok(nova_vm::ecmascript::types::String::from_string( + Ok(nova_vm::ecmascript::String::from_string( agent, "encrypt,decrypt".to_string(), gc.nogc(), @@ -419,7 +409,7 @@ impl CryptoExt { ) -> JsResult<'gc, Value<'gc>> { // TODO: Implement proper ArrayBuffer creation from bytes let _bytes_arg = args[0]; - Ok(nova_vm::ecmascript::types::String::from_string( + Ok(nova_vm::ecmascript::String::from_string( agent, "arraybuffer_placeholder".to_string(), gc.nogc(), @@ -435,7 +425,7 @@ impl CryptoExt { gc: GcScope<'gc, '_>, ) -> JsResult<'gc, Value<'gc>> { // TODO: Implement proper bytes extraction from ArrayBuffer/TypedArray - Ok(nova_vm::ecmascript::types::String::from_string( + Ok(nova_vm::ecmascript::String::from_string( agent, "buffer_bytes_placeholder".to_string(), gc.nogc(), diff --git a/crates/runtime/src/ext/crypto/subtle.rs b/crates/runtime/src/ext/crypto/subtle.rs index 6bea7d7..40aafda 100644 --- a/crates/runtime/src/ext/crypto/subtle.rs +++ b/crates/runtime/src/ext/crypto/subtle.rs @@ -4,12 +4,8 @@ use andromeda_core::HostData; use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult}, - types::Value, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, JsResult, Value}, + engine::{Bindable, GcScope}, }; use rand::SecureRandom; use ring::{aead, digest, hmac, rand}; @@ -259,7 +255,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Invalid algorithm", gc, ) @@ -274,7 +270,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to extract data", gc, ) @@ -291,7 +287,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Unsupported digest algorithm", gc, ) @@ -303,7 +299,7 @@ impl SubtleCrypto { let base64_string = base64_simd::STANDARD.encode_to_string(&result_bytes); Ok( - nova_vm::ecmascript::types::String::from_string(agent, base64_string, gc.nogc()) + nova_vm::ecmascript::String::from_string(agent, base64_string, gc.nogc()) .unbind() .into(), ) @@ -355,7 +351,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to generate random key", gc, ) @@ -403,7 +399,7 @@ impl SubtleCrypto { "keyId": key_id }); - Ok(nova_vm::ecmascript::types::String::from_string( + Ok(nova_vm::ecmascript::String::from_string( agent, key_object.to_string(), gc.nogc(), @@ -425,7 +421,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to generate random key", gc, ) @@ -456,7 +452,7 @@ impl SubtleCrypto { "keyId": key_id }); - Ok(nova_vm::ecmascript::types::String::from_string( + Ok(nova_vm::ecmascript::String::from_string( agent, key_object.to_string(), gc.nogc(), @@ -473,13 +469,9 @@ impl SubtleCrypto { ); Ok( - nova_vm::ecmascript::types::String::from_string( - agent, - key_pair_info, - gc.nogc(), - ) - .unbind() - .into(), + nova_vm::ecmascript::String::from_string(agent, key_pair_info, gc.nogc()) + .unbind() + .into(), ) } "ECDSA" | "ECDH" => { @@ -496,13 +488,9 @@ impl SubtleCrypto { ); Ok( - nova_vm::ecmascript::types::String::from_string( - agent, - key_pair_info, - gc.nogc(), - ) - .unbind() - .into(), + nova_vm::ecmascript::String::from_string(agent, key_pair_info, gc.nogc()) + .unbind() + .into(), ) } "Ed25519" | "Ed448" | "X25519" | "X448" => { @@ -512,13 +500,9 @@ impl SubtleCrypto { ); Ok( - nova_vm::ecmascript::types::String::from_string( - agent, - key_pair_info, - gc.nogc(), - ) - .unbind() - .into(), + nova_vm::ecmascript::String::from_string(agent, key_pair_info, gc.nogc()) + .unbind() + .into(), ) } "HKDF" | "PBKDF2" => { @@ -526,7 +510,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Key derivation algorithms cannot generate keys", gc, ) @@ -536,7 +520,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Unsupported key generation algorithm", gc, ) @@ -562,7 +546,7 @@ impl SubtleCrypto { } else { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Invalid key format", gc.nogc(), ) @@ -581,7 +565,7 @@ impl SubtleCrypto { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Unsupported algorithm", gc.nogc(), ) @@ -599,7 +583,7 @@ impl SubtleCrypto { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Invalid key data", gc.nogc(), ) @@ -632,19 +616,21 @@ impl SubtleCrypto { "extractable": extractable }); - Ok(nova_vm::ecmascript::types::String::from_string( - agent, - key_json.to_string(), - gc.nogc(), + Ok( + nova_vm::ecmascript::String::from_string( + agent, + key_json.to_string(), + gc.nogc(), + ) + .unbind() + .into(), ) - .unbind() - .into()) } _ => { // TODO: Implement other formats (spki, pkcs8, jwk) Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Unsupported key format", gc.nogc(), ) @@ -667,7 +653,7 @@ impl SubtleCrypto { } else { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Invalid key format", gc.nogc(), ) @@ -680,7 +666,7 @@ impl SubtleCrypto { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Invalid key object", gc.nogc(), ) @@ -693,7 +679,7 @@ impl SubtleCrypto { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Key not found", gc.nogc(), ) @@ -705,7 +691,7 @@ impl SubtleCrypto { if !crypto_key.extractable { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Key is not extractable", gc.nogc(), ) @@ -716,13 +702,11 @@ impl SubtleCrypto { "raw" => { // Return raw key data as base64 string let key_data_base64 = base64_simd::STANDARD.encode_to_string(&crypto_key.key_data); - Ok(nova_vm::ecmascript::types::String::from_string( - agent, - key_data_base64, - gc.nogc(), + Ok( + nova_vm::ecmascript::String::from_string(agent, key_data_base64, gc.nogc()) + .unbind() + .into(), ) - .unbind() - .into()) } "jwk" => { // Return JWK format @@ -745,7 +729,7 @@ impl SubtleCrypto { _ => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "JWK export not supported for this algorithm", gc.nogc(), ) @@ -753,17 +737,15 @@ impl SubtleCrypto { } }; - Ok(nova_vm::ecmascript::types::String::from_string( - agent, - jwk.to_string(), - gc.nogc(), + Ok( + nova_vm::ecmascript::String::from_string(agent, jwk.to_string(), gc.nogc()) + .unbind() + .into(), ) - .unbind() - .into()) } _ => Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Unsupported export format", gc.nogc(), ) @@ -787,7 +769,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Invalid algorithm parameter", gc, ) @@ -802,7 +784,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Invalid key parameter", gc, ) @@ -816,7 +798,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Key not found", gc, ) @@ -831,7 +813,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Invalid data parameter", gc, ) @@ -859,20 +841,16 @@ impl SubtleCrypto { let base64_result = base64_simd::STANDARD.encode_to_string(&ciphertext); Ok( - nova_vm::ecmascript::types::String::from_string( - agent, - base64_result, - gc.nogc(), - ) - .unbind() - .into(), + nova_vm::ecmascript::String::from_string(agent, base64_result, gc.nogc()) + .unbind() + .into(), ) } Err(_) => { let gc = gc.into_nogc(); Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Encryption failed", gc, ) @@ -954,7 +932,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Invalid algorithm parameter", gc, ) @@ -969,7 +947,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Invalid key parameter", gc, ) @@ -983,7 +961,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Key not found", gc, ) @@ -998,7 +976,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Invalid data parameter", gc, ) @@ -1026,20 +1004,16 @@ impl SubtleCrypto { let base64_result = base64_simd::STANDARD.encode_to_string(&plaintext); Ok( - nova_vm::ecmascript::types::String::from_string( - agent, - base64_result, - gc.nogc(), - ) - .unbind() - .into(), + nova_vm::ecmascript::String::from_string(agent, base64_result, gc.nogc()) + .unbind() + .into(), ) } Err(_) => { let gc = gc.into_nogc(); Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Decryption failed", gc, ) @@ -1105,7 +1079,7 @@ impl SubtleCrypto { let algorithm = match Self::parse_algorithm(agent, algorithm_value, gc.reborrow()) { Ok(alg) => alg, Err(_) => { - return Ok(nova_vm::ecmascript::types::String::from_string( + return Ok(nova_vm::ecmascript::String::from_string( agent, "error_unsupported_algorithm".to_string(), gc.nogc(), @@ -1119,7 +1093,7 @@ impl SubtleCrypto { let data = match Self::extract_bytes_from_value(agent, data_value, gc.reborrow()) { Ok(bytes) => bytes, Err(_) => { - return Ok(nova_vm::ecmascript::types::String::from_string( + return Ok(nova_vm::ecmascript::String::from_string( agent, "error_invalid_data".to_string(), gc.nogc(), @@ -1171,7 +1145,7 @@ impl SubtleCrypto { hmac::sign(&key, &data) } _ => { - return Ok(nova_vm::ecmascript::types::String::from_string( + return Ok(nova_vm::ecmascript::String::from_string( agent, "error_unsupported_hash".to_string(), gc.nogc(), @@ -1184,17 +1158,15 @@ impl SubtleCrypto { let signature_bytes = signature_result.as_ref().to_vec(); let signature_base64 = base64_simd::STANDARD.encode_to_string(&signature_bytes); - Ok(nova_vm::ecmascript::types::String::from_string( - agent, - signature_base64, - gc.nogc(), + Ok( + nova_vm::ecmascript::String::from_string(agent, signature_base64, gc.nogc()) + .unbind() + .into(), ) - .unbind() - .into()) } _ => { // TODO: Implement RSA signatures and ECDSA - Ok(nova_vm::ecmascript::types::String::from_string( + Ok(nova_vm::ecmascript::String::from_string( agent, "error_algorithm_not_implemented".to_string(), gc.nogc(), @@ -1277,7 +1249,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "deriveKey not yet implemented", gc, ) @@ -1293,7 +1265,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "deriveBits not yet implemented", gc, ) @@ -1309,7 +1281,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "wrapKey not yet implemented", gc, ) @@ -1325,7 +1297,7 @@ impl SubtleCrypto { let gc = gc.into_nogc(); Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "unwrapKey not yet implemented", gc, ) diff --git a/crates/runtime/src/ext/ffi/ir.rs b/crates/runtime/src/ext/ffi/ir.rs index 223c73c..64c0174 100644 --- a/crates/runtime/src/ext/ffi/ir.rs +++ b/crates/runtime/src/ext/ffi/ir.rs @@ -3,11 +3,8 @@ use crate::ext::ffi::{ error::FfiError, }; use nova_vm::{ - ecmascript::{ - execution::Agent, - types::{BigInt, Value}, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, BigInt, Value}, + engine::{Bindable, GcScope}, }; use std::os::raw::c_void; use std::ptr; diff --git a/crates/runtime/src/ext/ffi/mod.rs b/crates/runtime/src/ext/ffi/mod.rs index 7cf92d7..c7499d1 100644 --- a/crates/runtime/src/ext/ffi/mod.rs +++ b/crates/runtime/src/ext/ffi/mod.rs @@ -24,12 +24,8 @@ use crate::ext::ffi::ir::{ use andromeda_core::{Extension, ExtensionOp, HostData, OpsStorage}; use libffi::middle; use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult}, - types::{BigInt, Value}, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, BigInt, JsResult, Value}, + engine::{Bindable, GcScope}, }; static LIBRARY_ID_COUNTER: AtomicU32 = AtomicU32::new(1); @@ -260,7 +256,7 @@ impl FfiExt { _ => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Filename must be a string", gc.nogc(), ) @@ -275,7 +271,7 @@ impl FfiExt { Err(_e) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to load dynamic library", gc.nogc(), ) @@ -328,7 +324,7 @@ impl FfiExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Library ID must be a number", gc.nogc(), ) @@ -345,7 +341,7 @@ impl FfiExt { _ => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Symbol name must be a string", gc.nogc(), ) @@ -361,7 +357,7 @@ impl FfiExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to parse function definition", gc.nogc(), ) @@ -395,7 +391,7 @@ impl FfiExt { Ok(pointer) => Ok(Value::from_f64(agent, pointer as f64, gc.nogc()).unbind()), Err(_) => Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to get symbol", gc.nogc(), ) @@ -414,7 +410,7 @@ impl FfiExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Library ID must be a number", gc.nogc(), ) @@ -431,7 +427,7 @@ impl FfiExt { _ => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Symbol name must be a string", gc.nogc(), ) @@ -454,7 +450,7 @@ impl FfiExt { drop(storage); // Release borrow before using agent return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "No libraries available", gc.nogc(), ) @@ -468,7 +464,7 @@ impl FfiExt { drop(storage); // Release borrow before using agent return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Library not found", gc.nogc(), ) @@ -483,7 +479,7 @@ impl FfiExt { drop(storage); // Release borrow before using agent return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Symbol not found", gc.nogc(), ) @@ -566,7 +562,7 @@ impl FfiExt { Ok(result) => Ok(Value::from_f64(agent, result, gc.nogc()).unbind()), Err(_) => Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to call symbol", gc.nogc(), ) @@ -585,7 +581,7 @@ impl FfiExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Library ID must be a number", gc.nogc(), ) @@ -671,7 +667,7 @@ impl FfiExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Callback ID must be a number", gc.nogc(), ) @@ -702,7 +698,7 @@ impl FfiExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Pointer value must be a number", gc.nogc(), ) diff --git a/crates/runtime/src/ext/file/mod.rs b/crates/runtime/src/ext/file/mod.rs index 6c408f9..a7a7788 100644 --- a/crates/runtime/src/ext/file/mod.rs +++ b/crates/runtime/src/ext/file/mod.rs @@ -4,12 +4,8 @@ use andromeda_core::{Extension, ExtensionOp, HostData, OpsStorage}; use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult, agent::ExceptionType}, - types::Value, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, ExceptionType, JsResult, Value}, + engine::{Bindable, GcScope}, }; use std::collections::HashMap; use uuid::Uuid; diff --git a/crates/runtime/src/ext/fs.rs b/crates/runtime/src/ext/fs.rs index af77167..a255a6e 100644 --- a/crates/runtime/src/ext/fs.rs +++ b/crates/runtime/src/ext/fs.rs @@ -10,19 +10,8 @@ use std::{ }; use nova_vm::{ - SmallInteger, - ecmascript::{ - builtins::{ - ArgumentsList, - promise_objects::promise_abstract_operations::promise_capability_records::PromiseCapability, - }, - execution::{Agent, JsResult}, - types::{IntoValue, Value}, - }, - engine::{ - Global, - context::{Bindable, GcScope}, - }, + ecmascript::{Agent, ArgumentsList, JsResult, PromiseCapability, SmallInteger, Value}, + engine::{Bindable, GcScope, Global}, }; use andromeda_core::{ @@ -1168,7 +1157,7 @@ impl FsExt { let error_msg = ErrorReporter::format_error(&error); let promise_capability = PromiseCapability::new(agent, gc.nogc()); let root_value = - Global::new(agent, promise_capability.promise().into_value().unbind()); + Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1185,7 +1174,7 @@ impl FsExt { let path_string = resolved_path.to_string_lossy().to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1247,7 +1236,7 @@ impl FsExt { let error_msg = ErrorReporter::format_error(&error); let promise_capability = PromiseCapability::new(agent, gc.nogc()); let root_value = - Global::new(agent, promise_capability.promise().into_value().unbind()); + Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1264,7 +1253,7 @@ impl FsExt { let path_string = resolved_path.to_string_lossy().to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1310,7 +1299,7 @@ impl FsExt { .to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1367,7 +1356,7 @@ impl FsExt { .to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1425,7 +1414,7 @@ impl FsExt { .to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1475,7 +1464,7 @@ impl FsExt { .to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1527,7 +1516,7 @@ impl FsExt { .to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1573,7 +1562,7 @@ impl FsExt { .to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1616,7 +1605,7 @@ impl FsExt { .to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1659,7 +1648,7 @@ impl FsExt { .to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1697,7 +1686,7 @@ impl FsExt { .to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -1740,7 +1729,7 @@ impl FsExt { .to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); diff --git a/crates/runtime/src/ext/local_storage/mod.rs b/crates/runtime/src/ext/local_storage/mod.rs index abff71d..5d965f6 100644 --- a/crates/runtime/src/ext/local_storage/mod.rs +++ b/crates/runtime/src/ext/local_storage/mod.rs @@ -4,12 +4,8 @@ use andromeda_core::{Extension, ExtensionOp, HostData}; use nova_vm::{ - ecmascript::{ - builtins::{ArgumentsList, Array}, - execution::{Agent, JsResult}, - types::Value, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, Array, JsResult, Value}, + engine::{Bindable, GcScope}, }; use rusqlite::{Connection, OptionalExtension, params}; @@ -151,7 +147,7 @@ impl LocalStorageExt { Ok(_) => Ok(Value::Boolean(persistent)), Err(_) => Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "LocalStorage is not supported in this context", gc.nogc(), ) @@ -276,7 +272,7 @@ impl LocalStorageExt { if size_check(key.len() + value.len()).is_err() { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Exceeded maximum storage size", gc.nogc(), ) @@ -303,14 +299,14 @@ impl LocalStorageExt { Ok(_) => Ok(Value::Undefined), Err(WebStorageError::StorageExceeded) => Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Exceeded maximum storage size", gc.nogc(), ) .unbind()), Err(_) => Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to store item", gc.nogc(), ) diff --git a/crates/runtime/src/ext/net/mod.rs b/crates/runtime/src/ext/net/mod.rs index 93d687b..e4da7d9 100644 --- a/crates/runtime/src/ext/net/mod.rs +++ b/crates/runtime/src/ext/net/mod.rs @@ -22,18 +22,8 @@ use tokio::net::{TcpListener, TcpStream, UdpSocket}; use tokio::sync::Mutex; use nova_vm::{ - ecmascript::{ - builtins::{ - ArgumentsList, - promise_objects::promise_abstract_operations::promise_capability_records::PromiseCapability, - }, - execution::{Agent, JsResult}, - types::{IntoValue, Value}, - }, - engine::{ - Global, - context::{Bindable, GcScope}, - }, + ecmascript::{Agent, ArgumentsList, JsResult, PromiseCapability, Value}, + engine::{Bindable, GcScope, Global}, }; use andromeda_core::{ @@ -280,7 +270,7 @@ impl NetExt { }; let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); @@ -440,7 +430,7 @@ impl NetExt { }; let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); @@ -569,7 +559,7 @@ impl NetExt { }; let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); @@ -669,7 +659,7 @@ impl NetExt { }; let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); @@ -876,7 +866,7 @@ impl NetExt { }; let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); @@ -956,7 +946,7 @@ impl NetExt { }; let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); @@ -1080,7 +1070,7 @@ impl NetExt { .to_string(); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); diff --git a/crates/runtime/src/ext/process.rs b/crates/runtime/src/ext/process.rs index 5b7bc90..c04c8ce 100644 --- a/crates/runtime/src/ext/process.rs +++ b/crates/runtime/src/ext/process.rs @@ -4,12 +4,8 @@ use andromeda_core::{ErrorReporter, Extension, ExtensionOp, HostData, OpsStorage, RuntimeError}; use nova_vm::{ - ecmascript::{ - builtins::{ArgumentsList, Array}, - execution::{Agent, JsResult}, - types::{IntoValue, Value}, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, Array, JsResult, Value}, + engine::{Bindable, GcScope}, }; use std::{collections::HashMap, env}; use tokio::task::JoinHandle; @@ -83,8 +79,7 @@ impl ProcessExt { let args = args .iter() .map(|s| { - nova_vm::ecmascript::types::String::from_string(agent, s.to_string(), gc.nogc()) - .into_value() + nova_vm::ecmascript::String::from_string(agent, s.to_string(), gc.nogc()).into() }) .collect::>(); @@ -103,13 +98,11 @@ impl ProcessExt { let key_str = key.as_str(agent).expect("String is not valid UTF-8"); match env::var(key_str) { - Ok(value) => { - Ok( - nova_vm::ecmascript::types::String::from_string(agent, value, gc.nogc()) - .unbind() - .into(), - ) - } + Ok(value) => Ok( + nova_vm::ecmascript::String::from_string(agent, value, gc.nogc()) + .unbind() + .into(), + ), Err(env::VarError::NotPresent) => Ok(Value::Undefined), Err(env::VarError::NotUnicode(_)) => { let error = RuntimeError::encoding_error( @@ -117,7 +110,7 @@ impl ProcessExt { format!("Environment variable '{key_str}' contains invalid Unicode"), ); let error_msg = ErrorReporter::format_error(&error); - Ok(nova_vm::ecmascript::types::String::from_string( + Ok(nova_vm::ecmascript::String::from_string( agent, format!("Error: {error_msg}"), gc.nogc(), @@ -173,9 +166,7 @@ impl ProcessExt { ) -> JsResult<'gc, Value<'gc>> { let keys = env::vars() .map(|(k, _)| k) - .map(|s| { - nova_vm::ecmascript::types::String::from_string(agent, s, gc.nogc()).into_value() - }) + .map(|s| nova_vm::ecmascript::String::from_string(agent, s, gc.nogc()).into()) .collect::>(); Ok(Array::from_slice(agent, keys.as_slice(), gc.nogc()) diff --git a/crates/runtime/src/ext/sqlite/mod.rs b/crates/runtime/src/ext/sqlite/mod.rs index da71176..3cc6fef 100644 --- a/crates/runtime/src/ext/sqlite/mod.rs +++ b/crates/runtime/src/ext/sqlite/mod.rs @@ -8,14 +8,13 @@ use std::sync::{Arc, Mutex}; use andromeda_core::{Extension, ExtensionOp, HostData}; use nova_vm::{ - ecmascript::{ - builtins::{ArgumentsList, Array}, - execution::{Agent, JsResult}, - types::Value, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, Array, JsResult, Value}, + engine::{Bindable, GcScope}, +}; +use rusqlite::{ + Connection, OpenFlags, + types::{ToSql, ValueRef}, }; -use rusqlite::{Connection, OpenFlags, types::ToSql, types::ValueRef}; static DATABASE_ID_COUNTER: AtomicU32 = AtomicU32::new(1); static STATEMENT_ID_COUNTER: AtomicU32 = AtomicU32::new(1); @@ -293,7 +292,7 @@ impl SqliteExt { _ => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Filename must be a string", gc.nogc(), ) @@ -308,7 +307,7 @@ impl SqliteExt { Err(_e) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to open database", gc.nogc(), ) @@ -356,7 +355,7 @@ impl SqliteExt { } else { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Invalid database ID", gc.nogc(), ) @@ -366,7 +365,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Database ID must be a number", gc.nogc(), ) @@ -383,7 +382,7 @@ impl SqliteExt { _ => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "SQL must be a string", gc.nogc(), ) @@ -395,7 +394,7 @@ impl SqliteExt { Ok(_) => Ok(Value::Undefined.unbind()), Err(_) => Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to execute SQL", gc.nogc(), ) @@ -414,7 +413,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Database ID must be a number", gc.nogc(), ) @@ -431,7 +430,7 @@ impl SqliteExt { _ => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "SQL must be a string", gc.nogc(), ) @@ -471,7 +470,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Database ID must be a number", gc.nogc(), ) @@ -502,7 +501,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Database ID must be a number", gc.nogc(), ) @@ -515,7 +514,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Statement ID must be a number", gc.nogc(), ) @@ -620,7 +619,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Database ID must be a number", gc.nogc(), ) @@ -633,7 +632,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Statement ID must be a number", gc.nogc(), ) @@ -715,7 +714,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Database ID must be a number", gc.nogc(), ) @@ -728,7 +727,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Statement ID must be a number", gc.nogc(), ) @@ -797,7 +796,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Statement ID must be a number", gc.nogc(), ) @@ -832,7 +831,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Database ID must be a number", gc.nogc(), ) @@ -845,7 +844,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Statement ID must be a number", gc.nogc(), ) @@ -946,7 +945,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Statement ID must be a number", gc.nogc(), ) @@ -985,7 +984,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Statement ID must be a number", gc.nogc(), ) @@ -1024,7 +1023,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Statement ID must be a number", gc.nogc(), ) @@ -1055,7 +1054,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Database ID must be a number", gc.nogc(), ) @@ -1078,7 +1077,7 @@ impl SqliteExt { Ok(_) => Ok(Value::Undefined.unbind()), Err(_) => Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to enable/disable extension loading", gc.nogc(), ) @@ -1097,7 +1096,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Database ID must be a number", gc.nogc(), ) @@ -1114,7 +1113,7 @@ impl SqliteExt { _ => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Extension path must be a string", gc.nogc(), ) @@ -1135,7 +1134,7 @@ impl SqliteExt { _ => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Entry point must be a string or undefined", gc.nogc(), ) @@ -1149,7 +1148,7 @@ impl SqliteExt { Ok(_) => Ok(Value::Undefined.unbind()), Err(_) => Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to load extension", gc.nogc(), ) @@ -1168,7 +1167,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Database ID must be a number", gc.nogc(), ) @@ -1185,7 +1184,7 @@ impl SqliteExt { _ => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Function name must be a string", gc.nogc(), ) @@ -1210,7 +1209,7 @@ impl SqliteExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Database ID must be a number", gc.nogc(), ) @@ -1227,7 +1226,7 @@ impl SqliteExt { _ => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Filename must be a string", gc.nogc(), ) @@ -1255,7 +1254,7 @@ impl SqliteExt { Err(_e) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::Error, + nova_vm::ecmascript::ExceptionType::Error, "Failed to open database", gc.nogc(), ) diff --git a/crates/runtime/src/ext/streams/mod.rs b/crates/runtime/src/ext/streams/mod.rs index 527ac93..0bedd97 100644 --- a/crates/runtime/src/ext/streams/mod.rs +++ b/crates/runtime/src/ext/streams/mod.rs @@ -4,12 +4,8 @@ use andromeda_core::{Extension, ExtensionOp}; use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult, agent::ExceptionType}, - types::Value, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, ExceptionType, JsResult, Value}, + engine::{Bindable, GcScope}, }; use std::collections::HashMap; use std::sync::{Arc, Mutex}; diff --git a/crates/runtime/src/ext/time/interval.rs b/crates/runtime/src/ext/time/interval.rs index 3dd9131..fd3c2ad 100644 --- a/crates/runtime/src/ext/time/interval.rs +++ b/crates/runtime/src/ext/time/interval.rs @@ -13,10 +13,7 @@ use std::{ use andromeda_core::{HostData, TaskId}; use nova_vm::{ - ecmascript::{ - execution::agent::{GcAgent, RealmRoot}, - types::{Function, Value}, - }, + ecmascript::{Function, GcAgent, RealmRoot, Value}, engine::Global, }; diff --git a/crates/runtime/src/ext/time/mod.rs b/crates/runtime/src/ext/time/mod.rs index dc34651..21a477e 100644 --- a/crates/runtime/src/ext/time/mod.rs +++ b/crates/runtime/src/ext/time/mod.rs @@ -8,18 +8,8 @@ pub mod timeout; use std::time::Duration; use nova_vm::{ - ecmascript::{ - builtins::{ - ArgumentsList, - promise_objects::promise_abstract_operations::promise_capability_records::PromiseCapability, - }, - execution::{Agent, JsResult}, - types::{IntoValue, Value}, - }, - engine::{ - Global, - context::{Bindable, GcScope}, - }, + ecmascript::{Agent, ArgumentsList, JsResult, PromiseCapability, Value}, + engine::{Bindable, GcScope, Global}, }; use tokio::time::interval; @@ -62,7 +52,7 @@ impl TimeExt { let duration = Duration::from_millis(time_ms as u64); let promise_capability = PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); let macro_task_tx = host_data.macro_task_tx(); diff --git a/crates/runtime/src/ext/time/timeout.rs b/crates/runtime/src/ext/time/timeout.rs index 6bbb470..9e5434c 100644 --- a/crates/runtime/src/ext/time/timeout.rs +++ b/crates/runtime/src/ext/time/timeout.rs @@ -13,10 +13,7 @@ use std::{ use andromeda_core::{HostData, TaskId}; use nova_vm::{ - ecmascript::{ - execution::agent::{GcAgent, RealmRoot}, - types::{Function, Value}, - }, + ecmascript::{Function, GcAgent, RealmRoot, Value}, engine::Global, }; diff --git a/crates/runtime/src/ext/tls.rs b/crates/runtime/src/ext/tls.rs index 59cbbf0..d4d092b 100644 --- a/crates/runtime/src/ext/tls.rs +++ b/crates/runtime/src/ext/tls.rs @@ -7,14 +7,8 @@ use std::sync::Arc; use andromeda_core::Rid; use andromeda_core::{Extension, ExtensionOp, HostData, MacroTask, OpsStorage, ResourceTable}; use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult, agent::ExceptionType}, - types::IntoValue, - types::Value, - }, - engine::context::Bindable, - engine::{Global, context::GcScope}, + ecmascript::{Agent, ArgumentsList, ExceptionType, JsResult, Value}, + engine::{Bindable, GcScope, Global}, }; use rustls; @@ -85,8 +79,8 @@ impl TlsExt { .expect("String is not valid UTF-8") .to_string(); - let promise_capability = nova_vm::ecmascript::builtins::promise_objects::promise_abstract_operations::promise_capability_records::PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let promise_capability = nova_vm::ecmascript::PromiseCapability::new(agent, gc.nogc()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); @@ -237,8 +231,8 @@ impl TlsExt { }; let rid = Rid::from_index(rid_val); - let promise_capability = nova_vm::ecmascript::builtins::promise_objects::promise_abstract_operations::promise_capability_records::PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let promise_capability = nova_vm::ecmascript::PromiseCapability::new(agent, gc.nogc()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); @@ -321,8 +315,8 @@ impl TlsExt { }; let rid = Rid::from_index(rid_val); - let promise_capability = nova_vm::ecmascript::builtins::promise_objects::promise_abstract_operations::promise_capability_records::PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let promise_capability = nova_vm::ecmascript::PromiseCapability::new(agent, gc.nogc()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); @@ -399,8 +393,8 @@ impl TlsExt { }; let rid = Rid::from_index(rid_val); - let promise_capability = nova_vm::ecmascript::builtins::promise_objects::promise_abstract_operations::promise_capability_records::PromiseCapability::new(agent, gc.nogc()); - let root_value = Global::new(agent, promise_capability.promise().into_value().unbind()); + let promise_capability = nova_vm::ecmascript::PromiseCapability::new(agent, gc.nogc()); + let root_value = Global::new(agent, Value::from(promise_capability.promise()).unbind()); let host_data = agent.get_host_data(); let host_data: &HostData = host_data.downcast_ref().unwrap(); diff --git a/crates/runtime/src/ext/url/mod.rs b/crates/runtime/src/ext/url/mod.rs index 37243ba..1c71e8d 100644 --- a/crates/runtime/src/ext/url/mod.rs +++ b/crates/runtime/src/ext/url/mod.rs @@ -3,15 +3,9 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use andromeda_core::{Extension, ExtensionOp}; -use nova_vm::engine::context::Bindable; - use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult}, - types::Value, - }, - engine::context::GcScope, + ecmascript::{Agent, ArgumentsList, JsResult, Value}, + engine::{Bindable, GcScope}, }; use url::Url; diff --git a/crates/runtime/src/ext/virtualfs.rs b/crates/runtime/src/ext/virtualfs.rs index 5a26fb5..755f62d 100644 --- a/crates/runtime/src/ext/virtualfs.rs +++ b/crates/runtime/src/ext/virtualfs.rs @@ -8,13 +8,8 @@ use std::{ }; use nova_vm::{ - SmallInteger, - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult}, - types::Value, - }, - engine::context::{Bindable, GcScope}, + ecmascript::{Agent, ArgumentsList, JsResult, SmallInteger, Value}, + engine::{Bindable, GcScope}, }; use andromeda_core::{Extension, ExtensionOp, HostData, OpsStorage, ResourceTable}; @@ -458,7 +453,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -504,7 +499,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -517,7 +512,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Content must be a string", gc.nogc(), ) @@ -585,7 +580,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -679,7 +674,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -741,7 +736,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -796,7 +791,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -848,7 +843,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Source path must be a string", gc.nogc(), ) @@ -861,7 +856,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Destination path must be a string", gc.nogc(), ) @@ -939,7 +934,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -989,7 +984,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -1033,7 +1028,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -1046,7 +1041,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Data must be a string (base64 encoded)", gc.nogc(), ) @@ -1122,7 +1117,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -1183,7 +1178,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -1239,7 +1234,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -1305,7 +1300,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Old path must be a string", gc.nogc(), ) @@ -1318,7 +1313,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "New path must be a string", gc.nogc(), ) @@ -1430,7 +1425,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -1445,7 +1440,7 @@ impl VirtualFsExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Size must be a number", gc.nogc(), ) @@ -1456,7 +1451,7 @@ impl VirtualFsExt { if size < 0 { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::RangeError, + nova_vm::ecmascript::ExceptionType::RangeError, "Size must be non-negative", gc.nogc(), ) @@ -1530,7 +1525,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -1544,7 +1539,7 @@ impl VirtualFsExt { Err(_) => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Mode must be a number", gc.nogc(), ) @@ -1585,7 +1580,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Target must be a string", gc.nogc(), ) @@ -1598,7 +1593,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Link path must be a string", gc.nogc(), ) @@ -1654,7 +1649,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) @@ -1701,7 +1696,7 @@ impl VirtualFsExt { None => { return Err(agent .throw_exception_with_static_message( - nova_vm::ecmascript::execution::agent::ExceptionType::TypeError, + nova_vm::ecmascript::ExceptionType::TypeError, "Path must be a string", gc.nogc(), ) diff --git a/crates/runtime/src/ext/web/mod.rs b/crates/runtime/src/ext/web/mod.rs index 7fe0272..0c5f4a8 100644 --- a/crates/runtime/src/ext/web/mod.rs +++ b/crates/runtime/src/ext/web/mod.rs @@ -4,12 +4,8 @@ use andromeda_core::{Extension, ExtensionOp}; use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult, agent::ExceptionType}, - types::Value, - }, - engine::context::{Bindable, GcScope, NoGcScope}, + ecmascript::{Agent, ArgumentsList, ExceptionType, JsResult, Value}, + engine::{Bindable, GcScope, NoGcScope}, }; #[cfg(target_os = "linux")] diff --git a/crates/runtime/src/ext/web_locks.rs b/crates/runtime/src/ext/web_locks.rs index ce4eaae..f81dee6 100644 --- a/crates/runtime/src/ext/web_locks.rs +++ b/crates/runtime/src/ext/web_locks.rs @@ -14,15 +14,8 @@ use std::{ use andromeda_core::{Extension, ExtensionOp, HostData, MacroTask, OpsStorage, TaskId}; use nova_vm::{ - ecmascript::{ - builtins::ArgumentsList, - execution::{Agent, JsResult}, - types::{IntoValue, Value}, - }, - engine::{ - Global, - context::{Bindable, GcScope}, - }, + ecmascript::{Agent, ArgumentsList, JsResult, Value}, + engine::{Bindable, GcScope, Global}, }; use crate::RuntimeMacroTask; @@ -155,7 +148,7 @@ impl WebLocksManager { agent: &mut Agent, params: AcquireTaskParams<'gc>, ) -> Result<(), String> { - let promise_global = Global::new(agent, params.promise.into_value().unbind()); + let promise_global = Global::new(agent, params.promise.unbind()); let task = MacroTask::User(RuntimeMacroTask::AcquireLock { promise: promise_global, lock_id: params.lock_id, @@ -492,9 +485,7 @@ impl WebLocksExt { // Validate name (no leading '-') if name.starts_with('-') { - return Ok(Value::from_str(agent, "error:Invalid lock name", gc.nogc()) - .into_value() - .unbind()); + return Ok(Value::from_str(agent, "error:Invalid lock name", gc.nogc()).unbind()); } let mode_str = mode_binding @@ -534,22 +525,14 @@ impl WebLocksExt { match result { Ok(lock_id) => { let lock_id_str = lock_id.to_string(); - Ok(Value::from_str(agent, &lock_id_str, gc.nogc()) - .into_value() - .unbind()) + Ok(Value::from_str(agent, &lock_id_str, gc.nogc()).unbind()) } Err(error) => { // Return "not_available" for ifAvailable failures if error.contains("ifAvailable") { - Ok(Value::from_str(agent, "not_available", gc.nogc()) - .into_value() - .unbind()) + Ok(Value::from_str(agent, "not_available", gc.nogc()).unbind()) } else { - Ok( - Value::from_str(agent, &format!("error:{}", error), gc.nogc()) - .into_value() - .unbind(), - ) + Ok(Value::from_str(agent, &format!("error:{}", error), gc.nogc()).unbind()) } } } @@ -587,14 +570,10 @@ impl WebLocksExt { let result = manager.release_lock_with_tx(name, lock_id, macro_task_tx); match result { - Ok(()) => Ok(Value::from_str(agent, "released", gc.nogc()) - .into_value() - .unbind()), - Err(error) => Ok( - Value::from_str(agent, &format!("error:{}", error), gc.nogc()) - .into_value() - .unbind(), - ), + Ok(()) => Ok(Value::from_str(agent, "released", gc.nogc()).unbind()), + Err(error) => { + Ok(Value::from_str(agent, &format!("error:{}", error), gc.nogc()).unbind()) + } } } @@ -616,9 +595,7 @@ impl WebLocksExt { resources.manager.query_locks() }; - Ok(Value::from_str(agent, &result_json, gc.nogc()) - .into_value() - .unbind()) + Ok(Value::from_str(agent, &result_json, gc.nogc()).unbind()) } // Abort a lock request: internal_locks_abort(name, lockId) @@ -654,14 +631,10 @@ impl WebLocksExt { let result = manager.abort_request_with_tx(name, lock_id, macro_task_tx); match result { - Ok(()) => Ok(Value::from_str(agent, "aborted", gc.nogc()) - .into_value() - .unbind()), - Err(error) => Ok( - Value::from_str(agent, &format!("error:{}", error), gc.nogc()) - .into_value() - .unbind(), - ), + Ok(()) => Ok(Value::from_str(agent, "aborted", gc.nogc()).unbind()), + Err(error) => { + Ok(Value::from_str(agent, &format!("error:{}", error), gc.nogc()).unbind()) + } } } } diff --git a/crates/runtime/src/recommended.rs b/crates/runtime/src/recommended.rs index a4a08b5..93720b8 100644 --- a/crates/runtime/src/recommended.rs +++ b/crates/runtime/src/recommended.rs @@ -4,12 +4,8 @@ use andromeda_core::{Extension, HostData}; use nova_vm::{ - ecmascript::{ - builtins::promise_objects::promise_abstract_operations::promise_capability_records::PromiseCapability, - execution::agent::{GcAgent, RealmRoot}, - types::{IntoValue, String as NovaString, Value}, - }, - engine::{Global, context::Bindable}, + ecmascript::{GcAgent, PromiseCapability, RealmRoot, String as NovaString, Value}, + engine::{Bindable, Global}, }; use crate::{ @@ -93,7 +89,7 @@ pub fn recommended_eventloop_handler( let promise_capability = PromiseCapability::from_promise(promise, false); promise_capability.resolve(agent, resolve_value, gc.reborrow()); } else { - panic!("Attempted to resolve a non-promise value"); + eprintln!("ResolvePromiseWithValue: expected a Promise, got {promise_value:?}"); } }); } @@ -103,9 +99,9 @@ pub fn recommended_eventloop_handler( if let Value::Promise(promise) = value { let promise_capability = PromiseCapability::from_promise(promise, false); let error_val = NovaString::from_str(agent, &error_message, gc.nogc()); - promise_capability.reject(agent, error_val.into_value(), gc.nogc()); + promise_capability.reject(agent, Value::from(error_val), gc.nogc()); } else { - panic!("Attempted to reject a non-promise value"); + eprintln!("RejectPromise: expected a Promise, got {value:?}"); } }); } @@ -114,7 +110,7 @@ pub fn recommended_eventloop_handler( let string_global = agent .run_in_realm(realm_root, |agent, gc| { let string_val = Value::from_string(agent, string_value, gc.nogc()); - Some(Global::new(agent, string_val.into_value().unbind())) + Some(Global::new(agent, string_val.unbind())) }) .unwrap(); @@ -126,7 +122,9 @@ pub fn recommended_eventloop_handler( let promise_capability = PromiseCapability::from_promise(promise, false); promise_capability.resolve(agent, string_value, gc); } else { - panic!("Attempted to resolve a non-promise value"); + eprintln!( + "ResolvePromiseWithString: expected a Promise, got {promise_value:?}" + ); } }); } @@ -139,7 +137,7 @@ pub fn recommended_eventloop_handler( write!(&mut hex_content, "{b:02x}").unwrap(); } let string_val = Value::from_string(agent, hex_content, gc.nogc()); - Some(Global::new(agent, string_val.into_value().unbind())) + Some(Global::new(agent, string_val.unbind())) }) .unwrap(); @@ -150,7 +148,7 @@ pub fn recommended_eventloop_handler( let promise_capability = PromiseCapability::from_promise(promise, false); promise_capability.resolve(agent, string_value, gc); } else { - panic!("Attempted to resolve a non-promise value"); + eprintln!("ResolvePromiseWithBytes: expected a Promise, got {promise_value:?}"); } }); } @@ -173,7 +171,7 @@ pub fn recommended_eventloop_handler( .run_in_realm(realm_root, |agent, gc| { let rid_str = rid.index().to_string(); let string_val = Value::from_string(agent, rid_str, gc.nogc()); - Some(Global::new(agent, string_val.into_value().unbind())) + Some(Global::new(agent, string_val.unbind())) }) .unwrap(); @@ -184,7 +182,7 @@ pub fn recommended_eventloop_handler( let promise_capability = PromiseCapability::from_promise(promise, false); promise_capability.resolve(agent, string_value, gc); } else { - panic!("Attempted to resolve a non-promise value"); + eprintln!("RegisterTlsStream: expected a Promise, got {promise_value:?}"); } }); } @@ -203,7 +201,7 @@ pub fn recommended_eventloop_handler( let string_global = agent .run_in_realm(realm_root, |agent, gc| { let string_val = Value::from_string(agent, lock_info, gc.nogc()); - Some(Global::new(agent, string_val.into_value().unbind())) + Some(Global::new(agent, string_val.unbind())) }) .unwrap(); @@ -215,7 +213,7 @@ pub fn recommended_eventloop_handler( let promise_capability = PromiseCapability::from_promise(promise_obj, false); promise_capability.resolve(agent, string_value, gc); } else { - panic!("Attempted to resolve a non-promise value in AcquireLock"); + eprintln!("AcquireLock: expected a Promise, got {promise_value:?}"); } }); }