With jquery very slowly being phased out you get into more and more situations where library X will run with either jquery or zepto.js (but at least one is required).

No package managers that I can think of however allow you to express dependencies like this. If I was to propose this feature to - say - bower, is there precedent for how it might look?

  • Seems like it would be off topic on SO as there isn't really a correct answer and its more of a general question about programming. Why do you think its off topic? – George Mauer Feb 19 '14 at 16:11
  • Better try to ask such questions on softwarerecs.stackexchange.com – Doc Brown Jan 10 '15 at 9:25

dpkg / APT has supported this for ages.

There are two mechanisms for this. One is alternate dependencies by simply declaring the dependency like this:

Depends: jquery | zeptojs

You will declare that the package depends on either jquery or zepto.js.

The other mechanism is Virtual Packages. A package can declare that it Provides a virtual package and then other packages can depend on that virtual package.

For example, both the jquery package and the zeptojs package can declare that they provide the jquery-api virtual package, and then your app can depend on jquery-api. This has the added advantage that if in the future a third new JQuery-compatible library appears in the market, only the author of that package has to put a Provides: jquery-api line in his package description. You don't have to change your app and it will just work with the new library.

In your app:

Depends: jquery-api

In JQuery:

Provides: jquery-api

In Zepto.JS:

Provides: jquery-api

In the brand-new yet-to-be-written awesome new JQuery replacement:

Provides: jquery-api
  • oh awesome. Thanks, glad to know the terminology for this as well. – George Mauer Feb 19 '14 at 20:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.