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

Replace @ljharb/through with native solution #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kibertoad
Copy link

Considering that CI is only executed on Node 14, it can be implied that very old Node.js version are not supported by this library.

Therefore it it possible to benefit from using native Node.js functionality and remove the unnecessary dependency.

@kibertoad
Copy link
Author

@feross Any comments on this PR? Judging by emotes, there is a clear demand from the community for these kind of changes.

@kibertoad
Copy link
Author

@feross ping?..

@kibertoad
Copy link
Author

@feross If you don't believe that this PR is useful, can we get at least a comment stating so?..

@@ -2,7 +2,7 @@
var fs = require('fs')
var once = require('once')
var split = require('split')
var through = require('@ljharb/through')
var { Writable } = require('node:stream')
Copy link
Contributor

@ljharb ljharb Oct 7, 2024

Choose a reason for hiding this comment

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

use of destructuring, or node:, would be a breaking change (CI support has no bearing on what engines are supported; only engines.node, which defaults to *, does)

Suggested change
var { Writable } = require('node:stream')
var Writable = require('stream').Writable

also, Writable wasn't added until node 0.10, which technically would also be a breaking change and require an engines.node declaration to be added.

Copy link
Author

@kibertoad kibertoad Oct 7, 2024

Choose a reason for hiding this comment

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

chalk 4 requires node 10+, so older versions aren't supported already.
and CI for hostile is only running on Node 14, so there was no indication for old version support to begin with.

Copy link
Contributor

Choose a reason for hiding this comment

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

indeed you're right; 6d5d1c3 was a breaking change in a patch version.

Again, lack of CI coverage indicates nothing; engines.node combined with "what actually worked at one point within the major" is the indicator. In other words, chalk needs to be dropped to 3 or replaced, and CI coverage should be expanded.

Copy link
Author

Choose a reason for hiding this comment

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

@ljharb literally nobody complained over all this time, so looks like it's not a problem for anyone among real users of the library, so why fix something that isn't broken?

Copy link
Contributor

Choose a reason for hiding this comment

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

being semver-compliant requires adhering to principle, regardless of whether there's actual/reported breakage or not.

It's up to the maintainer, of course, whether they want to comply with semver or not - I'm just helpfully pointing out what that requires.

Copy link
Author

Choose a reason for hiding this comment

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

@feross what is your stance on this? if requested, I can do the obsolete Node compatibility changes in this PR, but it seems more reasonable for me to stay on Node 10+

@@ -33,7 +33,12 @@ exports.getFile = function (filePath, preserveFormatting, cb) {
cb = once(cb)
fs.createReadStream(filePath, { encoding: 'utf8' })
.pipe(split())
.pipe(through(online))
.pipe(new Writable({
write: (chunk, encoding, callback) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

as would arrow functions

Suggested change
write: (chunk, encoding, callback) => {
write: function (chunk, encoding, callback) {

Copy link
Author

Choose a reason for hiding this comment

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

see above, realistically hostile already requires node 10+ due to chalk usage

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.

2 participants