diff --git a/.github/actions/clone-crates/action.yml b/.github/actions/clone-crates/action.yml index ead05a6..fdc6647 100644 --- a/.github/actions/clone-crates/action.yml +++ b/.github/actions/clone-crates/action.yml @@ -12,7 +12,7 @@ inputs: required: false type: string ref: - default: 'v0.5.3' + default: 'v0.5.4' required: false type: string temp: diff --git a/Cargo.lock b/Cargo.lock index 0ba3136..50f00f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -180,9 +180,9 @@ dependencies = [ [[package]] name = "async-scoped" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb5d44cd33a5095cf47aa2a90455ea3f9141f45e24d092425fef2bf4fd9c98e" +checksum = "4042078ea593edffc452eef14e99fdb2b120caa4ad9618bcdeabc4a023b98740" dependencies = [ "futures", "pin-project", @@ -330,7 +330,7 @@ dependencies = [ "rspack_plugin_remove_empty_chunks", "rspack_plugin_runtime", "rspack_plugin_schemes", - "rspack_plugin_split_chunks_new", + "rspack_plugin_split_chunks", "rspack_plugin_swc_css_minimizer", "rspack_plugin_swc_js_minimizer", "rspack_plugin_warn_sensitive_module", @@ -789,10 +789,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.2", + "hashbrown 0.14.3", "lock_api", "once_cell", - "parking_lot_core 0.9.9", + "parking_lot_core", ] [[package]] @@ -994,6 +994,19 @@ dependencies = [ "futures-sink", ] +[[package]] +name = "futures-concurrency" +version = "7.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef6712e11cdeed5c8cf21ea0b90fec40fbe64afc9bbf2339356197eeca829fc3" +dependencies = [ + "bitvec", + "futures-core", + "pin-project", + "slab", + "smallvec", +] + [[package]] name = "futures-core" version = "0.3.30" @@ -1150,9 +1163,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ "ahash 0.8.6", "allocator-api2", @@ -1164,7 +1177,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "692eaaf7f7607518dd3cef090f1474b61edc5301d8012f09579920df68b725ee" dependencies = [ - "hashbrown 0.14.2", + "hashbrown 0.14.3", ] [[package]] @@ -1280,12 +1293,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown 0.14.3", "rayon", "serde", ] @@ -1566,7 +1579,7 @@ dependencies = [ "anyhow", "async-trait", "either", - "indexmap 2.1.0", + "indexmap 2.2.2", "lazy_static", "once_cell", "regex", @@ -1767,9 +1780,9 @@ dependencies = [ [[package]] name = "napi" -version = "2.14.4" +version = "2.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "902495f6b80f53f8435aefbbd2241c9c675fa239cd7e5f8e28fb57f3b69ecd09" +checksum = "efbf98e1bcb85cc441bbf7cdfb11070d2537a100e2697d75397b2584c32492d1" dependencies = [ "anyhow", "bitflags 2.4.2", @@ -1790,9 +1803,9 @@ checksum = "d4b4532cf86bfef556348ac65e561e3123879f0e7566cca6d43a6ff5326f13df" [[package]] name = "napi-derive" -version = "2.14.6" +version = "2.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e61bec1ee990ae3e9a5f443484c65fb38e571a898437f0ad283ed69c82fc59c0" +checksum = "7622f0dbe0968af2dacdd64870eee6dee94f93c989c841f1ad8f300cf1abd514" dependencies = [ "cfg-if", "convert_case", @@ -1850,6 +1863,7 @@ dependencies = [ "rspack_core", "rspack_error", "rspack_fs_node", + "rspack_hook", "rspack_napi_shared", "rspack_tracing", "testing_macros", @@ -1980,7 +1994,7 @@ checksum = "cee5ab0cc7527aa402272a810615b9412985529a6124504fab03da76c7882f60" dependencies = [ "dashmap", "dunce", - "indexmap 2.1.0", + "indexmap 2.2.2", "json-strip-comments", "once_cell", "rustc-hash", @@ -1990,17 +2004,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -2008,21 +2011,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.9", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] @@ -2033,7 +2022,7 @@ checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall", "smallvec", "windows-targets 0.48.5", ] @@ -2120,7 +2109,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.1.0", + "indexmap 2.2.2", "serde", "serde_derive", ] @@ -2461,15 +2450,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -2525,11 +2505,11 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "regress" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ed9969cad8051328011596bf549629f1b800cf1731e7964b1eef8dfc480d2c2" +checksum = "4f5f39ba4513916c1b2657b72af6ec671f091cd637992f58d0ede5cae4e5dea0" dependencies = [ - "hashbrown 0.13.2", + "hashbrown 0.14.3", "memchr", ] @@ -2607,7 +2587,7 @@ dependencies = [ "testing_macros", "tikv-jemallocator", "tokio", - "ustr", + "ustr-fxhash", "xshell", ] @@ -2686,7 +2666,7 @@ dependencies = [ "rspack_plugin_remove_empty_chunks", "rspack_plugin_runtime", "rspack_plugin_schemes", - "rspack_plugin_split_chunks_new", + "rspack_plugin_split_chunks", "rspack_plugin_swc_css_minimizer", "rspack_plugin_swc_js_minimizer", "rspack_plugin_warn_sensitive_module", @@ -2737,7 +2717,7 @@ dependencies = [ "glob-match", "hashlink", "hex", - "indexmap 2.1.0", + "indexmap 2.2.2", "itertools 0.12.1", "json", "mime_guess", @@ -2756,6 +2736,7 @@ dependencies = [ "rspack_fs", "rspack_futures", "rspack_hash", + "rspack_hook", "rspack_identifier", "rspack_loader_runner", "rspack_regex", @@ -2771,7 +2752,7 @@ dependencies = [ "tokio", "tracing", "url", - "ustr", + "ustr-fxhash", ] [[package]] @@ -2847,13 +2828,23 @@ dependencies = [ "xxhash-rust", ] +[[package]] +name = "rspack_hook" +version = "0.1.0" +dependencies = [ + "async-trait", + "futures-concurrency", + "rspack_error", + "rustc-hash", +] + [[package]] name = "rspack_identifier" version = "0.1.0" dependencies = [ "hashlink", "serde", - "ustr", + "ustr-fxhash", ] [[package]] @@ -2909,7 +2900,7 @@ dependencies = [ "async-trait", "dashmap", "either", - "indexmap 2.1.0", + "indexmap 2.2.2", "jsonc-parser 0.23.0", "once_cell", "rspack_ast", @@ -2955,6 +2946,7 @@ dependencies = [ "rspack_core", "rspack_error", "rspack_fs_node", + "rspack_hook", "rspack_napi_shared", "rspack_tracing", "testing_macros", @@ -3033,6 +3025,7 @@ dependencies = [ "rspack_core", "rspack_error", "rspack_hash", + "rspack_hook", "rspack_identifier", "rspack_plugin_runtime", "rspack_testing", @@ -3081,6 +3074,8 @@ version = "0.1.0" dependencies = [ "async-trait", "rspack_core", + "rspack_error", + "rspack_hook", ] [[package]] @@ -3102,6 +3097,7 @@ dependencies = [ "rspack_core", "rspack_error", "rspack_hash", + "rspack_hook", "rspack_identifier", "rspack_util", "rustc-hash", @@ -3139,7 +3135,8 @@ version = "0.1.0" dependencies = [ "async-trait", "bitflags 2.4.2", - "indexmap 2.1.0", + "dashmap", + "indexmap 2.2.2", "itertools 0.12.1", "linked_hash_set", "num-bigint", @@ -3150,6 +3147,7 @@ dependencies = [ "rspack_core", "rspack_error", "rspack_hash", + "rspack_hook", "rspack_identifier", "rspack_ids", "rspack_regex", @@ -3219,6 +3217,7 @@ dependencies = [ "rspack_core", "rspack_error", "rspack_hash", + "rspack_hook", "rspack_identifier", "rspack_loader_runner", "rspack_util", @@ -3237,6 +3236,7 @@ dependencies = [ "linked-hash-map", "rspack_core", "rspack_error", + "rspack_hook", ] [[package]] @@ -3245,7 +3245,7 @@ version = "0.1.0" dependencies = [ "async-trait", "derivative", - "indexmap 2.1.0", + "indexmap 2.2.2", "once_cell", "rayon", "regex", @@ -3267,7 +3267,7 @@ name = "rspack_plugin_runtime" version = "0.1.0" dependencies = [ "async-trait", - "indexmap 2.1.0", + "indexmap 2.2.2", "itertools 0.12.1", "once_cell", "regex", @@ -3296,7 +3296,7 @@ dependencies = [ ] [[package]] -name = "rspack_plugin_split_chunks_new" +name = "rspack_plugin_split_chunks" version = "0.1.0" dependencies = [ "async-trait", @@ -3358,10 +3358,11 @@ version = "0.1.0" dependencies = [ "async-trait", "dashmap", - "indexmap 2.1.0", + "indexmap 2.2.2", "rayon", "rspack_core", "rspack_error", + "rspack_hook", "rspack_identifier", "rspack_testing", "rspack_util", @@ -3384,6 +3385,8 @@ version = "0.1.0" dependencies = [ "async-trait", "rspack_core", + "rspack_error", + "rspack_hook", ] [[package]] @@ -3398,15 +3401,13 @@ dependencies = [ [[package]] name = "rspack_sources" -version = "0.2.7" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a741e3d5c1b73996bad4beeefb8aa0bbffad40ba4f0c4b09080265c11bd7bd" +checksum = "a9719e80a305624d27b790f0734c72365152d35b0c700cc985c1d110e7452c1d" dependencies = [ "dashmap", "dyn-clone", "memchr", - "once_cell", - "parking_lot 0.12.1", "rustc-hash", "serde", "serde_json", @@ -3617,18 +3618,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", @@ -3648,11 +3649,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.2", "itoa", "ryu", "serde", @@ -3732,9 +3733,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smartstring" @@ -3833,7 +3834,7 @@ checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" dependencies = [ "new_debug_unreachable", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "phf_shared 0.10.0", "precomputed-hash", "serde", @@ -3871,9 +3872,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "styled_components" -version = "0.91.0" +version = "0.96.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70839c116ea418685475d63254fbbbfa84805a29be9643bd4c0ff853df933165" +checksum = "1a0db141a50acf297a815bcd1fe9d958ef56c19aeb36bd12182a7e72567ee499" dependencies = [ "Inflector", "once_cell", @@ -3963,19 +3964,19 @@ dependencies = [ [[package]] name = "swc" -version = "0.270.20" +version = "0.272.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df31dd9488814df8b8c2e0ed34d24c21a3622efb14f6babd29d9f7ff1e9ddf34" +checksum = "5267f891db67d4627443f038918e124937709bff5a98be29376441d79452d6af" dependencies = [ "anyhow", "base64 0.21.5", "dashmap", "either", - "indexmap 2.1.0", + "indexmap 2.2.2", "jsonc-parser 0.21.1", "lru", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "pathdiff", "regex", "rustc-hash", @@ -4023,9 +4024,9 @@ dependencies = [ [[package]] name = "swc_cached" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b357b80879f6c4f4f34879d02eeae63aafc7730293e6eda3686f990d160486" +checksum = "630c761c74ac8021490b78578cc2223aa4a568241e26505c27bf0e4fd4ad8ec2" dependencies = [ "ahash 0.8.6", "anyhow", @@ -4047,9 +4048,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.33.12" +version = "0.33.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b3ae36feceded27f0178dc9dabb49399830847ffb7f866af01798844de8f973" +checksum = "0a15b8a5ec7b3c87b5c602dec00caf3dbb07fe2daaaa1d144d0c00a612e0890c" dependencies = [ "ahash 0.8.6", "ast_node", @@ -4061,7 +4062,7 @@ dependencies = [ "new_debug_unreachable", "num-bigint", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "rustc-hash", "serde", "siphasher", @@ -4088,12 +4089,13 @@ dependencies = [ [[package]] name = "swc_compiler_base" -version = "0.4.18" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48f2ef1d6ccbeb79c4fdce7abfc12194e291bf202fa61ab02c245b9a2811fb67" +checksum = "b9cc48094639d199f8c915b96e52b343aee82cf57f5c628431d2ffe7614daf9b" dependencies = [ "anyhow", "base64 0.21.5", + "once_cell", "pathdiff", "serde", "sourcemap", @@ -4110,13 +4112,16 @@ dependencies = [ [[package]] name = "swc_config" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112884e66b60e614c0f416138b91b8b82b7fea6ed0ecc5e26bad4726c57a6c99" +checksum = "c29e3b76a63111ef318f161bc413dfc093f21da1afca9ba5cdd6442b7069d65b" dependencies = [ - "indexmap 2.1.0", + "anyhow", + "indexmap 2.2.2", "serde", "serde_json", + "sourcemap", + "swc_cached", "swc_config_macro", ] @@ -4134,9 +4139,9 @@ dependencies = [ [[package]] name = "swc_core" -version = "0.87.21" +version = "0.89.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f71409708fe30c531a1447cc7d339f53d76b0b7235b2b9e3cc070882a15a55b0" +checksum = "a0d3b3ef135a76e7476cfd0af40eacad54e3a743f446a79eba60507bb72a9d34" dependencies = [ "swc", "swc_atoms", @@ -4170,9 +4175,9 @@ dependencies = [ [[package]] name = "swc_css_ast" -version = "0.140.14" +version = "0.140.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eb09e34d7a6e1869897b4aa884c739c5f5320aea00b35b589d2e4391e47868" +checksum = "8abb5eeaa51dbd33fc8774109a754381443a473f917242880f6d9d29e19c64a9" dependencies = [ "is-macro", "string_enum", @@ -4182,9 +4187,9 @@ dependencies = [ [[package]] name = "swc_css_codegen" -version = "0.151.23" +version = "0.151.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d292d3dbf611b6be21980919f8896852af40bbb0d430d6008f4283685137e64" +checksum = "dfb51078c9b11a548adc73bf8fd00055a2d5da498039e7f918bd4e6a28b1a794" dependencies = [ "auto_impl", "bitflags 2.4.2", @@ -4211,9 +4216,9 @@ dependencies = [ [[package]] name = "swc_css_compat" -version = "0.27.24" +version = "0.27.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a544c80e5b481dab958e4bdd1286349b7583b1412e53993fbcf1aeb83d0e585e" +checksum = "a1d1878067abcc8d9e003f13f3bbe6b764f88634558bb39aabc166995c2c9125" dependencies = [ "bitflags 2.4.2", "once_cell", @@ -4228,9 +4233,9 @@ dependencies = [ [[package]] name = "swc_css_minifier" -version = "0.116.24" +version = "0.116.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9807dea905a6c4696076ff642e507ecaf63e624ef20c55a303017d3e6f301e9" +checksum = "95d746604b670a09533ddd5cc742bf4812fdaf5e5e3312e7249841444d7e43b9" dependencies = [ "serde", "swc_atoms", @@ -4242,9 +4247,9 @@ dependencies = [ [[package]] name = "swc_css_modules" -version = "0.29.26" +version = "0.29.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caceeba805e5123dbbe9f4210bb28644ea026bdd7a6f407046c7b3c941573332" +checksum = "0ee4c630bc0ac6032d48ff95db52fb78cef6a8972d6d5fe9d6759a7f8fffdcb0" dependencies = [ "rustc-hash", "serde", @@ -4258,9 +4263,9 @@ dependencies = [ [[package]] name = "swc_css_parser" -version = "0.150.22" +version = "0.150.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8221a52f2f50cd23c6b70fa024f4ef21a3dd737a67965292fdac49f391036" +checksum = "6bff09ddfccb7a69828c0a76a85083f18c09ff8f8cd15f52719d3bddd5719441" dependencies = [ "lexical", "serde", @@ -4271,9 +4276,9 @@ dependencies = [ [[package]] name = "swc_css_prefixer" -version = "0.153.25" +version = "0.153.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74adc2822de64d5215ad253ce360dc39f99686dbb46840b6ae374aad69133cfa" +checksum = "fb331d260e643e00afc2a463f4918f7057c6c8006b9401b50b92d963f265762b" dependencies = [ "once_cell", "preset_env_base", @@ -4288,9 +4293,9 @@ dependencies = [ [[package]] name = "swc_css_utils" -version = "0.137.14" +version = "0.137.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426952c65332d750820cc4cb2b8e21955d6315c57b30939e43def2c48f36c55f" +checksum = "211e38d51bc37b25db5f4f2efca24541d86783b40d3ec9bea1c2f025282dcd25" dependencies = [ "once_cell", "serde", @@ -4303,9 +4308,9 @@ dependencies = [ [[package]] name = "swc_css_visit" -version = "0.139.14" +version = "0.139.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0653b91d85ef5415bfd7b205d03d7a4772ec8e324c980873523294bc2e827717" +checksum = "2a861f8d89bfaf930855169880245d6d795ef838de4218ec022ccf6be22b1240" dependencies = [ "serde", "swc_atoms", @@ -4316,9 +4321,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.110.17" +version = "0.111.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79401a45da704f4fb2552c5bf86ee2198e8636b121cb81f8036848a300edd53b" +checksum = "e12b4d0f3b31d293dac16fc13a50f8a282a3bdb658f2a000ffe09b1b638f45c9" dependencies = [ "bitflags 2.4.2", "is-macro", @@ -4334,9 +4339,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.146.54" +version = "0.147.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b61ca275e3663238b71c4b5da8e6fb745bde9989ef37d94984dfc81fc6d009" +checksum = "7739068b0183472199afc0df2aedaa154edc719dbd508ee450ce53844cd359c0" dependencies = [ "memchr", "num-bigint", @@ -4365,9 +4370,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_bugfixes" -version = "0.2.16" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0337067ede6103a274191a20c4de238ded32bb8b3d3e99561ca3e7811e089b21" +checksum = "54d27ff77096b85619fd6b5e6e77ef1db6eda54d25101967f30822dce83b2ee2" dependencies = [ "swc_atoms", "swc_common", @@ -4382,9 +4387,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_common" -version = "0.2.5" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0a57bd134c03dd545263ee41824a8cb06af1553016dccf8ac1ad8cbbb940c3" +checksum = "ebebfc4abb2502a9408ba8a3afaf4523be11d8910ad1e9301fb5992d99ee2513" dependencies = [ "swc_common", "swc_ecma_ast", @@ -4395,12 +4400,12 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2015" -version = "0.2.16" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6912d92bcfc313d7b05d1da0ae8d283bce24baf4e1fd09541acd52f32ab1e32" +checksum = "f45ac5dbfd6c4827c88b65b46bb507a7879a2b4a409c7ec7fdf83db802204849" dependencies = [ "arrayvec", - "indexmap 2.1.0", + "indexmap 2.2.2", "is-macro", "serde", "serde_derive", @@ -4421,9 +4426,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2016" -version = "0.2.11" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f4824f2bd45b02b70bc85824daa35c9c07477589f008f888748c115d4b0b97" +checksum = "1edab0ae602d9f74c86dbf1c091ffbfcc46f02383b676ea44532facde5a39974" dependencies = [ "swc_atoms", "swc_common", @@ -4438,9 +4443,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2017" -version = "0.2.12" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85bcb454c2d69e38777fd739864938fbc18ed45b6ee4dd314b9fc0a463a63c1" +checksum = "7651b5a5720e3ae1af3644ed8b975bee44bfaab19fb3b1672468c8c152ba7af6" dependencies = [ "serde", "swc_atoms", @@ -4456,9 +4461,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2018" -version = "0.2.13" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d47d63860994814c49e8ad5996d182d1d7804e96d6f7bdab0bf1282716d9884" +checksum = "72203cdb4252e9d03e521521fc0f3195223ded9cb30a44cbf499662fa004ed22" dependencies = [ "serde", "swc_atoms", @@ -4475,9 +4480,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2019" -version = "0.2.12" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f20b2d70b26e48926bba3b7629b6bc10de724a8f076fdf4eb9267fe12a1db17b" +checksum = "2c26575b0b710c7712aa69f1947e6712dd034feefa1af31c27bc684d66e3f0a7" dependencies = [ "swc_atoms", "swc_common", @@ -4491,9 +4496,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2020" -version = "0.2.13" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "973a0bca6c9e85869d62b38937b80e13ee5e105df4eb18576177c4ebb41e5bb9" +checksum = "ec11ebb0f2696bf3384c9e2e9d42f2341f568ec2900e1313e1c1ab3fd71062ea" dependencies = [ "serde", "swc_atoms", @@ -4509,9 +4514,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2021" -version = "0.2.11" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a33089b3b121acadc052ca636905c1dd465db3cc94fa456c26eacc65d5074db" +checksum = "cb49936d8e957a30d6fb88316af5e3be43acd1933341fb774da80f780b06f61d" dependencies = [ "swc_atoms", "swc_common", @@ -4525,9 +4530,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2022" -version = "0.2.12" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe2a334c1ed213b0a58adb09518c63c63229afad705e5ab027e2fd0f3ff20bd" +checksum = "17878b07c59b1f771f4688f196433239e057909436d99c1b2812004c4919ea25" dependencies = [ "swc_atoms", "swc_common", @@ -4544,9 +4549,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es3" -version = "0.2.11" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce5624a8b906965af30484a0b8e2ed9b0d68675a1b8bdba6a242882f38e3270e" +checksum = "0be846ed12bc1e1732c588b1ed172c2b6b8613a0038ff4660c6003fc43c38abd" dependencies = [ "swc_common", "swc_ecma_ast", @@ -4559,9 +4564,9 @@ dependencies = [ [[package]] name = "swc_ecma_ext_transforms" -version = "0.111.4" +version = "0.112.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e728d14119048a95e023c3c5c0ad5ddddb1f405bfef3bd55f81dc5fc3c9e95a" +checksum = "896d23feb20b3cdd76f016f5049f654849f72830b8ef5af981e3d0e349deb463" dependencies = [ "phf", "swc_atoms", @@ -4573,13 +4578,13 @@ dependencies = [ [[package]] name = "swc_ecma_lints" -version = "0.90.10" +version = "0.91.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5afe579c82fe80a24e8c815fa19e7f1126c8114db0985f211c985d5b4db4137e" +checksum = "4301d29d5b404e127488574ef3e6be22bffcf107f9e7fdd6454b44a774edc0b4" dependencies = [ "auto_impl", "dashmap", - "parking_lot 0.12.1", + "parking_lot", "rayon", "regex", "serde", @@ -4593,20 +4598,21 @@ dependencies = [ [[package]] name = "swc_ecma_loader" -version = "0.45.13" +version = "0.45.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5713ab3429530c10bdf167170ebbde75b046c8003558459e4de5aaec62ce0f1" +checksum = "5e93c1c8c3206ffcbd110b2fe95993c6df36a9668aeb5126480af8767168e67c" dependencies = [ "anyhow", "dashmap", "lru", "normpath", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "path-clean 0.1.0", "pathdiff", "serde", "serde_json", + "swc_atoms", "swc_cached", "swc_common", "tracing", @@ -4614,16 +4620,16 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.190.17" +version = "0.191.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35dae1f624247350378a02bbbbe408844e6ebfe8b8cd4558d9544f55b5a47b2d" +checksum = "609547ba63c64b609984f2089a436e2f94488c3751f8496c42940ce4992efd4b" dependencies = [ "arrayvec", - "indexmap 2.1.0", + "indexmap 2.2.2", "num-bigint", "num_cpus", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "radix_fmt", "rayon", "regex", @@ -4632,7 +4638,6 @@ dependencies = [ "serde", "serde_json", "swc_atoms", - "swc_cached", "swc_common", "swc_config", "swc_ecma_ast", @@ -4649,9 +4654,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "0.141.37" +version = "0.142.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d17401dd95048a6a62b777d533c0999dabdd531ef9d667e22f8ae2a2a0d294" +checksum = "2048574683e3847ecb360dd6ac603ba3c68331254a545eaf927f56f6aeeea205" dependencies = [ "either", "new_debug_unreachable", @@ -4671,13 +4676,13 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.204.19" +version = "0.205.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25c04f9800e67c97938a60f3c90f9455ba1984abe169ba70b1776428dcc6ee25" +checksum = "dbb783c8a9142b6b17d5cc68509e7df2abf0c267a3fa006f49b896ad22894015" dependencies = [ "anyhow", "dashmap", - "indexmap 2.1.0", + "indexmap 2.2.2", "once_cell", "preset_env_base", "rustc-hash", @@ -4696,9 +4701,9 @@ dependencies = [ [[package]] name = "swc_ecma_quote_macros" -version = "0.52.37" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2bd72fda3eb232e08ac6ce9766edb59791dab5f588377c151a1da6c1862b734" +checksum = "1cda9878986be57662927e89b0c973d8e225e37da219a151197249a2efe78d6d" dependencies = [ "anyhow", "proc-macro2", @@ -4713,9 +4718,9 @@ dependencies = [ [[package]] name = "swc_ecma_testing" -version = "0.22.15" +version = "0.22.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b02a3eafe6cecb8a63618c21edc31dda5baefa829c3e0ffb386da73a5f94d8" +checksum = "8b73fd79980ad3182437a62dc0413bcd00e6157a7fcf5a64a86fa264ec6672ba" dependencies = [ "anyhow", "hex", @@ -4726,9 +4731,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.227.19" +version = "0.228.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91e52749e37685afa9bcb3ad58c945e31b1bf51259c8438c4cc6787366ae3cd" +checksum = "d6f39b4102dfc005919dd9e6df52d39f4674309d70e169c16fd6ecea7cc7bcf7" dependencies = [ "swc_atoms", "swc_common", @@ -4746,13 +4751,13 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.135.11" +version = "0.136.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d4ab26ec124b03e47f54d4daade8e9a9dcd66d3a4ca3cd47045f138d267a60e" +checksum = "f2d2df94f34ce186479508dd94e45799e58cac36a6b1c00c8ff0ba467643fbe9" dependencies = [ "better_scoped_tls", "bitflags 2.4.2", - "indexmap 2.1.0", + "indexmap 2.2.2", "once_cell", "phf", "rayon", @@ -4770,9 +4775,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.124.11" +version = "0.125.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fe4376c024fa04394cafb8faecafb4623722b92dbbe46532258cc0a6b569d9c" +checksum = "8a6f65b2bea8e61a744650f0f05c54eff417adbe826310849f2a34574c4b5e73" dependencies = [ "swc_atoms", "swc_common", @@ -4784,12 +4789,12 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.161.16" +version = "0.162.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46cfe232648c0994922d136d686c0a598c73a30334d92b14ba5a61e768bb4e7" +checksum = "ae086748be4cb4f15c72b8b93871cb80868bcef4cfa49c24d250ff08cc95528b" dependencies = [ "arrayvec", - "indexmap 2.1.0", + "indexmap 2.2.2", "is-macro", "num-bigint", "serde", @@ -4832,14 +4837,14 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.178.18" +version = "0.179.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e51136811754dcbd7400cdd62da7117deabd029c8049a6740cff75934e3f40" +checksum = "076887c8cd4a025aeef27a4a7f4d7aa8c7f500e357271487239501d5cf330b5e" dependencies = [ "Inflector", "anyhow", "bitflags 2.4.2", - "indexmap 2.1.0", + "indexmap 2.2.2", "is-macro", "path-clean 0.1.0", "pathdiff", @@ -4859,12 +4864,12 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.196.18" +version = "0.197.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b7acea7f3306e5b9c3b19abc02f85885309f154901c951c63c3bcef4b0ff82" +checksum = "096d3b4d090910a0797ff034f7319365966b66daea1228ecd5104094abac4985" dependencies = [ "dashmap", - "indexmap 2.1.0", + "indexmap 2.2.2", "once_cell", "petgraph", "rayon", @@ -4884,9 +4889,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.169.16" +version = "0.170.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed89d6ff74f60de490fb56e1cc505b057905e36c13d405d7d61dd5c9f6ee8fc9" +checksum = "2e4a4c173a9726aec6b5c12d8b8c83dbb424821b27ffce6c22d728f1543ac598" dependencies = [ "either", "rustc-hash", @@ -4904,13 +4909,13 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.181.18" +version = "0.182.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e31a2f879fd21d18080b6c42e633e0ae8c6f3d54b83c1de876767d82b458c999" +checksum = "be9b480685775f65c764609691fec8ee9de483dfa08b16d1c400b8ca24490dcf" dependencies = [ "base64 0.21.5", "dashmap", - "indexmap 2.1.0", + "indexmap 2.2.2", "once_cell", "serde", "sha-1", @@ -4928,9 +4933,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_testing" -version = "0.138.11" +version = "0.139.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbff87379f76ecb3d159f6c73e140c7b95d3ee37facfdf4e539e648fe616c95c" +checksum = "fd5341fb6a5fd6844a916ce730b134758e02c2401b56778d5e94c6d7a3e0ce47" dependencies = [ "ansi_term", "anyhow", @@ -4954,9 +4959,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.186.18" +version = "0.187.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6460d1e6a9ffade4b89b15fa38944fa0f7da877d7e79aa69e9f9c6a83a23b031" +checksum = "5a4e759a735b940bf525b9f5180853c3d783c8681d2fb22ba142ea1b56aabc65" dependencies = [ "ryu-js", "serde", @@ -4971,11 +4976,11 @@ dependencies = [ [[package]] name = "swc_ecma_usage_analyzer" -version = "0.21.5" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf6ae5dd022ac6f39034896dd94eaeb590bf1fc6ab6e4f302fc9cdd8569e9b7" +checksum = "0b9ef3fcbb56dd3b2e0eb7748e91e4b4041a4d24f4fcc917006e0ffa0f0fee4b" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.2", "rustc-hash", "swc_atoms", "swc_common", @@ -4988,11 +4993,11 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.125.4" +version = "0.126.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cead1083e46b0f072a82938f16d366014468f7510350957765bb4d013496890" +checksum = "759800be567b50371fc5fae245870f8aea5948d7ca1288d8443fa73801abc1b8" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.2", "num_cpus", "once_cell", "rayon", @@ -5007,9 +5012,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.96.17" +version = "0.97.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d0100c383fb08b6f34911ab6f925950416a5d14404c1cd520d59fb8dfbb3bf" +checksum = "26ecefeec816318f1d449b4bac2e28a4243a167cc16620e15c3c1f2d91085770" dependencies = [ "num-bigint", "swc_atoms", @@ -5021,9 +5026,9 @@ dependencies = [ [[package]] name = "swc_emotion" -version = "0.67.0" +version = "0.72.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e429f66f612c42bef6b202419a79ccbe7317a09da00107a56c24dbc3dbaf0d" +checksum = "8b759380eee487f70b74126ed51fae2273fbfa27fb51165a31a61a5ee3890a20" dependencies = [ "base64 0.13.1", "byteorder", @@ -5063,24 +5068,24 @@ dependencies = [ [[package]] name = "swc_error_reporters" -version = "0.17.12" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e00fa7c3009268d8ab2ca69d22ac3c3fe777297215fa128bc0ef42dcdf230ab" +checksum = "be42e786ee9bda3f72f7d7de791e1d7b49ab7f86ed54fdc5808681ae04406080" dependencies = [ "anyhow", "miette 4.7.1", "once_cell", - "parking_lot 0.12.1", + "parking_lot", "swc_common", ] [[package]] name = "swc_fast_graph" -version = "0.21.13" +version = "0.21.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acfc056067a0fbfe26a4763c1eb246e813fdbe6b376415d07915e96e15481b6" +checksum = "06cc80877ed5595b496b7cce938483be24cfa6c358b8d17aff789961c31104a9" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.2.2", "petgraph", "rustc-hash", "swc_common", @@ -5088,9 +5093,9 @@ dependencies = [ [[package]] name = "swc_html" -version = "0.135.20" +version = "0.136.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e177a34d7260d8bd440fe3458eb656b68b90e14de06b50b8d2a685fd8f1f1" +checksum = "44a4bd6924f713c1534a191109b1072b02779878243371d176ba8b7441373027" dependencies = [ "swc_html_ast", "swc_html_codegen", @@ -5100,9 +5105,9 @@ dependencies = [ [[package]] name = "swc_html_ast" -version = "0.33.12" +version = "0.33.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f0686a31d5552ab7f75e7eae284c596c6f715488601989c3691f7817b8d4c8f" +checksum = "0545c78cf690a13f324502eb02edd138021e5cb08b84712c1605e441ecbe004a" dependencies = [ "is-macro", "string_enum", @@ -5112,9 +5117,9 @@ dependencies = [ [[package]] name = "swc_html_codegen" -version = "0.42.17" +version = "0.42.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27c3f2bf9a87df642f7f3df10e4d471f216d955deb28cf053f4f637db9c7d535" +checksum = "7e7102f9a90af97a9aa71a3ad2a9e94ad7defae1fc0132abdf04d7dee609dd44" dependencies = [ "auto_impl", "bitflags 2.4.2", @@ -5140,9 +5145,9 @@ dependencies = [ [[package]] name = "swc_html_minifier" -version = "0.132.20" +version = "0.133.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9770f760f1c6f43abd65d25828b5881ff6ff3dc72816a3bfdeb524078a33fcdd" +checksum = "75a03dfc350ea2e19269d2b6756e028b617ef3d7b94ed4cd257aa2f9f4cc9d96" dependencies = [ "once_cell", "serde", @@ -5169,9 +5174,9 @@ dependencies = [ [[package]] name = "swc_html_parser" -version = "0.39.17" +version = "0.39.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3366eb3d3b955f7bfeb3ddbc19184dd87caaf687c85daac4bde5acf59cfa0413" +checksum = "c47d794f486ac2bcdf1c1f94b73f933013904e416de6f57a67b2b2e038a6637f" dependencies = [ "swc_atoms", "swc_common", @@ -5181,9 +5186,9 @@ dependencies = [ [[package]] name = "swc_html_utils" -version = "0.18.12" +version = "0.18.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bafa26f8a17f398abb71cd7aeeb8e755f8087f276e9594b5120e38e5a596a457" +checksum = "8cf47147292d52e04a3273bdd30ccb3fbd589b3929408bc1832dbc4db73b0969" dependencies = [ "once_cell", "serde", @@ -5194,9 +5199,9 @@ dependencies = [ [[package]] name = "swc_html_visit" -version = "0.33.12" +version = "0.33.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bccbddc3f97355513c881aed62d209e4f46fc455a36a1485fa41dad0132e8b5" +checksum = "e5e411a59cf54fe6b18c5ced408d532bdb5a198f472940e254650726a83b5321" dependencies = [ "serde", "swc_atoms", @@ -5234,9 +5239,9 @@ dependencies = [ [[package]] name = "swc_node_comments" -version = "0.20.12" +version = "0.20.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86a67c8fb9735b17b2cdf7b5dd539dc1625f73d05c794566b98e65be39cee5b1" +checksum = "a8058148241150b482cbe8f690f1005663994dc22c9f8f9a651c7aeca9263f35" dependencies = [ "dashmap", "swc_atoms", @@ -5274,9 +5279,9 @@ dependencies = [ [[package]] name = "swc_timer" -version = "0.21.14" +version = "0.21.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b37010da5874d241c9e11ef020b8e4473f3af4e5d2e19219e92d99c04f12e0c6" +checksum = "9e52754d1060c70b44e6d4d65ebfc7bde9769d5b0e6e8e1e6a4c051980459473" dependencies = [ "tracing", ] @@ -5352,7 +5357,7 @@ checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.4.1", + "redox_syscall", "rustix", "windows-sys 0.52.0", ] @@ -5378,9 +5383,9 @@ dependencies = [ [[package]] name = "testing" -version = "0.35.14" +version = "0.35.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "293dc0c2fc5e51a67cde205832476cf205758168f9966312ea05a97c8fb2230c" +checksum = "42599f638bd2b48c2892cf330862aca433c86286ae776d75c5074ba3b4935ed8" dependencies = [ "ansi_term", "cargo_metadata", @@ -5507,7 +5512,7 @@ checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "tokio-macros", ] @@ -5685,15 +5690,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" [[package]] -name = "ustr" -version = "0.9.0" +name = "ustr-fxhash" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "371436099f2980de56dc385b615696d3eabbdac9649a72b85f9d75f68474fa9c" +checksum = "bbe38ae02de418d12de738120d42d829f9fcc3b98fb203620aab98026611db08" dependencies = [ - "ahash 0.7.7", "byteorder", + "fxhash", "lazy_static", - "parking_lot 0.11.2", + "parking_lot", "serde", ] @@ -5809,12 +5814,12 @@ checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "wasmparser" -version = "0.120.0" +version = "0.121.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9148127f39cbffe43efee8d5442b16ecdba21567785268daa1ec9e134389705" +checksum = "953cf6a7606ab31382cb1caa5ae403e77ba70c7f8e12eeda167e7040d42bfda8" dependencies = [ "bitflags 2.4.2", - "indexmap 2.1.0", + "indexmap 2.2.2", "semver 1.0.20", ] diff --git a/Cargo.toml b/Cargo.toml index 00de340..99c15d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ resolver = "2" [workspace.dependencies] anyhow = { version = "1.0.79", features = ["backtrace"] } async-recursion = { version = "1.0.5" } -async-scoped = { version = "0.8.0" } +async-scoped = { version = "0.9.0" } async-trait = { version = "0.1.77" } backtrace = "0.3" better_scoped_tls = { version = "0.1.1" } @@ -33,9 +33,9 @@ futures = { version = "0.3.30" } futures-util = { version = "0.3.30" } glob = { version = "0.3.1" } hashlink = { version = "0.9.0" } -indexmap = { version = "2.1.0" } +indexmap = { version = "2.2.1" } insta = { version = "1.34.0" } -itertools = { version = "0.12.0" } +itertools = { version = "0.12.1" } json = { version = "0.12.4" } linked_hash_set = { version = "0.1.4" } mimalloc-rust = { version = "0.2" } @@ -50,11 +50,11 @@ quote = { version = "1.0.35" } rayon = { version = "1.8.1" } regex = { version = "1.10.3" } rkyv = { version = "0.7.43" } -rspack_sources = { version = "0.2.7" } +rspack_sources = { version = "=0.2.10" } rustc-hash = { version = "1.1.0" } schemars = { version = "0.8.16" } -serde = { version = "1.0.195" } -serde_json = { version = "1.0.111" } +serde = { version = "1.0.196" } +serde_json = { version = "1.0.113" } similar = { version = "2.4.0" } sugar_path = { version = "0.0.12" } syn = { version = "2.0.48" } @@ -64,28 +64,28 @@ tracing = { version = "0.1.40" } tracing-subscriber = { version = "0.3.18" } url = { version = "2.5.0" } urlencoding = { version = "2.1.3" } -ustr = { version = "0.9.0" } +ustr = { package = "ustr-fxhash", version = "1.0.0" } xxhash-rust = { version = "0.8.8" } # Pinned -napi = { version = "=2.14.4" } +napi = { version = "=2.15.0" } napi-build = { version = "=2.1.0" } -napi-derive = { version = "=2.14.6" } +napi-derive = { version = "=2.15.0" } napi-sys = { version = "=2.3.0" } tikv-jemallocator = { version = "=0.5.4", features = ["disable_initial_exec_tls"] } # Must be pinned with the same swc versions -styled_components = { version = "=0.91.0" } -swc_config = { version = "=0.1.9" } -swc_core = { version = "=0.87.21", default-features = false } -swc_css = { version = "=0.157.29" } -swc_ecma_minifier = { version = "=0.190.17", default-features = false } -swc_emotion = { version = "=0.67.0" } -swc_error_reporters = { version = "=0.17.12" } -swc_html = { version = "=0.135.20" } -swc_html_minifier = { version = "=0.132.20" } -swc_node_comments = { version = "=0.20.12" } -testing = { version = "=0.35.14" } +styled_components = { version = "=0.96.3" } +swc_config = { version = "=0.1.10" } +swc_core = { version = "=0.89.6", default-features = false } +swc_css = { version = "=0.157.32" } +swc_ecma_minifier = { version = "=0.191.7", default-features = false } +swc_emotion = { version = "=0.72.2" } +swc_error_reporters = { version = "=0.17.14" } +swc_html = { version = "=0.136.7" } +swc_html_minifier = { version = "=0.133.7" } +swc_node_comments = { version = "=0.20.14" } +testing = { version = "^0.35.16" } [profile.dev] codegen-units = 16 # debug build will cause runtime panic if codegen-unints is default diff --git a/crates/binding_options/Cargo.toml b/crates/binding_options/Cargo.toml index 09e6e8c..336fc4b 100644 --- a/crates/binding_options/Cargo.toml +++ b/crates/binding_options/Cargo.toml @@ -43,7 +43,7 @@ rspack_plugin_real_content_hash = { path = "../.rspack_crates/rspack_plugi rspack_plugin_remove_empty_chunks = { path = "../.rspack_crates/rspack_plugin_remove_empty_chunks" } rspack_plugin_runtime = { path = "../.rspack_crates/rspack_plugin_runtime" } rspack_plugin_schemes = { path = "../.rspack_crates/rspack_plugin_schemes" } -rspack_plugin_split_chunks_new = { path = "../.rspack_crates/rspack_plugin_split_chunks_new" } +rspack_plugin_split_chunks = { path = "../.rspack_crates/rspack_plugin_split_chunks" } rspack_plugin_swc_css_minimizer = { path = "../.rspack_crates/rspack_plugin_swc_css_minimizer" } rspack_plugin_swc_js_minimizer = { path = "../.rspack_crates/rspack_plugin_swc_js_minimizer" } rspack_plugin_warn_sensitive_module = { path = "../.rspack_crates/rspack_plugin_warn_sensitive_module" } @@ -52,9 +52,9 @@ rspack_plugin_web_worker_template = { path = "../.rspack_crates/rspack_plugi rspack_plugin_worker = { path = "../.rspack_crates/rspack_plugin_worker" } rspack_regex = { path = "../.rspack_crates/rspack_regex" } rspack_swc_visitors = { path = "../.rspack_crates/rspack_swc_visitors" } -loader_compilation = { path = "../loader_compilation" } -loader_barrel = { path = "../loader_barrel" } -plugin_manifest = { path = "../plugin_manifest" } +loader_compilation = { path = "../loader_compilation" } +loader_barrel = { path = "../loader_barrel" } +plugin_manifest = { path = "../plugin_manifest" } rustc-hash = { workspace = true } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } diff --git a/crates/binding_options/src/options/mod.rs b/crates/binding_options/src/options/mod.rs index b6dacbc..d2375ba 100644 --- a/crates/binding_options/src/options/mod.rs +++ b/crates/binding_options/src/options/mod.rs @@ -86,7 +86,7 @@ impl RSPackRawOptions { if self.features.assets_manifest.unwrap_or_default() { plugins.push(Box::new(plugin_manifest::ManifestPlugin::new())); } - + let mut builtins = self.builtins.apply(plugins)?; if experiments.rspack_future.new_treeshaking { builtins.tree_shaking = TreeShaking::False; diff --git a/crates/binding_options/src/options/raw_features.rs b/crates/binding_options/src/options/raw_features.rs index 2caeefc..219f6e6 100644 --- a/crates/binding_options/src/options/raw_features.rs +++ b/crates/binding_options/src/options/raw_features.rs @@ -6,7 +6,7 @@ use rspack_core::{ SideEffectOption, SourceType, UsedExportsOption, }; use rspack_hash::{HashDigest, HashFunction, RspackHash}; -use rspack_plugin_split_chunks_new::{ +use rspack_plugin_split_chunks::{ CacheGroup, CacheGroupTest, CacheGroupTestFnCtx, ChunkNameGetter, PluginOptions, }; use rspack_regex::RspackRegex; @@ -36,8 +36,8 @@ fn get_modules_size(module: &dyn Module) -> f64 { fn get_plugin_options( strategy: RawStrategyOptions, context: String, -) -> rspack_plugin_split_chunks_new::PluginOptions { - use rspack_plugin_split_chunks_new::SplitChunkSizes; +) -> rspack_plugin_split_chunks::PluginOptions { + use rspack_plugin_split_chunks::SplitChunkSizes; let default_size_types = [SourceType::JavaScript, SourceType::Unknown]; let create_sizes = |size: Option| { size @@ -50,7 +50,7 @@ fn get_plugin_options( CacheGroup { key: String::from("framework"), name: ChunkNameGetter::String("framework".to_string()), - chunk_filter: rspack_plugin_split_chunks_new::create_all_chunk_filter(), + chunk_filter: rspack_plugin_split_chunks::create_all_chunk_filter(), priority: 40.0, test: CacheGroupTest::Fn(Arc::new(move |ctx: CacheGroupTestFnCtx| -> Option { Some(ctx.module.name_for_condition().map_or(false, |name| { @@ -69,7 +69,7 @@ fn get_plugin_options( max_async_size: SplitChunkSizes::empty(), max_initial_size: SplitChunkSizes::empty(), id_hint: String::from("framework"), - r#type: rspack_plugin_split_chunks_new::create_default_module_type_filter(), + r#type: rspack_plugin_split_chunks::create_default_module_type_filter(), automatic_name_delimiter: String::from("-"), filename: Some(Filename::from(String::from("framework.js"))), }, @@ -89,7 +89,7 @@ fn get_plugin_options( } Some(hash.digest(&HashDigest::Hex).rendered(8).to_string()) })), - chunk_filter: rspack_plugin_split_chunks_new::create_all_chunk_filter(), + chunk_filter: rspack_plugin_split_chunks::create_all_chunk_filter(), test: CacheGroupTest::Fn(Arc::new(move |ctx| { Some( ctx @@ -108,7 +108,7 @@ fn get_plugin_options( max_async_size: SplitChunkSizes::default(), max_initial_size: SplitChunkSizes::default(), id_hint: String::from("lib"), - r#type: rspack_plugin_split_chunks_new::create_default_module_type_filter(), + r#type: rspack_plugin_split_chunks::create_default_module_type_filter(), automatic_name_delimiter: String::from("-"), filename: Some(Filename::from(String::from("lib-[name].js"))), }, @@ -116,8 +116,8 @@ fn get_plugin_options( PluginOptions { cache_groups, - fallback_cache_group: rspack_plugin_split_chunks_new::FallbackCacheGroup { - chunks_filter: rspack_plugin_split_chunks_new::create_all_chunk_filter(), + fallback_cache_group: rspack_plugin_split_chunks::FallbackCacheGroup { + chunks_filter: rspack_plugin_split_chunks::create_all_chunk_filter(), min_size: SplitChunkSizes::default(), max_async_size: SplitChunkSizes::default(), max_initial_size: SplitChunkSizes::default(), @@ -159,7 +159,7 @@ impl FeatureApply for SplitChunksStrategy { plugins: &mut Vec>, context: String, ) -> Result { - let split_chunks_plugin = rspack_plugin_split_chunks_new::SplitChunksPlugin::new( + let split_chunks_plugin = rspack_plugin_split_chunks::SplitChunksPlugin::new( get_plugin_options(self.strategy, context), ) .boxed(); diff --git a/crates/loader_barrel/tests/fixtures.rs b/crates/loader_barrel/tests/fixtures.rs index d18d1e5..24b9e80 100644 --- a/crates/loader_barrel/tests/fixtures.rs +++ b/crates/loader_barrel/tests/fixtures.rs @@ -2,13 +2,14 @@ use std::{ env, fs, path::{Path, PathBuf}, str::FromStr, - sync::Arc, vec, + sync::Arc, + vec, }; use loader_barrel::{BarrelLoader, LoaderOptions}; use rspack_core::{ - run_loaders, CompilerContext, CompilerOptions, Loader, LoaderRunnerContext, ResourceData, - SideEffectOption, ResolverFactory, PluginDriver, + run_loaders, CompilerContext, CompilerOptions, Loader, LoaderRunnerContext, PluginDriver, + ResolverFactory, ResourceData, SideEffectOption, }; use rspack_util::source_map::SourceMapKind; use swc_core::base::config::Config; @@ -88,13 +89,15 @@ async fn loader_test(actual: impl AsRef, expected: impl AsRef) { profile: false, }; - let (plugin_driver, compiler_options) = - PluginDriver::new(compiler_options, vec![], Arc::new( - ResolverFactory::new( - rspack_core::Resolve { extensions: Some(vec![".js".to_string()]), - ..Default::default() - } - ))); + let (plugin_driver, compiler_options) = PluginDriver::new( + compiler_options, + vec![], + Arc::new(ResolverFactory::new(rspack_core::Resolve { + extensions: Some(vec![".js".to_string()]), + ..Default::default() + })), + &mut Default::default(), + ); let (result, _) = run_loaders( &[Arc::new(BarrelLoader::new(LoaderOptions { @@ -105,12 +108,10 @@ async fn loader_test(actual: impl AsRef, expected: impl AsRef) { &[], CompilerContext { options: Arc::clone(&compiler_options), - resolver_factory: Arc::new( - ResolverFactory::new( - rspack_core::Resolve { extensions: Some(vec![".js".to_string()]), - ..Default::default() - } - )), + resolver_factory: Arc::new(ResolverFactory::new(rspack_core::Resolve { + extensions: Some(vec![".js".to_string()]), + ..Default::default() + })), module: "".into(), module_context: None, module_source_map_kind: SourceMapKind::SourceMap, diff --git a/crates/loader_compilation/src/lib.rs b/crates/loader_compilation/src/lib.rs index ca8d4fb..0d1b04e 100644 --- a/crates/loader_compilation/src/lib.rs +++ b/crates/loader_compilation/src/lib.rs @@ -9,8 +9,8 @@ use rspack_plugin_javascript::{ ast::{self, SourceMapConfig}, TransformOutput, }; -use rspack_util::source_map::SourceMapKind; use rspack_regex::RspackRegex; +use rspack_util::source_map::SourceMapKind; use serde::Deserialize; use swc_config::{config_types::MergingOption, merge::Merge}; use swc_core::{ diff --git a/crates/loader_compilation/tests/fixtures.rs b/crates/loader_compilation/tests/fixtures.rs index 1a84480..f0ee7dc 100644 --- a/crates/loader_compilation/tests/fixtures.rs +++ b/crates/loader_compilation/tests/fixtures.rs @@ -8,11 +8,11 @@ use std::{ use loader_compilation::{CompilationLoader, LoaderOptions}; use rspack_ast::RspackAst; use rspack_core::{ - run_loaders, CompilerContext, CompilerOptions, Loader, LoaderRunnerContext, ResourceData, - SideEffectOption, ResolverFactory, PluginDriver, + run_loaders, CompilerContext, CompilerOptions, Loader, LoaderRunnerContext, PluginDriver, + ResolverFactory, ResourceData, SideEffectOption, }; -use rspack_util::source_map::SourceMapKind; use rspack_plugin_javascript::ast; +use rspack_util::source_map::SourceMapKind; use swc_core::base::config::Config; use swc_core::ecma::ast::EsVersion; @@ -90,13 +90,15 @@ async fn loader_test(actual: impl AsRef, expected: impl AsRef) { profile: false, }; - let (plugin_driver, compiler_options) = - PluginDriver::new(compiler_options, vec![], Arc::new( - ResolverFactory::new( - rspack_core::Resolve { extensions: Some(vec![".js".to_string()]), - ..Default::default() - } - ))); + let (plugin_driver, compiler_options) = PluginDriver::new( + compiler_options, + vec![], + Arc::new(ResolverFactory::new(rspack_core::Resolve { + extensions: Some(vec![".js".to_string()]), + ..Default::default() + })), + &mut Default::default(), + ); let (result, _) = run_loaders( &[Arc::new(CompilationLoader::new(LoaderOptions { swc_options: options, @@ -107,12 +109,10 @@ async fn loader_test(actual: impl AsRef, expected: impl AsRef) { &[], CompilerContext { options: Arc::clone(&compiler_options), - resolver_factory: Arc::new( - ResolverFactory::new( - rspack_core::Resolve { extensions: Some(vec![".js".to_string()]), - ..Default::default() - } - )), + resolver_factory: Arc::new(ResolverFactory::new(rspack_core::Resolve { + extensions: Some(vec![".js".to_string()]), + ..Default::default() + })), module: "".into(), module_context: None, module_source_map_kind: SourceMapKind::SourceMap, diff --git a/crates/node_binding/Cargo.toml b/crates/node_binding/Cargo.toml index db20d3e..21ba605 100644 --- a/crates/node_binding/Cargo.toml +++ b/crates/node_binding/Cargo.toml @@ -14,6 +14,7 @@ rspack_binding_values = { path = "../.rspack_crates/rspack_binding_values" } rspack_core = { path = "../.rspack_crates/rspack_core" } rspack_error = { path = "../.rspack_crates/rspack_error" } rspack_fs_node = { path = "../.rspack_crates/rspack_fs_node" } +rspack_hook = { path = "../.rspack_crates/rspack_hook" } rspack_napi_shared = { path = "../.rspack_crates/rspack_napi_shared" } rspack_tracing = { path = "../.rspack_crates/rspack_tracing" } diff --git a/crates/node_binding/index.d.ts b/crates/node_binding/index.d.ts index 12a9223..519dd1f 100644 --- a/crates/node_binding/index.d.ts +++ b/crates/node_binding/index.d.ts @@ -136,7 +136,6 @@ export interface JsHooks { processAssetsStageAnalyse: (...args: any[]) => any processAssetsStageReport: (...args: any[]) => any afterProcessAssets: (...args: any[]) => any - compilation: (...args: any[]) => any thisCompilation: (...args: any[]) => any emit: (...args: any[]) => any assetEmitted: (...args: any[]) => any @@ -163,6 +162,13 @@ export interface JsHooks { executeModule: (...args: any[]) => any runtimeModule: (...args: any[]) => any } +export const enum JsHookType { + CompilerCompilation = 'CompilerCompilation' +} +export interface JsHook { + type: JsHookType + function: (...args: any[]) => any +} export interface JsModule { context?: string originalSource?: JsCompatSource @@ -585,10 +591,12 @@ export const enum BuiltinPluginName { AssetModulesPlugin = 'AssetModulesPlugin', SourceMapDevToolPlugin = 'SourceMapDevToolPlugin', EvalSourceMapDevToolPlugin = 'EvalSourceMapDevToolPlugin', + EvalDevToolModulePlugin = 'EvalDevToolModulePlugin', SideEffectsFlagPlugin = 'SideEffectsFlagPlugin', FlagDependencyExportsPlugin = 'FlagDependencyExportsPlugin', FlagDependencyUsagePlugin = 'FlagDependencyUsagePlugin', MangleExportsPlugin = 'MangleExportsPlugin', + ModuleConcatenationPlugin = 'ModuleConcatenationPlugin', HttpExternalsRspackPlugin = 'HttpExternalsRspackPlugin', CopyRspackPlugin = 'CopyRspackPlugin', HtmlRspackPlugin = 'HtmlRspackPlugin', @@ -628,17 +636,22 @@ export interface RawModuleFilenameTemplateFnCtx { export interface RawSourceMapDevToolPluginOptions { append?: (false | null) | string | Function columns?: boolean - fallbackModuleFilenameTemplate?: string | Function + fallbackModuleFilenameTemplate?: string | ((info: RawModuleFilenameTemplateFnCtx) => string) fileContext?: string filename?: (false | null) | string module?: boolean - moduleFilenameTemplate?: string | Function + moduleFilenameTemplate?: string | ((info: RawModuleFilenameTemplateFnCtx) => string) namespace?: string noSources?: boolean publicPath?: string sourceRoot?: string test?: (text: string) => boolean } +export interface RawEvalDevToolModulePluginOptions { + namespace?: string + moduleFilenameTemplate?: string | ((info: RawModuleFilenameTemplateFnCtx) => string) + sourceUrlComment?: string +} export interface RawEntryPluginOptions { context: string entry: string @@ -1146,7 +1159,7 @@ export class JsStats { getHash(): string | null } export class Rspack { - constructor(options: RSPackRawOptions, builtinPlugins: Array, jsHooks: JsHooks | undefined | null, outputFilesystem: ThreadsafeNodeFS, jsLoaderRunner: (...args: any[]) => any) + constructor(options: RSPackRawOptions, builtinPlugins: Array, jsHooks: JsHooks, compilerHooks: Array, outputFilesystem: ThreadsafeNodeFS, jsLoaderRunner: (...args: any[]) => any) unsafe_set_disabled_hooks(hooks: Array): void /** * Build with the given option passed to the constructor diff --git a/crates/node_binding/index.js b/crates/node_binding/index.js index 65024f8..913f384 100644 --- a/crates/node_binding/index.js +++ b/crates/node_binding/index.js @@ -252,7 +252,7 @@ if (!nativeBinding) { throw new Error(`Failed to load native binding`) } -const { __chunk_inner_is_only_initial, __chunk_inner_can_be_initial, __chunk_inner_has_runtime, __chunk_inner_get_all_async_chunks, __chunk_inner_get_all_initial_chunks, __chunk_inner_get_all_referenced_chunks, __chunk_graph_inner_get_chunk_modules, __chunk_graph_inner_get_chunk_entry_modules, __chunk_graph_inner_get_chunk_entry_dependent_chunks_iterable, __chunk_graph_inner_get_chunk_modules_iterable_by_source_type, __chunk_group_inner_get_chunk_group, JsCompilation, JsStats, BuiltinPluginName, runBuiltinLoader, Rspack, registerGlobalTrace, cleanupGlobalTrace } = nativeBinding +const { __chunk_inner_is_only_initial, __chunk_inner_can_be_initial, __chunk_inner_has_runtime, __chunk_inner_get_all_async_chunks, __chunk_inner_get_all_initial_chunks, __chunk_inner_get_all_referenced_chunks, __chunk_graph_inner_get_chunk_modules, __chunk_graph_inner_get_chunk_entry_modules, __chunk_graph_inner_get_chunk_entry_dependent_chunks_iterable, __chunk_graph_inner_get_chunk_modules_iterable_by_source_type, __chunk_group_inner_get_chunk_group, JsCompilation, JsHookType, JsStats, BuiltinPluginName, runBuiltinLoader, Rspack, registerGlobalTrace, cleanupGlobalTrace } = nativeBinding module.exports.__chunk_inner_is_only_initial = __chunk_inner_is_only_initial module.exports.__chunk_inner_can_be_initial = __chunk_inner_can_be_initial @@ -266,6 +266,7 @@ module.exports.__chunk_graph_inner_get_chunk_entry_dependent_chunks_iterable = _ module.exports.__chunk_graph_inner_get_chunk_modules_iterable_by_source_type = __chunk_graph_inner_get_chunk_modules_iterable_by_source_type module.exports.__chunk_group_inner_get_chunk_group = __chunk_group_inner_get_chunk_group module.exports.JsCompilation = JsCompilation +module.exports.JsHookType = JsHookType module.exports.JsStats = JsStats module.exports.BuiltinPluginName = BuiltinPluginName module.exports.runBuiltinLoader = runBuiltinLoader diff --git a/crates/node_binding/src/hook.rs b/crates/node_binding/src/hook.rs index 7f9c4b5..7496131 100644 --- a/crates/node_binding/src/hook.rs +++ b/crates/node_binding/src/hook.rs @@ -1,4 +1,4 @@ -use std::sync::{Arc, RwLock}; +use std::sync::RwLock; /// rust support hooks #[derive(PartialEq)] @@ -6,7 +6,6 @@ pub enum Hook { Make, FinishMake, BuildModule, - Compilation, ThisCompilation, ProcessAssetsStageAdditional, ProcessAssetsStagePreProcess, @@ -55,7 +54,6 @@ impl From for Hook { "make" => Hook::Make, "finishMake" => Hook::FinishMake, "buildModule" => Hook::BuildModule, - "compilation" => Hook::Compilation, "thisCompilation" => Hook::ThisCompilation, "processAssetsStageAdditional" => Hook::ProcessAssetsStageAdditional, "processAssetsStagePreProcess" => Hook::ProcessAssetsStagePreProcess, @@ -100,4 +98,17 @@ impl From for Hook { } } -pub type DisabledHooks = Arc>>; +#[derive(Default)] +pub struct DisabledHooks(RwLock>); + +impl DisabledHooks { + pub fn set_disabled_hooks(&self, hooks: Vec) -> napi::Result<()> { + let mut disabled_hooks = self.0.write().expect("failed to write lock"); + *disabled_hooks = hooks.into_iter().map(Into::into).collect::>(); + Ok(()) + } + + pub fn is_hook_disabled(&self, hook: &Hook) -> bool { + self.0.read().expect("").contains(hook) + } +} diff --git a/crates/node_binding/src/lib.rs b/crates/node_binding/src/lib.rs index 11c1682..e341210 100644 --- a/crates/node_binding/src/lib.rs +++ b/crates/node_binding/src/lib.rs @@ -56,7 +56,7 @@ type CompilerId = u32; #[napi(custom_finalize)] pub struct Rspack { id: CompilerId, - disabled_hooks: DisabledHooks, + js_plugin: JsHooksAdapterPlugin, } #[napi] @@ -66,7 +66,8 @@ impl Rspack { env: Env, options: RSPackRawOptions, builtin_plugins: Vec, - js_hooks: Option, + js_hooks: JsHooks, + compiler_hooks: Vec, output_filesystem: ThreadsafeNodeFS, js_loader_runner: JsFunction, ) -> Result { @@ -75,9 +76,9 @@ impl Rspack { let disabled_hooks: DisabledHooks = Default::default(); let mut plugins = Vec::new(); - if let Some(js_hooks) = js_hooks { - plugins.push(JsHooksAdapter::from_js_hooks(env, js_hooks, disabled_hooks.clone())?.boxed()); - } + let js_plugin = + JsHooksAdapterPlugin::from_js_hooks(env, js_hooks, disabled_hooks, compiler_hooks)?; + plugins.push(js_plugin.clone().boxed()); for bp in builtin_plugins { bp.append_to(&mut plugins) .map_err(|e| Error::from_reason(format!("{e}")))?; @@ -102,7 +103,7 @@ impl Rspack { let id = NEXT_COMPILER_ID.fetch_add(1, Ordering::SeqCst); unsafe { COMPILERS.insert_if_vacant(id, Box::pin(rspack)) }?; - Ok(Self { id, disabled_hooks }) + Ok(Self { id, js_plugin }) } #[allow(clippy::unwrap_in_result, clippy::unwrap_used)] @@ -111,9 +112,7 @@ impl Rspack { ts_args_type = "hooks: Array" )] pub fn set_disabled_hooks(&self, _env: Env, hooks: Vec) -> Result<()> { - let mut disabled_hooks = self.disabled_hooks.write().unwrap(); - *disabled_hooks = hooks.into_iter().map(Into::into).collect::>(); - Ok(()) + self.js_plugin.set_disabled_hooks(hooks) } /// Build with the given option passed to the constructor diff --git a/crates/node_binding/src/plugins/mod.rs b/crates/node_binding/src/plugins/mod.rs index 3ddaa73..4515971 100644 --- a/crates/node_binding/src/plugins/mod.rs +++ b/crates/node_binding/src/plugins/mod.rs @@ -1,20 +1,21 @@ mod loader; use std::fmt::Debug; use std::path::PathBuf; +use std::sync::Arc; use async_trait::async_trait; use napi::{Env, Result}; use rspack_binding_macros::js_fn_into_threadsafe_fn; use rspack_binding_values::{ - AfterResolveData, JsChunk, JsChunkAssetArgs, JsModule, JsRuntimeModule, JsRuntimeModuleArg, - ToJsCompatSource, + AfterResolveData, JsChunk, JsChunkAssetArgs, JsHook, JsHookType, JsModule, JsRuntimeModule, + JsRuntimeModuleArg, ToJsCompatSource, }; use rspack_binding_values::{BeforeResolveData, JsAssetEmittedArgs, ToJsModule}; use rspack_binding_values::{CreateModuleData, JsBuildTimeExecutionOption, JsExecuteModuleArg}; use rspack_binding_values::{JsResolveForSchemeInput, JsResolveForSchemeResult}; use rspack_core::{ - BuildTimeExecutionOption, Chunk, ChunkAssetArgs, Compilation, ModuleIdentifier, - NormalModuleAfterResolveArgs, RuntimeModule, + ApplyContext, BuildTimeExecutionOption, Chunk, ChunkAssetArgs, Compilation, CompilationParams, + CompilerOptions, ModuleIdentifier, NormalModuleAfterResolveArgs, PluginContext, RuntimeModule, }; use rspack_core::{NormalModuleBeforeResolveArgs, PluginNormalModuleFactoryAfterResolveOutput}; use rspack_core::{ @@ -22,16 +23,17 @@ use rspack_core::{ PluginNormalModuleFactoryCreateModuleHookOutput, ResourceData, }; use rspack_core::{PluginNormalModuleFactoryResolveForSchemeOutput, PluginShouldEmitHookOutput}; +use rspack_hook::AsyncSeries2; use rspack_napi_shared::threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode}; use rspack_napi_shared::NapiResultExt; pub use self::loader::JsLoaderResolver; use crate::{DisabledHooks, Hook, JsCompilation, JsHooks}; -pub struct JsHooksAdapter { - disabled_hooks: DisabledHooks, +pub struct JsHooksAdapterInner { + pub disabled_hooks: DisabledHooks, pub make_tsfn: ThreadsafeFunction<(), ()>, - pub compilation_tsfn: ThreadsafeFunction, + compiler_compilation_hooks: Vec, pub this_compilation_tsfn: ThreadsafeFunction, pub process_assets_stage_additional_tsfn: ThreadsafeFunction<(), ()>, pub process_assets_stage_pre_process_tsfn: ThreadsafeFunction<(), ()>, @@ -76,40 +78,77 @@ pub struct JsHooksAdapter { pub runtime_module_tsfn: ThreadsafeFunction>, } -impl Debug for JsHooksAdapter { +#[derive(Clone)] +pub struct JsHooksAdapterPlugin { + inner: Arc, +} + +impl Debug for JsHooksAdapterPlugin { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "rspack_plugin_js_hooks_adapter") } } -#[async_trait] -impl rspack_core::Plugin for JsHooksAdapter { - fn name(&self) -> &'static str { - "rspack.JsHooksAdapterPlugin" +// TODO: remove deref +impl std::ops::Deref for JsHooksAdapterPlugin { + type Target = JsHooksAdapterInner; + + fn deref(&self) -> &Self::Target { + &self.inner } +} - async fn compilation( - &self, - args: rspack_core::CompilationArgs<'_>, - _params: &rspack_core::CompilationParams, - ) -> rspack_core::PluginCompilationHookOutput { - if self.is_hook_disabled(&Hook::Compilation) { - return Ok(()); - } +#[derive(Clone)] +struct CompilerCompilationHookFn(Arc>); +impl CompilerCompilationHookFn { + pub fn new(function: Arc>) -> Self { + Self(function) + } +} + +#[async_trait] +impl AsyncSeries2 for CompilerCompilationHookFn { + async fn run( + &self, + compilation: &mut Compilation, + _: &mut CompilationParams, + ) -> rspack_error::Result<()> { let compilation = JsCompilation::from_compilation(unsafe { std::mem::transmute::<&'_ mut rspack_core::Compilation, &'static mut rspack_core::Compilation>( - args.compilation, + compilation, ) }); self - .compilation_tsfn + .0 .call(compilation, ThreadsafeFunctionCallMode::NonBlocking) .into_rspack_result()? .await .unwrap_or_else(|err| panic!("Failed to call compilation: {err}")) } +} + +#[async_trait] +impl rspack_core::Plugin for JsHooksAdapterPlugin { + fn name(&self) -> &'static str { + "rspack.JsHooksAdapterPlugin" + } + + fn apply( + &self, + ctx: PluginContext<&mut ApplyContext>, + _options: &mut CompilerOptions, + ) -> rspack_error::Result<()> { + self.compiler_compilation_hooks.iter().for_each(|f| { + ctx + .context + .compiler_hooks + .compilation + .tap(Box::new(f.clone())); + }); + Ok(()) + } async fn this_compilation( &self, @@ -912,8 +951,13 @@ impl rspack_core::Plugin for JsHooksAdapter { } } -impl JsHooksAdapter { - pub fn from_js_hooks(env: Env, js_hooks: JsHooks, disabled_hooks: DisabledHooks) -> Result { +impl JsHooksAdapterPlugin { + pub fn from_js_hooks( + env: Env, + js_hooks: JsHooks, + disabled_hooks: DisabledHooks, + compiler_hooks: Vec, + ) -> Result { let JsHooks { make, process_assets_stage_additional, @@ -934,7 +978,6 @@ impl JsHooksAdapter { process_assets_stage_report, after_process_assets, this_compilation, - compilation, should_emit, emit, asset_emitted, @@ -1002,8 +1045,6 @@ impl JsHooksAdapter { let after_emit_tsfn: ThreadsafeFunction<(), ()> = js_fn_into_threadsafe_fn!(after_emit, env); let this_compilation_tsfn: ThreadsafeFunction = js_fn_into_threadsafe_fn!(this_compilation, env); - let compilation_tsfn: ThreadsafeFunction = - js_fn_into_threadsafe_fn!(compilation, env); let make_tsfn: ThreadsafeFunction<(), ()> = js_fn_into_threadsafe_fn!(make, env); let optimize_modules_tsfn: ThreadsafeFunction = js_fn_into_threadsafe_fn!(optimize_modules, env); @@ -1046,56 +1087,70 @@ impl JsHooksAdapter { let runtime_module_tsfn: ThreadsafeFunction> = js_fn_into_threadsafe_fn!(runtime_module, env); - Ok(JsHooksAdapter { - disabled_hooks, - make_tsfn, - process_assets_stage_additional_tsfn, - process_assets_stage_pre_process_tsfn, - process_assets_stage_derived_tsfn, - process_assets_stage_additions_tsfn, - process_assets_stage_none_tsfn, - process_assets_stage_optimize_tsfn, - process_assets_stage_optimize_count_tsfn, - process_assets_stage_optimize_compatibility_tsfn, - process_assets_stage_optimize_size_tsfn, - process_assets_stage_dev_tooling_tsfn, - process_assets_stage_optimize_inline_tsfn, - process_assets_stage_summarize_tsfn, - process_assets_stage_optimize_hash_tsfn, - process_assets_stage_optimize_transfer_tsfn, - process_assets_stage_analyse_tsfn, - process_assets_stage_report_tsfn, - after_process_assets_tsfn, - compilation_tsfn, - this_compilation_tsfn, - should_emit_tsfn, - emit_tsfn, - asset_emitted_tsfn, - after_emit_tsfn, - optimize_modules_tsfn, - after_optimize_modules_tsfn, - optimize_tree_tsfn, - optimize_chunk_modules_tsfn, - before_compile_tsfn, - after_compile_tsfn, - before_resolve, - context_module_factory_before_resolve, - normal_module_factory_create_module, - normal_module_factory_resolve_for_scheme, - finish_modules_tsfn, - finish_make_tsfn, - build_module_tsfn, - chunk_asset_tsfn, - after_resolve, - succeed_module_tsfn, - still_valid_module_tsfn, - execute_module_tsfn, - runtime_module_tsfn, + let mut compiler_compilation_hooks = Vec::new(); + for hook in compiler_hooks { + match hook.r#type { + JsHookType::CompilerCompilation => compiler_compilation_hooks.push( + CompilerCompilationHookFn::new(Arc::new(js_fn_into_threadsafe_fn!(hook.function, env))), + ), + } + } + + Ok(JsHooksAdapterPlugin { + inner: Arc::new(JsHooksAdapterInner { + disabled_hooks, + make_tsfn, + process_assets_stage_additional_tsfn, + process_assets_stage_pre_process_tsfn, + process_assets_stage_derived_tsfn, + process_assets_stage_additions_tsfn, + process_assets_stage_none_tsfn, + process_assets_stage_optimize_tsfn, + process_assets_stage_optimize_count_tsfn, + process_assets_stage_optimize_compatibility_tsfn, + process_assets_stage_optimize_size_tsfn, + process_assets_stage_dev_tooling_tsfn, + process_assets_stage_optimize_inline_tsfn, + process_assets_stage_summarize_tsfn, + process_assets_stage_optimize_hash_tsfn, + process_assets_stage_optimize_transfer_tsfn, + process_assets_stage_analyse_tsfn, + process_assets_stage_report_tsfn, + after_process_assets_tsfn, + compiler_compilation_hooks, + this_compilation_tsfn, + should_emit_tsfn, + emit_tsfn, + asset_emitted_tsfn, + after_emit_tsfn, + optimize_modules_tsfn, + after_optimize_modules_tsfn, + optimize_tree_tsfn, + optimize_chunk_modules_tsfn, + before_compile_tsfn, + after_compile_tsfn, + before_resolve, + context_module_factory_before_resolve, + normal_module_factory_create_module, + normal_module_factory_resolve_for_scheme, + finish_modules_tsfn, + finish_make_tsfn, + build_module_tsfn, + chunk_asset_tsfn, + after_resolve, + succeed_module_tsfn, + still_valid_module_tsfn, + execute_module_tsfn, + runtime_module_tsfn, + }), }) } - #[allow(clippy::unwrap_used)] fn is_hook_disabled(&self, hook: &Hook) -> bool { - self.disabled_hooks.read().expect("").contains(hook) + self.disabled_hooks.is_hook_disabled(hook) + } + + pub fn set_disabled_hooks(&self, hooks: Vec) -> Result<()> { + self.disabled_hooks.set_disabled_hooks(hooks) } } diff --git a/crates/swc_change_package_import/src/change_package_import.rs b/crates/swc_change_package_import/src/change_package_import.rs index 421c51e..766ea73 100644 --- a/crates/swc_change_package_import/src/change_package_import.rs +++ b/crates/swc_change_package_import/src/change_package_import.rs @@ -171,6 +171,7 @@ fn get_import_module_name(named_import_spec: &ImportNamedSpecifier) -> String { fn create_default_import_decl(src: String, local: Ident) -> ModuleItem { wrap_with_moudle_item(ImportDecl { + phase: Default::default(), src: Box::new(quote_str!(src)), specifiers: vec![ImportSpecifier::Default(ImportDefaultSpecifier { span: DUMMY_SP, @@ -184,6 +185,7 @@ fn create_default_import_decl(src: String, local: Ident) -> ModuleItem { fn create_named_import_decl(src: String, specifiers: Vec) -> ModuleItem { wrap_with_moudle_item(ImportDecl { + phase: Default::default(), src: Box::new(quote_str!(src)), specifiers, span: DUMMY_SP, diff --git a/crates/swc_compiler/src/compiler.rs b/crates/swc_compiler/src/compiler.rs index a4144fa..3980224 100644 --- a/crates/swc_compiler/src/compiler.rs +++ b/crates/swc_compiler/src/compiler.rs @@ -12,7 +12,7 @@ use anyhow::{Context, Error}; use dashmap::DashMap; use rspack_ast::javascript::{Ast as JsAst, Context as JsAstContext, Program as JsProgram}; use swc_config::config_types::BoolOr; -use swc_core::base::config::{BuiltInput, IsModule, JsMinifyCommentOption}; +use swc_core::base::config::{BuiltInput, Config, IsModule, JsMinifyCommentOption}; use swc_core::base::SwcComments; use swc_core::common::comments::{Comment, CommentKind, Comments}; use swc_core::common::errors::{Handler, HANDLER}; @@ -73,40 +73,10 @@ pub struct SwcCompiler { options: Options, globals: Globals, helpers: Helpers, + config: Config, } impl SwcCompiler { - pub fn new(resource_path: PathBuf, source: String, mut options: Options) -> Result { - let cm = Arc::new(SourceMap::new(FilePathMapping::empty())); - let globals = Globals::default(); - GLOBALS.set(&globals, || { - let top_level_mark = Mark::new(); - let unresolved_mark = Mark::new(); - options.top_level_mark = Some(top_level_mark); - options.unresolved_mark = Some(unresolved_mark); - }); - - let fm = cm.new_source_file(FileName::Real(resource_path), source); - let comments = SingleThreadedComments::default(); - let helpers = GLOBALS.set(&globals, || { - let external_helpers = options.config.jsc.external_helpers; - Helpers::new(external_helpers.into()) - }); - - Ok(Self { - cm, - fm, - comments, - options, - globals, - helpers, - }) - } - - pub fn run(&self, op: impl FnOnce() -> R) -> R { - GLOBALS.set(&self.globals, op) - } - fn parse_js( &self, fm: Arc, @@ -150,6 +120,40 @@ impl SwcCompiler { res } + pub fn new(resource_path: PathBuf, source: String, mut options: Options) -> Result { + let cm = Arc::new(SourceMap::new(FilePathMapping::empty())); + let globals = Globals::default(); + GLOBALS.set(&globals, || { + let top_level_mark = Mark::new(); + let unresolved_mark = Mark::new(); + options.top_level_mark = Some(top_level_mark); + options.unresolved_mark = Some(unresolved_mark); + }); + + let fm = cm.new_source_file(FileName::Real(resource_path), source); + let comments = SingleThreadedComments::default(); + let config = options.config.clone(); + + let helpers = GLOBALS.set(&globals, || { + let external_helpers = options.config.jsc.external_helpers; + Helpers::new(external_helpers.into()) + }); + + Ok(Self { + cm, + fm, + comments, + options, + globals, + helpers, + config, + }) + } + + pub fn run(&self, op: impl FnOnce() -> R) -> R { + GLOBALS.set(&self.globals, op) + } + pub fn parse<'a, P>( &'a self, program: Option, @@ -175,10 +179,10 @@ impl SwcCompiler { ), }, self.options.output_path.as_deref(), + self.options.source_root.clone(), self.options.source_file_name.clone(), handler, - // TODO: support config file. - Some(self.options.config.clone()), + Some(self.config.clone()), Some(&self.comments), before_pass, )?; @@ -215,6 +219,18 @@ impl SwcCompiler { program } + + pub fn comments(&self) -> &SingleThreadedComments { + &self.comments + } + + pub fn options(&self) -> &Options { + &self.options + } + + pub fn cm(&self) -> &Arc { + &self.cm + } } pub trait IntoJsAst {