Skip to content

Move live reload client code to new hot_reload_client.dart file #1732

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 6 commits into from
Aug 9, 2018

Conversation

samogot
Copy link
Contributor

@samogot samogot commented Aug 8, 2018

It is expected that client code will become complicated, so in separate
dart file it would be easier to test and maintain.

@samogot samogot requested review from jakemac53 and natebosch August 8, 2018 01:41
@googlebot googlebot added the cla: yes Google is happy with the PR contributors label Aug 8, 2018
@samogot samogot changed the title Create hot-reload client Move live reload client code to new hot_reload_client.dart file Aug 8, 2018
It is expected that client code will become complicated, so in separate
dart file it would be easier to test and maintain.
@samogot samogot force-pushed the create-hotreload-client branch from 13dfc7f to f8b1efc Compare August 8, 2018 17:19
location.reload();
};
}());
requirejs(['packages/build_runner/src/server/hot_reload_client.dart'])
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we should be relying on requirejs here... is there any other way we can handle this?

@@ -0,0 +1,3857 @@
// Generated by dart2js (full emitter, strong), the Dart to JavaScript compiler version: 2.0.0-dev.69.4.
Copy link
Member

Choose a reason for hiding this comment

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

we should check if there are other flags we should be using. --minify, maybe --omit-implicit-checks

ideally we should get this code size down

.gitignore Outdated
@@ -21,3 +21,6 @@ bazel-*
packages.bzl
BUILD
WORKSPACE

# Deps of checked-in dart2js generated code
*.dart.js.deps
Copy link
Contributor

@jakemac53 jakemac53 Aug 8, 2018

Choose a reason for hiding this comment

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

Lets be a bit more specific here, also see #1734 for the custom build script which we can update to also run on this new entrypoint.

@samogot samogot force-pushed the create-hotreload-client branch from b25e229 to e8a2e98 Compare August 9, 2018 16:32
@samogot samogot merged commit f8cd20b into hot-reload Aug 9, 2018
@samogot samogot deleted the create-hotreload-client branch August 9, 2018 20:51
samogot added a commit that referenced this pull request Aug 28, 2018
* Add assets digests handler (#1709)

This entry point will be used for hot reloading, in order to initially
retrieve digests of all assets, as build_runner might not know list of
all of them, unlike client.

* Emit useful information about build results (#1710)

Instead of just 'update' emit json with updated build results and its
digests

* Move live reload client code to new hot_reload_client.dart file (#1732)

It is expected that client code will become complicated, so in separate
dart file it would be easier to test and maintain.

* Implement basic hot reload (#1741)

Reload any changed modules without any specific order, then reload main
module and call main func to hopefully apply changes.

Still need to get module dependency graph to reload in topological order
and find correct ancessor chain where reloaded modules can be saved in
closures.

* Basic graph handling for hot reload (#1759)

We still lack handling situations when graph is dynamically updated
between reloads.

* Add rough graph changes handling by full page reload (#1763)

* Simplify module interface (#1764)

* Change HMR API to work with several libraries bundled in one module (#1765)

Fixes #1762

* Close Hot Reload listeners on exit (#1775)

Closes #1774

* Refactor and improve HMR code (#1770)

- Get rid of `roughLibraryKeyDecode` - use library path exposed from
  dart runtime now.
- Get load modules from cache directly and throw if it isn't loaded
  instead of using require.js and hoping that module already loaded and
  no network request would be done.
- Don't mess with `.ddc` extension in `build_runner` code - encapsulate
  all of it on build_web_compilers side.

Fixes #1760
Fixes #1762

* Finalize hot-reloading feature (#1773)

- Rename live-reload to hot-reload
- Add debug logging about reloading
- Add documentation
- Version bump and changelog

Fixes #1766

* Restore --live-reload option (#1778)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google is happy with the PR contributors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants