ef4 / ember-browserify

ember-cli addon for easily loading CommonJS packages from npm via browserify.
MIT License
172 stars 28 forks source link

Support hoisting to nearest host. #99

Closed nathanhammond closed 8 years ago

nathanhammond commented 8 years ago

ember-browserify currently does a one-level deep check in an attempt to find the host application, making it work in addons which directly descend from the host. This is incomplete. Addons can be nested infinitely deep and we need to recurse up to the host.

This code is extracted from Ember CLI.

Except for the one line added by ember-engines since the host is not always guaranteed to be the top level application. The host may also be the closest lazily-loaded engine.

This code is identical to the check which ember-engines uses to support importing.

Closes #92 and #93.

asakusuma commented 8 years ago

@nathanhammond I presume this has been tested on past and present versions of ember-cli? I noticed that your new approach is looking for the existence of different properties than before.

nathanhammond commented 8 years ago

app was previously either the addon or the host application. The host application always had an import method. app.app always refers to the parent in a nested addon, so we should directly use the .parent property which was introduced in 0.2.0

Related commit.

stefanpenner commented 8 years ago

I don't believe we want this. We need to mangle input names, and be sure we don't collide.

stefanpenner commented 8 years ago

@nathanhammond spoke about it, and we have come up with a solution. Going to pair on it.

stefanpenner commented 8 years ago

https://github.com/ef4/ember-browserify/pull/100 is our WIP