Integrate next-* crates from Turbopack (#47019)
Update workspace cargo deps Update cargo deps to point to local workspace Ignore too-many-arguments warnings Fix clippy errors Update pnpm workspaces exclude integration tests from unit tests CI rust-analyzer settings add rust flags and env vars
This commit is contained in:
parent
b98469c86b
commit
8ae2df0f10
17 changed files with 1934 additions and 2305 deletions
|
@ -1,2 +1,3 @@
|
|||
CODE_OF_CONDUCT.md
|
||||
examples/
|
||||
**/*/LICENSE.md
|
||||
|
|
2
.github/workflows/build_test_deploy.yml
vendored
2
.github/workflows/build_test_deploy.yml
vendored
|
@ -1127,7 +1127,7 @@ jobs:
|
|||
toolchain: ${{ env.RUST_TOOLCHAIN }}
|
||||
profile: minimal
|
||||
|
||||
- run: cd packages/next-swc && cargo test
|
||||
- run: cd packages/next-swc && cargo test --workspace --exclude next-dev-tests
|
||||
if: ${{ steps.swc-change.outputs.SWC_CHANGE == 'yup' }}
|
||||
|
||||
test-wasm:
|
||||
|
|
11
.vscode/settings.json
vendored
11
.vscode/settings.json
vendored
|
@ -57,5 +57,16 @@
|
|||
"explorer.fileNesting.patterns": {
|
||||
"*.ts": "$(capture).test.ts, $(capture).test.tsx",
|
||||
"*.tsx": "$(capture).test.ts, $(capture).test.tsx"
|
||||
},
|
||||
|
||||
// Allow to find the cargo project for rust-analyzer.
|
||||
"rust-analyzer.linkedProjects": ["packages/next-swc/Cargo.toml"],
|
||||
// Compile rust-analyzer in a separate directory to avoid conflicts with the main project.
|
||||
"rust-analyzer.checkOnSave.extraEnv": {
|
||||
"CARGO_TARGET_DIR": "target/rust-analyzer"
|
||||
},
|
||||
"rust-analyzer.server.extraEnv": {
|
||||
"CARGO_TARGET_DIR": "target/rust-analyzer",
|
||||
"RUST_BACKTRACE": "0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,33 @@
|
|||
[env]
|
||||
CARGO_WORKSPACE_DIR = { value = "", relative = true }
|
||||
|
||||
[build]
|
||||
|
||||
rustdocflags = []
|
||||
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
linker = "rust-lld"
|
||||
|
||||
[target.aarch64-unknown-linux-gnu]
|
||||
linker = "aarch64-linux-gnu-gcc"
|
||||
|
||||
[target.aarch64-unknown-linux-musl]
|
||||
linker = "aarch64-linux-musl-gcc"
|
||||
rustflags = [
|
||||
"-C",
|
||||
"target-feature=-crt-static",
|
||||
"-C",
|
||||
"link-arg=-lgcc",
|
||||
"--cfg",
|
||||
"tokio_unstable",
|
||||
"-Csymbol-mangling-version=v0",
|
||||
"-Ctarget-feature=-crt-static",
|
||||
"-Clink-arg=-lgcc",
|
||||
]
|
||||
|
||||
[target.armv7-unknown-linux-gnueabihf]
|
||||
linker = "arm-linux-gnueabihf-gcc"
|
||||
|
||||
[target.'cfg(all())']
|
||||
rustflags = [
|
||||
"--cfg",
|
||||
"tokio_unstable",
|
||||
"-Csymbol-mangling-version=v0",
|
||||
"-Aclippy::too_many_arguments"
|
||||
]
|
||||
|
|
1717
packages/next-swc/Cargo.lock
generated
1717
packages/next-swc/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,17 @@
|
|||
[workspace]
|
||||
|
||||
members = ["crates/core", "crates/napi", "crates/wasm"]
|
||||
members = [
|
||||
"crates/core",
|
||||
"crates/napi",
|
||||
"crates/wasm",
|
||||
"crates/next-binding",
|
||||
"crates/next-core",
|
||||
"crates/next-dev",
|
||||
"crates/next-dev-tests",
|
||||
# "crates/next-font",
|
||||
# "crates/next-transform-dynamic",
|
||||
# "crates/next-transform-strip-page-exports",
|
||||
]
|
||||
|
||||
[profile.dev.package.swc_css_prefixer]
|
||||
opt-level = 2
|
||||
|
@ -11,3 +22,131 @@ debug-assertions = false
|
|||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
||||
[workspace.dependencies]
|
||||
# Workspace crates
|
||||
next-binding = { path = "crates/next-binding" }
|
||||
next-core = { path = "crates/next-core" }
|
||||
next-dev = { path = "crates/next-dev" }
|
||||
next-dev-tests = { path = "crates/next-dev-tests" }
|
||||
# next-font = { path = "crates/next-font" }
|
||||
# next-transform-dynamic = { path = "crates/next-transform-dynamic" }
|
||||
# next-transform-strip-page-exports = { path = "crates/next-transform-strip-page-exports" }
|
||||
|
||||
# SWC crates
|
||||
# Keep consistent with preset_env_base through swc_core
|
||||
browserslist-rs = { version = "0.12.2" }
|
||||
mdxjs = { version = "0.1.6" }
|
||||
modularize_imports = { version = "0.26.4" }
|
||||
styled_components = { version = "0.53.4" }
|
||||
styled_jsx = { version = "0.30.4" }
|
||||
swc_core = { version = "0.59.26" }
|
||||
swc_emotion = { version = "0.29.4" }
|
||||
testing = { version = "0.31.31" }
|
||||
|
||||
# Turbo crates
|
||||
auto-hash-map = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
node-file-trace = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
swc-ast-explorer = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbo-malloc = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94", default-features = false }
|
||||
turbo-tasks = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbo-tasks-build = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbo-tasks-env = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbo-tasks-fetch = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbo-tasks-hash = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbo-tasks-macros = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbo-tasks-macros-shared = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbo-tasks-memory = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbo-tasks-testing = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbo-updater = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-cli-utils = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-core = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-create-test-app = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-css = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-dev-server = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-ecmascript = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-env = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-json = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-mdx = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-node = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-static = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-swc-utils = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-test-utils = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
turbopack-tests = { git = "https://github.com/vercel/turbo.git", rev = "8a8038f94" }
|
||||
|
||||
# General Deps
|
||||
|
||||
# Be careful when selecting tls backend, including change default tls backend.
|
||||
# If you changed, must verify with ALL build targets with next-swc to ensure
|
||||
# it works. next-swc have various platforms, some doesn't support native (using openssl-sys)
|
||||
# and some aren't buildable with rustls.
|
||||
reqwest = { version = "0.11.14", default-features = false }
|
||||
|
||||
chromiumoxide = { version = "0.4.0", features = [
|
||||
"tokio-runtime",
|
||||
], default-features = false }
|
||||
# For matching on errors from chromiumoxide. Keep in
|
||||
# sync with chromiumoxide's tungstenite requirement.
|
||||
tungstenite = "0.17.3"
|
||||
|
||||
anyhow = "1.0.69"
|
||||
assert_cmd = "2.0.8"
|
||||
async-compression = { version = "0.3.13", default-features = false, features = [
|
||||
"gzip",
|
||||
"tokio",
|
||||
] }
|
||||
async-trait = "0.1.64"
|
||||
atty = "0.2.14"
|
||||
chrono = "0.4.23"
|
||||
clap = "4.1.6"
|
||||
clap_complete = "4.1.2"
|
||||
concurrent-queue = "2.1.0"
|
||||
console = "0.15.5"
|
||||
console-subscriber = "0.1.8"
|
||||
criterion = "0.4.0"
|
||||
dashmap = "5.4.0"
|
||||
dialoguer = "0.10.3"
|
||||
dunce = "1.0.3"
|
||||
futures = "0.3.26"
|
||||
futures-retry = "0.6.0"
|
||||
httpmock = "0.6.7"
|
||||
indexmap = "1.9.2"
|
||||
indicatif = "0.17.3"
|
||||
indoc = "2.0.0"
|
||||
itertools = "0.10.5"
|
||||
lazy_static = "1.4.0"
|
||||
log = "0.4.17"
|
||||
mime = "0.3.16"
|
||||
nohash-hasher = "0.2.0"
|
||||
once_cell = "1.17.1"
|
||||
owo-colors = "3.5.0"
|
||||
parking_lot = "0.12.1"
|
||||
pathdiff = "0.2.1"
|
||||
pin-project-lite = "0.2.9"
|
||||
predicates = "2.1.5"
|
||||
pretty_assertions = "1.3.0"
|
||||
proc-macro2 = "1.0.51"
|
||||
qstring = "0.7.2"
|
||||
quote = "1.0.23"
|
||||
rand = "0.8.5"
|
||||
regex = "1.7.0"
|
||||
rstest = "0.16.0"
|
||||
rustc-hash = "1.1.0"
|
||||
semver = "1.0.16"
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
serde_json = "1.0.93"
|
||||
serde_qs = "0.11.0"
|
||||
serde_yaml = "0.9.17"
|
||||
syn = "1.0.107"
|
||||
tempfile = "3.3.0"
|
||||
test-generator = "0.3.1"
|
||||
thiserror = "1.0.38"
|
||||
tiny-gradient = "0.1.0"
|
||||
tokio = "1.25.0"
|
||||
tokio-util = { version = "0.7.7", features = ["io"] }
|
||||
tracing = "0.1.37"
|
||||
url = "2.2.2"
|
||||
urlencoding = "2.1.2"
|
||||
webbrowser = "0.8.7"
|
||||
|
|
|
@ -21,7 +21,7 @@ serde_json = "1"
|
|||
sha1 = "0.10.1"
|
||||
tracing = { version = "0.1.37", features = ["release_max_level_info"] }
|
||||
|
||||
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230310.2", features = [
|
||||
next-binding = { path = "../next-binding", features = [
|
||||
"__swc_core",
|
||||
"__swc_core_next_core",
|
||||
"__swc_transform_styled_jsx",
|
||||
|
@ -31,7 +31,7 @@ next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-2
|
|||
] }
|
||||
|
||||
[dev-dependencies]
|
||||
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230310.2", features = [
|
||||
next-binding = { path = "../next-binding", features = [
|
||||
"__swc_core_testing_transform",
|
||||
"__swc_testing",
|
||||
] }
|
||||
|
|
|
@ -39,10 +39,10 @@ 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"
|
||||
turbopack = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230310.2" }
|
||||
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230310.2" }
|
||||
turbo-tasks-memory = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230310.2" }
|
||||
next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230310.2", features = [
|
||||
turbopack = { workspace = true }
|
||||
turbo-tasks = { workspace = true }
|
||||
turbo-tasks-memory = { workspace = true }
|
||||
next-binding = { path = "../next-binding", features = [
|
||||
"__swc_core_binding_napi",
|
||||
"__turbo_next_dev_server",
|
||||
"__turbo_node_file_trace",
|
||||
|
@ -51,7 +51,7 @@ next-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-2
|
|||
|
||||
|
||||
[target.'cfg(not(all(target_os = "linux", target_env = "musl", target_arch = "aarch64")))'.dependencies]
|
||||
turbo-malloc = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230310.2" }
|
||||
turbo-malloc = { workspace = true }
|
||||
|
||||
# There are few build targets we can't use native-tls which default features rely on,
|
||||
# allow to specify alternative (rustls) instead via features.
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
"build:compiled": "node build.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/turbopack-runtime": "latest",
|
||||
"@vercel/turbopack-runtime": "https://gitpkg.now.sh/vercel/turbo/crates/turbopack-ecmascript/js?8a8038f94",
|
||||
"anser": "^2.1.1",
|
||||
"css.escape": "^1.5.1",
|
||||
"next": "13.2.4-canary.7",
|
||||
"next": "*",
|
||||
"platform": "1.3.6",
|
||||
"react-dom": "^18.2.0",
|
||||
"react": "^18.2.0",
|
||||
|
|
|
@ -27,7 +27,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
fn strip_prefix_and_suffix<'a, 'b>(&'a self, path: &'b str) -> Option<&'b str> {
|
||||
fn strip_prefix_and_suffix<'b>(&self, path: &'b str) -> Option<&'b str> {
|
||||
path.strip_prefix(self.prefix.as_str())?
|
||||
.strip_suffix(self.suffix.as_str())
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ pub async fn get_typescript_transform_options(
|
|||
|
||||
let ts_transform_options = TypescriptTransformOptions {
|
||||
use_define_for_class_fields,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
Ok(ts_transform_options.cell())
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
"version": "0.0.1",
|
||||
"main": "./harness.ts",
|
||||
"dependencies": {
|
||||
"expect": "^24.5.0",
|
||||
"jest-circus": "^29.4.1",
|
||||
"expect": "27.5.1",
|
||||
"jest-circus": "27.5.1",
|
||||
"jest-circus-browser": "^1.0.7"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,19 +2,15 @@
|
|||
"name": "next-dev-tests",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@babel/preset-typescript": "7.21.0",
|
||||
"@turbo/pack-test-harness": "file:../test-harness",
|
||||
"@types/jest": "29.4.0",
|
||||
"@types/node": "^18.14.0",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"babel-loader": "^9.1.2",
|
||||
"loader-runner": "^4.3.0",
|
||||
"next": "13.2.4-canary.7",
|
||||
"postcss": "^8.4.20",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-test-renderer": "^18.2.0",
|
||||
"styled-jsx": "^5.1.0",
|
||||
"tailwindcss": "^3.2.4"
|
||||
"@babel/preset-typescript": "7.18.6",
|
||||
"@babel/core": "7.18.0",
|
||||
"@turbo/pack-test-harness": "*",
|
||||
"autoprefixer": "10.4.4",
|
||||
"postcss": "8.4.14",
|
||||
"babel-loader": "9.1.2",
|
||||
"loader-runner": "4.3.0",
|
||||
"next": "*",
|
||||
"react-test-renderer": "18.2.0",
|
||||
"tailwindcss": "1.1.3"
|
||||
}
|
||||
}
|
|
@ -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", tag = "turbopack-230310.2", features = [
|
||||
next-binding = { path = "../next-binding", features = [
|
||||
"__swc_core_binding_wasm",
|
||||
"__feature_mdx_rs",
|
||||
] }
|
||||
|
|
2288
pnpm-lock.yaml
2288
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,6 @@
|
|||
packages:
|
||||
- 'packages/*'
|
||||
- 'bench/vercel/'
|
||||
- 'packages/next-swc/crates/next-dev-tests/test-harness'
|
||||
- 'packages/next-swc/crates/next-dev-tests/tests'
|
||||
- 'packages/next-swc/crates/next-core/js'
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
"esModuleInterop": true,
|
||||
"moduleResolution": "node",
|
||||
"baseUrl": ".",
|
||||
"types": ["react", "jest", "node", "trusted-types"],
|
||||
"paths": {
|
||||
"next-test-utils": ["test/lib/next-test-utils"],
|
||||
"amp-test-utils": ["test/lib/amp-test-utils"],
|
||||
|
|
Loading…
Reference in a new issue