-
Notifications
You must be signed in to change notification settings - Fork 25
feat: Add support for intra resolve compiler mutations #118
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
base: main
Are you sure you want to change the base?
feat: Add support for intra resolve compiler mutations #118
Conversation
64be190
to
0e6f92e
Compare
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.
mrge found 2 issues across 2 files. Review them in mrge.io
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.
mrge found 2 issues across 2 files. Review them in mrge.io
7029a1a
to
4c0dd50
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #118 +/- ##
==========================================
- Coverage 86.71% 86.68% -0.03%
==========================================
Files 82 82
Lines 4071 4085 +14
==========================================
+ Hits 3530 3541 +11
- Misses 408 410 +2
- Partials 133 134 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Brian Kane <[email protected]>
4c0dd50
to
295a6bb
Compare
Description of your changes
Allows functions to be supplied into the CompilerOptions that will execute during the compilation process and allows mutations to be made on the cue value. These mutations run after initial parsing and before provider function resolution.
I have:
How has this code been tested
Compiler unit testing
Special notes for your reviewer
This feature won't do anything on it's own. This is to allow changes in the main Kubevela repo for loading of configuration within Components and Traits, in a similar fashion to the Trait
processing
field.e.g:
For this to work correctly, we need to load the config into the cue.Value{} after parsing but before CueX provider function processing, otherwise the use of a config field in the provider functions
$params
causes a compilation issue. To solve, the logic for reading the config will be moved from running after compilation in the template.go file, to being passed as a IntraResolveMutation that runs before provider function processing.i.e.
Summary by mrge
Added support for intra resolve mutations in the compiler, allowing custom mutations to run after parsing but before provider function resolution.
WithIntraResolveMutation
to let users inject mutation functions during compilation.