interlockjs/interlock

Extensible runtime module resolution

divmain opened this issue · 0 comments

Plugins should be able to register "module providers". When a request occurs for an uninstalled module (identified by hash), the default behavior is to check the URLs hash and make a request for that script.

However, if a provider is registered, that provider will be called with two arguments, the moduleHash and the next callback. moduleHash is the hash string of the requested module. The next callback should be invoked by the provider if that provider is unable to fulfill the request. This next callback will invoke the next provider (if there is one), ultimately terminating with the default behavior (or an error, if that fails).

Providers should be invoked in order of their registration.

This should lead the way to caching mechanisms (like localStorage and IndexedDb) and a patch mechanism (to be implemented in interlock-patch).