From 0a267100fc6e192eb333fd2017b5fb9e49471dba Mon Sep 17 00:00:00 2001 From: OJ Kwon <1210596+kwonoj@users.noreply.github.com> Date: Fri, 16 Dec 2022 12:06:16 -0800 Subject: [PATCH] build(next-swc): fix turbopack with tls backend --- .github/workflows/build_test_deploy.yml | 2 +- packages/next-swc/crates/core/Cargo.toml | 8 ++------ packages/next-swc/crates/napi/Cargo.toml | 7 +++++-- packages/next-swc/crates/wasm/Cargo.toml | 2 +- packages/next-swc/package.json | 4 +++- turbo.json | 4 ++++ 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index bea196a7676f..a63f41c4a506 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -1128,7 +1128,7 @@ jobs: target: 'aarch64-pc-windows-msvc' build: | npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}" "turbo@${TURBO_VERSION}" "pnpm@${PNPM_VERSION}" - turbo run build-native-no-plugin -- --release --target aarch64-pc-windows-msvc --cargo-flags=--no-default-features + turbo run build-native-no-plugin-woa -- --release --target aarch64-pc-windows-msvc --cargo-flags=--no-default-features if: ${{ needs.build.outputs.isRelease == 'true' || (needs.build.outputs.swcChange == 'yup' && needs.build.outputs.turboToken != 'empty') }} needs: build name: stable - ${{ matrix.settings.target }} - node@16 diff --git a/packages/next-swc/crates/core/Cargo.toml b/packages/next-swc/crates/core/Cargo.toml index 7b9d28176fc5..5c5b3fa0b7d8 100644 --- a/packages/next-swc/crates/core/Cargo.toml +++ b/packages/next-swc/crates/core/Cargo.toml @@ -17,13 +17,9 @@ pathdiff = "0.2.0" regex = "1.5" serde = "1" serde_json = "1" -swc_emotion = "0.28.4" -styled_components = "0.52.8" -styled_jsx = "0.29.8" -modularize_imports = "0.25.8" tracing = { version = "0.1.37", features = ["release_max_level_info"] } -next-binding = { git = "https://github.com/vercel/turbo.git", rev = "cc024fa59f1c3ad253e74eefe86e0386455455d1", features = [ +next-binding = { git = "https://github.com/vercel/turbo.git", rev = "d3820c52989a2badf38ff868a176f61a7a7255fd", features = [ "__swc_core", "__swc_core_next_core", "__swc_transform_styled_jsx", @@ -33,7 +29,7 @@ next-binding = { git = "https://github.com/vercel/turbo.git", rev = "cc024fa59f1 ] } [dev-dependencies] -next-binding = { git = "https://github.com/vercel/turbo.git", rev = "cc024fa59f1c3ad253e74eefe86e0386455455d1", features = [ +next-binding = { git = "https://github.com/vercel/turbo.git", rev = "d3820c52989a2badf38ff868a176f61a7a7255fd", features = [ "__swc_core_testing_transform", "__swc_testing", ] } diff --git a/packages/next-swc/crates/napi/Cargo.toml b/packages/next-swc/crates/napi/Cargo.toml index 51bd83b6055b..13202b6a2a6c 100644 --- a/packages/next-swc/crates/napi/Cargo.toml +++ b/packages/next-swc/crates/napi/Cargo.toml @@ -8,7 +8,7 @@ publish = false crate-type = ["cdylib", "rlib"] [features] -default = [] +default = ["rustls-tls"] # Instead of enabling all the plugin-related features by default, make it explicitly specified # when build (i.e napi --build --features plugin), same for the wasm as well. # this is due to some of transitive dependencies have features cannot be enabled at the same time @@ -17,6 +17,9 @@ plugin = ["next-binding/__swc_core_binding_napi_plugin", "next-swc/plugin"] sentry_native_tls = ["_sentry_native_tls"] sentry_rustls = ["_sentry_rustls"] +native-tls = ["next-binding/__turbo_native_tls"] +rustls-tls = ["next-binding/__turbo_rustls_tls"] + [dependencies] anyhow = "1.0.66" backtrace = "0.3" @@ -36,7 +39,7 @@ tracing = { version = "0.1.37", features = ["release_max_level_info"] } tracing-futures = "0.2.5" tracing-subscriber = "0.3.9" tracing-chrome = "0.5.0" -next-binding = { git = "https://github.com/vercel/turbo.git", rev = "cc024fa59f1c3ad253e74eefe86e0386455455d1", features = [ +next-binding = { git = "https://github.com/vercel/turbo.git", rev = "d3820c52989a2badf38ff868a176f61a7a7255fd", features = [ "__swc_core_binding_napi", "__turbo_next_dev_server", "__turbo_node_file_trace", diff --git a/packages/next-swc/crates/wasm/Cargo.toml b/packages/next-swc/crates/wasm/Cargo.toml index 894b9860ddab..62fecaf94fd6 100644 --- a/packages/next-swc/crates/wasm/Cargo.toml +++ b/packages/next-swc/crates/wasm/Cargo.toml @@ -31,7 +31,7 @@ wasm-bindgen-futures = "0.4.8" getrandom = { version = "0.2.5", optional = true, default-features = false } js-sys = "0.3.59" serde-wasm-bindgen = "0.4.3" -next-binding = { git = "https://github.com/vercel/turbo.git", rev = "cc024fa59f1c3ad253e74eefe86e0386455455d1", features = [ +next-binding = { git = "https://github.com/vercel/turbo.git", rev = "d3820c52989a2badf38ff868a176f61a7a7255fd", features = [ "__swc_core_binding_wasm", "__feature_mdx_rs", ] } diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 202dc6f0ff21..8188bde1a3ca 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -3,8 +3,10 @@ "version": "13.0.8-canary.0", "private": true, "scripts": { - "build-native": "napi build --platform -p next-swc-napi --cargo-name next_swc_napi --features plugin --js false native", + "build-native": "napi build --platform -p next-swc-napi --cargo-name next_swc_napi --features plugin,rustls-tls --js false native", + "build-native-woa": "napi build --platform -p next-swc-napi --cargo-name next_swc_napi --features plugin,native-tls --js false native", "build-native-no-plugin": "napi build --platform -p next-swc-napi --cargo-name next_swc_napi --js false native", + "build-native-no-plugin-woa": "napi build --platform -p next-swc-napi --cargo-name next_swc_napi --cargo-flags=--no-default-features --features native-tls --js false native", "build-wasm": "wasm-pack build crates/wasm --scope=next", "cache-build-native": "echo $(ls native)" }, diff --git a/turbo.json b/turbo.json index 8b9d0365efa8..21c50734074e 100644 --- a/turbo.json +++ b/turbo.json @@ -9,6 +9,10 @@ "dependsOn": ["^build-native-no-plugin"], "outputs": ["native/*.node"] }, + "build-native-no-plugin-woa": { + "dependsOn": ["^build-native-no-plugin-woa"], + "outputs": ["native/*.node"] + }, "build-wasm": { "dependsOn": ["^build-wasm"], "outputs": ["crates/wasm/pkg/*"]