Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turbopack: Implement HMR in next-api #54772

Merged
merged 31 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
dd650bf
Setup basic pages websocket
jridgewell Aug 19, 2023
64c5959
Setup basic app websocket
jridgewell Aug 19, 2023
07c3a1c
Keep react-dev-overlay remap in turbo-dev dev server
jridgewell Aug 21, 2023
0cdd01a
Unify page bootstrapping
jridgewell Aug 23, 2023
6ba827e
Make turbopack HMR agnostic to websocket
jridgewell Aug 23, 2023
4897c28
Unify addMessageListener with turbopack
jridgewell Aug 23, 2023
b7663a8
Allow subscriptions to be broken mid iteration
jridgewell Aug 23, 2023
f46d016
Wire up pre-compiled turbopack dev runtime
jridgewell Aug 23, 2023
22ef3a6
tmp
jridgewell Aug 25, 2023
d03a933
Implement hotReloader.send
jridgewell Aug 25, 2023
cffc1a4
Remove HRM setup from app pages
jridgewell Aug 25, 2023
30e3077
Implement middleware changed
jridgewell Aug 25, 2023
3dddb0d
Implement serverOnlyChanges and serverComponentChanges
jridgewell Aug 26, 2023
d9b906e
Implement reloadPage
jridgewell Aug 26, 2023
ba5d601
Pin to latest turbopack
jridgewell Aug 29, 2023
44354eb
Fix changed subscriptions
jridgewell Aug 29, 2023
a1c3327
Don't compile turbopack-ecmascript-runtime
jridgewell Aug 29, 2023
2d8787d
Revert "Don't compile turbopack-ecmascript-runtime"
jridgewell Aug 29, 2023
d847936
Compile dev runtime TS into JS
jridgewell Aug 29, 2023
e374402
Lint
jridgewell Aug 30, 2023
8e099a0
Update sass loader for some reason
jridgewell Aug 30, 2023
b478dfe
Our Eslint setup sucks
jridgewell Aug 30, 2023
80864bd
update turbopack
sokra Aug 30, 2023
f6d2e25
update changed APIs
sokra Aug 30, 2023
9857ae6
Merge remote-tracking branch 'origin/canary' into jrl-hmr
sokra Aug 30, 2023
7e5e581
Merge branch 'sokra/update-turbopack9' into jrl-hmr
sokra Aug 30, 2023
5a19faf
remove turbopack runtime from compiled
sokra Aug 30, 2023
36578f7
Merge remote-tracking branch 'origin/canary' into sokra-jrl/hmr
sokra Aug 30, 2023
e339cc6
fix test case
sokra Aug 30, 2023
d5b5bb6
fix dependencies
sokra Aug 30, 2023
b3c2c63
fix import
sokra Aug 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 37 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ swc_core = { version = "0.79.70" }
testing = { version = "0.33.24" }

# Turbo crates
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230825.2" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230829.2" }
# [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-230825.2" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230829.2" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230825.2" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230829.2" }

# General Deps

Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/next-api/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,6 @@ impl Endpoint for MiddlewareEndpoint {

#[turbo_tasks::function]
fn client_changed(self: Vc<Self>) -> Vc<Completion> {
Completion::new()
Completion::immutable()
}
}
2 changes: 1 addition & 1 deletion packages/next-swc/crates/next-api/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ impl Project {
Ok(self
.await?
.versioned_content_map
.get(self.client_root().join(identifier)))
.get(self.client_relative_path().join(identifier)))
}

#[turbo_tasks::function]
Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/next-core/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"check": "tsc --noEmit"
},
"dependencies": {
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-230825.2",
"@vercel/turbopack-node": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-node/js?turbopack-230825.2",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-230829.2",
"@vercel/turbopack-node": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-node/js?turbopack-230829.2",
"anser": "^2.1.1",
"css.escape": "^1.5.1",
"next": "*",
Expand Down
9 changes: 7 additions & 2 deletions packages/next-swc/crates/next-core/js/src/dev/client.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { connect } from '@vercel/turbopack-ecmascript-runtime/dev/client/hmr-client'
import { connectHMR } from '@vercel/turbopack-ecmascript-runtime/dev/client/websocket'
import {
connectHMR,
addMessageListener,
sendMessage,
} from '@vercel/turbopack-ecmascript-runtime/dev/client/websocket'
import { register, ReactDevOverlay } from '../overlay/client'

export function initializeHMR(options: { assetPrefix: string }) {
connect({
assetPrefix: options.assetPrefix,
addMessageListener,
sendMessage,
})
connectHMR({
assetPrefix: options.assetPrefix,
Expand Down
Loading