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 httpyac runtime reference to plugin api #144

Merged
merged 2 commits into from Dec 3, 2021

Conversation

fredrikhr
Copy link
Contributor

@fredrikhr fredrikhr commented Dec 2, 2021

Adds a new property httpyac to the HttpyacHooksApi type.

Adds a new property utils to the to the HttpyacHooksApi type.

This will enable a plugin or a configureHooks function provided by .httpyac.js to use the exported functions in the httpyac module from memory without the need of resolving/requiring the module.

This has the benefit that a no-dependencies plugin or a standalone .httpyac.js can run in the context of httpyac without any additional steps. It will also ensure that a plugin sees the same APIs as the runtime it is extending. Typically a plugin could now only add a devDependency on httpyac to get type definitions, but the original way of doing thing would still work seamlessly (you'd just ignore the new property).

@AnWeber
Copy link
Owner

AnWeber commented Dec 2, 2021

I find the move relatively dangerous. Since I currently export all methods on purpose and they are more or less public. However, this limits me a lot when refactoring. Refactoring will be necessary for the switch to esm and to support vscode.dev.
This will probably not affect the utils methods. But the structure for parser, action and variables will change.
I can merge the PR, but only under the restriction that breaking changes can occur here without notice. I will add a warning to documentation.

@fredrikhr
Copy link
Contributor Author

Hmm, I see that... I actually was mostly interested in the utils anyways, maybe we can add that instead then?

@AnWeber
Copy link
Owner

AnWeber commented Dec 2, 2021

utils would be better. Here it is easier to provide methods in case of error in a backward compatible way. Are you changing your PR to reflect that?

@fredrikhr
Copy link
Contributor Author

Will do tomorrow 👍

@fredrikhr
Copy link
Contributor Author

@AnWeber done in fb92411

@AnWeber
Copy link
Owner

AnWeber commented Dec 3, 2021

Thx

@AnWeber AnWeber merged commit 1a9bf09 into AnWeber:main Dec 3, 2021
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.

None yet

2 participants