luabundle icon indicating copy to clipboard operation
luabundle copied to clipboard

Watch for changes.

Open jamestalmage opened this issue 3 years ago • 4 comments

Watch the base file, as well as all resolved files for changes, and re-bundle. Useful for building hot-reload tooling.

jamestalmage avatar Oct 26 '20 04:10 jamestalmage

I'd probably say this one is a little bit out of scope for this core library; although it's definitely in scope for https://github.com/Benjamin-Dobell/luabundler.

My ideal solution would be a small luabundle-watch package that takes a Lua search path and a list of module names. It'd watch for changes in resolved files as well as for the creation of new files that would be resolved instead of the existing resolved files (higher priority in the search path).

Additionally, it'd take the same proposed resolve callback as luabundle itself https://github.com/Benjamin-Dobell/luabundle/issues/4

I'll leave this issue open though as a general issue to track any changes to luabundle that may be required to best facilitate a simple integration.

Benjamin-Dobell avatar Oct 26 '20 05:10 Benjamin-Dobell

Yes. A separate module would be entirely fine. I wouldn't want it bundled into luabundler though. I intend to consume this module directly.

I think a low-friction way to solve this would be to provide a lower level API than bundle / bundleString. Expose a completion callback that consumers takeover from here.

jamestalmage avatar Oct 26 '20 13:10 jamestalmage

I'm not yet in dire need of this functionality, and most of me spare time at the moment is taken up by development of Luanalysis.

So if you're keen to work on this, then I'll very happily merge PRs that introduce the necessary extension points and/or additional APIs.

Benjamin-Dobell avatar Oct 26 '20 13:10 Benjamin-Dobell

For sure. Happy to.

Luanalysis is fantastic, BTW.

jamestalmage avatar Oct 26 '20 15:10 jamestalmage