Reapply "Implement Turbopack trace server bindings" (#65419) (#65527)

Applies #65419 with the latest version of Turbopack that uses a
different websocket library.

<!-- 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(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-3363
This commit is contained in:
Tim Neutkens 2024-05-13 18:59:59 +02:00 committed by GitHub
parent 1518895728
commit ac6e41292b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 235 additions and 88 deletions

167
Cargo.lock generated
View file

@ -321,7 +321,7 @@ dependencies = [
[[package]]
name = "auto-hash-map"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"serde",
"smallvec",
@ -1861,7 +1861,7 @@ dependencies = [
"futures-core",
"futures-sink",
"futures-util",
"http",
"http 0.2.11",
"indexmap 2.2.3",
"slab",
"tokio",
@ -1997,6 +1997,17 @@ dependencies = [
"itoa",
]
[[package]]
name = "http"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
dependencies = [
"bytes",
"fnv",
"itoa",
]
[[package]]
name = "http-body"
version = "0.4.5"
@ -2004,7 +2015,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
dependencies = [
"bytes",
"http",
"http 0.2.11",
"pin-project-lite",
]
@ -2031,7 +2042,7 @@ dependencies = [
"futures-core",
"futures-util",
"h2",
"http",
"http 0.2.11",
"http-body",
"httparse",
"httpdate",
@ -2050,7 +2061,7 @@ version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c"
dependencies = [
"http",
"http 0.2.11",
"hyper",
"rustls",
"tokio",
@ -2080,7 +2091,7 @@ dependencies = [
"pin-project",
"tokio",
"tokio-tungstenite",
"tungstenite",
"tungstenite 0.18.0",
]
[[package]]
@ -3086,7 +3097,7 @@ dependencies = [
[[package]]
name = "node-file-trace"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"serde",
@ -4174,7 +4185,7 @@ dependencies = [
"futures-core",
"futures-util",
"h2",
"http",
"http 0.2.11",
"http-body",
"hyper",
"hyper-rustls",
@ -6733,7 +6744,7 @@ dependencies = [
"futures-util",
"log",
"tokio",
"tungstenite",
"tungstenite 0.18.0",
]
[[package]]
@ -6922,7 +6933,26 @@ dependencies = [
"base64 0.13.1",
"byteorder",
"bytes",
"http",
"http 0.2.11",
"httparse",
"log",
"rand",
"sha1",
"thiserror",
"url",
"utf-8",
]
[[package]]
name = "tungstenite"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1"
dependencies = [
"byteorder",
"bytes",
"data-encoding",
"http 1.1.0",
"httparse",
"log",
"rand",
@ -6935,7 +6965,7 @@ dependencies = [
[[package]]
name = "turbo-tasks"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"async-trait",
@ -6966,7 +6996,7 @@ dependencies = [
[[package]]
name = "turbo-tasks-build"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"cargo-lock",
@ -6978,7 +7008,7 @@ dependencies = [
[[package]]
name = "turbo-tasks-bytes"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"bytes",
@ -6992,7 +7022,7 @@ dependencies = [
[[package]]
name = "turbo-tasks-env"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"dotenvs",
@ -7006,7 +7036,7 @@ dependencies = [
[[package]]
name = "turbo-tasks-fetch"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"lazy_static",
@ -7022,7 +7052,7 @@ dependencies = [
[[package]]
name = "turbo-tasks-fs"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"auto-hash-map",
@ -7054,7 +7084,7 @@ dependencies = [
[[package]]
name = "turbo-tasks-hash"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"base16",
"hex",
@ -7066,12 +7096,13 @@ dependencies = [
[[package]]
name = "turbo-tasks-macros"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"proc-macro-error",
"proc-macro2",
"quote",
"regex",
"syn 1.0.109",
"turbo-tasks-macros-shared",
]
@ -7079,7 +7110,7 @@ dependencies = [
[[package]]
name = "turbo-tasks-macros-shared"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"proc-macro2",
"quote",
@ -7089,7 +7120,7 @@ dependencies = [
[[package]]
name = "turbo-tasks-malloc"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"mimalloc",
]
@ -7097,7 +7128,7 @@ dependencies = [
[[package]]
name = "turbo-tasks-memory"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"auto-hash-map",
@ -7123,7 +7154,7 @@ dependencies = [
[[package]]
name = "turbopack"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"async-recursion",
@ -7153,7 +7184,7 @@ dependencies = [
[[package]]
name = "turbopack-binding"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"auto-hash-map",
"mdxjs",
@ -7187,13 +7218,14 @@ dependencies = [
"turbopack-node",
"turbopack-nodejs",
"turbopack-static",
"turbopack-trace-server",
"turbopack-trace-utils",
]
[[package]]
name = "turbopack-browser"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"indexmap 1.9.3",
@ -7216,7 +7248,7 @@ dependencies = [
[[package]]
name = "turbopack-cli-utils"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"clap",
@ -7233,7 +7265,7 @@ dependencies = [
[[package]]
name = "turbopack-core"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"async-recursion",
@ -7262,7 +7294,7 @@ dependencies = [
[[package]]
name = "turbopack-css"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"indexmap 1.9.3",
@ -7289,7 +7321,7 @@ dependencies = [
[[package]]
name = "turbopack-dev-server"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"async-compression",
@ -7325,7 +7357,7 @@ dependencies = [
[[package]]
name = "turbopack-ecmascript"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"async-trait",
@ -7360,7 +7392,7 @@ dependencies = [
[[package]]
name = "turbopack-ecmascript-hmr-protocol"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"serde",
"serde_json",
@ -7371,7 +7403,7 @@ dependencies = [
[[package]]
name = "turbopack-ecmascript-plugins"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"async-trait",
@ -7395,7 +7427,7 @@ dependencies = [
[[package]]
name = "turbopack-ecmascript-runtime"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"indoc",
@ -7411,7 +7443,7 @@ dependencies = [
[[package]]
name = "turbopack-env"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"indexmap 1.9.3",
@ -7427,7 +7459,7 @@ dependencies = [
[[package]]
name = "turbopack-image"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"base64 0.21.4",
@ -7446,7 +7478,7 @@ dependencies = [
[[package]]
name = "turbopack-json"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"serde",
@ -7461,7 +7493,7 @@ dependencies = [
[[package]]
name = "turbopack-mdx"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"mdxjs",
@ -7476,7 +7508,7 @@ dependencies = [
[[package]]
name = "turbopack-node"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"async-stream",
@ -7510,7 +7542,7 @@ dependencies = [
[[package]]
name = "turbopack-nodejs"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"indexmap 1.9.3",
@ -7530,7 +7562,7 @@ dependencies = [
[[package]]
name = "turbopack-resolve"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"indexmap 1.9.3",
@ -7548,7 +7580,7 @@ dependencies = [
[[package]]
name = "turbopack-static"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"serde",
@ -7564,7 +7596,7 @@ dependencies = [
[[package]]
name = "turbopack-swc-utils"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"swc_core",
"turbo-tasks",
@ -7572,10 +7604,29 @@ dependencies = [
"turbopack-core",
]
[[package]]
name = "turbopack-trace-server"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"either",
"flate2",
"indexmap 1.9.3",
"itertools 0.10.5",
"postcard",
"rustc-demangle",
"serde",
"serde_json",
"tungstenite 0.21.0",
"turbopack-trace-utils",
"zstd",
]
[[package]]
name = "turbopack-trace-utils"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"crossbeam-channel",
@ -7591,7 +7642,7 @@ dependencies = [
[[package]]
name = "turbopack-wasm"
version = "0.1.0"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240508.4#adfb5990c9c65e831d8c064337f25d96bf51d1a8"
source = "git+https://github.com/vercel/turbo.git?tag=turbopack-240513.1#cc565e86be3506bc80592813a192217a8cc5b0c1"
dependencies = [
"anyhow",
"indexmap 1.9.3",
@ -8329,7 +8380,7 @@ dependencies = [
"getrandom",
"heapless",
"hex",
"http",
"http 0.2.11",
"js-sys",
"lazy_static",
"libc",
@ -8903,6 +8954,34 @@ dependencies = [
"syn 2.0.58",
]
[[package]]
name = "zstd"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a"
dependencies = [
"zstd-safe",
]
[[package]]
name = "zstd-safe"
version = "7.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a"
dependencies = [
"zstd-sys",
]
[[package]]
name = "zstd-sys"
version = "2.0.10+zstd.1.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa"
dependencies = [
"cc",
"pkg-config",
]
[[package]]
name = "zune-core"
version = "0.4.12"

View file

@ -37,11 +37,11 @@ swc_core = { version = "0.90.33", features = [
testing = { version = "0.35.22" }
# Turbo crates
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240508.4" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240513.1" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240508.4" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240513.1" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240508.4" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240513.1" }
# General Deps

View file

@ -58,6 +58,8 @@ pub mod next_api;
pub mod parse;
pub mod transform;
#[cfg(not(target_arch = "wasm32"))]
pub mod turbo_trace_server;
#[cfg(not(target_arch = "wasm32"))]
pub mod turbopack;
#[cfg(not(target_arch = "wasm32"))]
pub mod turbotrace;

View file

@ -1,4 +1,4 @@
use std::{path::PathBuf, sync::Arc, time::Duration};
use std::{path::PathBuf, sync::Arc, thread, time::Duration};
use anyhow::{anyhow, bail, Context, Result};
use napi::{
@ -290,12 +290,22 @@ pub async fn project_new(
.context("Unable to create .next directory")
.unwrap();
let trace_file = internal_dir.join("trace.log");
let trace_writer = std::fs::File::create(trace_file).unwrap();
let trace_writer = std::fs::File::create(trace_file.clone()).unwrap();
let (trace_writer, guard) = TraceWriter::new(trace_writer);
let subscriber = subscriber.with(RawTraceLayer::new(trace_writer));
let guard = ExitGuard::new(guard).unwrap();
let trace_server = std::env::var("NEXT_TURBOPACK_TRACE_SERVER").ok();
if trace_server.is_some() {
thread::spawn(move || {
turbopack_binding::turbopack::trace_server::start_turbopack_trace_server(
trace_file,
);
});
println!("Turbopack trace server started. View trace at https://turbo-trace-viewer.vercel.app/");
}
subscriber.init();
Some(guard)

View file

@ -0,0 +1,7 @@
use std::path::PathBuf;
#[napi]
pub fn start_turbopack_trace_server(path: String) {
let path_buf = PathBuf::from(path);
turbopack_binding::turbopack::trace_server::start_turbopack_trace_server(path_buf);
}

View file

@ -55,6 +55,7 @@ turbopack-binding = { workspace = true, features = [
"__turbopack_image",
"__turbopack_node",
"__turbopack_trace_utils",
"__turbopack_trace_server",
] }
turbo-tasks = { workspace = true }

View file

@ -200,7 +200,7 @@
"@types/ws": "8.2.0",
"@vercel/ncc": "0.34.0",
"@vercel/nft": "0.26.4",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240508.4",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240513.1",
"acorn": "8.5.0",
"amphtml-validator": "1.0.35",
"anser": "1.4.9",

View file

@ -383,4 +383,19 @@ program
})
.usage('[directory] [options]')
const internal = program
.command('internal')
.description(
'Internal debugging commands. Use with caution. Not covered by semver.'
)
internal
.command('turbo-trace-server')
.argument('[file]', 'Trace file to serve.')
.action((file) => {
return import('../cli/internal/turbo-trace-server.js').then((mod) =>
mod.startTurboTraceServerCli(file)
)
})
program.parse(process.argv)

View file

@ -138,7 +138,7 @@ let lastNativeBindingsLoadErrorCode:
| 'unsupported_target'
| string
| undefined = undefined
let nativeBindings: any
let nativeBindings: Binding
let wasmBindings: any
let downloadWasmPromise: any
let pendingBindings: any
@ -158,21 +158,21 @@ export interface Binding {
stream: any
get: any
}
mdx: {
compile: any
compileSync: any
}
createProject: (
options: ProjectOptions,
turboEngineOptions?: TurboEngineOptions
) => Promise<Project>
startTurbopackTraceServer: (path: string) => void
}
mdx: {
compile: any
compileSync: any
}
minify: any
minifySync: any
transform: any
transformSync: any
parse: any
parseSync: any
getTargetTriple(): string | undefined
@ -775,7 +775,10 @@ function rustifyEnv(env: Record<string, string>): RustifiedEnv {
}
// TODO(sokra) Support wasm option.
function bindingToApi(binding: any, _wasm: boolean) {
function bindingToApi(
binding: any,
_wasm: boolean
): Binding['turbo']['createProject'] {
type NativeFunction<T> = (
callback: (err: Error, value: T) => void
) => Promise<{ __napiType: 'RootTask' }>
@ -1217,10 +1220,10 @@ function bindingToApi(binding: any, _wasm: boolean) {
}
}
async function createProject(
options: ProjectOptions,
turboEngineOptions: TurboEngineOptions
) {
const createProject: Binding['turbo']['createProject'] = async (
options,
turboEngineOptions
) => {
return new ProjectImpl(
await binding.projectNew(
await rustifyProjectOptions(options),
@ -1278,9 +1281,6 @@ async function loadWasm(importPath = '') {
? bindings.parse(src.toString(), options)
: Promise.resolve(bindings.parseSync(src.toString(), options))
},
parseSync(src: string, options: any) {
return bindings.parseSync(src.toString(), options)
},
getTargetTriple() {
return undefined
},
@ -1510,6 +1510,12 @@ function loadNative(importPath?: string) {
},
},
createProject: bindingToApi(customBindings ?? bindings, false),
startTurbopackTraceServer: (traceFilePath) => {
Log.warn(
'Turbopack trace server started. View trace at https://turbo-trace-viewer.vercel.app/'
)
;(customBindings ?? bindings).startTurbopackTraceServer(traceFilePath)
},
},
mdx: {
compile: (src: string, options: any) =>

View file

@ -0,0 +1,6 @@
import { loadBindings } from '../../build/swc'
export async function startTurboTraceServerCli(file: string) {
let bindings = await loadBindings()
bindings.turbo.startTurbopackTraceServer(file)
}

View file

@ -128,7 +128,7 @@ importers:
version: 6.1.2(@types/jest@29.5.5)(jest@29.7.0)
'@testing-library/react':
specifier: ^15.0.5
version: 15.0.5(react-dom@19.0.0-beta-4508873393-20240430)(react@19.0.0-beta-4508873393-20240430)
version: 15.0.7(@types/react@18.2.74)(react-dom@19.0.0-beta-4508873393-20240430)(react@19.0.0-beta-4508873393-20240430)
'@types/busboy':
specifier: 1.5.3
version: 1.5.3
@ -1076,8 +1076,8 @@ importers:
specifier: 0.26.4
version: 0.26.4
'@vercel/turbopack-ecmascript-runtime':
specifier: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240508.4
version: '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240508.4'
specifier: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240513.1
version: '@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240513.1'
acorn:
specifier: 8.5.0
version: 8.5.0
@ -6757,6 +6757,7 @@ packages:
/@swc/core@1.5.0(@swc/helpers@0.5.11):
resolution: {integrity: sha512-fjADAC5gOOX54Rpcr1lF9DHLD+nPD5H/zXLtEgK2Ez3esmogT+LfHzCZtUxqetjvaMChKhQ0Pp0ZB6Hpz/tCbw==}
engines: {node: '>=10'}
deprecated: Mac OS installation is broken
requiresBuild: true
peerDependencies:
'@swc/helpers': ^0.5.0
@ -6832,8 +6833,8 @@ packages:
rewrite-imports: 1.4.0
dev: true
/@testing-library/dom@10.0.0:
resolution: {integrity: sha512-PmJPnogldqoVFf+EwbHvbBJ98MmqASV8kLrBYgsDNxQcFMeIS7JFL48sfyXvuMtgmWO/wMhh25odr+8VhDmn4g==}
/@testing-library/dom@10.1.0:
resolution: {integrity: sha512-wdsYKy5zupPyLCW2Je5DLHSxSfbIp6h80WoHOQc+RPtmPGA52O9x5MJEkv92Sjonpq+poOAtUKhh1kBGAXBrNA==}
engines: {node: '>=18'}
dependencies:
'@babel/code-frame': 7.22.5
@ -6876,15 +6877,20 @@ packages:
redent: 3.0.0
dev: true
/@testing-library/react@15.0.5(react-dom@19.0.0-beta-4508873393-20240430)(react@19.0.0-beta-4508873393-20240430):
resolution: {integrity: sha512-ttodVWYA2i2w4hRa6krKrmS1vKxAEkwDz34y+CwbcrbZUxFzUYN3a5xZyFKo+K6LBseCRCUkwcjATpaNn/UsIA==}
/@testing-library/react@15.0.7(@types/react@18.2.74)(react-dom@19.0.0-beta-4508873393-20240430)(react@19.0.0-beta-4508873393-20240430):
resolution: {integrity: sha512-cg0RvEdD1TIhhkm1IeYMQxrzy0MtUNfa3minv4MjbgcYzJAZ7yD0i0lwoPOTPr+INtiXFezt2o8xMSnyHhEn2Q==}
engines: {node: '>=18'}
peerDependencies:
'@types/react': 18.2.74
react: 19.0.0-beta-4508873393-20240430
react-dom: 19.0.0-beta-4508873393-20240430
peerDependenciesMeta:
'@types/react':
optional: true
dependencies:
'@babel/runtime': 7.22.5
'@testing-library/dom': 10.0.0
'@testing-library/dom': 10.1.0
'@types/react': 18.2.74
'@types/react-dom': 18.2.23
react: 19.0.0-beta-4508873393-20240430
react-dom: 19.0.0-beta-4508873393-20240430(react@19.0.0-beta-4508873393-20240430)
@ -7717,7 +7723,7 @@ packages:
'@typescript-eslint/types': 6.14.0
'@typescript-eslint/typescript-estree': 6.14.0(typescript@5.3.3)
eslint: 8.56.0
semver: 7.6.0
semver: 7.5.4
transitivePeerDependencies:
- supports-color
- typescript
@ -9788,18 +9794,27 @@ packages:
/color-name@1.1.4:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
/color-string@1.5.4:
resolution: {integrity: sha512-57yF5yt8Xa3czSEW1jfQDE79Idk0+AkN/4KWad6tbdxUmAs3MvjxlWSWD4deYytcRfoZ9nhKyFl1kj5tBvidbw==}
dependencies:
color-name: 1.1.4
simple-swizzle: 0.2.2
dev: true
/color-string@1.9.1:
resolution: {integrity: sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==}
requiresBuild: true
dependencies:
color-name: 1.1.4
simple-swizzle: 0.2.2
dev: false
optional: true
/color@3.1.3:
resolution: {integrity: sha512-xgXAcTHa2HeFCGLE9Xs/R82hujGtu9Jd9x4NW3T34+OMs7VoPsjwzRczKHvTAHeJwWFwX5j15+MgAppE8ztObQ==}
dependencies:
color-convert: 1.9.3
color-string: 1.9.1
color-string: 1.5.4
dev: true
/color@4.2.3:
@ -12190,7 +12205,7 @@ packages:
glob-parent: 5.1.2
globals: 13.19.0
ignore: 4.0.6
import-fresh: 3.3.0
import-fresh: 3.2.1
imurmurhash: 0.1.4
is-glob: 4.0.3
js-yaml: 3.14.1
@ -14353,6 +14368,14 @@ packages:
resolve-from: 3.0.0
dev: true
/import-fresh@3.2.1:
resolution: {integrity: sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==}
engines: {node: '>=6'}
dependencies:
parent-module: 1.0.1
resolve-from: 4.0.0
dev: true
/import-fresh@3.3.0:
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
engines: {node: '>=6'}
@ -15268,7 +15291,7 @@ packages:
'@babel/parser': 7.22.5
'@istanbuljs/schema': 0.1.2
istanbul-lib-coverage: 3.2.0
semver: 7.6.0
semver: 7.5.4
transitivePeerDependencies:
- supports-color
dev: true
@ -15977,7 +16000,7 @@ packages:
jest-util: 29.7.0
natural-compare: 1.4.0
pretty-format: 29.7.0
semver: 7.6.0
semver: 7.5.4
transitivePeerDependencies:
- supports-color
dev: true
@ -18952,7 +18975,7 @@ packages:
is-interactive: 1.0.0
is-unicode-supported: 0.1.0
log-symbols: 4.1.0
strip-ansi: 6.0.1
strip-ansi: 6.0.0
wcwidth: 1.0.1
dev: true
@ -22513,13 +22536,13 @@ packages:
dependencies:
lru-cache: 6.0.0
/semver@7.6.0:
resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==}
/semver@7.6.2:
resolution: {integrity: sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==}
engines: {node: '>=10'}
hasBin: true
requiresBuild: true
dependencies:
lru-cache: 6.0.0
dev: false
optional: true
/send@0.17.1:
resolution: {integrity: sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==}
@ -22634,7 +22657,7 @@ packages:
dependencies:
color: 4.2.3
detect-libc: 2.0.3
semver: 7.6.0
semver: 7.6.2
optionalDependencies:
'@img/sharp-darwin-arm64': 0.33.3
'@img/sharp-darwin-x64': 0.33.3
@ -22714,7 +22737,6 @@ packages:
/simple-swizzle@0.2.2:
resolution: {integrity: sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==}
requiresBuild: true
dependencies:
is-arrayish: 0.3.2
@ -23361,7 +23383,6 @@ packages:
engines: {node: '>=8'}
dependencies:
ansi-regex: 5.0.1
dev: true
/strip-ansi@6.0.1:
resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}
@ -25464,7 +25485,7 @@ packages:
dependencies:
ansi-styles: 4.3.0
string-width: 4.2.3
strip-ansi: 6.0.1
strip-ansi: 6.0.0
/wrap-ansi@7.0.0:
resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
@ -25749,8 +25770,8 @@ packages:
/zwitch@2.0.4:
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
'@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240508.4':
resolution: {tarball: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240508.4}
'@gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240513.1':
resolution: {tarball: https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-240513.1}
name: '@vercel/turbopack-ecmascript-runtime'
version: 0.0.0
dependencies: