This repository has been archived by the owner on Feb 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pipeline): Introduced explicit, named extension points
The previous iteration of pipeline extensibility exposed an implementation detail (the function name) to enable extensibility, implicitly making each step in the pipeline a potential extension point, and worse, part of the API contract. This change introduces an explicit extension point marker, called `ext`. It can be used in two ways: (a) by setting the `ext` property of the function that you want to make an extension point to the name of the extension point (b) by calling the `ext(name)` chain method on `Pipeline`, which will set the extension point name for the last function added to the pipeline.
- Loading branch information
Showing
9 changed files
with
57 additions
and
19 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
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
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
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
It seems we now have three ways of defining a function name; alias, ext and name (the default one).
IMO, if we really want to store the name of the pipeline step inside the function, we really could just explicitly overwrite the name property as I have done in sequence.js…
IMO there still is a more fundamental underlying issue:
Specifying that the pipeline steps need to have their name in a property is relatively unusual, which means whether we use ext or .name, this is probably something new helix devs and external devs will run into when they write their first pipeline steps or when they refactor some functions. If we do not check for this it might actually lead to a lot of devs complaining pipeline extensions do not work, unless they have red the fine print in the api documentation specifying that the pipeline step's name is in .ext…
I think we can avoid this issue altogether and create a much smoother development experience by altering .before, .once, .after, … and the extension points to just explicitly take the name of the pipeline step to add…
There are two more reasons why I personally would prefer using an explicit name:
pug
pipeline; theparse
step would parse the pug template and in a further step we would parse inline markdown; this step could be calledparse-markdown
and might reuse the markdown parser pipeline step…