-
Notifications
You must be signed in to change notification settings - Fork 116
Apply SWC transformation on step functions returned from factory function #360
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
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
🦋 Changeset detectedLatest commit: 40ab768 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Nov 18, 2025
packages/swc-plugin-workflow/transform/tests/fixture/factory-with-step-method/output-client.js
Show resolved
Hide resolved
2ade117 to
3fbc15f
Compare
1f99feb to
95f5114
Compare
VaguelySerious
approved these changes
Nov 25, 2025
Member
Author
Merge activity
|
7e5fe40 to
40ab768
Compare
adriandlam
pushed a commit
that referenced
this pull request
Nov 25, 2025
…tion (#360) Added support for transforming step functions that are returned from factory functions. ### What changed? Enhanced the SWC plugin to detect and transform step functions that are defined within object literals returned by factory functions. The transformation now properly identifies arrow functions with object literal bodies and processes their step functions accordingly. Added test fixtures to verify the functionality: - Created test cases for a factory function that returns an object with a step method - Added corresponding output files for client, step, and workflow modes ### How to test? 1. Create a factory function that returns an object with methods marked as steps: ```javascript const myFactory = () => ({ myStep: async () => { 'use step'; await fs.mkdir('test'); }, }); ``` 2. Verify that the step function is properly transformed and registered when used in a workflow. ### Why make this change? This enhancement supports a common pattern where developers create factory functions that return objects containing step methods. Without this change, step functions defined in this pattern weren't being properly transformed, which limited the flexibility of the workflow system.
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.

Added support for transforming step functions that are returned from factory functions.
What changed?
Enhanced the SWC plugin to detect and transform step functions that are defined within object literals returned by factory functions. The transformation now properly identifies arrow functions with object literal bodies and processes their step functions accordingly.
Added test fixtures to verify the functionality:
How to test?
Why make this change?
This enhancement supports a common pattern where developers create factory functions that return objects containing step methods. Without this change, step functions defined in this pattern weren't being properly transformed, which limited the flexibility of the workflow system.