-
-
Notifications
You must be signed in to change notification settings - Fork 979
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
Use npm's resolution algorithm #80
Conversation
Use npm's resolution algorithm
Just FYI the problem with this change is that you're going to be downloading an order of magnitude more JSON. e.g. for
vs.
Have you done benchmarks against this change? I suspect this will slow |
Aw man... that's true |
also a shame the registry isn't gzipping that. maybe we can add a check to only do the "optimized" route only for registry.npmjs.org and non-scoped packages... |
@rstacruz how hard would it be to make the
|
wouldn't it be better if it was automatically inferred for you? it's only supported for |
Well it's hard to say which registries support it and which don't. e.g. if GemFury starts implementing it, how do I tell the client to start using it? |
hm, fair i guess, maybe even an npm-style |
That would be rad. Anything to fallback to the faster downloads. |
The thing is that gem fury supports the undocumented requests (by proxy) for anything public. The ratio of private/public packages is pretty low in most cases so allowing gem fury to 404 and failing over to the npm style request then seems perfectly okay to me - faster even because of the reduced payload size for most responses (public packages). Maybe it would be better to always use the npm style resolution for dist tags (to avoid scope workarounds etc). And use the faster undocumented requests for everything else - allowing a 404 to result in a fallback to the npm style resolution. Sounds like a win-win to me :) Also if bandwidth is an issue, registries do etags properly so you could cache on disk like npm does and include the relevant etag in any subsequent requests - the resulting 304 will have no body! |
@misterbyrne, I've made your module resolution code the default method of finding packages. This is because the one we're using by default,
registry.npmjs.org/lodash/4.0.0
, is actually an undocumented endpoint (and hence not implemented by gemfury et al).This instead uses
registry.npmjs.org/lodash
.This has the following benefits:
expect a possible slight performance dip for smaller packages, but not by much.