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

src: Remove ES5/6 shim dependencies #15

Closed
wants to merge 1 commit into from
Closed

src: Remove ES5/6 shim dependencies #15

wants to merge 1 commit into from

Conversation

Raynos
Copy link

@Raynos Raynos commented Dec 19, 2019

This project is a pretty lightweight module and can be implemented
as a zero dependency library.

The actual implementation is basically 20 lines itself.

Since this module already depends on ES5 & global.Promise I
inlined the other 3 dependencies it has (all pretty trivial).

This makes this module zero dependency which makes it really
lightweight!

The motiviation for this is to simplify aws-sdk ;

Currently for aws-sdk; 50% of the transitive dependencies are
the dependencies of util.promisify itself ( 24 ). This is
quite a lot of weight.

Fixes #14

This project is a pretty lightweight module and can be implemented
as a zero dependency library.

The actual implementation is basically 20 lines itself.

Since this module already depends on ES5 & global.Promise I
inlined the other 3 dependencies it has (all pretty trivial).

This makes this module zero dependency which makes it really
lightweight!

The motiviation for this is to simplify `aws-sdk` ;

Currently for aws-sdk; 50% of the transitive dependencies are
the dependencies of `util.promisify` itself ( 24 ). This is
quite a lot of weight.
@Raynos Raynos mentioned this pull request Dec 19, 2019
@@ -19,11 +19,21 @@ var slice = Function.call.bind(Array.prototype.slice);
var concat = Function.call.bind(Array.prototype.concat);
var forEach = Function.call.bind(Array.prototype.forEach);

var hasSymbols = require('has-symbols')();
var hasSymbols = typeof global.Symbol !== 'function';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will cause it to pass on a symbol sham; the intention is to only have it be true for native symbols. (also, you inverted the logic, breaking it)

Suggested change
var hasSymbols = typeof global.Symbol !== 'function';
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';


var kCustomPromisifiedSymbol = hasSymbols ? Symbol('util.promisify.custom') : null;
var kCustomPromisifyArgsSymbol = hasSymbols ? Symbol('customPromisifyArgs') : null;

var getOwnPropertyDescriptors = function _getOwnPropertyDescriptors(obj) {
var out = {};
var keys = Object.keys(obj);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this means the implementation is reliant on nobody doing delete Object.keys

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(

@Raynos
Copy link
Author

Raynos commented Dec 19, 2019

Willfix.

@ljharb
Copy link
Owner

ljharb commented Dec 19, 2019

I just pushed up baa0cf6 which uses es-abstract's callBound helper for further robustness; i think that dep should remain regardless.

@Raynos Raynos closed this Dec 20, 2019
@Raynos
Copy link
Author

Raynos commented Dec 20, 2019

That dependency has more transitive deps then the ones I am removing. I don't think there's any point left.

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

Successfully merging this pull request may close these issues.

Too many dependencies :(
2 participants