-
Notifications
You must be signed in to change notification settings - Fork 424
JS AST templating and matching #5481
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
Merged
Merged
Conversation
This file contains hidden or 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
…ds with escape characters (#5476) * Added tests showing the issue * Added check to skip escaped '$' signs in build.groovy files * Added support for escaped $ in single quoted strings, added tests showing correct parsing, added test showing correct behavior
…th conjunctions (#5470) ensuring EE10 migration recipes (e.g. JavaxXmlToJakartaXmlXJCBinding) reliably match intended elements, regardless of whitespace. Co-authored-by: Torsten Liermann <[email protected]>
…if dependency is pulled in transitively (#5409) * RemoveRedundantDependencyVersions recipe removes direct dependencies if dependency is pulled in transitively * Polish * Can handle several boms * Added sorting to find highest dependency managed version * cleanup * extracted method out of loop * improved name, removed unused option * Added support for kotlin, added support for all dependency management methods. * renamed method * reverted temporary assignment for debug purposes --------- Co-authored-by: Johan Kragt <[email protected]>
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.gradle.UpdateGradleWrapper?organizationId=T3BlblJld3JpdGU%3D#defaults%3DW3sibmFtZSI6ImRpc3RyaWJ1dGlvbiIsInZhbHVlIjoiYmluIn0seyJuYW1lIjoiYWRkSWZNaXNzaW5nIiwidmFsdWUiOiJGYWxzZSJ9XQ%3D%3D Co-authored-by: Moderne <[email protected]>
* Add initial xml LST, jsx test * [wip] * JS: extract JSX children mapping to dedicated method Separate JSX-specific logic from the general-purpose `mapToRightPaddedList()` method by creating a dedicated `mapJsxChildren()` method. This improves code organization by keeping the general-purpose method clean and focused on its original purpose, while moving JSX-specific logic to a dedicated method. The change updates all JSX visitor methods (`visitJsxElement`, `visitJsxSelfClosingElement`, and `visitJsxFragment`) to use the new method, ensuring proper handling of JSX children and attributes. This approach makes the code more maintainable and easier to understand. All JSX tests now pass successfully. * Start updating Java code * Extend senders and receivers * Wait with types for `JSX.Tag` and `JSX.NamespacedName` * Polish JSX LST model * Fix bugs in sender and receiver logic for JSX * Adjust JSX LST model to account for member expressions * Update rewrite-javascript/src/main/java/org/openrewrite/javascript/tree/JSX.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update rewrite-javascript/src/main/java/org/openrewrite/javascript/tree/JSX.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Polish --------- Co-authored-by: Jonathan Schneider <[email protected]> Co-authored-by: Sam Snyder <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Fixing spaces for type declarations * Fixing spaces for type declarations
# Conflicts: # rewrite-javascript/rewrite/src/javascript/parser.ts
Maybe we don't need that.
Still unclear if we need `LeftPadded` etc. on the cursor stack.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new templating system that provides a clean, TypeScript-friendly API for JavaScript AST pattern matching and code generation using tagged template literals.
pattern()
- Pattern MatchingCreate patterns to match against AST nodes and extract matched captures:
template()
- AST GenerationGenerate new AST nodes from templates:
capture()
- Reusable PlaceholdersCreate placeholders for pattern matching and value reuse:
rewrite()
- Transformation RulesCombine patterns and templates into rewrite rules: