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

Cleanup entries API #82

Open
krisselden opened this issue Jun 3, 2016 · 15 comments
Open

Cleanup entries API #82

krisselden opened this issue Jun 3, 2016 · 15 comments
Assignees

Comments

@krisselden
Copy link
Contributor

Use a interface instead of exposing the entries pojo and migrate the ember-cli resolver to them to allow for alternate implementations of testing a module's presence or scanning modules.

@rwjblue
Copy link
Member

rwjblue commented Jun 3, 2016

The resolver itself uses an interface (see here) for this. FWIW, that interface combined with an override in the resolver makes testing various module registry combinations a breeze...

@rwjblue
Copy link
Member

rwjblue commented Jun 12, 2016

API's needed:

  • has
  • require
  • unsee
  • moduleIds
  • eachModuleId

@stefanpenner
Copy link
Contributor

We can deprecate requirejs.entries and move to something else that provides this sort of API.

@rwjblue
Copy link
Member

rwjblue commented Jun 12, 2016

I was thinking of implementing this similarly to how you implemented require in Ember itself.

import has from 'loader/has';
import require from 'loader/require';
import getModuleIds from 'loader/get-module-ids';
import eachModuleId from 'loader/each-module-id';
import {
  has,
  require,
  getModuleIds,
  eachModuleId
} from 'loader';

Then we can deprecate .entries, thoughts?

@krisselden
Copy link
Contributor Author

Can those just be loader? And we need to keep require for commonjs wrapping

@stefanpenner
Copy link
Contributor

stefanpenner commented Jun 13, 2016

Can those just be loader? And we need to keep require for commonjs wrapping

import { has } from 'loader'
import require from 'require';

?

@rwjblue
Copy link
Member

rwjblue commented Jun 13, 2016

@krisselden - I do not understand what you mean. Can you jot down your proposal in terms of import statements?

@rwjblue
Copy link
Member

rwjblue commented Jun 13, 2016

I see, we need import require from 'require'; so that we can give a special require per module (so they can do relative requires).

@stefanpenner
Copy link
Contributor

stefanpenner commented Jun 13, 2016

I see, we need import require from 'require'; so that we can give a special require per module (so they can do relative requires).

we already have this one, but loader/require seems legit.

@rwjblue
Copy link
Member

rwjblue commented Jun 13, 2016

👍

@rwjblue
Copy link
Member

rwjblue commented Jun 13, 2016

I believe the easiest thing to do would be to just add the define calls that we want in .clear here. This works for all except require itself, and that needs to be similar to this.

@rwjblue
Copy link
Member

rwjblue commented Apr 6, 2017

OK, discussed in person with @krisselden, and I think we are settling on the following API:

import {
  has,
  getIds,
  define,
  require,
  resolve
} from 'loader';

If there are no objections to the above, I'll try to get this going soon...

@rwjblue rwjblue self-assigned this Apr 6, 2017
@kratiahuja
Copy link
Collaborator

How about alias?

@rwjblue
Copy link
Member

rwjblue commented Apr 6, 2017

The current alias API is odd, I was thinking we could land the API above (which does expose some version of alias via define.alias) and then submit a separate PR for making alias accept a second arg (for target).

@kratiahuja
Copy link
Collaborator

Sounds perfect to me!

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

Successfully merging a pull request may close this issue.

4 participants