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

Add passthrough option, fixes #25, fixes gulpjs/gulp#840 #55

Merged
merged 2 commits into from
Feb 19, 2015

Conversation

UltCombo
Copy link
Contributor

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 97.46% when pulling b9629ea on UltCombo:passthrough into 318a983 on wearefractal:master.

@@ -46,7 +49,12 @@ function src(glob, opt) {
.pipe(getContents(options));
}

return outputStream.pipe(pass);
if (options.passthrough) {
var inputPass = through.obj();
Copy link
Member

Choose a reason for hiding this comment

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

var in an if condition should fail the linter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What linter? The project doesn't have JSCS, and JSHint has moved away from checking code style I believe. Anyway, should I move the var declarations to the top of their scope?

Copy link
Member

Choose a reason for hiding this comment

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

@UltCombo Yeah I think you can merge inputPass and pass into the same var as well

@yocontra
Copy link
Member

How does the ordering work? Does it wait for the parent to finish, then emit? Or is it just first come first serve

@UltCombo
Copy link
Contributor Author

@contra the PR uses merge-stream, so it is first come first served -- this is gulp-add-src's default. This is also why I'm using .some in some tests.

gulp-add-src also provides methods for prepend/append, but I don't know if those are worth adding to vinyl-fs -- users that need ordered streaming can still use gulp-add-src I believe.

I'm also a bit concerned that there is no deduping in their (and, consequently, our) stream merging logic. This is most likely a rare enough use case that can be addressed in the future in case such use cases actually surface.

@yocontra
Copy link
Member

@UltCombo I think we should support some form of ordering and deduplicaton

@UltCombo
Copy link
Contributor Author

@contra which form of ordering should we prefer (or should ordering be customizable)? Not sure about deduping, it might be over-thinking it a bit too much -- I believe it is mostly a corner case, and can be cleanly solved in user code with a simple .pipe(require('unique-stream')('path')) once we implement ordering.

@UltCombo
Copy link
Contributor Author

The main problem I see with supporting ordering and deduping options is that it'd be too much API pollution for unnecessary/simple abstractions.

Might as well recommend people to use gulp-add-src instead of implementing passthrough: true (plus unique-stream when that makes sense), dunno.


if (!isValidGlob(glob)) {
throw new Error('Invalid glob argument: ' + glob);
}
// return dead stream if empty array
if (Array.isArray(glob) && glob.length === 0) {
process.nextTick(pass.end.bind(pass));
var pass = through.obj();
Copy link
Member

Choose a reason for hiding this comment

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

var in an if block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@contra I don't really know what code style you want.

@UltCombo
Copy link
Contributor Author

@contra I don't really see what is wrong with var inside block, it is perfectly valid JS and if anything, as long as the given binding is only referenced inside the given block, eases the transition to ECMAScript 2015's block bindings (s/var/let/g or s/var/const/g).

Anyway, I've moved the var declarations to outside of blocks as requested.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.62%) to 97.47% when pulling 972c8ad on UltCombo:passthrough into 318a983 on wearefractal:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.62%) to 97.47% when pulling 972c8ad on UltCombo:passthrough into 318a983 on wearefractal:master.

@yocontra
Copy link
Member

@UltCombo It makes it harder to follow things imo - having vars at the top makes it easier to know what is in scope

yocontra pushed a commit that referenced this pull request Feb 19, 2015
Add `passthrough` option, fixes #25, fixes gulpjs/gulp#840
@yocontra yocontra merged commit 8dd0bb1 into gulpjs:master Feb 19, 2015
@UltCombo UltCombo deleted the passthrough branch February 19, 2015 06:28
@UltCombo
Copy link
Contributor Author

Alright, no prob. =]

@yocontra
Copy link
Member

Available on the gulp 4.0 branch now

phated pushed a commit that referenced this pull request Dec 5, 2017
Add `passthrough` option, fixes #25, fixes gulpjs/gulp#840
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.

3 participants