Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dep: upgrade swc npm pkg to 1.2.151; upgrade swc, swc_* crates #35127

Closed

Conversation

bnoguchi
Copy link
Contributor

@bnoguchi bnoguchi commented Mar 8, 2022

Dependencies (fixes some parsing bugs)

  • Upgrade npm package @swc/core 1.2.148 -> 1.2.151
  • Upgrade crates
    • swc 0.138.0 -> 0.140.1
    • swc_atoms 0.2.7 -> 0.2.9
    • swc_common 0.17.9 -> 0.17.10
    • swc_css 0.94.0 -> 0.98.0
    • swc_ecma_loader 0.28.0 -> 0.29.0
    • swc_ecmascript 0.123.0 -> 0.125.0
    • swc_stylis 0.90.0 -> 0.94.0
    • swc_ecma_transforms_testing 0.65.0 -> 0.66.0
    • swc_bundler 0.114.0 -> 0.115.0

@ijjk

This comment has been minimized.

@huozhi huozhi requested a review from kdy1 March 8, 2022 10:42
@kdy1
Copy link
Member

kdy1 commented Mar 8, 2022

Oh... I missed this and made #35133
Anyway, I'll review it.

Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this PR at the moment, mainly because it does not use recent version.
Due to it, there will be multiple copies of some large crates.

#35133

@@ -821,7 +841,7 @@ dependencies = [
"swc_css",
"swc_ecma_loader",
"swc_ecma_transforms_testing",
"swc_ecmascript",
"swc_ecmascript 0.125.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update styled_components

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swc_ecmascript 0.125.0 means swc_ecmascript is included multiple times, and one of them is 0.125.0

Copy link
Contributor Author

@bnoguchi bnoguchi Mar 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next version of styled_components (0.18.0) requires a dependency of swc_ecmascript ^0.129.0, so upgrading it will also still result in swc_ecmascript being included multiple times -- in particular 0.125.0 and 0.129.0 in addition to additional crates being included multiple times relative to if styled_components isn't updated. See https://crates.io/crates/styled_components/0.18.0/dependencies

@@ -1843,24 +1830,24 @@ dependencies = [

[[package]]
name = "swc_ecma_ast"
version = "0.68.3"
version = "0.68.4"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is fine, as 0.69.1 has a patch to reduce the binary size

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for using the latest versions that result in reduced binary sizes, but used less new versions to get the build to work. See my comment here - #35127 (comment)

swc_css = "0.94.0"
swc_ecma_loader = { version = "0.28.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.123.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc = "0.140.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you used a non-recent version?

Copy link
Contributor Author

@bnoguchi bnoguchi Mar 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was to get the build to work. I initially tried to use the newest versions of these crates, but the build failed (see the failed build here https://github.com/vercel/next.js/runs/5458285184?check_suite_focus=true#step:14:440)

I then started decreasing the versions of the crates until the build passed, and I tried to decrement the versions of the crates I had upgraded, such that there weren't 2 different versions of crates due to different dependency versions.

swc_common = { version = "0.17.10", features = ["concurrent", "sourcemap"] }
swc_css = "0.98.0"
swc_ecma_loader = { version = "0.29.0", features = ["node", "lru"] }
swc_ecmascript = { version = "0.125.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Various swc crates have patch to reduce the binary size, but I'm not sure if it's applied in this version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, no idea. I'll defer to #35133 -- I'm trying to get a patch for parsing behavior that was associated with @swc/core 1.2.148, shipped 5 days ago and happy to toss this PR out in favor of yours.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
I fixed the rust version issue and updated #35133 to use the fixed version

@huozhi huozhi self-requested a review March 8, 2022 10:54
@ijjk
Copy link
Member

ijjk commented Mar 8, 2022

Stats from current PR

Default Build (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
buildDuration 15.3s 15.2s -92ms
buildDurationCached 6s 6s ⚠️ +64ms
nodeModulesSize 378 MB 378 MB -3.62 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
/ failed reqs 0 0
/ total time (seconds) 2.905 2.893 -0.01
/ avg req/sec 860.72 864.17 +3.45
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.159 1.187 ⚠️ +0.03
/error-in-render avg req/sec 2157.85 2105.79 ⚠️ -52.06
Client Bundles (main, webpack) Overall increase ⚠️
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
925.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42 kB 42 kB
main-HASH.js gzip 27.9 kB 27.9 kB ⚠️ +68 B
webpack-HASH.js gzip 1.44 kB 1.44 kB
Overall change 71.5 kB 71.6 kB ⚠️ +68 B
Legacy Client Bundles (polyfills)
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
_app-HASH.js gzip 1.36 kB 1.36 kB
_error-HASH.js gzip 192 B 192 B
amp-HASH.js gzip 309 B 309 B
css-HASH.js gzip 327 B 327 B
dynamic-HASH.js gzip 2.57 kB 2.57 kB
head-HASH.js gzip 351 B 351 B
hooks-HASH.js gzip 920 B 920 B
image-HASH.js gzip 5.09 kB 5.09 kB
index-HASH.js gzip 263 B 263 B
link-HASH.js gzip 2.26 kB 2.26 kB
routerDirect..HASH.js gzip 320 B 320 B
script-HASH.js gzip 387 B 387 B
withRouter-HASH.js gzip 319 B 319 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 14.8 kB 14.8 kB
Client Build Manifests
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
_buildManifest.js gzip 460 B 460 B
Overall change 460 B 460 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
index.html gzip 531 B 531 B
link.html gzip 545 B 544 B -1 B
withRouter.html gzip 526 B 525 B -1 B
Overall change 1.6 kB 1.6 kB -2 B

Diffs

Diff for _app-HASH.js
@@ -246,8 +246,9 @@
         );
         return _appGetInitialProps.apply(this, arguments);
       }
-      var App = /*#__PURE__*/ (function(_Component) {
-        _inherits(App, _Component);
+      var _Component;
+      var App = /*#__PURE__*/ (function(_superClass) {
+        _inherits(App, _superClass);
         var _super = _createSuper(App);
         function App() {
           _classCallCheck(this, App);
@@ -268,7 +269,7 @@
           }
         ]);
         return App;
-      })(_react.default.Component);
+      })((_Component = _react.default.Component));
       exports["default"] = App;
       App.origGetInitialProps = appGetInitialProps;
       App.getInitialProps = appGetInitialProps; //# sourceMappingURL=_app.js.map
Diff for main-HASH.js

Diff too large to display

Diff for index.html
@@ -19,11 +19,11 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-4c121f2669339916.js"
+      src="/_next/static/chunks/main-4a76c4f82fd92e66.js"
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/_app-fddd598caf627789.js"
+      src="/_next/static/chunks/pages/_app-bdfef13e7956aba8.js"
       defer=""
     ></script>
     <script
Diff for link.html
@@ -19,11 +19,11 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-4c121f2669339916.js"
+      src="/_next/static/chunks/main-4a76c4f82fd92e66.js"
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/_app-fddd598caf627789.js"
+      src="/_next/static/chunks/pages/_app-bdfef13e7956aba8.js"
       defer=""
     ></script>
     <script
Diff for withRouter.html
@@ -19,11 +19,11 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-4c121f2669339916.js"
+      src="/_next/static/chunks/main-4a76c4f82fd92e66.js"
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/_app-fddd598caf627789.js"
+      src="/_next/static/chunks/pages/_app-bdfef13e7956aba8.js"
       defer=""
     ></script>
     <script

Default Build with SWC (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
buildDuration 18.4s 18.7s ⚠️ +285ms
buildDurationCached 6s 6.1s ⚠️ +108ms
nodeModulesSize 378 MB 378 MB -3.62 kB
Page Load Tests Overall decrease ⚠️
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
/ failed reqs 0 0
/ total time (seconds) 2.902 2.901 0
/ avg req/sec 861.48 861.74 +0.26
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.16 1.161 0
/error-in-render avg req/sec 2154.82 2152.56 ⚠️ -2.26
Client Bundles (main, webpack) Overall increase ⚠️
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
925.HASH.js gzip 178 B 178 B
framework-HASH.js gzip 42.3 kB 42.3 kB
main-HASH.js gzip 28.2 kB 28.2 kB ⚠️ +60 B
webpack-HASH.js gzip 1.45 kB 1.45 kB
Overall change 72.1 kB 72.2 kB ⚠️ +60 B
Legacy Client Bundles (polyfills)
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
_app-HASH.js gzip 1.35 kB 1.35 kB
_error-HASH.js gzip 179 B 179 B
amp-HASH.js gzip 313 B 313 B
css-HASH.js gzip 324 B 324 B
dynamic-HASH.js gzip 2.56 kB 2.56 kB
head-HASH.js gzip 351 B 351 B
hooks-HASH.js gzip 921 B 921 B
image-HASH.js gzip 5.23 kB 5.23 kB
index-HASH.js gzip 261 B 261 B
link-HASH.js gzip 2.33 kB 2.33 kB
routerDirect..HASH.js gzip 322 B 322 B
script-HASH.js gzip 388 B 388 B
withRouter-HASH.js gzip 317 B 317 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 15 kB 15 kB
Client Build Manifests
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
_buildManifest.js gzip 458 B 458 B
Overall change 458 B 458 B
Rendered Page Sizes Overall decrease ✓
vercel/next.js canary bnoguchi/next.js dep/upgrade-swc-including-crates Change
index.html gzip 531 B 529 B -2 B
link.html gzip 545 B 543 B -2 B
withRouter.html gzip 526 B 525 B -1 B
Overall change 1.6 kB 1.6 kB -5 B

Diffs

Diff for _app-HASH.js
@@ -246,8 +246,9 @@
         );
         return _appGetInitialProps.apply(this, arguments);
       }
-      var App = /*#__PURE__*/ (function(_Component) {
-        _inherits(App, _Component);
+      var _Component;
+      var App = /*#__PURE__*/ (function(_superClass) {
+        _inherits(App, _superClass);
         var _super = _createSuper(App);
         function App() {
           _classCallCheck(this, App);
@@ -268,7 +269,7 @@
           }
         ]);
         return App;
-      })(_react.default.Component);
+      })((_Component = _react.default.Component));
       exports["default"] = App;
       App.origGetInitialProps = appGetInitialProps;
       App.getInitialProps = appGetInitialProps; //# sourceMappingURL=_app.js.map
Diff for main-HASH.js

Diff too large to display

Diff for index.html
@@ -19,11 +19,11 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-4c121f2669339916.js"
+      src="/_next/static/chunks/main-4a76c4f82fd92e66.js"
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/_app-fddd598caf627789.js"
+      src="/_next/static/chunks/pages/_app-bdfef13e7956aba8.js"
       defer=""
     ></script>
     <script
Diff for link.html
@@ -19,11 +19,11 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-4c121f2669339916.js"
+      src="/_next/static/chunks/main-4a76c4f82fd92e66.js"
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/_app-fddd598caf627789.js"
+      src="/_next/static/chunks/pages/_app-bdfef13e7956aba8.js"
       defer=""
     ></script>
     <script
Diff for withRouter.html
@@ -19,11 +19,11 @@
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/main-4c121f2669339916.js"
+      src="/_next/static/chunks/main-4a76c4f82fd92e66.js"
       defer=""
     ></script>
     <script
-      src="/_next/static/chunks/pages/_app-fddd598caf627789.js"
+      src="/_next/static/chunks/pages/_app-bdfef13e7956aba8.js"
       defer=""
     ></script>
     <script
Commit: 710df21

@bnoguchi bnoguchi closed this Mar 11, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants