rsnext/packages
OJ Kwon b45c81577c
refactor(next-swc): introduce next-binding to consolidate dependencies. (#43473)
<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change that you're making:
-->

Partial solutions for WEB-225.

One of the issue we want to improve is version bump process across
multiple dependencies sharing same transitive dependencies. There were
known cases of last-minute build failures of next-swc due to this. The
biggest thing is we have lot of dependenceis rely on swc_core, and
consolidating it altogether is tricky.

PR introduces `next-binding`, which reexports all the related
dependencies that next-swc and turbopack commonly uses. Unfortunately,
this is not a complete solution, but at least it'll make `upfront` cost
to turbopack when it try to update swc_core and others, so by the time
upgrading it in next-swc we expect minimal friction. Note not 0
friction: due to how cargo behaves for the merging all of the features,
there's still chances to have some build failures but meaningfully less
I believe.

I think the easiest way to describe before / after is having some
diagrams. This is rather simplified to illustrate problems easily, i.e
when it comes to actual build if there are same version of deps cargo
will dedupe, so below illustaration only would occur for non-compatible
version cases, etcs.

**Before**
```mermaid
graph TD
    A[next-swc] --> B(next-dev)
    A --> C(swc_core)
    A --> D(swc_emotion)
    D --> E(swc_core)
    A --> F(styled_jsx)
    F --> E
    A --> G(mdxrs)
    G --> H(swc_core)
    B --> I(swc_core)
    B --> J(swc_emotion)
    J --> K(swc_core)
```

**After**
```mermaid
graph TD
    A[next-swc] --> B(next-binding)
    B --> C[swc_core]
    B --> D[swc_emotion]
    D --> I[swc_core]
    B --> H[styled_jsx]
    B --> F[next-dev]
    B --> J[node-file-trace]
    F --> C
    H --> I
    B --> E(mdxrs)
    E --> G(swc_core)
 ```

You can see repeated dependencies (`swc_core`, `swc_emotion`) occurs lot more in next-swc in `before`, including next-swc top level direct import itself. In result, update process have to align between next-swc, turbopack, swc-plugins and others.

With newly proposed changes, `next-swc` no longer directly owns deps reduces those repetaed deps. At the moment of version bump, only `next-binding` need to be updated.

This brings small caveat however : next-swc does not directly update `swc_core`, but have to bump turbopack and its transitive dependencies. Given our bump process usually requires to bump up turbopack anyway, I wouldn't consider this as hard blocking though.
2022-12-16 11:47:56 -08:00
..
create-next-app v13.0.8-canary.0 2022-12-15 20:54:35 +01:00
eslint-config-next v13.0.8-canary.0 2022-12-15 20:54:35 +01:00
eslint-plugin-next v13.0.8-canary.0 2022-12-15 20:54:35 +01:00
font v13.0.8-canary.0 2022-12-15 20:54:35 +01:00
next Fix ignoring dev warning for preload component (#44065) 2022-12-16 17:47:30 +01:00
next-bundle-analyzer v13.0.8-canary.0 2022-12-15 20:54:35 +01:00
next-codemod v13.0.8-canary.0 2022-12-15 20:54:35 +01:00
next-env v13.0.8-canary.0 2022-12-15 20:54:35 +01:00
next-mdx v13.0.8-canary.0 2022-12-15 20:54:35 +01:00
next-plugin-storybook v13.0.8-canary.0 2022-12-15 20:54:35 +01:00
next-polyfill-module v13.0.8-canary.0 2022-12-15 20:54:35 +01:00
next-polyfill-nomodule v13.0.8-canary.0 2022-12-15 20:54:35 +01:00
next-swc refactor(next-swc): introduce next-binding to consolidate dependencies. (#43473) 2022-12-16 11:47:56 -08:00
react-dev-overlay v13.0.8-canary.0 2022-12-15 20:54:35 +01:00
react-refresh-utils v13.0.8-canary.0 2022-12-15 20:54:35 +01:00