-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Breaking: Return wrapped task instead of original function, add unwra…
…p method to wrapper, update tests
- Loading branch information
Showing
5 changed files
with
38 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,7 @@ | ||
'use strict'; | ||
|
||
var metadata = require('./helpers/metadata'); | ||
|
||
function get(name) { | ||
var wrapper = this._registry.get(name); | ||
|
||
if (!wrapper) { | ||
return; | ||
} | ||
|
||
var meta = metadata.get(wrapper); | ||
|
||
if (meta) { | ||
return meta.orig; | ||
} | ||
|
||
return wrapper; | ||
return this._registry.get(name); | ||
} | ||
|
||
module.exports = get; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67fd02c
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.
which problems does this fix? Am I, as a consumer, expected to unwrap the tasks? Or what kind of implementation breaks when updating to 1.0.0?
My custom registry seems to work fine (ref Xiphe/gulp-toolbox-registry#64), but I'm not really sure if I miss some implications here :)
67fd02c
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.
@Xiphe the only thing that this changes (for gulp) is that
gulp.task('css') !== cssFn
where it used to. Also, aliased tasks get wrapped an extra time.unwrap()
isn't really expected to be used (other than testing) but I wanted to allow people to get the original function if they needed to for some reason.Side note: custom registries have always received the wrapped task and didn't operate on the original function.
67fd02c
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.
The biggest implication of this is that it solves gulpjs/gulp#1492
67fd02c
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.
🎉 great! thanks for the explanation