Skip to content

Commit

Permalink
build(next/swc): consolidate swc_core dependency version (#41043)
Browse files Browse the repository at this point in the history
<!--
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:
-->

This PR utilizes cargo's new feature from latest release (1.64.0),
inheriting dependency from a workspace.

In short, top-level workspace cargo manifest can specify a version of
dependency to use, then actual packages uses it without re-declaring
version per each via workspace = true. This will help to dedupe
different versions of packages, also potentially avoid conflicts if
forgot to bump up specific versions.

In this pr only touches swc_core, which is a base dependency we use in
several place. One another benefit for this is bump up PR can be lot
more simplified, only need to update single Cargo.toml when we bump up.

Note rust-toolchain has updated to use nightly version after 1.64.0 to
enable this.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
  • Loading branch information
kwonoj committed Sep 30, 2022
1 parent cae96f2 commit 3b34602
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_test_deploy.yml
Expand Up @@ -9,7 +9,7 @@ name: Build, test, and deploy
env:
NAPI_CLI_VERSION: 2.7.0
TURBO_VERSION: 1.3.2-canary.1
RUST_TOOLCHAIN: nightly-2022-09-14
RUST_TOOLCHAIN: nightly-2022-09-23
PNPM_VERSION: 7.2.1

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull_request_stats.yml
Expand Up @@ -7,7 +7,7 @@ name: Generate Pull Request Stats
env:
NAPI_CLI_VERSION: 2.7.0
TURBO_VERSION: 1.3.2-canary.1
RUST_TOOLCHAIN: nightly-2022-02-23
RUST_TOOLCHAIN: nightly-2022-09-23
PNPM_VERSION: 7.2.1

jobs:
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
with:
profile: minimal
toolchain: nightly-2021-11-15
toolchain: nightly-2022-09-23

- name: Cache cargo registry
uses: actions/cache@v1
Expand Down
7 changes: 6 additions & 1 deletion packages/next-swc/Cargo.toml
Expand Up @@ -14,4 +14,9 @@ opt-level = 2
debug-assertions = false

[profile.release]
lto = true
lto = true

# Declare dependencies used across workspace packages requires single version bump.
# ref: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#inheriting-a-dependency-from-a-workspace
[workspace.dependencies]
swc_core = "0.28.10"
4 changes: 2 additions & 2 deletions packages/next-swc/crates/core/Cargo.toml
Expand Up @@ -28,7 +28,7 @@ styled_jsx = {path="../styled_jsx"}
modularize_imports = {path="../modularize_imports"}
tracing = { version = "0.1.32", features = ["release_max_level_info"] }

swc_core = { version = "0.28.10", features = [
swc_core = { workspace = true, features = [
"common_concurrent",
"ecma_ast",
"ecma_visit",
Expand All @@ -48,6 +48,6 @@ swc_core = { version = "0.28.10", features = [
] }

[dev-dependencies]
swc_core = { version = "0.28.10", features = ["testing_transform"] }
swc_core = { workspace = true, features = ["testing_transform"] }
testing = "0.31.3"
walkdir = "2.3.2"
4 changes: 2 additions & 2 deletions packages/next-swc/crates/emotion/Cargo.toml
Expand Up @@ -19,9 +19,9 @@ regex = "1.5"
serde = "1"
sourcemap = "6.0.1"
tracing = { version = "0.1.32", features = ["release_max_level_info"] }
swc_core = { version = "0.28.10", features = ["common", "ecma_ast","ecma_codegen", "ecma_utils", "ecma_visit", "trace_macro"] }
swc_core = { workspace = true, features = ["common", "ecma_ast","ecma_codegen", "ecma_utils", "ecma_visit", "trace_macro"] }

[dev-dependencies]
swc_core = { version = "0.28.10", features = ["testing_transform", "ecma_transforms_react"] }
swc_core = { workspace = true, features = ["testing_transform", "ecma_transforms_react"] }
testing = "0.31.3"
serde_json = "1"
4 changes: 2 additions & 2 deletions packages/next-swc/crates/modularize_imports/Cargo.toml
Expand Up @@ -15,8 +15,8 @@ handlebars = "4.2.1"
once_cell = "1.13.0"
regex = "1.5"
serde = "1"
swc_core = { version = "0.28.10", features = ["cached", "ecma_ast", "ecma_visit"] }
swc_core = { workspace = true, features = ["cached", "ecma_ast", "ecma_visit"] }

[dev-dependencies]
swc_core = { version = "0.28.10", features = ["testing_transform"] }
swc_core = { workspace = true, features = ["testing_transform"] }
testing = "0.31.3"
2 changes: 1 addition & 1 deletion packages/next-swc/crates/napi/Cargo.toml
Expand Up @@ -30,7 +30,7 @@ next-swc = {version = "0.0.0", path = "../core"}
once_cell = "1.13.0"
serde = "1"
serde_json = "1"
swc_core = { version = "0.28.10", features = [
swc_core = { workspace = true, features = [
"allocator_node",
"base_concurrent", # concurrent?
"common_concurrent",
Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/styled_components/Cargo.toml
Expand Up @@ -16,7 +16,7 @@ once_cell = "1.13.0"
regex = {version = "1.5.4", features = ["std", "perf"], default-features = false}
serde = {version = "1.0.130", features = ["derive"]}
tracing = "0.1.32"
swc_core = { version = "0.28.10", features = [
swc_core = { workspace = true, features = [
"common",
"ecma_ast",
"ecma_utils",
Expand All @@ -26,7 +26,7 @@ swc_core = { version = "0.28.10", features = [
[dev-dependencies]
serde_json = "1"
testing = "0.31.3"
swc_core = { version = "0.28.10", features = [
swc_core = { workspace = true, features = [
"ecma_parser",
"ecma_transforms",
"testing_transform"
Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/styled_jsx/Cargo.toml
Expand Up @@ -13,7 +13,7 @@ version = "0.20.0"
easy-error = "1.0.0"
tracing = "0.1.32"

swc_core = { version = "0.28.10", features = [
swc_core = { workspace = true, features = [
"common",
"css_ast",
"css_codegen",
Expand All @@ -28,6 +28,6 @@ swc_core = { version = "0.28.10", features = [

[dev-dependencies]
testing = "0.31.3"
swc_core = { version = "0.28.10", features = [
swc_core = { workspace = true, features = [
"testing_transform"
] }
2 changes: 1 addition & 1 deletion packages/next-swc/crates/wasm/Cargo.toml
Expand Up @@ -32,7 +32,7 @@ getrandom = { version = "0.2.5", optional = true, default-features = false }
js-sys = "0.3.59"
serde-wasm-bindgen = "0.4.3"

swc_core = { version = "0.28.10", features = [
swc_core = { workspace = true, features = [
"common_concurrent",
"binding_macro_wasm",
"ecma_codegen",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/rust-toolchain
@@ -1 +1 @@
nightly-2022-09-14
nightly-2022-09-23

0 comments on commit 3b34602

Please sign in to comment.