jspm / npm

NPM Location Service
19 stars 34 forks source link

Support npm scoped packages #12

Closed guybedford closed 9 years ago

guybedford commented 10 years ago

(See npm issue 5239)

markstickley commented 9 years ago

One of the key features (for me, at least) of scoped packages is the ability to direct requests for packages in a particular scope to a non-default registry.

Is that functionality that you would seek to replicate in jspm's support for npm scoped packages, or would you stick to just allowing the @scope/package syntax?

I'm undecided as to how I think it would work best as while automatically mapping a scope to a registry is conveient, jspm already has endpoints and so it would be confusing to say endpoint1:@scopePointingToEndpoint2/package. Would it try and get the package from endpoint1 or endpoint2?

guybedford commented 9 years ago

@markstickley I must admit I'm not that clued up on how scoped packages work in npm, but we do support endpoint redirects.

So you can have jspm install endpoint1:@scopePointingToendpoint2/package redirecting (with logic in endpoint1) to be equivalent to jspm install endpoint2:package.

An alternative would be to parse out scopes in package.json dependencies and do this upfront.

Appreciate your thoughts on this.

markstickley commented 9 years ago

@guybedford I think that actually the endpoint redirects option would be the best approach as it feels less hard-wired that way.

The only thing I'd point out is that (unless I'm misunderstanding npm scoped packages) the logic in endpoint1 that redirects jspm install endpoint1:@scopePointingToendpoint2/package should in fact make it equivalent to jspm install endpoint2:@scopePointingToendpoint2/package, the scoped package retaining the same scope on the custom/non-default package registry.

Hopefully this should mean that the only extra code required would be to support the scoped package name format @scope/package (if it's not already supported).

Incidentally, I can't find any docs on the endpoint redirects - am I looking in the wrong place?

guybedford commented 9 years ago

@markstickley interesting ok that may well well make sense. We could support multiple npm endpoints being set up for each registry, with the scoped packages as redirects. Would be interesting to have a model case to test this on.

The endpoint API documentation including how to do redirects is at https://github.com/jspm/jspm-cli/wiki/Endpoint-API.

guybedford commented 9 years ago

I haven't been able to test this personally, but any issues we can tackle in due course.

markstickley commented 9 years ago

I haven't had a chance to try it either but from your description it sounds like it's more likely to be something to do with nginx decoding the url before passing it on than an issue with jspm.

Does this sound like the sort of thing you're experiencing? http://stackoverflow.com/questions/20496963/avoid-nginx-decoding-query-parameters-on-proxy-pass-equivalent-to-allowencodeds

On 15 Dec 2014, at 10:26, Guy Bedford notifications@github.com wrote:

I haven't been able to test this personally, but any issues we can tackle in due course.

— Reply to this email directly or view it on GitHub.

guybedford commented 9 years ago

I was mainly referring to closing this issue, as opposed to a specific one. Is there anything we still need to tackle here?

markstickley commented 9 years ago

Not to my understanding...

On 15 Dec 2014, at 16:49, Guy Bedford notifications@github.com wrote:

I was mainly referring to closing this issue, as opposed to a specific one. Is there anything we still need to tackle here?

— Reply to this email directly or view it on GitHub.