Skip to content
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

Notes for v2 #73

Closed
steelbrain opened this issue Oct 24, 2016 · 1 comment
Closed

Notes for v2 #73

steelbrain opened this issue Oct 24, 2016 · 1 comment

Comments

@steelbrain
Copy link
Owner

steelbrain commented Oct 24, 2016

Just writing these down so I don't forget

Main Components

These are going to be the main components of the v2 architecture

Resolvers

Resolvers will be responsible for resolving the path to a file based on relativity. They should be able to accept multiple module dirs and support live fs changes.

Loaders

Loaders will have the responsibility to process the raw contents of the files, even css or woff or something, and convert it into a js source, that automatically sets the contents to module.exports.

Loaders will also have the responsibility to tell pundle what others modules were required from it (only the ones where we can do it dynamic, like for js or coffee sources but NOT for less sources) as well as swap values in require to be usable in runtime

Transformers

Transformers will work in a way that they accept javascript and output javascript. Babel is an example use case of transformers.

Post-Transformers

Post-Transformers will work just like transformers, except after all transformers have been executed. UglifyJS is an example use case of transformers. Unlike transformers, these will not be executed on individual files but on the generated content.

Plugins

Everything else that does not modify the contents of the generated output will be a plugin. ESLint, NPM Installer and others could be counted as plugins.

Generators

Generators will be given the processed contents of each files and will be responsible for making output bundles. The default generator generates CommonJS style output.

Reporters

Reporters will be responsible for keeping the user aware of the status of the builds. For example, a reporter in pundle-dev could show the messages in browser, while the pundle CLI would show them in the terminal like this post

Other Notes to self

  • Make sure to split CLI into a separate package pundle-cli or something and make pundle an API only base package
  • Make sure to implement advance resolve config like aliases
  • Every component should have a this context that has a report() method, useful in cases like eslint
  • When this.resolve(path, ?from, ?cached) is called from a component, and the component is a resolver, make sure NOT to invoke that one again for that request until the existing request is fulfilled

TODO: Write more notes here

@steelbrain
Copy link
Owner Author

Done in Pundle v2Alpha1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant