alloc / cush

WIP module bundler 🎁
MIT License
0 stars 0 forks source link

Bundler hooks #16

Closed aleclarson closed 6 years ago

aleclarson commented 6 years ago

The virtual filesystem (Package objects and file objects) is owned by the bundler (not the bundles). In other words, all bundles use the same objects.

We need an API that lets "bundle plugins" hook into the filesystem when at least one bundle is using them. The main use case I have in mind is for loading plugin-specific configuration for each new Package object.

The hookPackages method does not fulfill this need in its current form, because it creates a function for every Bundle object. Package configuration would be loaded once per bundle that uses the plugin, which is undesirable.

aleclarson commented 6 years ago

It's easy enough to track which packages have had their configuration loaded by using a WeakMap object. Closing this for now.

aleclarson commented 5 years ago

Update: Packages are now created once per bundle, so loading a package's config files every time a bundle uses a package is unavoidable. And it's really no biggie. 😁