request/request-promise

Use any-promise?

knpwrs opened this issue · 8 comments

Do you think it would make sense to use any-promise for this library? While I personally *love Bluebird, I don't see any Bluebird-specific functionality being used and this would allow for people to pick their own Promise library (or go native).

I noticed that bluebird-cls is included as a dependency, but continuation-local-storage is a dev dependency. Maybe, if this library were to go the route of using any-promise, it would make sense to move bluebird and bluebird-cls to devDependencies for testing purposes and then either move the require of bluebird-cls to a test or gate it off using process.env.NODE_ENV !== "production" so it could be trimmed out with something like Envify.

Open to hearing your thoughts.

Good pointer @KenPowers ! We were already discussing in issue #65 how to move forward considering that more and more people will want to switch to native promises. any-promise could be the perfect solution. I'll look into it.

BTW, cls-bluebird is a dependency that is only used if you call rp.bindCLS(ns). Otherwise the library is not even required. Of course if we choose the approach to allow users to inject their preferred promise library then cls-bluebird doesn't need to be a dependency anymore.

I mentioned in #65 that native-or-bluebird could also be a consideration.

we deprecated native-or-bluebird in favor of any-promise

Thanks for the info @jonathanong ! I guess it is time that I start working on the new Request-Promise version.

would also be nice to not include bluebird as a dependency, especially because the current version is out of date. i'm a stickler for duplicate dependencies in my tree :)

Agreed, @jonathanong. When any-promise will be introduced the user has to install the preferred promise library herself - if not only using native promises.

Bluebird is still much faster than native promises and I've run into cases where this was an issue with request myself (obviously biased as a bluebird person though), for the very least you should wait until v8 5.1 lands.

Also note, bluebird still has much easier to debug semantics :)

Hey buddies, I just released request-promise@4.0.0 and along with it request-promise-native and request-promise-any.

All three libraries share the same core and will be maintained in parallel. The migration is straight forward so feel free to choose the Promise implementation you like best.

Thanks everyone for contributing to this discussion. Cheers!