Skip to content

fix(serve): support serve hmr #26078

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

Merged
merged 14 commits into from
Oct 30, 2024
Merged

Conversation

HasanAlrimawi
Copy link
Contributor

This PR addresses issue #25600

Changes:
Updated fn has_hmr to check serve subcommand and return its hmr value if found, in order to run the worker in serve mode with hmr_runner. Thus the hmr event can be dispatched upon changes on the file served.

cli/worker.rs Outdated
@@ -415,7 +414,7 @@ impl CliMainWorker {

#[derive(Clone)]
pub struct CliMainWorkerFactory {
shared: Arc<SharedWorkerState>,
pub shared: Arc<SharedWorkerState>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these visibility changes needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No not at all, I used that while inspecting, I'll remove it soon.

@nathanwhit nathanwhit self-requested a review October 9, 2024 14:35
Comment on lines 49 to 52
.unwrap_or(WatchFlagsWithPaths {
hmr: false,
..Default::default()
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.unwrap_or(WatchFlagsWithPaths {
hmr: false,
..Default::default()
})
.map(|watch_flags| watch_flags.hmr).unwrap_or(false)

cli/worker.rs Outdated
@@ -121,7 +121,6 @@ pub struct CliMainWorkerOptions {
pub serve_port: Option<u16>,
pub serve_host: Option<String>,
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please revert this line?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this hasn't been reverted yet

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nathanwhit please take a look. I'm not sure this actually helps much - looks like HMR runner is still not wired up properly

@HasanAlrimawi
Copy link
Contributor Author

@nathanwhit
Could you please give it a look and let me know if any further work is needed?

@nathanwhit
Copy link
Member

Aside from that one whitespace change that should be reverted, LGTM

Copy link
Member

@nathanwhit nathanwhit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@nathanwhit nathanwhit merged commit 5f5ac40 into denoland:main Oct 30, 2024
17 checks passed
bartlomieju pushed a commit that referenced this pull request Nov 5, 2024
This PR addresses issue #25600 

Changes:
Updated `fn has_hmr` to check `serve` subcommand and return its hmr
value if found, in order to run the worker in serve mode with
hmr_runner. Thus the hmr event can be dispatched upon changes on the
file served.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants