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 option to specify order of taps #3

Merged
merged 2 commits into from
Dec 6, 2022

Conversation

KetanReddy
Copy link
Contributor

Adds a parameter before to specify which, if any, taps the new tap should be called before. This API exists in the original webpack implementation so this should bring it a bit more inline with it's API.

@@ -214,6 +220,17 @@ abstract class Hook<
};

this.taps.push(tap);
this.taps.sort((A, B) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have to sort it here because the new tap being added could be in the before of a previous tap. So all taps need to be reevaluated.

@KetanReddy KetanReddy marked this pull request as ready for review December 6, 2022 16:50
syncHook.tap("tap1", (input) => {
return [...input, 'tap1']
});
syncHook.tap({name: "tap2", before: "tap1"}, (input) => {
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add a test here for the array variant too?

@adierkens adierkens merged commit 28c6acf into adierkens:main Dec 6, 2022
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