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

Refactor preprocessors to work with addons. #1030

Merged

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Jun 14, 2014

  • Create plugin subclasses to allow usage of inheritance, but still use custom toTree methods.
  • Make preprocessJS defer to the plugins toTree method (allows plugins to require from their own node_modules folder).
  • Make preprocessTemplates defer to the plugins toTree method (allows plugins to require from their own node_modules folder).

These changes allow addons to add their own preprocessors during their included hook.

Please review the following for implementation details on the addon side:

* Create plugin subclasses to allow usage of inheritance, but still use
  custom `toTree` methods.
* Make `preprocessJS` defer to the plugins `toTree` method
  (allows plugins to require from their own node_modules folder).
* Make `preprocessTemplates` defer to the plugins `toTree` method
  (allows plugins to require from their own node_modules folder).

These changes allow addons to add their own preprocessors during their `included` hook.

Please review the following for implementation details on the addon
side:

* [ember-cli-esnext](https://github.com/rjackson/ember-cli-esnext/blob/master/index.js)
* [sample app](rwjblue/_____ember-cli-test@4391e62)

function Registry(plugins, app) {
this.registry = {};
this.availablePlugins = plugins;
this.app = app;
this.pluginTypes = {
'js': JavascriptPlugin,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should aim to suppose multiple plugins per type, so people refactoring from coffee -> js can do so. My quick skim implies this isn't ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not supported by this PR, but it isn't impacted by it either (we didn't previously support it).

IMHO, I can add that as a refactoring after my round of addon stuff is done...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added #1033 so we don't loose track.

stefanpenner added a commit that referenced this pull request Jun 14, 2014
…sure

Refactor preprocessors to work with addons.
@stefanpenner stefanpenner merged commit 9032745 into ember-cli:master Jun 14, 2014
@stefanpenner stefanpenner deleted the plugin-refactor-and-addon-exposure branch June 14, 2014 19:17
rwjblue added a commit that referenced this pull request Jun 14, 2014
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

Successfully merging this pull request may close these issues.

2 participants