-
Notifications
You must be signed in to change notification settings - Fork 36
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
file changed event socket api #147
Comments
Hi there, Take all answers lightly. It's been a little while since I worked on this project and my working memory is pretty poor anyway. In terms of message format, there's really two "formats" that it currently supports. The new one I was playing with and the original one that @capaj had. Ultimately they both are just given to fileChanged which expects Once we know the specific module that changed, we search the SystemJS module registry (loaded modules) to find any files that depend on the changed one in any way and delete them. We then run a simple To answer your specific questions. Currently
Ultimately I decided that the best place for more complicated computation and scenarios was in the file watcher lib itself. That's what I was trying to achieve with systemjs-tools. Not only would it be able to calculate this, but also handle caching of these modules, precompile them so that the browser didn't have to, sending over file contents (as you suggested), to save on latency, compile error messages and all that good stuff. If you're working on a file watcher, you might have luck with that project. And perhaps if it takes your fancy might be able to continue with some of the features I haven't gotten to. Fair warning though, I'm probably not going to be working on these projects in the future. My professional life as taken be to other places and I don't have time to work on these as I would have liked. |
On another note, I noticed your bio mentioned you were based in Surrey. I've recently moved to Guildford. If you ever decide you want to push any of these projects further, I'd be happy to explain things in person. |
Thanks for the explanation.
Side Note: I am thinking very much long the lines of a modular CMS here, where different modules can be configured on different pages. So in the above scenario, when the file watcher detects a change to the file
Lastly, if I am making a complete guess about what Foo --> Bar --> Baz
So.. thinking about it, the entry point cannot be determined by static analysis of the entire dependency graph alone, you also need to know which modules are actually "in use" to know how much of the dependency graph is actually impacted? Does this sound right? If so, when /Baz is changes, how does my file watcher know what to poulate My last thoughts are that I think I could interop with System.JS builder on the server to compute the Entries for a changed file, and I could probably cache that information with the file so that when it changes in future, I don't need to re-run the trace. However if caching, I'd have to invalidate the cache whenever the dependency tree changed and I am not sure how I could detect that event off the back of a file edit on the server side.. Sorry - I digress! |
Hello,
Suppose I am writing my own file watcher, and its listening on a socket. When the client connects, what are the format of the messages I need to trigger a reload?
In both cases system.js config knows the modules / bundle mapping.
Does this mean all I need to send over the socket is the changed file path and the hmr system will know in the case of bundle.js that it needs to reload all bundled modules? Or do I need to work out which modules have changed when bundle.js is modified and send accross just the module names?
Do I also need to push the new file contents itself to save a roundtrip?
Many Thanks
The text was updated successfully, but these errors were encountered: