-
Notifications
You must be signed in to change notification settings - Fork 231
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
v2.x - do not mutate core-util-is module #423
Conversation
v2.x still support Node.js 0.8, and I think Object.create() is not present there. Can you address that? Overall I would concentrate your efforts in getting stream-browserify updated to v3.x as v2.x is ancient. |
test errors seem unrelated |
Does this apply to v3 as well? |
@mcollina thanks for the quick response! did a quick test:
|
v3.x does not mutate readable-stream/lib/_stream_readable.js Line 92 in edd8c2d
|
I agree, though I am not a maintainer on seems stream-browserify CI expects 0.8 support here is a relevant browserify land stuff |
@mcollina sorry to bring this ancient maintenance task upon you but it would unblock me on my quest to improve the security of open source projects. browserify's technical debt should not be your burden to bear. I will attempt to push through a breaking change on their end for streams@3 I humbly ask for your time in landing this 2.x patch |
@mcollina seems like the CI tries to install npm v6 which is not supported by node v4 |
0b304ad
to
3ce2a4d
Compare
@mcollina Resolved the CI issues that were already present in the |
It would be great to land this, and make the transition from v2 to v3 easier for people by reducing the delta between them. |
@ljharb from an API perspective, readable-stream v2 is a cut of the stream module from Given the massive adoption of new ES5 and ES6 features in Node core, it has been deemed too hard for the current maintainers to ship support for IE < 11 and old nodes in v3: making the test harness “pass” with polyfills of new JS features was gargantuan with very little benefit. We are of course happy to take PRs that improve that situation. (I’m currently on vacation, I’ll land this as soon as I can). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
released as v2.3.7. |
report
v2.x modifes the exports of
core-util-is
v2.x is still used by
browserify
's viastream-browserify
The replacements inserted by the build process include some workaround for
util
andinherits
. This seems to be an unintentional modification of thecore-util-is
.readable-stream/lib/_stream_readable.js
Lines 66 to 69 in b3cf9b1
fix
The fix uses
Object.create(...)
to create a new object with thecore-util-is
module.exports set as its prototype. This means all the content of the original module.exports is exposed but the object can be decorated without mutatingcore-util-is
.I originally used
Object.assign({}, ...)
butObject.create
has even wider support.platform support details
Object.create
(ES5)Object.assign
(ES6)context:
I'm working on a set of tools to help defend against software supplychain attacks. One of the imposed limitations is that you cannot modify the module.exports of a module from another package.
readable-stream@2.x
is one of the only packages I've found that breaks this limitation.readable-stream@3.x
has such issue.