-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: optimise template string resolving performance (#6685)
* perf: optimise template string resolving performance We optimise the template string resolving performance by making sure that we only parse each template expression once. Once parsed, we use the AST to evaluate template expressions. * chore: fix lint issues * test: fix tests * chore: fix compilation and lint errors * chore: print details on assertion failure in `expectError` function * test: fix some assertions * fix: read raw template string from input * test: fix tests for `resolveTemplateString` * chore: return value instead of throwing * test: fix remaining resolveTemplateString tests Co-authored-by: Vladimir Vagaytsev <[email protected]> * fix: bug fix + unit test * fix: test failures * fix: always use error message from context if it's available * perf: optimize `ConfigContext.resolve` * perf: don't cache non-template strings and also cache unescape * test: fix "exposes arguments and options correctly in command templates" * fix: throw on critical errors while context resolution * test: fix assertions * test: fix undefined errors in ConfigContext tests Co-authored-by: Vladimir Vagaytsev <[email protected]> * test: fix remaining ConfigContext tests * wip: use static analysis instead of scancontext ScanContext does not work with AST, because it does not eagerly resolve all variables anymore. we have to walk the AST intead. * chore: lint fixes * chore: replace `ScanContext` with `NoOpContext` * test: consume generator in tests * test: fix "throws if action kind is not resolvable" * feat: allow referencing variables and evaluating complex expressions in action references * refactor: get rid of function `collectTemplateReferences` Co-authored-by: Steffen Neubauer <[email protected]> * refactor: introduce local variables * fix: module dependencies resolition * fix: restore module name filter * test: update assertion for circular dep error * chore: remove dead code * fix: handle all kinds of `GardenError` on the AST level * test: fix partial runtime resolution tests * fix: make sure that yaml path is included in template string errors Co-authored-by: Vladimir Vagaytsev <[email protected]> * refactor: make code safer and easier to reason about * improvement: minor improvements * test: additional tests * refactor: remove NoopContext * fix: handle further edge cases in `getContextLookupReferences` * fix: handle optional expressions in brackets correctly * fix: special edge case in module resolution flow * chore: fix lint --------- Co-authored-by: Vladimir Vagaytsev <[email protected]> Co-authored-by: Vladimir Vagaytsev <[email protected]>
- Loading branch information
1 parent
ce902db
commit a348564
Showing
34 changed files
with
2,738 additions
and
1,419 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
require: | ||
- build/test/setup.js | ||
- ../../../../build/test/setup.js | ||
watch-files: | ||
- build/**/* | ||
ignore: | ||
|
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
Oops, something went wrong.