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

Remove explicit util dependency. #36

Closed
wants to merge 1 commit into from

Conversation

goto-bus-stop
Copy link
Member

@goto-bus-stop goto-bus-stop commented Jun 20, 2018

assert depended on the userland util module rather than browserify's
builtin, which could cause two different versions of util could be
included in bundles, if browserify's version doesn't exactly match
assert's dependency.

Since util is builtin in Node and in bundlers, we can safely use it
instead of explicitly depending on it.

@calvinmetcalf
Copy link
Collaborator

yeah any idea why we aren't using the browserify util ?

@goto-bus-stop
Copy link
Member Author

no clue. i think we should use the builtin instead, i take it you do too? i'll update the PR.

`assert` depended on the userland `util` module rather than browserify's
builtin, which could cause two different versions of `util` could be
included in bundles, if browserify's version doesn't exactly match
`assert`'s dependency.

Since `util` is builtin in Node and in bundlers, we can safely use it
instead of explicitly depending on it.
@goto-bus-stop goto-bus-stop changed the title Update to util v0.11.0. Remove explicit util dependency. Jun 20, 2018
@calvinmetcalf
Copy link
Collaborator

well this is me trying to remember why it was done in the first place, there could have been a reason

@goto-bus-stop
Copy link
Member Author

ah, i see 😅 the commit that introduced it doesn't have that much context: ea3de89

i suppose the point is to guarantee behaviour in assert regardless of the node version on which it is run—most people won't be running this module in node tho.

@goto-bus-stop
Copy link
Member Author

@calvinmetcalf does this seem ok? I can't personally think of a reason not to do it. I'd like to upgrade the util shim in browserify to add support for util.promisify/callbackify, it would be nice to not include two versions of that shim in user bundles if both require('assert') and require('util') are used.

@jfirebaugh
Copy link

What if I want to require('assert') but I'm using some bundler that's not browserify? Won't removing the dependency from package.json break that use case?

@goto-bus-stop
Copy link
Member Author

that's a fair point, in webpack 5 and some other default configs node shims aren't included by default. i didn't think of the case where you manually install assert to be able to require it. i think the best thing to do in this pr will be to update to ^0.11.0 then

@BridgeAR
Copy link
Member

BridgeAR commented May 6, 2019

It's probably hard to figure this out for the browser. If we are would be able to tree shake after running some code, it would be possible to run some feature tests and only load util if the features are not supported. That's likely too late though.

@BridgeAR
Copy link
Member

BridgeAR commented May 6, 2019

Should this stay upon?

@goto-bus-stop
Copy link
Member Author

no lets use the newer version from #44

@goto-bus-stop goto-bus-stop deleted the util-11 branch May 6, 2019 18:47
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.

None yet

4 participants