From 9d8f907027cce4dd30ebe1992f246184eb4f25d3 Mon Sep 17 00:00:00 2001 From: Hana Date: Fri, 5 Jan 2024 17:46:19 +0800 Subject: [PATCH] chore: bump oxc --- Cargo.lock | 100 +++++++++--------- Cargo.toml | 2 +- crates/rspack_core/Cargo.toml | 2 +- .../rspack_core/src/resolver/resolver_impl.rs | 58 +--------- .../__snapshots__/StatsTestCases.test.ts.snap | 9 +- 5 files changed, 60 insertions(+), 111 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b392a147ddad..9058a4f98ebd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -141,7 +141,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -152,7 +152,7 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -175,7 +175,7 @@ checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -600,7 +600,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eed5fff0d93c7559121e9c72bf9c242295869396255071ff2cb1617147b608c5" dependencies = [ "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -818,7 +818,7 @@ dependencies = [ "pmutil", "proc-macro2", "swc_macros_common", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -883,7 +883,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -1184,7 +1184,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -1486,7 +1486,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -1744,9 +1744,9 @@ checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" [[package]] name = "oxc_resolver" -version = "0.6.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ac76a705bf7db9d1e43904ed4704039de8fa654b0f613cc729c09bb67fd89f6" +checksum = "497a89a4d3c44b9df9fade0e70cf46e79722bced1ddf6e3a02d1fec9e30ce161" dependencies = [ "dashmap", "dunce", @@ -1885,7 +1885,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -1951,7 +1951,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -1989,7 +1989,7 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -2040,7 +2040,7 @@ checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -2115,9 +2115,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.64" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" +checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" dependencies = [ "unicode-ident", ] @@ -2176,9 +2176,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.29" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -3538,9 +3538,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" dependencies = [ "serde_derive", ] @@ -3557,13 +3557,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -3579,9 +3579,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "indexmap 2.1.0", "itoa", @@ -3740,7 +3740,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -3791,7 +3791,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -4040,7 +4040,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -4117,7 +4117,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -4272,7 +4272,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -4621,7 +4621,7 @@ dependencies = [ "swc_ecma_ast", "swc_ecma_parser", "swc_macros_common", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -4728,7 +4728,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -4927,7 +4927,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -5005,7 +5005,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -5084,7 +5084,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -5125,7 +5125,7 @@ checksum = "ff9719b6085dd2824fd61938a881937be14b08f95e2d27c64c825a9f65e052ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -5149,7 +5149,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -5165,9 +5165,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.32" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -5213,7 +5213,7 @@ dependencies = [ "quote", "regex", "relative-path", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -5238,22 +5238,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.51" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.51" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -5344,7 +5344,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -5366,7 +5366,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -5609,7 +5609,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", "wasm-bindgen-shared", ] @@ -5631,7 +5631,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5896,5 +5896,5 @@ checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] diff --git a/Cargo.toml b/Cargo.toml index b41222bf9749..d6b2dd7e69ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ rkyv = { version = "0.7.42" } rspack_sources = { version = "0.2.7" } rustc-hash = { version = "1.1.0" } schemars = { version = "0.8.12" } -serde = { version = "1.0.171" } +serde = { version = "1.0.194" } serde_json = { version = "1.0.100" } similar = { version = "2.2.1" } sugar_path = { version = "0.0.12" } diff --git a/crates/rspack_core/Cargo.toml b/crates/rspack_core/Cargo.toml index 97794c55ec9a..c3f08c838bec 100644 --- a/crates/rspack_core/Cargo.toml +++ b/crates/rspack_core/Cargo.toml @@ -24,7 +24,7 @@ json = { workspace = true } mime_guess = { workspace = true } nodejs-resolver = { version = "0.1.1" } once_cell = { workspace = true } -oxc_resolver = { version = "0.6.2" } +oxc_resolver = "1.2.0" paste = { workspace = true } petgraph = { version = "0.6.3", features = ["serde-1"] } rayon = { workspace = true } diff --git a/crates/rspack_core/src/resolver/resolver_impl.rs b/crates/rspack_core/src/resolver/resolver_impl.rs index df24c9053b7d..f7268b7de763 100644 --- a/crates/rspack_core/src/resolver/resolver_impl.rs +++ b/crates/rspack_core/src/resolver/resolver_impl.rs @@ -184,7 +184,7 @@ impl Resolver { fragment: r.fragment().map(ToString::to_string), description_data: r .package_json() - .map(|d| DescriptionData::new(d.directory().to_path_buf(), Arc::clone(&d.raw_json))), + .map(|d| DescriptionData::new(d.directory().to_path_buf(), Arc::clone(d.raw_json()))), })), Err(oxc_resolver::ResolveError::Ignored(_)) => Ok(ResolveResult::Ignored), Err(error) => Err(ResolveInnerError::OxcResolver(error)), @@ -384,64 +384,10 @@ fn map_nodejs_resolver_error(error: nodejs_resolver::Error, args: &ResolveArgs<' fn map_oxc_resolver_error(error: oxc_resolver::ResolveError, args: &ResolveArgs<'_>) -> Error { match error { - oxc_resolver::ResolveError::InvalidPackageTarget(specifier) => { - let message = format!( - "Export should be relative path and start with \"./\", but got {}", - specifier - ); - error!(message) - } oxc_resolver::ResolveError::IOError(error) => DiagnosticError::from(error.boxed()).into(), - oxc_resolver::ResolveError::Builtin(error) => { - error!("Builtin module: {}", error) - } - oxc_resolver::ResolveError::Ignored(path) => { - error!("Path is ignored: {}", path.display()) - } - oxc_resolver::ResolveError::TsconfigNotFound(path) => { - error!("{} is not a tsconfig", path.display()) - } - oxc_resolver::ResolveError::ExtensionAlias => { - error!("All of the aliased extension are not found") - } - oxc_resolver::ResolveError::Specifier(_) => { - error!("The provided patn specifier cannot be parsed") - } - oxc_resolver::ResolveError::JSON(json) => { - error!("{:?}", json) - } - oxc_resolver::ResolveError::Restriction(path) => { - error!( - "Restriction by `ResolveOptions::restrictions`: {}", - path.display() - ) - } - oxc_resolver::ResolveError::InvalidModuleSpecifier(error) => { - error!("Invalid module specifier: {}", error) - } - oxc_resolver::ResolveError::PackagePathNotExported(error) => { - error!("Package subpath '{}' is not defined by \"exports\"", error) - } - oxc_resolver::ResolveError::InvalidPackageConfig(path) => { - error!("Invalid package config in: {}", path.display()) - } - oxc_resolver::ResolveError::InvalidPackageConfigDefault(path) => { - error!("Default condition should be last one: {}", path.display()) - } - oxc_resolver::ResolveError::InvalidPackageConfigDirectory(path) => { - error!( - "Expecting folder to folder mapping. \"{}\" should end with \"/\"", - path.display() - ) - } - oxc_resolver::ResolveError::PackageImportNotDefined(error) => { - error!("Package import not defined: {}", error) - } - oxc_resolver::ResolveError::Unimplemented(error) => { - error!("{} is unimplemented", error) - } oxc_resolver::ResolveError::Recursion => map_resolver_error(true, args), oxc_resolver::ResolveError::NotFound(_) => map_resolver_error(false, args), + _ => error!("{}", error), } } diff --git a/packages/rspack/tests/__snapshots__/StatsTestCases.test.ts.snap b/packages/rspack/tests/__snapshots__/StatsTestCases.test.ts.snap index f8d18972ba9b..f17d2f05ba01 100644 --- a/packages/rspack/tests/__snapshots__/StatsTestCases.test.ts.snap +++ b/packages/rspack/tests/__snapshots__/StatsTestCases.test.ts.snap @@ -5449,9 +5449,11 @@ console.log(a); }, "errors": [ { - "formatted": " × Export should be relative path and start with "./", but got ../../index.js + "formatted": " × Invalid "exports" target "../../index.js" defined for '.' in the package config /tests/statsCases/resolve-unexpected-exports-in-pkg/node_modules/ + │ pkg-a/package.json ", - "message": " × Export should be relative path and start with "./", but got ../../index.js + "message": " × Invalid "exports" target "../../index.js" defined for '.' in the package config /tests/statsCases/resolve-unexpected-exports-in-pkg/node_modules/ + │ pkg-a/package.json ", "moduleId": "10", "moduleIdentifier": "/tests/statsCases/resolve-unexpected-exports-in-pkg/index.js", @@ -5548,7 +5550,8 @@ chunk {main} bundle.js (main) [entry] webpack/runtime/make_namespace_object {main} -ERROR in ./index.js × Export should be relative path and start with "./", but got ../../index.js +ERROR in ./index.js × Invalid "exports" target "../../index.js" defined for '.' in the package config /tests/statsCases/resolve-unexpected-exports-in-pkg/node_modules/ + │ pkg-a/package.json Rspack compiled with 1 error (660067b0d769a99b766b)" `;