Update swc#32210
Conversation
| pub(crate) fn contains_cjs(m: &Module) -> bool { | ||
| let mut v = CjsFinder::default(); | ||
| m.visit_with(&Invalid { span: DUMMY_SP }, &mut v); | ||
| m.visit_with(&mut v); |
There was a problem hiding this comment.
This is a major difference.
| is_global: bool, | ||
| class_name: &Option<String>, | ||
| ) -> Result<Expr, Error> { | ||
| debug!("CSS: \n{}", style_info.css); |
There was a problem hiding this comment.
This expression (and corresponding expression statement) will be completely noop on release builds.
There was a problem hiding this comment.
cc @padmaia
It was useful for debugging to me, but I'm not sure if it's good to have this line.
There was a problem hiding this comment.
I don't quite understand what it does. Doesn't seem to be spamming the terminal by default so I think I'm okay with it, but it would help to understand how it works.
There was a problem hiding this comment.
We enable release_max_level_off of tracing, which is a crate for logging.
The cargo feature release_max_level_off removes all logging for release build and all macro calls for logging become completely no-op.
There was a problem hiding this comment.
This logging statement will print the input passed to the css parser while testing.
testing is a crate for testing swc crates and next-swc, and it configures logger by default.
Logging level is debug by default, but if you run it like RUST_LOG=trace cargo test, trace! calls will also print the messages.
There was a problem hiding this comment.
As a side note, tracing is used by swc and rustc.
| bail!("Failed to transform one off global selector"); | ||
| } | ||
|
|
||
| trace!("Combinator: {:?}", combinator); |
There was a problem hiding this comment.
cc @padmaia
This line is also removable. I used it to debug styled-jsx, but I'm not sure if it's better to remove it.
Also completely noop on release builds.
There was a problem hiding this comment.
Same answer as the debug comment
| impl VisitMut for Namespacer { | ||
| fn visit_mut_complex_selector(&mut self, node: &mut ComplexSelector) { | ||
| #[cfg(debug_assertions)] | ||
| let _tracing = { |
There was a problem hiding this comment.
This block explictly uses #[cfg(debug_assertions)] because it does some operation which cannot removed by tracing.
| <Element {...props} className={"jsx-abb4c2202db1a207" + " " + (props && props.className != null && props.className || "")}/> | ||
| <_JSXStyle id={"abb4c2202db1a207"}>{"div.jsx-abb4c2202db1a207 {color:red}"}</_JSXStyle> | ||
|
|
||
| <_JSXStyle id={"abb4c2202db1a207"}>{"div.jsx-abb4c2202db1a207{color:red}"}</_JSXStyle> |
There was a problem hiding this comment.
I removed a space between the selectors and the block.
Most css changes of this PR is due to removal of the space.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| is_global: bool, | ||
| class_name: &Option<String>, | ||
| ) -> Result<Expr, Error> { | ||
| debug!("CSS: \n{}", style_info.css); |
There was a problem hiding this comment.
I don't quite understand what it does. Doesn't seem to be spamming the terminal by default so I think I'm okay with it, but it would help to understand how it works.
| bail!("Failed to transform one off global selector"); | ||
| } | ||
|
|
||
| trace!("Combinator: {:?}", combinator); |
There was a problem hiding this comment.
Same answer as the debug comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Failing test suitesCommit: 34ad44b test/integration/app-document-add-hmr/test/index.test.js
Expand output● _app/_document add HMR › should HMR when _document is added test/integration/css-customization/test/index.test.js
Expand output● CSS Customization custom loader › should've applied style |
This comment has been minimized.
This comment has been minimized.
Stats from current PRDefault Build (Decrease detected ✓)General Overall increase
|
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| buildDuration | 18.4s | 18.1s | -218ms |
| buildDurationCached | 3.4s | 3.3s | -143ms |
| nodeModulesSize | 349 MB | 349 MB |
Page Load Tests Overall decrease ⚠️
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| / failed reqs | 0 | 0 | ✓ |
| / total time (seconds) | 2.953 | 2.973 | |
| / avg req/sec | 846.73 | 840.92 | |
| /error-in-render failed reqs | 0 | 0 | ✓ |
| /error-in-render total time (seconds) | 1.397 | 1.399 | 0 |
| /error-in-render avg req/sec | 1790.14 | 1786.69 |
Client Bundles (main, webpack, commons)
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| 450.HASH.js gzip | 179 B | 179 B | ✓ |
| framework-HASH.js gzip | 42.2 kB | 42.2 kB | ✓ |
| main-HASH.js gzip | 28.8 kB | 28.8 kB | ✓ |
| webpack-HASH.js gzip | 1.45 kB | 1.45 kB | ✓ |
| Overall change | 72.7 kB | 72.7 kB | ✓ |
Legacy Client Bundles (polyfills)
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| polyfills-HASH.js gzip | 31 kB | 31 kB | ✓ |
| Overall change | 31 kB | 31 kB | ✓ |
Client Pages
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| _app-HASH.js gzip | 1.37 kB | 1.37 kB | ✓ |
| _error-HASH.js gzip | 194 B | 194 B | ✓ |
| amp-HASH.js gzip | 312 B | 312 B | ✓ |
| css-HASH.js gzip | 326 B | 326 B | ✓ |
| dynamic-HASH.js gzip | 2.39 kB | 2.39 kB | ✓ |
| head-HASH.js gzip | 350 B | 350 B | ✓ |
| hooks-HASH.js gzip | 919 B | 919 B | ✓ |
| image-HASH.js gzip | 4.73 kB | 4.73 kB | ✓ |
| index-HASH.js gzip | 263 B | 263 B | ✓ |
| link-HASH.js gzip | 2.13 kB | 2.13 kB | ✓ |
| routerDirect..HASH.js gzip | 321 B | 321 B | ✓ |
| script-HASH.js gzip | 383 B | 383 B | ✓ |
| withRouter-HASH.js gzip | 318 B | 318 B | ✓ |
| 85e02e95b279..7e3.css gzip | 107 B | 107 B | ✓ |
| Overall change | 14.1 kB | 14.1 kB | ✓ |
Client Build Manifests
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| _buildManifest.js gzip | 459 B | 459 B | ✓ |
| Overall change | 459 B | 459 B | ✓ |
Rendered Page Sizes
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| index.html gzip | 532 B | 532 B | ✓ |
| link.html gzip | 546 B | 546 B | ✓ |
| withRouter.html gzip | 527 B | 527 B | ✓ |
| Overall change | 1.6 kB | 1.6 kB | ✓ |
Default Build with SWC (Decrease detected ✓)
General Overall increase ⚠️
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| buildDuration | 18.5s | 18.8s | |
| buildDurationCached | 3.3s | 3.3s | |
| nodeModulesSize | 349 MB | 349 MB |
Page Load Tests Overall decrease ⚠️
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| / failed reqs | 0 | 0 | ✓ |
| / total time (seconds) | 2.795 | 2.841 | |
| / avg req/sec | 894.42 | 879.86 | |
| /error-in-render failed reqs | 0 | 0 | ✓ |
| /error-in-render total time (seconds) | 1.347 | 1.373 | |
| /error-in-render avg req/sec | 1856.66 | 1820.77 |
Client Bundles (main, webpack, commons)
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| 450.HASH.js gzip | 179 B | 179 B | ✓ |
| framework-HASH.js gzip | 42.3 kB | 42.3 kB | ✓ |
| main-HASH.js gzip | 29.1 kB | 29.1 kB | ✓ |
| webpack-HASH.js gzip | 1.44 kB | 1.44 kB | ✓ |
| Overall change | 73 kB | 73 kB | ✓ |
Legacy Client Bundles (polyfills)
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| polyfills-HASH.js gzip | 31 kB | 31 kB | ✓ |
| Overall change | 31 kB | 31 kB | ✓ |
Client Pages
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| _app-HASH.js gzip | 1.35 kB | 1.35 kB | ✓ |
| _error-HASH.js gzip | 180 B | 180 B | ✓ |
| amp-HASH.js gzip | 305 B | 305 B | ✓ |
| css-HASH.js gzip | 321 B | 321 B | ✓ |
| dynamic-HASH.js gzip | 2.39 kB | 2.39 kB | ✓ |
| head-HASH.js gzip | 342 B | 342 B | ✓ |
| hooks-HASH.js gzip | 906 B | 906 B | ✓ |
| image-HASH.js gzip | 4.75 kB | 4.75 kB | ✓ |
| index-HASH.js gzip | 256 B | 256 B | ✓ |
| link-HASH.js gzip | 2.19 kB | 2.19 kB | ✓ |
| routerDirect..HASH.js gzip | 314 B | 314 B | ✓ |
| script-HASH.js gzip | 375 B | 375 B | ✓ |
| withRouter-HASH.js gzip | 309 B | 309 B | ✓ |
| 85e02e95b279..7e3.css gzip | 107 B | 107 B | ✓ |
| Overall change | 14.1 kB | 14.1 kB | ✓ |
Client Build Manifests
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| _buildManifest.js gzip | 458 B | 458 B | ✓ |
| Overall change | 458 B | 458 B | ✓ |
Rendered Page Sizes
| vercel/next.js canary | kdy1/next.js update-swc-min | Change | |
|---|---|---|---|
| index.html gzip | 531 B | 531 B | ✓ |
| link.html gzip | 545 B | 545 B | ✓ |
| withRouter.html gzip | 525 B | 525 B | ✓ |
| Overall change | 1.6 kB | 1.6 kB | ✓ |
Fixes failing tests from swc bump in #32210 which removed some whitespace. x-ref: https://github.com/vercel/next.js/runs/4456734159?check_suite_focus=true x-ref: https://github.com/vercel/next.js/runs/4461064714?check_suite_focus=true

Bug
fixes #numbercontributing.mdFeature
fixes #numbercontributing.mdDocumentation / Examples
yarn lintThis PR upgrades all crates related to swc.